本文整理汇总了PHP中SessionManager::add_courses_to_session方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionManager::add_courses_to_session方法的具体用法?PHP SessionManager::add_courses_to_session怎么用?PHP SessionManager::add_courses_to_session使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SessionManager
的用法示例。
在下文中一共展示了SessionManager::add_courses_to_session方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
i = i-1;
}
}
}
</script>';
$formSent = 0;
$errorMsg = $firstLetterCourse = $firstLetterSession = '';
$CourseList = $SessionList = array();
$courses = $sessions = array();
$noPHP_SELF = true;
if (isset($_POST['formSent']) && $_POST['formSent']) {
$formSent = $_POST['formSent'];
$firstLetterCourse = $_POST['firstLetterCourse'];
$firstLetterSession = $_POST['firstLetterSession'];
$CourseList = $_POST['SessionCoursesList'];
SessionManager::add_courses_to_session($id_session, $CourseList);
if (isset($_GET['add'])) {
header('Location: add_users_to_session.php?id_session=' . $id_session . '&add=true');
exit;
} else {
header('Location: resume_session.php?id_session=' . $id_session);
exit;
}
}
// display the dokeos header
Display::display_header($tool_name);
if ($add_type == 'multiple') {
$link_add_type_unique = '<a href="' . api_get_self() . '?id_session=' . $id_session . '&add=' . Security::remove_XSS($_GET['add']) . '&add_type=unique">' . Display::return_icon('single.gif') . get_lang('SessionAddTypeUnique') . '</a>';
$link_add_type_multiple = Display::return_icon('multiple.gif') . get_lang('SessionAddTypeMultiple') . ' ';
} else {
$link_add_type_unique = Display::return_icon('single.gif') . get_lang('SessionAddTypeUnique') . ' ';
示例2: array
{
for(var i = 0 ; i<origin.options.length ; i++) {
if(origin.options[i].selected) {
origin.options[i]=null;
i = i-1;
}
}
}
</script>';
$errorMsg = '';
$CourseList = $SessionList = array();
$courses = $sessions = array();
if (isset($_POST['formSent']) && $_POST['formSent']) {
$courseList = $_POST['SessionCoursesList'];
$copyEvaluation = isset($_POST['copy_evaluation']);
SessionManager::add_courses_to_session($sessionId, $courseList, true, $copyEvaluation);
Display::addFlash(Display::return_message(get_lang('Updated')));
if (isset($add)) {
header('Location: add_users_to_session.php?id_session=' . $sessionId . '&add=true');
} else {
header('Location: resume_session.php?id_session=' . $sessionId);
}
exit;
}
// display the header
Display::display_header($tool_name);
if ($add_type == 'multiple') {
$link_add_type_unique = '<a href="' . api_get_self() . '?id_session=' . $sessionId . '&add=' . $add . '&add_type=unique">' . Display::return_icon('single.gif') . get_lang('SessionAddTypeUnique') . '</a>';
$link_add_type_multiple = Display::return_icon('multiple.gif') . get_lang('SessionAddTypeMultiple') . ' ';
} else {
$link_add_type_unique = Display::return_icon('single.gif') . get_lang('SessionAddTypeUnique') . ' ';
示例3: importSessionsStatic
/**
* Updates the session synchronize with the csv file.
* @param string $file
*/
private function importSessionsStatic($file)
{
$content = file($file);
$sessions = array();
if (!api_strstr($content[0], ';')) {
$error_message = get_lang('NotCSV');
} else {
$tag_names = array();
foreach ($content as $key => $enreg) {
$enreg = explode(';', trim($enreg));
if ($key) {
foreach ($tag_names as $tag_key => $tag_name) {
$sessions[$key - 1][$tag_name] = $enreg[$tag_key];
}
} else {
foreach ($enreg as $tag_name) {
$tag_names[] = api_preg_replace('/[^a-zA-Z0-9_\\-]/', '', $tag_name);
}
if (!in_array('SessionName', $tag_names) || !in_array('DateStart', $tag_names) || !in_array('DateEnd', $tag_names)) {
$error_message = get_lang('NoNeededData');
break;
}
}
}
}
if (!empty($sessions)) {
// Looping the sessions.
foreach ($sessions as $session) {
if (!empty($session['SessionID'])) {
$sessionId = SessionManager::get_session_id_from_original_id($session['SessionID'], $this->extraFieldIdNameList['session']);
$coachUserName = isset($session['Coach']) ? $session['Coach'] : null;
$categoryId = isset($session['category_id']) ? $session['category_id'] : null;
// 2014-06-30
$dateStart = explode('/', $session['DateStart']);
$dateEnd = explode('/', $session['DateEnd']);
$visibility = $this->defaultSessionVisibility;
$coachId = null;
if (!empty($coachUserName)) {
$coachInfo = api_get_user_info_from_username($coachUserName);
$coachId = $coachInfo['user_id'];
}
if (empty($sessionId)) {
$result = SessionManager::create_session($session['SessionName'], $dateStart[0], $dateStart[1], $dateStart[2], $dateEnd[0], $dateEnd[1], $dateEnd[2], $this->daysCoachAccessBeforeBeginning, $this->daysCoachAccessAfterBeginning, null, $coachUserName, $categoryId, $visibility, 1);
if (is_numeric($result)) {
$sessionId = $result;
SessionManager::update_session_extra_field_value($sessionId, $this->extraFieldIdNameList['session'], $session['SessionID']);
}
} else {
$sessionInfo = api_get_session_info($sessionId);
$accessBefore = null;
$accessAfter = null;
if (empty($sessionInfo['nb_days_access_before_beginning']) || !empty($sessionInfo['nb_days_access_before_beginning']) && $sessionInfo['nb_days_access_before_beginning'] < $this->daysCoachAccessBeforeBeginning) {
$accessBefore = intval($this->daysCoachAccessBeforeBeginning);
}
$accessAfter = null;
if (empty($sessionInfo['nb_days_access_after_end']) || !empty($sessionInfo['nb_days_access_after_end']) && $sessionInfo['nb_days_access_after_end'] < $this->daysCoachAccessAfterBeginning) {
$accessAfter = intval($this->daysCoachAccessAfterBeginning);
}
$showDescription = isset($sessionInfo['show_description']) ? $sessionInfo['show_description'] : 1;
$result = SessionManager::edit_session($sessionId, $session['SessionName'], $dateStart[0], $dateStart[1], $dateStart[2], $dateEnd[0], $dateEnd[1], $dateEnd[2], $accessBefore, $accessAfter, null, $coachId, $categoryId, $visibility, true, true, null, $showDescription);
if (is_numeric($result)) {
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$params = array('description' => $session['SessionDescription']);
Database::update($tbl_session, $params, array('id = ?' => $sessionId));
}
}
// Courses
$courses = explode('|', $session['Courses']);
$courseList = array();
foreach ($courses as $course) {
$courseArray = bracketsToArray($course);
$courseCode = $courseArray[0];
if (CourseManager::course_exists($courseCode)) {
$courseList[] = $courseCode;
}
}
SessionManager::add_courses_to_session($sessionId, $courseList, true);
if (!empty($sessionId)) {
$courses = explode('|', $session['Courses']);
foreach ($courses as $course) {
$courseArray = bracketsToArray($course);
$courseCode = $courseArray[0];
if (CourseManager::course_exists($courseCode)) {
// Coaches
$courseCoaches = isset($courseArray[1]) ? $courseArray[1] : null;
$courseCoaches = explode(',', $courseCoaches);
if (!empty($courseCoaches)) {
$coachList = array();
foreach ($courseCoaches as $courseCoach) {
$courseCoachId = UserManager::get_user_id_from_username($courseCoach);
if ($courseCoachId !== false) {
// Just insert new coaches
$coachList[] = $courseCoachId;
}
}
SessionManager::updateCoaches($sessionId, $courseCode, $coachList, true);
//.........这里部分代码省略.........
示例4: changeCourseSubscription
/**
* Change course subscription
*
* @param string Course id field name
* @param string Course id value
* @param string Session id field name
* @param string Session id value
* @param int State (1 to subscribe, 0 to unsubscribe)
* @return mixed True on success, WSError otherwise
*/
protected function changeCourseSubscription($course_id_field_name, $course_id_value, $session_id_field_name, $session_id_value, $state)
{
$session_id = $this->getSessionId($session_id_field_name, $session_id_value);
if ($session_id instanceof WSError) {
return $session_id;
} else {
$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
if ($course_id instanceof WSError) {
return $course_id;
} else {
if ($state == 1) {
SessionManager::add_courses_to_session($session_id, array($course_id));
return true;
} else {
$result = SessionManager::unsubscribe_course_from_session($session_id, $course_id);
if ($result) {
return true;
} else {
return new WSError(304, 'Error unsubscribing course from session');
}
}
}
}
}
示例5: transaction_curso_matricula
/**
* Cambiar curso de progr. académ. (de nada a A) curso_matricula CID ORIG DEST
* @todo Unused ?
*
*/
static function transaction_curso_matricula($data)
{
$course_code = self::get_real_course_code($data['item_id']);
$courseInfo = api_get_course_info($course_code);
$uidIdPrograma = $data['orig_id'];
$uidIdProgramaDestination = $data['dest_id'];
global $data_list;
//$session_id = self::get_session_id_by_programa_id($uidIdPrograma, $data_list);
$destination_session_id = self::get_session_id_by_programa_id($uidIdProgramaDestination, $data_list);
if (!empty($course_code)) {
if (empty($uidIdPrograma) && !empty($uidIdProgramaDestination) && !empty($destination_session_id)) {
SessionManager::add_courses_to_session($destination_session_id, array($courseInfo['real_id']));
return array('message' => "Session updated {$uidIdPrograma}", 'status_id' => self::TRANSACTION_STATUS_SUCCESSFUL);
} else {
return array('message' => "Session destination was not found - [dest_id] not found", 'status_id' => self::TRANSACTION_STATUS_FAILED);
}
} else {
return array('message' => "Course does not exists {$course_code}", 'status_id' => self::TRANSACTION_STATUS_FAILED);
}
}
示例6: createCourseSessions
/**
* Creates one session per course with $administratorId as the creator and
* adds it to the session starting on $startDate and finishing on $endDate
* @param array $courses Courses
* @param int $administratorId Administrator id
* @param date $startDate First day of the month
* @param date $endDate Last day of the month
* @return void
*/
function createCourseSessions($courses, $administratorId, $startDate, $endDate)
{
echo "\n";
echo $courses ? "Creating sessions and adding courses for the period between " . $startDate . " and " . $endDate : "Every course is already in session for the period between " . $startDate . " and " . $endDate;
echo "\n=====================================================================================\n\n";
// Loop through courses creating one session per each and adding them
foreach ($courses as $course) {
//$period = date("m/Y", api_strtotime($startDate));
$month = date("m", api_strtotime($startDate));
$year = date("Y", api_strtotime($startDate));
$quarter = getQuarter($month);
$quarter = getQuarterRoman($quarter);
$period = $year . '-' . $quarter;
$sessionName = '[' . $period . '] ' . $course['title'];
$sessionId = SessionManager::create_session($sessionName, $startDate, $endDate, null, null, null, null, $administratorId, 0, SESSION_INVISIBLE);
SessionManager::add_courses_to_session($sessionId, array($course['id']));
echo "Session '" . $sessionName . "' created.\nCourse '" . $course['title'] . "' added.\n\n";
}
}
示例7: WSSuscribeCoursesToSession
function WSSuscribeCoursesToSession($params)
{
global $debug;
if (!WSHelperVerifyKey($params)) {
return returnError(WS_ERROR_SECRET_KEY);
}
if ($debug) {
error_log('WSSuscribeCoursesToSession: ' . print_r($params, 1));
}
$coursessessions_params = $params['coursessessions'];
$results = array();
$orig_course_id_value = array();
$orig_session_id_value = array();
foreach ($coursessessions_params as $coursesession_param) {
$original_session_id_value = $coursesession_param['original_session_id_value'];
$original_session_id_name = $coursesession_param['original_session_id_name'];
$original_course_id_name = $coursesession_param['original_course_id_name'];
$original_course_id_values = $coursesession_param['original_course_id_values'];
$orig_session_id_value[] = $original_session_id_value;
$sessionId = SessionManager::getSessionIdFromOriginalId($original_session_id_value, $original_session_id_name);
// Get course list from row_original_course_id_values
foreach ($original_course_id_values as $row_original_course_list) {
$courseInfo = CourseManager::getCourseInfoFromOriginalId($row_original_course_list['course_code'], $original_course_id_name);
if (empty($courseInfo) || isset($courseInfo) && $courseInfo['visibility'] == 0) {
$results[] = 0;
continue;
// Original_course_id_value doesn't exist.
} else {
$courseCode = $courseInfo['code'];
SessionManager::add_courses_to_session($sessionId, array($courseInfo['real_id']), false);
if ($debug) {
error_log("add_courses_to_session: course:{$courseCode} to session:{$sessionId}");
}
$results[] = 1;
$orig_course_id_value[] = $original_session_id_value;
$orig_session_id_value[] = $row_original_course_list['course_code'];
}
}
}
$count_results = count($results);
$output = array();
for ($i = 0; $i < $count_results; $i++) {
$output[] = array('original_course_id_values' => $orig_course_id_value[$i], 'original_session_id_value' => $orig_session_id_value[$i], 'result' => $results[$i]);
}
return $output;
}
示例8: remove_item
function remove_item(origin)
{
for(var i = 0 ; i<origin.options.length ; i++) {
if(origin.options[i].selected) {
origin.options[i]=null;
i = i-1;
}
}
}
</script>';
$errorMsg = '';
$CourseList = $SessionList = array();
$courses = $sessions = array();
if (isset($_POST['formSent']) && $_POST['formSent']) {
$courseList = $_POST['SessionCoursesList'];
SessionManager::add_courses_to_session($sessionId, $courseList, true);
Display::addFlash(Display::return_message(get_lang('Updated')));
if (isset($add)) {
header('Location: add_users_to_session.php?id_session=' . $sessionId . '&add=true');
} else {
header('Location: resume_session.php?id_session=' . $sessionId);
}
exit;
}
// display the header
Display::display_header($tool_name);
if ($add_type == 'multiple') {
$link_add_type_unique = '<a href="' . api_get_self() . '?id_session=' . $sessionId . '&add=' . $add . '&add_type=unique">' . Display::return_icon('single.gif') . get_lang('SessionAddTypeUnique') . '</a>';
$link_add_type_multiple = Display::return_icon('multiple.gif') . get_lang('SessionAddTypeMultiple') . ' ';
} else {
$link_add_type_unique = Display::return_icon('single.gif') . get_lang('SessionAddTypeUnique') . ' ';