diff --git a/app/Migrations/Schema/V111/Version111.php b/app/Migrations/Schema/V111/Version111.php index e7fd01b58e..773b017984 100644 --- a/app/Migrations/Schema/V111/Version111.php +++ b/app/Migrations/Schema/V111/Version111.php @@ -260,9 +260,16 @@ class Version111 extends AbstractMigrationChamilo $this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('ticket_allow_student_add', NULL, 'radio','Ticket', 'false','TicketAllowStudentAddTitle','TicketAllowStudentAddComment',NULL,NULL, 0)"); $this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('ticket_allow_category_edition', NULL, 'radio','Ticket', 'false','TicketAllowCategoryEditionTitle','TicketAllowCategoryEditionComment',NULL,NULL, 0)"); + $this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('ticket_send_warning_to_all_admins', NULL, 'radio','Ticket', 'false','TicketSendWarningToAllAdminsTitle','TicketSendWarningToAllAdminsComment',NULL,NULL, 0)"); + $this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('ticket_warn_admin_no_user_in_category', NULL, 'radio','Ticket', 'false','TicketWarnAdminNoUserInCategoryTitle','TicketWarnAdminNoUserInCategoryComment',NULL,NULL, 0)"); $this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('ticket_allow_student_add', 'true', 'Yes'), ('ticket_allow_student_add', 'false', 'No')"); $this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('ticket_allow_category_edition', 'true', 'Yes'), ('ticket_allow_category_edition', 'false', 'No')"); + $this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('ticket_send_warning_to_all_admins', 'true', 'Yes'), ('ticket_send_warning_to_all_admins', 'false', 'No')"); + $this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('ticket_warn_admin_no_user_in_category', 'true', 'Yes'), ('ticket_warn_admin_no_user_in_category', 'false', 'No')"); + $this->addSql("ALTER TABLE c_quiz_question_rel_category ADD INDEX idx_qqrc_qid (question_id)"); + $this->addSql("ALTER TABLE c_quiz_answer ADD INDEX idx_cqa_q (question_id)"); + $this->addSql("ALTER TABLE c_student_publication ADD INDEX idx_csp_u (user_id)"); } } diff --git a/documentation/optimization.html b/documentation/optimization.html index e0c23cbea0..6cb09dba92 100755 --- a/documentation/optimization.html +++ b/documentation/optimization.html @@ -351,10 +351,13 @@ alter table c_quiz_rel_question ADD INDEX idx_cqrq_qid (question_id); alter table c_quiz_rel_question ADD INDEX idx_cqrq_cid (c_id); alter table c_quiz_answer add index idx_qa_cidqid (c_id, question_id); +In Chamilo 1.10.6, an additional query was confirmed to still have effect a considerable effect: +
+alter table c_quiz_question_rel_category add index idx_qqrc_qid (question_id); +
'; + echo ''; + echo ''; echo ''; echo "".get_lang('All').""; echo "".get_lang('None').""; echo '
'; - + echo ''; foreach ($resources as $id => $resource) { if ($resource) { + echo '
'; + echo '- '; // Event obj in 1.9.x in 1.10.x the class is CalendarEvent Coursecopy\Resource::setClassType($resource); echo ''; + echo '
'; } } - echo ''; + echo '
'; diff --git a/main/gradebook/certificate_template/template.html b/main/gradebook/certificate_template/template.html index 2d55544444..047e94eac9 100644 --- a/main/gradebook/certificate_template/template.html +++ b/main/gradebook/certificate_template/template.html @@ -1,10 +1,12 @@ - + +((course_title)) - ((user_firstname)) ((user_lastname)) - ((date_certificate_no_time)) +diff --git a/main/gradebook/exercise_jump.php b/main/gradebook/exercise_jump.php index c80c7e1b6f..8c154c5386 100755 --- a/main/gradebook/exercise_jump.php +++ b/main/gradebook/exercise_jump.php @@ -22,7 +22,7 @@ $type = Security::remove_XSS($_GET['type']); $doExerciseUrl = ''; if (isset($_GET['doexercise'])) { - $doExerciseUrl = api_get_path(WEB_CODE_PATH) . 'exercise/overview.php?' . http_build_query([ + $doExerciseUrl = api_get_path(WEB_CODE_PATH) . 'exercice/overview.php?' . http_build_query([ 'session_id' => $session_id, 'cidReq' => $cidReq, 'gradebook' => $gradebook, diff --git a/main/inc/ajax/admin.ajax.php b/main/inc/ajax/admin.ajax.php index 2f8223a3fe..01eb70c0e4 100755 --- a/main/inc/ajax/admin.ajax.php +++ b/main/inc/ajax/admin.ajax.php @@ -127,6 +127,10 @@ function check_system_version() // The number of sessions $number_of_sessions = Statistics::countSessions(); + $packager = api_get_configuration_value('packager'); + if (empty($packager)) { + $packager = 'chamilo'; + } $data = array( 'url' => api_get_path(WEB_PATH), @@ -144,6 +148,11 @@ function check_system_version() 'language' => api_get_setting('platformLanguage'), //helps us know the spread of language usage for campuses, by main language 'adminname' => api_get_setting('administratorName').' '.api_get_setting('administratorSurname'), //not sure this is necessary... 'ip' => $_SERVER['REMOTE_ADDR'], //the admin's IP address, with the only purpose of trying to geolocate portals around the globe to draw a map + // Reference to the packager system or provider through which + // Chamilo is installed/downloaded. Packagers can change this in + // the default config file (main/install/configuration.dist.php) + // or in the installed config file. The default value is 'chamilo' + 'packager' => $packager, ); $version = null; // version.php has been updated to include the version in an HTTP header @@ -182,14 +191,13 @@ function check_system_version() /** * Function to make an HTTP request through fsockopen (specialised for GET) * Derived from Jeremy Saintot: http://www.php.net/manual/en/function.fsockopen.php#101872 - * @param string IP or hostname - * @param int Target port - * @param string URI (defaults to '/') - * @param array GET data - * @param float Timeout - * @param bool Include HTTP Request headers? - * @param bool Include HTTP Response headers? - * @param string $ip + * @param string $ip IP or hostname + * @param int $port Target port + * @param string $uri URI (defaults to '/') + * @param array $getdata GET data + * @param int $timeout Timeout + * @param bool $req_hdr Include HTTP Request headers? + * @param bool $res_hdr Include HTTP Response headers? * @return string */ function _http_request($ip, $port = 80, $uri = '/', $getdata = array(), $timeout = 5, $req_hdr = false, $res_hdr = false) diff --git a/main/inc/global.inc.php b/main/inc/global.inc.php index f2dde8d0b9..13fc02654d 100755 --- a/main/inc/global.inc.php +++ b/main/inc/global.inc.php @@ -24,13 +24,6 @@ // Showing/hiding error codes in global error messages. define('SHOW_ERROR_CODES', false); -// Make sure the CHAMILO_LOAD_WYSIWYG constant is defined -// To remove CKeditor libs from HTML, set this constant to true before loading -// global.inc.php -if (!defined('CHAMILO_LOAD_WYSIWYG')) { - define('CHAMILO_LOAD_WYSIWYG', true); -} - // Include the libraries that are necessary everywhere require_once __DIR__.'/../../vendor/autoload.php'; require_once __DIR__.'/../../app/AppKernel.php'; @@ -442,7 +435,7 @@ if (!empty($valid_languages)) { $language_interface = api_get_language_from_type($language_priority4); } else { $language_interface = api_get_setting('platformLanguage'); - } + } if (!empty($language_priority3) && api_get_language_from_type($language_priority3) !== false) { $language_interface = api_get_language_from_type($language_priority3); diff --git a/main/inc/lib/TicketManager.php b/main/inc/lib/TicketManager.php index 3067a3c992..3bcfb5be0e 100644 --- a/main/inc/lib/TicketManager.php +++ b/main/inc/lib/TicketManager.php @@ -1,6 +1,10 @@ $categoryId, - 'user_id' => $userId + 'user_id' => $userId, ]; Database::insert($table, $params); } @@ -331,7 +335,6 @@ class TicketManager 'project_id' => $project_id, 'category_id' => $category_id, 'priority_id' => $priority, - 'course_id' => $course_id, 'personal_email' => $personalEmail, 'status_id' => $status, 'start_date' => $now, @@ -344,6 +347,11 @@ class TicketManager 'subject' => $subject, 'message' => $content ]; + + if (!empty($course_id)) { + $params['course_id'] = $course_id; + } + $ticket_id = Database::insert($table_support_tickets, $params); if ($ticket_id) { @@ -375,13 +383,13 @@ class TicketManager // Update code $sql = "UPDATE $table_support_tickets SET code = '$ticket_code' - WHERE ticket_id = '$ticket_id'"; + WHERE id = '$ticket_id'"; Database::query($sql); // Update total $sql = "UPDATE $table_support_category SET total_tickets = total_tickets + 1 - WHERE category_id = '$category_id'"; + WHERE id = $category_id"; Database::query($sql); $user = api_get_user_info($assigned_user); @@ -418,7 +426,8 @@ class TicketManager '; if (empty($category_id)) { - if ($plugin->get('send_warning_to_all_admins')) { + + if (api_get_setting('ticket_send_warning_to_all_admins') == 'true') { $warningSubject = sprintf( get_lang('TicketXCreatedWithNoCategory'), $ticket_code @@ -442,7 +451,7 @@ class TicketManager $message = ''.get_lang('TicketInformation').'
'.$helpDeskMessage; - if ($plugin->get('warn_admin_no_user_in_category')) { + if (api_get_setting('ticket_warn_admin_no_user_in_category') == 'true') { $usersInCategory = TicketManager::getUsersInCategory($category_id); if (empty($usersInCategory)) { $subject = sprintf( @@ -450,7 +459,7 @@ class TicketManager $categoryInfo['name'] ); - if ($plugin->get('send_warning_to_all_admins')) { + if (api_get_setting('ticket_send_warning_to_all_admins') == 'true') { Display::addFlash(Display::return_message( sprintf( get_lang('CategoryWithNoUserNotificationSentToAdmins'), @@ -577,7 +586,7 @@ class TicketManager 'ticket_id' => $ticket_id, 'user_id' => $user_id, 'assigned_date' => $now, - 'sys_insert_user_id' => $insert_id + 'sys_insert_user_id' => $insert_id, ]; Database::insert($table_support_assigned_log, $params); @@ -612,7 +621,7 @@ class TicketManager null, // sender name null, // sender e-mail array( - 'cc' => $sender['email'] + 'cc' => $sender['email'], ) // should be support e-mail (platform admin) here ); } @@ -677,7 +686,7 @@ class TicketManager 'sys_insert_datetime' => $now, 'sys_lastedit_user_id' => $user_id, 'sys_lastedit_datetime' => $now, - 'status' => $status + 'status' => $status, ]; Database::insert($table_support_messages, $params); @@ -788,7 +797,7 @@ class TicketManager return array( 'path' => $path_message_attach . $safe_new_file_name, - 'filename' => $safe_file_name + 'filename' => $safe_file_name, ); } } @@ -1046,7 +1055,7 @@ class TicketManager $name, $row['assigned_last_user'], $row['col7'], - $row['col8'] + $row['col8'], ); } else { $actions = ''; @@ -1059,7 +1068,7 @@ class TicketManager $dif = $now - $last_edit_date; if ($dif > 172800 && $row['priority_id'] === self::PRIORITY_NORMAL && $row['status_id'] != self::STATUS_CLOSE) { - $actions .= ' + $actions .= ' '; } if ($row['priority_id'] === self::PRIORITY_HIGH) { @@ -1070,7 +1079,7 @@ class TicketManager api_format_date($row['col1'], '%d/%m/%y - %I:%M:%S %p'), api_format_date($row['col2'], '%d/%m/%y - %I:%M:%S %p'), $row['col3'], - $row['col7'] + $row['col7'], ); } /*if ($unread > 0) { @@ -1467,7 +1476,7 @@ class TicketManager 'priority_id' => isset($params['priority_id']) ? $params['priority_id'] : '', 'status_id' => isset($params['status_id']) ? $params['status_id'] : '', 'sys_lastedit_user_id' => $userId, - 'sys_lastedit_datetime' => $now + 'sys_lastedit_datetime' => $now, ]; Database::update($table, $newParams, ['id = ? ' => $ticketId]); @@ -1574,8 +1583,8 @@ class TicketManager } /** - * @param $ticket_id - * @param $user_id + * @param int $ticket_id + * @param int $user_id */ public static function close_ticket($ticket_id, $user_id) { @@ -1838,7 +1847,7 @@ class TicketManager utf8_decode('Estado'), utf8_decode('Mensajes'), utf8_decode('Responsable'), - utf8_decode('Programa') + utf8_decode('Programa'), ); while ($row = Database::fetch_assoc($result)) { @@ -1876,18 +1885,135 @@ class TicketManager return $form; } - public static function getProjects() + /** + * @return array + */ + public static function getStatusList() { - $em = Database::getManager()->getRepository('ChamiloTicketBundle')->findAll(); + $projects = Database::getManager()->getRepository('ChamiloTicketBundle:Status')->findAll(); - return $em; + $list = []; + /** @var \Chamilo\TicketBundle\Entity\Status $row */ + foreach ($projects as $row) { + $list[$row->getId()] = $row->getName(); + } + + return $list; } + /** + * @return array + */ + public static function getPriorityList() + { + $projects = Database::getManager()->getRepository('ChamiloTicketBundle:Priority')->findAll(); + + $list = []; + /** @var \Chamilo\TicketBundle\Entity\Priority $row */ + foreach ($projects as $row) { + $list[$row->getId()] = $row->getName(); + } + + return $list; + } + + + /** + * @return array + */ + public static function getProjects() + { + $projects = Database::getManager()->getRepository('ChamiloTicketBundle:Project')->findAll(); + + $list = []; + /** @var Project $row */ + foreach ($projects as $row) { + $list[] = [ + 'id' => $row->getId(), + '0' => $row->getId(), + '1' => $row->getName(), + '2' => $row->getDescription(), + '3' => $row->getId() + ]; + } + return $list; + } + + /** + * @return int + */ public static function getProjectsCount() { - $em = Database::getManager()->getRepository('ChamiloTicketBundle')->findAll(); + $count = Database::getManager()->getRepository('ChamiloTicketBundle:Project')->createQueryBuilder('p') + ->select('COUNT(p.id)') + ->getQuery() + ->getSingleScalarResult(); - return $em; + return $count; + } + + /** + * @param array $params + */ + public static function addProject($params) + { + $project = new Project(); + $project->setName($params['name']); + $project->setDescription($params['description']); + $project->setInsertUserId(api_get_user_id()); + //$project->setEmail($params['email']); + + Database::getManager()->persist($project); + Database::getManager()->flush(); + } + + /** + * @param $id + * @return Project + */ + public static function getProject($id) + { + return Database::getManager()->getRepository('ChamiloTicketBundle:Project')->find($id); + } + + /** + * @param int $id + * @param array $params + */ + public static function updateProject($id, $params) + { + $project = self::getProject($id); + $project->setName($params['name']); + $project->setDescription($params['description']); + $project->setLastEditDateTime(new DateTime($params['sys_lastedit_datetime'])); + $project->setLastEditUserId($params['sys_lastedit_user_id']); + + Database::getManager()->merge($project); + Database::getManager()->flush(); + } + + /** + * @param int $id + */ + public static function deleteProject($id) + { + $project = self::getProject($id); + Database::getManager()->remove($project); + Database::getManager()->flush(); + } + + /** + * @param string $url + * @return FormValidator + */ + public static function getProjectForm($url) + { + $form = new FormValidator('project', 'post', $url); + $form->addText('name', get_lang('Name')); + $form->addHtmlEditor('description', get_lang('Description')); + $form->addButtonUpdate(get_lang('Save')); + + return $form; } } diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php index 3c6d6f3324..1d2c6cf20f 100644 --- a/main/inc/lib/api.lib.php +++ b/main/inc/lib/api.lib.php @@ -571,6 +571,12 @@ define('SHORTCUTS_VERTICAL', 1); // Image class define('IMAGE_PROCESSOR', 'gd'); // 'imagick' or 'gd' strings +// Make sure the CHAMILO_LOAD_WYSIWYG constant is defined +// To remove CKeditor libs from HTML, set this constant to true before loading +if (!defined('CHAMILO_LOAD_WYSIWYG')) { + define('CHAMILO_LOAD_WYSIWYG', true); +} + /** * Inclusion of internationalization libraries */ diff --git a/main/inc/lib/document.lib.php b/main/inc/lib/document.lib.php index 5c08e5bcc0..9ed8955ad7 100755 --- a/main/inc/lib/document.lib.php +++ b/main/inc/lib/document.lib.php @@ -364,8 +364,10 @@ class DocumentManager $content_type = self::file_get_mime_type($filename); $lpFixedEncoding = api_get_configuration_value('lp_fixed_encoding'); - header('Expires: Wed, 01 Jan 1990 00:00:00 GMT'); - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + // Comented to let courses content to be cached in order to improve performance: + //header('Expires: Wed, 01 Jan 1990 00:00:00 GMT'); + //header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + // Commented to avoid double caching declaration when playing with IE and HTTPS //header('Cache-Control: no-cache, must-revalidate'); //header('Pragma: no-cache'); @@ -1901,6 +1903,13 @@ class DocumentManager $url = api_get_path(WEB_PATH) . 'certificates/index.php?id=' . $info_grade_certificate['id']; + $externalStyleFile = api_get_path(SYS_CSS_PATH) . 'themes/' . api_get_visual_theme() . '/certificate.css'; + $externalStyle = ''; + + if (is_file($externalStyleFile)) { + $externalStyle = file_get_contents($externalStyleFile); + } + //replace content $info_to_replace_in_content_html = array( $first_name, @@ -1918,6 +1927,7 @@ class DocumentManager $url, '' . get_lang('CertificateOnlineLink') . '', '((certificate_barcode))', + $externalStyle ); $info_to_be_replaced_in_content_html = array('((user_firstname))', @@ -1935,6 +1945,7 @@ class DocumentManager '((certificate_link))', '((certificate_link_html))', '((certificate_barcode))', + '((external_style))' ); if (!empty($extraFields)) { diff --git a/main/inc/lib/legal.lib.php b/main/inc/lib/legal.lib.php index c00a515fe6..b21ebb522a 100755 --- a/main/inc/lib/legal.lib.php +++ b/main/inc/lib/legal.lib.php @@ -44,7 +44,7 @@ class LegalManager Database::insert($legal_table, $params); return true; - } elseif($last['type'] != $type && $language==$last['language_id']) { + } elseif($last['type'] != $type && $language == $last['language_id']) { //update $id = $last['legal_id']; $params = [ @@ -56,10 +56,14 @@ class LegalManager return true; } else { + return false; } } + /** + * @param int $id + */ public static function delete($id) { /* @@ -137,7 +141,7 @@ class LegalManager /** * Show the last condition - * @param array with type and content i.e array('type'=>'1', 'content'=>'hola'); + * @param array $term_preview with type and content i.e array('type'=>'1', 'content'=>'hola'); * * @return string html preview */ @@ -172,9 +176,9 @@ class LegalManager /** * Get the terms and condition table (only for maintenance) - * @param int offset - * @param int number of items - * @param int column + * @param int $from + * @param int $number_of_items + * @param int $column * @return array */ public static function get_legal_data($from, $number_of_items, $column) @@ -191,19 +195,21 @@ class LegalManager $sql .= "LIMIT $from, $number_of_items "; $result = Database::query($sql); - $legals = array (); - $versions = array (); + $legals = array(); + $versions = array(); while ($legal = Database::fetch_array($result)) { // max 2000 chars //echo strlen($legal[1]); echo '
'; - $versions[]=$legal[0]; - $languages[]=$legal[1]; - if (strlen($legal[2])>2000) - $legal[2]= substr($legal[2],0,2000).' ... '; - if ($legal[4]==0) - $legal[4]= get_lang('HTMLText'); - elseif($legal[4]==1) - $legal[4]=get_lang('PageLink'); + $versions[] = $legal[0]; + $languages[] = $legal[1]; + if (strlen($legal[2]) > 2000) { + $legal[2] = substr($legal[2], 0, 2000).' ... '; + } + if ($legal[4] == 0) { + $legal[4] = get_lang('HTMLText'); + } elseif ($legal[4] == 1) { + $legal[4] = get_lang('PageLink'); + } $legals[] = $legal; } return $legals; @@ -228,8 +234,8 @@ class LegalManager /** * Get type of terms and conditions - * @param int The legal id - * @param int The language id + * @param int $legal_id + * @param int $language_id * @return int The current type of terms and conditions */ public static function get_type_of_terms_and_conditions($legal_id, $language_id) diff --git a/main/inc/lib/login.lib.php b/main/inc/lib/login.lib.php index 7b15c31b71..71cb6c011a 100755 --- a/main/inc/lib/login.lib.php +++ b/main/inc/lib/login.lib.php @@ -99,7 +99,12 @@ class Login $email_body = get_lang('YourAccountParam') . " " . $portal_url . "\n\n$user_account_list"; // SEND MESSAGE - $sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); + $sender_name = api_get_person_name( + api_get_setting('administratorName'), + api_get_setting('administratorSurname'), + null, + PERSON_NAME_EMAIL_ADDRESS + ); $email_admin = api_get_setting('emailAdministrator'); if (api_mail_html('', $email_to, $email_subject, $email_body, $sender_name, $email_admin) == 1) { @@ -175,7 +180,10 @@ class Login api_get_setting('administratorSurname') ) ); - $message = sprintf(get_lang('ThisPlatformWasUnableToSendTheEmailPleaseContactXForMoreInformation'), $admin_email); + $message = sprintf( + get_lang('ThisPlatformWasUnableToSendTheEmailPleaseContactXForMoreInformation'), + $admin_email + ); return $message; } @@ -196,16 +204,12 @@ class Login $url = api_get_path(WEB_CODE_PATH).'auth/reset.php?token='.$uniqueId; - $mailTemplate = new Template(null, false, false, false, false, false); - $mailLayout = $mailTemplate->get_template('mail/reset_password.tpl'); - $mailTemplate->assign('complete_user_name', $user->getCompleteName()); - $mailTemplate->assign('link', $url); - - - + //$mailTemplate = new Template(null, false, false, false, false, false); + //$mailLayout = $mailTemplate->get_template('mail/reset_password.tpl'); + //$mailTemplate->assign('complete_user_name', $user->getCompleteName()); + //$mailTemplate->assign('link', $url); $mailSubject = get_lang('ResetPasswordInstructions'); - $mailBody = $mailTemplate->fetch($mailLayout); - $mailBody = nl2br($mailBody); + //$mailBody = $mailTemplate->fetch($mailLayout); $mailBody = sprintf( get_lang('ResetPasswordCommentWithUrl'), @@ -256,7 +260,7 @@ class Login $user = Database::fetch_array($result); if ($user['auth_source'] == 'extldap') { - + return get_lang('CouldNotResetPassword'); } } else { @@ -879,7 +883,7 @@ class Login if ($result && $num_rows > 0) { return Database::fetch_assoc($result); } - + return false; } } diff --git a/main/inc/lib/sortable_table.class.php b/main/inc/lib/sortable_table.class.php index 418397cd61..b5ff7a855a 100755 --- a/main/inc/lib/sortable_table.class.php +++ b/main/inc/lib/sortable_table.class.php @@ -174,21 +174,21 @@ class SortableTable extends HTML_Table $this->per_page = isset($_SESSION[$this->param_prefix.'per_page']) ? intval($_SESSION[$this->param_prefix.'per_page']) : $default_items_per_page; $this->per_page = isset($_GET[$this->param_prefix.'per_page']) ? intval($_GET[$this->param_prefix.'per_page']) : $this->per_page; - $_SESSION[$this->param_prefix.'per_page'] = $this->per_page; - $_SESSION[$this->param_prefix.'direction'] = $this->direction ; - $_SESSION[$this->param_prefix.'page_nr'] = $this->page_nr; - $_SESSION[$this->param_prefix.'column'] = $this->column; - $this->pager = null; - $this->default_items_per_page = $default_items_per_page; - $this->total_number_of_items = -1; - $this->get_total_number_function = $get_total_number_function; - $this->get_data_function = $get_data_function; - $this->column_filters = array(); - $this->form_actions = array(); - $this->checkbox_name = null; - $this->td_attributes = array(); - $this->th_attributes = array(); - $this->other_tables = array(); + $_SESSION[$this->param_prefix.'per_page'] = $this->per_page; + $_SESSION[$this->param_prefix.'direction'] = $this->direction; + $_SESSION[$this->param_prefix.'page_nr'] = $this->page_nr; + $_SESSION[$this->param_prefix.'column'] = $this->column; + $this->pager = null; + $this->default_items_per_page = $default_items_per_page; + $this->total_number_of_items = -1; + $this->get_total_number_function = $get_total_number_function; + $this->get_data_function = $get_data_function; + $this->column_filters = array(); + $this->form_actions = array(); + $this->checkbox_name = null; + $this->td_attributes = array(); + $this->th_attributes = array(); + $this->other_tables = array(); } /** @@ -197,23 +197,23 @@ class SortableTable extends HTML_Table public function get_pager() { if (is_null($this->pager)) { - $total_number_of_items = $this->get_total_number_of_items(); - $params['mode'] = 'Sliding'; - $params['perPage'] = $this->per_page; - $params['totalItems'] = $total_number_of_items; - $params['urlVar'] = $this->param_prefix.'page_nr'; - $params['currentPage'] = $this->page_nr; - $icon_attributes = array('style' => 'vertical-align: middle;'); - $params['prevImg'] = Display :: return_icon('action_prev.png', get_lang('PreviousPage'), $icon_attributes); - $params['nextImg'] = Display :: return_icon('action_next.png', get_lang('NextPage'), $icon_attributes); - $params['firstPageText'] = Display :: return_icon('action_first.png', get_lang('FirstPage'), $icon_attributes); - $params['lastPageText'] = Display :: return_icon('action_last.png', get_lang('LastPage'), $icon_attributes); - $params['firstPagePre'] = ''; - $params['lastPagePre'] = ''; + $total_number_of_items = $this->get_total_number_of_items(); + $params['mode'] = 'Sliding'; + $params['perPage'] = $this->per_page; + $params['totalItems'] = $total_number_of_items; + $params['urlVar'] = $this->param_prefix.'page_nr'; + $params['currentPage'] = $this->page_nr; + $icon_attributes = array('style' => 'vertical-align: middle;'); + $params['prevImg'] = Display:: return_icon('action_prev.png', get_lang('PreviousPage'), $icon_attributes); + $params['nextImg'] = Display:: return_icon('action_next.png', get_lang('NextPage'), $icon_attributes); + $params['firstPageText'] = Display:: return_icon('action_first.png', get_lang('FirstPage'), $icon_attributes); + $params['lastPageText'] = Display:: return_icon('action_last.png', get_lang('LastPage'), $icon_attributes); + $params['firstPagePre'] = ''; + $params['lastPagePre'] = ''; $params['firstPagePost'] = ''; - $params['lastPagePost'] = ''; + $params['lastPagePost'] = ''; $params['spacesBeforeSeparator'] = ''; - $params['spacesAfterSeparator'] = ''; + $params['spacesAfterSeparator'] = ''; $query_vars = array_keys($_GET); $query_vars_needed = array ($this->param_prefix.'column', $this->param_prefix.'direction', $this->param_prefix.'per_page'); if (count($this->additional_parameters) > 0) { @@ -231,9 +231,7 @@ class SortableTable extends HTML_Table */ public function display() { - echo $this->return_table(); - } /** @@ -243,7 +241,6 @@ class SortableTable extends HTML_Table public function return_table() { $empty_table = false; - $content = $this->get_table_html(); if ($this->get_total_number_of_items() == 0) { $cols = $this->getColCount(); @@ -299,21 +296,21 @@ class SortableTable extends HTML_Table if (count($this->form_actions) > 0) { $html .= ' '; //toolbar } else { $html .= $form; @@ -336,7 +333,7 @@ class SortableTable extends HTML_Table $html .= ''; } } - + return '' . $html . ''; } @@ -346,7 +343,6 @@ class SortableTable extends HTML_Table **/ public function display_grid() { - $empty_table = false; if ($this->get_total_number_of_items() == 0) { $cols = $this->getColCount(); @@ -358,7 +354,7 @@ class SortableTable extends HTML_Table $html = ''; if (!$empty_table) { $form = $this->get_page_select_form(); - $nav = $this->get_navigation_html(); + $nav = $this->get_navigation_html(); // @todo This style css must be moved to default.css only for dev echo '