• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Framework\Container类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了Container类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: classicAction

 /**
  * @param string $name
  * @param Request $request
  * @return Response
  */
 public function classicAction($name, Request $request)
 {
     // get.
     $_GET = $request->query->all();
     // post.
     $_POST = $request->request->all();
     $rootDir = $this->get('kernel')->getRealRootDir();
     //$_REQUEST = $request->request->all();
     $mainPath = $rootDir . 'main/';
     $fileToLoad = $mainPath . $name;
     // Setting legacy values inside the container
     /** @var Connection $dbConnection */
     $dbConnection = $this->container->get('database_connection');
     $em = $this->get('kernel')->getContainer()->get('doctrine.orm.entity_manager');
     $database = new \Database($dbConnection, array());
     $database->setConnection($dbConnection);
     $database->setManager($em);
     Container::$container = $this->container;
     Container::$dataDir = $this->container->get('kernel')->getDataDir();
     Container::$courseDir = $this->container->get('kernel')->getDataDir();
     //Container::$configDir = $this->container->get('kernel')->getConfigDir();
     $this->container->get('twig')->addGlobal('api_get_cidreq', api_get_cidreq());
     //$breadcrumb = $this->container->get('chamilo_core.block.breadcrumb');
     if (is_file($fileToLoad) && \Security::check_abs_path($fileToLoad, $mainPath)) {
         // Files inside /main need this variables to be set
         $is_allowed_in_course = api_is_allowed_in_course();
         $is_courseAdmin = api_is_course_admin();
         $is_platformAdmin = api_is_platform_admin();
         $toolNameFromFile = basename(dirname($fileToLoad));
         $charset = 'UTF-8';
         // Default values
         $_course = api_get_course_info();
         $_user = api_get_user_info();
         $debug = $this->container->get('kernel')->getEnvironment() == 'dev' ? true : false;
         // Loading file
         ob_start();
         require_once $fileToLoad;
         $out = ob_get_contents();
         ob_end_clean();
         // No browser cache when executing an exercise.
         if ($name == 'exercice/exercise_submit.php') {
             $responseHeaders = array('cache-control' => 'no-store, no-cache, must-revalidate');
         }
         $js = isset($htmlHeadXtra) ? $htmlHeadXtra : array();
         // $interbreadcrumb is loaded in the require_once file.
         $interbreadcrumb = isset($interbreadcrumb) ? $interbreadcrumb : null;
         $template = Container::$legacyTemplate;
         $defaultLayout = 'layout_one_col.html.twig';
         if (!empty($template)) {
             $defaultLayout = $template;
         }
         return $this->render('ChamiloCoreBundle::' . $defaultLayout, array('legacy_breadcrumb' => $interbreadcrumb, 'content' => $out, 'js' => $js));
     } else {
         // Found does not exist
         throw new NotFoundHttpException();
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:62,代码来源:LegacyController.php


示例3: __construct

 /**
  * Class Constructor
  * @param string $name
  * @param string $elementLabel HTML editor  label
  * @param array  $attributes Attributes for the textarea
  * @param array  $config Optional configuration settings for the online editor.
  *
  */
 public function __construct($name = null, $elementLabel = null, $attributes = [], $config = [])
 {
     if (empty($name)) {
         return false;
     }
     parent::__construct($name, $elementLabel, $attributes);
     $this->_persistantFreeze = true;
     $this->_type = 'html_editor';
     $editor = Container::getHtmlEditor();
     if ($editor) {
         $this->editor = $editor;
         $this->editor->setName($name);
         $this->editor->processConfig($config);
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:23,代码来源:HtmlEditor.php


示例4: HTML_QuickForm_html_editor

 /**
  * Class constructor
  * @param string  HTML editor name/id
  * @param string  HTML editor  label
  * @param array  Attributes for the textarea
  * @param array $config	Optional configuration settings for the online editor.
  * @return bool
  */
 public function HTML_QuickForm_html_editor($name = null, $label = null, $attributes = null, $config = null)
 {
     if (empty($name)) {
         return false;
     }
     HTML_QuickForm_element::HTML_QuickForm_element($name, $label, $attributes);
     $this->_persistantFreeze = true;
     $this->_type = 'html_editor';
     global $fck_attribute;
     $editor = Container::getHtmlEditor();
     if ($editor) {
         $this->editor = $editor;
         $this->editor->setName($name);
         $this->editor->processConfig($fck_attribute);
         $this->editor->processConfig($config);
     }
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:25,代码来源:html_editor.php


示例5: array

 /**
  * Class constructor
  */
 function HTML_QuickForm_Select_Language($elementName = null, $elementLabel = null, $options = null, $attributes = null)
 {
     if (!isset($attributes['class'])) {
         $attributes['class'] = 'chzn-select';
     }
     parent::HTML_QuickForm_Select($elementName, $elementLabel, $options, $attributes);
     // Get all languages
     $languages = api_get_languages();
     $this->_options = array();
     $this->_values = array();
     $platformLanguage = Container::getTranslator()->getLocale();
     foreach ($languages as $language) {
         if ($language['isocode'] == $platformLanguage) {
             $this->addOption($language['english_name'], $language['isocode'], array('selected' => 'selected'));
         } else {
             $this->addOption($language['english_name'], $language['isocode']);
         }
     }
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:22,代码来源:select_language.php


示例6: array

$template->addGlobal('is_allowed_to_edit', $is_allowed_to_edit);
$template->addGlobal('gamification_mode', $gamificationMode);
$template->addGlobal('breadcrumb', $breadcrumb);
$template->addGlobal('button_home_url', $buttonHomeUrl);
$template->addGlobal('button_home_text', $buttonHomeText);
$template->addGlobal('navigation_bar', $navigation_bar);
$template->addGlobal('progress_bar', $progress_bar);
$template->addGlobal('show_audio_player', $show_audioplayer);
$template->addGlobal('media_player', $mediaplayer);
$template->addGlobal('toc_list', $get_toc_list);
$template->addGlobal('teacher_toc_buttons', $get_teacher_buttons);
$template->addGlobal('iframe_src', $src);
$template->addGlobal('navigation_bar_bottom', $navigation_bar_bottom);
if ($gamificationMode == 1) {
    $template->addGlobal('gamification_stars', $learnPath->getCalculateStars($sessionId));
    $template->addGlobal('gamification_points', $learnPath->getCalculateScore($sessionId));
}
$template->addGlobal('lp_preview_image', Display::img($lpPreviewImagePath, $learnPath->name, array('class' => 'img-circle'), ICON_SIZE_BIG));
$template->addGlobal('lp_author', $learnPath->get_author());
$template->addGlobal('lp_mode', $learnPath->mode);
$template->addGlobal('lp_title_scorm', $learnPath->name);
$template->addGlobal('lp_html_toc', $learnPath->get_html_toc($get_toc_list));
$template->addGlobal('lp_id', $learnPath->lp_id);
$template->addGlobal('lp_current_item_id', $learnPath->get_current_item_id());
$content = $template->render('@template_style/learnpath/view.html.twig');
echo $content;
// Restore a global setting.
$_setting['show_navigation_menu'] = $save_setting;
// Hide headers
Container::$legacyTemplate = 'layout_one_col_no_content.html.twig';
$learnPath->updateCurrentLpFromSession();
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:lp_view.php


示例7: array

    $text_after_registration .= $form_register->returnForm();
    // Just in case
    Session::erase('course_redirect');
    Session::erase('exercise_redirect');
    if (CustomPages::enabled()) {
        CustomPages::display(CustomPages::REGISTRATION_FEEDBACK, array('info' => $text_after_registration));
    } else {
        //$tpl = new Template($tool_name);
        echo Container::getTemplating()->render('@template_style/auth/inscription.html.twig', ['inscription_content' => $content, 'text_after_registration' => $text_after_registration, 'hide_header' => $hideHeaders]);
    }
} else {
    // Custom pages
    if (CustomPages::enabled()) {
        CustomPages::display(CustomPages::REGISTRATION, array('form' => $form));
    } else {
        if (!api_is_anonymous()) {
            // Saving user to course if it was set.
            if (!empty($course_code_redirect)) {
                $course_info = api_get_course_info($course_code_redirect);
                if (!empty($course_info)) {
                    if (in_array($course_info['visibility'], array(COURSE_VISIBILITY_OPEN_PLATFORM, COURSE_VISIBILITY_OPEN_WORLD))) {
                        CourseManager::subscribe_user($user_id, $course_info['code']);
                    }
                }
            }
            CourseManager::redirectToCourse([]);
        }
        //$tpl = new Template($tool_name);
        echo Container::getTemplating()->render('@template_style/auth/inscription.html.twig', ['inscription_header' => Display::page_header($tool_name), 'inscription_content' => $content, 'hide_header' => $hideHeaders, 'form', $form->returnForm()]);
    }
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:inscription.php


示例8: isset

    $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,代码行数:30,代码来源:course_add.php


示例9: Agenda

if (isset($_REQUEST['cidReq']) && !empty($_REQUEST['cidReq'])) {
    $type = 'course';
}
$agenda = new Agenda();
$agenda->type = $type;
$is_group_tutor = false;
$session_id = api_get_session_id();
$group_id = api_get_group_id();
if (!empty($group_id)) {
    $is_group_tutor = GroupManager::is_tutor_of_group(api_get_user_id(), $group_id);
    $group_properties = GroupManager::get_group_properties($group_id);
    $interbreadcrumb[] = array("url" => api_get_path(WEB_CODE_PATH) . "group/group.php?" . api_get_cidreq(), "name" => get_lang('Groups'));
    $interbreadcrumb[] = array("url" => api_get_path(WEB_CODE_PATH) . "group/group_space.php?" . api_get_cidreq(), "name" => get_lang('GroupSpace') . ' ' . $group_properties['name']);
}
$app['title'] = get_lang('Agenda');
$tpl = Container::getTwig();
$tpl->addGlobal('use_google_calendar', 0);
$can_add_events = 0;
switch ($type) {
    case 'admin':
        api_protect_admin_script();
        $this_section = SECTION_PLATFORM_ADMIN;
        if (api_is_platform_admin()) {
            $can_add_events = 1;
        }
        break;
    case 'course':
        api_protect_course_script(true);
        $this_section = SECTION_COURSES;
        if (api_is_allowed_to_edit()) {
            $can_add_events = 1;
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:agenda_js.php


示例10: isset

     }
     $courses_controller->sessionsList($action, $nameTools, $limit);
     break;
 case 'subscribe_to_session':
     if (!$user_can_view_page) {
         api_not_allowed(true);
     }
     $userId = api_get_user_id();
     $confirmed = isset($_GET['confirm']);
     $sessionId = intval($_GET['session_id']);
     if (empty($userId)) {
         api_not_allowed();
         exit;
     }
     if (!$confirmed) {
         echo Container::getTemplating()->render('@template_style/auth/confirm_session_subscription.html.twig', ['session_id' => $sessionId]);
         exit;
     }
     $registrationAllowed = api_get_setting('session.catalog_allow_session_auto_subscription');
     if ($registrationAllowed === 'true') {
         $entityManager = Database::getManager();
         $repository = $entityManager->getRepository('ChamiloCoreBundle:SequenceResource');
         $sequences = $repository->getRequirements($sessionId, SequenceResource::SESSION_TYPE);
         if (count($sequences) > 0) {
             $requirementsData = SequenceResourceManager::checkRequirementsForUser($sequences, SequenceResource::SESSION_TYPE, $userId);
             $continueWithSubscription = SequenceResourceManager::checkSequenceAreCompleted($requirementsData);
             if (!$continueWithSubscription) {
                 header('Location: ' . api_get_path(WEB_CODE_PATH) . 'auth/courses.php');
                 exit;
             }
         }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:courses.php


示例11: str_replace

 // Setting the extension
 $extension = 'html';
 $content = Security::remove_XSS($values['content'], COURSEMANAGERLOWSECURITY);
 /*if (strpos($content, '/css/frames.css') == false) {
 		$content = str_replace('</head>', '<link rel="stylesheet" href="./css/frames.css" type="text/css" /><style> body{margin:50px;}</style></head>', $content);
 	}*/
 // Don't create file with the same name.
 if (file_exists($filepath . $filename . '.' . $extension)) {
     Display::display_header($nameTools, 'Doc');
     Display::display_error_message(get_lang('FileExists') . ' ' . $title, false);
     Display::display_footer();
     exit;
 }
 if ($fp = @fopen($filepath . $filename . '.' . $extension, 'w')) {
     //$courseUrl = \Chamilo\CoreBundle\Framework\Container::getUrlGenerator()->generate('course_url').'/';
     $content = str_replace(api_get_path(WEB_COURSE_PATH), Container::getUrlAppend() . '/courses/', $content);
     fputs($fp, $content);
     fclose($fp);
     chmod($filepath . $filename . '.' . $extension, api_get_permissions_for_new_files());
     $file_size = filesize($filepath . $filename . '.' . $extension);
     $save_file_path = $dir . $filename . '.' . $extension;
     $document_id = add_document($_course, $save_file_path, 'file', $file_size, $title, null, $readonly);
     if ($document_id) {
         api_item_property_update($_course, TOOL_DOCUMENT, $document_id, 'DocumentAdded', $userId, $to_group_id, null, null, null, $current_session_id);
         // Update parent folders
         item_property_update_on_folder($_course, $dir, $userId);
         $new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : '';
         $new_title = isset($_POST['title']) ? trim($_POST['title']) : '';
         $new_title = htmlspecialchars($new_title);
         if ($new_comment || $new_title) {
             $ct = '';
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:create_document.php


示例12: getSkillBlock

 /**
  * Get HTML code block for user skills
  * @param int $userId The user ID
  * @return string
  */
 public static function getSkillBlock($userId)
 {
     if (api_get_setting('skill.allow_skills_tool') !== 'true') {
         return null;
     }
     $skill = new Skill();
     $ranking = $skill->get_user_skill_ranking($userId);
     $skills = $skill->get_user_skills($userId, true);
     return Container::getTemplating()->render('@template_style/social/skills_block.html.twig', ['ranking' => $ranking, 'skills' => $skills, 'user_id' => $userId, 'show_skills_report_link' => api_is_student() || api_is_student_boss() || api_is_drh()]);
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:15,代码来源:social.lib.php


示例13: 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


示例14: 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


示例15: switch

                } else {
                    // Update
                    $sequenceResource->getSequence()->setGraphAndSerialize($graph);
                }
                $em->persist($sequenceResource);
                $em->flush();
                echo Display::return_message(get_lang('Saved'), 'success');
                break;
        }
        break;
    case 'get_requirements':
        $userId = api_get_user_id();
        switch ($type) {
            case SequenceResource::SESSION_TYPE:
                $session = api_get_session_info($id);
                $sequences = $repository->getRequirements($session['id'], $type);
                if (count($sequences) === 0) {
                    break;
                }
                $sequenceList = SequenceResourceManager::checkRequirementsForUser($sequences, $type, $userId);
                $allowSubscription = SequenceResourceManager::checkSequenceAreCompleted($sequenceList);
                $courseController = new CoursesController();
                $subscribeButton = '';
                if ($allowSubscription) {
                    $subscribeButton = $courseController->getRegisteredInSessionButton($session['id'], $session['name'], false);
                }
                echo Container::getTemplating()->render('@template_style/sequence_resource/session_requirements.html.twig', ['sequences' => $sequenceList, 'allow_subscription' => $allowSubscription, 'subscribe_button' => $subscribeButton]);
                break;
        }
        break;
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:sequence.ajax.php


示例16: foreach

        }
    }
    $courses[] = ['course' => $sessionCourse, 'description' => $courseDescription, 'tags' => $courseTags, 'objectives' => $courseObjectives, 'topics' => $courseTopics, 'coaches' => $coachesData, 'extra_fields' => $courseValues->getAllValuesForAnItem($sessionCourse->getId())];
}
$sessionDates = SessionManager::parseSessionDates(['display_start_date' => $session->getDisplayStartDate(), 'display_end_date' => $session->getDisplayEndDate(), 'access_start_date' => $session->getAccessStartDate(), 'access_end_date' => $session->getAccessEndDate(), 'coach_access_start_date' => $session->getCoachAccessStartDate(), 'coach_access_end_date' => $session->getCoachAccessEndDate()]);
$sessionRequirements = $sequenceResourceRepo->getRequirements($session->getId(), SequenceResource::SESSION_TYPE);
$hasRequirements = false;
foreach ($sessionRequirements as $sequence) {
    if (!empty($sequence['requirements'])) {
        $hasRequirements = true;
        break;
    }
}
$courseController = new CoursesController();
/* View */
//$template = new Template($session->getName(), true, true, false, true, false);
$template = \Chamilo\CoreBundle\Framework\Container::getTwig();
$template->addGlobal('show_tutor', api_get_setting('session.show_session_coach') === 'true' ? true : false);
$template->addGlobal('pageUrl', api_get_path(WEB_PATH) . "session/{$session->getId()}/about/");
$template->addGlobal('session', $session);
$template->addGlobal('session_date', $sessionDates);
$template->addGlobal('is_subscribed', SessionManager::isUserSubscribedAsStudent($session->getId(), api_get_user_id()));
$template->addGlobal('subscribe_button', $courseController->getRegisteredInSessionButton($session->getId(), $session->getName(), $hasRequirements));
$template->addGlobal('courses', $courses);
$template->addGlobal('essence', \Essence\Essence::instance());
$template->addGlobal('session_extra_fields', $sessionValues->getAllValuesForAnItem($session->getId(), true));
$template->addGlobal('has_requirements', $hasRequirements);
$template->addGlobal('sequences', $sessionRequirements);
//$templateFolder = api_get_configuration_value('default_template');
echo $template->render('@template_style/session/about.html.twig');
//$template->assign('header', $session->getName());
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:about.php


示例17: destroy

 /**
  * Destroy
  */
 static function destroy()
 {
     $session = Container::getSession();
     $session->invalidate();
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:8,代码来源:chamilo_session.class.php


示例18: elseif

    $glossary_id = Security::remove_XSS($_POST['glossary_id']);
    $glossary_description_by_id = GlossaryManager::get_glossary_term_by_glossary_id($glossary_id);
    $glossary_description_by_id = str_replace($path_image_search, $path_image, $glossary_description_by_id);
    echo api_xml_http_response_encode($glossary_description_by_id);
} elseif (isset($_POST['glossary_data']) && $_POST['glossary_data'] == 'true') {
    //get_glossary_terms
    $glossary_data = GlossaryManager::get_glossary_terms();
    $glossary_all_data = array();
    if (count($glossary_data) > 0) {
        foreach ($glossary_data as $glossary_index => $glossary_value) {
            $glossary_all_data[] = $glossary_value['id'] . '__|__|' . $glossary_value['name'];
        }
        $glossary_all_data = implode('[|.|_|.|-|.|]', $glossary_all_data);
        echo api_xml_http_response_encode($glossary_all_data);
    }
} elseif (isset($_POST['glossary_name'])) {
    $my_glossary_name = Security::remove_XSS($_POST['glossary_name']);
    $my_glossary_name = api_convert_encoding($my_glossary_name, $charset, 'UTF-8');
    $my_glossary_name = trim($my_glossary_name);
    $glossary_description = GlossaryManager::get_glossary_term_by_glossary_name($my_glossary_name);
    $glossary_description = str_replace($path_image_search, $path_image, $glossary_description);
    if (is_null($glossary_description) || strlen(trim($glossary_description)) == 0) {
        echo api_xml_http_response_encode(get_lang('NoResults'));
    } else {
        echo api_xml_http_response_encode($glossary_description);
    }
} else {
    echo api_xml_http_response_encode(get_lang('NoResults'));
}
Container::$legacyTemplate = 'layout_empty.html.twig';
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:30,代码来源:glossary_ajax_request.php


示例19: array

<?php

/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container;
/**
 * Show information about Mozilla OpenBadges
 * @author Angel Fernando Quiroz Campos <[email protected]>
 * @package chamilo.admin.openbadges
 */
$cidReset = true;
//require_once '../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
if (!api_is_platform_admin() || api_get_setting('skill.allow_skills_tool') !== 'true') {
    api_not_allowed(true);
}
$backpack = 'https://backpack.openbadges.org/';
$configBackpack = api_get_setting('gradebook.openbadges_backpack');
if (strcmp($backpack, $configBackpack) !== 0) {
    $backpack = $configBackpack;
}
$interbreadcrumb = array(array('url' => api_get_path(WEB_CODE_PATH) . 'admin/index.php', 'name' => get_lang('Administration')));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Badges'));
$toolbar = Display::toolbarButton(get_lang('ManageSkills'), api_get_path(WEB_CODE_PATH) . 'admin/skill_list.php', 'list', 'primary', ['title' => get_lang('ManageSkills')]);
//$tpl = new Template(get_lang('Badges'));
echo $toolbar;
echo Container::getTemplating()->render('@template_style/skill/badge.html.twig', ['backpack' => $backpack]);
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:26,代码来源:skill_badge.php


示例20: suscribe_users_to_session

 /**
  * Subscribes students to the given session and optionally (default) unsubscribes previous users
  *
  * @author Carlos Vargas from existing code
  * @author Julio Montoya. Cleaning code.
  * @param int $id_session
  * @param array $user_list
  * @param int $session_visibility
  * @param bool $empty_users
  * @return bool
  */
 public static function suscribe_users_to_session($id_session, $user_list, $session_visibility = SESSION_VISIBLE_READ_ONLY, $empty_users = true)
 {
     if ($id_session != strval(intval($id_session))) {
         return false;
     }
     foreach ($user_list as $intUser) {
         if ($intUser != strval(intval($intUser))) {
             return false;
         }
     }
     $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
     $tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
     $tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
     $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
     $entityManager = Database::getManager();
     $session = $entityManager->find('ChamiloCoreBundle:Session', $id_session);
     // from function parameter
     if (empty($session_visibility)) {
         $session_visibility = $session->getVisibility();
         //default status loaded if empty
         if (empty($session_visibility)) {
             $session_visibility = SESSION_VISIBLE_READ_ONLY;
         }
         // by default readonly 1
     } else {
         if (!in_array($session_visibility, array(SESSION_VISIBLE_READ_ONLY, SESSION_VISIBLE, SESSION_INVISIBLE))) {
             $session_visibility = SESSION_VISIBLE_READ_ONLY;
         }
     }
     $sql = "SELECT user_id FROM {$tbl_session_rel_course_rel_user}\n                WHERE session_id = {$id_session} AND status = 0";
     $result = Database::query($sql);
     $existingUsers = array();
     while ($row = Database::fetch_array($result)) {
         $existingUsers[] = $row['user_id'];
     }
     $sql = "SELECT c_id FROM {$tbl_session_rel_course}\n                WHERE session_id = {$id_session}";
     $result = Database::query($sql);
     $course_list = array();
     while ($row = Database::fetch_array($result)) {
         $course_list[] = $row['c_id'];
     }
     if ($session->getSendSubscriptionNotification() && is_array($user_list)) {
         // Sending emails only
         foreach ($user_list as $user_id) {
             if (in_array($user_id, $existingUsers)) {
                 continue;
             }
             $subject = Container::getTemplating()->render('@template_style/mail/subject_subscription_to_session_confirmation.html.twig');
             $user_info = api_get_user_info($user_id);
             $content = Container::getTemplating()->render('@template_style/mail/content_subscription_to_session_confirmation.html.twig', ['complete_name' => stripslashes($user_info['complete_name']), 'session_name' => $session->getName(), 'session_coach' => $session->getGeneralCoach()->getCompleteName()]);
             api_mail_html($user_info['complete_name'], $user_info['mail'], $subject, $content, api_get_person_name(api_get_setting('admin.administrator_name'), api_get_setting('admin.administrator_surname')), api_get_setting('admin.administrator_email'));
         }
     }
     foreach ($course_list as $courseId) {
         // for each course in the session
         $nbr_users = 0;
         $courseId = intval($courseId);
         $sql = "SELECT DISTINCT user_id\n                    FROM {$tbl_session_rel_course_rel_user}\n                    WHERE\n                        session_id = {$id_session} AND\n                        c_id = {$courseId} AND\n                        status = 0\n                    ";
         $result = Database::query($sql);
         $existingUsers = array();
         while ($row = Database::fetch_array($result)) {
             $existingUsers[] = $row['user_id'];
         }
         // Delete existing users
         if ($empty_users) {
             foreach ($existingUsers as $existing_user) {
                 if (!in_array($existing_user, $user_list)) {
                     $sql = "DELETE FROM {$tbl_session_rel_course_rel_user}\n                                WHERE\n                                    session_id = {$id_session} AND\n                                    c_id = {$courseId} AND\n                                    user_id = {$existing_user} AND\n                                    status = 0 ";
                     $result = Database::query($sql);
                     Event::addEvent(LOG_SESSION_DELETE_USER_COURSE, LOG_USER_ID, $existing_user, api_get_utc_datetime(), api_get_user_id(), $courseId, $id_session);
                     if (Database::affected_rows($result)) {
                         $nbr_users--;
                     }
                 }
             }
         }
         // Replace with this new function
         // insert new users into session_rel_course_rel_user and ignore if they already exist
         foreach ($user_list as $enreg_user) {
             if (!in_array($enreg_user, $existingUsers)) {
                 $enreg_user = Database::escape_string($enreg_user);
                 $sql = "INSERT IGNORE INTO {$tbl_session_rel_course_rel_user} (session_id, c_id, user_id, visibility, status)\n                            VALUES({$id_session}, {$courseId}, {$enreg_user}, {$session_visibility}, 0)";
                 $result = Database::query($sql);
                 Event::addEvent(LOG_SESSION_ADD_USER_COURSE, LOG_USER_ID, $enreg_user, api_get_utc_datetime(), api_get_user_id(), $courseId, $id_session);
                 if (Database::affected_rows($result)) {
                     $nbr_users++;
                 }
             }
         }
//.........这里部分代码省略.........
开发者ID:daffef,项目名称:chamilo-lms,代码行数:101,代码来源:sessionmanager.lib.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Filesystem\Path类代码示例发布时间:2022-05-23
下一篇:
PHP Internal\Di类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap