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


PHP api_block_anonymous_users函数代码示例

本文整理汇总了PHP中api_block_anonymous_users函数的典型用法代码示例。如果您正苦于以下问题:PHP api_block_anonymous_users函数的具体用法?PHP api_block_anonymous_users怎么用?PHP api_block_anonymous_users使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: indexAction

 /**
  * @param Application $app
  * @param string $type courses|sessions|mycoursecategories
  * @param string $filter for the userportal courses page. Only works when setting 'history'
  * @param int $page
  *
  * @return Response|void
  */
 public function indexAction(Application $app, $type = 'courses', $filter = 'current', $page = 1)
 {
     // @todo Use filters like "after/before|finish" to manage user access
     api_block_anonymous_users();
     // Abort request because the user is not allowed here - @todo use filters
     if ($app['allowed'] == false) {
         return $app->abort(403, 'Not allowed');
     }
     // Main courses and session list
     $items = null;
     $type = str_replace('/', '', $type);
     /** @var \PageController $pageController */
     $pageController = $app['page_controller'];
     switch ($type) {
         case 'sessions':
             $items = $pageController->returnSessions(api_get_user_id(), $filter, $page);
             break;
         case 'sessioncategories':
             $items = $pageController->returnSessionsCategories(api_get_user_id(), $filter, $page);
             break;
         case 'courses':
             $items = $pageController->returnCourses(api_get_user_id(), $filter, $page);
             break;
         case 'mycoursecategories':
             $items = $pageController->returnMyCourseCategories(api_get_user_id(), $filter, $page);
             break;
         case 'specialcourses':
             $items = $pageController->returnSpecialCourses(api_get_user_id(), $filter, $page);
             break;
     }
     //Show the chamilo mascot
     if (empty($items) && empty($filter)) {
         $pageController->return_welcome_to_course_block($app['template']);
     }
     /*
             $app['my_main_menu'] = function($app) {
                 $menu = $app['knp_menu.factory']->createItem('root');
                 $menu->addChild('Home', array('route' => api_get_path(WEB_CODE_PATH)));
                 return $menu;
             };
             $app['knp_menu.menus'] = array('main' => 'my_main_menu');*/
     $app['template']->assign('content', $items);
     $pageController->setCourseSessionMenu();
     $pageController->setProfileBlock();
     $pageController->setUserImageBlock();
     $pageController->setCourseBlock($filter);
     $pageController->setSessionBlock();
     $pageController->return_reservation_block();
     $pageController->returnNavigationLinks($app['template']->getNavigationLinks());
     $app['template']->assign('search_block', $pageController->return_search_block());
     $app['template']->assign('classes_block', $pageController->return_classes_block());
     $pageController->returnSkillsLinks();
     // Deleting the session_id.
     Session::erase('session_id');
     $response = $app['template']->render_template('userportal/index.tpl');
     return new Response($response, 200, array());
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:65,代码来源:UserPortalController.php

示例2: indexAction

 /**
  *
  * @Route("/")
  * @Method({"GET"})
  */
 public function indexAction()
 {
     // @todo Use filters like "after/before|finish" to manage user access
     api_block_anonymous_users();
     // Abort request because the user is not allowed here - @todo use filters
     if ($app['allowed'] == false) {
         return $app->abort(403, 'Not allowed');
     }
     $breadcrumbs = array(array('name' => get_lang('Curriculum'), 'url' => array()));
     $this->setBreadcrumb($breadcrumbs);
     $userId = $this->getUser()->getUserId();
     $qb = $this->getManager()->createQueryBuilder()->select('node, i, u')->from('Chamilo\\CoreBundle\\Entity\\CurriculumCategory', 'node')->innerJoin('node.course', 'c')->leftJoin('node.items', 'i')->leftJoin('i.userItems', 'u', 'WITH', 'u.userId = :userId OR u.userId IS NULL')->setParameter('userId', $userId)->orderBy('node.root, node.lft, node.title', 'ASC');
     $this->setCourseParameters($qb, 'node');
     $query = $qb->getQuery();
     $categories = $query->getResult();
     $formList = array();
     /** @var \Chamilo\CoreBundle\Entity\CurriculumCategory $category */
     foreach ($categories as $category) {
         /** @var \Chamilo\CoreBundle\Entity\CurriculumItem $item */
         foreach ($category->getItems() as $item) {
             $formType = new CurriculumItemRelUserCollectionType($item->getId());
             $count = count($item->getUserItems());
             // If there are no items for the user, then create a new one!
             if ($count == 0) {
                 $userItem = new CurriculumItemRelUser();
                 $userItem->setItemId($item->getId());
                 $userItemList = array($userItem);
                 $item->setUserItems($userItemList);
             }
             $form = $this->get('form.factory')->create($formType, $item);
             $formList[$item->getId()] = $form->createView();
         }
     }
     if (api_is_allowed_to_edit()) {
         $this->get('template')->assign('teacher_links', $categories);
     }
     $this->get('template')->assign('categories', $categories);
     $this->get('template')->assign('links', $this->generateLinks());
     $this->get('template')->assign('form_list', $formList);
     $this->get('template')->assign('isAllowed', api_is_allowed_to_edit(true, true, true));
     $response = $this->get('template')->render_template($this->getTemplatePath() . 'list.tpl');
     return new Response($response, 200, array());
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:48,代码来源:CurriculumUserController.php

示例3: unset

    $this_section = SECTION_COURSES;
} else {
    $_SESSION['gradebook_dest'] = 'gradebook.php';
    $this_section = SECTION_MYGRADEBOOK;
    unset($_GET['course']);
}
$htmlHeadXtra[] = '<script type="text/javascript">
$(document).ready( function() {
	for (i=0;i<$(".actions").length;i++) {
		if ($(".actions:eq("+i+")").html()=="<table border=\\"0\\"></table>" || $(".actions:eq("+i+")").html()=="" || $(".actions:eq("+i+")").html()==null) {
			$(".actions:eq("+i+")").hide();
		}
	}
 } );
 </script>';
api_block_anonymous_users();
$htmlHeadXtra[] = '<script type="text/javascript">
function confirmation ()
{
	if (confirm("' . get_lang('DeleteAll') . '?")) {
	    return true;
	} else {
	    return false;
	}
}
</script>';
$filter_confirm_msg = true;
$filter_warning_msg = true;
// ACTIONS
//this is called when there is no data for the course admin
if (isset($_GET['createallcategories'])) {
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:31,代码来源:gradebook.php

示例4: array

 */

use \ChamiloSession as Session;
$language_file = array('courses', 'index', 'admin', 'userInfo');
/* Flag forcing the 'current course' reset, as we're not inside a course anymore */
$cidReset = true;

// For HTML editor repository.
if (isset($_SESSION['this_section']))
	unset($_SESSION['this_section']);

/* Included libraries */
require_once './main/inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'userportal.lib.php';

api_block_anonymous_users(); // Only users who are logged in can proceed.

$user_id = api_get_user_id();

/* Constants and CONFIGURATION parameters */
$load_dirs = api_get_setting('show_documents_preview');

// Check if a user is enrolled only in one course for going directly to the course after the login.
if (api_get_setting('go_to_course_after_login') == 'true') {

	// Get the courses list
	$personal_course_list = UserManager::get_personal_session_course_list($user_id);

	$my_session_list = array();
	$count_of_courses_no_sessions = 0;
	$count_of_courses_with_sessions = 0;
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:user_portal.php


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