Пример #1
0
 private function getPageForm()
 {
     $request = $this->getRequest();
     $page_id = $request->getQuery('id');
     $pages_module = new Model_Pages();
     $this->view->sub_of = $sub_of = $this->getRequest()->getRequest('sub_of', 0);
     if ($page_id) {
         $page_info = $pages_module->getPage($page_id);
     }
     $this->view->languages = array();
     $this->view->def_lang = false;
     $languages = Model_Language::getLanguages();
     if ($languages) {
         $this->view->languages = $languages;
         foreach ($languages as $language) {
             if ($language['language_id'] == JO_Registry::get('default_config_language_id')) {
                 $this->view->def_lang = $language['code'];
             }
             $this->view->name[$language['language_id']] = '';
             $this->view->text[$language['language_id']] = '';
         }
     }
     if ($sub_of) {
         $category_info = $pages_module->getPagePath($sub_of);
         if (!$category_info) {
             $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/pages/');
         }
         $this->view->parent_name = $category_info['name'];
         $this->view->parent_href = $this->getRequest()->getModule() . '/pages/?sub_of=' . $category_info['sub_of'];
     }
     if ($request->getPost('name')) {
         $this->view->name = $request->getPost('name');
     } elseif (isset($page_info)) {
         $this->view->name = array();
         foreach ($page_info as $i) {
             $this->view->name[$i['lid']] = $i['name'];
         }
     }
     if ($request->getPost('text')) {
         $this->view->text = $request->getPost('text');
     } elseif (isset($page_info)) {
         $this->view->text = array();
         foreach ($page_info as $i) {
             $this->view->text[$i['lid']] = $i['text'];
         }
     }
     if ($request->getPost('visible')) {
         $this->view->visible = $request->getPost('visible');
     } elseif (isset($page_info)) {
         $this->view->visible = $page_info[0]['visible'];
     } else {
         $this->view->visible = 'true';
     }
     if ($request->getPost('meta_title')) {
         $this->view->meta_title = $request->getPost('meta_title');
     } elseif (isset($page_info)) {
         $this->view->meta_title = $page_info[0]['meta_title'];
     } else {
         $this->view->meta_title = '';
     }
     if ($request->getPost('meta_keywords')) {
         $this->view->meta_keywords = $request->getPost('meta_keywords');
     } elseif (isset($page_info)) {
         $this->view->meta_keywords = $page_info[0]['meta_keywords'];
     } else {
         $this->view->meta_keywords = '';
     }
     if ($request->getPost('meta_description')) {
         $this->view->meta_description = $request->getPost('meta_description');
     } elseif (isset($page_info)) {
         $this->view->meta_description = $page_info[0]['meta_description'];
     } else {
         $this->view->meta_description = '';
     }
     if ($request->getPost('menu')) {
         $this->view->menu = $request->getPost('menu');
     } elseif (isset($page_info)) {
         $this->view->menu = $page_info[0]['menu'];
     } else {
         $this->view->menu = '';
     }
     if ($request->getPost('footer')) {
         $this->view->footer = $request->getPost('footer');
     } elseif (isset($page_info)) {
         $this->view->footer = $page_info[0]['footer'];
     } else {
         $this->view->footer = 'false';
     }
     if ($request->getPost('key')) {
         $this->view->key = $request->getPost('key');
     } elseif (isset($page_info)) {
         $this->view->key = $page_info[0]['key'];
     } else {
         $this->view->key = '';
     }
     if ($request->getPost('url')) {
         $this->view->url = $request->getPost('url');
     } elseif (isset($page_info)) {
         $this->view->url = $page_info[0]['url'];
     } else {
         $this->view->url = '';
     }
 }