// Execute COMMAND section //------------------------------------ $cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : null; switch ($cmd) { case 'sub': //execute subscription command... $done = user_add_to_course($user_id, $cidToEdit, false, false, null); // Set status requested if ($_REQUEST['isCourseManager']) { $properties['isCourseManager'] = 1; $properties['tutor'] = 1; } else { $properties['isCourseManager'] = 0; $properties['tutor'] = 0; } user_set_course_properties($user_id, $cidToEdit, $properties); //set dialogbox message if ($done) { $dialogBox->success(get_lang('The user has been enroled to the course')); } break; } //build and call DB to get info about current course (for title) if needed : $courseData = claro_get_course_data($cidToEdit); if (!$courseData) { unset($_REQUEST['cidToEdit']); claro_die('ERROR : COURSE NOT FOUND!!!'); } //---------------------------------- // Build query and find info in db //----------------------------------
$cfrom = isset($_REQUEST['cfrom']) ? $_REQUEST['cfrom'] : ''; $cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : null; switch ($cmd) { case 'exUpdateCourseUserProperties': if (isset($_REQUEST['profileId'])) { $properties['profileId'] = $_REQUEST['profileId']; } if (isset($_REQUEST['isTutor'])) { $properties['tutor'] = (int) $_REQUEST['isTutor']; } else { $properties['tutor'] = 0; } if (isset($_REQUEST['role'])) { $properties['role'] = trim($_REQUEST['role']); } $done = user_set_course_properties($uidToEdit, $cidToEdit, $properties); if (!$done) { $dialogBox->warning(get_lang('No change applied')); } elseif (!empty($properties['profileId'])) { if (claro_get_profile_label($properties['profileId']) == 'manager') { $dialogBox->success(get_lang('User is now course manager')); } else { $dialogBox->success(get_lang('User is now student for this course')); } } break; } //------------------------------------ // FIND GLOBAL INFO SECTION //------------------------------------ if (isset($uidToEdit)) {
} if ($courseRegistration->addUser()) { $claroline->log('COURSE_SUBSCRIBE', array('user' => $userId, 'course' => $courseCode)); $displayMode = DISPLAY_MESSAGE_SCREEN; if (claro_get_current_user_id() != $uidToEdit) { // Message for admin $dialogBox->success(get_lang('The user has been enroled to the course')); } else { $dialogBox->success(get_lang('You\'ve been enroled on the course')); } $properties = array(); if ($asTeacher && claro_is_platform_admin()) { $properties['isCourseManager'] = 1; $properties['role'] = get_lang('Course manager'); $properties['tutor'] = 1; user_set_course_properties($userId, $courseCode, $properties); } } else { switch ($courseRegistration->getStatus()) { case Claro_CourseUserRegistration::STATUS_KEYVALIDATION_FAILED: $displayMode = DISPLAY_REGISTRATION_KEY_FORM; $dialogBox->error($courseRegistration->getErrorMessage()); break; case Claro_CourseUserRegistration::STATUS_SYSTEM_ERROR: $displayMode = DISPLAY_MESSAGE_SCREEN; $dialogBox->error($courseRegistration->getErrorMessage()); break; case Claro_CourseUserRegistration::STATUS_REGISTRATION_NOTAVAILABLE: $displayMode = DISPLAY_REGISTRATION_DISABLED_FORM; $dialogBox->error($courseRegistration->getErrorMessage()); $dialogBox->info(get_lang('Please contact the course manager : %email', array('%email' => '<a href="mailto:' . $courseObj->email . '?body=' . $courseObj->officialCode . '&subject=[' . rawurlencode(get_conf('siteName')) . ']' . '">' . claro_htmlspecialchars($courseObj->titular) . '</a>')));
/** * set or unset course tutor status for a user in a course * * @author Hugues Peeters <*****@*****.**> * * @param boolean $status, 'true' for tutor status, 'false' for not ... * @param int $userId user ID from the course_user table * @param string $courseId course code from the cours table * * @return boolean TRUE if update succeed * boolean FALSE otherwise. */ function user_set_course_tutor($status, $userId, $courseId) { $status = $status == true ? 1 : 0; return user_set_course_properties($userId, $courseId, array('tutor' => $status)); }
$tbl_crs_names = claro_sql_get_course_tbl(); $tbl_group_rel_team_user = $tbl_crs_names['group_rel_team_user']; $sql = "SELECT COUNT(user)\n FROM `" . $tbl_group_rel_team_user . "`\n WHERE user = "******"viewContentList"; } } // COMMON COMMANDS if ($allowedToEditContent) { if (isset($_REQUEST['submitContent'])) { if ($_REQUEST['cntId']) { claro_user_info_edit_cat_content($_REQUEST['catId'], $userIdViewed, $_REQUEST['content'], $_SERVER['REMOTE_ADDR']); } else { claro_user_info_fill_new_cat_content($_REQUEST['catId'], $userIdViewed, $_REQUEST['content'], $_SERVER['REMOTE_ADDR']); } $displayMode = "viewContentList"; } elseif (isset($_REQUEST['editContent'])) { $displayMode = "viewContentEdit"; }