$template = new CoreTemplate('platform_index.tpl.php'); // Languages $template->assign('languages', get_language_to_display_list()); $template->assign('currentLanguage', language::current_language()); // Last user action $lastUserAction = isset($_SESSION['last_action']) && $_SESSION['last_action'] != '1970-01-01 00:00:00' ? $_SESSION['last_action'] : date('Y-m-d H:i:s'); $template->assign('lastUserAction', $lastUserAction); // Manage the search box and search results $searchBox = new CourseSearchBox($_SERVER['REQUEST_URI']); $template->assign('searchBox', $searchBox); if (claro_is_user_authenticated()) { // User course (activated and deactivated) lists and search results (if any) if (empty($_REQUEST['viewCategory'])) { $courseTreeView = CourseTreeNodeViewFactory::getUserCourseTreeView(claro_get_current_user_id()); } else { $courseTreeView = CourseTreeNodeViewFactory::getUserCategoryCourseTreeView(claro_get_current_user_id(), $_REQUEST['viewCategory']); } $template->assign('templateMyCourses', $courseTreeView); // User commands $userCommands = array(); $userCommands[] = '<a href="' . $_SERVER['PHP_SELF'] . '" class="userCommandsItem">' . '<img src="' . get_icon_url('mycourses') . '" alt="" /> ' . get_lang('My course list') . '</a>' . "\n"; // 'Create Course Site' command. Only available for teacher. if (claro_is_allowed_to_create_course()) { $userCommands[] = '<a href="claroline/course/create.php" class="userCommandsItem">' . '<img src="' . get_icon_url('courseadd') . '" alt="" /> ' . get_lang('Create a course site') . '</a>' . "\n"; } elseif ($GLOBALS['currentUser']->isCourseCreator) { $userCommands[] = '<span class="userCommandsItemDisabled">' . '<img src="' . get_icon_url('courseadd') . '" alt="" /> ' . get_lang('Create a course site') . '</span>' . "\n"; } if (get_conf('allowToSelfEnroll', true)) { $userCommands[] = '<a href="claroline/auth/courses.php?cmd=rqReg&categoryId=0" class="userCommandsItem">' . '<img src="' . get_icon_url('enroll') . '" alt="" /> ' . get_lang('Enrol on a new course') . '</a>' . "\n"; $userCommands[] = '<a href="claroline/auth/courses.php?cmd=rqUnreg" class="userCommandsItem">' . '<img src="' . get_icon_url('unenroll') . '" alt="" /> ' . get_lang('Remove course enrolment') . '</a>' . "\n"; }
/** * @return template object * @since 1.10 * @todo write a CategoryBrowserView class (implementing Display) */ public function getTemplate() { $currentCategory = $this->getCurrentCategorySettings(); $categoryList = $this->getSubCategoryList(); $navigationUrl = new Url($_SERVER['PHP_SELF'] . '#categoryContent'); /* * Build url param list * @todo find a better way to do that */ if (isset($_REQUEST['cmd'])) { $navigationUrl->addParam('cmd', $_REQUEST['cmd']); } if (isset($_REQUEST['fromAdmin'])) { $navigationUrl->addParam('fromAdmin', $_REQUEST['fromAdmin']); } if (isset($_REQUEST['uidToEdit'])) { $navigationUrl->addParam('uidToEdit', $_REQUEST['uidToEdit']); } if (isset($_REQUEST['asTeacher'])) { $navigationUrl->addParam('asTeacher', $_REQUEST['asTeacher']); } $courseTreeView = CourseTreeNodeViewFactory::getCategoryCourseTreeView($this->categoryId, $this->userId); $courseTreeView->setViewOptions($this->viewOptions); $template = new CoreTemplate('categorybrowser.tpl.php'); $template->assign('currentCategory', $currentCategory); $template->assign('categoryBrowser', $this); $template->assign('categoryList', $categoryList); $template->assign('courseTreeView', $courseTreeView); $template->assign('navigationUrl', $navigationUrl->toUrl()); return $template; }
protected function fetchResults() { $this->searchResults = CourseTreeNodeViewFactory::getSearchedCourseTreeView($this->keyword); }
$dialogBox->error($courseRegistration->getErrorMessage()); $dialogBox->info(get_lang('Please contact the course manager : %email', array('%email' => '<a href="mailto:' . $courseObj->email . '?body=' . $courseObj->officialCode . '&subject=[' . rawurlencode(get_conf('siteName')) . ']' . '">' . claro_htmlspecialchars($courseObj->titular) . '</a>'))); break; default: $displayMode = DISPLAY_MESSAGE_SCREEN; $dialogBox->warning($courseRegistration->getErrorMessage()); break; } } } // end if ($cmd == 'exReg') /*---------------------------------------------------------------------------- User course list to unregister ----------------------------------------------------------------------------*/ if ($cmd == 'rqUnreg') { $courseListView = CourseTreeNodeViewFactory::getUserCourseTreeView($userId); $unenrollUrl = Url::buildUrl($_SERVER['PHP_SELF'] . '?cmd=exUnreg', $urlParamList, null); $viewOptions = new CourseTreeViewOptions(false, true, null, $unenrollUrl->toUrl()); $courseListView->setViewOptions($viewOptions); $displayMode = DISPLAY_USER_COURSES; } // end if ($cmd == 'rqUnreg') /*---------------------------------------------------------------------------- Search a course to register ----------------------------------------------------------------------------*/ if ($cmd == 'rqReg') { // Set user id to null if we're working on a class $userId = $fromAdmin == 'class' ? null : $userId; // Build the category browser $categoryBrowser = new CategoryBrowser($categoryId, $userId); if ($fromAdmin == 'class') {