Пример #1
0
 public function preview()
 {
     //NOTE: Layout preview feature is not finished. Not supported yet
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
     $url = '';
     if ($this->request->is_POST()) {
         $tmpl_id = $this->request->post['tmpl_id'];
         $page_id = $this->request->post['page_id'];
         $layout_id = $this->request->post['layout_id'];
         $section = $this->request->post['section'];
         $block = $this->request->post['block'];
         $parentBlock = $this->request->post['parentBlock'];
         $blockStatus = $this->request->post['blockStatus'];
         foreach ($section as $k => $item) {
             $section[$k]['children'] = array();
         }
         foreach ($block as $k => $block_id) {
             $parent = $parentBlock[$k];
             $status = $blockStatus[$k];
             $section[$parent]['children'][] = array('block_id' => $block_id, 'status' => $status);
         }
         $layout_data['blocks'] = $section;
         $layout = new ALayoutManager($tmpl_id, $page_id, $layout_id);
         $draft_layout_id = $layout->savePageLayoutAsDraft($layout_data);
         $url = '&' . $this->html->buildURI(array('tmpl_id' => $tmpl_id, 'page_id' => $page_id, 'layout_id' => $layout_id, 'preview_id' => $draft_layout_id));
     }
     $this->redirect($this->html->getSecureURL('design/layout', $url));
 }