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


PHP Container::twig方法代码示例

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


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

示例1: classicAction

 /**
  * @param $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;
     // Legacy inclusions
     Container::setSession($request->getSession());
     $dbConnection = $this->container->get('database_connection');
     $database = new \Database($dbConnection, array());
     Container::$urlGenerator = $this->container->get('router');
     Container::$security = $this->container->get('security.context');
     Container::$translator = $this->container->get('translator');
     Container::$assets = $this->container->get('templating.helper.assets');
     Container::$rootDir = $this->container->get('kernel')->getRealRootDir();
     Container::$logDir = $this->container->get('kernel')->getLogDir();
     Container::$dataDir = $this->container->get('kernel')->getDataDir();
     Container::$tempDir = $this->container->get('kernel')->getCacheDir();
     Container::$courseDir = $this->container->get('kernel')->getDataDir();
     //Container::$configDir = $this->container->get('kernel')->getConfigDir();
     Container::$htmlEditor = $this->container->get('chamilo_core.html_editor');
     Container::$twig = $this->container->get('twig');
     if (is_file($fileToLoad) && \Security::check_abs_path($fileToLoad, $mainPath)) {
         $toolNameFromFile = basename(dirname($fileToLoad));
         $charset = 'UTF-8';
         // Default values
         $_course = api_get_course_info();
         $_user = api_get_user_info();
         /*
                     $text_dir = api_get_text_direction();
                     $is_platformAdmin = api_is_platform_admin();
                     $_cid = api_get_course_id();*/
         $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;
         //$this->getTemplate()->setBreadcrumb($interbreadcrumb);
         //$breadCrumb = $this->getTemplate()->getBreadCrumbLegacyArray();
         //$menu = $this->parseLegacyBreadCrumb($breadCrumb);
         //$this->getTemplate()->assign('new_breadcrumb', $menu);
         //$this->getTemplate()->parseResources();
         /*if (isset($tpl)) {
               $response = $app['twig']->render($app['default_layout']);
           } else {
               $this->getTemplate()->assign('content', $out);
               $response = $app['twig']->render($app['default_layout']);
           }*/
         return $this->render('ChamiloCoreBundle:Legacy:index.html.twig', array('content' => $out, 'js' => $js));
     } else {
         throw new NotFoundHttpException();
     }
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:70,代码来源:LegacyController.php


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