コード例 #1
0
 public function handlePostAjaxRequestionForLessons()
 {
     if (isset($_GET['id']) && eF_checkParameter($_GET['id'], 'id')) {
         !$this->isCourseLesson($_GET['id']) ? $this->addLessons($_GET['id']) : $this->removeLessons($_GET['id']);
     } else {
         if (isset($_GET['addAll'])) {
             $constraints = createConstraintsFromSortedTable() + array('archive' => false, 'active' => true);
             unset($constraints['limit']);
             //This way, we preserve filter, but the operation still applies to all entries
             $this->addCourseLessons($constraints);
             /*
             $courseLessons = $this -> getCourseLessons();
             $result = eF_getTableData("lessons", "*", "archive=0 and active=1 and course_only=1");
             $lessons = array();
             foreach ($result as $lesson) {
             $lessons[$lesson['id']] = $lesson;
             }
             isset($_GET['filter']) ? $lessons = eF_filterData($lessons, $_GET['filter']) : null;
             $this -> addLessons(array_diff(array_keys($lessons), array_keys($courseLessons)));
             */
         } else {
             if (isset($_GET['removeAll'])) {
                 //$constraints = createConstraintsFromSortedTable() + array('archive' => false, 'active' => true);
                 //$this -> removeCourseLessons($constraints);
                 $courseLessons = $this->getCourseLessons();
                 isset($_GET['filter']) ? $courseLessons = eF_filterData($courseLessons, $_GET['filter']) : null;
                 $this->removeLessons(array_keys($courseLessons));
             }
         }
     }
     $constraints = array('archive' => false, 'active' => true, 'return_objects' => false);
     echo json_encode(array('lessons' => array_keys($this->getCourseLessons($constraints))));
 }
コード例 #2
0
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 $smarty->assign("T_BASIC_ROLES_ARRAY", $rolesBasic);
 if (isset($_GET['ajax']) && $_GET['ajax'] == 'courseUsersTable') {
     //pr($studentRoles);
     $smarty->assign("T_DATASOURCE_COLUMNS", array('login', 'active_in_course', 'completed', 'to_timestamp', 'score', 'issued_certificate', 'expire_certificate', 'operations'));
     $smarty->assign("T_DATASOURCE_SORT_BY", 0);
     $constraints = array('archive' => false, 'active' => true) + createConstraintsFromSortedTable();
     $constraints['condition'] = "uc.user_type in ('" . implode("','", $studentRoles) . "')";
     if ($_SESSION['s_type'] != 'administrator' && $_SESSION['s_current_branch']) {
         //this applies to supervisors only
         $stats_filters = array();
         $branches = array($_SESSION['s_current_branch']);
         $branchesTree = new EfrontBranchesTree();
         $iterator = new EfrontNodeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($branchesTree->getNodeChildren($_SESSION['s_current_branch'])), RecursiveIteratorIterator::SELF_FIRST));
         foreach ($iterator as $key => $value) {
             $branches[] = $key;
         }
         $stats_filters[] = array("table" => "module_hcd_employee_works_at_branch as filter_eb", "joinField" => "filter_eb.users_LOGIN", "condition" => "(filter_eb.branch_ID in (" . implode(",", $branches) . ") AND filter_eb.assigned = 1)");
         $constraints['table_filters'] = $stats_filters;
     }
     $users = $currentCourse->getCourseUsers($constraints);
     $totalEntries = $currentCourse->countCourseUsers($constraints);
コード例 #3
0
ファイル: courses.php プロジェクト: kaseya-university/efront
        //Assign this form to the renderer, so that corresponding template code is created
        $smarty->assign('T_IMPORT_COURSE_FORM', $renderer->toArray());
        //Assign the form to the template
        /** Calculate and display course ajax lists*/
        $sortedColumns = array('name', 'location', 'num_students', 'num_skills', 'start_date', 'end_date', 'price', 'created', 'active', 'operations');
        $smarty->assign("T_DATASOURCE_SORT_BY", array_search('active', $sortedColumns));
        $smarty->assign("T_DATASOURCE_SORT_ORDER", 'desc');
        $smarty->assign("T_DATASOURCE_OPERATIONS", array('statistics', 'settings', 'delete'));
        $smarty->assign("T_DATASOURCE_COLUMNS", $sortedColumns);
        if ($_GET['ajax'] == 'coursesTable' || $_GET['ajax'] == 'instancesTable') {
            try {
                if ($_GET['ajax'] == 'coursesTable') {
                    $constraints = createConstraintsFromSortedTable() + array('archive' => false, 'instance' => false);
                }
                if ($_GET['ajax'] == 'instancesTable' && eF_checkParameter($_GET['instancesTable_source'], 'id')) {
                    $constraints = createConstraintsFromSortedTable() + array('archive' => false, 'instance' => $_GET['instancesTable_source']);
                }
                $constraints['required_fields'] = array('has_instances', 'location', 'num_students', 'num_lessons', 'num_skills');
                $courses = EfrontCourse::getAllCourses($constraints);
                $totalEntries = EfrontCourse::countAllCourses($constraints);
                $dataSource = EfrontCourse::convertCourseObjectsToArrays($courses);
                $smarty->assign("T_TABLE_SIZE", $totalEntries);
                $tableName = $_GET['ajax'];
                $alreadySorted = 1;
                include "sorted_table.php";
            } catch (Exception $e) {
                handleAjaxExceptions($e);
            }
        }
    }
}
コード例 #4
0
 private function doCourseLessonUsers()
 {
     $smarty = $this->getSmartyVar();
     $currentUser = $this->getCurrentUser();
     if (isset($_GET['lessons_ID'])) {
         $currentLesson = new EfrontLesson($_GET['lessons_ID']);
         $smarty->assign("T_CURRENT_LESSON", $currentLesson);
         $roles = EfrontUser::getRoles(true);
         $smarty->assign("T_ROLES", $roles);
         try {
             if ($_GET['ajax'] == 'usersTable') {
                 $constraints = array('archive' => false, 'active' => 1, 'return_objects' => false) + createConstraintsFromSortedTable();
                 $dataSource = $currentLesson->getLessonUsersIncludingUnassigned($constraints);
                 $totalEntries = $currentLesson->countLessonUsersIncludingUnassigned($constraints);
                 $smarty->assign("T_SORTED_TABLE", $_GET['ajax']);
                 $smarty->assign("T_TABLE_SIZE", $totalEntries);
                 $smarty->assign("T_DATA_SOURCE", $dataSource);
             }
             if (isset($_GET['ajax']) && isset($_GET['reset_user'])) {
                 $user = EfrontUserFactory::factory($_GET['reset_user']);
                 $user->resetProgressInLesson($currentLesson);
                 exit;
             }
             if (isset($_GET['postAjaxRequest'])) {
                 if (isset($_GET['login']) && eF_checkParameter($_GET['login'], 'login')) {
                     isset($_GET['user_type']) && in_array($_GET['user_type'], array_keys($roles)) ? $userType = $_GET['user_type'] : ($userType = 'student');
                     $result = eF_getTableData("users_to_lessons", "*", "archive = 0 and users_LOGIN='******'login'] . "' and lessons_ID=" . $currentLesson->lesson['id']);
                     if (sizeof($result) == 0) {
                         $currentLesson->addUsers($_GET['login'], $userType);
                     } elseif ($result[0]['user_type'] != $userType) {
                         $currentLesson->setRoles($_GET['login'], $userType);
                     } else {
                         $currentLesson->removeUsers($_GET['login']);
                     }
                 } else {
                     if (isset($_GET['addAll'])) {
                         $constraints = array('archive' => false, 'active' => 1, 'has_lesson' => 0, 'return_objects' => false) + createConstraintsFromSortedTable();
                         $dataSource = $currentLesson->getLessonUsersIncludingUnassigned($constraints);
                         $userTypes = array();
                         foreach ($dataSource as $user) {
                             $user['user_types_ID'] ? $userTypes[] = $user['user_types_ID'] : ($userTypes[] = $user['user_type']);
                         }
                         $currentLesson->addUsers($dataSource, $userTypes);
                     } else {
                         if (isset($_GET['removeAll'])) {
                             $constraints = array('archive' => false, 'active' => 1, 'has_lesson' => 1, 'return_objects' => false) + createConstraintsFromSortedTable();
                             $dataSource = $currentLesson->getLessonUsersIncludingUnassigned($constraints);
                             $currentLesson->archiveLessonUsers($dataSource);
                         }
                     }
                 }
                 exit;
             }
         } catch (Exception $e) {
             handleAjaxExceptions($e);
         }
     }
 }
コード例 #5
0
             	$infoLesson -> lesson['num_professors'] = ($infoLesson -> countLessonUsers($constraints));
     */
     $infoLesson->lesson['category_path'] = $directionsPaths[$infoLesson->lesson['directions_ID']];
     $smarty->assign("T_CURRENT_LESSON_INFO", $infoLesson);
     $smarty->assign("T_STATS_ENTITY_ID", $infoLesson->lesson['id']);
     $lessonInfo = $infoLesson->getStatisticInformation();
     $smarty->assign("T_LESSON_INFO", $lessonInfo);
 } catch (Exception $e) {
     handleNormalFlowExceptions($e);
 }
 //pr($infoLesson -> getLessonStatusForUsers());exit;
 try {
     if (isset($_GET['ajax']) && $_GET['ajax'] == 'lessonUsersTable') {
         //$smarty -> assign("T_DATASOURCE_COLUMNS", array('login', 'location', 'user_type', 'completed', 'score', 'operations'));
         //$smarty -> assign("T_DATASOURCE_OPERATIONS", array('statistics'));
         $constraints = createConstraintsFromSortedTable() + array('return_objects' => false, 'table_filters' => $stats_filters);
         $users = $infoLesson->getLessonStatusForUsers($constraints);
         foreach ($users as $key => $value) {
             if ($value['user_type'] == 'professor' || $rolesBasic[$value['user_types_ID']] == 'professor') {
                 $users[$key]['basic_user_type'] = 'professor';
             }
         }
         $totalEntries = $infoLesson->countLessonUsers($constraints);
         $dataSource = $users;
         $smarty->assign("T_TABLE_SIZE", $totalEntries);
         $tableName = $_GET['ajax'];
     }
     $alreadySorted = true;
     include "sorted_table.php";
 } catch (Exception $e) {
     handleAjaxExceptions($e);
コード例 #6
0
ファイル: professor_lessons.php プロジェクト: bqq1986/efront
         }
     }
     if ($lessons[$key]['creator_LOGIN'] != $_SESSION['s_login']) {
         unset($lessons[$key]);
     }
 }
 /*
 $tableName  = 'lessonsTable';
 $dataSource = $lessons;
 include "sorted_table.php";
 */
 if (isset($_GET['ajax']) && $_GET['ajax'] == 'lessonsTable') {
     $directionsTree = new EfrontDirectionsTree();
     $directionPaths = $directionsTree->toPathString();
     $smarty->assign("T_DIRECTIONS_PATHS", $directionPaths);
     $constraints = array('archive' => false, 'condition' => "creator_LOGIN='******'s_login']}'") + createConstraintsFromSortedTable();
     $dataSource = EfrontLesson::getAllLessons($constraints);
     $totalEntries = EfrontLesson::countAllLessons($constraints);
     $tableName = $_GET['ajax'];
     $alreadySorted = 1;
     $smarty->assign("T_TABLE_SIZE", $totalEntries);
     include "sorted_table.php";
     isset($_GET['limit']) ? $limit = $_GET['limit'] : ($limit = G_DEFAULT_TABLE_SIZE);
     if (isset($_GET['sort'])) {
         isset($_GET['order']) ? $order = $_GET['order'] : ($order = 'asc');
         $lessons = eF_multiSort($lessons, $_GET['sort'], $order);
     }
     if (isset($_GET['filter'])) {
         $lessons = eF_filterData($lessons, $_GET['filter']);
     }
     $smarty->assign("T_LESSONS_SIZE", sizeof($lessons));
コード例 #7
0
ファイル: progress.php プロジェクト: bqq1986/efront
         exit;
     }
     $uncompleteEntities = json_decode($_GET['uncomplete']);
     if (!empty($uncompleteEntities)) {
         $list = '"' . implode('","', $uncompleteEntities) . '"';
         $info = eF_getTableData("users_to_lessons", "users_LOGIN,lessons_ID,completed,score,to_timestamp,comments", "users_LOGIN IN (" . $list . ") and lessons_ID = " . $currentLesson->lesson['id']);
         foreach ($info as $value) {
             if ($value['completed'] == 1) {
                 eF_updateTableData("users_to_lessons", array("completed" => 0, "to_timestamp" => null, "score" => 0, "comments" => "", "issued_certificate" => ""), "users_LOGIN='******'users_LOGIN'] . "' and lessons_ID = " . $value['lessons_ID']);
             }
         }
     }
     exit;
 }
 if (isset($_GET['ajax']) && $_GET['ajax'] == 'usersTable') {
     $constraints = createConstraintsFromSortedTable() + array('archive' => false, 'return_objects' => false);
     foreach (EfrontLessonUser::getLessonsRoles() as $key => $value) {
         $value != 'student' or $studentRoles[] = $key;
     }
     if ($_SESSION['s_current_branch']) {
         $branches = array($_SESSION['s_current_branch']);
         $branchesTree = new EfrontBranchesTree();
         $iterator = new EfrontNodeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($branchesTree->getNodeChildren($_SESSION['s_current_branch'])), RecursiveIteratorIterator::SELF_FIRST));
         foreach ($iterator as $key => $value) {
             $branches[] = $key;
         }
         $stats_filters[] = array("table" => "module_hcd_employee_works_at_branch as filter_eb", "joinField" => "filter_eb.users_LOGIN", "condition" => "(filter_eb.branch_ID in (" . implode(",", $branches) . ") AND filter_eb.assigned = 1)");
         $constraints['table_filters'] = $stats_filters;
     }
     $constraints['condition'] = "ul.user_type in ('" . implode("','", $studentRoles) . "')";
     $users = $currentLesson->getLessonStatusForUsers($constraints);
コード例 #8
0
ファイル: digests.php プロジェクト: kaseya-university/efront
 }
 if (isset($_GET['ajax']) && $_GET['ajax'] == 'msgQueueTable') {
     isset($_GET['limit']) && eF_checkParameter($_GET['limit'], 'uint') ? $limit = $_GET['limit'] : ($limit = G_DEFAULT_TABLE_SIZE);
     if (isset($_GET['sort']) && eF_checkParameter($_GET['sort'], 'text')) {
         $sort = $_GET['sort'];
         // @TODO fix
         if ($sort == "timestamp") {
             $order = "desc";
         } else {
             isset($_GET['order']) && $_GET['order'] == 'desc' ? $order = 'desc' : ($order = 'asc');
         }
     } else {
         $sort = 'timestamp';
         $order = 'asc';
     }
     $constraints = createConstraintsFromSortedTable();
     list($where, $limit, $orderby) = EfrontNotification::convertNotificationConstraintsToSqlParameters($constraints);
     // ** Get queue messages **
     $sending_queue_msgs = eF_getTableData("notifications as n", "*", implode(" and ", $where), $orderby, false, $limit);
     $sending_queue_size = eF_countTableData("notifications as n", "n.id", implode(" and ", $where));
     //$sending_queue_msgs = eF_getTableData("notifications", "*", "active = 1", "timestamp ASC");
     // Create the corresponding info per message
     foreach ($sending_queue_msgs as $key => $sending_queue_msg) {
         // recipients
         if ($sending_queue_msg['send_conditions'] == "N;") {
             $sending_queue_msgs[$key]['recipients'] = _ALLUSERS;
         } else {
             $sending_queue_msg['send_conditions'] = unserialize($sending_queue_msg['send_conditions']);
             if (is_array($sending_queue_msg['send_conditions'])) {
                 if (isset($sending_queue_msg['send_conditions']['lessons_ID'])) {
                     if ($sending_queue_msg['send_conditions']['lessons_ID'] != 0) {
コード例 #9
0
     }
 } else {
     if (isset($_GET['removeAll']) && $_GET['table'] == "lessonsTable") {
         //isset($_GET['filter']) ? $lessons = eF_filterData($lessons, $_GET['filter']) : null;
         eF_deleteTableData("lessons_to_groups", "groups_ID=" . $_GET['edit_user_group']);
         echo "All lessons where deleted from group";
     } else {
         if (isset($_GET['courses_ID']) && eF_checkParameter($_GET['courses_ID'], 'id')) {
             if ($_GET['insert'] == 1) {
                 $currentGroup->addCourse($_GET['courses_ID']);
             } else {
                 $currentGroup->removeCourses($_GET['courses_ID']);
             }
         } else {
             if (isset($_GET['addAll']) && $_GET['table'] == "coursesTable") {
                 $constraints = array('archive' => false, 'instance' => false) + createConstraintsFromSortedTable();
                 $courses = $currentGroup->getGroupCoursesAggregatingResultsIncludingUnassigned($constraints);
                 $courses = EfrontCourse::convertCourseObjectsToArrays($courses);
                 isset($_GET['filter']) ? $courses = eF_filterData($courses, $_GET['filter']) : null;
                 foreach ($courses as $course) {
                     if (!$course['in_group']) {
                         $currentGroup->addCourse($course['id'], 'student');
                         echo "Added course " . $course['id'] . " to group";
                     }
                 }
             } else {
                 if (isset($_GET['removeAll']) && $_GET['table'] == "coursesTable") {
                     //isset($_GET['filter']) ? $lessons = eF_filterData($lessons, $_GET['filter']) : null;
                     eF_deleteTableData("courses_to_groups", "groups_ID=" . $_GET['edit_user_group']);
                     echo "All lessons where deleted from group";
                 } else {
コード例 #10
0
     $dataSource = $courses;
     $smarty->assign("T_TABLE_SIZE", $totalEntries);
 }
 if (isset($_GET['ajax']) && $_GET['ajax'] == 'courseLessonsUsersTable' && eF_checkParameter($_GET['courseLessonsUsersTable_source'], 'id')) {
     $smarty->assign("T_DATASOURCE_COLUMNS", array('name', 'time_in_lesson', 'overall_progress', 'test_status', 'project_status', 'completed', 'score', 'user_type'));
     $infoUser = EfrontUserFactory::factory($_GET['courseLessonsUsersTable_login']);
     $lessons = $infoUser->getUserStatusInCourseLessons(new EfrontCourse($_GET['courseLessonsUsersTable_source']), true);
     $lessons = EfrontLesson::convertLessonObjectsToArrays($lessons);
     $dataSource = $lessons;
 }
 if (isset($_GET['ajax']) && $_GET['ajax'] == 'coursesTable') {
     $smarty->assign("T_DATASOURCE_COLUMNS", array('name', 'location', 'directions_name', 'num_students', 'num_lessons', 'num_skills', 'price', 'created', 'operations', 'sort_by_column' => 8));
     $smarty->assign("T_DATASOURCE_OPERATIONS", array('statistics', 'settings'));
     $smarty->assign("T_SHOW_COURSE_LESSONS", true);
     // the 'active' is now part of the table filters
     $constraints = createConstraintsFromSortedTable() + array('archive' => false, 'instance' => $infoCourse->course['id']);
     $constraints['required_fields'] = array('has_instances', 'location', 'num_students', 'num_lessons', 'num_skills');
     $constraints['table_filters'] = $stats_filters;
     $courses = EfrontCourse::getAllCourses($constraints);
     $courses = EfrontCourse::convertCourseObjectsToArrays($courses);
     array_walk($courses, create_function('&$v,$k', '$v["has_instances"] = 0;'));
     //Eliminate the information on whether this course has instances, since this table only lists a course's instances anyway (and we want the + to expand its lessons always)
     $dataSource = $courses;
 }
 if (isset($_GET['ajax']) && $_GET['ajax'] == 'courseLessonsTable' && eF_checkParameter($_GET['courseLessonsTable_source'], 'id')) {
     $smarty->assign("T_DATASOURCE_COLUMNS", array('name'));
     $lessons = $infoCourse->getCourseLessons();
     $lessons = EfrontLesson::convertLessonObjectsToArrays($lessons);
     $dataSource = $lessons;
 }
 $tableName = $_GET['ajax'];
コード例 #11
0
                 if ($currentEmployee->isSupervisor()) {
                     $constraints['active'] = true;
                     $constraints['branch_url'] = true;
                 }
             }
             #cpp#endif
             $courses = $editedUser->getUserCoursesAggregatingResultsIncludingUnassigned($constraints);
             $totalEntries = $editedUser->countUserCoursesAggregatingResultsIncludingUnassigned($constraints);
         } else {
             $constraints['active'] = true;
             $courses = $editedUser->getUserCoursesAggregatingResults($constraints);
             $totalEntries = $editedUser->countUserCoursesAggregatingResults($constraints);
         }
     }
     if (isset($_GET['ajax']) && $_GET['ajax'] == 'instancesTable' && eF_checkParameter($_GET['instancesTable_source'], 'id')) {
         $constraints = array('archive' => false, 'active' => true, 'instance' => $_GET['instancesTable_source']) + createConstraintsFromSortedTable();
         $constraints['required_fields'] = array('has_instances', 'location', 'active_in_course', 'user_type', 'completed', 'score', 'has_course', 'num_lessons');
         $constraints['return_objects'] = false;
         if ($_change_courses_) {
             $courses = $editedUser->getUserCoursesIncludingUnassigned($constraints);
             $totalEntries = $editedUser->countUserCoursesIncludingUnassigned($constraints);
         } else {
             $courses = $editedUser->getUserCourses($constraints);
             $totalEntries = $editedUser->countUserCourses($constraints);
         }
     }
     $alreadySorted = true;
     $dataSource = $courses;
     $smarty->assign("T_SHOW_COURSE_LESSONS", true);
     $smarty->assign("T_TABLE_SIZE", $totalEntries);
 }