/** * Constructor */ public function ResultTable($evaluation, $results = array(), $iscourse, $addparams = null, $forprint = false) { parent::__construct('resultlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1); $this->datagen = new ResultsDataGenerator($evaluation, $results, true); $this->evaluation = $evaluation; $this->iscourse = $iscourse; $this->forprint = $forprint; if (isset($addparams)) { $this->set_additional_parameters($addparams); } $scoredisplay = ScoreDisplay::instance(); $column = 0; if ($this->iscourse == '1') { $this->set_header($column++, '', false); $this->set_form_actions(array('delete' => get_lang('Delete'))); } if (api_is_western_name_order()) { $this->set_header($column++, get_lang('FirstName')); $this->set_header($column++, get_lang('LastName')); } else { $this->set_header($column++, get_lang('LastName')); $this->set_header($column++, get_lang('FirstName')); } $this->set_header($column++, get_lang('Score')); if ($scoredisplay->is_custom()) { $this->set_header($column++, get_lang('Display')); } if (!$this->forprint) { $this->set_header($column++, get_lang('Modify'), false); } }
/** * Constructor * @param Category $currentcat * @param array $cats * @param array $evals * @param array $links * @param null $addparams */ public function __construct($currentcat, $cats = array(), $evals = array(), $links = array(), $addparams = null, $exportToPdf = false, $showTeacherView = null, $userId = null, $studentList = array()) { $this->teacherView = is_null($showTeacherView) ? api_is_allowed_to_edit(null, true) : $showTeacherView; $this->userId = is_null($userId) ? api_get_user_id() : $userId; $this->exportToPdf = $exportToPdf; parent::__construct('gradebooklist', null, null, api_is_allowed_to_edit() ? 1 : 0, 20, 'ASC', 'gradebook_list'); $this->evals_links = array_merge($evals, $links); $this->currentcat = $currentcat; $this->cats = $cats; $this->datagen = new GradebookDataGenerator($cats, $evals, $links); if (!empty($userId)) { $this->datagen->userId = $userId; } if (isset($addparams)) { $this->set_additional_parameters($addparams); } $column = 0; if ($this->teacherView) { if ($this->exportToPdf == false) { $this->set_header($column++, '', '', 'width="25px"'); } } $this->set_header($column++, get_lang('Type'), '', 'width="35px"'); $this->set_header($column++, get_lang('Name'), false); if ($this->exportToPdf == false) { $this->set_header($column++, get_lang('Description'), false); } if ($this->teacherView) { $this->set_header($column++, get_lang('Weight'), '', 'width="100px"'); } else { $this->set_header($column++, get_lang('Weight'), false); $this->set_header($column++, get_lang('Result'), false); $this->set_header($column++, get_lang('Ranking'), false); $this->set_header($column++, get_lang('BestScore'), false); $this->set_header($column++, get_lang('Average'), false); if (!empty($cats)) { if ($this->exportToPdf == false) { $this->set_header($column++, get_lang('Actions'), false); } } } // Deactivates the odd/even alt rows in order that the +/- buttons work see #4047 $this->odd_even_rows_enabled = false; // Admins get an edit column. if ($this->teacherView) { $this->set_header($column++, get_lang('Modify'), false, 'width="195px"'); // Actions on multiple selected documents. $this->set_form_actions(array('setvisible' => get_lang('SetVisible'), 'setinvisible' => get_lang('SetInvisible'), 'deleted' => get_lang('DeleteSelected'))); } else { if (empty($_GET['selectcat']) && !$this->teacherView) { if ($this->exportToPdf == false) { $this->set_header($column++, get_lang('Certificates'), false); } } } }
/** * Constructor */ function FlatViewTable($selectcat, $users = array(), $evals = array(), $links = array(), $limit_enabled = false, $offset = 0, $addparams = null) { parent::__construct('flatviewlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 1 : 0); $this->selectcat = $selectcat; $this->datagen = new FlatViewDataGenerator($users, $evals, $links, array('only_subcat' => $this->selectcat->get_id())); $this->limit_enabled = $limit_enabled; $this->offset = $offset; if (isset($addparams)) { $this->set_additional_parameters($addparams); } // step 2: generate rows: students $this->datagen->category = $this->selectcat; }
/** * Constructor */ function GradebookTable($currentcat, $cats = array(), $evals = array(), $links = array(), $addparams = null) { //$status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id()); parent::__construct('gradebooklist', null, null, api_is_allowed_to_edit() ? 1 : 0); $this->evals_links = array_merge($evals, $links); $this->currentcat = $currentcat; $this->cats = $cats; $this->datagen = new GradebookDataGenerator($cats, $evals, $links); if (isset($addparams)) { $this->set_additional_parameters($addparams); } $column = 0; if (api_is_allowed_to_edit(null, true)) { $this->set_header($column++, '', '', 'width="25px"'); } $this->set_header($column++, get_lang('Type'), '', 'width="35px"'); $this->set_header($column++, get_lang('Name'), false); $this->set_header($column++, get_lang('Description'), false); if (api_is_allowed_to_edit(null, true)) { $this->set_header($column++, get_lang('Weight'), '', 'width="100px"'); } else { $this->set_header($column++, get_lang('Weight'), false); $this->set_header($column++, get_lang('Result'), false); if (!empty($cats)) { $this->set_header($column++, get_lang('Actions'), false); } } //Desactivates the odd/even alt rows in order that the +/- buttons work see #4047 $this->odd_even_rows_enabled = false; /*if (api_is_allowed_to_edit(null, true)) { //$this->set_header($column++, get_lang('CreationDate'),true, 'width="100px"'); } elseif (($status<>1) && !api_is_allowed_to_edit() && (!isset($_GET['selectcat']) || $_GET['selectcat']==0)) { //$this->set_header($column++, get_lang('Date'),true, 'width="100px"'); }*/ //admins get an edit column if (api_is_allowed_to_edit(null, true)) { $this->set_header($column++, get_lang('Modify'), false, 'width="195px"'); //actions on multiple selected documents $this->set_form_actions(array('setvisible' => get_lang('SetVisible'), 'setinvisible' => get_lang('SetInvisible'), 'deleted' => get_lang('DeleteSelected'))); } else { if (empty($_GET['selectcat']) && !api_is_allowed_to_edit()) { $this->set_header($column++, get_lang('Certificates'), false); } else { //$evals_links = array_merge($evals, $links); //if (count($evals_links)>0) { //$this->set_header($column++, get_lang('Results'), false); //} } } }
/** * Constructor */ public function __construct($userid, $evals = array(), $links = array(), $addparams = null) { parent::__construct('userlist', null, null, 0); $this->userid = $userid; $this->datagen = new UserDataGenerator($userid, $evals, $links); if (isset($addparams)) { $this->set_additional_parameters($addparams); } $column = 0; $this->set_header($column++, get_lang('Type')); $this->set_header($column++, get_lang('Evaluation')); $this->set_header($column++, get_lang('Course')); $this->set_header($column++, get_lang('Category')); $this->set_header($column++, get_lang('EvaluationAverage')); $this->set_header($column++, get_lang('Result')); $scoredisplay = ScoreDisplay::instance(); if ($scoredisplay->is_custom()) { $this->set_header($column++, get_lang('Display')); } }
/** * Constructor * @param array $table_data All the information of the table * @param int $default_column Default column that will be use in the sorts functions * @param int $default_items_per_page quantity of pages that we are going to see * @param int $tablename Name of the table * @param array $column_show An array with binary values 1: we show the column 2: we don't show it * @param array $column_order An array of integers that let us decide how the columns are going to be sort. * @param string $direction * @param bool $doc_filter special modification to fix the document name order */ public function __construct($table_data, $default_column = 1, $default_items_per_page = 20, $tablename = 'tablename', $column_show = array(), $column_order = array(), $direction = 'ASC', $doc_filter = false) { $this->column_show = $column_show; $this->column_order = $column_order; $this->doc_filter = $doc_filter; parent::__construct($tablename, null, null, $default_column, $default_items_per_page, $direction); $this->table_data = $table_data; }