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


PHP SessionManager::get_sessions_by_user方法代码示例

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


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

示例1: api_is_platform_admin

}
echo '</div>';
if ($displayMessage != "") {
    Display::display_confirmation_message($displayMessage);
    $displayMessage = "";
}
// Form
echo '<form class="form-horizontal" name="question_pool" method="GET" action="' . $url . '">';
// Title
echo '<legend>' . $nameTools . ' - ' . $titleAdd . '</legend>';
if (isset($type)) {
    echo '<input type="hidden" name="type" value="1">';
}
echo '<input type="hidden" name="fromExercise" value="' . $fromExercise . '">';
// Session list, if sessions are used.
$sessionList = SessionManager::get_sessions_by_user(api_get_user_id(), api_is_platform_admin());
$tabAttrParam = array('class' => 'chzn-select', 'onchange' => 'submit_form(this)');
$labelFormRow = get_lang('Session');
$session_select_list = array();
foreach ($sessionList as $item) {
    $session_select_list[$item['session_id']] = $item['session_name'];
}
$select_session_html = Display::select('session_id', $session_select_list, $session_id, $tabAttrParam);
echo Display::form_row($labelFormRow, $select_session_html);
// Course list, get course list of session, or for course where user is admin
if (!empty($session_id) && $session_id != '-1' && !empty($sessionList)) {
    $sessionInfo = array();
    foreach ($sessionList as $session) {
        if ($session['session_id'] == $session_id) {
            $sessionInfo = $session;
        }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:question_pool.php

示例2: foreach

foreach ($data as $label => $item) {
    if (!empty($label)) {
        $label = $label . ': ';
    }
    $table->setCellContents($row, 0, $label . $item);
    $csvContent[] = array($label, strip_tags($item));
    $row++;
}
$trackingInformation = $table->toHtml();
$tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$user_id = $user['user_id'];
$sessions = SessionManager::get_sessions_by_user($user_id, true);
$personal_course_list = array();
$courseToolInformationTotal = null;
if (count($sessions) > 0) {
    $sessionInformation = null;
    $header = array(array(get_lang('Code'), true), array(get_lang('Title'), true), array(get_lang('Status'), true), array(get_lang('TimeSpentInTheCourse'), true), array(get_lang('TotalPostsInAllForums'), true), array('', false));
    $headerList = array();
    foreach ($header as $item) {
        $headerList[] = $item[0];
    }
    $csvContent[] = array();
    $csvContent[] = array(get_lang('Sessions'));
    foreach ($sessions as $session_item) {
        $data = array();
        $personal_course_list = array();
        $id_session = $session_item['session_id'];
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:user_information.php

示例3: displayActions

 /**
  * @param int $filter
  * @param string $view
  * @return string
  */
 public function displayActions($view, $filter = 0)
 {
     $courseInfo = api_get_course_info();
     $actionsLeft = '';
     $actionsLeft .= "<a href='" . api_get_path(WEB_CODE_PATH) . "calendar/agenda_js.php?type={$this->type}'>" . Display::return_icon('calendar.png', get_lang('Calendar'), '', ICON_SIZE_MEDIUM) . "</a>";
     $courseCondition = '';
     if (!empty($courseInfo)) {
         $courseCondition = api_get_cidreq();
     }
     $actionsLeft .= "<a href='" . api_get_path(WEB_CODE_PATH) . "calendar/agenda_list.php?type={$this->type}&" . $courseCondition . "'>" . Display::return_icon('week.png', get_lang('AgendaList'), '', ICON_SIZE_MEDIUM) . "</a>";
     $form = '';
     if (api_is_allowed_to_edit(false, true) || api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous() && api_is_allowed_to_session_edit(false, true) || GroupManager::user_has_access(api_get_user_id(), api_get_group_id(), GroupManager::GROUP_TOOL_CALENDAR) && GroupManager::is_tutor_of_group(api_get_user_id(), api_get_group_id())) {
         $actionsLeft .= Display::url(Display::return_icon('new_event.png', get_lang('AgendaAdd'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . "calendar/agenda.php?" . api_get_cidreq() . "&action=add&type=" . $this->type);
         $actionsLeft .= Display::url(Display::return_icon('import_calendar.png', get_lang('ICalFileImport'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . "calendar/agenda.php?" . api_get_cidreq() . "&action=importical&type=" . $this->type);
         if ($this->type == 'course') {
             if (!isset($_GET['action'])) {
                 $form = new FormValidator('form-search', 'post', '', '', array(), FormValidator::LAYOUT_INLINE);
                 $attributes = array('multiple' => false, 'id' => 'select_form_id_search');
                 $selectedValues = $this->parseAgendaFilter($filter);
                 $this->showToForm($form, $selectedValues, $attributes);
                 $form = $form->returnForm();
             }
         }
     }
     if (api_is_platform_admin() || api_is_teacher() || api_is_student_boss() || api_is_drh() || api_is_session_admin() || api_is_coach()) {
         if ($this->type == 'personal') {
             $form = null;
             if (!isset($_GET['action'])) {
                 $form = new FormValidator('form-search', 'get', api_get_self() . '?type=personal&', '', array(), FormValidator::LAYOUT_INLINE);
                 $sessions = SessionManager::get_sessions_by_user(api_get_user_id());
                 $form->addHidden('type', 'personal');
                 $sessions = array_column($sessions, 'session_name', 'session_id');
                 $sessions = ['0' => get_lang('SelectAnOption')] + $sessions;
                 $form->addSelect('session_id', get_lang('Session'), $sessions, ['id' => 'session_id', 'onchange' => 'submit();']);
                 //$form->addButtonFilter(get_lang('Filter'));
                 //$renderer = $form->defaultRenderer();
                 //$renderer->setCustomElementTemplate('<div class="col-md-6">{element}</div>');
                 $form->addButtonReset(get_lang('Reset'));
                 $form = $form->returnForm();
             }
         }
     }
     $actionsRight = '';
     if ($view == 'calendar') {
         $actionsRight .= $form;
     }
     $toolbar = Display::toolbarAction('toolbar-agenda', array(0 => $actionsLeft, 1 => $actionsRight), 2, false);
     return $toolbar;
 }
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:54,代码来源:agenda.lib.php

示例4: get_events

 /**
  *
  * Get agenda events
  * @param    int        start tms
  * @param    int        end tms
  * @param    int        course id *integer* not the course code
  * @param   int     user id
  *
  */
 public function get_events($start, $end, $course_id = null, $group_id = null, $user_id = 0)
 {
     switch ($this->type) {
         case 'admin':
             $this->get_platform_events($start, $end);
             break;
         case 'course':
             $session_id = api_get_session_id();
             $course_info = api_get_course_info_by_id($course_id);
             $this->get_course_events($start, $end, $course_info, $group_id, $session_id, $user_id);
             break;
         case 'personal':
         default:
             //Getting personal events
             $this->get_personal_events($start, $end);
             //Getting platform/admin events
             $this->get_platform_events($start, $end);
             //Getting course events
             $my_course_list = array();
             if (!api_is_anonymous()) {
                 $session_list = SessionManager::get_sessions_by_user(api_get_user_id());
                 $my_course_list = CourseManager::get_courses_list_by_user_id(api_get_user_id(), true);
             }
             if (!empty($session_list)) {
                 foreach ($session_list as $session_item) {
                     $my_courses = $session_item['courses'];
                     $my_session_id = $session_item['session_id'];
                     if (!empty($my_courses)) {
                         foreach ($my_courses as $course_item) {
                             $course_info = api_get_course_info_by_id($course_item['id']);
                             $this->get_course_events($start, $end, $course_info, 0, $my_session_id);
                         }
                     }
                 }
             }
             if (!empty($my_course_list)) {
                 foreach ($my_course_list as $course_info_item) {
                     if (isset($course_id) && !empty($course_id)) {
                         if ($course_info_item['real_id'] == $course_id) {
                             $this->get_course_events($start, $end, $course_info_item);
                         }
                     } else {
                         $this->get_course_events($start, $end, $course_info_item);
                     }
                 }
             }
             break;
     }
     if (!empty($this->events)) {
         return json_encode($this->events);
     }
     return '';
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:62,代码来源:agenda.lib.php

示例5: getUserCertificatesInSessions

 /**
  * Get the achieved certificates for a user in course sessions
  * @param int $userId The user id
  * @param type $includeNonPublicCertificates Whether include the non-plublic certificates
  * @return array
  */
 public static function getUserCertificatesInSessions($userId, $includeNonPublicCertificates = true)
 {
     $userId = intval($userId);
     $sessionList = [];
     $sessions = SessionManager::get_sessions_by_user($userId);
     foreach ($sessions as $session) {
         if (empty($session['courses'])) {
             continue;
         }
         $sessionCourses = SessionManager::get_course_list_by_session_id($session['session_id']);
         foreach ($sessionCourses as $course) {
             if (!$includeNonPublicCertificates) {
                 $allowPublicCertificates = api_get_course_setting('allow_public_certificates', $course['code']);
                 if (empty($allowPublicCertificates)) {
                     continue;
                 }
             }
             $courseGradebookCategory = Category::load(null, null, $course['code'], null, null, $session['session_id']);
             if (empty($courseGradebookCategory)) {
                 continue;
             }
             $courseGradebookId = $courseGradebookCategory[0]->get_id();
             $certificateInfo = GradebookUtils::get_certificate_by_user_id($courseGradebookId, $userId);
             if (empty($certificateInfo)) {
                 continue;
             }
             $sessionList[] = ['session' => $session['session_name'], 'course' => $course['title'], 'score' => $certificateInfo['score_certificate'], 'date' => api_format_date($certificateInfo['created_at'], DATE_FORMAT_SHORT), 'link' => api_get_path(WEB_PATH) . "certificates/index.php?id={$certificateInfo['id']}"];
         }
     }
     return $sessionList;
 }
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:37,代码来源:GradebookUtils.php

示例6: get_lang

    IndexManager::setDefaultMyCourseView(IndexManager::VIEW_BY_SESSION, $userId);
} else {
    $courseAndSessions = $controller->returnCoursesAndSessions($userId);
    IndexManager::setDefaultMyCourseView(IndexManager::VIEW_BY_DEFAULT, $userId);
}
// if teacher, session coach or admin, display the button to change te course view
if ($displayMyCourseViewBySessionLink && (api_is_drh() || api_is_course_coach() || api_is_platform_admin() || api_is_session_admin() || api_is_teacher())) {
    $courseAndSessions['html'] = "<div class='view-by-session-link'>\n\t\t<div class='btn-group pull-right'>\n\t\t<a class='btn btn-default' id='viewByDefault' href='user_portal.php' onclick='changeMyCoursesView(\"" . IndexManager::VIEW_BY_DEFAULT . "\")'>\n\t\t" . get_lang('MyCoursesDefaultView') . "\n\t\t</a>\n\t\t<a class='btn btn-default' id='viewBySession' href='user_portal.php' onclick='changeMyCoursesView(\"" . IndexManager::VIEW_BY_SESSION . "\")'>\n\t\t" . get_lang('MyCoursesSessionView') . "\n\t\t</a>\n\t\t</div>\n\t</div><br /><br />\n\t" . $courseAndSessions['html'];
}
// Check if a user is enrolled only in one course for going directly to the course after the login.
if (api_get_setting('go_to_course_after_login') == 'true') {
    $count_of_sessions = $courseAndSessions['session_count'];
    $count_of_courses_no_sessions = $courseAndSessions['course_count'];
    // User is subscribe in 1 session and 0 courses.
    if ($count_of_sessions == 1 && $count_of_courses_no_sessions == 0) {
        $sessions = SessionManager::get_sessions_by_user($userId);
        if (isset($sessions[0])) {
            $sessionInfo = $sessions[0];
            // Session only has 1 course.
            if (isset($sessionInfo['courses']) && count($sessionInfo['courses']) == 1) {
                $courseCode = $sessionInfo['courses'][0]['code'];
                $courseInfo = api_get_course_info_by_id($sessionInfo['courses'][0]['real_id']);
                $courseUrl = $courseInfo['course_public_url'] . '?id_session=' . $sessionInfo['session_id'];
                header('Location:' . $courseUrl);
                exit;
            }
            // Session has many courses.
            if (isset($sessionInfo['session_id'])) {
                $url = api_get_path(WEB_CODE_PATH) . 'session/?session_id=' . $sessionInfo['session_id'];
                header('Location:' . $url);
                exit;
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:31,代码来源:user_portal.php


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