From 18bab28cea7a93fd882e5c6188986cb98c7f2d1f Mon Sep 17 00:00:00 2001 From: mk111 Date: Thu, 26 May 2016 16:56:51 +0200 Subject: [PATCH 01/27] apply font-awesome on resource tree (#8256) replacing 0.gif and 1.gif with fa-plus-square-o and fa-minus-square-0, gain enlarging possibility (fa-lg, fa-3x), possiiblity to choose from other awesome icons --- .../classes/CourseSelectForm.class.php | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/main/coursecopy/classes/CourseSelectForm.class.php b/main/coursecopy/classes/CourseSelectForm.class.php index 9f76b5163f..54f1747f63 100755 --- a/main/coursecopy/classes/CourseSelectForm.class.php +++ b/main/coursecopy/classes/CourseSelectForm.class.php @@ -44,11 +44,13 @@ class CourseSelectForm el = document.getElementById('div_'+item); if (el.style.display=='none'){ el.style.display=''; - document.getElementById('img_'+item).src=''; + //document.getElementById('img_'+item).src=''; + document.getElementById('img_'+item).className='fa fa-minus-square-o fa-lg'; } else{ el.style.display='none'; - document.getElementById('img_'+item).src=''; + //document.getElementById('img_'+item).src=''; + document.getElementById('img_'+item).className ='fa fa-plus-square-o fa-lg'; } } @@ -203,7 +205,8 @@ class CourseSelectForm case RESOURCE_SCORM: break; default : - echo ' '; + //echo ' '; + echo '  '; echo ''.$resource_titles[$type].'
'; echo '
'; if ($type == RESOURCE_LEARNPATH) { @@ -244,7 +247,8 @@ class CourseSelectForm if (!empty($forum_categories)) { $type = RESOURCE_FORUMCATEGORY; - echo ' '; + //echo ' '; + echo '  '; echo ''.$resource_titles[RESOURCE_FORUM].'
'; echo '
'; @@ -581,11 +585,13 @@ class CourseSelectForm el = document.getElementById('div_'+item); if (el.style.display=='none'){ el.style.display=''; - document.getElementById('img_'+item).src=''; + //document.getElementById('img_'+item).src=''; + document.getElementById('img_'+item).className('fa fa-minus-square-o fa-lg'); } else{ el.style.display='none'; - document.getElementById('img_'+item).src=''; + //document.getElementById('img_'+item).src=''; + document.getElementById('img_'+item).className('fa fa-plus-square-o fa-lg'); } } function setCheckbox(type,value) { @@ -638,7 +644,8 @@ class CourseSelectForm foreach ($list_course as $course){ foreach ($course->resources as $type => $resources) { if (count($resources) > 0) { - echo 'code'".');" />'; + //echo 'code'".');" />'; + echo 'code'".');" > '; echo 'code'".');" > '.$course->code.'
'; echo '
'; echo '
'; From 9ec471e678aaa54bc15065d473d3450639818253 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Fri, 27 May 2016 09:41:34 -0500 Subject: [PATCH 02/27] Add 'packager' config info for packagers to change for their portals --- main/inc/ajax/admin.ajax.php | 9 +++++++++ main/install/configuration.dist.php | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/main/inc/ajax/admin.ajax.php b/main/inc/ajax/admin.ajax.php index 2f8223a3fe..009717c00b 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 diff --git a/main/install/configuration.dist.php b/main/install/configuration.dist.php index 4210604422..8680bbca9c 100755 --- a/main/install/configuration.dist.php +++ b/main/install/configuration.dist.php @@ -242,3 +242,8 @@ $_configuration['system_stable'] = NEW_VERSION_STABLE; //$_configuration['messaging_gdc_api_key'] = ''; // Text to speech google app id //$_configuration['translate_app_google_key'] = ''; +// Reference to the packager system or provider through which +// Chamilo is installed/downloaded. Packagers can change this +// to reflect their packaging method. The default value is 'chamilo'. This will +// be reflected on the https://version.chamilo.org/stats page in the future. +//$_configuration['packager'] = 'chamilo'; From 949d46339e15d29e3d23d7f61f90a1ae79d1cd70 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Fri, 27 May 2016 09:48:20 -0500 Subject: [PATCH 03/27] Minor - Improve PHPDoc --- main/inc/ajax/admin.ajax.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/main/inc/ajax/admin.ajax.php b/main/inc/ajax/admin.ajax.php index 009717c00b..01eb70c0e4 100755 --- a/main/inc/ajax/admin.ajax.php +++ b/main/inc/ajax/admin.ajax.php @@ -191,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) From 2574ed6bfbc18121608d37d8571ebce7c03eefec Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Fri, 27 May 2016 10:20:10 -0500 Subject: [PATCH 04/27] Fix session_rel_user table when it does not have the duration field This commit should not be added to 1.11.x and master branches --- main/admin/index.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/main/admin/index.php b/main/admin/index.php index b54a1d4273..59f110332b 100644 --- a/main/admin/index.php +++ b/main/admin/index.php @@ -438,6 +438,30 @@ if (api_is_platform_admin()) { $blocks = $data['blocks']; } } + + //Hack for fix migration on session_rel_user + $tableColumns = Database::getManager() + ->getConnection() + ->getSchemaManager() + ->listTableColumns( + Database::get_main_table(TABLE_MAIN_SESSION_USER) + ); + + if (!array_key_exists('duration', $tableColumns)) { + try { + $dbSchema = Database::getManager()->getConnection()->getSchemaManager(); + $durationColumn = new \Doctrine\DBAL\Schema\Column( + 'duration', + Doctrine\DBAL\Types\Type::getType(\Doctrine\DBAL\Types\Type::INTEGER), + ['notnull' => false] + ); + $tableDiff = new \Doctrine\DBAL\Schema\TableDiff('session_rel_user', [$durationColumn]); + $dbSchema->alterTable($tableDiff); + } catch (Exception $e) { + error_log($e->getMessage()); + } + } + //end hack } $admin_ajax_url = api_get_path(WEB_AJAX_PATH) . 'admin.ajax.php'; From c1c0ee9cb4a296bf628aec021ccdc8743b769e29 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Fri, 27 May 2016 17:20:07 -0500 Subject: [PATCH 05/27] Create Azure Active Directory plugin - refs BT#11214 --- plugin/azure_active_directory/README.md | 17 +++ plugin/azure_active_directory/index.php | 14 +++ .../azure_active_directory/lang/english.php | 20 ++++ plugin/azure_active_directory/plugin.php | 9 ++ plugin/azure_active_directory/readme.txt | 30 ++++++ .../src/AzureActiveDirectory.php | 102 ++++++++++++++++++ .../azure_active_directory/src/callback.php | 55 ++++++++++ plugin/azure_active_directory/view/block.tpl | 12 +++ 8 files changed, 259 insertions(+) create mode 100644 plugin/azure_active_directory/README.md create mode 100644 plugin/azure_active_directory/index.php create mode 100644 plugin/azure_active_directory/lang/english.php create mode 100644 plugin/azure_active_directory/plugin.php create mode 100644 plugin/azure_active_directory/readme.txt create mode 100644 plugin/azure_active_directory/src/AzureActiveDirectory.php create mode 100644 plugin/azure_active_directory/src/callback.php create mode 100644 plugin/azure_active_directory/view/block.tpl diff --git a/plugin/azure_active_directory/README.md b/plugin/azure_active_directory/README.md new file mode 100644 index 0000000000..37f5386a3e --- /dev/null +++ b/plugin/azure_active_directory/README.md @@ -0,0 +1,17 @@ +# The Azure Active Directory Plugin +Allow authentication with Microsoft's Azure Active Directory + +### To configure Azure Active Directory +* [Create an Azure AD B2C tenant](https://azure.microsoft.com/en-us/documentation/articles/active-directory-b2c-get-started/) +* [Register your application](https://azure.microsoft.com/en-us/documentation/articles/active-directory-b2c-app-registration/) +* [Configure Facebook, Google+, Microsoft account, Amazon, and LinkedIn accounts for use in your consumer-facing applications](https://azure.microsoft.com/en-us/documentation/articles/active-directory-b2c-overview/#how-to-articles) + +### To configure this plugin +* Enable +* Application ID: Enter the Application Id assinged to your app by the Azure portal, e.g. 580e250c-8f26-49d0-bee8-1c078add1609 +* Tenant: Enter the name of your B2C directory, e.g. contoso.onmicrosoft.com +* Sign up policy: Enter your sign up policy name, e.g. b2c_1_sign_up +* Sign in policy: Enter your sign in policy name, e.g. b2c_1_sign_in +* Block name: (Optional) The name to show above the buttons + +And assign a region. Preferably `login_bottom` diff --git a/plugin/azure_active_directory/index.php b/plugin/azure_active_directory/index.php new file mode 100644 index 0000000000..6055876ef3 --- /dev/null +++ b/plugin/azure_active_directory/index.php @@ -0,0 +1,14 @@ + + * @package chamilo.plugin.azure_active_directory + */ +$activeDirectoryPlugin = AzureActiveDirectory::create(); + +if ($activeDirectoryPlugin->get(AzureActiveDirectory::SETTING_ENABLE) === 'true') { + $_template['block_title'] = $activeDirectoryPlugin->get(AzureActiveDirectory::SETTING_BLOCK_NAME); + $_template['signup_url'] = $activeDirectoryPlugin->getUrl(AzureActiveDirectory::URL_TYPE_SIGNUP); + $_template['signin_url'] = $activeDirectoryPlugin->getUrl(AzureActiveDirectory::URL_TYPE_SIGNIN); + $_template['signout_url'] = $activeDirectoryPlugin->getUrl(AzureActiveDirectory::URL_TYPE_SIGNOUT); +} diff --git a/plugin/azure_active_directory/lang/english.php b/plugin/azure_active_directory/lang/english.php new file mode 100644 index 0000000000..545ec61f7a --- /dev/null +++ b/plugin/azure_active_directory/lang/english.php @@ -0,0 +1,20 @@ + + * @package chamilo.plugin.azure_active_directory + */ +$strings['plugin_title'] = 'Azure Active Directory'; +$strings['plugin_comment'] = 'Allow authentication with Microsoft\'s Azure Active Directory'; + +$strings['enable'] = 'Enable'; +$strings['app_id'] = 'Application ID'; +$strings['app_id_help'] = 'Enter the Application Id assinged to your app by the Azure portal, e.g. 580e250c-8f26-49d0-bee8-1c078add1609'; +$strings['tenant'] = 'Tenant'; +$strings['tenant_help'] = 'Enter the name of your B2C directory, e.g. contoso.onmicrosoft.com'; +$strings['signup_policy'] = 'Sign up policy'; +$strings['signup_policy_help'] = 'Enter your sign up policy name, e.g.g b2c_1_sign_up'; +$strings['signin_policy'] = 'Sign in policy'; +$strings['signin_policy_help'] = 'Enter your sign in policy name, e.g. b2c_1_sign_in'; +$strings['block_name'] = 'Block name'; diff --git a/plugin/azure_active_directory/plugin.php b/plugin/azure_active_directory/plugin.php new file mode 100644 index 0000000000..0f6bc99e73 --- /dev/null +++ b/plugin/azure_active_directory/plugin.php @@ -0,0 +1,9 @@ + + * @package chamilo.plugin.azure_active_directory + */ +$plugin_info = AzureActiveDirectory::create()->get_info(); + +$plugin_info['templates'] = array('view/block.tpl'); diff --git a/plugin/azure_active_directory/readme.txt b/plugin/azure_active_directory/readme.txt new file mode 100644 index 0000000000..c987a07acd --- /dev/null +++ b/plugin/azure_active_directory/readme.txt @@ -0,0 +1,30 @@ +

The Azure Active Directory Plugin

+

Allow authentication with Microsoft's Azure Active Directory

+

To configure Azure Active Directory

+ +

To configure this plugin

+
    +
  • Enable
  • +
  • Application ID: Enter the Application Id assinged to your app by the Azure portal, e.g. 580e250c-8f26-49d0-bee8-1c078add1609
  • +
  • Tenant: Enter the name of your B2C directory, e.g. contoso.onmicrosoft.com
  • +
  • Sign up policy: Enter your sign up policy name, e.g. b2c_1_sign_up
  • +
  • Sign in policy: Enter your sign in policy name, e.g. b2c_1_sign_in
  • +
  • Block name: (Optional) The name to show above the buttons
  • +
+

And assign a region. Preferably login_bottom

diff --git a/plugin/azure_active_directory/src/AzureActiveDirectory.php b/plugin/azure_active_directory/src/AzureActiveDirectory.php new file mode 100644 index 0000000000..ceac516234 --- /dev/null +++ b/plugin/azure_active_directory/src/AzureActiveDirectory.php @@ -0,0 +1,102 @@ + + * @package chamilo.plugin.azure_active_directory + */ +class AzureActiveDirectory extends Plugin +{ + const SETTING_ENABLE = 'enable'; + const SETTING_APP_ID = 'app_id'; + const SETTING_TENANT = 'tenant'; + const SETTING_SIGNUP_POLICY = 'signup_policy'; + const SETTING_SIGNIN_POLICY = 'signin_policy'; + const SETTING_BLOCK_NAME = 'block_name'; + const URL_TYPE_SIGNUP = 'sign-up'; + const URL_TYPE_SIGNIN = 'sign-in'; + const URL_TYPE_SIGNOUT = 'sign-out'; + + /** + * AzureActiveDirectory constructor. + */ + protected function __construct() + { + $settings = [ + self::SETTING_ENABLE => 'boolean', + self::SETTING_APP_ID => 'text', + self::SETTING_TENANT => 'text', + self::SETTING_SIGNUP_POLICY => 'text', + self::SETTING_SIGNIN_POLICY => 'text', + self::SETTING_BLOCK_NAME => 'text' + ]; + + parent::__construct('1.0', 'Angel Fernando Quiroz Campos', $settings); + } + + /** + * Instance the plugin + * @staticvar null $result + * @return Tour + */ + static function create() + { + static $result = null; + + return $result ? $result : $result = new self(); + } + + /** + * @return string + */ + public function get_name() + { + return 'azure_active_directory'; + } + + /** + * @param $urlType Type of URL to generate + * @return string + */ + public function getUrl($urlType) + { + $settingsInfo = $this->get_settings(); + $settings = []; + + foreach ($settingsInfo as $settingInfo) { + $variable = str_replace($this->get_name() . '_', '', $settingInfo['variable']); + + $settings[$variable] = $settingInfo['selected_value']; + } + + $url = "https://login.microsoftonline.com/{$settings[self::SETTING_TENANT]}/oauth2/v2.0/"; + $callback = api_get_path(WEB_PLUGIN_PATH) . $this->get_name() . '/src/callback.php'; + + if ($urlType === self::URL_TYPE_SIGNOUT) { + $action = 'logout'; + $urlParams = [ + 'p' => $settings[self::SETTING_SIGNIN_POLICY], + 'post_logout_redirect_uri' => $callback + ]; + } else { + $action = 'authorize'; + $policy = $settings[self::SETTING_SIGNUP_POLICY]; + + if ($urlType === self::URL_TYPE_SIGNIN) { + $policy = $settings[self::SETTING_SIGNIN_POLICY]; + } + + $urlParams = [ + 'client_id' => $settings[self::SETTING_APP_ID], + 'response_type' => 'id_token', + 'redirect_uri' => $callback, + 'scope' => 'openid', + 'response_mode' => 'form_post', + 'state' => time(), + 'nonce' => time(), + 'p' => $policy + ]; + } + + return $url . $action . '?' . http_build_query($urlParams); + } +} \ No newline at end of file diff --git a/plugin/azure_active_directory/src/callback.php b/plugin/azure_active_directory/src/callback.php new file mode 100644 index 0000000000..40f33baa13 --- /dev/null +++ b/plugin/azure_active_directory/src/callback.php @@ -0,0 +1,55 @@ + $jwtPayload->given_name, + 'lastname' => $jwtPayload->family_name, + 'status' => STUDENT, + 'email' => $jwtPayload->emails[0], + 'username' => $jwtPayload->emails[0], + 'language' => 'en', + 'password' => 'azure_active_directory', + 'auth_source' => 'azure_active_directory ' . $jwtPayload->idp, + 'extra' => array() +); + +$userInfo = api_get_user_info_from_email($jwtPayload->emails[0]); + +if ($userInfo === false) { + // we have to create the user + $chamilo_uid = external_add_user($u); + + if ($chamilo_uid !== false) { + $_user['user_id'] = $chamilo_uid; + $_user['uidReset'] = true; + $_SESSION['_user'] = $_user; + } +} else { + // User already exists, update info and login + $chamilo_uid = $userInfo['user_id']; + $u['user_id'] = $chamilo_uid; + external_update_user($u); + + $_user['user_id'] = $chamilo_uid; + $_user['uidReset'] = true; + $_SESSION['_user'] = $_user; +} + +header('Location: ' . api_get_path(WEB_PATH)); +exit; diff --git a/plugin/azure_active_directory/view/block.tpl b/plugin/azure_active_directory/view/block.tpl new file mode 100644 index 0000000000..85605bb08e --- /dev/null +++ b/plugin/azure_active_directory/view/block.tpl @@ -0,0 +1,12 @@ +
+ {% if _u.logged %} + {# {{ 'Logout'|get_lang }} #} + {% else %} + {% if not azure_active_directory.block_title is empty %} +

{{ azure_active_directory.block_title }}

+ {% endif %} + + {{ 'SignIn'|get_lang }} + {{ 'SignUp'|get_lang }} + {% endif %} +
From 008029b2566c1b081443387713926555a01537cd Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Sat, 28 May 2016 21:29:48 -0500 Subject: [PATCH 06/27] Fix issue preventing the detection of BBB plugin --- plugin/bbb/lib/bbb.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/bbb/lib/bbb.lib.php b/plugin/bbb/lib/bbb.lib.php index c85f09f5d9..c97e05fee7 100755 --- a/plugin/bbb/lib/bbb.lib.php +++ b/plugin/bbb/lib/bbb.lib.php @@ -64,7 +64,7 @@ class bbb } } - if ($bbbPlugin === true) { + if ($bbbPlugin == true) { $userInfo = api_get_user_info(); $this->userCompleteName = $userInfo['complete_name']; $this->salt = $bbb_salt; From 6bc0e1c870f517a2f14350e473dc77d980af2269 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Mon, 30 May 2016 15:22:19 -0500 Subject: [PATCH 07/27] Add index documentation to boost db --- documentation/optimization.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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);
+

3. Indexes caching

One good reference: MySQL documentation on multiple key caches
-

4. Sessions directories

From 91d8b0941d10d63e6a497f2e2d2066632041cd14 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Mon, 30 May 2016 11:11:28 -0500 Subject: [PATCH 08/27] Show default badge image on final lp item - refs BT#11242 --- main/newscorm/lp_final_item.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/main/newscorm/lp_final_item.php b/main/newscorm/lp_final_item.php index b5af284411..6752645370 100644 --- a/main/newscorm/lp_final_item.php +++ b/main/newscorm/lp_final_item.php @@ -143,32 +143,32 @@ function generateLPFinalItemTemplate($lpItemId, $courseCode, $sessionId=0, $down */ function generateLPFinalItemTemplateBadgeLinks($userId, $courseId, $sessionId=0) { + $em = Database::getManager(); $skillRelUser = new SkillRelUser(); $userSkills = $skillRelUser->get_user_skills($userId, $courseId, $sessionId); $skillList = ''; $badgeLink = ''; if ($userSkills) { - $skill = new Skill(); foreach ($userSkills as $userSkill) { - $oneSkill = $skill->get($userSkill['skill_id']); + $skill = $em->find('ChamiloCoreBundle:Skill', $userSkill['skill_id']); $skillList .= "
-
+
- +
-
-
" . $oneSkill['name'] . "
- " . $oneSkill['description'] . " +
+
" . $skill->getName() . "
+ " . $skill->getDescription() . "
@@ -209,4 +209,4 @@ function generateLPFinalItemTemplateCertificateLinks($certificate)
"; return $downloadCertificateLink; -} \ No newline at end of file +} From 864ddb77a5459e38014b0dfce2eb9a094e7839ff Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Mon, 30 May 2016 11:33:38 -0500 Subject: [PATCH 09/27] Minor - Format code - refs BT#11242 --- main/newscorm/lp_final_item.php | 116 ++++++++++++++++++-------------- 1 file changed, 65 insertions(+), 51 deletions(-) diff --git a/main/newscorm/lp_final_item.php b/main/newscorm/lp_final_item.php index 6752645370..f85f4267f8 100644 --- a/main/newscorm/lp_final_item.php +++ b/main/newscorm/lp_final_item.php @@ -7,8 +7,10 @@ */ // Initialize context $_in_course = true; -require_once __DIR__.'/../inc/global.inc.php'; -$current_course_tool = TOOL_GRADEBOOK; + +require_once __DIR__ . '/../inc/global.inc.php'; + +$current_course_tool = TOOL_GRADEBOOK; // Make sure no anonymous user gets here without permission api_protect_course_script(true); @@ -40,7 +42,11 @@ $currentItemId = $lp->get_current_item_id(); $currentItem = $lp->items[$currentItemId]; $currentItemStatus = $currentItem->get_status(); $accessGranted = false; -if (($count - $completed == 0) or (($count - $completed == 1 && ($currentItemStatus == 'incomplete') or ($currentItemStatus == 'not attempted') ))) { + +if ( + ($count - $completed == 0) or + ($count - $completed == 1 && ($currentItemStatus == 'incomplete') or ($currentItemStatus == 'not attempted')) +) { if ($lp->prerequisites_match($currentItemId)) { $accessGranted = true; } @@ -62,10 +68,14 @@ if ($accessGranted == false) { // If not gradebook has been defined if (empty($catLoad)) { - $finalItemTemplate = generateLPFinalItemTemplate($id, $courseCode, $sessionId, $downloadCertificateLink, - $badgeLink); + $finalItemTemplate = generateLPFinalItemTemplate( + $id, + $courseCode, + $sessionId, + $downloadCertificateLink, + $badgeLink + ); // TODO: Missing validation of learning path completion - } else { // A gradebook was found, proceed... $categoryId = $catLoad[0]->get_id(); @@ -78,10 +88,8 @@ if ($accessGranted == false) { if ($show_message == '') { if (!api_is_allowed_to_edit() && !api_is_excluded_user_type()) { - $certificate = Category::register_user_certificate( - $categoryId, - $userId - ); + $certificate = Category::register_user_certificate($categoryId, $userId); + if (!empty($certificate['pdf_url']) || !empty($certificate['badge_link'])) { if (is_array($certificate) && isset($certificate['pdf_url'])) { $downloadCertificateLink = generateLPFinalItemTemplateCertificateLinks($certificate); @@ -92,13 +100,18 @@ if ($accessGranted == false) { $badgeLink = generateLPFinalItemTemplateBadgeLinks($userId, $courseId, $sessionId); } } + $currentScore = Category::getCurrentScore($userId, $categoryId, $courseCode, $sessionId, true); Category::registerCurrentScore($currentScore, $userId, $categoryId); } } } - $finalItemTemplate = generateLPFinalItemTemplate($id, $courseCode, $sessionId, $downloadCertificateLink, - $badgeLink); + + $finalItemTemplate = generateLPFinalItemTemplate($id, $courseCode, $downloadCertificateLink, $badgeLink); + + if (!$finalItemTemplate) { + Display::display_warning_message(get_lang('FileNotFound')); + } } } @@ -118,7 +131,7 @@ $tpl->display_one_col_template(); * @param string $badgeLink * @return mixed|string */ -function generateLPFinalItemTemplate($lpItemId, $courseCode, $sessionId=0, $downloadCertificateLink='', $badgeLink='') +function generateLPFinalItemTemplate($lpItemId, $courseCode, $sessionId = 0, $downloadCertificateLink = '', $badgeLink = '') { $documentInfo = DocumentManager::get_document_data_by_id( $lpItemId, @@ -131,6 +144,7 @@ function generateLPFinalItemTemplate($lpItemId, $courseCode, $sessionId=0, $down $finalItemTemplate = str_replace('((certificate))', $downloadCertificateLink, $finalItemTemplate); $finalItemTemplate = str_replace('((skill))', $badgeLink, $finalItemTemplate); + return $finalItemTemplate; } @@ -141,7 +155,7 @@ function generateLPFinalItemTemplate($lpItemId, $courseCode, $sessionId=0, $down * @param int $sessionId * @return string HTML string for badges */ -function generateLPFinalItemTemplateBadgeLinks($userId, $courseId, $sessionId=0) +function generateLPFinalItemTemplateBadgeLinks($userId, $courseId, $sessionId = 0) { $em = Database::getManager(); $skillRelUser = new SkillRelUser(); @@ -153,36 +167,36 @@ function generateLPFinalItemTemplateBadgeLinks($userId, $courseId, $sessionId=0) foreach ($userSkills as $userSkill) { $skill = $em->find('ChamiloCoreBundle:Skill', $userSkill['skill_id']); $skillList .= " -
-
-
- -
-
-
-
" . $skill->getName() . "
- " . $skill->getDescription() . " -
- -
- "; +
+
+
+ +
+
+
+
" . $skill->getName() . "
+ " . $skill->getDescription() . " +
+ +
+ "; } $badgeLink .= " -
-
-

" . get_lang('AdditionallyYouHaveObtainedTheFollowingSkills') . "

- $skillList -
-
- "; +
+
+

" . get_lang('AdditionallyYouHaveObtainedTheFollowingSkills') . "

+ $skillList +
+
+ "; } return $badgeLink; } @@ -194,19 +208,19 @@ function generateLPFinalItemTemplateBadgeLinks($userId, $courseId, $sessionId=0) */ function generateLPFinalItemTemplateCertificateLinks($certificate) { - $downloadCertificateLink = Display::url(Display::returnFontAwesomeIcon('file-pdf-o') . - get_lang('DownloadCertificatePdf'), + $downloadCertificateLink = Display::url( + Display::returnFontAwesomeIcon('file-pdf-o') . get_lang('DownloadCertificatePdf'), $certificate['pdf_url'], ['class' => 'btn btn-default'] ); $viewCertificateLink = $certificate['certificate_link']; $downloadCertificateLink = " -
-
-

" . get_lang('NowDownloadYourCertificateClickHere') . "

-
$downloadCertificateLink $viewCertificateLink
-
-
- "; +
+
+

" . get_lang('NowDownloadYourCertificateClickHere') . "

+
$downloadCertificateLink $viewCertificateLink
+
+
+ "; return $downloadCertificateLink; } From b7a253e298a2c6de67f576e8db2d9a8d96892e8b Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Mon, 30 May 2016 15:51:17 -0500 Subject: [PATCH 10/27] Allow add external style sheet on certificates when they are in lp view - refs BT#11242 --- main/gradebook/certificate_template/template.html | 4 +++- main/inc/lib/document.lib.php | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) 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/inc/lib/document.lib.php b/main/inc/lib/document.lib.php index 0b4006e00b..d2750352c1 100755 --- a/main/inc/lib/document.lib.php +++ b/main/inc/lib/document.lib.php @@ -1901,6 +1901,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 +1925,7 @@ class DocumentManager $url, '' . get_lang('CertificateOnlineLink') . '', '((certificate_barcode))', + $externalStyle ); $info_to_be_replaced_in_content_html = array('((user_firstname))', @@ -1935,6 +1943,7 @@ class DocumentManager '((certificate_link))', '((certificate_link_html))', '((certificate_barcode))', + '((external_style))' ); if (!empty($extraFields)) { From 2be62b04ae3e0126f8d472fe3225fba30c4d9f3d Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Mon, 30 May 2016 17:20:15 -0500 Subject: [PATCH 11/27] Fix ExtraFieldValues adding a missing index --- src/Chamilo/CoreBundle/Entity/ExtraFieldValues.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Chamilo/CoreBundle/Entity/ExtraFieldValues.php b/src/Chamilo/CoreBundle/Entity/ExtraFieldValues.php index ea6fca54c2..a6ca88e142 100644 --- a/src/Chamilo/CoreBundle/Entity/ExtraFieldValues.php +++ b/src/Chamilo/CoreBundle/Entity/ExtraFieldValues.php @@ -10,7 +10,12 @@ use Sylius\Component\Attribute\Model\AttributeValue as BaseAttributeValue; /** * Class ExtraFieldValues * - * @ORM\Table(name="extra_field_values") + * @ORM\Table( + * name="extra_field_values", + * indexes={ + * @ORM\Index(name="idx_efv_fiii", columns={"field_id", "item_id"}), + * } + * ) * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Entity\Repository\ExtraFieldValuesRepository") * @ORM\MappedSuperclass */ From bfa0cfdc566c1cf383a19bd8284d785848b2fa86 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Mon, 30 May 2016 17:20:15 -0500 Subject: [PATCH 12/27] Fix ExtraFieldValues adding a missing index --- src/Chamilo/CoreBundle/Entity/ExtraFieldValues.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Chamilo/CoreBundle/Entity/ExtraFieldValues.php b/src/Chamilo/CoreBundle/Entity/ExtraFieldValues.php index ea6fca54c2..a6ca88e142 100644 --- a/src/Chamilo/CoreBundle/Entity/ExtraFieldValues.php +++ b/src/Chamilo/CoreBundle/Entity/ExtraFieldValues.php @@ -10,7 +10,12 @@ use Sylius\Component\Attribute\Model\AttributeValue as BaseAttributeValue; /** * Class ExtraFieldValues * - * @ORM\Table(name="extra_field_values") + * @ORM\Table( + * name="extra_field_values", + * indexes={ + * @ORM\Index(name="idx_efv_fiii", columns={"field_id", "item_id"}), + * } + * ) * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Entity\Repository\ExtraFieldValuesRepository") * @ORM\MappedSuperclass */ From 11e38c94eec6d0a18831639e3e669b7109b5f86c Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Mon, 30 May 2016 17:25:01 -0500 Subject: [PATCH 13/27] Add index on c_quiz_question_rel_category --- app/Migrations/Schema/V111/Version111.php | 1 + src/Chamilo/CourseBundle/Entity/CQuizQuestionRelCategory.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Migrations/Schema/V111/Version111.php b/app/Migrations/Schema/V111/Version111.php index e7fd01b58e..8fb2c0eabf 100644 --- a/app/Migrations/Schema/V111/Version111.php +++ b/app/Migrations/Schema/V111/Version111.php @@ -263,6 +263,7 @@ class Version111 extends AbstractMigrationChamilo $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("ALTER TABLE c_quiz_question_rel_category ADD INDEX idx_qqrc_qid (question_id)"); } } diff --git a/src/Chamilo/CourseBundle/Entity/CQuizQuestionRelCategory.php b/src/Chamilo/CourseBundle/Entity/CQuizQuestionRelCategory.php index 9196701434..70938737a3 100644 --- a/src/Chamilo/CourseBundle/Entity/CQuizQuestionRelCategory.php +++ b/src/Chamilo/CourseBundle/Entity/CQuizQuestionRelCategory.php @@ -11,7 +11,8 @@ use Doctrine\ORM\Mapping as ORM; * @ORM\Table( * name="c_quiz_question_rel_category", * indexes={ - * @ORM\Index(name="course", columns={"c_id"}) + * @ORM\Index(name="course", columns={"c_id"}), + * @ORM\Index(name="idx_qqrc_qid", columns={"question_id"}) * } * ) * @ORM\Entity From 254ea6c2b3da82029d9dfd37aa64a523b2b328c3 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Mon, 30 May 2016 18:02:52 -0500 Subject: [PATCH 14/27] Fix UsergroupRelUser entity adding missing index --- src/Chamilo/CoreBundle/Entity/UsergroupRelUser.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Chamilo/CoreBundle/Entity/UsergroupRelUser.php b/src/Chamilo/CoreBundle/Entity/UsergroupRelUser.php index 3659849548..4ab8ff6fc7 100644 --- a/src/Chamilo/CoreBundle/Entity/UsergroupRelUser.php +++ b/src/Chamilo/CoreBundle/Entity/UsergroupRelUser.php @@ -18,7 +18,11 @@ use Doctrine\ORM\Mapping as ORM; * Class UsergroupRelUser * * @ORM\Table( - * name="usergroup_rel_user" + * name="usergroup_rel_user", + * indexes={ + * @ORM\Index(name="IDX_739515A9A76ED395", columns={"user_id"}), + * @ORM\Index(name="IDX_739515A9D2112630", columns={"usergroup_id"}) + * } * ) * @ORM\Entity */ From 7eaabd2cce8b11d3b7421db725641e0ff8609c30 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Mon, 30 May 2016 18:02:52 -0500 Subject: [PATCH 15/27] Fix UsergroupRelUser entity adding missing index --- src/Chamilo/CoreBundle/Entity/UsergroupRelUser.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Chamilo/CoreBundle/Entity/UsergroupRelUser.php b/src/Chamilo/CoreBundle/Entity/UsergroupRelUser.php index 3659849548..4ab8ff6fc7 100644 --- a/src/Chamilo/CoreBundle/Entity/UsergroupRelUser.php +++ b/src/Chamilo/CoreBundle/Entity/UsergroupRelUser.php @@ -18,7 +18,11 @@ use Doctrine\ORM\Mapping as ORM; * Class UsergroupRelUser * * @ORM\Table( - * name="usergroup_rel_user" + * name="usergroup_rel_user", + * indexes={ + * @ORM\Index(name="IDX_739515A9A76ED395", columns={"user_id"}), + * @ORM\Index(name="IDX_739515A9D2112630", columns={"usergroup_id"}) + * } * ) * @ORM\Entity */ From d2de9b9277c56d80bb6786a84c3615f66385535d Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Mon, 30 May 2016 18:08:56 -0500 Subject: [PATCH 16/27] Add missing indexes according slow queries section in documentation --- app/Migrations/Schema/V111/Version111.php | 2 ++ src/Chamilo/CourseBundle/Entity/CQuizAnswer.php | 3 ++- src/Chamilo/CourseBundle/Entity/CStudentPublication.php | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Migrations/Schema/V111/Version111.php b/app/Migrations/Schema/V111/Version111.php index 8fb2c0eabf..05dc86903c 100644 --- a/app/Migrations/Schema/V111/Version111.php +++ b/app/Migrations/Schema/V111/Version111.php @@ -264,6 +264,8 @@ class Version111 extends AbstractMigrationChamilo $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("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/src/Chamilo/CourseBundle/Entity/CQuizAnswer.php b/src/Chamilo/CourseBundle/Entity/CQuizAnswer.php index 3b7044c80d..45e8c836c1 100644 --- a/src/Chamilo/CourseBundle/Entity/CQuizAnswer.php +++ b/src/Chamilo/CourseBundle/Entity/CQuizAnswer.php @@ -11,7 +11,8 @@ use Doctrine\ORM\Mapping as ORM; * @ORM\Table( * name="c_quiz_answer", * indexes={ - * @ORM\Index(name="c_id", columns={"c_id"}) + * @ORM\Index(name="c_id", columns={"c_id"}), + * @ORM\Index(name="idx_cqa_q", columns={"question_id"}) * } * ) * @ORM\Entity diff --git a/src/Chamilo/CourseBundle/Entity/CStudentPublication.php b/src/Chamilo/CourseBundle/Entity/CStudentPublication.php index 360bd6e835..d63960d6e9 100644 --- a/src/Chamilo/CourseBundle/Entity/CStudentPublication.php +++ b/src/Chamilo/CourseBundle/Entity/CStudentPublication.php @@ -12,7 +12,8 @@ use Doctrine\ORM\Mapping as ORM; * name="c_student_publication", * indexes={ * @ORM\Index(name="course", columns={"c_id"}), - * @ORM\Index(name="session_id", columns={"session_id"}) + * @ORM\Index(name="session_id", columns={"session_id"}), + * @ORM\Index(name="idx_csp_u", columns={"user_id"}) * } * ) * @ORM\Entity From b2efe1ba5582178ff08fad45ac1f2f619ee50ac7 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 31 May 2016 09:09:03 +0200 Subject: [PATCH 17/27] Fix URL --- main/gradebook/exercise_jump.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/gradebook/exercise_jump.php b/main/gradebook/exercise_jump.php index dccc72b787..be804d5ba2 100755 --- a/main/gradebook/exercise_jump.php +++ b/main/gradebook/exercise_jump.php @@ -24,7 +24,7 @@ $type = Security::remove_XSS($_GET['type']); $doExerciseUrl = null; 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, From 61d5e39dd3c0abd307f10e1fc66704fa0e6c4c79 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 31 May 2016 09:46:53 +0200 Subject: [PATCH 18/27] Minor - fix UI --- main/coursecopy/classes/CourseSelectForm.class.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main/coursecopy/classes/CourseSelectForm.class.php b/main/coursecopy/classes/CourseSelectForm.class.php index 54f1747f63..6461f6780f 100755 --- a/main/coursecopy/classes/CourseSelectForm.class.php +++ b/main/coursecopy/classes/CourseSelectForm.class.php @@ -219,23 +219,27 @@ class CourseSelectForm } } - echo '
'; + echo '
'; + echo '
'; echo "".get_lang('All').""; echo "".get_lang('None').""; echo '

'; - + echo '
    '; foreach ($resources as $id => $resource) { if ($resource) { + echo '
  • '; // Event obj in 1.9.x in 1.10.x the class is CalendarEvent Coursecopy\Resource::setClassType($resource); echo ''; + echo '
  • '; } } - echo '
'; + echo ''; + echo '
'; echo '
'; echo ''; $element_count++; From ef6dc7d2b18dc65573e40fbfef23cd76218c89da Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 31 May 2016 11:30:37 +0200 Subject: [PATCH 19/27] Minor - Format code --- main/inc/lib/legal.lib.php | 40 ++++++++++++++++++++++---------------- main/inc/lib/login.lib.php | 30 +++++++++++++++------------- 2 files changed, 40 insertions(+), 30 deletions(-) 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; } } From 58d4fb46df6a72ba6131d6e54a451fc1eb08f492 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 31 May 2016 14:57:34 +0200 Subject: [PATCH 20/27] Move constant see: cbca6874407130615849ac3b70f6b19e9ada7cc8 --- index.php | 2 -- main/inc/global.inc.php | 9 +-------- main/inc/lib/api.lib.php | 3 +++ 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/index.php b/index.php index f2af26e28f..321613a01d 100755 --- a/index.php +++ b/index.php @@ -7,8 +7,6 @@ use \ChamiloSession as Session; define('CHAMILO_HOMEPAGE', true); -// Avoid loading CKeditor lib on homepage (very heavy lib) -define('CHAMILO_LOAD_WYSIWYG', false); /* Flag forcing the 'current course' reset, as we're not inside a course anymore. */ // Maybe we should change this into an api function? an example: CourseManager::unset(); 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/api.lib.php b/main/inc/lib/api.lib.php index 3c6d6f3324..cc3e826a38 100644 --- a/main/inc/lib/api.lib.php +++ b/main/inc/lib/api.lib.php @@ -571,6 +571,9 @@ define('SHORTCUTS_VERTICAL', 1); // Image class define('IMAGE_PROCESSOR', 'gd'); // 'imagick' or 'gd' strings +// Avoid loading CKeditor lib on homepage (very heavy lib) +define('CHAMILO_LOAD_WYSIWYG', false); + /** * Inclusion of internationalization libraries */ From 008a8a7f19bba6d2a2c11d17c238748a522bbb1b Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 31 May 2016 15:20:19 +0200 Subject: [PATCH 21/27] Add setters/getters --- src/Chamilo/TicketBundle/Entity/Priority.php | 200 +++++++++++++++++++ src/Chamilo/TicketBundle/Entity/Project.php | 183 ++++++++++++++++- src/Chamilo/TicketBundle/Entity/Status.php | 78 ++++++++ 3 files changed, 460 insertions(+), 1 deletion(-) diff --git a/src/Chamilo/TicketBundle/Entity/Priority.php b/src/Chamilo/TicketBundle/Entity/Priority.php index e521df5520..48eb259683 100644 --- a/src/Chamilo/TicketBundle/Entity/Priority.php +++ b/src/Chamilo/TicketBundle/Entity/Priority.php @@ -87,4 +87,204 @@ class Priority * @ORM\Column(name="sys_lastedit_datetime", type="datetime", nullable=true, unique=false) */ protected $lastEditDateTime; + + /** + * Priority constructor. + */ + public function __construct() + { + $this->insertDateTime = new \DateTime(); + } + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @param int $id + * @return Priority + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * @return Priority + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * @param string $code + * @return Priority + */ + public function setCode($code) + { + $this->code = $code; + + return $this; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * @return Priority + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * @return string + */ + public function getColor() + { + return $this->color; + } + + /** + * @param string $color + * @return Priority + */ + public function setColor($color) + { + $this->color = $color; + + return $this; + } + + /** + * @return string + */ + public function getUrgency() + { + return $this->urgency; + } + + /** + * @param string $urgency + * @return Priority + */ + public function setUrgency($urgency) + { + $this->urgency = $urgency; + + return $this; + } + + /** + * @return int + */ + public function getInsertUserId() + { + return $this->insertUserId; + } + + /** + * @param int $insertUserId + * @return Priority + */ + public function setInsertUserId($insertUserId) + { + $this->insertUserId = $insertUserId; + + return $this; + } + + /** + * @return \DateTime + */ + public function getInsertDateTime() + { + return $this->insertDateTime; + } + + /** + * @param \DateTime $insertDateTime + * @return Priority + */ + public function setInsertDateTime($insertDateTime) + { + $this->insertDateTime = $insertDateTime; + + return $this; + } + + /** + * @return int + */ + public function getLastEditUserId() + { + return $this->lastEditUserId; + } + + /** + * @param int $lastEditUserId + * @return Priority + */ + public function setLastEditUserId($lastEditUserId) + { + $this->lastEditUserId = $lastEditUserId; + + return $this; + } + + /** + * @return \DateTime + */ + public function getLastEditDateTime() + { + return $this->lastEditDateTime; + } + + /** + * @param \DateTime $lastEditDateTime + * @return Priority + */ + public function setLastEditDateTime($lastEditDateTime) + { + $this->lastEditDateTime = $lastEditDateTime; + + return $this; + } + + } diff --git a/src/Chamilo/TicketBundle/Entity/Project.php b/src/Chamilo/TicketBundle/Entity/Project.php index 09888b519f..b2197711d2 100644 --- a/src/Chamilo/TicketBundle/Entity/Project.php +++ b/src/Chamilo/TicketBundle/Entity/Project.php @@ -59,7 +59,7 @@ class Project * @ORM\Column(name="sys_insert_user_id", type="integer", nullable=false, unique=false) */ protected $insertUserId; - + /** * @var \DateTime * @@ -80,4 +80,185 @@ class Project * @ORM\Column(name="sys_lastedit_datetime", type="datetime", nullable=true, unique=false) */ protected $lastEditDateTime; + + /** + * Project constructor. + */ + public function __construct() + { + $this->insertDateTime = new \DateTime(); + } + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @param int $id + * @return Project + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * @return Project + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * @return Project + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * @param string $email + * @return Project + */ + public function setEmail($email) + { + $this->email = $email; + + return $this; + } + + /** + * @return string + */ + public function getOtherArea() + { + return $this->otherArea; + } + + /** + * @param string $otherArea + * @return Project + */ + public function setOtherArea($otherArea) + { + $this->otherArea = $otherArea; + + return $this; + } + + /** + * @return int + */ + public function getInsertUserId() + { + return $this->insertUserId; + } + + /** + * @param int $insertUserId + * @return Project + */ + public function setInsertUserId($insertUserId) + { + $this->insertUserId = $insertUserId; + + return $this; + } + + /** + * @return \DateTime + */ + public function getInsertDateTime() + { + return $this->insertDateTime; + } + + /** + * @param \DateTime $insertDateTime + * @return Project + */ + public function setInsertDateTime($insertDateTime) + { + $this->insertDateTime = $insertDateTime; + + return $this; + } + + /** + * @return int + */ + public function getLastEditUserId() + { + return $this->lastEditUserId; + } + + /** + * @param int $lastEditUserId + * @return Project + */ + public function setLastEditUserId($lastEditUserId) + { + $this->lastEditUserId = $lastEditUserId; + + return $this; + } + + /** + * @return \DateTime + */ + public function getLastEditDateTime() + { + return $this->lastEditDateTime; + } + + /** + * @param \DateTime $lastEditDateTime + * @return Project + */ + public function setLastEditDateTime($lastEditDateTime) + { + $this->lastEditDateTime = $lastEditDateTime; + + return $this; + } + + } diff --git a/src/Chamilo/TicketBundle/Entity/Status.php b/src/Chamilo/TicketBundle/Entity/Status.php index 3c690d8fbd..474d46a71a 100644 --- a/src/Chamilo/TicketBundle/Entity/Status.php +++ b/src/Chamilo/TicketBundle/Entity/Status.php @@ -45,4 +45,82 @@ class Status * @ORM\Column(name="description", type="text", nullable=true) */ protected $description; + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @param int $id + * @return Status + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * @param string $code + * @return Status + */ + public function setCode($code) + { + $this->code = $code; + + return $this; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * @return Status + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * @return Status + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + } From efcc8fca0875272247ed6491e32fe09e997f52ba Mon Sep 17 00:00:00 2001 From: David Nos Date: Tue, 31 May 2016 15:20:24 +0200 Subject: [PATCH 22/27] Remove hardcoded headers Expires and Last-Modified to enable course content caching in order to improve performance --- main/inc/lib/document.lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main/inc/lib/document.lib.php b/main/inc/lib/document.lib.php index 78d8699b6d..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'); From ca91bc7c58769794c4848dccea3ce07dbb3f7ebb Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 31 May 2016 15:20:36 +0200 Subject: [PATCH 23/27] Update migration --- app/Migrations/Schema/V111/Version111.php | 4 ++++ main/install/data.sql | 12 +++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/Migrations/Schema/V111/Version111.php b/app/Migrations/Schema/V111/Version111.php index 05dc86903c..773b017984 100644 --- a/app/Migrations/Schema/V111/Version111.php +++ b/app/Migrations/Schema/V111/Version111.php @@ -260,8 +260,12 @@ 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)"); diff --git a/main/install/data.sql b/main/install/data.sql index 3e5ecd9008..39782060d7 100644 --- a/main/install/data.sql +++ b/main/install/data.sql @@ -310,6 +310,8 @@ VALUES ('allow_coach_feedback_exercises',NULL,'radio','Session','true','AllowCoachFeedbackExercisesTitle','AllowCoachFeedbackExercisesComment',NULL,NULL, 0), ('allow_my_files',NULL,'radio','Platform','true','AllowMyFilesTitle','AllowMyFilesComment','',NULL, 1), ('ticket_allow_student_add', NULL, 'radio','Ticket', 'false','TicketAllowStudentAddTitle','TicketAllowStudentAddComment',NULL,NULL, 0), +('ticket_send_warning_to_all_admins', NULL, 'radio','Ticket', 'false','TicketSendWarningToAllAdminsTitle','TicketSendWarningToAllAdminsComment',NULL,NULL, 0), +('ticket_warn_admin_no_user_in_category', NULL, 'radio','Ticket', 'false','TicketWarnAdminNoUserInCategoryTitle','TicketWarnAdminNoUserInCategoryComment',NULL,NULL, 0), ('ticket_allow_category_edition', NULL, 'radio','Ticket', 'false','TicketAllowCategoryEditionTitle','TicketAllowCategoryEditionComment',NULL,NULL, 0); INSERT INTO settings_options (variable, value, display_text) @@ -630,11 +632,15 @@ VALUES ('allow_coach_feedback_exercises','true','Yes'), ('allow_coach_feedback_exercises','false','No'), ('allow_my_files','true','Yes'), -('allow_my_files','false','No') +('allow_my_files','false','No'), ('ticket_allow_student_add','true','Yes'), ('ticket_allow_student_add','false','No'), -('ticket_allow_category_edition','true','Yes'), -('ticket_allow_category_edition','false','No'); +('ticket_allow_category_edition', 'true', 'Yes'), +('ticket_allow_category_edition', 'false', 'No'), +('ticket_send_warning_to_all_admins', 'true', 'Yes'), +('ticket_send_warning_to_all_admins', 'false', 'No'), +('ticket_warn_admin_no_user_in_category', 'true', 'Yes'), +('ticket_warn_admin_no_user_in_category', 'false', 'No'); INSERT INTO language (original_name, english_name, isocode, dokeos_folder, available) VALUES ('العربية','arabic','ar','arabic',0), From 96c14bc6a546feecffa56091841f8adb649efb34 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 31 May 2016 15:20:58 +0200 Subject: [PATCH 24/27] Fix warning --- main/inc/lib/usermanager.lib.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php index e43dfe43f3..727c59277f 100755 --- a/main/inc/lib/usermanager.lib.php +++ b/main/inc/lib/usermanager.lib.php @@ -294,8 +294,11 @@ class UserManager //Checking the user language $languages = api_get_languages(); $language = strtolower($language); - if (!in_array($language, $languages['folder'])) { - $language = api_get_setting('platformLanguage'); + + if (isset($languages['folder'])) { + if (!in_array($language, $languages['folder'])) { + $language = api_get_setting('platformLanguage'); + } } if (!empty($currentUserId)) { @@ -1365,7 +1368,7 @@ class UserManager $result['complete_name'] = api_get_person_name( $result['firstname'], - $result['lastname'] + $result['lastname'] ); $return_array[] = $result; } @@ -4832,7 +4835,7 @@ EOF; /** * Subscribe boss to students - * + * * @param int $bossId The boss id * @param array $usersId The users array * @return int Affected rows From 821db803214718da21d0102cd3ca00c3e4d3a9fb Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 31 May 2016 16:04:28 +0200 Subject: [PATCH 25/27] Minor - format code --- main/inc/lib/sortable_table.class.php | 140 ++++++++++++++------------ 1 file changed, 73 insertions(+), 67 deletions(-) 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 .= '
'; - $html .= '
'; - $html .= ''.get_lang('SelectAll').''; - $html .= ''.get_lang('UnSelectAll').' '; - $html .= '
'; - $html .= '
- - '; - $html .= ''; - $html .= '
';//btn-group + $html .= '
'; + $html .= ''.get_lang('SelectAll').''; + $html .= ''.get_lang('UnSelectAll').' '; + $html .= '
'; + $html .= '
+ + '; + $html .= ''; + $html .= '
';//btn-group $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 '