/**
  * Return Session Catalogue rendered view
  * @param string $action
  * @param string $nameTools
  * @param array $limit
  */
 public function sessionsList($action, $nameTools, $limit = array())
 {
     $date = isset($_POST['date']) ? $_POST['date'] : date('Y-m-d');
     $hiddenLinks = isset($_GET['hidden_links']) ? intval($_GET['hidden_links']) == 1 : false;
     $limit = isset($limit) ? $limit : CourseCategoryManager::getLimitArray();
     $countSessions = $this->model->countSessions($date);
     $sessions = $this->model->browseSessions($date, $limit);
     $pageTotal = intval(ceil(intval($countSessions) / $limit['length']));
     // Do NOT show pagination if only one page or less
     $cataloguePagination = $pageTotal > 1 ? CourseCategoryManager::getCatalogPagination($limit['current'], $limit['length'], $pageTotal) : '';
     $sessionsBlocks = $this->getFormatedSessionsBlock($sessions);
     // Get session list catalogue URL
     //$sessionUrl = CourseCategoryManager::getCourseCategoryUrl(1, $limit['length'], null, 0, 'display_sessions');
     // Get session search catalogue URL
     $courseUrl = CourseCategoryManager::getCourseCategoryUrl(1, $limit['length'], null, 0, 'subscribe');
     $tpl = \Chamilo\CoreBundle\Framework\Container::getTwig();
     $tpl->addGlobal('show_courses', CoursesAndSessionsCatalog::showCourses());
     $tpl->addGlobal('show_sessions', CoursesAndSessionsCatalog::showSessions());
     $tpl->addGlobal('show_tutor', api_get_setting('session.show_session_coach') === 'true' ? true : false);
     $tpl->addGlobal('course_url', $courseUrl);
     $tpl->addGlobal('catalog_pagination', $cataloguePagination);
     $tpl->addGlobal('hidden_links', $hiddenLinks);
     $tpl->addGlobal('search_token', Security::get_token());
     $tpl->addGlobal('search_date', $date);
     $tpl->addGlobal('web_session_courses_ajax_url', api_get_path(WEB_AJAX_PATH) . 'course.ajax.php');
     $tpl->addGlobal('sessions', $sessionsBlocks);
     $tpl->addGlobal('already_subscribed_label', $this->getAlreadyRegisteredInSessionLabel());
     echo $tpl->render('@template_style/auth/session_catalog.html.twig');
 }
Example #2
0
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CoreBundle\Entity\SequenceResource;
/**
* Template (front controller in MVC pattern) used for distpaching
 * to the controllers depend on the current action
* @author Christian Fasanando <*****@*****.**> - Beeznest
* @package chamilo.auth
*/
// Delete the globals['_cid'], we don't need it here.
$cidReset = true;
// Flag forcing the 'current course' reset
// including files
//require_once '../inc/global.inc.php';
$ctok = Security::get_existing_token();
// Get Limit data
$limit = CourseCategoryManager::getLimitArray();
// Section for the tabs.
$this_section = SECTION_COURSES;
if (api_get_setting('course.course_catalog_published') !== 'true') {
    // Access rights: anonymous users can't do anything useful here.
    api_block_anonymous_users();
}
$user_can_view_page = false;
//For students
if (api_get_setting('display.allow_students_to_browse_courses') == 'false') {
    $user_can_view_page = false;
} else {
    $user_can_view_page = true;
}
//For teachers/admins
if (api_is_platform_admin() || api_is_course_admin() || api_is_allowed_to_create_course()) {