Example #1
0
try {
    if (isset($_GET['ajax']) && $_GET['ajax'] == "usersTable") {
        $roles = EfrontUser::getRoles(true);
        $smarty->assign("T_ROLES", $roles);
        $constraints = array('archive' => false, 'return_objects' => false) + createConstraintsFromSortedTable();
        $users = $currentGroup->getGroupUsersIncludingUnassigned($constraints);
        $totalEntries = $currentGroup->countGroupUsersIncludingUnassigned($constraints);
        $dataSource = $users;
        $tableName = $_GET['ajax'];
        $alreadySorted = 1;
        $smarty->assign("T_TABLE_SIZE", $totalEntries);
        include "sorted_table.php";
    }
    if (isset($_GET['ajax']) && $_GET['ajax'] == "lessonsTable") {
        $groupLessons = $currentGroup->getLessons();
        $result = EfrontLesson::getStandAloneLessons(true);
        $lessons = array();
        foreach ($result as $value) {
            $lesson = $value->lesson;
            $lesson['in_group'] = false;
            $lesson['user_type'] = 'student';
            if (in_array($lesson['id'], array_keys($groupLessons))) {
                $lesson['in_group'] = true;
                $lessons[$lesson['id']] = $lesson;
                $lessons[$lesson['id']]['user_type'] = $groupLessons[$lesson['id']]['user_type'];
            } else {
                if ($lesson['active']) {
                    $lessons[$lesson['id']] = $lesson;
                }
            }
        }