示例#1
0
 public function addAction()
 {
     $flag = false;
     foreach ($this->privileges as $privilege) {
         if ($privilege['id'] == 69) {
             $flag = true;
         }
     }
     if (!$flag) {
         $this->_redirect('admin/index/error');
     }
     $this->view->headTitle($this->config['title']['addPage']);
     $componentMapper = new Cloud_Model_Component_CloudComponentMapper();
     $components = $componentMapper->fetchAllByFront();
     $componentMaxOrder = $this->pageMapper->getMaxOrder();
     $form = new Cloud_Form_Admin_Page_Add(array('components' => $components, 'page' => $componentMaxOrder));
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->request->getPost())) {
             $values = $form->getValues();
             $page = new Cloud_Model_Page_CloudPage($values);
             $component_id = $values['component_id'];
             $this->pageMapper->savePage($page, $component_id);
             $this->view->message = 'Đã thêm page: ' . $page->getName();
         }
     }
     $this->view->form = $form;
 }
示例#2
0
 public function addAction()
 {
     $flag = false;
     foreach ($this->privileges as $privilege) {
         if ($privilege['id'] == 74) {
             $flag = true;
         }
     }
     if (!$flag) {
         $this->_redirect('admin/index/error');
     }
     $this->view->headTitle($this->config['title']['addWidget']);
     $componentMapper = new Cloud_Model_Component_CloudComponentMapper();
     $components = $componentMapper->fetchAllByFront();
     $this->view->components = $components;
     if (isset($_POST['ok'])) {
         $newId = $this->widgetMapper->saveAll();
         $this->pagewidgetMapper->saveAll($newId);
         $this->view->message = 'Đã thêm widget: ' . $_POST['name'];
     }
 }