//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); } } } }
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 { if (isset($_GET['assign_to_all_users']) && $_GET['assign_to_all_users'] == "courses") { $groupUsers = $currentGroup->getGroupUsers();