当前位置: 首页>>代码示例>>PHP>>正文


PHP SessionManager::fetch方法代码示例

本文整理汇总了PHP中SessionManager::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionManager::fetch方法的具体用法?PHP SessionManager::fetch怎么用?PHP SessionManager::fetch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SessionManager的用法示例。


在下文中一共展示了SessionManager::fetch方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: WSFetchSession

/**
 * Web service to get a session by its id. Optionally can get its extra fields values
 * @param array $params Contains the following parameters:
 *   int $params['id'] The session id
 *   string $params['extrafields'] Extrafields to include in request result
 *   string $params['secret_key'] Secret key to check
 * @return array The session data
 */
function WSFetchSession($params)
{
    if (!WSHelperVerifyKey($params['secret_key'])) {
        return return_error(WS_ERROR_SECRET_KEY);
    }
    $fieldsToInclude = explode(',', $params['extrafields']);
    foreach ($fieldsToInclude as &$field) {
        if (empty($field)) {
            continue;
        }
        $field = trim($field);
    }
    $sessionData = SessionManager::fetch($params['id']);
    if ($sessionData === false) {
        return return_error(WS_ERROR_INVALID_INPUT);
    }
    if (!empty($extraFields)) {
        $sessionData['extra'] = SessionManager::getFilteredExtraFields($params['id'], $fieldsToInclude);
    }
    return array($sessionData);
}
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:29,代码来源:registration.soap.php

示例2: header

    } 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') . '&nbsp;&nbsp;&nbsp;';
    $link_add_type_multiple = '<a href="' . api_get_self() . '?id_session=' . $id_session . '&add=' . Security::remove_XSS($_GET['add']) . '&add_type=multiple">' . Display::return_icon('multiple.gif') . get_lang('SessionAddTypeMultiple') . '</a>';
}
// the form header
$session_info = SessionManager::fetch($id_session);
echo '<div class="actions">';
echo $link_add_type_unique . $link_add_type_multiple;
echo '</div>';
/*$sql = 'SELECT COUNT(1) FROM '.$tbl_course;
$rs = Database::query($sql);
$count_courses = Database::result($rs, 0, 0);*/
$ajax_search = $add_type == 'unique' ? true : false;
$nosessionCourses = $sessionCourses = array();
if ($ajax_search) {
    $sql = "SELECT code, title, visual_code, id_session\n\t\t\tFROM {$tbl_course} course\n\t\t\tINNER JOIN {$tbl_session_rel_course} session_rel_course\n\t\t\t\tON course.id = session_rel_course.c_id\n\t\t\t\tAND session_rel_course.id_session = " . intval($id_session) . "\n\t\t\tORDER BY " . (sizeof($courses) ? "(course.code IN(" . implode(',', $courses) . ")) DESC," : "") . " title";
    if (api_is_multiple_url_enabled()) {
        $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
        $access_url_id = api_get_current_access_url_id();
        if ($access_url_id != -1) {
            $sql = "SELECT code, title, visual_code, id_session\n\t\t\tFROM {$tbl_course} course\n\t\t\tINNER JOIN {$tbl_session_rel_course} session_rel_course\n\t\t\t\tON course.code = session_rel_course.course_code\n\t\t\t\tAND session_rel_course.id_session = " . intval($id_session) . "\n\t\t\t\tINNER JOIN {$tbl_course_rel_access_url} url_course ON (url_course.c_id = course.id)\n\t\t\t\tWHERE access_url_id = {$access_url_id}\n\t\t\tORDER BY " . (sizeof($courses) ? "(course.code IN(" . implode(',', $courses) . ")) DESC," : "") . " title";
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:add_courses_to_session.php

示例3: Category

     CourseManager::delete_course($_GET['delete_course']);
     $obj_cat = new Category();
     $obj_cat->update_category_delete($_GET['delete_course']);
 }
 // Create a search-box
 $form = new FormValidator('search_simple', 'get', '', '', array('class' => 'form-search'), false);
 $form->addElement('text', 'keyword', null);
 $form->addElement('style_submit_button', 'submit', get_lang('SearchCourse'), 'class="btn"');
 $form->addElement('static', 'search_advanced_link', null, '<a href="course_list.php?search=advanced">' . get_lang('AdvancedSearch') . '</a>');
 // Create a filter by session
 $sessionFilter = new FormValidator('course_filter', 'get', '', '', array('class' => 'form-search'), false);
 $url = api_get_path(WEB_AJAX_PATH) . 'session.ajax.php?a=search_session';
 $sessionList = array();
 if (!empty($sessionId)) {
     $sessionList = array();
     $sessionInfo = SessionManager::fetch($sessionId);
     $sessionList[] = array('id' => $sessionInfo['id'], 'text' => $sessionInfo['name']);
 }
 $sessionFilter->addElement('select_ajax', 'session_name', get_lang('SearchCourseBySession'), null, array('url' => $url, 'defaults' => $sessionList));
 $courseListUrl = api_get_self();
 $actions = '
 <script>
 $(function() {
     $("#session_name").on("change", function() {
        var sessionId = $(this).val();
        window.location = "' . $courseListUrl . '?session_id="+sessionId;
     });
 });
 </script>';
 $actions .= '<div class="pull-right">';
 $actions .= '<a href="course_add.php">' . Display::return_icon('new_course.png', get_lang('AddCourse'), '', ICON_SIZE_MEDIUM) . '</a> ';
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:course_list.php

示例4: api_get_course_info_by_id

         $quizIds[] = $exercise['id'];
     }
 }
 $course = api_get_course_info_by_id($_GET['course_id']);
 $listUserSess = CourseManager::get_student_list_from_course_code($course['code'], true, $_GET['session_id']);
 $usersId = array_keys($listUserSess);
 $users = UserManager::get_user_list_by_ids($usersId, null, "lastname, firstname", "{$start} , {$limit}");
 $exeResults = $objExercise->getExerciseAndResult($_GET['course_id'], $_GET['session_id'], $quizIds);
 $arrGrade = array();
 foreach ($exeResults as $exeResult) {
     $arrGrade[$exeResult['exe_user_id']][$exeResult['exe_exo_id']] = $exeResult['exe_result'];
 }
 $result = array();
 $i = 0;
 foreach ($users as $user) {
     $sessionInfo = SessionManager::fetch($listUserSess[$user['user_id']]['id_session']);
     $result[$i]['session'] = $sessionInfo['name'];
     $result[$i]['username'] = $user['username'];
     $result[$i]['name'] = $user['lastname'] . " " . $user['firstname'];
     $j = 1;
     $finalScore = 0;
     foreach ($quizIds as $quizID) {
         $grade = "";
         if (!empty($arrGrade[$user['user_id']][$quizID]) || $arrGrade[$user['user_id']][$quizID] == 0) {
             $finalScore += $grade = $arrGrade[$user['user_id']][$quizID];
         }
         $result[$i]['exer' . $j] = $grade;
         $j++;
     }
     if ($finalScore > 20) {
         $finalScore = 20;
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:model.ajax.php

示例5: getNamedSessionCourseForCoach

 /**
  * Return an array of courses in session for user
  * and for each courses the list of session that use this course for user
  *
  * [0] => array
  *      userCatId
  *      userCatTitle
  *      courseInUserCatList
  *          [0] => array
  *              courseId
  *              title
  *              courseCode
  *              sessionCatList
  *                  [0] => array
  *                      catSessionId
  *                      catSessionName
  *                      sessionList
  *                          [0] => array
  *                              sessionId
  *                              sessionName
  *
  * @param $userId
  * @return array
  *
  */
 public static function getNamedSessionCourseForCoach($userId)
 {
     $listResults = array();
     $listCourseSession = self::getSessionCourseForUser($userId);
     foreach ($listCourseSession as $courseId => $listSessionId) {
         // Course info
         $courseInfo = api_get_course_info_by_id($courseId);
         $listOneCourse = array();
         $listOneCourse['courseId'] = $courseId;
         $listOneCourse['title'] = $courseInfo['title'];
         //$listOneCourse['courseCode'] = $courseInfo['code'];
         $listOneCourse['course'] = $courseInfo;
         $listOneCourse['sessionCatList'] = array();
         $listCat = array();
         foreach ($listSessionId as $i => $sessionId) {
             // here we got all session for this course
             // lets check there session categories
             $sessionInfo = SessionManager::fetch($sessionId);
             $catId = $sessionInfo['session_category_id'];
             if (!isset($listCat[$catId])) {
                 $listCatInfo = self::get_session_category($catId);
                 $listCat[$catId] = array();
                 $listCat[$catId]['catSessionId'] = $catId;
                 $listCat[$catId]['catSessionName'] = $listCatInfo['name'];
                 $listCat[$catId]['sessionList'] = array();
             }
             $listSessionInfo = SessionManager::fetch($sessionId);
             $listSessionIdName = array("sessionId" => $sessionId, "sessionName" => $listSessionInfo['name']);
             $listCat[$catId]['sessionList'][] = $listSessionIdName;
         }
         // sort $listCat by catSessionName
         usort($listCat, 'self::compareBySessionName');
         // in each catSession sort sessionList by sessionName
         foreach ($listCat as $i => $listCatSessionInfo) {
             $listSessionList = $listCatSessionInfo['sessionList'];
             usort($listSessionList, 'self::compareCatSessionInfo');
             $listCat[$i]['sessionList'] = $listSessionList;
         }
         $listOneCourse['sessionCatList'] = $listCat;
         // user course category
         list($userCatId, $userCatTitle) = CourseManager::getUserCourseCategoryForCourse($userId, $courseId);
         $userCatId = intval($userCatId);
         $listResults[$userCatId]['courseInUserCategoryId'] = $userCatId;
         $listResults[$userCatId]['courseInUserCategoryTitle'] = $userCatTitle;
         $listResults[$userCatId]['courseInUserCatList'][] = $listOneCourse;
     }
     // sort by user course cat
     uasort($listResults, 'self::compareByUserCourseCat');
     // sort by course title
     foreach ($listResults as $userCourseCatId => $tabCoursesInCat) {
         $courseInUserCatList = $tabCoursesInCat['courseInUserCatList'];
         uasort($courseInUserCatList, 'self::compareByCourse');
         $listResults[$userCourseCatId]['courseInUserCatList'] = $courseInUserCatList;
     }
     return $listResults;
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:81,代码来源:sessionmanager.lib.php

示例6: getSessionId

 /**
  * Gets the real session id based on the session id field name and value. Note that if the session id field name is "chamilo_session_id", it will use the session id
  * in the system database
  * 
  * @param string Session id field name
  * @param string Session id value
  * @return mixed System session id if the session was found, WSError otherwise
  */
 protected function getSessionId($session_id_field_name, $session_id_value)
 {
     if ($session_id_field_name == "chamilo_session_id") {
         $session = SessionManager::fetch((int) $session_id_value);
         if (!empty($session)) {
             return intval($session_id_value);
         } else {
             return new WSError(300, "Session not found");
         }
     } else {
         $session_id = SessionManager::get_session_id_from_original_id($session_id_value, $session_id_field_name);
         if ($session_id == 0) {
             return new WSError(300, "Session not found");
         } else {
             return $session_id;
         }
     }
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:26,代码来源:webservice.php

示例7: intval

/**
 * Code
 */
// name of the language file that needs to be included
$language_file = 'admin';
$cidReset = true;
//require_once '../inc/global.inc.php';
// setting the section (for the tabs)
$this_section = SECTION_PLATFORM_ADMIN;
$formSent = 0;
// Database Table Definitions
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$id = intval($_GET['id']);
SessionManager::protect_session_edit($id);
$infos = SessionManager::fetch($id);
$id_coach = $infos['id_coach'];
$tool_name = get_lang('EditSession');
$interbreadcrumb[] = array('url' => 'index.php', "name" => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => "session_list.php", "name" => get_lang('SessionList'));
$interbreadcrumb[] = array('url' => "resume_session.php?id_session=" . $id, "name" => get_lang('SessionOverview'));
list($year_start, $month_start, $day_start) = explode('-', $infos['date_start']);
list($year_end, $month_end, $day_end) = explode('-', $infos['date_end']);
$showDescriptionChecked = null;
if (isset($infos['show_description']) && !empty($infos['show_description'])) {
    $showDescriptionChecked = 'checked';
}
$end_year_disabled = $end_month_disabled = $end_day_disabled = '';
if (isset($_POST['formSent']) && $_POST['formSent']) {
    $formSent = 1;
    $name = $_POST['name'];
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:session_edit.php

示例8: edit_session


//.........这里部分代码省略.........

        $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);

        if (empty($nolimit)) {
            $date_start = "$year_start-" . (($month_start < 10) ? "0$month_start" : $month_start) . "-" . (($day_start < 10) ? "0$day_start" : $day_start);
            $date_end = "$year_end-" . (($month_end < 10) ? "0$month_end" : $month_end) . "-" . (($day_end < 10) ? "0$day_end" : $day_end);
        } else {
            $date_start = "0000-00-00";
            $date_end = "0000-00-00";
            $id_visibility = 1; //force read only
        }

        if (!empty($no_end_limit)) {
            $date_end = "0000-00-00";
        }

        if (empty($end_limit)) {
            $date_end = "0000-00-00";
            $id_visibility = 1; //force read only
        }

        if (empty($start_limit)) {
            $date_start = "0000-00-00";
        }

        if (empty($name)) {
            $msg = get_lang('SessionNameIsRequired');
            return $msg;
        } elseif (empty($id_coach)) {
            $msg = get_lang('CoachIsRequired');
            return $msg;
        } elseif (!empty($start_limit) && empty($nolimit) && (!$month_start || !$day_start || !$year_start || !checkdate($month_start, $day_start, $year_start))) {
            $msg = get_lang('InvalidStartDate');
            return $msg;
        } elseif (!empty($end_limit) && empty($nolimit) && (!$month_end || !$day_end || !$year_end || !checkdate($month_end, $day_end, $year_end))) {
            $msg = get_lang('InvalidEndDate');
            return $msg;
        } elseif (!empty($start_limit) && !empty($end_limit) && empty($nolimit) && $date_start >= $date_end) {
            $msg = get_lang('StartDateShouldBeBeforeEndDate');
            return $msg;
        } else {

            $rs = Database::query("SELECT id FROM $tbl_session WHERE name='" . Database::escape_string($name) . "'");
            $exists = false;
            while ($row = Database::fetch_array($rs)) {
                if ($row['id'] != $id) {
                    $exists = true;
                }
            }

            if ($exists) {
                $msg = get_lang('SessionNameAlreadyExists');
                return $msg;
            } else {

                $sessionInfo = SessionManager::fetch($id);

                $descriptionCondition = null;
                if (array_key_exists('description', $sessionInfo)) {
                    $descriptionCondition = ' description = "' . Database::escape_string($description) . '" ,';
                }

                $showDescriptionCondition = null;
                if (array_key_exists('show_description', $sessionInfo)) {
                    $showDescriptionCondition = ' show_description = "' . Database::escape_string($showDescription) . '" ,';
                }

                $durationCondition = null;
                if (self::durationPerUserIsEnabled()) {

                    if (empty($duration)) {
                        $duration = null;
                    } else {
                        $date_start = '0000-00-00';
                        $date_end = "0000-00-00";
                        $duration = intval($duration);
                    }

                    $durationCondition = ' duration = "' . $duration . '" ,';
                }

                $sql = "UPDATE $tbl_session SET
                        name='" . Database::escape_string($name) . "',
						date_start='" . $date_start . "',
						date_end='" . $date_end . "',
						id_coach='" . $id_coach . "',
						nb_days_access_before_beginning = " . $nb_days_acess_before . ",
						nb_days_access_after_end = " . $nb_days_acess_after . ",
						session_category_id = " . $id_session_category . " ,
                        $descriptionCondition
                        $showDescriptionCondition
                        $durationCondition
						visibility= " . $id_visibility . "
					  WHERE id='$id'";

                Database::query($sql);
                return $id;
            }
        }
    }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:101,代码来源:sessionmanager.lib.php

示例9: isset

$session_id = isset($_GET['session_id']) ? intval($_GET['session_id']) : null;
$sessionField = new ExtraFieldValue('session');
$valueAllowVisitors = $sessionField->get_values_by_handler_and_field_variable($session_id, 'allow_visitors');
$allowVisitors = $valueAllowVisitors != false;
if (!$allowVisitors) {
    // Only users who are logged in can proceed.
    api_block_anonymous_users();
}
$this_section = SECTION_COURSES;
$htmlHeadXtra[] = api_get_jqgrid_js();
$course_id = isset($_GET['course_id']) ? intval($_GET['course_id']) : null;
Session::write('id_session', $session_id);
// Clear the exercise session just in case
Session::erase('objExercise');
$userId = api_get_user_id();
$session_info = SessionManager::fetch($session_id);
$session_list = SessionManager::get_sessions_by_coach(api_get_user_id());
$course_list = SessionManager::get_course_list_by_session_id($session_id);
// Getting all sessions where I'm subscribed
/*$new_session_list = array();
if (!api_is_anonymous()) {
    $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id());
}
$user_course_list = array();
foreach ($new_session_list as $session_item) {
    $user_course_list[] = $session_item['code'];
}*/
$userIsGeneralCoach = SessionManager::user_is_general_coach($userId, $session_id);
$user_course_list = array();
foreach ($course_list as $course) {
    $status = SessionManager::get_user_status_in_course_session($userId, $course['real_id'], $session_id);
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:index.php

示例10: api_get_path

         if ($session_info) {
             $url = api_get_path(WEB_CODE_PATH) . 'admin/resume_session.php?id_session=' . $session_info['id'];
             $destination = Display::url($session_info['name'], $url);
             //$destination = $destination;
         }
     }
     $row_style = 'style = " background-color: #ddd;"';
     $course_link = Display::return_icon('course_na.gif', get_lang('BlockCoursesForThisUser')) . '&nbsp;';
     $moved_link = Display::return_icon('move_na.png', get_lang('ChangeUserSession')) . '&nbsp;';
     $delete_link = Display::return_icon('delete_na.png', get_lang('Delete')) . '&nbsp;';
 } else {
     $session_origin_info = SessionManager::get_session_rel_user_by_moved_to($id_session, $user['user_id']);
     if (!empty($session_origin_info)) {
         $moved_date = api_get_local_time($session_origin_info['moved_at']);
     }
     $session_info = SessionManager::fetch($session_origin_info['id_session']);
     $variation = SessionManager::get_session_change_user_reasons_variations_by_id($session_origin_info['moved_status'], 'from');
     //$information = $reasons[$session_origin_info['moved_status']].$variation;
     $information .= $variation;
     if ($session_info) {
         $url = api_get_path(WEB_CODE_PATH) . 'admin/resume_session.php?id_session=' . $session_info['id'];
         $origin = Display::url($session_info['name'], $url);
         $url = api_get_path(WEB_CODE_PATH) . 'admin/resume_session.php?id_session=' . $id_session;
         //$destination = Display::url($session['name'], $url);
         //$destination = ' / '.$destination;
     }
     $delete_link = '<a href="' . api_get_self() . '?id_session=' . $id_session . '&action=delete&user=' . $user['user_id'] . '" onclick="javascript:if(!confirm(\'' . get_lang('ConfirmYourChoice') . '\')) return false;">' . Display::return_icon('delete.png', get_lang('Delete')) . '</a>';
 }
 $link_to_add_user_in_url = '';
 if ($multiple_url_is_on) {
     if (isset($user['access_url_id']) && $user['access_url_id'] != $url_id) {
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:resume_session.php

示例11: array

             *  none: No reason code
             *  chargeback: A reversal has occurred on this transaction due to a chargeback by your customer.
             *  guarantee: A reversal has occurred on this transaction due to your customer triggering a money-back guarantee.
             *  buyer-complaint: A reversal has occurred on this transaction due to a complaint about the transaction from your customer.
             *  refund: A reversal has occurred on this transaction because you have given the customer a refund.
             *  other: A reversal has occurred on this transaction due to a reason not listed above.
             */

            $reasonCode = $resArray["PAYMENTINFO_0_REASONCODE"];

            // Insert the user information to activate the user
            if ($paymentStatus == "Completed") {
                $userId = $_SESSION['bc_user_id'];
                if ($_SESSION['bc_codetext'] === 'THIS_IS_A_SESSION') {
                    $sessionId = $_SESSION['bc_code'];
                    $all_session_information = SessionManager::fetch($sessionId);
                    SessionManager::suscribe_users_to_session(
                        $sessionId,
                        array($userId),
                        api_get_session_visibility($sessionId),
                        false
                    );
                    $url = Display::url(
                        $all_session_information['name'],
                        api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$sessionId
                    );
                    $_SESSION['bc_message'] = 'EnrollToSessionXSuccessful';
                    $_SESSION['bc_url'] = $url;
                    $_SESSION['bc_success'] = true;
                } else {
                    $course_code = $_SESSION['bc_codetext'];
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:success.php


注:本文中的SessionManager::fetch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。