コード例 #1
0
ファイル: ThemeView.php プロジェクト: wasabi-cms/cms
 /**
  * Initialization hook method.
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadHelper('Meta', ['className' => 'Wasabi/Cms.Meta']);
     $this->loadHelper('Asset', ['className' => 'FrankFoerster/Asset.Asset']);
     $this->loadHelper('Menu', ['className' => 'Wasabi/Cms.Menu']);
 }
コード例 #2
0
 /**
  * Initialization hook method.
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->response->type('png');
     $this->response->header(['Content-Transfer-Encoding' => 'binary']);
 }
コード例 #3
0
ファイル: AjaxView.php プロジェクト: JesseDarellMoore/CS499
 /**
  * Initialization hook method.
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->response->type('ajax');
 }
コード例 #4
0
ファイル: AjaxView.php プロジェクト: eripoll/webiplan
 /**
  * Initialization hook method.
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadHelper('Social.Commentable');
     $this->response->type('ajax');
 }
コード例 #5
0
 /**
  * @param \Cake\Network\Request|null $request Request instance.
  * @param \Cake\Network\Response|null $response Response instance.
  * @param \Cake\Event\EventManager|null $eventManager Event manager instance.
  * @param array $viewOptions View options.
  */
 public function __construct(Request $request = null, Response $response = null, EventManager $eventManager = null, array $viewOptions = [])
 {
     parent::__construct($request, $response, $eventManager, $viewOptions);
     $this->_duration = isset($viewOptions['duration']) ? $viewOptions['duration'] : 0;
     $this->_compress = isset($viewOptions['compress']) ? $viewOptions['compress'] : false;
 }
コード例 #6
0
ファイル: PdfView.php プロジェクト: dereuromark/CakePdf
 /**
  * Render a Pdf view.
  *
  * @param string $view The view being rendered.
  * @param string $layout The layout being rendered.
  * @return string The rendered view.
  */
 public function render($view = null, $layout = null)
 {
     $content = parent::render($view, $layout);
     if ($this->response->type() === 'text/html') {
         return $content;
     }
     if ($this->renderer() === null) {
         $this->response->type('html');
         return $content;
     }
     if (isset($this->pdfConfig['download']) && $this->pdfConfig['download'] === true) {
         $this->response->download($this->getFilename());
     }
     $this->Blocks->set('content', $this->renderer()->output($content));
     return $this->Blocks->get('content');
 }
コード例 #7
0
 /**
  * Method that adds elements to associated Element actions menu.
  *
  * @param  Cake\Event\Event     $event   Event object
  * @param  Cake\Network\Request $request Request object
  * @param  Cake\ORM\Entity      $options Entity options
  * @return undefined
  */
 public function getAssociatedMenuActions(Event $event, Request $request, array $options)
 {
     list($assocPlugin, $assocController) = pluginSplit($options['associated']['className']);
     $appView = $event->subject();
     if (!$appView instanceof View) {
         $appView = new AppView();
     }
     $controllerName = $request->controller;
     if (!empty($request->plugin)) {
         $controllerName = $request->plugin . '.' . $controllerName;
     }
     $urlView = ['prefix' => false, 'plugin' => $assocPlugin, 'controller' => $assocController, 'action' => 'view', $options['associated']['entity']->id];
     $btnView = $appView->Html->link('', $urlView, ['title' => __('View'), 'class' => 'btn btn-default glyphicon glyphicon-eye-open']);
     $urlEdit = ['prefix' => false, 'plugin' => $assocPlugin, 'controller' => $assocController, 'action' => 'edit', $options['associated']['entity']->id];
     $btnEdit = ' ' . $appView->Html->link('', $urlEdit, ['title' => __('Edit'), 'class' => 'btn btn-default glyphicon glyphicon-pencil']);
     $urlDel = ['prefix' => false, 'plugin' => $assocPlugin, 'controller' => $assocController, 'action' => 'delete', $options['associated']['entity']->id];
     $btnDel = ' ' . $appView->Form->postLink('', $urlDel, ['confirm' => __('Are you sure you want to delete {0}?', $options['associated']['entity']->{$options['associated']['displayField']}), 'title' => __('Delete'), 'class' => 'btn btn-default glyphicon glyphicon-trash']);
     $menu = [['label' => $btnView, 'url' => $urlView], ['label' => $btnEdit, 'url' => $urlEdit], ['label' => $btnDel, 'url' => $urlDel]];
     if (isset($options['associated']['type']) && in_array($options['associated']['type'], ['manyToMany'])) {
         $urlUnlink = ['plugin' => $request->plugin, 'controller' => $request->controller, 'action' => 'unlink', $options['entity']->id, $options['associated']['name'], $options['associated']['entity']->id];
         $btnUnlink = ' ' . $appView->Form->postLink('', $urlUnlink, ['title' => __('Unlink'), 'class' => 'btn btn-default fa fa-chain-broken']);
         $menu[] = ['label' => $btnUnlink, 'url' => $urlUnlink];
     }
     if ($appView->elementExists(static::MENU_ELEMENT)) {
         $result = $appView->element(static::MENU_ELEMENT, ['menu' => $menu, 'renderAs' => 'provided']);
     } else {
         $result = $btnUnlink;
     }
     return $result;
 }