/** * @Route("/courses/{cidReq}/{sessionId}") * @Method({"GET"}) * * @param string $cidReq * @param int $id_session * @return Response */ public function indexAction($cidReq, $id_session = null) { $courseCode = api_get_course_id(); $sessionId = api_get_session_id(); $userId = $this->getUser()->getUserId(); $coursesAlreadyVisited = $this->getRequest()->getSession()->get('coursesAlreadyVisited'); $result = $this->autolaunch(); $showAutoLaunchLpWarning = $result['show_autolaunch_lp_warning']; $showAutoLaunchExerciseWarning = $result['show_autolaunch_exercise_warning']; if ($showAutoLaunchLpWarning) { $this->getTemplate()->assign('lp_warning', Display::return_message(get_lang('TheLPAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificLP'), 'warning')); } if ($showAutoLaunchExerciseWarning) { $this->getTemplate()->assign('exercise_warning', Display::return_message(get_lang('TheExerciseAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificExercise'), 'warning')); } if ($this->isCourseTeacher()) { $editIcons = Display::url(Display::return_icon('edit.png'), $this->generateUrl('course_home.controller:iconListAction', array('course' => api_get_course_id()))); $this->getTemplate()->assign('edit_icons', $editIcons); } if (!isset($coursesAlreadyVisited[$courseCode])) { event_access_course(); $coursesAlreadyVisited[$courseCode] = 1; $this->getRequest()->getSession()->set('coursesAlreadyVisited', $coursesAlreadyVisited); } $this->getRequest()->getSession()->remove('toolgroup'); $this->getRequest()->getSession()->remove('_gid'); $isSpecialCourse = \CourseManager::is_special_course($courseCode); if ($isSpecialCourse) { $autoreg = $this->getRequest()->get('autoreg'); if ($autoreg == 1) { \CourseManager::subscribe_user($userId, $courseCode, STUDENT); } } $script = 'activity.php'; if (api_get_setting('homepage_view') == 'activity' || api_get_setting('homepage_view') == 'activity_big') { $script = 'activity.php'; } elseif (api_get_setting('homepage_view') == '2column') { $script = '2column.php'; } elseif (api_get_setting('homepage_view') == '3column') { $script = '3column.php'; } elseif (api_get_setting('homepage_view') == 'vertical_activity') { $script = 'vertical_activity.php'; } $result = (require_once api_get_path(SYS_CODE_PATH) . 'course_home/' . $script); $toolList = $result['tool_list']; $this->getTemplate()->assign('icons', $result['content']); $introduction = Display::return_introduction_section($this->get('url_generator'), TOOL_COURSE_HOMEPAGE, $toolList); $this->getTemplate()->assign('introduction_text', $introduction); if (api_get_setting('show_session_data') == 'true' && $sessionId) { $sessionInfo = \CourseHome::show_session_data($sessionId); $this->getTemplate()->assign('session_info', $sessionInfo); } $response = $this->get('template')->render_template($this->getTemplatePath() . 'index.tpl'); return new Response($response, 200, array()); }
/** * Sets the header visibility * @param bool true if we show the header */ public function set_header($status) { $this->show_header = $status; $this->assign('show_header', $status); $show_toolbar = 0; if (self::isToolBarDisplayedForUser()) { $show_toolbar = 1; } $this->assign('show_toolbar', $show_toolbar); //Only if course is available $show_course_shortcut = null; $show_course_navigation_menu = null; if (!empty($this->course_id) && $this->user_is_logged_in) { if (api_get_setting('show_toolshortcuts') != 'false') { //Course toolbar $show_course_shortcut = CourseHome::show_navigation_tool_shortcuts(); } if (api_get_setting('show_navigation_menu') != 'false') { //Course toolbar $show_course_navigation_menu = CourseHome::show_navigation_menu(); } } $this->assign('show_course_shortcut', $show_course_shortcut); $this->assign('show_course_navigation_menu', $show_course_navigation_menu); }
} /* TOOLS VISIBLE FOR EVERYBODY */ $content .= '<div class="everybodyview">'; $content .= '<table width="100%">'; $content .= CourseHome::show_tool_2column(TOOL_PUBLIC); $content .= '</table>'; $content .= '</div>'; /* COURSE ADMIN ONLY VIEW */ // Start of tools for CourseAdmins (teachers/tutors) if (api_is_allowed_to_edit(null, true) && !api_is_coach()) { $content .= "<div class=\"courseadminview\">"; $content .= "<span class=\"viewcaption\">"; $content .= get_lang('CourseAdminOnly'); $content .= "</span>"; $content .= "<table width=\"100%\">"; $content .= CourseHome::show_tool_2column(TOOL_COURSE_ADMIN); /* INACTIVE TOOLS - HIDDEN (GREY) LINKS */ $content .= "<tr><td colspan=\"4\"><hr style='color:\"#4171B5\"' noshade=\"noshade\" size=\"1\" /></td></tr>\n" . "<tr>\n" . "<td colspan=\"4\">\n" . "<div style=\"margin-bottom: 10px;\"><font color=\"#808080\">\n" . get_lang('InLnk') . "</font></div>" . "</td>\n" . "</tr>"; $content .= CourseHome::show_tool_2column(TOOL_PUBLIC_BUT_HIDDEN); $content .= "</table>"; $content .= "</div> "; } /* Tools for platform admin only */ if (api_is_platform_admin() && api_is_allowed_to_edit(null, true) && !api_is_coach()) { $content .= '<div class="platformadminview"> <span class="viewcaption">' . get_lang('PlatformAdminOnly') . '</span> <table width="100%"> ' . CourseHome::show_tool_2column(TOOL_PLATFORM_ADMIN) . ' </table> </div>'; }
/** * @param bool $include_admin_tools * @return array */ static function get_navigation_items($include_admin_tools = false) { $navigation_items = array(); $course_id = api_get_course_int_id(); if (!empty($course_id)) { $course_tools_table = Database::get_course_table(TABLE_TOOL_LIST); /* Link to the Course homepage */ $navigation_items['home']['image'] = 'home.gif'; $navigation_items['home']['link'] = api_get_path(REL_COURSE_PATH) . Security::remove_XSS($_SESSION['_course']['path']) . '/index.php'; $navigation_items['home']['name'] = get_lang('CourseHomepageLink'); $sql_menu_query = "SELECT * FROM {$course_tools_table}\n WHERE c_id = {$course_id} AND visibility='1' and admin='0'\n ORDER BY id ASC"; $sql_result = Database::query($sql_menu_query); while ($row = Database::fetch_array($sql_result)) { $navigation_items[$row['id']] = $row; if (stripos($row['link'], 'http://') === false && stripos($row['link'], 'https://') === false) { $navigation_items[$row['id']]['link'] = api_get_path(REL_CODE_PATH) . $row['link']; $navigation_items[$row['id']]['name'] = CourseHome::translate_tool_name($row); } } /* Admin (edit rights) only links - Course settings (course admin only) - Course rights (roles & rights overview) */ if ($include_admin_tools) { $course_settings_sql = "SELECT name,image FROM {$course_tools_table}\n WHERE c_id = {$course_id} AND link='course_info/infocours.php'"; $sql_result = Database::query($course_settings_sql); $course_setting_info = Database::fetch_array($sql_result); $course_setting_visual_name = CourseHome::translate_tool_name($course_setting_info); if (api_get_session_id() == 0) { // course settings item $navigation_items['course_settings']['image'] = $course_setting_info['image']; $navigation_items['course_settings']['link'] = api_get_path(REL_CODE_PATH) . 'course_info/infocours.php'; $navigation_items['course_settings']['name'] = $course_setting_visual_name; } } } foreach ($navigation_items as $key => $navigation_item) { if (strstr($navigation_item['link'], '?')) { //link already contains a parameter, add course id parameter with & $parameter_separator = '&'; } else { //link doesn't contain a parameter yet, add course id parameter with ? $parameter_separator = '?'; } //$navigation_items[$key]['link'] .= $parameter_separator.api_get_cidreq(); $navigation_items[$key]['link'] .= $parameter_separator . 'cidReq=' . api_get_course_id() . '&gidReq=0&id_session=' . api_get_session_id(); } return $navigation_items; }
break; } } if ($addUserTool) { $tools[] = array('c_id' => api_get_course_int_id(), 'name' => 'user', 'link' => 'user/user.php', 'image' => 'members.gif', 'visibility' => '1', 'admin' => '0', 'address' => 'squaregrey.gif', 'added_tool' => '0', 'target' => '_self', 'category' => 'interaction', 'session_id' => api_get_session_id()); } } if (count($tools) > 0) { $content .= '<div class="row">'; $content .= CourseHome::show_tools_category($tools); $content .= '</div>'; } if ($isDrhOfCourse) { $drhTool = CourseHome::get_tools_category(TOOL_DRH); $content .= '<div class="row">'; $content .= CourseHome::show_tools_category($drhTool); $content .= '</div>'; } } /** * @param string $title * @param string $content * @param string $class * * @return string */ function return_block($title, $content, $class = null) { $html = '<div class="row"> <div class="col-xs-12 col-md-12"> <div class="title-tools">' . $title . '</div>
$tool_table = Database::get_course_table(TABLE_TOOL_LIST); $tool_info = api_get_tool_information($_GET['id']); $tool_visibility = $tool_info['visibility']; $tool_image = $tool_info['image']; if (api_get_setting('course.homepage_view') != 'activity_big') { $tool_image = Display::return_icon($tool_image, null, null, null, null, true); $na_image = str_replace('.gif', '_na.gif', $tool_image); } else { // Display::return_icon() also checks in the app/Resources/public/css/themes/{theme}/icons folder $tool_image = substr($tool_image, 0, strpos($tool_image, '.')) . '.png'; $tool_image = Display::return_icon($tool_image, get_lang(ucfirst($tool_info['name'])), null, ICON_SIZE_BIG, null, true); $na_image = str_replace('.png', '_na.png', $tool_image); } if (isset($tool_info['custom_icon']) && !empty($tool_info['custom_icon'])) { $tool_image = CourseHome::getCustomWebIconPath() . $tool_info['custom_icon']; $na_image = CourseHome::getCustomWebIconPath() . CourseHome::getDisableIcon($tool_info['custom_icon']); } $requested_image = $tool_visibility == 0 ? $tool_image : $na_image; $requested_class = $tool_visibility == 0 ? 'visible' : 'invisible'; $requested_message = $tool_visibility == 0 ? 'is_active' : 'is_inactive'; $requested_view = $tool_visibility == 0 ? 'visible.png' : 'invisible.png'; $requested_visible = $tool_visibility == 0 ? 1 : 0; $requested_view = $tool_visibility == 0 ? 'visible.png' : 'invisible.png'; $requested_visible = $tool_visibility == 0 ? 1 : 0; // HIDE AND REACTIVATE TOOL if ($_GET["id"] == strval(intval($_GET["id"]))) { $sql = "UPDATE {$tool_table} SET\n visibility = {$requested_visible}\n WHERE c_id = {$course_id} AND iid ='" . intval($_GET['id']) . "'"; Database::query($sql); } $response_data = array('image' => $requested_image, 'tclass' => $requested_class, 'message' => $requested_message, 'view' => $requested_view); echo json_encode($response_data);
if (api_is_platform_admin() && api_is_allowed_to_edit(null, true) && !api_is_coach()) { // Show message to confirm that a tools must be hide from aivailable tools // visibility 0,1->2 if ($askDelete) { $content .= "<table align=\"center\"><tr><td colspan=\"4\">\n <br /><br /><font color=\"#ff0000\"> <strong>" . get_lang('DelLk') . "</strong>\n\t\t\t<br /> \n\t\t\t<a href=\"" . api_get_self() . "\">" . get_lang('No') . "</a>\n\t\t\t | \n\t\t\t<a href=\"" . api_get_self() . "?delete=yes&id={$id}\">" . get_lang('Yes') . "</a>\n\t\t\t</font>\n\t\t\t<br /><br /><br />\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</table>\n"; } elseif (isset($delete) && $delete) { Database::query("DELETE FROM {$TBL_ACCUEIL} WHERE c_id = {$course_id} AND id = {$id} AND added_tool=1"); } } $content .= "<table class=\"item\" align=\"center\" border=\"0\" width=\"95%\">\n"; /* TOOLS FOR EVERYBODY */ $content .= "<tr>\n<td colspan=\"6\"> </td>\n</tr>\n"; $content .= "<tr>\n<td colspan=\"6\">"; $content .= CourseHome::show_tool_3column('Basic'); $content .= CourseHome::show_tool_3column('External'); $content .= "</td>\n</tr>\n"; /* PROF ONLY VIEW */ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) { $content .= "<tr><td colspan=\"6\"><hr noshade size=\"1\" /></td></tr>\n" . "<tr><td colspan=\"6\"><font color=\"#F66105\">\n" . get_lang('CourseAdminOnly') . "</font>\n\t\t</td></tr>\n"; $content .= "<tr>\n<td colspan=\"6\">"; $content .= CourseHome::show_tool_3column('courseAdmin'); $content .= "</td>\n</tr>\n"; } /* TOOLS FOR PLATFORM ADMIN ONLY */ if (api_is_platform_admin() && api_is_allowed_to_edit(null, true) && !api_is_coach()) { $content .= "<tr>" . "<td colspan=\"6\">" . "<hr noshade size=\"1\" />" . "</td>" . "</tr>\n" . "<tr>\n" . "<td colspan=\"6\">\n" . "<font color=\"#F66105\" >" . get_lang('PlatformAdminOnly') . "</font>\n" . "</td>\n" . "</tr>\n"; $content .= "<tr>\n<td colspan=\"6\">"; $content .= CourseHome::show_tool_3column('platformAdmin'); $content .= "</td>\n</tr>\n"; } $content .= "</table>\n";
} else { $my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW); if (count($my_list) > 0) { $content .= '<div class="course-student-view-activity-3col">'; //ordering by get_lang name $order_tool_list = array(); foreach ($my_list as $key => $new_tool) { $tool_name = CourseHome::translate_tool_name($new_tool); $order_tool_list[$key] = $tool_name; } natsort($order_tool_list); $my_temp_tool_array = array(); foreach ($order_tool_list as $key => $new_tool) { $my_temp_tool_array[] = $my_list[$key]; } $my_list = $my_temp_tool_array; $i = 0; foreach ($my_list as $new_tool) { if ($i >= 10) { $my_list2[] = $new_tool; } else { $my_list1[] = $new_tool; } $i++; } $content .= CourseHome::show_tools_category($my_list1); $content .= CourseHome::show_tools_category($my_list2); $content .= '</div>'; } } $content .= '</div>';
/** * @param string $tool * @param array $toolList * * @return null */ public static function return_introduction_section($tool, $toolList = array()) { $urlGenerator = Container::getRouter(); $is_allowed_to_edit = api_is_allowed_to_edit(); $courseInfo = api_get_course_info(); $introduction_section = null; if (api_get_setting('course.enable_tool_introduction') == 'true' || $tool == TOOL_COURSE_HOMEPAGE) { $introduction_section = null; $TBL_INTRODUCTION = Database::get_course_table(TABLE_TOOL_INTRO); $session_id = api_get_session_id(); $course_id = api_get_course_int_id(); /* Retrieves the module introduction text, if exist */ $sql = "SELECT iid, intro_text FROM {$TBL_INTRODUCTION}\n WHERE\n c_id = {$course_id} AND\n tool ='" . Database::escape_string($tool) . "' AND\n session_id = '" . intval($session_id) . "'"; $intro_dbQuery = Database::query($sql); $introContent = null; $toolId = null; if (Database::num_rows($intro_dbQuery) > 0) { $row = Database::fetch_array($intro_dbQuery); $introContent = $row['intro_text']; $toolId = $row['iid']; } $introContent = CourseHome::replaceTextWithToolUrls($introContent, $toolList); /* Determines the correct display */ $displayIntro = false; if ($is_allowed_to_edit) { $displayIntro = true; } $thematicDescription = ''; if ($tool == TOOL_COURSE_HOMEPAGE) { $thematic = new Thematic($courseInfo); $thematic->set_course_int_id(api_get_course_int_id()); if (api_get_course_setting('display_info_advance_inside_homecourse') == '1') { $information_title = get_lang('InfoAboutLastDoneAdvance'); $last_done_advance = $thematic->get_last_done_thematic_advance(); $thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance); } else { if (api_get_course_setting('display_info_advance_inside_homecourse') == '2') { $information_title = get_lang('InfoAboutNextAdvanceNotDone'); $next_advance_not_done = $thematic->get_next_thematic_advance_not_done(); $thematic_advance_info = $thematic->get_thematic_advance_list($next_advance_not_done); } else { if (api_get_course_setting('display_info_advance_inside_homecourse') == '3') { $information_title = get_lang('InfoAboutLastDoneAdvanceAndNextAdvanceNotDone'); $last_done_advance = $thematic->get_last_done_thematic_advance(); $next_advance_not_done = $thematic->get_next_thematic_advance_not_done(); $thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance); $thematic_advance_info2 = $thematic->get_thematic_advance_list($next_advance_not_done); } } } if (!empty($thematic_advance_info)) { $thematic_advance = get_lang('CourseThematicAdvance') . ' ' . $thematic->get_total_average_of_thematic_advances() . '%'; $thematic_info = $thematic->get_thematic_list($thematic_advance_info['thematic_id']); $thematic_advance_info['start_date'] = api_get_local_time($thematic_advance_info['start_date']); $thematic_advance_info['start_date'] = api_format_date($thematic_advance_info['start_date'], DATE_TIME_FORMAT_LONG); $thematicDescription = '<div class="thematic-postit"> <div class="thematic-postit-top"><h3><a class="thematic-postit-head" style="" href="#"> ' . $thematic_advance . '</h3></a></div> <div class="thematic-postit-center" style="display:none">'; $thematicDescription .= '<div><strong>' . $thematic_info['title'] . '</strong></div>'; $thematicDescription .= '<div style="font-size:8pt;"><strong>' . $thematic_advance_info['start_date'] . '</strong></div>'; $thematicDescription .= '<div>' . $thematic_advance_info['content'] . '</div>'; $thematicDescription .= '<div>' . get_lang('DurationInHours') . ' : ' . $thematic_advance_info['duration'] . '</div>'; if (!empty($thematic_advance_info2)) { $thematic_info2 = $thematic->get_thematic_list($thematic_advance_info2['thematic_id']); $thematic_advance_info2['start_date'] = api_get_local_time($thematic_advance_info2['start_date']); $thematic_advance_info2['start_date'] = api_format_date($thematic_advance_info2['start_date'], DATE_TIME_FORMAT_LONG); $thematicDescription .= '<div><strong>' . $thematic_info2['title'] . '</strong></div>'; $thematicDescription .= '<div style="font-size:8pt;"><strong>' . $thematic_advance_info2['start_date'] . '</strong></div>'; $thematicDescription .= '<div>' . $thematic_advance_info2['content'] . '</div>'; $thematicDescription .= '<div>' . get_lang('DurationInHours') . ' : ' . $thematic_advance_info2['duration'] . '</div>'; $thematicDescription .= '<br />'; } $thematicDescription .= '</div> <div class="thematic-postit-bottom"></div> </div>'; } } $introduction_section .= '<div id="introduction_block" class="row"><div class="col-md-12">'; $introduction_section .= $thematicDescription; if (!empty($introContent)) { $introduction_section .= $introContent; } $introduction_section .= '</div>'; if ($displayIntro) { if (empty($introContent)) { // Displays "Add intro" commands $introduction_section .= '<div id="introduction_block_action" class="col-md-2 col-md-offset-10">'; $em = Database::getManager(); $criteria = ['tool' => $tool, 'cId' => api_get_course_int_id()]; $toolIntro = $em->getRepository('ChamiloCourseBundle:CToolIntro')->findOneBy($criteria); if ($toolIntro) { $url = $urlGenerator->generate('chamilo_course_ctoolintro_update', array('tool' => $toolIntro->getTool(), 'course' => api_get_course_id(), 'iid' => $toolIntro->getId())); } else { $url = $urlGenerator->generate('chamilo_course_ctoolintro_create', array('tool' => $tool, 'course' => api_get_course_id())); } $introduction_section .= "<a href=\"" . $url . "?" . api_get_cidreq() . "\">"; $introduction_section .= Display::return_icon('introduction_add.gif', get_lang('AddIntro')) . ' '; $introduction_section .= "</a>"; $introduction_section .= "</div>"; } else { // Displays "edit intro && delete intro" commands $introduction_section .= '<div id="introduction_block_action" class="col-md-2 col-md-offset-10">'; $url = $urlGenerator->generate('chamilo_course_ctoolintro_update', array('tool' => $tool, 'iid' => $toolId, 'course' => api_get_course_id())); $introduction_section .= "<a href=\"" . $url . "?" . api_get_cidreq() . "\">"; $introduction_section .= Display::return_icon('edit.png', get_lang('Modify')) . ' '; $introduction_section .= "</a>"; $url = $urlGenerator->generate('chamilo_course_ctoolintro_delete', array('iid' => $toolId, 'course' => api_get_course_id())); $introduction_section .= "<a onclick=\"javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'))) . "')) return false;\" href=\"" . $url . "?" . api_get_cidreq() . "\">"; $introduction_section .= Display::return_icon('delete.png', get_lang('AddIntro')) . ' '; $introduction_section .= "</a>"; $introduction_section .= "</div>"; } } $introduction_section .= '</div>'; } return $introduction_section; /*$moduleId = $tool; if (api_get_setting('course.enable_tool_introduction') == 'true' || $tool == TOOL_COURSE_HOMEPAGE ) { $introduction_section = null; require api_get_path(INCLUDE_PATH).'introductionSection.inc.php'; return $introduction_section; }*/ }
$tool_info = api_get_tool_information($_GET["id"]); $tool_visibility = $tool_info['visibility']; $tool_image = $tool_info['image']; if (api_get_setting('homepage_view') != 'activity_big') { $new_image = Display::return_icon(str_replace('.gif', '_na.gif', $tool_image), null, null, null, null, true); $tool_image = Display::return_icon($tool_image, null, null, null, null, true); } else { $tool_image = $tool_info['image']; $tool_image = substr($tool_info['image'], 0, strpos($tool_info['image'], '.')) . '.png'; $new_image = str_replace('.png', '_na.png', $tool_image); $new_image = api_get_path(WEB_IMG_PATH) . 'icons/64/' . $new_image; $tool_image = api_get_path(WEB_IMG_PATH) . 'icons/64/' . $tool_image; if (!empty($tool_info['custom_icon'])) { $tool_image = CourseHome::getCustomIconPath($courseInfo) . $tool_info['custom_icon']; $new_image = str_replace('.png', '_na.png', $tool_info['custom_icon']); $new_image = CourseHome::getCustomIconPath($courseInfo) . $new_image; } } $requested_image = $tool_visibility == 0 ? $tool_image : $new_image; $requested_clase = $tool_visibility == 0 ? 'visible' : 'invisible'; $requested_message = $tool_visibility == 0 ? 'is_active' : 'is_inactive'; $requested_view = $tool_visibility == 0 ? 'visible.gif' : 'invisible.gif'; $requested_visible = $tool_visibility == 0 ? 1 : 0; $requested_view = $tool_visibility == 0 ? 'visible.gif' : 'invisible.gif'; $requested_visible = $tool_visibility == 0 ? 1 : 0; //HIDE AND REACTIVATE TOOL if ($_GET["id"] == strval(intval($_GET["id"]))) { /* -- session condition for visibility if (!empty($session_id)) { $sql = "select session_id FROM $tool_table WHERE id='".$_GET["id"]."' AND session_id = '$session_id'"; $rs = Database::query($sql);
$content = $form->returnForm(); if ($form->validate()) { $data = $form->getSubmitValues(); CourseHome::updateTool($id, $data); Display::addFlash(Display::return_message(get_lang('Updated'))); if (isset($data['delete_icon'])) { CourseHome::deleteIcon($id); } $currentUrlReturn = api_get_self() . '?' . api_get_cidreq(); header('Location: ' . $currentUrlReturn); exit; } break; case 'list': default: $toolList = CourseHome::toolsIconsAction(api_get_course_int_id(), api_get_session_id()); $iconsTools = '<div id="custom-icons">'; $iconsTools .= Display::page_header(get_lang('CustomizeIcons'), null, 'h4'); $iconsTools .= '<div class="row">'; foreach ($toolList as $tool) { $toolIconName = 'Tool' . api_underscore_to_camel_case($tool['name']); $toolIconName = isset(${$toolIconName}) ? get_lang($toolIconName) : $tool['name']; $iconsTools .= '<div class="col-md-2">'; $iconsTools .= '<div class="items-tools">'; if (!empty($tool['custom_icon'])) { $image = getCustomWebIconPath() . $tool['custom_icon']; $icon = Display::img($image, $toolIconName); } else { $image = substr($tool['image'], 0, strpos($tool['image'], '.')) . '.png'; $icon = Display::return_icon($image, $toolIconName, array('id' => 'tool_' . $tool['id']), ICON_SIZE_BIG, false); }
/** * * @param $url * @param string * @return \FormValidator */ private function getForm($url, $tool) { $toolbar_set = 'IntroductionTool'; $width = '100%'; $height = '300'; $editor_config = array('ToolbarSet' => $toolbar_set, 'Width' => $width, 'Height' => $height); $form = new \FormValidator('form', 'post', $url); $form->add_html_editor('content', null, null, false, $editor_config); if ($tool == 'course_homepage') { $form->addElement('label', get_lang('YouCanUseAllTheseTags'), '((' . implode(')) <br /> ((', \CourseHome::availableTools()) . '))'); } $form->addElement('button', 'submit', get_lang('SaveIntroText')); return $form; }
/** * Sets the header visibility * @param bool true if we show the header */ public function setHeader($status) { $this->show_header = $status; $this->assign('show_header', $status); //Toolbar $show_admin_toolbar = api_get_setting('display.show_admin_toolbar'); $show_toolbar = 0; switch ($show_admin_toolbar) { case 'do_not_show': break; case 'show_to_admin': if (api_is_platform_admin()) { $show_toolbar = 1; } break; case 'show_to_admin_and_teachers': if (api_is_platform_admin() || api_is_allowed_to_edit()) { $show_toolbar = 1; } break; case 'show_to_all': $show_toolbar = 1; break; } $this->assign('show_toolbar', $show_toolbar); //Only if course is available $show_course_shortcut = null; $show_course_navigation_menu = null; if (!empty($this->course_id) && $this->user_is_logged_in) { if (api_get_setting('course.show_tool_shortcuts') != 'false') { //Course toolbar $show_course_shortcut = CourseHome::show_navigation_tool_shortcuts(); } if (api_get_setting('course.show_navigation_menu') != 'false') { //Course toolbar $show_course_navigation_menu = CourseHome::show_navigation_menu(); } } $this->assign('show_course_shortcut', $show_course_shortcut); $this->assign('show_course_navigation_menu', $show_course_navigation_menu); }
$result = CourseHome::show_tools_category($urlGenerator, $list); $content .= return_block(get_lang('Authoring'), $result['content']); $totalList = $result['tool_list']; $list = CourseHome::get_tools_category(TOOL_INTERACTION); $list2 = CourseHome::get_tools_category(TOOL_COURSE_PLUGIN); $list = array_merge($list, $list2); $result = CourseHome::show_tools_category($urlGenerator, $list); $totalList = array_merge($totalList, $result['tool_list']); $content .= return_block(get_lang('Interaction'), $result['content']); $list = CourseHome::get_tools_category(TOOL_ADMIN_PLATFORM); $totalList = array_merge($totalList, $list); $result = CourseHome::show_tools_category($urlGenerator, $list); $totalList = array_merge($totalList, $result['tool_list']); $content .= return_block(get_lang('Administration'), $result['content']); } elseif (api_is_coach()) { $content .= '<div class="row">'; $list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW); $content .= CourseHome::show_tools_category($urlGenerator, $result['content']); $totalList = array_merge($totalList, $result['tool_list']); $content .= '</div>'; } else { $list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW); if (count($list) > 0) { $content .= '<div class="row">'; $result = CourseHome::show_tools_category($urlGenerator, $list); $content .= $result['content']; $totalList = array_merge($totalList, $result['tool_list']); $content .= '</div>'; } } return array('content' => $content, 'tool_list' => $totalList);