Added option to prevent/authorize teachers to register users in course - CT#903

skala
christian1827 16 years ago
parent d6a93b110e
commit 715b24467f
  1. 5
      main/install/db_main.sql
  2. 4
      main/install/migrate-db-1.8.6.2-1.8.7-pre.sql
  3. 79
      main/user/user.php
  4. 159
      main/user/userInfo.php

@ -759,6 +759,7 @@ VALUES
('show_tabs', 'dashboard', 'checkbox', 'Platform', 'true', 'ShowTabsTitle', 'ShowTabsComment', NULL, 'TabsDashboard', 1),
('use_users_timezone', 'timezones', 'radio', 'Timezones', 'true', 'UseUsersTimezoneTitle','UseUsersTimezoneComment',NULL,'Timezones', 1),
('timezone_value', 'timezones', 'select', 'Timezones', '', 'TimezoneValueTitle','TimezoneValueComment',NULL,'Timezones', 1),
('allow_user_course_subscription_by_course_admin', NULL, 'radio', 'Security', 'true', 'AllowUserCourseSubscriptionByCourseAdminTitle', 'AllowUserCourseSubscriptionByCourseAdminComment', NULL, NULL, 0),
('dokeos_database_version', NULL, 'textfield', NULL,'1.8.7.11220','DokeosDatabaseVersion','',NULL,NULL,0);
@ -969,7 +970,9 @@ VALUES
('allow_send_message_to_all_platform_users','true','Yes'),
('allow_send_message_to_all_platform_users','false','No'),
('use_users_timezone', 'true', 'Yes'),
('use_users_timezone', 'false', 'No');
('use_users_timezone', 'false', 'No'),
('allow_user_course_subscription_by_course_admin', 'true', 'Yes'),
('allow_user_course_subscription_by_course_admin', 'false', 'No');
UNLOCK TABLES;

@ -77,6 +77,10 @@ INSERT INTO settings_options(variable,value,display_text) VALUES ('homepage_view
UPDATE settings_current SET selected_value = 'UTF-8' WHERE variable = 'platform_charset';
INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_user_course_subscription_by_course_admin', NULL, 'radio', 'Security', 'true', 'AllowUserCourseSubscriptionByCourseAdminTitle', 'AllowUserCourseSubscriptionByCourseAdminComment', NULL, NULL, 0);
INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_user_course_subscription_by_course_admin', 'true', 'Yes');
INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_user_course_subscription_by_course_admin', 'false', 'No');
-- 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);
ALTER TABLE track_e_item_property ADD INDEX (course_id, item_property_id, session_id);

@ -64,7 +64,7 @@ $is_western_name_order = api_is_western_name_order();
$sort_by_first_name = api_sort_by_first_name();
/* Unregistering a user section */
if (api_is_allowed_to_edit()) {
if (api_is_allowed_to_edit(null, true)) {
if (isset($_POST['action'])) {
switch ($_POST['action']) {
case 'unsubscribe' :
@ -81,7 +81,7 @@ if (api_is_allowed_to_edit()) {
}
}
if (api_is_allowed_to_edit()) {
if (api_is_allowed_to_edit(null, true)) {
if ( isset ($_GET['action'])) {
switch ($_GET['action']) {
case 'export' :
@ -137,7 +137,7 @@ if (api_is_allowed_to_edit()) {
}
} // end if allowed to edit
if (api_is_allowed_to_edit()) {
if (api_is_allowed_to_edit(null, true)) {
// Unregister user from course
if ($_REQUEST['unregister']) {
if (isset($_GET['user_id']) && is_numeric($_GET['user_id']) && $_GET['user_id'] != $_user['user_id']) {
@ -301,16 +301,18 @@ $is_allowed_to_track = ($is_courseAdmin || $is_courseTutor) && $_configuration['
Display::display_introduction_section(TOOL_USER, 'left');
if ( api_is_allowed_to_edit()) {
if ( api_is_allowed_to_edit(null, true)) {
echo "<div class=\"actions\">";
// the action links
$actions .= '<a href="user.php?'.api_get_cidreq().'&action=export&amp;type=csv">'.Display::return_icon('csv.gif', get_lang('ExportAsCSV')).'&nbsp;'.get_lang('ExportAsCSV').'</a> ';
$actions .= '<a href="user.php?'.api_get_cidreq().'&action=export&amp;type=xls">'.Display::return_icon('excel.gif', get_lang('ExportAsXLS')).'&nbsp;'.get_lang('ExportAsXLS').'</a> ';
$actions .= '<a href="subscribe_user.php?'.api_get_cidreq().'">'.Display::return_icon('add_user_big.gif',get_lang("SubscribeUserToCourse")).'&nbsp;'.get_lang("SubscribeUserToCourse").'</a> ';
$actions .= "<a href=\"subscribe_user.php?".api_get_cidreq()."&type=teacher\">".Display::return_icon('add_teacher_big.gif', get_lang("SubscribeUserToCourseAsTeacher"))."&nbsp;".get_lang("SubscribeUserToCourseAsTeacher")."</a> ";
$actions .= "<a href=\"../group/group.php?".api_get_cidreq()."\">".Display::return_icon('group.gif', get_lang("GroupUserManagement"))."&nbsp;".get_lang("GroupUserManagement")."</a>";
if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true') {
$actions .= '<a href="subscribe_user.php?'.api_get_cidreq().'">'.Display::return_icon('add_user_big.gif',get_lang("SubscribeUserToCourse")).'&nbsp;'.get_lang("SubscribeUserToCourse").'</a> ';
$actions .= "<a href=\"subscribe_user.php?".api_get_cidreq()."&type=teacher\">".Display::return_icon('add_teacher_big.gif', get_lang("SubscribeUserToCourseAsTeacher"))."&nbsp;".get_lang("SubscribeUserToCourseAsTeacher")."</a> ";
}
$actions .= "<a href=\"../group/group.php?".api_get_cidreq()."\">".Display::return_icon('group.gif', get_lang("GroupUserManagement"))."&nbsp;".get_lang("GroupUserManagement")."</a>";
if (api_get_setting('use_session_mode') == 'false') {
$actions .= ' <a href="class.php?'.api_get_cidreq().'">'.get_lang('Classes').'</a>';
}
@ -445,11 +447,12 @@ function get_user_data($from, $number_of_items, $column, $direction) {
if ((isset ($_GET['keyword']) && search_keyword($o_course_user['firstname'], $o_course_user['lastname'], $o_course_user['username'], $o_course_user['official_code'], $_GET['keyword'])) || !isset($_GET['keyword']) || empty($_GET['keyword'])) {
$groups_name = GroupManager :: get_user_group_name($user_id);
if (api_is_allowed_to_edit()) {
$temp = array();
$temp[] = $user_id;
$temp = array();
if (api_is_allowed_to_edit(null, true)) {
if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true') {
$temp[] = $user_id;
}
$image_path = UserManager::get_user_picture_path_by_id($user_id, 'web', false, true);
$user_profile = UserManager::get_picture_user($user_id, $image_path['file'], 22, USER_IMAGE_SIZE_SMALL, ' width="22" height="22" ');
if (!api_is_anonymous()) {
@ -487,8 +490,6 @@ function get_user_data($from, $number_of_items, $column, $direction) {
$temp[] = $o_course_user['active'];
$temp[] = $user_id;
} else {
$temp = array();
$image_path = UserManager::get_user_picture_path_by_id($user_id, 'web', false, true);
$image_repository = $image_path['dir'];
$existing_image = $image_path['file'];
@ -508,10 +509,7 @@ function get_user_data($from, $number_of_items, $column, $direction) {
}
$temp[] = $o_course_user['role'];
$temp[] = implode(', ', $groups_name);//Group
$temp[] = $o_course_user['official_code'];
if (api_is_allowed_to_edit()) {
$temp[] = $user_id;
}
$temp[] = $o_course_user['official_code'];
}
$a_users[$user_id] = $temp;
}
@ -539,7 +537,7 @@ function active_filter($active, $url_params, $row) {
$action='AccountInactive';
$image='wrong';
}
if ($row['0']<>$_user['user_id']) { // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore.
if ($row[count($row)-1]<>$_user['user_id']) { // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore.
$result = '<center><img src="../img/'.$image.'.gif" border="0" style="vertical-align: middle;" alt="'.get_lang(ucfirst($action)).'" title="'.get_lang(ucfirst($action)).'"/></center>';
}
return $result;
@ -560,15 +558,17 @@ function modify_filter($user_id) {
$result .= '<a href="../mySpace/myStudents.php?'.api_get_cidreq().'&student='.$user_id.'&amp;details=true&amp;course='.$_course['id'].'&amp;origin=user_course&amp;id_session='.$_SESSION["id_session"].'" title="'.get_lang('Tracking').'" ><img border="0" alt="'.get_lang('Tracking').'" src="../img/statistics.gif" /></a>&nbsp;';
}
if (api_is_allowed_to_edit()) {
// edit
$result .= '<a href="userInfo.php?'.api_get_cidreq().'&origin='.$origin.'&amp;editMainUserInfo='.$user_id.'" title="'.get_lang('Edit').'" ><img border="0" alt="'.get_lang('Edit').'" src="../img/edit.gif" /></a>&nbsp;';
// unregister
if ($user_id != $_user['user_id']) {
$result .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&unregister=yes&amp;user_id='.$user_id.'" title="'.get_lang('Unreg').' " onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;"><img border="0" alt="'.get_lang("Unreg").'" src="../img/delete.gif"/></a>';
} else {
$result .= '<img border="0" alt="'.get_lang("Unreg").'" src="../img/delete_na.gif"/>';
}
if (api_is_allowed_to_edit(null, true)) {
if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true') {
// edit
$result .= '<a href="userInfo.php?'.api_get_cidreq().'&origin='.$origin.'&amp;editMainUserInfo='.$user_id.'" title="'.get_lang('Edit').'" ><img border="0" alt="'.get_lang('Edit').'" src="../img/edit.gif" /></a>&nbsp;';
// unregister
if ($user_id != $_user['user_id']) {
$result .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&unregister=yes&amp;user_id='.$user_id.'" title="'.get_lang('Unreg').' " onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;"><img border="0" alt="'.get_lang("Unreg").'" src="../img/delete.gif"/></a>';
} else {
$result .= '<img border="0" alt="'.get_lang("Unreg").'" src="../img/delete_na.gif"/>';
}
}
}
$result .= "</div>";
return $result;
@ -582,8 +582,10 @@ $parameters['keyword'] = Security::remove_XSS($_GET['keyword']);
$table->set_additional_parameters($parameters);
$header_nr = 0;
if (api_is_allowed_to_edit()) {
$table->set_header($header_nr++, '', false);
if (api_is_allowed_to_edit(null, true)) {
if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true') {
$table->set_header($header_nr++, '', false);
}
}
$table->set_header($header_nr++, get_lang('Photo'), false);
if ($is_western_name_order) {
@ -597,18 +599,23 @@ $table->set_header($header_nr++, get_lang('Description'), false);
$table->set_header($header_nr++, get_lang('GroupSingle'), false);
$table->set_header($header_nr++, get_lang('OfficialCode'));
if (api_is_allowed_to_edit()) {
if (api_is_allowed_to_edit(null, true)) {
// deprecated feature
$table->set_header($header_nr++, get_lang('Tutor'), false);
$table->set_header($header_nr++, get_lang('CourseManager'), false);
$table->set_header($header_nr++, get_lang('Active'), false);
$table->set_column_filter(9, 'active_filter');
if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true') {
$table->set_column_filter(9, 'active_filter');
} else {
$table->set_column_filter(8, 'active_filter');
}
//actions column
$table->set_header($header_nr++, get_lang('Action'), false);
$table->set_column_filter($header_nr-1, 'modify_filter');
if (api_is_allowed_to_edit()) {
$table->set_form_actions(array('unsubscribe' => get_lang('Unreg')), 'user');
}
if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true') {
$table->set_form_actions(array('unsubscribe' => get_lang('Unreg')), 'user');
}
}
$table->display();

@ -98,8 +98,8 @@ $userIdViewer = $_user['user_id']; // id fo the user currently online
//$userIdViewed = $_GET['userIdViewed']; // Id of the user we want to view
$allowedToEditContent = ($userIdViewer == $userIdViewed) || $is_platformAdmin;
$allowedToEditDef = api_is_allowed_to_edit();
$is_allowedToTrack = api_is_allowed_to_edit() && $_configuration['tracking_enabled'];
$allowedToEditDef = api_is_allowed_to_edit(null, true);
$is_allowedToTrack = api_is_allowed_to_edit(null, true) && $_configuration['tracking_enabled'];
// Library connection
require_once ("userInfoLib.php");
@ -122,55 +122,33 @@ $editDef = Security::remove_XSS($_GET['editDef']);
$moveUpDef = Security::remove_XSS($_GET['moveUpDef']);
$moveDownDef = Security::remove_XSS($_GET['moveDownDef']);
if ($allowedToEditDef)
{
if (!empty($_POST['submitDef']))
{
if (!empty($_POST['id']))
{
if ($allowedToEditDef) {
if (!empty($_POST['submitDef'])) {
if (!empty($_POST['id'])) {
edit_cat_def($_POST['id'], $_POST['title'], $_POST['comment'], $_POST['nbline']);
}
else
{
} else {
create_cat_def($_POST['title'], $_POST['comment'], $_POST['nbline']);
}
$displayMode = "viewDefList";
}
elseif (!empty($_GET['removeDef']))
{
} elseif (!empty($_GET['removeDef'])) {
remove_cat_def($_GET['removeDef'], true);
$displayMode = "viewDefList";
}
elseif (!empty($_GET['editDef']))
{
} elseif (!empty($_GET['editDef'])) {
$displayMode = "viewDefEdit";
}
elseif (!empty ($_POST['addDef']))
{
} elseif (!empty ($_POST['addDef'])) {
$displayMode = "viewDefEdit";
}
elseif (!empty($_GET['moveUpDef']))
{
} elseif (!empty($_GET['moveUpDef'])) {
move_cat_rank($_GET['moveUpDef'], "up");
$displayMode = "viewDefList";
}
elseif (!empty($_GET['moveDownDef']))
{
} elseif (!empty($_GET['moveDownDef'])) {
move_cat_rank($_GET['moveDownDef'], "down");
$displayMode = "viewDefList";
}
elseif (!empty($_POST['viewDefList']))
{
} elseif (!empty($_POST['viewDefList'])) {
$displayMode = "viewDefList";
}
elseif (!empty($_GET['editMainUserInfo']))
{
} elseif (!empty($_GET['editMainUserInfo'])) {
$userIdViewed = strval(intval($_GET['editMainUserInfo']));
$displayMode = "viewMainInfoEdit";
}
elseif (!empty($_REQUEST['submitMainUserInfo']))
{
} elseif (!empty($_REQUEST['submitMainUserInfo'])) {
/*
if (isset ($_REQUEST['submitMainUserInfo']))
{
@ -237,25 +215,19 @@ if ($allowedToEditDef)
// COMMON COMMANDS
if ($allowedToEditContent)
{
if (isset($_POST['submitContent']))
{
if ($_POST['cntId']) // submit a content change
{
edit_cat_content($_POST['catId'], $userIdViewed, $_POST['content'], $_SERVER['REMOTE_ADDR']);
if ($allowedToEditContent) {
if (isset($_POST['submitContent'])) {
if ($_POST['cntId']) {
// submit a content change
edit_cat_content($_POST['catId'], $userIdViewed, $_POST['content'], $_SERVER['REMOTE_ADDR']);
}
else // submit a totally new content
{
fill_new_cat_content($_POST['catId'], $userIdViewed, $_POST['content'], $_SERVER['REMOTE_ADDR']);
} else {
// submit a totally new content
fill_new_cat_content($_POST['catId'], $userIdViewed, $_POST['content'], $_SERVER['REMOTE_ADDR']);
}
$displayMode = "viewContentList";
}
elseif (!empty($_GET['editContent']))
{
} elseif (!empty($_GET['editContent'])) {
$displayMode = "viewContentEdit";
$userIdViewed = $userIdViewed;
}
@ -264,13 +236,17 @@ if ($allowedToEditContent)
/* DISPLAY MODES */
// Back button for each display mode (Top)
if (api_is_allowed_to_edit()) {
if (api_is_allowed_to_edit(null, true)) {
echo '<div class="actions">';
echo '<a href="user.php?'.api_get_cidreq().'&amp;origin='.$origin.'">'.Display::return_icon('back.png',get_lang('BackUser')).get_lang('BackUser').'</a>';
if (!is_numeric($_GET['editMainUserInfo'])) {
echo '<a href="userInfo.php?'.api_get_cidreq().'&amp;origin='.$origin.'&amp;editMainUserInfo='.$userIdViewed.'">'.Display::return_icon('edit.gif',get_lang('EditUser')).get_lang('EditUser').'</a>';
if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true') {
echo '<a href="userInfo.php?'.api_get_cidreq().'&amp;origin='.$origin.'&amp;editMainUserInfo='.$userIdViewed.'">'.Display::return_icon('edit.gif',get_lang('EditUser')).get_lang('EditUser').'</a>';
}
} else {
echo '<a href="userInfo.php?'.api_get_cidreq().'&amp;origin='.$origin.'&amp;uInfo='.$userIdViewed.'">'.Display::return_icon('members.gif',get_lang('ViewUser')).get_lang('ViewUser').'</a>';
if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true') {
echo '<a href="userInfo.php?'.api_get_cidreq().'&amp;origin='.$origin.'&amp;uInfo='.$userIdViewed.'">'.Display::return_icon('members.gif',get_lang('ViewUser')).get_lang('ViewUser').'</a>';
}
}
echo '<a href="../mySpace/myStudents.php?'.api_get_cidreq().'&amp;origin=user_course&amp;student='.$userIdViewed.'&amp;details=true&amp;course='.$_course['id'].'">'.Display::return_icon('statistics.gif',get_lang('UserStatistics')).get_lang('UserStatistics').'</a>';
echo '</div>';
@ -286,8 +262,7 @@ if (api_is_allowed_to_edit()) {
$user_info_viewed = api_get_user_info($userIdViewed);
$is_session_course_coach = UserManager::is_session_course_coach($userIdViewed, $_course['sysCode'], $current_session_id);
if ($displayMode == "viewDefEdit")
{
if ($displayMode == "viewDefEdit") {
/*>>>>>>>>>>>> CATEGORIES DEFINITIONS : EDIT <<<<<<<<<<<<*/
$catToEdit = get_cat_def($_GET['editDef']);
@ -304,38 +279,28 @@ if ($displayMode == "viewDefEdit")
$edit_heading_form->addElement('submit', 'submitDef', get_lang('Ok'));
$edit_heading_form->setDefaults($catToEdit);
$edit_heading_form->display();
}
elseif ($displayMode == "viewDefList")
{
} elseif ($displayMode == "viewDefList") {
/*>>>>>>>>>>>> CATEGORIES DEFINITIONS : LIST <<<<<<<<<<<<*/
$catList = get_cat_def_list();
if ($catList)
{
foreach ($catList as $thisCat)
{
if ($catList) {
foreach ($catList as $thisCat) {
// displays Title and comments
echo "<p>", "<b>".htmlize($thisCat['title'])."</b><br>\n", "<i>".htmlize($thisCat['comment'])."</i>\n", "</p>";
// displays lines
echo "<blockquote>\n", "<font color=\"gray\">\n";
for ($i = 1; $i <= $thisCat['nbline']; $i ++)
{
for ($i = 1; $i <= $thisCat['nbline']; $i ++) {
echo "<br>__________________________________________\n";
}
echo "</font>\n", "</blockquote>\n";
// displays commands
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&removeDef=", $thisCat['catId'], "\">", "<img src=\"../img/delete.gif\" border=\"0\" alt=\"".get_lang('Remove')."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset))."')) return false;\">", "</a>", "<a href=\"".api_get_self()."?".api_get_cidreq()."&editDef=", $thisCat['catId'], "\">", "<img src=\"../img/edit.gif\" border=\"0\" alt=\"".get_lang('Edit')."\" />", "</a>", "<a href=\"".api_get_self()."?".api_get_cidreq()."&moveUpDef=", $thisCat['catId'], "\">", "<img src=\"../img/up.gif\" border=\"0\" alt=\"".get_lang('MoveUp')."\">", "</a>", "<a href=\"".api_get_self()."?".api_get_cidreq()."&moveDownDef=", $thisCat['catId'], "\">", "<img src=\"../img/down.gif\" border=\"0\" alt=\"".get_lang('MoveDown')."\">", "</a>\n";
} // end for each
} // end if ($catList)
echo "<center>\n",
@ -344,8 +309,7 @@ elseif ($displayMode == "viewDefList")
"</form>\n",
"<center>\n";
}
elseif ($displayMode == "viewContentEdit")
{
elseif ($displayMode == "viewContentEdit") {
/*>>>>>>>>>>>> CATEGORIES CONTENTS : EDIT <<<<<<<<<<<<*/
$catToEdit = get_cat_content($userIdViewed, $_GET['editContent']);
@ -354,12 +318,9 @@ elseif ($displayMode == "viewContentEdit")
$content_heading_form->addElement('hidden', 'catId');
$content_heading_form->addElement('hidden', 'uInfo');
$content_heading_form->addElement('static', null, $catToEdit['title'], htmlize($catToEdit['comment']));
if ($catToEdit['nbline'] == 1)
{
if ($catToEdit['nbline'] == 1) {
$content_heading_form->addElement('text', 'content', null, array ('size' => 80));
}
else
{
} else {
$content_heading_form->addElement('textarea', 'content', null, array ('cols' => 60, 'rows' => $catToEdit['nbline']));
}
$content_heading_form->addElement('submit', 'submitContent', get_lang('Ok'));
@ -368,16 +329,13 @@ elseif ($displayMode == "viewContentEdit")
$defaults['uInfo'] = $userIdViewed;
$content_heading_form->setDefaults($defaults);
$content_heading_form->display();
}
elseif ($displayMode == "viewMainInfoEdit")
{
} elseif ($displayMode == "viewMainInfoEdit") {
/*>>>>>>>>>>>> CATEGORIES MAIN INFO : EDIT <<<<<<<<<<<<*/
$mainUserInfo = get_main_user_info($userIdViewed, $courseCode);
if ($mainUserInfo)
{
if ($mainUserInfo) {
($mainUserInfo['status'] == COURSEMANAGER) ? $courseAdminChecked = "checked" : $courseAdminChecked = "";
if ($current_session_id) {
@ -400,7 +358,6 @@ elseif ($displayMode == "viewMainInfoEdit")
echo '<input type="image" src="'.$image_array['dir'].$image_array['file'].'" onclick="return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');"/>';
}
//"<td>", get_lang('Tutor'), "</td>\n",
echo "<form action=\"".api_get_self()."\" method=\"post\">\n",
"<input type=\"hidden\" name=\"submitMainUserInfo\" value=\"$userIdViewed\" />\n",
"<table width=\"80%\" border=\"0\">",
@ -423,14 +380,9 @@ elseif ($displayMode == "viewMainInfoEdit")
echo "</tr>\n",
"<tr align=\"center\">",
"<td align=\"left\"><b>", htmlize(api_get_person_name($mainUserInfo['firstName'], $mainUserInfo['lastName'])), "</b></td>\n",
"<td align=\"left\"><input type=\"text\" name =\"role\" value=\"", $mainUserInfo['role'], "\" maxlength=\"40\" /></td>";
//"<td><input class=\"checkbox\" type=\"checkbox\" name=\"promoteTutor\" value=\"1\" ", $tutorChecked, " /></td>";
//aca
"<td align=\"left\"><input type=\"text\" name =\"role\" value=\"", $mainUserInfo['role'], "\" maxlength=\"40\" /></td>";
if (!($is_courseAdmin && $_user['user_id'] == $userIdViewed)) {
if ($current_session_id) {
if ($user_info_viewed['status'] == COURSEMANAGER) {
echo "<td><input class=\"checkbox\" type=\"checkbox\" name=\"promoteTutor\" value=\"1\" ", $tutorChecked, " /></td>";
@ -441,17 +393,13 @@ elseif ($displayMode == "viewMainInfoEdit")
} else {
echo "<td><input class=\"checkbox\" type=\"checkbox\" name=\"promoteCourseAdmin\" value=\"1\"", $courseAdminChecked, " /></td>\n";
}
}
}
} else {
echo "<td>", get_lang('CourseManager'), "</td>\n";
}
echo "<td><button class=\"save\" type=\"submit\" name=\"submit\">".get_lang('SaveChanges')."</button></td>\n", "</tr>", "</table>", "</form>\n";
echo "<p>".Display :: encrypted_mailto_link($mainUserInfo['email'], $mainUserInfo['email'])."</p>";
@ -470,14 +418,12 @@ elseif ($displayMode == "viewMainInfoEdit")
{
Display :: display_normal_message(get_lang('ThisStudentIsSubscribeThroughASession'));
}
}
elseif ($displayMode == "viewContentList") // default display
{
} elseif ($displayMode == "viewContentList") {
// default display
/*>>>>>>>>>>>> CATEGORIES CONTENTS : LIST <<<<<<<<<<<<*/
$virtual_course_code = $_GET["virtual_course"];
if (isset ($virtual_course_code))
{
if (isset ($virtual_course_code)) {
$courseCode = $virtual_course_code;
//not supported yet: editing users of virtual courses
$allowedToEditDef = false;
@ -485,8 +431,7 @@ elseif ($displayMode == "viewContentList") // default display
$mainUserInfo = get_main_user_info($userIdViewed, $courseCode);
if ($mainUserInfo)
{
if ($mainUserInfo) {
$image_array=UserManager::get_user_picture_path_by_id($userIdViewed,'web',false,true);
// get the path,width and height from original picture
$big_image = $image_array['dir'].'big_'.$image_array['file'];
@ -505,13 +450,9 @@ elseif ($displayMode == "viewContentList") // default display
$users_online = who_is_online(30);
foreach ($users_online as $online) {
if (in_array($userIdViewed, $online)) {
$online = Display::return_icon('online.gif', get_lang('OnLine'),array('style'=>'with="8"; height="8"'));
break;
}
else
{
} else {
$online ='';
}
@ -539,7 +480,7 @@ elseif ($displayMode == "viewContentList") // default display
}
}
echo ($allowedToEditDef?"<td>".get_lang('Edit')."</td>\n":""),
echo ($allowedToEditDef && api_get_setting('allow_user_course_subscription_by_course_admin') == 'true'?"<td>".get_lang('Edit')."</td>\n":""),
($is_allowedToTrack?"<td>".get_lang('Tracking')."</td>\n":""),
"</tr>\n",
@ -574,7 +515,7 @@ elseif ($displayMode == "viewContentList") // default display
}
}
if ($allowedToEditDef) {
if ($allowedToEditDef && api_get_setting('allow_user_course_subscription_by_course_admin') == 'true') {
echo "<td>",
"<a href=\"".api_get_self()."?".api_get_cidreq()."&editMainUserInfo=$userIdViewed\">",
"<img border=\"0\" alt=\"\" src=\"../img/edit.gif\" />",

Loading…
Cancel
Save