Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
$this->src("db")
->query('CALL getTeacherSchedule(:year, :teacher_id)')
->params(array(
':year' => $this->params['year'],
':teacher_id' => $this->params['teacher_id']
))
->saveTo($node1);
foreach ($this->teachersList as $teacher) {
$node1->pipe( new Filter( array (
array("teacher_id", "=", $teacher['id']),
"or",
array("teacher_id","findInSet",$teacher['id']),
)))
->pipe(new \koolreport\processes\Map(array(
"{value}" => function($row) {
$row['class_name'] =
//$row['class_name'].'<br>'.
( $this->params['show_class'] != null ? $row['class_name'] != '' ? $row['class_name'] : lang('tts.no_class') : null ).'<br>'.
( $this->params['show_profession'] != null ? $row['profession_name'] : null ).'<br>'.
( $this->params['show_room'] != null ? $row['room_name'] : null );
if ( $this->params['teacher_id'] != 0 ) {
$this->teachersList[0]['teacher_name'] = $row['teacher_name'];
}
return $row;
},
)))
->pipe(new \koolreport\processes\Map(array(
"{end}" => function($count, $mapState) {
$emptyRows = [];
//$days = [1, 2, 3, 4, 5, 6]; //use day name if it's your case
foreach ($_SESSION['settings']->allowed_days as $key => $day) {
if ($day == true) {
foreach ($_SESSION['settings']->allowed_hours as $h_key => $hour) {
if ($hour == true) {
$emptyRows[] = ['day' => $key, 'hour_num' => $h_key];
}
}
}
}
return $emptyRows;
}
)))
->pipe(new Cube(array(
'row' => 'hour_num',
'column' => 'day',
'max' => 'class_name'
)))
->pipe(new koolreport\processes\ColumnsSort(array(
"{name}" => "asc", //or "desc" or function($colName1, $colName2) {...}
)))
->pipe(new \koolreport\processes\Map(array(
"{value}" => function($row) {
foreach ($row as $k => $v)
if ($v == null) $row[$k] = "";
return $row;
}
)))
->pipe(new \koolreport\processes\RemoveColumn(array(
'{{all}}','{{others}}'
)))
->pipe(new \koolreport\processes\Map(array(
"{meta}" => function($meta) {
$colMetas = $meta["columns"];
foreach ($colMetas as $colKey => $colMeta) {
if (is_numeric($colKey)) {
$colMetas[$colKey]['label'] = lang("tts.day_$colKey"); //for columns '1', '2', etc
$colMetas[$colKey]['cssStyle'] = "width: 120px";
}
else {
$colMetas[$colKey]['label'] = lang("tts.$colKey"); //for column 'hour_num'
$colMetas[$colKey]['cssStyle'] = "width: 80px";
}
}
$meta["columns"] = $colMetas;
return $meta;
}
)))
->pipe($this->dataStore("DS_" . $teacher['id']));
Yes it did. I had to solve the issue from the stored procedure side to eliminate any Null that i have in one of the (row, column, max) columns that I return. Before I did so I can assure you that even after using the code above using the RemoveColumn the column {{others}} still appears.
We tested RemoveColumn for "{{others}}" column after Cube process and found that the column was remove like any column did normally. We suggest next time you only keep the Cube and RemoveColumn processes and remove all the other codes. Then check the datastore to see the result.
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo