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

Public Member Functions

 filters ()
 accessRules ()
 actionSaveAttribute ()
 actionDeleteAttribute ()
 actionUpdateUserAttribute ()
 actionAdd ($url, $title, $page_id, $additional, $key, $back_to_referer)
 actionShareByMail ()
 actionDownloadPdf ()
 actionLoadPdf ($mailurls)
 actionDeletePage ()
 filters ()
 accessRules ()
 actionIndex ()
- 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())

Public Attributes

 $layout = false
- Public Attributes inherited from BaseController
 $layout = '//layouts/gportal'
 $mailLayout = '//layouts/mail'

Additional Inherited Members

- 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.

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.

ManageController used for managing operations with RememberedPages like view, add, delete, share

Definition at line 11 of file ManageController.php.

Member Function Documentation

ManageController::accessRules ( )

Specifies the access control rules. This method is used by the 'accessControl' filter.

Returns
array access control rules

Definition at line 23 of file ManageController.php.

{
return array(
array('allow',
'roles' => array('Admin'),
),
array('deny', // deny all users
'users' => array('*'),
),
);
}
ManageController::accessRules ( )

returns filter rules

Returns
array

Definition at line 31 of file ManageController.php.

{
return array(
array(
'allow',
'roles' => array('Admin')
),
array(
'deny',
'users' => array('*')
)
);
}
ManageController::actionAdd (   $url,
  $title,
  $page_id,
  $additional,
  $key,
  $back_to_referer 
)

Remembering page into database This action performs validations to prevent unautorized access

Returns
void

Definition at line 24 of file ManageController.php.

{
$data = array(
'url'=> $_GET['url'],
'title'=> $_GET['title'],
'page_id'=> $_GET['page_id'],
'additional' => $_GET['additional'],
'back_to_referer' => (boolean) $_GET['back_to_referer'],
);
if($this->module->sign(serialize($data)) !== $key) {
throw new CHttpException(400, 'Invalid key');
}
$rememberedPage = new RememberedPage();
$rememberedPage->collection_id = Yii::app()->getModule('remember')->getUserCollectionId();
$rememberedPage->url = $url;
$rememberedPage->title = $title;
$rememberedPage->page_id = $page_id;
$rememberedPage->additional = unserialize($additional);
if(!$rememberedPage->save()){
throw new CHttpException(400, 'Internal error');
}
$this->redirect($back_to_referer === 'true' ? Yii::app()->request->getUrlReferrer() : $url);
}
ManageController::actionDeleteAttribute ( )

Deletes personalisation attribute

Exceptions
CHttpException
Returns
void

Definition at line 91 of file ManageController.php.

References PersonalisationAttribute\model(), and PersonalisationModule\t().

{
if (isset($_POST['id'])) {
$pa = PersonalisationAttribute::model()->findByPk($_POST['id']);
if ($pa->delete()) {
echo CJSON::encode(array());
} else {
echo CJSON::encode(array('error' => PersonalisationModule::t('Can\'t delete attribute')));
}
Yii::app()->end();
} else {
throw new CHttpException(400);
}
}
ManageController::actionDeletePage ( )

Deleting single remembered page

Returns
void

Definition at line 129 of file ManageController.php.

References RememberedPage\model().

{
$id = Yii::app()->request->getQuery('id', '');
$isAjax = Yii::app()->request->isAjaxRequest;
$collectionId = Yii::app()->getModule('remember')->getUserCollectionId();
$ids = explode(",",$id);
foreach($ids as $id){
$rememberedPage = RememberedPage::model()->findByPk($id);
if($rememberedPage && $rememberedPage->collection_id == $collectionId){
$rememberedPage->delete();
}else{
throw new CHttpException(400);
}
}
if(!$isAjax){
if(isset($_SERVER['HTTP_REFERER'])){
$this->redirect($_SERVER['HTTP_REFERER']);
}
}else{
echo json_encode(array('status'=>'success'));
}
}
ManageController::actionIndex ( )

Default action

Returns
void

Definition at line 40 of file ManageController.php.

References Settings\instance(), and SettingsModule\t().

{
foreach (Settings::instance()->settings as $name => $value) {
if (!in_array($name, $this->module->fields)) {
Settings::instance()->unsetValue($name);
}
}
foreach ($this->module->fields as $field) {
if (isset($_POST[$field])) {
Settings::instance()->set($field, $_POST[$field]);
Yii::app()->user->setFlash('settings', SettingsModule::t('Updated success'));
}
}
$this->render('index', array('allowedSettings' => $this->module->fields, 'settings' => Settings::instance()->settings));
}
ManageController::actionSaveAttribute ( )

saves personalisation attribute

Exceptions
CHttpException
Returns
void

Definition at line 52 of file ManageController.php.

References PersonalisationAttribute\model().

{
if (!isset($_POST['parent_id'], $_POST['id'], $_POST['name'], $_POST['title'])) {
throw new CHttpException(400);
}
if (strpos($_POST['id'], 'tmp_') === 0) {
$attribute = new PersonalisationAttribute();
if ($_POST['parent_id'] !== 'root') {
$attribute->childOf(PersonalisationAttribute::model()->findByPk($_POST['parent_id']));
}
} else {
$attribute = PersonalisationAttribute::model()->findByPk($_POST['id']);
if (!$attribute) {
throw new CHttpException(400);
}
}
$attribute->name = $_POST['name'];
$attribute->title = !empty($_POST['title']) ? $_POST['title'] : $_POST['name'];
if ($attribute->save()) {
echo CJSON::encode(array('id' => $attribute->id, 'parent_id' => $attribute->parent_id, 'name' => $attribute->name, 'title' => $attribute->title));
Yii::app()->end();
} else {
$errorsString = array();
foreach ($attribute->getErrors() as $field => $errors) {
$errorsString[] = $field . ': ' . implode(', ', $errors);
}
echo CJSON::encode(array('error' => implode('; ', $errorsString)));
Yii::app()->end();
}
}
ManageController::actionUpdateUserAttribute ( )

Updates user personalisation attribute

Returns
void

Definition at line 111 of file ManageController.php.

References UserPersonalisationAttribute\model(), PersonalisationAttribute\model(), and User\model().

{
if (isset($_POST['user_id']) && isset($_POST['id']) && isset($_POST['state']) && User::model()->findByPk($_POST['user_id'])) {
if ($_POST['state'] == 1) {
if (PersonalisationAttribute::model()->findByPk($_POST['id'])) {
$upa->user_id = $_POST['user_id'];
$upa->personalisation_attribute_id = $_POST['id'];
$upa->save();
}
} else {
UserPersonalisationAttribute::model()->deleteAllByAttributes(array('user_id' => $_POST['user_id'], 'personalisation_attribute_id' => $_POST['id']));
}
}
}
ManageController::filters ( )

sets some access rules

Returns
array

Definition at line 10 of file ManageController.php.

{
return array(
'accessControl', // perform access control for CRUD operations
);
}
ManageController::filters ( )

Returns filers array

Returns
array

Definition at line 19 of file ManageController.php.

{
return array(
'accessControl'
);
}

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