Selaa lähdekoodia

Settings to choose page after login for each kind of user (teachern student, drh, session admin)

Noel Dieschburg 14 vuotta sitten
vanhempi
commit
0ad4994657

+ 5 - 1
main/install/db_main.sql

@@ -772,7 +772,11 @@ VALUES
 ('cas_add_user_login_attr', NULL, 'textfield', 'CAS', '', 'CasUserAddLoginAttributeTitle', 'CasUserAddLoginAttributeComment', NULL, NULL, 0),
 ('cas_add_user_email_attr', NULL, 'textfield', 'CAS', '', 'CasUserAddEmailAttributeTitle', 'CasUserAddEmailAttributeComment', NULL, NULL, 0),
 ('cas_add_user_firstname_attr', NULL, 'textfield', 'CAS', '', 'CasUserAddFirstnameAttributeTitle', 'CasUserAddFirstnameAttributeComment', NULL, NULL, 0),
-('cas_add_user_lastname_attr', NULL, 'textfield', 'CAS', '', 'CasUserAddLastnameAttributeTitle', 'CasUserAddLastnameAttributeComment', NULL, NULL, 0);
+('cas_add_user_lastname_attr', NULL, 'textfield', 'CAS', '', 'CasUserAddLastnameAttributeTitle', 'CasUserAddLastnameAttributeComment', NULL, NULL, 0),
+('student_page_after_login', NULL, 'textfield', 'Platform', '', 'StudentPageAfterLoginTitle', 'StudentPageAfterLoginComment', NULL, NULL, 0),
+('teacher_page_after_login', NULL, 'textfield', 'Platform', '', 'TeacherPageAfterLoginTitle', 'TeacherPageAfterLoginComment', NULL, NULL, 0),
+('DRH_page_after_login', NULL, 'textfield', 'Platform', '', 'DRHPageAfterLoginTitle', 'DRHPageAfterLoginComment', NULL, NULL, 0),
+('sessionadmin_page_after_login', NULL, 'textfield', 'Platform', '', 'SessionAdminPageAfterLoginTitle', 'SessionAdminPageAfterLoginComment', NULL, NULL, 0);
 
 
 UNLOCK TABLES;

+ 5 - 0
main/install/migrate-db-1.8.6.2-1.8.7-pre.sql

@@ -107,6 +107,11 @@ INSERT INTO settings_current (variable, subkey, type, category, selected_value,
 ALTER TABLE gradebook_score_display ADD category_id int NOT NULL DEFAULT 0;
 ALTER TABLE gradebook_score_display ADD INDEX (category_id);
 ALTER TABLE gradebook_score_display ADD score_color_percent float unsigned NOT NULL DEFAULT 0;
+-- CBlue custom
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('student_page_after_login', NULL, 'textfield', 'Platform', '', 'StudentPageAfterLoginTitle', 'StudentPageAfterLoginComment', NULL, NULL, 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('teacher_page_after_login', NULL, 'textfield', 'Platform', '', 'TeacherPageAfterLoginTitle', 'TeacherPageAfterLoginComment', NULL, NULL, 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('DRH_page_after_login', NULL, 'textfield', 'Platform', '', 'DRHPageAfterLoginTitle', 'DRHPageAfterLoginComment', NULL, NULL, 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('sessionadmin_page_after_login', NULL, 'textfield', 'Platform', '', 'SessionAdminPageAfterLoginTitle', 'SessionAdminPageAfterLoginComment', NULL, NULL, 0);
 
 -- xxSTATSxx
 CREATE TABLE track_e_item_property(id int NOT NULL auto_increment PRIMARY KEY, course_id int NOT NULL, item_property_id int NOT NULL, title varchar(255), content text, progress int NOT NULL default 0, lastedit_date datetime NOT NULL default '0000-00-00 00:00:00', lastedit_user_id int  NOT NULL, session_id int NOT NULL default 0);

+ 11 - 2
main/lang/english/admin.inc.php

@@ -171,7 +171,7 @@ $CourseCoach = "Training coach";
 $UsersNumber = "Users number";
 $DokeosClassic = "Chamilo classic";
 $PublicAdmin = "Public administration";
-$PageAfterLoginTitle = "Page after login";
+$PageAfterLoginTitle = "After login page";
 $PageAfterLoginComment = "The page which is seen by the user entering the platform";
 $DokeosAdminWebLinks = "Chamilo Web";
 $TabsMyProfile = "My Profile tab";
@@ -1284,7 +1284,7 @@ $SAMLText = "SAML";
 $CasMainProtocolTitle = "CAS Protocol used";
 $CasMainProtocolComment = "CAS Protocol used. If you want to use your cas server to pass information within the cas ticket, choose SAML";
 $CasUserAddActivateTitle = "User add by CAS activation";
-$CasUserAddActivateComment = "Choose this oprtion if you want dokeos to automatically add user with information sent by the CAS server (using SAML)";
+$CasUserAddActivateComment = "Choose this oprtion if you want chamilo to automatically add user with information sent by the CAS server (using SAML)";
 $CasUserAddLoginAttributeTitle = "XML field for user login";
 $CasUserAddLoginAttributeComment = "The XML field of the CAS ticket containing the user login";
 $CasUserAddEmailAttributeTitle = "XML field for user email";
@@ -1293,4 +1293,13 @@ $CasUserAddFirstnameAttributeTitle = "XML field for user firstname";
 $CasUserAddFirstnameAttributeComment = "The XML field of the CAS ticket containing the user firstname";
 $CasUserAddLastnameAttributeTitle = "XML field for user firsstname";
 $CasUserAddLastnameAttributeComment = "The XML field of the CAS ticket containing the user firstname";
+$StudentPageAfterLoginTitle = "After login page for students";
+$StudentPageAfterLoginComment = "Leave blank for chamilo default page after login.";
+$TeacherPageAfterLoginTitle =  "After login page for teachers";
+$TeacherPageAfterLoginComment = "Leave blank for chamilo default page after login.";
+$DRHPageAfterLoginTitle =  "After login page for DRH";
+$DRHPageAfterLoginComment = "Leave blank for chamilo default page after login.";
+$SessionAdminPageAfterLoginTitle = "After login page for session admin";
+$SessionAdminPageAfterLoginComment = "Leave blank for chamilo default page after login.";
+
 ?>

+ 10 - 1
main/lang/french/admin.inc.php

@@ -1270,4 +1270,13 @@ $ErrorReadingZip = "Erreur de lecture du fichier ZIP";
 $ErrorStylesheetFilesExtensionsInsideZip = "Les seules extensions acceptées pour les fichiers contenus dans le ZIP sont jpg, jpeg, png, gif et css.";
 $MyTextHere = "Introduisez votre texte ici...";
 $FieldTypeSocialProfile = "Lien réseau social";
-?>
+$StudentPageAfterLoginTitle = "Page à montrer pour les étudiants une fois authentifiés";
+$StudentPageAfterLoginComment = "Laisser vide pour le comportement normal de chamilo.";
+$TeacherPageAfterLoginTitle =  "Page à montrer pour les professeurs une fois authentifiés";
+$TeacherPageAfterLoginComment = "Laisser vide pour le comportement normal de chamilo.";
+$DRHPageAfterLoginTitle =  "Page à montrer pour les DRH une fois authentifiés";
+$DRHPageAfterLoginComment = "Laisser vide pour le comportement normal de chamilo.";
+$SessionAdminPageAfterLoginTitle = "Page à montrer pour les adminsitrateurs de sessions une fois authentifiés";
+$SessionAdminPageAfterLoginComment = "Laisser vide pour le comportement normal de chamilo.";
+
+?>

+ 19 - 0
user_portal.php

@@ -92,6 +92,25 @@ define("CONFVAL_limitPreviewTo", SCRIPTVAL_NewEntriesOfTheDayOfLastLogin);
 $personal_course_list = UserManager::get_personal_session_course_list($_user['user_id']);
 
 // check if a user is enrolled only in one course for going directly to the course after the login
+$user_status = $_user['status'];
+$tes = api_get_setting('student_page_after_login');
+if ( $user_status == STUDENT && !api_get_setting('student_page_after_login') == '' ){
+  header('Location: '.api_get_setting('student_page_after_login'));
+  exit();
+}
+if ( $user_status == COURSEMANAGER && !api_get_setting('teacher_page_after_login') == '' ){
+  header('Location: '.api_get_setting('teacher_page_after_login'));
+  exit();
+}
+if ( $user_status == DRH && !api_get_setting('drh_page_after_login') == '' ){
+  header('Location: '.api_get_setting('student_page_after_login'));
+  exit();
+}
+if ( $user_status == SESSIONADMIN && !api_get_setting('sessionadmin_page_after_login') == '' ){
+  header('Location: '.api_get_setting('student_page_after_login'));
+  exit();
+}
+
 if (api_get_setting('go_to_course_after_login') == 'true') {
 	if (!isset($_SESSION['coursesAlreadyVisited']) && is_array($personal_course_list) && count($personal_course_list) == 1) {