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


PHP SessionManager::get_user_status_in_course_session方法代码示例

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


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

示例1: get_document_preview

 /**
  * @param array $course_info
  * @param bool $lp_id
  * @param string $target
  * @param int $session_id
  * @param bool $add_move_button
  * @param string $filter_by_folder
  * @param string $overwrite_url
  * @param bool $showInvisibleFiles
  * @param bool $showOnlyFolders
  * @param int $folderId
  * @return string
  */
 public static function get_document_preview($course_info, $lp_id = false, $target = '', $session_id = 0, $add_move_button = false, $filter_by_folder = null, $overwrite_url = null, $showInvisibleFiles = false, $showOnlyFolders = false, $folderId = false)
 {
     if (empty($course_info['real_id']) || empty($course_info['code']) || !is_array($course_info)) {
         return '';
     }
     $overwrite_url = Security::remove_XSS($overwrite_url);
     $user_id = api_get_user_id();
     $user_in_course = false;
     if (api_is_platform_admin()) {
         $user_in_course = true;
     }
     if (!$user_in_course) {
         if (CourseManager::is_course_teacher($user_id, $course_info['code'])) {
             $user_in_course = true;
         }
     }
     // Condition for the session
     $session_id = intval($session_id);
     if (!$user_in_course) {
         if (empty($session_id)) {
             if (CourseManager::is_user_subscribed_in_course($user_id, $course_info['code'])) {
                 $user_in_course = true;
             }
             // Check if course is open then we can consider that the student is registered to the course
             if (isset($course_info) && in_array($course_info['visibility'], array(2, 3))) {
                 $user_in_course = true;
             }
         } else {
             $user_status = SessionManager::get_user_status_in_course_session($user_id, $course_info['real_id'], $session_id);
             //is true if is an student, course session teacher or coach
             if (in_array($user_status, array('0', '2', '6'))) {
                 $user_in_course = true;
             }
         }
     }
     $tbl_doc = Database::get_course_table(TABLE_DOCUMENT);
     $tbl_item_prop = Database::get_course_table(TABLE_ITEM_PROPERTY);
     $condition_session = " AND (last.session_id = '{$session_id}' OR last.session_id = '0' OR last.session_id IS NULL)";
     $add_folder_filter = null;
     if (!empty($filter_by_folder)) {
         $add_folder_filter = " AND docs.path LIKE '" . Database::escape_string($filter_by_folder) . "%'";
     }
     // If we are in LP display hidden folder https://support.chamilo.org/issues/6679
     $lp_visibility_condition = null;
     if ($lp_id) {
         // $lp_visibility_condition = " OR filetype='folder'";
         if ($showInvisibleFiles) {
             $lp_visibility_condition .= ' OR last.visibility = 0';
         }
     }
     $showOnlyFoldersCondition = null;
     if ($showOnlyFolders) {
         //$showOnlyFoldersCondition = " AND docs.filetype = 'folder' ";
     }
     $folderCondition = " AND docs.path LIKE '/%' ";
     if (!api_is_allowed_to_edit()) {
         $protectedFolders = self::getProtectedFolderFromStudent();
         foreach ($protectedFolders as $folder) {
             $folderCondition .= " AND docs.path NOT LIKE '{$folder}' ";
         }
     }
     $parentData = [];
     if ($folderId !== false) {
         $parentData = self::get_document_data_by_id($folderId, $course_info['code']);
         if (!empty($parentData)) {
             $cleanedPath = $parentData['path'];
             $num = substr_count($cleanedPath, '/');
             $notLikeCondition = null;
             for ($i = 1; $i <= $num; $i++) {
                 $repeat = str_repeat('/%', $i + 1);
                 $notLikeCondition .= " AND docs.path NOT LIKE '" . Database::escape_string($cleanedPath . $repeat) . "' ";
             }
             $folderCondition = " AND\n                    docs.id <> {$folderId} AND\n                    docs.path LIKE '" . $cleanedPath . "/%'\n                    {$notLikeCondition}\n                ";
         } else {
             $folderCondition = " AND\n                docs.filetype = 'file' ";
         }
     }
     $levelCondition = null;
     if ($folderId === false) {
         $levelCondition = " AND docs.path NOT LIKE'/%/%'";
     }
     $sql = "SELECT last.visibility, docs.*\n                FROM {$tbl_item_prop} AS last INNER JOIN {$tbl_doc} AS docs\n                ON (docs.id = last.ref AND docs.c_id = last.c_id)\n                WHERE\n                    docs.path NOT LIKE '%_DELETED_%' AND\n                    last.tool = '" . TOOL_DOCUMENT . "' {$condition_session} AND\n                    (last.visibility = '1' {$lp_visibility_condition}) AND\n                    last.visibility <> 2 AND\n                    docs.c_id = {$course_info['real_id']} AND\n                    last.c_id = {$course_info['real_id']}\n                    {$showOnlyFoldersCondition}\n                    {$folderCondition}\n                    {$levelCondition}\n                    {$add_folder_filter}\n                ORDER BY docs.filetype DESC, docs.title ASC";
     $res_doc = Database::query($sql);
     $resources = Database::store_result($res_doc, 'ASSOC');
     $return = '';
     if ($lp_id) {
         $learnPath = learnpath::getCurrentLpFromSession();
//.........这里部分代码省略.........
开发者ID:daffef,项目名称:chamilo-lms,代码行数:101,代码来源:document.lib.php

示例2: get_users_rel_course

 /**
  * Get registered users inside current course
  * @param 	int	   $attendance_id attendance id for showing attendance result field (optional)
  * @param int $groupId
  * @return 	array  users data
  */
 public function get_users_rel_course($attendance_id = 0, $groupId = null)
 {
     $current_session_id = api_get_session_id();
     $current_course_id = api_get_course_id();
     $currentCourseIntId = api_get_course_int_id();
     $studentInGroup = array();
     if (!empty($current_session_id)) {
         $a_course_users = CourseManager::get_user_list_from_course_code($current_course_id, $current_session_id, '', 'lastname');
     } else {
         $a_course_users = CourseManager::get_user_list_from_course_code($current_course_id, 0, '', 'lastname');
         if (!empty($groupId)) {
             $students = GroupManager::getStudents($groupId);
             if (!empty($students)) {
                 foreach ($students as $student) {
                     $studentInGroup[$student['user_id']] = true;
                 }
             }
         }
     }
     // get registered users inside current course
     $a_users = array();
     foreach ($a_course_users as $key => $user_data) {
         $value = array();
         $uid = $user_data['user_id'];
         $userInfo = api_get_user_info($uid);
         $status = $user_data['status'];
         if (!empty($groupId)) {
             if (!isset($studentInGroup[$uid])) {
                 continue;
             }
         }
         $user_status_in_session = null;
         $user_status_in_course = null;
         if (api_get_session_id()) {
             $user_status_in_session = SessionManager::get_user_status_in_course_session($uid, $currentCourseIntId, $current_session_id);
         } else {
             $user_status_in_course = CourseManager::get_user_in_course_status($uid, $current_course_id);
         }
         // Not taking into account DRH or COURSEMANAGER
         if ($uid <= 1 || $status == DRH || $user_status_in_course == COURSEMANAGER || $user_status_in_session == 2) {
             continue;
         }
         if (!empty($attendance_id)) {
             $user_faults = $this->get_faults_of_user($uid, $attendance_id, $groupId);
             $value['attendance_result'] = $user_faults['faults'] . '/' . $user_faults['total'] . ' (' . $user_faults['faults_porcent'] . '%)';
             $value['result_color_bar'] = $user_faults['color_bar'];
         }
         $photo = Display::img($userInfo['avatar_small'], $userInfo['complete_name'], [], false);
         $value['photo'] = $photo;
         $value['firstname'] = $user_data['firstname'];
         $value['lastname'] = $user_data['lastname'];
         $value['username'] = $user_data['username'];
         $value['user_id'] = $uid;
         //Sending only 5 items in the array instead of 60
         $a_users[$key] = $value;
     }
     return $a_users;
 }
开发者ID:daffef,项目名称:chamilo-lms,代码行数:64,代码来源:attendance.lib.php

示例3: api_detect_user_roles

/**
 * @param int $user_id
 * @param int $courseId
 * @param int $session_id
 * @return array
 */
function api_detect_user_roles($user_id, $courseId, $session_id = 0)
{
    $user_roles = array();
    /*$user_info = api_get_user_info($user_id);
      $user_roles[] = $user_info['status'];*/
    $courseInfo = api_get_course_info_by_id($courseId);
    $course_code = $courseInfo['code'];
    $url_id = api_get_current_access_url_id();
    if (api_is_platform_admin_by_id($user_id, $url_id)) {
        $user_roles[] = PLATFORM_ADMIN;
    }
    /*if (api_is_drh()) {
          $user_roles[] = DRH;
      }*/
    if (!empty($session_id)) {
        if (SessionManager::user_is_general_coach($user_id, $session_id)) {
            $user_roles[] = SESSION_GENERAL_COACH;
        }
    }
    if (!empty($course_code)) {
        if (empty($session_id)) {
            if (CourseManager::is_course_teacher($user_id, $course_code)) {
                $user_roles[] = COURSEMANAGER;
            }
            if (CourseManager::get_tutor_in_course_status($user_id, $course_code)) {
                $user_roles[] = COURSE_TUTOR;
            }
            if (CourseManager::is_user_subscribed_in_course($user_id, $course_code)) {
                $user_roles[] = COURSE_STUDENT;
            }
        } else {
            $user_status_in_session = SessionManager::get_user_status_in_course_session($user_id, $courseId, $session_id);
            if (!empty($user_status_in_session)) {
                if ($user_status_in_session == 0) {
                    $user_roles[] = SESSION_STUDENT;
                }
                if ($user_status_in_session == 2) {
                    $user_roles[] = SESSION_COURSE_COACH;
                }
            }
            /*if (api_is_course_session_coach($user_id, $course_code, $session_id)) {
                 $user_roles[] = SESSION_COURSE_COACH;
              }*/
        }
    }
    return $user_roles;
}
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:53,代码来源:api.lib.php

示例4: get_document_preview

 static function get_document_preview($course_info, $lp_id = false, $target = '', $session_id = 0, $add_move_button = false, $filter_by_folder = null, $overwrite_url = null)
 {
     if (empty($course_info['real_id']) || empty($course_info['code']) || !is_array($course_info)) {
         return '';
     }
     $user_id = api_get_user_id();
     $user_in_course = false;
     if (api_is_platform_admin()) {
         $user_in_course = true;
     }
     if (!$user_in_course) {
         if (CourseManager::is_course_teacher($user_id, $course_info['real_id'])) {
             $user_in_course = true;
         }
     }
     //condition for the session
     $session_id = intval($session_id);
     if (!$user_in_course) {
         if (empty($session_id)) {
             if (CourseManager::is_user_subscribed_in_course($user_id, $course_info['real_id'])) {
                 $user_in_course = true;
             }
             //Check if course is open then we can consider that the student is regitered to the course
             if (isset($course_info) && in_array($course_info['visibility'], array(2, 3))) {
                 $user_in_course = true;
             }
         } else {
             $user_status = SessionManager::get_user_status_in_course_session($user_id, $course_info['real_id'], $session_id);
             //is true if is an student, course session teacher or coach
             if (in_array($user_status, array('0', '2', '6'))) {
                 $user_in_course = true;
             }
         }
     }
     $tbl_doc = Database::get_course_table(TABLE_DOCUMENT);
     $tbl_item_prop = Database::get_course_table(TABLE_ITEM_PROPERTY);
     $path = '/';
     $path = Database::escape_string(str_replace('_', '\\_', $path));
     $added_slash = $path == '/' ? '' : '/';
     //$condition_session = " AND (id_session = '$session_id' OR (id_session = '0' AND insert_date <= (SELECT creation_date FROM $tbl_course WHERE code = '".$course_info['code']."' )))";
     $condition_session = " AND (id_session = '{$session_id}' OR  id_session = '0' )";
     $add_folder_filter = null;
     if (!empty($filter_by_folder)) {
         $add_folder_filter = " AND docs.path LIKE '" . Database::escape_string($filter_by_folder) . "%'";
     }
     $sql_doc = "SELECT last.visibility, docs.*\n\t\t\t\t\tFROM  {$tbl_item_prop} AS last, {$tbl_doc} AS docs\n    \t            WHERE   docs.id = last.ref AND\n                            docs.path LIKE '" . $path . $added_slash . "%' AND\n                            docs.path NOT LIKE '%_DELETED_%' AND\n                            last.tool = '" . TOOL_DOCUMENT . "' {$condition_session} AND\n                            last.visibility = '1' AND\n                            docs.c_id = {$course_info['real_id']} AND\n                            last.c_id = {$course_info['real_id']}\n                            {$add_folder_filter}\n                    ORDER BY docs.title ASC";
     $res_doc = Database::query($sql_doc);
     $resources = Database::store_result($res_doc, 'ASSOC');
     $resources_sorted = array();
     $return = '';
     if ($lp_id) {
         $return .= '<div class="lp_resource_element">';
         $return .= Display::return_icon('new_doc.gif', '', array(), ICON_SIZE_SMALL);
         $return .= Display::url(get_lang('NewDocument'), api_get_self() . '?' . api_get_cidreq() . '&action=add_item&type=' . TOOL_DOCUMENT . '&lp_id=' . $_SESSION['oLP']->lp_id);
         $return .= '</div>';
     } else {
         $return .= Display::div(Display::url(Display::return_icon('close.png', get_lang('Close'), array(), ICON_SIZE_SMALL), ' javascript:void(0);', array('id' => 'close_div_' . $course_info['real_id'] . '_' . $session_id, 'class' => 'close_div')), array('style' => 'position:absolute;right:10px'));
     }
     // If you want to debug it, I advise you to do "echo" on the eval statements.
     if (!empty($resources) && $user_in_course) {
         foreach ($resources as $resource) {
             $is_visible = self::is_visible_by_id($resource['id'], $course_info, $session_id, api_get_user_id());
             if (!$is_visible) {
                 continue;
             }
             $resource_paths = explode('/', $resource['path']);
             array_shift($resource_paths);
             $path_to_eval = $last_path = '';
             $is_file = false;
             if ($resource['filetype'] == 'file') {
                 foreach ($resource_paths as $key => $resource_path) {
                     if ($key != count($resource_paths) - 1) {
                         // It's a folder.
                         $path_to_eval .= "['{$resource_path}']['files']";
                     }
                     $is_file = true;
                 }
             } else {
                 foreach ($resource_paths as $key => $resource_path) {
                     if ($key != count($resource_paths) - 1) {
                         // It's a folder.
                         $path_to_eval .= "['{$resource_path}']['files']";
                     }
                 }
             }
             $last_path = $resource_path;
             //$data = json_encode(array('title'=>$resource['title'], 'path'=>$last_path));
             //@todo not sure if it's a good thing using base64_encode. I tried with json_encode but i received the same error
             //Some testing is needed in order to prove the performance
             //Also change the explode to value from "/" to "|@j@|" it fixes  #3780
             $data = base64_encode($resource['title'] . '|@j@|' . $last_path);
             if ($is_file) {
                 //for backward compatibility
                 if (empty($resource['title'])) {
                     $resource['title'] = basename($resource['path']);
                 }
                 eval('$resources_sorted' . $path_to_eval . '[' . $resource['id'] . '] = "' . $data . '" ; ');
             } else {
                 eval('$resources_sorted' . $path_to_eval . '["' . $last_path . '"]["id"]=' . $resource['id'] . ';');
                 eval('$resources_sorted' . $path_to_eval . '["' . $last_path . '"]["title"]= "' . api_htmlentities($resource['title']) . '";');
//.........这里部分代码省略.........
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:101,代码来源:document.lib.php

示例5: get_users_rel_course

 /**
  * Get registered users inside current course
  * @param 	int	   attendance id for showing attendance result field (optional)
  * @return 	array  users data
  */
 public function get_users_rel_course($attendance_id = 0)
 {
     $current_course_id = $this->get_course_id();
     $courseInfo = api_get_course_info($current_course_id);
     $courseId = $courseInfo['real_id'];
     $current_session_id = $this->get_session_id();
     if (!empty($current_session_id)) {
         $a_course_users = CourseManager::get_user_list_from_course_code($current_course_id, $current_session_id, '', 'lastname');
     } else {
         $a_course_users = CourseManager::get_user_list_from_course_code($current_course_id, 0, '', 'lastname');
     }
     // get registered users inside current course
     $a_users = array();
     foreach ($a_course_users as $key => $user_data) {
         $value = array();
         $uid = $user_data['user_id'];
         $status = $user_data['status'];
         $user_status_in_session = null;
         $user_status_in_course = null;
         if ($current_session_id) {
             $user_status_in_session = SessionManager::get_user_status_in_course_session($uid, $courseId, $current_session_id);
         } else {
             $user_status_in_course = CourseManager::get_user_in_course_status($uid, $courseId);
         }
         //Not taking into account DRH or COURSEMANAGER
         if ($uid <= 1 || $status == DRH || $user_status_in_course == COURSEMANAGER || $user_status_in_session == 2) {
             continue;
         }
         if (!empty($attendance_id)) {
             $user_faults = $this->get_faults_of_user($uid, $attendance_id);
             $value['attendance_result'] = $user_faults['faults'] . '/' . $user_faults['total'] . ' (' . $user_faults['faults_porcent'] . '%)';
             $value['result_color_bar'] = $user_faults['color_bar'];
         }
         // user's picture
         $image_path = UserManager::get_user_picture_path_by_id($uid, 'web', false);
         $user_profile = UserManager::get_picture_user($uid, $image_path['file'], 22, USER_IMAGE_SIZE_SMALL, ' width="22" height="22" ');
         if (!empty($image_path['file'])) {
             $photo = '<center><a class="thickbox" href="' . $image_path['dir'] . $image_path['file'] . '"  ><img src="' . $user_profile['file'] . '" ' . $user_profile['style'] . ' alt="' . api_get_person_name($user_data['firstname'], $user_data['lastname']) . '"  title="' . api_get_person_name($user_data['firstname'], $user_data['lastname']) . '" /></a></center>';
         } else {
             $photo = '<center><img src="' . $user_profile['file'] . '" ' . $user_profile['style'] . ' alt="' . api_get_person_name($user_data['firstname'], $user_data['lastname']) . '"  title="' . api_get_person_name($user_data['firstname'], $user_data['lastname']) . '" /></center>';
         }
         $value['photo'] = $photo;
         $value['firstname'] = $user_data['firstname'];
         $value['lastname'] = $user_data['lastname'];
         $value['username'] = $user_data['username'];
         $value['user_id'] = $uid;
         //Sending only 5 items in the array instead of 60
         $a_users[$key] = $value;
     }
     return $a_users;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:56,代码来源:attendance.lib.php

示例6: header

    /**
     * Displays the header for the gradebook containing the navigation tree and links
     * @param Category $catobj
     * @param int $showtree '1' will show the browse tree and naviation buttons
     * @param boolean $is_course_admin
     * @param boolean $is_platform_admin
     * @param boolean Whether to show or not the link to add a new qualification
     * (we hide it in case of the course-embedded tool where we have only one
     * calification per course or session)
     * @param boolean Whether to show or not the link to add a new item inside
     * the qualification (we hide it in case of the course-embedded tool
     * where we have only one calification per course or session)
     * @return void Everything is printed on screen upon closing
     */
    static function header($catobj, $showtree, $selectcat, $is_course_admin, $is_platform_admin, $simple_search_form, $show_add_qualification = true, $show_add_link = true, $certificateLinkInfo = null)
    {
        $userId = api_get_user_id();
        $courseCode = api_get_course_id();
        $courseId = api_get_course_int_id();
        $sessionId = api_get_session_id();
        // Student.
        $status = CourseManager::get_user_in_course_status($userId, $courseCode);
        if (!empty($sessionId)) {
            $sessionStatus = SessionManager::get_user_status_in_course_session($userId, $courseId, $sessionId);
        }
        $objcat = new Category();
        $course_id = CourseManager::get_course_by_category($selectcat);
        $message_resource = $objcat->show_message_resource_delete($course_id);
        $grade_model_id = $catobj->get_grade_model_id();
        $header = null;
        //@todo move these in a function
        $sum_categories_weight_array = array();
        if (isset($catobj) && !empty($catobj)) {
            $categories = Category::load(null, null, null, $catobj->get_id(), null, $sessionId);
            if (!empty($categories)) {
                foreach ($categories as $category) {
                    $sum_categories_weight_array[$category->get_id()] = $category->get_weight();
                }
            } else {
                $sum_categories_weight_array[$catobj->get_id()] = $catobj->get_weight();
            }
        }
        if (!$is_course_admin && ($status != 1 || $sessionStatus == 0) && $selectcat != 0) {
            $catcourse = Category::load($catobj->get_id());
            /** @var Category $category */
            $category = $catcourse[0];
            $main_weight = $category->get_weight();
            $scoredisplay = ScoreDisplay::instance();
            $allevals = $category->get_evaluations($userId, true);
            $alllinks = $category->get_links($userId, true);
            $allEvalsLinks = array_merge($allevals, $alllinks);
            $item_value_total = 0;
            $scoreinfo = null;
            for ($count = 0; $count < count($allEvalsLinks); $count++) {
                $item = $allEvalsLinks[$count];
                $score = $item->calc_score($userId);
                if (!empty($score)) {
                    $divide = $score[1] == 0 ? 1 : $score[1];
                    $item_value = $score[0] / $divide * $item->get_weight();
                    $item_value_total += $item_value;
                }
            }
            $item_total = $main_weight;
            $total_score = array($item_value_total, $item_total);
            $scorecourse_display = $scoredisplay->display_score($total_score, SCORE_DIV_PERCENT);
            if (!$catobj->get_id() == '0' && !isset($_GET['studentoverview']) && !isset($_GET['search'])) {
                $aditionalButtons = null;
                if (!empty($certificateLinkInfo)) {
                    $aditionalButtons .= '<div class="btn-group pull-right">';
                    $aditionalButtons .= isset($certificateLinkInfo['certificate_link']) ? $certificateLinkInfo['certificate_link'] : '';
                    $aditionalButtons .= isset($certificateLinkInfo['badge_link']) ? $certificateLinkInfo['badge_link'] : '';
                    $aditionalButtons .= '</div>';
                }
                $scoreinfo .= '<strong>' . sprintf(get_lang('TotalX'), $scorecourse_display . $aditionalButtons) . '</strong>';
            }
            Display::display_normal_message($scoreinfo, false);
        }
        // show navigation tree and buttons?
        if ($showtree == '1' || isset($_GET['studentoverview'])) {
            $header = '<div class="actions"><table>';
            $header .= '<tr>';
            if (!$selectcat == '0') {
                $header .= '<td><a href="' . api_get_self() . '?selectcat=' . $catobj->get_parent_id() . '">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('RootCat'), '', ICON_SIZE_MEDIUM) . '</a></td>';
            }
            $header .= '<td>' . get_lang('CurrentCategory') . '</td>' . '<td><form name="selector"><select name="selectcat" onchange="document.selector.submit()">';
            $cats = Category::load();
            $tree = $cats[0]->get_tree();
            unset($cats);
            $line = null;
            foreach ($tree as $cat) {
                for ($i = 0; $i < $cat[2]; $i++) {
                    $line .= '&mdash;';
                }
                $line = isset($line) ? $line : '';
                if (isset($_GET['selectcat']) && $_GET['selectcat'] == $cat[0]) {
                    $header .= '<option selected value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
                } else {
                    $header .= '<option value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
                }
                $line = '';
//.........这里部分代码省略.........
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:101,代码来源:displaygradebook.php

示例7: transaction_36

 static function transaction_36($original_data, $web_service_details)
 {
     global $data_list;
     $data = Migration::soap_call($web_service_details, 'asistenciaDetalles', array('uididpersona' => $original_data['item_id'], 'uididprograma' => $original_data['orig_id'], 'uididfecha' => $original_data['info'], 'intIdSede' => $original_data['branch_id']));
     if ($data['error'] == false) {
         $uidIdPrograma = $original_data['orig_id'];
         $uidIdPersona = $original_data['item_id'];
         $attendance_date = $data['date_assist'];
         $attendance_user_status = $data['status'];
         // modified in the asistenciaDetalles function
         $session_id = self::get_session_id_by_programa_id($uidIdPrograma, $data_list);
         $user_id = self::get_user_id_by_persona_id($uidIdPersona, $data_list);
         if (empty($user_id)) {
             return array('message' => "User does not exists in DB: {$uidIdPersona}", 'status_id' => self::TRANSACTION_STATUS_FAILED);
         }
         if (empty($session_id)) {
             return array('message' => "Session does not exists {$uidIdPrograma}", 'status_id' => self::TRANSACTION_STATUS_FAILED);
         }
         $course_list = SessionManager::get_course_list_by_session_id($session_id);
         if (!empty($course_list)) {
             $course_data = current($course_list);
             if (isset($course_data['code'])) {
                 //Check if user exist in the session
                 $status = SessionManager::get_user_status_in_course_session($user_id, $course_data['id'], $session_id);
                 if ($status === false) {
                     return array('message' => "User #{$user_id} is not registered in course code: {$course_data['code']} - session_id: {$session_id}", 'status_id' => self::TRANSACTION_STATUS_FAILED);
                 }
                 $time = self::get_horario_value($session_id);
                 $attendance_date .= " {$time}:00";
                 $attendance = new Attendance();
                 $course_info = api_get_course_info($course_data['code']);
                 $attendance->set_course_id($course_info['code']);
                 $attendance->set_course_int_id($course_info['real_id']);
                 $attendance->set_session_id($session_id);
                 $attendance_list = $attendance->get_attendances_list($course_info['real_id'], $session_id);
                 if (empty($attendance_list)) {
                     return array('message' => "Attendance not found for course code: {$course_info['code']} - session_id: {$session_id}", 'status_id' => self::TRANSACTION_STATUS_FAILED);
                     //only 1 course per session
                 } else {
                     $attendance_data = current($attendance_list);
                     $attendance_id = $attendance_data['id'];
                     error_log("Attendance found in attendance_id = {$attendance_id} - course code: {$course_info['code']} - session_id: {$session_id} - {$attendance_date}");
                 }
                 $cal_info = $attendance->get_attendance_calendar_data_by_date($attendance_id, $attendance_date);
                 if ($cal_info && isset($cal_info['id'])) {
                     $cal_id = $cal_info['id'];
                 } else {
                     //Creating the attendance date
                     $attendance->set_date_time($attendance_date);
                     $cal_id = $attendance->attendance_calendar_add($attendance_id, true);
                     error_log("Creating a new calendar item {$cal_id}");
                     /*
                                             return array(
                                                 'message' => "Attendance calendar does not exist for date: $attendance_date in attendance_id = $attendance_id - course code: {$course_info['code']} - session_id: $session_id",
                                                 'status_id' => self::TRANSACTION_STATUS_FAILED
                                             );*/
                 }
                 $users_present = array($user_id => $attendance_user_status);
                 $attendance_sheet_before = $attendance->attendance_sheet_get_info($cal_id, $user_id);
                 $result = $attendance->attendance_sheet_add($cal_id, $users_present, $attendance_id, false, true);
                 $attendance_sheet_after = $attendance->attendance_sheet_get_info($cal_id, $user_id);
                 if ($result) {
                     return array('entity' => 'attendance_sheet', 'before' => $attendance_sheet_before, 'after' => $attendance_sheet_after, 'message' => "Attendance sheet edited with", 'status_id' => self::TRANSACTION_STATUS_SUCCESSFUL);
                 } else {
                     return array('message' => "Attendance sheet can't be edited attendance_id: {$attendance_id} - cal_id: {$cal_id} - user_id: {$user_id} - course: {$course_info['code']} - session_id: {$session_id} ", 'status_id' => self::TRANSACTION_STATUS_FAILED);
                 }
             } else {
                 $message = "Course is not set";
             }
         } else {
             $message = "NO course found for session id: {$session_id}";
         }
         return array('message' => $message, 'status_id' => self::TRANSACTION_STATUS_FAILED);
     } else {
         return $data;
     }
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:77,代码来源:migration.custom.class.php

示例8: array

$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);
    if ($status !== false || api_is_platform_admin() || $userIsGeneralCoach) {
        $user_course_list[] = $course['code'];
    }
}
if (empty($user_course_list)) {
    api_not_allowed(true);
}
$my_session_list = array();
$final_array = array();
/*
if (!empty($new_session_list)) {
    foreach ($new_session_list as $item) {
        $my_session_id = isset($item['id_session']) ? $item['id_session'] : null;
        if (isset($my_session_id) && !in_array($my_session_id, $my_session_list) && $session_id == $my_session_id) {
            $final_array[$my_session_id]['name'] = $item['session_name'];
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:index.php

示例9: api_get_course_url

$url = api_get_course_url($course_code, $session_id);
if (empty($session_id)) {
    if (CourseManager::is_user_subscribed_in_course($user_id, $courseId) || api_check_user_access_to_legal($course_info['visibility'])) {
        $user_accepted_legal = CourseManager::is_user_accepted_legal($user_id, $course_info);
        if ($user_accepted_legal || $user_pass_open_course) {
            //Redirect to course home
            header('Location: ' . $url);
            exit;
        }
    } else {
        api_not_allowed();
    }
} else {
    if (api_is_platform_admin()) {
        header('Location: ' . $url);
    }
    $user_session_status = SessionManager::get_user_status_in_course_session($user_id, $courseId, $session_id);
    if (isset($user_session_status) || api_check_user_access_to_legal($course_info['visibility'])) {
        $user_accepted_legal = CourseManager::is_user_accepted_legal($user_id, $course_info, $session_id);
        if ($user_accepted_legal || $user_pass_open_course) {
            //Redirect to course session home
            header('Location: ' . $url);
            exit;
        }
    } else {
        api_not_allowed();
    }
}
Display::display_header($nameTools);
$form->display();
Display::display_footer();
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:legal.php


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