//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); } } } }