Example #1
0
 function indexAction()
 {
     if (@(!$_GET['pages_id']) && @$_POST['pages_id']) {
         $_GET['pages_id'] = @$_POST['pages_id'];
     }
     $this->view->name_dop_table = 'page';
     $this->_helper->actionStack('createmenu', 'Menu', 'admin', array('id' => $_GET['menu_id']));
     $page = new default_controllers_PageController();
     $this->pageType = $page->getPageType($_GET['menu_id']);
     $db = Zend_Db_Table::getDefaultAdapter();
     $this->view->iPage = $db->fetchRow("SELECT \tt.*,\n    \t\t\t\t\t\t\t\t\tm.nameforhref, m.type , m.parent_id, m.id as menu_activ, m.name as menu_name, m.default_controller, m.default_controller_add_edit, m.default_view, m.default_add_edit\n    \t\t\t\t\t\t\t\t\t,(select par.name from menu par where par.id = m.parent_id) as name_parenta \n    \t\t\t\t\t\t\tFROM menu m \n    \t\t\t\t\t\t\tleft join  " . $this->pageType . " as t on m.id = t.page_id \n    \t\t\t\t\t\t\tWHERE m.id=" . $_GET['menu_id']);
     if ($_POST && $this->view->iPage['id']) {
         $update = new Core_Controller_Action_Helper_Update();
         $ret = $update->update($this->pageType, $this->view->iPage);
         $this->id_row = $ret['id_row'];
         $this->mess = $ret['message'];
         if (!$this->mess) {
             $this->view->message = 'Изменения внесены';
         }
         //$this->view->page = array_merge($this->view->page,$_POST);
         $this->view->iPage = $db->fetchRow("SELECT \tt.*,\n\t\t\t\t\t\t\t\tm.nameforhref, m.type , m.parent_id, m.id as menu_activ, m.name as menu_name, m.default_controller, m.default_controller_add_edit, m.default_view, m.default_add_edit\n\t\t\t\t\t\t\t\t,(select par.name from menu par where par.id = m.parent_id) as name_parenta \n\t\t\t\t\t\tFROM menu m  \n\t\t\t\t\t\tleft join  " . $this->pageType . " as t on m.id = t.page_id \n\t\t\t\t\t\tWHERE m.id=" . $_GET['menu_id']);
     } elseif ($_POST) {
         $add = new Core_Controller_Action_Helper_Add();
         $ret = $add->add($this->pageType, $this->view->iPage);
         $this->id_row = $ret['id_row'];
         $this->mess = $ret['message'];
         if (!$this->mess) {
             $this->view->message = 'Сохранено';
         }
         //$this->view->page = array_merge($this->view->page,$_POST);
         $this->view->iPage = $db->fetchRow("SELECT \tt.*, \n\t    \t\t\t\t\t\t\t\t\tm.nameforhref, m.type , m.parent_id, m.id as menu_activ, m.name as menu_name, m.default_controller, m.default_controller_add_edit, m.default_view, m.default_add_edit\n\t    \t\t\t\t\t\t\t\t\t,(select par.name from menu par where par.id = m.parent_id) as name_parenta \n\t    \t\t\t\t\t\t\tFROM menu m \n\t    \t\t\t\t\t\t\tleft join  " . $this->pageType . " as t on m.id = t.page_id \n\t    \t\t\t\t\t\t\tWHERE m.id=" . $_GET['menu_id']);
     }
     if (!$this->view->page['default_view']) {
         $this->_helper->viewRenderer->setScriptAction($this->pageType);
     }
     require $_SERVER['DOCUMENT_ROOT'] . "/public/fck_new/fckeditor.php";
     $oFCKeditor = new FCKeditor("textred");
     $oFCKeditor->BasePath = "/public/fck_new/";
     $oFCKeditor->Value = @$this->view->iPage['textred'];
     $this->view->html_editor = $oFCKeditor->CreateHtml();
 }
Example #2
0
 function addAction()
 {
     $this->_helper->actionStack('createmenu', 'Menu', 'admin', array('id' => $_GET['menu_id']));
     $page = new default_controllers_PageController();
     $this->pageType = $page->getPageType($_GET['menu_id']);
     $this->view->iPage = $page->getParamsForAddPage($_GET['menu_id']);
     if (!$this->view->iPage['default_controller_add_edit']) {
         $name_controller = 'default_controllers_' . $this->pageType . 'Controller';
         $dopParam = new $name_controller();
         $this->view->dopParam = $dopParam->{$this->pageType . 'preinsert'}(@$this->mess['message']);
     }
     if ($_POST and !$this->view->dopParam['error']) {
         $add = new Core_Controller_Action_Helper_Add();
         $ret = $add->add($this->pageType, $this->view->iPage);
         $_GET['pages_id'] = $this->id_row = $ret['id_row'];
         $this->mess = $ret['message'];
     }
     if (!$this->view->iPage['default_controller_add_edit'] and !$this->view->dopParam['error']) {
         $name_controller = 'default_controllers_' . $this->pageType . 'Controller';
         $dopParam = new $name_controller();
         $this->view->dopParam = $dopParam->{$this->pageType . 'afterinsert'}(@$this->mess);
         //                echo '<pre>';
         //                var_dump($dopParam->{$this->pageType.'afterinsert'}(@$this->mess));die();
         //                echo '</pre>';
         if (!$this->view->dopParam['actions']) {
             $this->view->dopParam['actions'] = "error";
         }
     }
     if ($_POST) {
         $error = '';
         if ($this->view->dopParam['error']) {
             $error = '&error=' . $this->view->dopParam['error'];
         }
         if (@(!$this->mess)) {
             if ($this->pageType['default_controller']) {
                 header("Location: /standart/view/?menu_id=" . $_GET['menu_id'] . "&page_id=" . $this->id_row . $error);
             } else {
                 header("Location: /edit/?menu_id=" . $_GET['menu_id'] . "&page_id=" . $this->id_row . $error);
                 exit;
             }
         } else {
             $this->view->message = $this->mess;
             $this->view->iPage = array_merge($this->view->iPage, $_POST);
         }
     }
     require $_SERVER['DOCUMENT_ROOT'] . "/public/fck_new/fckeditor.php";
     $oFCKeditor = new FCKeditor("textred");
     $oFCKeditor->BasePath = "/public/fck_new/";
     $oFCKeditor->Value = @$_POST['textred'];
     $this->view->html_editor = $oFCKeditor->CreateHtml();
     if ($this->pageType == 'films') {
         $db = Zend_Db_Table::getDefaultAdapter();
         $storages = $db->fetchRow('select name FROM storages where isactive = "1"');
         $this->view->iPage['storages'] = $storages['name'];
         $oFCKeditor = new FCKeditor("grafiks");
         $oFCKeditor->BasePath = "/public/fck_new/";
         $this->view->grafiks = $oFCKeditor->CreateHtml();
     }
     $this->view->name_button = 'add';
     if ($this->view->iPage['default_add_edit']) {
         $this->_helper->viewRenderer->setScriptAction($this->pageType);
     } else {
         $phtml_name = $this->pageType;
         if ($this->view->iPage['nameforhref']) {
             $phtml_name = $this->view->iPage['nameforhref'];
         }
         $this->_helper->viewRenderer($this->pageType . '/' . $phtml_name, null, true);
     }
 }