public function actionEdit()
 {
     // Retrieve the pageid we're looking to edit
     $id = Yii::app()->getRequest()->getQuery('id');
     $model = CustomPage::model()->findByPk($id);
     if (!$model instanceof CustomPage) {
         Yii::app()->user->setFlash('error', "Invalid Custom Page");
         $this->redirect($this->createUrl("custompage/index"));
     }
     Yii::log('POST: ' . print_r($_POST, true), 'info', 'application.' . __CLASS__ . "." . __FUNCTION__);
     if (_xls_get_conf('LANG_MENU')) {
         $langs = _xls_comma_to_array(_xls_get_conf('LANG_OPTIONS'));
     } else {
         $langs = array("en:English");
     }
     if (isset($_POST['CustomPage'])) {
         $model->setPageData($_POST);
         $_POST['CustomPage']['page_data'] = $model->page_data;
         $model->attributes = $_POST['CustomPage'];
         if ($model->validate()) {
             if ($model->deleteMe) {
                 $model->delete();
                 Yii::app()->user->setFlash('info', "Custom page has been deleted");
                 $this->redirect($this->createUrl("custompage/index"));
             } else {
                 $model->request_url = _xls_seo_url($model->title);
                 if (!$model->save()) {
                     Yii::app()->user->setFlash('error', print_r($model->getErrors(), true));
                 } else {
                     Yii::app()->user->setFlash('success', Yii::t('admin', 'Custom page updated on {time}.', array('{time}' => date("d F, Y  h:i:sa"))));
                     $this->beforeAction('edit');
                     //In case we renamed one and we want to update menu
                 }
             }
         }
     }
     $this->render('edit', array('model' => $model));
 }
Exemplo n.º 2
0
?>
</div>
        </div>


	</div>

	<div class="span11">
	    <h4>Edit Page Content</h4>
		<div class="tip">Enter optional page content that will appear above any products (if you are using product tags feature). Click on the first tool on the toolbar to switch to editing HTML directly. Note this editor can be used for HTML and CSS, but any scripting language like JavaScript will not be functional.</div>
		<p></p>


		<?php 
if (_xls_get_conf('LANG_MENU')) {
    $langs = _xls_comma_to_array(_xls_get_conf('LANG_OPTIONS'));
} else {
    $langs = array("en:English");
}
?>
		<div class="tabbable">
			<ul class="nav nav-tabs langedit">
				<?php 
foreach ($langs as $lang) {
    $langa = explode(":", $lang);
    echo '<li ' . ($langa[0] == 'en' ? 'class="active"' : '') . '><a href="#' . $langa[0] . '" data-toggle="tab">' . $langa[1] . '</a></li>';
}
?>
			</ul>

			<div class="tab-content">
Exemplo n.º 3
0
 /**
  * Get the supported language(s) for the custom page
  * @return array The code:description array of supported languages
  */
 private function _getPageLanguages()
 {
     if (_xls_get_conf('LANG_MENU')) {
         $langs = _xls_comma_to_array(_xls_get_conf('LANG_OPTIONS'));
     } else {
         $langs = array("en:English");
     }
     return $langs;
 }