Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Static Public Member Functions | List of all members
RendererController Class Reference
Inheritance diagram for RendererController:
BaseController

Public Member Functions

 actionIndex ()
 actionStatic ()
 actionDynamic ()
 actionStartPage ()
 processOutput ($output)
 getCss ($file, $timestamp=null, $combine=true, $media= '')
 getJs ($file, $timestamp=null, $combine=true)
 getCoreJs ($file)
- Public Member Functions inherited from BaseController
 getClient ()
 getAssetsPath ()
 getViewFile ($viewName)
 getJs ($path)
 renderMail ($view, $title=null, $data, $return=true)
 redirect ($url, $terminate=true, $statusCode=302)
 createWidget ($className, $properties=array())

Static Public Member Functions

static getStatusText ($code)

Additional Inherited Members

- Public Attributes inherited from BaseController
 $layout = '//layouts/gportal'
 $mailLayout = '//layouts/mail'
- Protected Member Functions inherited from BaseController
 beforeAction ($action)

Detailed Description

Gentics Portal.Node PHP Author & Copyright (c) by Gentics Software GmbH sales.nosp@m.@gen.nosp@m.tics..nosp@m.com http://www.gentics.com Licenses can be found in the LICENSE.txt file in the root-folder of this installation You must not use this software without a valid license agreement.

Controller which recieve all requests to Content Repository

All request for pages which should be rendered(html, php) handled by actionDynamic() All other requests, for static content (img, doc, pdf, etc.) handled by actionStatic() Css and js files also handled by actionStatic() if they are not wrapped in Yii::app()->clientScript->registerCssFile() or Yii::app()->clientScript->registerScriptFile(). If they are wrapped then they will compressed and stored in /assets folder.

To handle request to specific node from content repository add these lines into routers.php 'rules' => array( '<path:nodename\/.+.(php|html)>' => 'contentRepository/dynamic', '<path:nodename\/.+>' => 'contentRepository/static', ), nodename - name of node(for exaple - gportal)

Definition at line 26 of file RendererController.php.

Member Function Documentation

RendererController::actionDynamic ( )

Action which render all dynamic content: php, html files

Exceptions
CHttpException
Exception
Returns
void

Definition at line 91 of file RendererController.php.

Referenced by actionStartPage().

{
if (Yii::app()->request->getParam('path',false)) {
$path = '/' . Yii::app()->request->getParam('path','');
$content = $this->_getContentSource()->getContent($path);
if ($content) {
if ($content->hasAccess(Yii::app()->user)) {
$content = $this->renderFile($content->getFile(), null, true);
echo $this->processOutput($content);
} else {
$this->_noAccess($content);
}
} else {
if (YII_DEBUG) {
throw new Exception('Path not exists: ' . $this->_getContentSource()->contentSource->contentFile($path));
} else {
throw new CHttpException(404);
}
}
}
}
RendererController::actionIndex ( )

Default action

Returns
void

Definition at line 33 of file RendererController.php.

{
$this->redirect(Yii::app()->createUrl(Yii::app()->getModule('user')->homePageUrl));
}
RendererController::actionStartPage ( )

Handle folder start page. In case user make request to folder like /Content.Node/service/

Returns
void
Author
Me

Definition at line 122 of file RendererController.php.

References actionDynamic().

{
if($this->module->getContentSource() instanceof FileSystemContentSource) {
throw new CHttpException(404);
}
$folder = Yii::app()->request->getParam('folder', '').'/';
$startPage = $this->module->getContentSource()->getStartPage($folder, substr(Yii::app()->locale->id, 0, 2));
if($startPage === false) {
$startPage = '/' . Yii::app()->request->getParam('path','') . $folder . $this->module->startPageFallback;
}
if($this->module->startPageDynamic) {
$_GET['path'] = substr($startPage,1);
$this->actionDynamic();
} else {
$this->redirect($startPage);
}
}
RendererController::actionStatic ( )

Action which render all static content: js, css, doc, pdf files etc.

Exceptions
CHttpException
Exception
Returns
void

Definition at line 46 of file RendererController.php.

References HeadersHelper\cache(), HeadersHelper\expires(), and HeadersHelper\forFile().

{
if (Yii::app()->request->getParam('path',false)) {
$path = '/' . Yii::app()->request->getParam('path','');
$content = $this->_getContentSource()->getContent($path);
if ($content) {
if ($content->hasAccess(Yii::app()->user)) {
$fileContent = file_get_contents($content->getFile());
array_map(
function($header)
{
header($header);
},
array_merge(
HeadersHelper::forFile($path, $fileContent),
// set the expires header
HeadersHelper::expires($this->_getContentSource()->getBrowserCacheTimeByFileName($path)),
// set the browser cache control for static files
HeadersHelper::cache($this->_getContentSource()->getBrowserCacheTimeByFileName($path))
)
);
echo $fileContent;
die;
} else {
$this->_noAccess($content);
}
} else {
if (YII_DEBUG) {
throw new Exception('Path not exists: ' . $this->_getContentSource()->contentSource->contentFile($path));
} else {
throw new CHttpException(404);
}
}
}
}
RendererController::getCoreJs (   $file)

Register general javascript library which is used by page and widgets and which should be of the same version in many palces. For example jQuery library

Parameters
string$filefilename
Returns
void

Definition at line 285 of file RendererController.php.

{
Yii::app()->clientScript->registerCoreScript($file, true);
}
RendererController::getCss (   $file,
  $timestamp = null,
  $combine = true,
  $media = '' 
)

Register css file in page

Parameters
string$filefilename
null$timestamplast update timestamp of this file
bool$combineif combine and compress this file
string$mediamedia that the CSS code should be applied to. If empty, it means all media types.
Returns
void

Definition at line 258 of file RendererController.php.

{
Yii::app()->clientScript->registerCssFile($file, $media, $timestamp, $combine, true, true);
}
RendererController::getJs (   $file,
  $timestamp = null,
  $combine = true 
)

Register js file in page

Parameters
string$filefilename
null$timestamplast update timestamp of this file
bool$combineif combine and compress this file
Returns
void

Definition at line 272 of file RendererController.php.

{
Yii::app()->clientScript->registerScriptFile($file, CClientScript::POS_HEAD, $timestamp, $combine, true, true);
}

The documentation for this class was generated from the following file: