public function __construct($courseId) { $this->courseId = $courseId; $courseCode = ClaroCourse::getCodeFromId($this->courseId); $tbl_mdb_names = claro_sql_get_main_tbl(); $tbl_rel_course_portlet = $tbl_mdb_names['rel_course_portlet']; $sql = "SELECT id, courseId, rank, label, visible\n FROM `{$tbl_rel_course_portlet}`\n WHERE `courseId` = {$this->courseId}\n ORDER BY `rank` ASC"; $result = Claroline::getDatabase()->query($sql); foreach ($result as $portletInfos) { // Require the proper portlet class $portletPath = get_module_path($portletInfos['label']) . '/connector/coursehomepage.cnr.php'; $portletName = $portletInfos['label'] . '_Portlet'; if (file_exists($portletPath)) { require_once $portletPath; } else { echo "Le fichier {$portletPath} est introuvable<br/>"; } if (class_exists($portletName)) { $portlet = new $portletName($portletInfos['id'], $courseCode, $portletInfos['courseId'], $portletInfos['rank'], $portletInfos['label'], $portletInfos['visible']); $this->portlets[] = $portlet; } else { echo "Can't find the class {$portletName}_portlet<br/>"; return false; } } }
public function current() { $portlet = $this->portlets->current(); $portletObj = ''; // Require the proper portlet class $portletPath = get_module_path($portlet['label']) . '/connector/coursehomepage.cnr.php'; $portletName = $portlet['label'] . '_Portlet'; if (file_exists($portletPath)) { require_once $portletPath; } else { throw new Exception("Can\\'t find the file %portletPath", array('%portletPath' => $portletPath)); } if (class_exists($portletName)) { $courseCode = ClaroCourse::getCodeFromId($this->courseId); $portletObj = new $portletName($portlet['id'], $courseCode, $portlet['courseId'], $portlet['rank'], $portlet['label'], $portlet['visible']); return $portletObj; } else { echo get_lang("Can't find the class %portletName_portlet", array('%portletName' => $portletName)); return false; } }
// Display the auth form if necessary // Also redirect if no cid specified if (!claro_is_in_a_course() || !claro_is_course_allowed()) { claro_disp_auth_form(true); } if (empty($cidReq)) { claro_die(get_lang('Cannot find course')); } // Fetch this course's portlets $portletiterator = new CourseHomePagePortletIterator(ClaroCourse::getIdFromCode($cidReq)); // Include specific CSS if any if (file_exists(get_conf('coursesRepositorySys') . $_course['path'] . '/css/course.css')) { $claroline->display->header->addHtmlHeader('<link rel="stylesheet" media="screen" type="text/css" href="' . get_path('url') . '/' . get_path('coursesRepositoryAppend') . $_course['path'] . '/css/course.css" />'); } // Instantiate course $thisCourse = new ClaroCourse(); $thisCourse->load($cidReq); include claro_get_conf_repository() . 'rss.conf.php'; // Include the course home page special CSS CssLoader::getInstance()->load('coursehomepage', 'all'); $toolRepository = get_path('clarolineRepositoryWeb'); claro_set_display_mode_available(true); // Manage portlets if (claro_is_course_manager() && !empty($portletClass)) { // Require the right class $portletPath = get_module_path($portletLabel) . '/connector/coursehomepage.cnr.php'; if (file_exists($portletPath)) { require_once $portletPath; } else { throw new Exception(get_lang('Cannot find this portlet')); }
?> <?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 ('clist' != $cfrom) { $addToURL .= '&offsetC=' . $offsetC; } $dialogBox = new DialogBox(); // Parse command if (!empty($courseCode)) { $courseToDelete = new ClaroCourse(); $courseToDelete->load($courseCode); } else { $courseToDelete = null; } if ('exDelete' == $cmd) { if (!is_null($courseToDelete)) { // Cannot delete a course if it has session courses if (!ClaroCourse::isSourceCourse($courseId)) { $do = 'delete'; } else { $dialogBox->error(get_lang('This course has session courses. You have to delete them before.')); } } else { switch (claro_failure::get_last_failure()) { case 'course_not_found': $dialogBox->error(get_lang('Course not found')); break; default: $dialogBox->error(get_lang('Course not found')); } } } elseif ('rqDelete' == $cmd) { if (!is_null($courseToDelete)) {
// $Id: index.php 12441 2010-06-11 14:34:16Z abourguignon $ /** * CLAROLINE * * @version 1.10 $Revision: 12441 $ * @copyright (c) 2001-2011, Universite catholique de Louvain (UCL) * @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE * @package CLHOME * @author Claro Team <*****@*****.**> */ require '../inc/claro_init_global.inc.php'; require_once get_path('incRepositorySys') . '/lib/claroCourse.class.php'; include claro_get_conf_repository() . 'rss.conf.php'; $cid = isset($_REQUEST['cid']) ? $_REQUEST['cid'] : ''; $nameTools = get_lang('Manage session courses'); if (!claro_is_in_a_course() || !claro_is_course_allowed()) { claro_disp_auth_form(true); } $toolRepository = get_path('clarolineRepositoryWeb'); claro_set_display_mode_available(TRUE); if (!empty($cid)) { $course = new ClaroCourse(); $course->load(ClaroCourse::getCodeFromId($cid)); } $sessionCourses = $course->getSessionCourses(); // Display header $template = new CoreTemplate('session_courses.tpl.php'); $template->assign('sessionCourses', $sessionCourses); $template->assign('courseId', $course->id); $claroline->display->body->setContent($template->render()); echo $claroline->display->render();
/** * 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(); } }
protected function getManagerLinkList() { $courseManageToolLinkList = array(); if ($this->viewMode != 'STUDENT') { $courseManageToolLinkList[] = '<a class="claroCmd" href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'course/tools.php', $this->currentCourseContext)) . '">' . '<img src="' . get_icon_url('edit') . '" alt="" /> ' . get_lang('Edit Tool list') . '</a>'; $courseManageToolLinkList[] = '<a class="claroCmd" href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'course/settings.php', $this->currentCourseContext)) . '">' . '<img src="' . get_icon_url('settings') . '" alt="" /> ' . get_lang('Course settings') . '</a>'; if (!ClaroCourse::isSessionCourse($this->courseId) && claro_is_allowed_to_create_course() && (get_conf('courseSessionAllowed', true) || claro_is_platform_admin())) { $courseManageToolLinkList[] = '<a class="claroCmd" href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'course/create.php', array('course_sourceCourseId' => $this->courseId))) . '">' . '<img src="' . get_icon_url('duplicate') . '" alt="" /> ' . get_lang("Create a session course") . '</a>'; } if (get_conf('is_trackingEnabled')) { $courseManageToolLinkList[] = '<a class="claroCmd" href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'tracking/courseReport.php', $this->currentCourseContext)) . '">' . '<img src="' . get_icon_url('statistics') . '" alt="" /> ' . get_lang('Statistics') . '</a>'; } $extraManageToolList = get_course_manage_module_list(true); if ($extraManageToolList) { foreach ($extraManageToolList as $extraManageTool) { $courseManageToolLinkList[] = '<a class="claroCmd" href="' . claro_htmlspecialchars(Url::Contextualize(get_module_entry_url($extraManageTool['label']))) . '">' . '<img src="' . get_module_icon_url($extraManageTool['label'], $extraManageTool['icon'], 'settings') . '" alt="" /> ' . get_lang($extraManageTool['name']) . '</a>'; } } } return $courseManageToolLinkList; }
protected function changeValidation($pendingStatus) { if (!$this->isModifiable()) { throw new Exception("Cannot change user " . $this->privileges->getUserId() . " enrolment validation in course " . $this->privileges->getCourseId()); } $tbl_mdb_names = claro_sql_get_main_tbl(); $updated = Claroline::getDatabase()->exec("\n UPDATE \n `{$tbl_mdb_names['rel_course_user']}` AS rcu\n SET \n isPending = " . $pendingStatus . "\n WHERE \n `rcu`.`user_id` = " . Claroline::getDatabase()->escape($this->privileges->getUserId()) . "\n AND \n `code_cours` = " . Claroline::getDatabase()->quote($this->privileges->getCourseId())); if ($updated) { if ($this->course->sourceCourseId) { $sourceCourseRegistrationValidation = new self(ClaroCourse::getCodeFromId($this->course->sourceCourseId), $this->privileges->getUserId()); $sourceCourseRegistrationValidation->changeValidation($pendingStatus); } return true; } else { return false; } }
require_once get_path('incRepositorySys') . '/lib/sendmail.lib.php'; require_once get_path('incRepositorySys') . '/lib/claroCourse.class.php'; define('DISP_COURSE_CREATION_FORM', __LINE__); define('DISP_COURSE_CREATION_SUCCEED', __LINE__); define('DISP_COURSE_CREATION_FAILED', __LINE__); define('DISP_COURSE_CREATION_PROGRESS', __LINE__); $display = DISP_COURSE_CREATION_FORM; // default display $dialogBox = new DialogBox(); $cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : null; $adminContext = isset($_REQUEST['adminContext']) ? (bool) $_REQUEST['adminContext'] : null; // $sourceCourseId has a value only if we're about to create a session course; it's null otherwise $sourceCourseId = isset($_REQUEST['course_sourceCourseId']) ? (int) $_REQUEST['course_sourceCourseId'] : null; // New course object $thisUser = claro_get_current_user_data(); $course = new ClaroCourse($thisUser['firstName'], $thisUser['lastName'], $thisUser['mail']); if (!is_null($sourceCourseId)) { $course->sourceCourseId = $sourceCourseId; } if (!is_null($course->sourceCourseId) && !empty($course->sourceCourseId)) { $sourceCourse = new claroCourse(); $sourceCourse->load(claroCourse::getCodeFromId($course->sourceCourseId)); if ($sourceCourse->sourceCourseId) { claro_die(get_lang('You cannot create a course session from another course session')); } $course->categories = $sourceCourse->categories; } if ($adminContext && claro_is_platform_admin()) { // From admin, add param to form $course->addHtmlParam('adminContext', '1'); }
include claro_get_conf_repository() . 'course_main.conf.php'; require_once get_path('incRepositorySys') . '/lib/course.lib.inc.php'; require_once get_path('incRepositorySys') . '/lib/user.lib.php'; require_once get_path('incRepositorySys') . '/lib/fileManage.lib.php'; require_once get_path('incRepositorySys') . '/lib/form.lib.php'; require_once get_path('incRepositorySys') . '/lib/claroCourse.class.php'; // Initialisation define('DISP_COURSE_EDIT_FORM', __LINE__); define('DISP_COURSE_RQ_DELETE', __LINE__); $dialogBox = new DialogBox(); $cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : null; $adminContext = isset($_REQUEST['adminContext']) ? (bool) $_REQUEST['adminContext'] : null; $courseType = isset($_REQUEST['courseType']) ? $_REQUEST['courseType'] : null; $current_cid = null; $display = DISP_COURSE_EDIT_FORM; $course = new ClaroCourse(); // Initialise current course id // TODO cidToEdit would die. cidReq be the the only container to enter in a course context if ($adminContext && claro_is_platform_admin()) { // from admin if (isset($_REQUEST['cidToEdit'])) { $current_cid = trim($_REQUEST['cidToEdit']); } elseif (isset($_REQUEST['cidReq'])) { $current_cid = trim($_REQUEST['cidReq']); } // add param to form $course->addHtmlParam('adminContext', '1'); $course->addHtmlParam('cidToEdit', $current_cid); // Back url $backUrl = get_path('rootAdminWeb') . 'admin_courses.php'; } elseif (claro_is_in_a_course()) {
/** * 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; } }