Browse Source

Adding new setting "session_page_enabled" see BT#5519

Julio Montoya 12 years ago
parent
commit
a748ff13fa

+ 0 - 1
index.php

@@ -85,7 +85,6 @@ class IndexController
 
         $this->set_login_form($app);
 
-        //@todo move this inside the IndexManager
         if (!api_is_anonymous()) {
             $app['template']->assign('profile_block', PageController::return_profile_block());
             $app['template']->assign('user_image_block', PageController::return_user_image_block());

+ 8 - 8
main/auth/shibboleth/app/controller/shibboleth_controller.class.php

@@ -7,7 +7,7 @@ use \Display;
 use IndexManager;
 
 /**
- * Controller for the Shibboleth authentication system. 
+ * Controller for the Shibboleth authentication system.
  *
  * @license see /license.txt
  * @author Laurent Opprecht <laurent@opprecht.info>, Nicolas Rod for the University of Geneva
@@ -17,7 +17,7 @@ class ShibbolethController
 
     /**
      *
-     * @return ShibbolethController 
+     * @return ShibbolethController
      */
     public static function instance()
     {
@@ -30,7 +30,7 @@ class ShibbolethController
     }
 
     /**
-     * Log user in with Shibboleth authentication 
+     * Log user in with Shibboleth authentication
      */
     function login()
     {
@@ -92,13 +92,13 @@ class ShibbolethController
             $message = get_lang('already_logged_in');
             Shibboleth::display()->message_page($message, $title);
         }
-        $index_manager = new IndexManager('');
-        $html = $index_manager->display_login_form();
+        //$index_manager = new IndexManager('');
+        $html = PageController::display_login_form();
         Shibboleth::display()->page($html, $title);
     }
 
     /**
-     * Display the request new status page to administrator for new users. 
+     * Display the request new status page to administrator for new users.
      */
     public function request_status()
     {
@@ -115,7 +115,7 @@ class ShibbolethController
             //Maximum user right is reached.
             Shibboleth::redirect();
         }
-        
+
         $form = ShibbolethStatusRequestForm::instance();
 
         if ($form->cancelled())
@@ -131,7 +131,7 @@ class ShibbolethController
 
             $message = <<<EOT
 New status: $status
-            
+
 Reason:
 $reason
 EOT;

+ 15 - 10
main/inc/lib/page.lib.php

@@ -762,10 +762,12 @@ class PageController {
                                 $params = array();
                                 $params['icon'] =  Display::return_icon('window_list.png', $session['session_name'], array('id' => 'session_img_'.$session_id), ICON_SIZE_LARGE);
 
-                                if (api_is_drh()) {
-                                    $session_link = $session['session_name'];
-                                    $params['link'] = null;
-                                } else {
+                                //Default session name
+                                $session_link = $session['session_name'];
+                                $params['link'] = null;
+
+                                if (api_get_setting('session_page_enabled' == 'true') && !api_is_drh()) {
+                                    //session name with link
                                     $session_link = Display::tag('a', $session['session_name'], array('href'=>api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session_id));
                                     $params['link'] = api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session_id;
                                 }
@@ -817,14 +819,17 @@ class PageController {
                         if ($count > 0) {
                             $params['icon'] = Display::return_icon('window_list.png', $session['session_name'], array('id' => 'session_img_'.$session_id), ICON_SIZE_LARGE);
 
-                            if (api_is_drh()) {
-                                $session_link = $session['session_name'];
-                                $params['link'] = null;
-                            } else {
-                                $session_link   = Display::tag('a', $session['session_name'], array('href'=>api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session_id));
-                                $params['link'] =  api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session_id;
+                            //Default session name
+                            $session_link = $session['session_name'];
+                            $params['link'] = null;
+
+                            if (api_get_setting('session_page_enabled' == 'true') && !api_is_drh()) {
+                                //session name with link
+                                $session_link = Display::tag('a', $session['session_name'], array('href'=>api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session_id));
+                                $params['link'] = api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session_id;
                             }
 
+
                             $params['title'] .=  $session_link;
 
                             $moved_status = SessionManager::get_session_change_user_reason($session['moved_status']);

+ 1 - 1
main/inc/lib/usermanager.lib.php

@@ -2233,7 +2233,7 @@ class UserManager {
         }
 
         $sql = " $select FROM $tbl_session as session LEFT JOIN $tbl_session_category session_category ON (session_category_id = session_category.id)
-                      INNER JOIN $tbl_session_course_user as scu ON (scu.id_session = session.id AND scu.user_id = $user_id)
+                      INNER JOIN $tbl_session_course_user as scu ON (scu.id_session = session.id AND scu.id_user = $user_id)
                       LEFT JOIN $tbl_session_user su ON su.id_session = session.id AND su.id_user = scu.id_user
                 WHERE (
                          scu.id_user = $user_id OR session.id_coach = $user_id

+ 3 - 0
main/inc/lib/userportal.lib.php

@@ -3,6 +3,9 @@
 
 use \ChamiloSession as Session;
 
+/**
+ * @deprecated  use PageController class main/inc/page.lib.php
+ */
 class IndexManager {
 	var $tpl 	= false; //An instance of the template engine
 	var $name 	= '';

+ 6 - 2
main/install/db_main.sql

@@ -915,6 +915,7 @@ VALUES
 ('tool_visible_by_default_at_creation','gradebook','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Gradebook', 1),
 ('session_tutor_reports_visibility', NULL, 'radio', 'Session', 'true', 'SessionTutorsCanSeeExpiredSessionsResultsTitle', 'SessionTutorsCanSeeExpiredSessionsResultsComment', NULL, NULL, 1),
 ('gradebook_show_percentage_in_reports',NULL,'radio','Gradebook','true','GradebookShowPercentageInReportsTitle','GradebookShowPercentageInReportsComment',NULL,NULL, 0),
+('session_page_enabled', NULL, 'radio', 'Session', 'true', 'SessionPageEnabledTitle', 'SessionPageEnabledComment', NULL, NULL, 1),
 ('chamilo_database_version', NULL, 'textfield', NULL, 'xxx','DatabaseVersion','', NULL, NULL, 0);
 UNLOCK TABLES;
 /*!40000 ALTER TABLE settings_current ENABLE KEYS */;
@@ -1261,7 +1262,10 @@ VALUES
 ('session_tutor_reports_visibility', 'true', 'Yes'),
 ('session_tutor_reports_visibility', 'false', 'No'),
 ('gradebook_show_percentage_in_reports', 'true', 'Yes'),
-('gradebook_show_percentage_in_reports', 'false', 'No');
+('gradebook_show_percentage_in_reports', 'false', 'No'),
+('session_page_enabled', 'true', 'Yes'),
+('session_page_enabled', 'false', 'No');
+
 
 UNLOCK TABLES;
 
@@ -3143,4 +3147,4 @@ CREATE TABLE branch_transaction (
 );
 
 -- Do not move this
-UPDATE settings_current SET selected_value = '1.10.0.20672' WHERE variable = 'chamilo_database_version';
+UPDATE settings_current SET selected_value = '1.10.0.20766' WHERE variable = 'chamilo_database_version';

+ 5 - 1
main/install/migrate-db-1.9.0-1.10.0-pre.sql

@@ -106,5 +106,9 @@ ALTER TABLE settings_current ADD INDEX idx_settings_current_au_cat (access_url,
 
 CREATE TABLE c_quiz_order( id int unsigned NOT NULL auto_increment, c_id int unsigned NOT NULL, session_id int unsigned NOT NULL, exercise_id int NOT NULL, exercise_order INT NOT NULL, PRIMARY KEY (id));
 
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('session_page_enabled', NULL, 'radio', 'Session', 'true', 'SessionPageEnabledTitle', 'SessionPageEnabledComment', NULL, NULL, 1);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('session_page_enabled', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('session_page_enabled', 'false', 'No');
+
 -- Do not move this
-UPDATE settings_current SET selected_value = '1.10.0.20672' WHERE variable = 'chamilo_database_version';
+UPDATE settings_current SET selected_value = '1.10.0.20766' WHERE variable = 'chamilo_database_version';