当前位置: 首页>>代码示例>>PHP>>正文


PHP CourseManager::is_special_course方法代码示例

本文整理汇总了PHP中CourseManager::is_special_course方法的典型用法代码示例。如果您正苦于以下问题:PHP CourseManager::is_special_course方法的具体用法?PHP CourseManager::is_special_course怎么用?PHP CourseManager::is_special_course使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CourseManager的用法示例。


在下文中一共展示了CourseManager::is_special_course方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: indexAction

 /**
  * @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());
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:63,代码来源:CourseHomeController.php

示例2: indexAction

 /**
  * @Route("/", name="course_home")
  * @Route("/index.php")
  * @Method({"GET"})
  * @return Response
  */
 public function indexAction(Request $request)
 {
     $course = $this->getCourse();
     $session = $this->getSession();
     // Already added in the listener.
     /*if (false === $this->isGranted('view', $course)) {
           throw new AccessDeniedException('Unauthorised access!');
       }*/
     $courseCode = $course->getId();
     $sessionId = api_get_session_id();
     $sessionHandler = $request->getSession();
     $coursesAlreadyVisited = $sessionHandler->get('coursesAlreadyVisited');
     $result = $this->autolaunch();
     $showAutoLaunchLpWarning = $result['show_autolaunch_lp_warning'];
     $showAutoLaunchExerciseWarning = $result['show_autolaunch_exercise_warning'];
     if ($showAutoLaunchLpWarning) {
         $this->addFlash('warning', 'TheLPAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificLP');
     }
     if ($showAutoLaunchExerciseWarning) {
         $this->addFlash('warning', 'TheExerciseAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificExercise');
     }
     if (true) {
         $editIcons = Display::url(Display::return_icon('edit.png'), $this->generateUrl('chamilo_course_home_home_iconlist', array('course' => api_get_course_id())));
     }
     // Course access events
     $dispatcher = $this->container->get('event_dispatcher');
     $dispatcher->dispatch('chamilo_course.course.access', new CourseAccess($this->getUser(), $course));
     if (!isset($coursesAlreadyVisited[$courseCode])) {
         $dispatcher = $this->container->get('event_dispatcher');
         if (empty($sessionId)) {
             $dispatcher->dispatch('chamilo_course.course.access', new CourseAccess($this->getUser(), $course));
         } else {
             $dispatcher->dispatch('chamilo_course.course.access', new SessionAccess($this->getUser(), $course, $session));
         }
         $coursesAlreadyVisited[$courseCode] = 1;
         $sessionHandler->set('coursesAlreadyVisited', $coursesAlreadyVisited);
     }
     $sessionHandler->remove('toolgroup');
     $sessionHandler->remove('_gid');
     $isSpecialCourse = \CourseManager::is_special_course($courseCode);
     if ($isSpecialCourse) {
         $user = $this->getUser();
         if (!empty($user)) {
             $userId = $this->getUser()->getId();
             $autoreg = $this->getRequest()->get('autoreg');
             if ($autoreg == 1) {
                 \CourseManager::subscribe_user($userId, $courseCode, STUDENT);
             }
         }
     }
     $homeView = api_get_setting('course.homepage_view');
     $homeView = 'activity_big';
     if ($homeView == 'activity' || $homeView == 'activity_big') {
         $result = $this->renderActivityView();
     } elseif ($homeView == '2column') {
         $result = $this->render2ColumnView();
     } elseif ($homeView == '3column') {
         $result = $this->render3ColumnView();
     } elseif ($homeView == 'vertical_activity') {
         $result = $this->renderVerticalActivityView();
     }
     $toolList = $result['tool_list'];
     $introduction = Display::return_introduction_section($this->get('router'), TOOL_COURSE_HOMEPAGE, $toolList);
     $sessionInfo = null;
     if (api_get_setting('session.show_session_data') == 'true' && $sessionId) {
         $sessionInfo = CourseHome::show_session_data($sessionId);
     }
     /*$response = $this->render(
                 'ChamiloCoreBundle:Tool:Home/index.html.twig',
                 array(
                     'session_info' => $sessionInfo,
                     'icons' => $result['content'],
                     'edit_icons' => $editIcons,
                     'introduction_text' => $introduction,
                     'exercise_warning' => null,
                     'lp_warning' => null
                 )
             );
     
             return new Response($response, 200, array());*/
     return $this->render('ChamiloCourseBundle:Home:index.html.twig', array('course' => $course, 'session_info' => $sessionInfo, 'icons' => $result['content'], 'edit_icons' => $editIcons, 'introduction_text' => $introduction, 'exercise_warning' => null, 'lp_warning' => null));
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:88,代码来源:HomeController.php

示例3: define

define('TOOL_AUTHORING', 'toolauthoring');
define('TOOL_INTERACTION', 'toolinteraction');
define('TOOL_COURSE_PLUGIN', 'toolcourseplugin');
//all plugins that can be enabled in courses
define('TOOL_ADMIN', 'tooladmin');
define('TOOL_ADMIN_PLATFORM', 'tooladminplatform');
define('TOOL_DRH', 'tool_drh');
define('TOOL_STUDENT_VIEW', 'toolstudentview');
define('TOOL_ADMIN_VISIBLE', 'tooladminvisible');
$user_id = api_get_user_id();
$course_code = api_get_course_id();
$show_message = '';
// Deleting group session
Session::erase('toolgroup');
Session::erase('_gid');
$is_speacialcourse = CourseManager::is_special_course($course_code);
if ($is_speacialcourse) {
    $autoreg = Security::remove_XSS($_GET['autoreg']);
    if ($autoreg == 1) {
        if (CourseManager::subscribe_user($user_id, $course_code, $status = STUDENT)) {
            Session::write('is_allowed_in_course', true);
        }
    }
}
if (isset($_GET['action']) && $_GET['action'] == 'subscribe') {
    if (Security::check_token('get')) {
        Security::clear_token();
        $auth = new Auth();
        $msg = $auth->subscribe_user($course_code);
        if (!empty($msg)) {
            $show_message .= Display::return_message(get_lang($msg));
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:course_home.php


注:本文中的CourseManager::is_special_course方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。