diff --git a/main/admin/skill.php b/main/admin/skill.php index ce12f67e2c..d0559a23ec 100644 --- a/main/admin/skill.php +++ b/main/admin/skill.php @@ -88,7 +88,7 @@ switch ($action) { } $tpl->assign('list', $list); - -$contentTemplate = $tpl->fetch('default/admin/skill.tpl'); +$view = $tpl->get_template('admin/skill.tpl'); +$contentTemplate = $tpl->fetch($view); $tpl->assign('content', $contentTemplate); $tpl->display_one_col_template(); diff --git a/main/admin/skill_badge.php b/main/admin/skill_badge.php index 60c65de9c0..44fe6c3e68 100644 --- a/main/admin/skill_badge.php +++ b/main/admin/skill_badge.php @@ -38,7 +38,9 @@ $toolbar = Display::toolbarButton( $tpl = new Template(get_lang('Badges')); $tpl->assign('backpack', $backpack); -$contentTemplate = $tpl->fetch('default/skill/badge.tpl'); + +$templateName = $tpl->get_template('skill/badge.tpl'); +$contentTemplate = $tpl->fetch($templateName); $tpl->assign('actions', $toolbar); $tpl->assign('content', $contentTemplate); diff --git a/main/admin/skill_badge_create.php b/main/admin/skill_badge_create.php index 35ac806b00..a3ea3a2d5c 100644 --- a/main/admin/skill_badge_create.php +++ b/main/admin/skill_badge_create.php @@ -120,9 +120,8 @@ $tpl = new Template(get_lang('CreateBadge')); $tpl->assign('platformAdminEmail', api_get_setting('emailAdministrator')); $tpl->assign('skill', $skill); $tpl->assign('badge_studio', $badgeStudio); - -$contentTemplate = $tpl->fetch('default/skill/badge_create.tpl'); - +$templateName = $tpl->get_template('skill/badge_create.tpl'); +$contentTemplate = $tpl->fetch($templateName); $tpl->assign('actions', $toolbar); $tpl->assign('content', $contentTemplate); $tpl->display_one_col_template(); diff --git a/main/admin/skill_badge_list.php b/main/admin/skill_badge_list.php index 54bbe3eb86..40732614c2 100644 --- a/main/admin/skill_badge_list.php +++ b/main/admin/skill_badge_list.php @@ -50,8 +50,8 @@ $toolbar = Display::toolbarButton( $tpl = new Template(get_lang('Skills')); $tpl->assign('errorMessage', $errorMessage); $tpl->assign('skills', $skills); - -$contentTemplate = $tpl->fetch('default/skill/badge_list.tpl'); +$templateName = $tpl->get_template('skill/badge_list.tpl'); +$contentTemplate = $tpl->fetch($templateName); $tpl->assign('actions', $toolbar); $tpl->assign('content', $contentTemplate); diff --git a/main/admin/skill_level.php b/main/admin/skill_level.php index 2af85ac988..ad1737006a 100644 --- a/main/admin/skill_level.php +++ b/main/admin/skill_level.php @@ -106,7 +106,7 @@ switch ($action) { } $tpl->assign('list', $list); - -$contentTemplate = $tpl->fetch('default/admin/skill_level.tpl'); +$templateName = $tpl->get_template('admin/skill_level.tpl'); +$contentTemplate = $tpl->fetch($templateName); $tpl->assign('content', $contentTemplate); $tpl->display_one_col_template(); diff --git a/main/admin/skill_list.php b/main/admin/skill_list.php index e91f12214a..074c17bb13 100644 --- a/main/admin/skill_list.php +++ b/main/admin/skill_list.php @@ -176,8 +176,8 @@ switch ($action) { $tpl->assign('skills', $skillList); $tpl->assign('current_tag_id', $extraFieldSearchTagId); $tpl->assign('tags', $tags); - - $content = $tpl->fetch('default/skill/list.tpl'); + $templateName = $tpl->get_template('skill/list.tpl'); + $content = $tpl->fetch($templateName); $tpl->assign('actions', $toolbar); $tpl->assign('content', $content); diff --git a/main/admin/skill_profile.php b/main/admin/skill_profile.php index 2a4acc8108..a6a3309cd2 100644 --- a/main/admin/skill_profile.php +++ b/main/admin/skill_profile.php @@ -116,7 +116,7 @@ switch ($action) { } $tpl->assign('list', $list); - -$contentTemplate = $tpl->fetch('default/admin/skill_profile.tpl'); +$templateName = $tpl->get_template('admin/skill_profile.tpl'); +$contentTemplate = $tpl->fetch($templateName); $tpl->assign('content', $contentTemplate); $tpl->display_one_col_template(); diff --git a/main/admin/skills.php b/main/admin/skills.php index 075b48e5ee..161800a91c 100755 --- a/main/admin/skills.php +++ b/main/admin/skills.php @@ -35,7 +35,7 @@ $tpl->assign('url', $url); $tpl->assign('html', $html); $tpl->assign('skill_visualizer', $skill_visualizer); $tpl->assign('js', $skill_visualizer->return_js()); - -$content = $tpl->fetch('default/skill/skill_tree.tpl'); +$templateName = $tpl->get_template('skill/skill_tree.tpl'); +$content = $tpl->fetch($templateName); $tpl->assign('content', $content); $tpl->display_no_layout_template(); diff --git a/main/admin/skills_profile.php b/main/admin/skills_profile.php index 1506f3660e..1785e26a8a 100755 --- a/main/admin/skills_profile.php +++ b/main/admin/skills_profile.php @@ -143,9 +143,10 @@ foreach ($total_skills_to_search as $skill_info) { $tpl->assign('skill_list', $skill_list); $tpl->assign('search_skill_list', $skills); -$form_to_html = $form->return_form(); +$form_to_html = $form->returnForm(); $tpl->assign('form', $form_to_html); $tpl->assign('url', $url); -$content = $tpl->fetch('default/skill/profile.tpl'); +$templateName = $tpl->get_template('skill/profile.tpl'); +$content = $tpl->fetch($templateName); $tpl->assign('content', $content); $tpl->display_one_col_template(); diff --git a/main/admin/skills_wheel.php b/main/admin/skills_wheel.php index b025ce20d8..9c06f1f7c3 100755 --- a/main/admin/skills_wheel.php +++ b/main/admin/skills_wheel.php @@ -70,7 +70,7 @@ $saveProfileForm->addHidden('profile_id', null); $saveProfileForm->addText('name', get_lang('Name'), true, ['id' => 'name_profile']); $saveProfileForm->addTextarea('description', get_lang('Description'), ['id' => 'description_profile', 'rows' => 6]); $tpl->assign('saveProfileForm', $saveProfileForm->returnForm()); - -$content = $tpl->fetch('default/skill/skill_wheel.tpl'); +$templateName = $tpl->get_template('skill/skill_wheel.tpl'); +$content = $tpl->fetch($templateName); $tpl->assign('content', $content); $tpl->display_no_layout_template(); diff --git a/main/admin/teacher_time_report.php b/main/admin/teacher_time_report.php index 667b853578..5777ed1057 100644 --- a/main/admin/teacher_time_report.php +++ b/main/admin/teacher_time_report.php @@ -368,25 +368,22 @@ $form->setDefaults([ ]); $tpl = new Template($toolName); -$tpl->assign('reportTitle', $reportTitle); -$tpl->assign('reportSubTitle', $reportSubTitle); - -$tpl->assign('selectedCourse', $selectedCourse); -$tpl->assign('selectedSession', $selectedSession); -$tpl->assign('selectedTeacher', $selectedTeacher); -$tpl->assign('selectedFrom', $selectedFrom); -$tpl->assign('selectedUntil', $selectedUntil); - -$tpl->assign('withFilter', $withFilter); - +$tpl->assign('report_title', $reportTitle); +$tpl->assign('report_sub_title', $reportSubTitle); +$tpl->assign('selected_course', $selectedCourse); +$tpl->assign('selected_session', $selectedSession); +$tpl->assign('selected_teacher', $selectedTeacher); +$tpl->assign('selected_from', $selectedFrom); +$tpl->assign('selected_until', $selectedUntil); +$tpl->assign('with_filter', $withFilter); $tpl->assign('courses', $courseList); $tpl->assign('sessions', $sessionsList); -$tpl->assign('courseCoaches', $teacherList); - +//$tpl->assign('courseCoaches', $teacherList); $tpl->assign('form', $form->returnForm()); - $tpl->assign('rows', $timeReport->data); -$contentTemplate = $tpl->fetch('default/admin/teacher_time_report.tpl'); +$templateName = $tpl->get_template('admin/teacher_time_report.tpl'); + +$contentTemplate = $tpl->fetch($templateName); $tpl->assign('content', $contentTemplate); $tpl->display_one_col_template(); diff --git a/main/calendar/agenda_js.php b/main/calendar/agenda_js.php index 52ac8ae392..a8472fbbde 100755 --- a/main/calendar/agenda_js.php +++ b/main/calendar/agenda_js.php @@ -246,11 +246,7 @@ if ($agenda->type === 'course') { } $tpl->assign('form_add', $form->returnForm()); - -// Loading Agenda template. -$content = $tpl->fetch('default/agenda/month.tpl'); - +$templateName = $tpl->get_template('agenda/month.tpl'); +$content = $tpl->fetch($templateName); $tpl->assign('content', $content); - -// Loading main Chamilo 1 col template $tpl->display_one_col_template(); diff --git a/main/calendar/agenda_list.php b/main/calendar/agenda_list.php index 83d532ff40..0f80a3eb65 100755 --- a/main/calendar/agenda_list.php +++ b/main/calendar/agenda_list.php @@ -79,10 +79,7 @@ if (api_is_allowed_to_edit()) { } } -// Loading Agenda template -$content = $tpl->fetch('default/agenda/event_list.tpl'); - +$templateName = $tpl->get_template('agenda/event_list.tpl'); +$content = $tpl->fetch($templateName); $tpl->assign('content', $content); - -// Loading main Chamilo 1 col template $tpl->display_one_col_template(); diff --git a/main/coursecopy/import_moodle.php b/main/coursecopy/import_moodle.php index 95d57555e2..6400df9fa3 100644 --- a/main/coursecopy/import_moodle.php +++ b/main/coursecopy/import_moodle.php @@ -59,7 +59,8 @@ $template = new Template($templateName); $infoMsg = Display::return_message(get_lang('ImportFromMoodleInstructions'), 'normal', false); $template->assign('info_msg', $infoMsg); $template->assign('form', $form->returnForm()); -$content = $template->fetch('default/coursecopy/import_moodle.tpl'); +$templateName = $template->get_template('coursecopy/import_moodle.tpl'); +$content = $template->fetch($templateName); $template->assign('header', $templateName); $template->assign('content', $content); diff --git a/main/document/recycle.php b/main/document/recycle.php index 281bb55e7c..1b798d39fc 100644 --- a/main/document/recycle.php +++ b/main/document/recycle.php @@ -58,8 +58,8 @@ $template = new Template(get_lang('DeletedDocuments')); $template->assign('files', $files); $template->assign('actions', $actions); $template->assign('web_cid_query', api_get_cidreq()); - -$content = $template->fetch('default/document/recycle.tpl'); +$templateName = $template->get_template('document/recycle.tpl'); +$content = $template->fetch($templateName); $template->assign('content', $content); $template->display_one_col_template(); diff --git a/main/exercise/admin.php b/main/exercise/admin.php index 3598a28b42..9a43720c97 100755 --- a/main/exercise/admin.php +++ b/main/exercise/admin.php @@ -340,8 +340,8 @@ $htmlHeadXtra[] = api_get_js('jqueryui-touch-punch/jquery.ui.touch-punch.min.js' $htmlHeadXtra[] = api_get_js('jquery.jsPlumb.all.js'); $template = new Template(); - -$htmlHeadXtra[] = $template->fetch('default/exercise/submit.js.tpl'); +$templateName = $template->get_template('exercise/submit.js.tpl'); +$htmlHeadXtra[] = $template->fetch($templateName); $htmlHeadXtra[] = api_get_js('d3/jquery.xcolor.js'); $htmlHeadXtra[] = ''; diff --git a/main/exercise/exercise_submit.php b/main/exercise/exercise_submit.php index cebc9ba458..a5bd54b4a4 100755 --- a/main/exercise/exercise_submit.php +++ b/main/exercise/exercise_submit.php @@ -156,7 +156,8 @@ if ($objExercise->review_answers) { } $template->assign('shuffle_answers', $objExercise->random_answers); -$htmlHeadXtra[] = $template->fetch('default/exercise/submit.js.tpl'); +$templateName = $template->get_template('exercise/submit.js.tpl'); +$htmlHeadXtra[] = $template->fetch($templateName); $current_timestamp = time(); $my_remind_list = array(); diff --git a/main/gradebook/certificate_report.php b/main/gradebook/certificate_report.php index 8098c826bf..8551539e99 100644 --- a/main/gradebook/certificate_report.php +++ b/main/gradebook/certificate_report.php @@ -30,7 +30,7 @@ $selectedStudent = isset($_POST['student']) && !empty($_POST['student']) ? intva $userId = api_get_user_id(); $sessions = $courses = $months = $students = [0 => get_lang('Select')]; - +$userList = []; if (api_is_student_boss()) { $userGroup = new UserGroup(); $userList = $userGroup->getGroupUsersByUser($userId); @@ -45,7 +45,7 @@ foreach ($sessionsList as $session) { if ($selectedSession > 0) { if (!SessionManager::isValidId($selectedSession)) { - Session::write('reportErrorMessage', get_lang('NoSession')); + Display::addFlash(Display::return_message(get_lang('NoSession'))); header("Location: $selfUrl"); exit; @@ -88,7 +88,6 @@ for ($key = 1; $key <= 12; $key++) { $exportAllLink = null; $certificateStudents = array(); - $searchSessionAndCourse = $selectedSession > 0 && $selectedCourse > 0; $searchCourseOnly = $selectedSession <= 0 && $selectedCourse > 0; $searchStudentOnly = $selectedStudent > 0; @@ -97,7 +96,7 @@ if ($searchSessionAndCourse || $searchCourseOnly) { $selectedCourseInfo = api_get_course_info_by_id($selectedCourse); if (empty($selectedCourseInfo)) { - Session::write('reportErrorMessage', get_lang('NoCourse')); + Display::addFlash(Display::return_message(get_lang('NoCourse'))); header("Location: $selfUrl"); exit; @@ -186,7 +185,7 @@ if ($searchSessionAndCourse || $searchCourseOnly) { $selectedStudentInfo = api_get_user_info($selectedStudent); if (empty($selectedStudentInfo)) { - Session::write('reportErrorMessage', get_lang('NoUser')); + Display::addFlash(Display::return_message(get_lang('NoUser'))); header('Location: '.$selfUrl); exit; @@ -244,32 +243,34 @@ if ($searchSessionAndCourse || $searchCourseOnly) { /* View */ $template = new Template(get_lang('GradebookListOfStudentsCertificates')); -if (Session::has('reportErrorMessage')) { - $template->assign('errorMessage', Session::read('reportErrorMessage')); -} - -$searchBySessionCourseDateForm = new FormValidator( +$form = new FormValidator( 'certificate_report_form', 'post', api_get_path(WEB_CODE_PATH) . 'gradebook/certificate_report.php' ); -$searchBySessionCourseDateForm->addSelect('session', get_lang('Sessions'), $sessions, ['id' => 'session']); -$searchBySessionCourseDateForm->addSelect('course', get_lang('Courses'), $courses, ['id' => 'course']); -$searchBySessionCourseDateForm->addGroup( +$form->addSelect('session', get_lang('Sessions'), $sessions, ['id' => 'session']); +$form->addSelect('course', get_lang('Courses'), $courses, ['id' => 'course']); +$form->addGroup( [ - $searchBySessionCourseDateForm->createElement('select', 'month', null, $months, ['id' => 'month']), - $searchBySessionCourseDateForm->createElement( + $form->createElement( + 'select', + 'month', + null, + $months, + ['id' => 'month'] + ), + $form->createElement( 'text', 'year', null, ['id' => 'year', 'placeholder' => get_lang('Year')] - ) + ), ], null, get_lang('Date') ); -$searchBySessionCourseDateForm->addButtonSearch(); -$searchBySessionCourseDateForm->setDefaults([ +$form->addButtonSearch(); +$form->setDefaults([ 'session' => $selectedSession, 'course' => $selectedCourse, 'month' => $selectedMonth, @@ -281,30 +282,27 @@ if (api_is_student_boss()) { $students[$studentId] = api_get_user_info($studentId)['complete_name_with_username']; } - $searchByStudentForm = new FormValidator( + $searchForm = new FormValidator( 'certificate_report_form', 'post', api_get_path(WEB_CODE_PATH) . 'gradebook/certificate_report.php' ); - $searchByStudentForm->addSelect('student', get_lang('Students'), $students, ['id' => 'student']); - $searchByStudentForm->addButtonSearch(); - $searchByStudentForm->setDefaults([ + $searchForm->addSelect('student', get_lang('Students'), $students, ['id' => 'student']); + $searchForm->addButtonSearch(); + $searchForm->setDefaults([ 'student' => $selectedStudent ]); - $template->assign('searchByStudentForm', $searchByStudentForm->returnForm()); + $template->assign('search_form', $searchForm->returnForm()); } -$template->assign('searchBySessionCourseDateForm', $searchBySessionCourseDateForm->returnForm()); +$template->assign('search_by_session_form', $form->returnForm()); $template->assign('sessions', $sessions); $template->assign('courses', $courses); $template->assign('months', $months); -$template->assign('exportAllLink', $exportAllLink); -$template->assign('certificateStudents', $certificateStudents); -$content = $template->fetch("default/gradebook/certificate_report.tpl"); - +$template->assign('export_all_link', $exportAllLink); +$template->assign('certificate_students', $certificateStudents); +$templateName = $template->get_template('gradebook/certificate_report.tpl'); +$content = $template->fetch($templateName); $template->assign('content', $content); - $template->display_one_col_template(); - -Session::erase('reportErrorMessage'); diff --git a/main/gradebook/my_certificates.php b/main/gradebook/my_certificates.php index c037eae5c0..c68a615e36 100644 --- a/main/gradebook/my_certificates.php +++ b/main/gradebook/my_certificates.php @@ -29,9 +29,10 @@ $template = new Template(get_lang('MyCertificates')); $template->assign('course_list', $courseList); $template->assign('session_list', $sessionList); -$content = $template->fetch('default/gradebook/my_certificates.tpl'); +$templateName = $template->get_template('gradebook/my_certificates.tpl'); +$content = $template->fetch($templateName); -if (api_get_setting('allow_public_certificates') == 'true') { +if (api_get_setting('allow_public_certificates') === 'true') { $template->assign( 'actions', Display::toolbarButton( diff --git a/main/gradebook/search.php b/main/gradebook/search.php index 9796f67040..9248623c10 100644 --- a/main/gradebook/search.php +++ b/main/gradebook/search.php @@ -76,8 +76,8 @@ $template->assign('user_list', $userList); $template->assign('user_info', $userInfo); $template->assign('course_list', $courseList); $template->assign('session_list', $sessionList); - -$content = $template->fetch('default/gradebook/search.tpl'); +$templateName = $template->get_template('gradebook/search.tpl'); +$content = $template->fetch($templateName); $template->assign('header', get_lang('SearchCertificates')); $template->assign('content', $content); diff --git a/main/inc/lib/javascript/ckeditor/config_js.php b/main/inc/lib/javascript/ckeditor/config_js.php index a077f9855e..5aa60407f2 100644 --- a/main/inc/lib/javascript/ckeditor/config_js.php +++ b/main/inc/lib/javascript/ckeditor/config_js.php @@ -11,7 +11,6 @@ if (api_get_setting('more_buttons_maximized_mode') === 'true') { $template = new Template(); $template->assign('moreButtonsInMaximizedMode', $moreButtonsInMaximizedMode); - $template->assign('course_condition', api_get_cidreq()); header('Content-type: application/x-javascript'); diff --git a/main/lp/lp_impress.php b/main/lp/lp_impress.php index 0ba4f6d253..c8e43ffc79 100755 --- a/main/lp/lp_impress.php +++ b/main/lp/lp_impress.php @@ -95,6 +95,7 @@ foreach ($list as $toc) { $tool_name = get_lang('ViewModeImpress'); $tpl = new Template($tool_name, false, false, true); $tpl->assign('html', $html); -$content = $tpl->fetch('default/learnpath/impress.tpl'); +$templateName = $tpl->get_template('learnpath/impress.tpl'); +$content = $tpl->fetch($templateName); $tpl->assign('content', $content); $tpl->display_one_col_template(); diff --git a/main/lp/lp_list.php b/main/lp/lp_list.php index a21c600abe..6225a46047 100755 --- a/main/lp/lp_list.php +++ b/main/lp/lp_list.php @@ -816,9 +816,8 @@ $template->assign('message', $message); $template->assign('introduction_section', $introductionSection); $template->assign('data', $data); $template->assign('lp_is_shown', $lpIsShown); - -$content = $template->fetch('default/learnpath/list.tpl'); - +$templateName = $template->get_template('learnpath/list.tpl'); +$content = $template->fetch($templateName); $template->assign('content', $content); $template->display_one_col_template(); diff --git a/main/mySpace/index.php b/main/mySpace/index.php index b7b570b628..75d4e1b60b 100755 --- a/main/mySpace/index.php +++ b/main/mySpace/index.php @@ -429,7 +429,6 @@ if ($export_csv) { '; } - // Send the csv file if asked if ($export_csv) { ob_end_clean(); diff --git a/main/social/my_skills_report.php b/main/social/my_skills_report.php index 101b4c919b..3f5809c471 100644 --- a/main/social/my_skills_report.php +++ b/main/social/my_skills_report.php @@ -148,7 +148,18 @@ if ($isStudent) { $skill = $objSkill->get($selectedSkill); $reportTitle = sprintf(get_lang('StudentsWhoAchievedTheSkillX'), $skill['name']); $students = UserManager::getUsersFollowedByUser( - $userId, STUDENT, false, false, false, null, null, null, null, null, null, DRH + $userId, + STUDENT, + false, + false, + false, + null, + null, + null, + null, + null, + null, + DRH ); $coursesFilter = array(); @@ -192,8 +203,7 @@ if ($isStudent) { } $tpl->assign('rows', $tableRows); - -$contentTemplate = $tpl->fetch("default/" . $tplPath); - +$templateName = $tpl->get_template($tplPath); +$contentTemplate = $tpl->fetch($templateName); $tpl->assign('content', $contentTemplate); $tpl->display_one_col_template(); diff --git a/main/template/default/admin/teacher_time_report.tpl b/main/template/default/admin/teacher_time_report.tpl index 0d90ba5663..8722739c97 100644 --- a/main/template/default/admin/teacher_time_report.tpl +++ b/main/template/default/admin/teacher_time_report.tpl @@ -1,68 +1,70 @@ -
| {{ 'Session' | get_lang }} | +{{ 'Course' | get_lang }} | + {% endif %} +{{ 'Coach' | get_lang }} | +{{ 'TotalTime' | get_lang }} | +||||
|---|---|---|---|---|---|---|---|
| {{ 'Session' | get_lang }} | -{{ 'Course' | get_lang }} | + {% if with_filter %} +{{ row.session ? row.session.name : ' ' }} | +{{ row.course.name }} | {% endif %} -{{ 'Coach' | get_lang }} | -{{ 'TotalTime' | get_lang }} | +{{ row.coach.completeName }} ({{ row.coach.username}}) | +{{ row.totalTime }} |
| {{ row.session ? row.session.name : ' ' }} | -{{ row.course.name }} | - {% endif %} -{{ row.coach.completeName }} ({{ row.coach.username}}) | -{{ row.totalTime }} | -
{{ certificate.createdAt }}
- {% endfor %} -{{ certificate.createdAt }}
+ {% endfor %} +