示例#1
0
        $avatar = new EfrontFile($editedUser->user['avatar']);
    } catch (Exception $e) {
        $avatar = new EfrontFile(G_SYSTEMAVATARSPATH . "unknown_small.png");
    }
    $smarty->assign("T_AVATAR", $avatar['url_path']);
    $smarty->assign("T_EMPLOYEE_SKILLS", $skills_sorted);
    $smarty->assign("T_EMPLOYEE_SKILL_CATEGORIES", $skill_categories);
    $smarty->assign('T_EVALUATIONS', $evaluations = $editedEmployee->getEvaluations());
    $smarty->assign("T_FORM_PLACEMENTS", $jobs = $editedEmployee->getJobs());
}
#cpp#endif
if ($editedUser->user['user_type'] != 'administrator') {
    $directionsTree = new EfrontDirectionsTree();
    $directionsArray = $directionsTree->getFlatTree();
    $smarty->assign("T_DIRECTIONS_TREE", $directionsPathStrings = $directionsTree->toPathString());
    $studentRoles = EfrontLessonUser::getRoles();
    foreach ($studentRoles as $key => $value) {
        if ($value != 'student') {
            unset($studentRoles[$key]);
        }
    }
    $constraints = array('archive' => false);
    if ($_COOKIE['setUserFormSelectedSort']) {
        preg_match("/\\d_(\\w+)--(\\w+)/", $_COOKIE['setUserFormSelectedSort'], $matches);
        in_array($matches[1], array('name', 'directions_ID', 'active_in_course', 'completed', 'score')) ? $constraints['sort'] = $matches[1] : ($constraints['sort'] = 'name');
        $matches[2] == 'desc' ? $constraints['order'] = 'asc' : ($constraints['order'] = 'desc');
    }
    $userCourses = $editedUser->getUserCourses($constraints);
    foreach ($userCourses as $key => $value) {
        if (!in_array($value->course['user_type'], array_keys($studentRoles))) {
            unset($userCourses[$key]);
 public static function convertDatabaseResultToUserObjects($result)
 {
     $roles = EfrontLessonUser::getRoles();
     $userObjects = array();
     foreach ($result as $value) {
         $userObjects[$value['login']] = EfrontUserFactory::factory($value, false, $value['role'] ? $roles[$value['role']] : false);
     }
     return $userObjects;
 }
 public function getUserStatusInLessons($lessons = false, $onlyContent = false)
 {
     $userLessons = $this->getUserLessons();
     if ($lessons !== false) {
         $lessonIds = $this->verifyLessonsList($lessons);
         foreach ($lessonIds as $id) {
             if (in_array($id, array_keys($userLessons))) {
                 $temp[$id] = $userLessons[$id];
             }
         }
         $userLessons = $temp;
     }
     if (!$onlyContent) {
         $activeTimes = $this->getLessonsActiveTimeForUser();
     }
     $roles = EfrontLessonUser::getRoles();
     foreach ($userLessons as $key => $lesson) {
         $lesson = $this->checkUserAccessToLessonBasedOnDuration($lesson);
         if (!$this->user['user_types_ID'] && $lesson->lesson['user_type'] != $this->user['user_type'] || $this->user['user_types_ID'] && $lesson->lesson['user_type'] != $this->user['user_types_ID']) {
             $lesson->lesson['different_role'] = 1;
         }
         if ($roles[$lesson->lesson['user_type']] == 'student') {
             $userLessons[$key]->lesson['overall_progress'] = $this->getUserOverallProgressInLesson($lesson);
             if (!$onlyContent) {
                 $userLessons[$key]->lesson['project_status'] = $this->getUserProjectsStatusInLesson($lesson);
                 $userLessons[$key]->lesson['test_status'] = $this->getUserTestsStatusInLesson($lesson);
                 $userLessons[$key]->lesson['time_in_lesson'] = $this->getUserTimeInLesson($lesson);
                 $userLessons[$key]->lesson['active_time_in_lesson'] = EfrontTimes::formatTimeForReporting($activeTimes[$key]);
             }
         }
     }
     return $userLessons;
 }