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

Public Member Functions

 actionCommentsWidget ($contentId=null, $allowAnonymous= 'true')
 actionCommentsFormWidget ($contentId=null, $allowAnonymous=true)
 actionCommentsListWidget ($contentId=null)
 actionIndex ()
 actionIndex ()
 actionIndex ()

Additional Inherited Members

- Public Attributes inherited from Controller
 $menu = array()
 $breadcrumbs = array()
- 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.

This controller used for widgets preview. It returns widgets with some content.

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.

Author
Vitalii Kovalchuk vital.nosp@m.y.ko.nosp@m.valch.nosp@m.uk@o.nosp@m.berig.nosp@m..com Comment controller class
Vitalii Kovalchuk vital.nosp@m.y.ko.nosp@m.valch.nosp@m.uk@o.nosp@m.berig.nosp@m..com

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.

Author
Vitalii Kovalchuk vital.nosp@m.y.ko.nosp@m.valch.nosp@m.uk@o.nosp@m.berig.nosp@m..com PersonalizedContent controller class
Vitalii Kovalchuk vital.nosp@m.y.ko.nosp@m.valch.nosp@m.uk@o.nosp@m.berig.nosp@m..com

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.

Author
Vitalii Kovalchuk vital.nosp@m.y.ko.nosp@m.valch.nosp@m.uk@o.nosp@m.berig.nosp@m..com tagcloud preview controller class
Vitalii Kovalchuk vital.nosp@m.y.ko.nosp@m.valch.nosp@m.uk@o.nosp@m.berig.nosp@m..com

Definition at line 13 of file PreviewController.php.

Member Function Documentation

PreviewController::actionCommentsFormWidget (   $contentId = null,
  $allowAnonymous = true 
)

CommentsFormWidget

Parameters
string$contentIdcontent id
bool$allowAnonymousallow anonymous comments
Returns
void

Definition at line 37 of file PreviewController.php.

{
$this->renderPartial('CommentsFormWidget', array('contentId' => $contentId, 'allowAnonymous' => strtolower($allowAnonymous) === 'true'));
}
PreviewController::actionCommentsListWidget (   $contentId = null)

CommentsListWidget

Parameters
string$contentIdcontent id
Returns
void

Definition at line 49 of file PreviewController.php.

{
$this->renderPartial('CommentsListWidget', array('contentId' => $contentId));
}
PreviewController::actionCommentsWidget (   $contentId = null,
  $allowAnonymous = 'true' 
)

CommentsWidget

Parameters
string$contentIdcontent id
bool | string$allowAnonymousallow anonymous comments
Returns
void

Definition at line 24 of file PreviewController.php.

{
$this->renderPartial('CommentsWidget', array('contentId' => $contentId, 'allowAnonymous' => strtolower($allowAnonymous) === 'true'));
}
PreviewController::actionIndex ( )

default action used to like or unlike content

Returns
bool

Definition at line 28 of file PreviewController.php.

{
$contentId = Yii::app()->request->getQuery('contentId', 0);
$this->renderPartial('LikeWidget', array('contentId' => $contentId));
}
PreviewController::actionIndex ( )

default action used to show widget preview

Returns
void
Exceptions
Exception

Definition at line 29 of file PreviewController.php.

References TagcloudModule\t().

{
$folderIds = Yii::app()->request->getQuery('folderIds', null);
$usePersonalisation = Yii::app()->request->getQuery('usePersonalisation', 'Y');
if (empty($folderIds)) {
throw new Exception(TagcloudModule::t('TagcloudModule error: folderIds is required and can`t be blank'));
}
preg_match_all('/([0-9]+)/', $folderIds, $folderIds);
array_walk(
$folderIds[0],
function(&$item)
{
$item = '10002.'.$item;
}
);
$this->widget(
'tagcloud.widgets.TagcloudWidget',
array(
'folderIds'=>$folderIds[0],
'usePersonalisation'=>($usePersonalisation == 'Y' ? true : false)
)
);
}
PreviewController::actionIndex ( )

default action used to show widget preview

Returns
void
Exceptions
Exception

Definition at line 30 of file PreviewController.php.

References PersonalizedContentModule\t().

{
$folderIds = Yii::app()->request->getQuery('folderIds', null);
$pageId = Yii::app()->request->getQuery('pageId', null);
$usePersonalisation = Yii::app()->request->getQuery('usePersonalisation', 'Y');
$lang = Yii::app()->request->getQuery('lang', null);
if (empty($folderIds)) {
throw new Exception(PersonalizedContentModule::t('PersonalizedContentPreview error: folderIds is required and can`t be blank'));
} else if (empty($pageId)) {
throw new Exception(PersonalizedContentModule::t('PersonalizedContentPreview error: pageId is required and can`t be blank'));
}
if (empty($lang)) {
$lang = substr(Yii::app()->language, 0, 2);
}
$folderIds = explode(',', $folderIds);
foreach ($folderIds as &$folderId) {
$folderId = '10002.'.intval($folderId);
}
$data = Yii::app()->repositoryApi->request(
array(
'filter' => 'object.languagecode=="'.$lang.'" AND object.contentid=='.$pageId,
'type' => 'php',
),
array('content')
);
$data = unserialize($data);
$tplString = !empty($data[$pageId]['attributes']['content']) ? $data[$pageId]['attributes']['content'] : '';
/*$tplString = '<div class="personalized-content-item">
<a href="{{url}}">{{name}}</a>
<br/>
<a href="{{url}}">{{url}}</a>
<br/>
<span>{{content}}</span>
date:{{date}}<br/>
time:{{time}}<br/>
datetime:{{datetime}}<br/>
</div>';*/
if (empty($tplString)) {
throw new Exception(PersonalizedContentModule::t('PersonalizedContentPreview error: could not load tplString from GCC or it is empty'));
}
$this->widget(
'personalizedContent.widgets.PersonalizedContentWidget',
array(
'folderIds'=>$folderIds,
'tplString'=>$tplString,
'usePersonalisation'=>($usePersonalisation == 'Y' ? true : false)
)
);
}

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