if (isset($data->user_columns)) { $columns = array_merge($columns, $data->user_columns); } if (isset($data->course_columns)) { $columns = array_merge($columns, $data->course_columns); } if (isset($data->course_completions_columns)) { $columns = array_merge($columns, $data->course_completions_columns); } if (isset($data->course_categories_columns)) { $columns = array_merge($columns, $data->course_categories_columns); } // Pass only the columns selected for the table. Joins are implied by the // report type selected $report->set_columns($columns); $report->set_order_by($data->order_by); for ($i = 0; $i < $data->where_num; $i++) { if ($data->where_col[$i] != '-') { $report->add_where_clause(array($data->where_col[$i], $data->where_op[$i], $data->where_filter[$i])); } } } else { // this branch is executed if the form is submitted but // the data doesn't validate and the form should be // redisplayed or on the first display of the form. $title = 'Select Options for ' . $type . ' Table'; } $PAGE->set_heading($title); $PAGE->set_title($title); echo $OUTPUT->header(); ?>