public function __construct() { $this->courseCode = claro_get_current_course_id(); $this->courseId = ClaroCourse::getIdFromCode($this->courseCode); $this->userId = claro_get_current_user_id(); $this->profileId = claro_get_current_user_profile_id_in_course(); $this->viewMode = claro_get_tool_view_mode(); $this->courseObject = new ClaroCourse(); $this->courseObject->load($this->courseCode); $this->currentCourseContext = Claro_Context::getUrlContext(array(CLARO_CONTEXT_COURSE => $this->courseCode)); $this->template = new CoreTemplate('coursetoollist.tpl.php'); }
} // Language initialisation of the tool names $toolNameList = claro_get_tool_name_list(); // Get tool id where new events have been recorded since last login if (claro_is_user_authenticated()) { $date = $claro_notifier->get_notification_date(claro_get_current_user_id()); $modified_tools = $claro_notifier->get_notified_tools(claro_get_current_course_id(), $date, claro_get_current_user_id()); } else { $modified_tools = array(); } /** * TOOL LIST */ $is_allowedToEdit = claro_is_allowed_to_edit(); // Fetch the portlets $portletiterator = new CourseHomePagePortletIterator(ClaroCourse::getIdFromCode($cidReq)); // Fetch the session courses (if any) if (ClaroCourse::isSourceCourse($thisCourse->id)) { $sessionCourses = $thisCourse->getSessionCourses(); } else { $sessionCourses = array(); } // Notices for course managers if (claro_is_allowed_to_edit()) { if ($thisCourse->status == 'pending') { $dialogBox->warning(get_lang('This course is deactivated: you can reactive it from your course list')); } elseif ($thisCourse->status == 'date') { if (!empty($thisCourse->publicationDate) && $thisCourse->publicationDate > claro_mktime()) { $dialogBox->warning(get_lang('This course will be enabled on the %date', array('%date' => claro_date('d/m/Y', $thisCourse->publicationDate)))); } if (!empty($thisCourse->expirationDate) && $thisCourse->expirationDate > claro_mktime()) {
?> <?php if (claro_is_allowed_to_edit() && !empty($this->activablePortlets)) { ?> <ul class="commandList"> <?php foreach ($this->activablePortlets as $portlet) { ?> <li> <a style="background-image: url(<?php echo get_icon_url('add'); ?> ); background-repeat: no-repeat; background-position: left center; padding-left: 20px;" href="<?php echo claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?portletCmd=exAdd&portletLabel=' . $portlet['label'])) . '&courseId=' . ClaroCourse::getIdFromCode(claro_get_current_course_id()); ?> "> <?php echo get_lang('Add a new portlet'); ?> : <?php echo get_lang($portlet['name']); ?> </a> </li> <?php } ?> </ul> <?php
if (!claro_is_user_authenticated()) { claro_disp_auth_form(); } if (!claro_is_platform_admin()) { claro_die(get_lang('Not allowed')); } // Initialisation of global variables and used libraries require_once get_path('incRepositorySys') . '/lib/admin.lib.inc.php'; require_once get_path('incRepositorySys') . '/lib/pager.lib.php'; require_once get_path('incRepositorySys') . '/lib/claroCourse.class.php'; // Check incoming data $offsetC = isset($_REQUEST['offsetC']) ? $_REQUEST['offsetC'] : '0'; $validCmdList = array('exDelete', 'rqDelete'); $cmd = isset($_REQUEST['cmd']) && in_array($_REQUEST['cmd'], $validCmdList) ? $_REQUEST['cmd'] : null; $courseCode = isset($_REQUEST['delCode']) ? $_REQUEST['delCode'] : null; $courseId = isset($_REQUEST['delCode']) ? ClaroCourse::getIdFromCode($_REQUEST['delCode']) : null; $resetFilter = (bool) (isset($_REQUEST['newsearch']) && 'yes' == $_REQUEST['newsearch']); $search = isset($_REQUEST['search']) ? $_REQUEST['search'] : ''; $validRefererList = array('clist'); $cfrom = isset($_REQUEST['cfrom']) && in_array($_REQUEST['cfrom'], $validRefererList) ? $_REQUEST['cfrom'] : null; $addToURL = ''; $do = null; // Javascript confirm pop up declaration JavascriptLanguage::getInstance()->addLangVar('Are you sure to delete %name ?'); JavascriptLoader::getInstance()->load('admin'); // Deal with interbreadcrumb ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb')); $nameTools = get_lang('Course list'); /** * USED SESSION VARIABLES *
/** * Return a list of activable portlets for the current course. * * @return array list of activable portlets */ public static function getActivablePortlets() { $courseCode = claro_get_current_course_id(); // Get table name $tbl_mdb_names = claro_sql_get_main_tbl(); $tbl_coursehomepage_portlet = $tbl_mdb_names['coursehomepage_portlet']; $tbl_rel_course_portlet = $tbl_mdb_names['rel_course_portlet']; // Get available portlets for the current course $sql = "SELECT `label`, `name`\n FROM `" . $tbl_coursehomepage_portlet . "`\n WHERE `label` NOT IN (\n SELECT CONCAT_WS(',', label)\n FROM `" . $tbl_rel_course_portlet . "`\n WHERE `courseId` = " . (int) ClaroCourse::getIdFromCode($courseCode) . "\n )\n ORDER BY `name` ASC"; $res = Claroline::getDatabase()->query($sql); if (!$res->isEmpty()) { return $res; } else { return array(); } }
/** * Render form * * @return mixed false or string with the html form */ public static function renderForm() { $courseCode = claro_get_current_course_id(); // Get table name $tbl_mdb_names = claro_sql_get_main_tbl(); $tbl_coursehomepage_portlet = $tbl_mdb_names['coursehomepage_portlet']; $tbl_rel_course_portlet = $tbl_mdb_names['rel_course_portlet']; // Get available portlets for the current course $sql = "SELECT `label`, `name`\n FROM `" . $tbl_coursehomepage_portlet . "`\n WHERE `label` NOT IN (\n SELECT CONCAT_WS(',', label)\n FROM `" . $tbl_rel_course_portlet . "`\n WHERE `courseId` = " . (int) ClaroCourse::getIdFromCode($courseCode) . "\n )\n ORDER BY `name` ASC"; $res = Claroline::getDatabase()->query($sql); $availablePortletList = ''; if (!$res->isEmpty()) { foreach ($res as $portlet) { $availablePortletList .= '<option value="' . $portlet['label'] . '">' . get_lang($portlet['name']) . '</option>'; } $availablePortletList = '<select id="portletLabel" name="portletLabel" />' . $availablePortletList . '</select>'; $out = '<form method="post" action="' . htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?portletCmd=exAdd')) . '" >' . "\n" . $availablePortletList . '<br/>' . "\n" . '<input type="hidden" name="courseId" value="' . ClaroCourse::getIdFromCode(claro_get_current_course_id()) . '" />' . '<input type="submit" value="' . get_lang('Ok') . '" />' . "\n" . claro_html_button(Url::Contextualize($_SERVER['PHP_SELF']), get_lang('Cancel')) . "\n" . '</form>'; return $out; } else { return false; } }