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

Public Member Functions

 filters ()
 accessRules ()
 actionInit ()
 actionLoadLibrary ()
 actionLoadForm ()
 actionLoadTemplate ()
 actionSaveTemplate ()
 actionSave ()

Additional Inherited Members

- Public Attributes inherited from Controller
 $menu = array()
 $breadcrumbs = array()
- Protected Member Functions inherited from BaseController
 beforeAction ($action)

Detailed Description

Definition at line 3 of file EditorController.php.

Member Function Documentation

EditorController::actionSave ( )

save form

Definition at line 124 of file EditorController.php.

{
if(count($_POST))
{
$response = array();
$model = new FGForms();
$model->setAttributes($_POST);
$model->user = Yii::app()->user->id;
$model->thankyoupage = $_POST['thankyoupage'];
$model->nextpage = $_POST['nextpage'];
$model->prevpage = $_POST['prevpage'];
if (!empty($_POST['id']) && $_POST['id'] != "" && $_POST['id'] != "0"){
if($model->updateByPk((int)$_POST['id'],
array( "name" => $_POST['name'],
"json" => $_POST['json'],
"html" => $_POST['html'],
"thankyoupage" => $_POST['thankyoupage'],
"nextpage" => $_POST['nextpage'],
"prevpage" => $_POST['prevpage']
)
))
{
$response['status'] = true;
$response['id'] = $_POST['id'];
}
else
{
$response['status'] = false;
$response['errors'] = $model->getErrors();
}
} else {
if($model->save())
{
$response['status'] = true;
$response['id'] = $model->id;
}
else
{
$response['status'] = false;
$response['errors'] = $model->getErrors();
}
}
}
else
{
throw new CHttpException(500, "No JSON provided");
}
FGHelper::sendJSON($response);
}
EditorController::actionSaveTemplate ( )

save template

Definition at line 96 of file EditorController.php.

{
if(isset($_POST['json']))
{
$model = new FGTemplates();
$model->setAttributes($_POST);
$model->user = Yii::app()->user->id;
if($model->save())
{
FGHelper::sendJSON(array(
'id'=>$model->id,
'name'=>$model->name
));
}
else
{
throw new CHttpException(500, CActiveForm::validate($model));
}
}
else
{
throw new CHttpException(500, "No JSON provided");
}
}

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