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


PHP Container::getRouter方法代码示例

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


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

示例1: setUserImageBlock

 /**
  * Returns an HTML block with the user picture (as a link in a <div>)
  * @param int User ID (if not provided, will use the user ID from session)
  * @return string HTML div with a link to the user's profile
  * @uses UserManager::get_user_pictur_path_by_id() to get the image path
  * @uses UserManager::get_picture_user() to get the details of the image in a specific format
  * @uses PageController::show_right_block() to include the image in a larger user block
  */
 public function setUserImageBlock($user_id = null)
 {
     if (empty($user_id)) {
         $user_id = api_get_user_id();
     }
     //Always show the user image
     $img_array = UserManager::get_user_picture_path_by_id($user_id, 'web', true, true);
     $no_image = false;
     if ($img_array['file'] == 'unknown.jpg') {
         $no_image = true;
     }
     $img_array = UserManager::get_picture_user($user_id, $img_array['file'], 100, USER_IMAGE_SIZE_ORIGINAL);
     $profile_content = null;
     if (api_get_setting('social.allow_social_tool') == 'true') {
         if (!$no_image) {
             $profile_content .= '<a style="text-align:center" href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php">
                                 <img src="' . $img_array['file'] . '"></a>';
         } else {
             $profile_content .= '<a style="text-align:center"  href="' . Container::getRouter()->generate('fos_user_profile_edit') . '">
                                 <img title="' . get_lang('EditProfile') . '" src="' . $img_array['file'] . '"></a>';
         }
     }
     if (!empty($profile_content)) {
         $this->show_right_block(null, null, 'user_image_block', array('content' => $profile_content));
     }
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:34,代码来源:PageController.php

示例2: isset

    } else {
        $token = Security::get_token();
        $form->addElement('hidden', 'sec_token');
        $form->setConstants(array('sec_token' => $token));
        $html .= $form->returnForm();
    }
    return $html;
}
$socialToolIsActive = isset($_GET['f']) && $_GET['f'] == 'social';
/* MAIN SECTION */
if ($socialToolIsActive) {
    $this_section = SECTION_SOCIAL;
    $interbreadcrumb[] = array('url' => api_get_path(WEB_PATH) . 'main/social/home.php', 'name' => get_lang('SocialNetwork'));
} else {
    $this_section = SECTION_MYPROFILE;
    $interbreadcrumb[] = array('url' => Container::getRouter()->generate('fos_user_profile_edit'), 'name' => get_lang('Profile'));
}
$group_id = isset($_REQUEST['group_id']) ? intval($_REQUEST['group_id']) : null;
$social_right_content = null;
if ($group_id != 0) {
    $social_right_content .= '<div class=actions>';
    $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/social/group_view.php?id=' . $group_id . '">' . Display::return_icon('back.png', api_xml_http_response_encode(get_lang('ComposeMessage'))) . '</a>';
    $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/messages/new_message.php?group_id=' . $group_id . '">' . Display::return_icon('message_new.png', api_xml_http_response_encode(get_lang('ComposeMessage'))) . '</a>';
    $social_right_content .= '</div>';
} else {
    if ($socialToolIsActive) {
    } else {
        $social_right_content .= '<div class=actions>';
        if (api_get_setting('social.allow_social_tool') == 'true' && api_get_setting('message.allow_message_tool') == 'true') {
            $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php">' . Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')) . '</a>';
        }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:new_message.php

示例3: array

/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
use Chamilo\CoreBundle\Framework\Container;
/**
 * Create skill form
 * @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
 * @package chamilo.admin
 */
$cidReset = true;
//require_once '../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
if (api_get_setting('skill.allow_skills_tool') != 'true') {
    api_not_allowed();
}
$interbreadcrumb[] = array('url' => Container::getRouter()->generate('administration'), "name" => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'skill_list.php', 'name' => get_lang('ManageSkills'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('CreateSkill'));
/* Process data */
$skillParentId = isset($_GET['parent']) ? intval($_GET['parent']) : 0;
$formDefaultValues = [];
$objSkill = new Skill();
$objGradebook = new Gradebook();
if ($skillParentId > 0) {
    $skillParentInfo = $objSkill->get_skill_info($skillParentId);
    $formDefaultValues = ['parent_id' => $skillParentInfo['id'], 'gradebook_id' => []];
    foreach ($skillParentInfo['gradebooks'] as $gradebook) {
        $formDefaultValues['gradebook_id'][] = intval($gradebook['id']);
    }
}
$allSkills = $objSkill->get_all();
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:skill_create.php

示例4: empty

    $course['exemplary_content']    = empty($course['exemplary_content']) ? false : true;
    $course['teachers']             = $course_teachers;
    //$course['user_id']              = $teacher_id;
    $course['wanted_code']          = $course['visual_code'];
    $course['gradebook_model_id']   = isset($course['gradebook_model_id']) ? $course['gradebook_model_id'] : null;
    // Fixing category code
    $course['course_category'] = $course['category_code'];
    $course_info = CourseManager::create_course($course);

    header('Location: course_list.php'.($course_info===false?'?action=show_msg&warn='.api_get_last_failure():''));
    exit;
}*/
// Display the form.
$content = $form->return_form();
//echo $content;
$em = Container::getEntityManager();
$request = Container::getRequest();
$course = new Course();
$builder = Container::getFormFactory()->createBuilder(new CourseType(), $course);
$form = $builder->getForm();
$form->handleRequest($request);
if ($form->isValid()) {
    $course = $form->getData();
    $em->persist($course);
    $em->flush();
    Container::addFlash(get_lang('Updated'));
    $url = Container::getRouter()->generate('main', array('name' => 'admin/course_list.php'));
    header('Location: ' . $url);
    exit;
}
echo Container::getTemplate()->render('ChamiloCoreBundle:Legacy:form.html.twig', array('form' => $form->createView(), 'url' => api_get_self()));
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:course_add.php

示例5: array

/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container;
/**
*	Index of the admin tools
*
*	@package chamilo.admin
*/
// resetting the course id
$cidReset = true;
// setting the section (for the tabs)
$this_section = SECTION_PLATFORM_ADMIN;
// Access restrictions
api_protect_admin_script(true);
$nameTools = get_lang('PlatformAdmin');
// setting breadcrumbs
$interbreadcrumb[] = array('url' => Container::getRouter()->generate('administration'), "name" => $nameTools);
// setting the name of the tool
$nameTools = get_lang('DataFiller');
$output = array();
if (!empty($_GET['fill'])) {
    switch ($_GET['fill']) {
        case 'users':
            require api_get_path(SYS_TEST_PATH) . 'datafiller/fill_users.php';
            $output = fill_users();
            break;
        case 'courses':
            require api_get_path(SYS_TEST_PATH) . 'datafiller/fill_courses.php';
            $output = fill_courses();
            break;
        default:
            break;
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:filler.php

示例6: check_session_name

            header('Location: add_courses_to_session.php?id_session=' . $session_id . '&add=true&msg=');
            exit;
        }
    }
}
function check_session_name($name)
{
    $session = SessionManager::get_session_by_name($name);
    return empty($session) ? true : false;
}
Display::display_header($tool_name);
echo '<div class="actions">';
echo '<a href="' . api_get_path(WEB_CODE_PATH) . 'session/session_list.php">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('PlatformAdmin'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '</div>';
$em = Container::getEntityManager();
$request = Container::getRequest();
$session = new Session();
if (!empty($id)) {
    $session = $em->getRepository('ChamiloCoreBundle:Session')->find($id);
}
$builder = Container::getFormFactory()->createBuilder(new SessionType(), $session);
$form = $builder->getForm();
$form->handleRequest($request);
if ($form->isValid()) {
    $em->flush();
    Container::addFlash(get_lang('Updated'));
    $url = Container::getRouter()->generate('main', array('name' => 'session/session_list.php'));
    header('Location: ' . $url);
    exit;
}
echo Container::getTemplate()->render('ChamiloCoreBundle:Legacy:form.html.twig', array('form' => $form->createView(), 'url' => $urlAction));
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:session_add.php

示例7: return_user_image_block

 /**
  * @return null|string
  */
 public function return_user_image_block()
 {
     $html = null;
     if (!api_is_anonymous()) {
         $userPicture = UserManager::getUserPicture(api_get_user_id());
         $content = null;
         if (api_get_setting('social.allow_social_tool') == 'true') {
             $content .= '<a style="text-align:center" href="' . api_get_path(WEB_PATH) . 'main/social/home.php">
             <img class="img-circle" src="' . $userPicture . '" ></a>';
         } else {
             $edit = Container::getRouter()->generate('fos_user_profile_edit');
             $content .= '<a style="text-align:center" href="' . $edit . '">
             <img class="img-circle" title="' . get_lang('EditProfile') . '" src="' . $userPicture . '" ></a>';
         }
         $html = self::show_right_block(null, $content, 'user_image_block', array('style' => 'text-align:center;'));
     }
     return $html;
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:21,代码来源:userportal.lib.php

示例8: formatContent

 /**
  * Formats the content in order to add the welcome message,
  * the notification preference, etc
  * @param string $content
  * @param array	 $senderInfo result of api_get_user_info() or
  * GroupPortalManager:get_group_data()
  *
  * @return string
  * */
 public function formatContent($content, $senderInfo)
 {
     $hook = HookNotificationContent::create();
     if (!empty($hook)) {
         $hook->setEventData(array('content' => $content));
         $data = $hook->notifyNotificationContent(HOOK_EVENT_TYPE_PRE);
         if (isset($data['content'])) {
             $content = $data['content'];
         }
     }
     $newMessageText = $linkToNewMessage = '';
     switch ($this->type) {
         case self::NOTIFICATION_TYPE_DIRECT_MESSAGE:
             $newMessageText = '';
             $linkToNewMessage = Display::url(get_lang('SeeMessage'), api_get_path(WEB_CODE_PATH) . 'messages/inbox.php');
             break;
         case self::NOTIFICATION_TYPE_MESSAGE:
             if (!empty($senderInfo)) {
                 $senderName = api_get_person_name($senderInfo['firstname'], $senderInfo['lastname'], null, PERSON_NAME_EMAIL_ADDRESS);
                 $newMessageText = sprintf(get_lang('YouHaveANewMessageFromX'), $senderName);
             }
             $linkToNewMessage = Display::url(get_lang('SeeMessage'), api_get_path(WEB_CODE_PATH) . 'messages/inbox.php');
             break;
         case self::NOTIFICATION_TYPE_INVITATION:
             if (!empty($senderInfo)) {
                 $senderName = api_get_person_name($senderInfo['firstname'], $senderInfo['lastname'], null, PERSON_NAME_EMAIL_ADDRESS);
                 $newMessageText = sprintf(get_lang('YouHaveANewInvitationFromX'), $senderName);
             }
             $linkToNewMessage = Display::url(get_lang('SeeInvitation'), api_get_path(WEB_CODE_PATH) . 'social/invitations.php');
             break;
         case self::NOTIFICATION_TYPE_GROUP:
             $topic_page = intval($_REQUEST['topics_page_nr']);
             if (!empty($senderInfo)) {
                 $senderName = $senderInfo['group_info']['name'];
                 $newMessageText = sprintf(get_lang('YouHaveReceivedANewMessageInTheGroupX'), $senderName);
                 $senderName = api_get_person_name($senderInfo['user_info']['firstname'], $senderInfo['user_info']['lastname'], null, PERSON_NAME_EMAIL_ADDRESS);
                 $senderName = Display::url($senderName, api_get_path(WEB_CODE_PATH) . 'social/profile.php?' . $senderInfo['user_info']['user_id']);
                 $newMessageText .= '<br />' . get_lang('User') . ': ' . $senderName;
             }
             $group_url = api_get_path(WEB_CODE_PATH) . 'social/group_topics.php?id=' . $senderInfo['group_info']['id'] . '&topic_id=' . $senderInfo['group_info']['topic_id'] . '&msg_id=' . $senderInfo['group_info']['msg_id'] . '&topics_page_nr=' . $topic_page;
             $linkToNewMessage = Display::url(get_lang('SeeMessage'), $group_url);
             break;
     }
     $preference_url = Container::getRouter()->generate('fos_user_profile_edit');
     // You have received a new message text
     if (!empty($newMessageText)) {
         $content = $newMessageText . '<br /><hr><br />' . $content;
     }
     // See message with link text
     if (!empty($linkToNewMessage) && api_get_setting('message.allow_message_tool') == 'true') {
         $content = $content . '<br /><br />' . $linkToNewMessage;
     }
     // You have received this message because you are subscribed text
     $content = $content . '<br /><hr><i>' . sprintf(get_lang('YouHaveReceivedThisNotificationBecauseYouAreSubscribedOrInvolvedInItToChangeYourNotificationPreferencesPleaseClickHereX'), Display::url($preference_url, $preference_url)) . '</i>';
     if (!empty($hook)) {
         $hook->setEventData(array('content' => $content));
         $data = $hook->notifyNotificationContent(HOOK_EVENT_TYPE_POST);
         if (isset($data['content'])) {
             $content = $data['content'];
         }
     }
     return $content;
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:72,代码来源:notification.lib.php

示例9: return_introduction_section

 /**
  * @param string $tool
  * @param array $toolList
  *
  * @return null
  */
 public static function return_introduction_section($tool, $toolList = array())
 {
     $urlGenerator = Container::getRouter();
     $is_allowed_to_edit = api_is_allowed_to_edit();
     $courseInfo = api_get_course_info();
     $introduction_section = null;
     if (api_get_setting('course.enable_tool_introduction') == 'true' || $tool == TOOL_COURSE_HOMEPAGE) {
         $introduction_section = null;
         $TBL_INTRODUCTION = Database::get_course_table(TABLE_TOOL_INTRO);
         $session_id = api_get_session_id();
         $course_id = api_get_course_int_id();
         /* Retrieves the module introduction text, if exist */
         $sql = "SELECT iid, intro_text FROM {$TBL_INTRODUCTION}\n                    WHERE\n                        c_id = {$course_id} AND\n                        tool ='" . Database::escape_string($tool) . "' AND\n                        session_id = '" . intval($session_id) . "'";
         $intro_dbQuery = Database::query($sql);
         $introContent = null;
         $toolId = null;
         if (Database::num_rows($intro_dbQuery) > 0) {
             $row = Database::fetch_array($intro_dbQuery);
             $introContent = $row['intro_text'];
             $toolId = $row['iid'];
         }
         $introContent = CourseHome::replaceTextWithToolUrls($introContent, $toolList);
         /* Determines the correct display */
         $displayIntro = false;
         if ($is_allowed_to_edit) {
             $displayIntro = true;
         }
         $thematicDescription = '';
         if ($tool == TOOL_COURSE_HOMEPAGE) {
             $thematic = new Thematic($courseInfo);
             $thematic->set_course_int_id(api_get_course_int_id());
             if (api_get_course_setting('display_info_advance_inside_homecourse') == '1') {
                 $information_title = get_lang('InfoAboutLastDoneAdvance');
                 $last_done_advance = $thematic->get_last_done_thematic_advance();
                 $thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance);
             } else {
                 if (api_get_course_setting('display_info_advance_inside_homecourse') == '2') {
                     $information_title = get_lang('InfoAboutNextAdvanceNotDone');
                     $next_advance_not_done = $thematic->get_next_thematic_advance_not_done();
                     $thematic_advance_info = $thematic->get_thematic_advance_list($next_advance_not_done);
                 } else {
                     if (api_get_course_setting('display_info_advance_inside_homecourse') == '3') {
                         $information_title = get_lang('InfoAboutLastDoneAdvanceAndNextAdvanceNotDone');
                         $last_done_advance = $thematic->get_last_done_thematic_advance();
                         $next_advance_not_done = $thematic->get_next_thematic_advance_not_done();
                         $thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance);
                         $thematic_advance_info2 = $thematic->get_thematic_advance_list($next_advance_not_done);
                     }
                 }
             }
             if (!empty($thematic_advance_info)) {
                 $thematic_advance = get_lang('CourseThematicAdvance') . '&nbsp;' . $thematic->get_total_average_of_thematic_advances() . '%';
                 $thematic_info = $thematic->get_thematic_list($thematic_advance_info['thematic_id']);
                 $thematic_advance_info['start_date'] = api_get_local_time($thematic_advance_info['start_date']);
                 $thematic_advance_info['start_date'] = api_format_date($thematic_advance_info['start_date'], DATE_TIME_FORMAT_LONG);
                 $thematicDescription = '<div class="thematic-postit">
                                               <div class="thematic-postit-top"><h3><a class="thematic-postit-head" style="" href="#"> ' . $thematic_advance . '</h3></a></div>
                                               <div class="thematic-postit-center" style="display:none">';
                 $thematicDescription .= '<div><strong>' . $thematic_info['title'] . '</strong></div>';
                 $thematicDescription .= '<div style="font-size:8pt;"><strong>' . $thematic_advance_info['start_date'] . '</strong></div>';
                 $thematicDescription .= '<div>' . $thematic_advance_info['content'] . '</div>';
                 $thematicDescription .= '<div>' . get_lang('DurationInHours') . ' : ' . $thematic_advance_info['duration'] . '</div>';
                 if (!empty($thematic_advance_info2)) {
                     $thematic_info2 = $thematic->get_thematic_list($thematic_advance_info2['thematic_id']);
                     $thematic_advance_info2['start_date'] = api_get_local_time($thematic_advance_info2['start_date']);
                     $thematic_advance_info2['start_date'] = api_format_date($thematic_advance_info2['start_date'], DATE_TIME_FORMAT_LONG);
                     $thematicDescription .= '<div><strong>' . $thematic_info2['title'] . '</strong></div>';
                     $thematicDescription .= '<div style="font-size:8pt;"><strong>' . $thematic_advance_info2['start_date'] . '</strong></div>';
                     $thematicDescription .= '<div>' . $thematic_advance_info2['content'] . '</div>';
                     $thematicDescription .= '<div>' . get_lang('DurationInHours') . ' : ' . $thematic_advance_info2['duration'] . '</div>';
                     $thematicDescription .= '<br />';
                 }
                 $thematicDescription .= '</div>
                                           <div class="thematic-postit-bottom"></div>
                                           </div>';
             }
         }
         $introduction_section .= '<div id="introduction_block" class="row"><div class="col-md-12">';
         $introduction_section .= $thematicDescription;
         if (!empty($introContent)) {
             $introduction_section .= $introContent;
         }
         $introduction_section .= '</div>';
         if ($displayIntro) {
             if (empty($introContent)) {
                 // Displays "Add intro" commands
                 $introduction_section .= '<div id="introduction_block_action" class="col-md-2 col-md-offset-10">';
                 $em = Database::getManager();
                 $criteria = ['tool' => $tool, 'cId' => api_get_course_int_id()];
                 $toolIntro = $em->getRepository('ChamiloCourseBundle:CToolIntro')->findOneBy($criteria);
                 if ($toolIntro) {
                     $url = $urlGenerator->generate('chamilo_course_ctoolintro_update', array('tool' => $toolIntro->getTool(), 'course' => api_get_course_id(), 'iid' => $toolIntro->getId()));
                 } else {
                     $url = $urlGenerator->generate('chamilo_course_ctoolintro_create', array('tool' => $tool, 'course' => api_get_course_id()));
//.........这里部分代码省略.........
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:101,代码来源:display.lib.php

示例10: getProfileEditionLink

 /**
  * Get the profile edition link for a user
  * @param int $userId The user id
  * @param boolean $asAdmin Optional. Whether get the URL for the platform admin
  * @return string The link
  */
 public static function getProfileEditionLink($userId, $asAdmin = false)
 {
     $editProfileUrl = Container::getRouter()->generate('fos_user_profile_edit');
     if ($asAdmin) {
         $editProfileUrl = api_get_path(WEB_CODE_PATH) . "admin/user_edit.php?user_id=" . intval($userId);
     }
     return $editProfileUrl;
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:14,代码来源:display.lib.php

示例11: header

/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container;
/**
 * @package chamilo.social
 * @author Julio Montoya <gugli100@gmail.com>
 * @autor Alex Aragon <alex.aragon@beeznest.com> CSS Design and Template
 */
$cidReset = true;
$user_id = api_get_user_id();
$show_full_profile = true;
// social tab
$this_section = SECTION_SOCIAL;
unset($_SESSION['this_section']);
api_block_anonymous_users();
if (api_get_setting('social.allow_social_tool') != 'true') {
    $url = Container::getRouter()->generate('fos_user_profile_edit');
    header('Location: ' . $url);
    exit;
}
$userGroup = new UserGroup();
//fast upload image
if (api_get_setting_in_list('profile.changeable_options', 'picture') == 'true') {
    $form = new FormValidator('profile', 'post', 'home.php', null, array());
    //	PICTURE
    $form->addElement('file', 'picture', get_lang('AddImage'));
    $form->add_progress_bar();
    if (!empty($user_data['picture_uri'])) {
        $form->addElement('checkbox', 'remove_picture', null, get_lang('DelImage'));
    }
    $allowed_picture_types = api_get_supported_image_extensions();
    $form->addRule('picture', get_lang('OnlyImagesAllowed') . ' (' . implode(',', $allowed_picture_types) . ')', 'filetype', $allowed_picture_types);
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:home.php


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