foreach ($gradebooks as $item) { $item['caption'] = $item['name']; $item['value'] = $item['id']; $return[] = $item; } echo json_encode($return); break; case 'get_course_info_popup': $course_info = api_get_course_info($_REQUEST['code']); $courses = CourseManager::process_hot_course_item([['c_id' => $course_info['real_id']]]); Display::display_no_header(); Display::$global_template->assign('hot_courses', $courses); echo Display::$global_template->fetch('default/layout/hot_course_item_popup.tpl'); break; case 'gradebook_exists': $data = $gradebook->get($_REQUEST['gradebook_id']); if (!empty($data)) { echo 1; } else { echo 0; } break; case 'get_skills_by_profile': $skill_rel_profile = new SkillRelProfile(); $profile_id = isset($_REQUEST['profile_id']) ? $_REQUEST['profile_id'] : null; $skills = $skill_rel_profile->get_skills_by_profile($profile_id); echo json_encode($skills); break; case 'get_saved_profiles': $skill_profile = new SkillProfile(); $profiles = $skill_profile->get_all();
<script> $(function() { <?php // grid definition see the $career->display() function echo Display::grid_js('gradebooks', $url, $columns, $column_model, $extra_params, array(), $action_links, true); ?> }); </script> <?php $gradebook = new Gradebook(); switch ($action) { case 'display': $gradebook->display(); break; case 'add_skill': $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : null; $gradebook_info = $gradebook->get($id); $url = api_get_self() . '?action=' . $action . '&id=' . $id; $form = $gradebook->show_skill_form($id, $url, $gradebook_info['name']); if ($form->validate()) { $values = $form->exportValues(); $res = $gradebook->update_skills_to_gradebook($values['id'], $values['skill']); if ($res) { Display::display_confirmation_message(get_lang('ItemAdded')); } } $form->display(); //echo Display::tag('h2',$gradebook_info['name']); break; } Display::display_footer();
/** * Shows the student's certificate (HTML file). If the global setting * allow_public_certificates is set to 'false', no certificate can be printed. * If the global allow_public_certificates is set to 'true' and the course * setting allow_public_certificates is set to 0, no certificate *in this * course* can be printed (for anonymous users). Connected users can always * print them. */ public function show() { // Special rules for anonymous users $failed = false; if (api_is_anonymous()) { if (api_get_setting('allow_public_certificates') != 'true') { // The "non-public" setting is set, so do not print $failed = true; } else { // Check the course-level setting to make sure the certificate // can be printed publicly if (isset($this->certificate_data) && isset($this->certificate_data['cat_id'])) { $gradebook = new Gradebook(); $gradebook_info = $gradebook->get($this->certificate_data['cat_id']); if (!empty($gradebook_info['course_code'])) { $allow_public_certificates = api_get_course_setting('allow_public_certificates', $gradebook_info['course_code']); if ($allow_public_certificates == 0) { // Printing not allowed $failed = true; } } else { // No course ID defined (should never get here) Display::display_reduced_header(); Display::display_warning_message(get_lang('NoCertificateAvailable')); exit; } } } } if ($failed) { Display::display_reduced_header(); Display::display_warning_message(get_lang('CertificateExistsButNotPublic')); exit; } //Read file or preview file if (!empty($this->certificate_data['path_certificate'])) { $user_certificate = $this->certification_user_path . basename($this->certificate_data['path_certificate']); if (file_exists($user_certificate)) { header('Content-Type: text/html; charset=' . api_get_system_encoding()); echo @file_get_contents($user_certificate); } } else { Display::display_reduced_header(); Display::display_warning_message(get_lang('NoCertificateAvailable')); } exit; }