Пример #1
0
 /**
  * Execute le module dans l'administration
  * @access public
  */
 public function run()
 {
     $header = new magixglobal_model_header();
     $create = new backend_controller_template();
     $plugin = new backend_controller_plugins();
     $create->addConfigFile(array('news'), array('news_'), false);
     $access = $this->model_access->module_access("backend_controller_news");
     $create->assign('access', $access);
     if (magixcjquery_filter_request::isGet('getlang')) {
         if (isset($this->action)) {
             if ($this->action == 'list') {
                 $max = 20;
                 if (magixcjquery_filter_request::isGet('json_list_news')) {
                     $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
                     $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
                     $header->pragma();
                     $header->cache_control("nocache");
                     $header->getStatus('200');
                     $header->json_header("UTF-8");
                     $this->json_list_news($max);
                 } else {
                     $create->assign('pagination', $this->news_pagination($max));
                     $create->display('news/list.tpl');
                 }
             } elseif ($this->action == 'add') {
                 if (isset($this->n_title)) {
                     $this->insert_news_data();
                 }
             } elseif ($this->action == 'edit') {
                 if (isset($this->edit)) {
                     $data = parent::s_news_data($this->edit);
                     $create->assign('plugin', $plugin->menu_item_plugin('news'));
                     if (magixcjquery_filter_request::isGet('json_urinews')) {
                         $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
                         $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
                         $header->pragma();
                         $header->cache_control("nocache");
                         $header->getStatus('200');
                         $header->json_header("UTF-8");
                         $this->json_uri($data);
                     } elseif (magixcjquery_filter_request::isGet('ajax_image')) {
                         $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
                         $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
                         $header->pragma();
                         $header->cache_control("nocache");
                         $header->getStatus('200');
                         $header->html_header("UTF-8");
                         $this->ajax_image($create, $data['n_image']);
                     } elseif (isset($this->n_image)) {
                         $this->update_news_image();
                     } elseif (isset($this->n_title)) {
                         $this->update_news_data();
                     } elseif (isset($this->name_tag)) {
                         $this->add_reltag();
                     } elseif (isset($this->delete_tag)) {
                         $this->remove_tag();
                     } else {
                         if (isset($this->plugin)) {
                             // Chargement du plugin dans les actualités (edition)
                             $this->load_edit_data($create, $data);
                             $param_arr = array($this->plugin, $this->getlang, $this->edit);
                             $plugin->extend_module($this->plugin, 'news', $param_arr);
                         } else {
                             $this->load_edit_data($create, $data);
                             $create->display('news/edit.tpl');
                         }
                     }
                 } else {
                     if (isset($this->published)) {
                         $this->update_published();
                     }
                 }
             } elseif ($this->action == 'remove') {
                 if (isset($this->delete_news)) {
                     $this->remove_news();
                 } elseif (isset($this->delete_image)) {
                     $this->remove_image();
                 }
             }
         }
     } else {
         if (magixcjquery_filter_request::isGet('json_graph')) {
             $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
             $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
             $header->pragma();
             $header->cache_control("nocache");
             $header->getStatus('200');
             $header->json_header("UTF-8");
             $this->json_graph();
         } elseif (isset($this->news_search)) {
             $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
             $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
             $header->pragma();
             $header->cache_control("nocache");
             $header->getStatus('200');
             $header->json_header("UTF-8");
             $this->json_url_news();
         } else {
             $create->display('news/index.tpl');
         }
     }
 }
Пример #2
0
 /**
  * Execute le module dans l'administration
  * @access public
  */
 public function run()
 {
     $header = new magixglobal_model_header();
     $create = new backend_controller_template();
     $plugin = new backend_controller_plugins();
     $create->addConfigFile(array('catalog'), array('catalog_'), false);
     $access = $this->model_access->module_access("backend_controller_catalog");
     $create->assign('access', $access);
     if (isset($this->section)) {
         if ($this->section === 'category') {
             if (isset($this->getlang)) {
                 if (isset($this->action)) {
                     if ($this->action === 'list') {
                         if (magixcjquery_filter_request::isGet('json_list_category')) {
                             $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
                             $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
                             $header->pragma();
                             $header->cache_control("nocache");
                             $header->getStatus('200');
                             $header->json_header("UTF-8");
                             $this->json_listing_category();
                         } elseif (isset($this->name_category)) {
                             $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
                             $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
                             $header->pragma();
                             $header->cache_control("nocache");
                             $header->getStatus('200');
                             $header->json_header("UTF-8");
                             $this->json_autocomplete_category();
                         }
                     } elseif ($this->action === 'add') {
                         if (isset($this->clibelle)) {
                             $this->addCategory($create);
                         }
                     } elseif ($this->action === 'edit') {
                         if (isset($this->edit)) {
                             $data = parent::s_catalog_category_data($this->edit);
                             $create->assign('plugin', $plugin->menu_item_plugin('catalog_category'));
                             if (magixcjquery_filter_request::isGet('json_uri_category')) {
                                 $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
                                 $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
                                 $header->pragma();
                                 $header->cache_control("nocache");
                                 $header->getStatus('200');
                                 $header->json_header("UTF-8");
                                 $this->json_uri_category($data);
                             } elseif (magixcjquery_filter_request::isGet('json_list_subcategory')) {
                                 $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
                                 $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
                                 $header->pragma();
                                 $header->cache_control("nocache");
                                 $header->getStatus('200');
                                 $header->json_header("UTF-8");
                                 $this->json_listing_subcategory();
                             } else {
                                 if (isset($this->tab)) {
                                     if ($this->tab === 'image') {
                                         if (isset($this->img_c)) {
                                             $this->update_category_image($data);
                                         } elseif (magixcjquery_filter_request::isGet('ajax_category_image')) {
                                             $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
                                             $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
                                             $header->pragma();
                                             $header->cache_control("nocache");
                                             $header->getStatus('200');
                                             $header->html_header("UTF-8");
                                             $this->ajax_category_image($create, $data['img_c']);
                                         } else {
                                             $this->load_category_edit_data($create, $data);
                                             $create->display('catalog/category/edit.tpl');
                                         }
                                     } elseif ($this->tab === 'subcat') {
                                         if (isset($this->slibelle)) {
                                             $this->addSubCategory($create);
                                         } elseif (isset($this->order_pages)) {
                                             $this->update_order_subcategory();
                                         } elseif (isset($this->delete_subcategory)) {
                                             $this->remove_subcategory();
                                         } else {
                                             $this->load_category_edit_data($create, $data);
                                             $create->display('catalog/category/edit.tpl');
                                         }
                                     } elseif ($this->tab === 'product') {
                                         if (isset($this->order_pages)) {
                                             $this->update_order_category_product();
                                         } elseif (magixcjquery_filter_request::isGet('json_category_product')) {
                                             $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
                                             $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
                                             $header->pragma();
                                             $header->cache_control("nocache");
                                             $header->getStatus('200');
                                             $header->json_header("UTF-8");
                                             $this->json_listing_category_product();
                                         } elseif (isset($this->delete_product)) {
                                             $this->remove_product_category();
                                         } else {
                                             $this->load_category_edit_data($create, $data);
                                             $create->display('catalog/category/edit.tpl');
                                         }
                                     }
                                 } elseif (isset($this->plugin)) {
                                     // Chargement du plugin dans le produit du catalogue (edition)
                                     $this->load_category_edit_data($create, $data);
                                     $param_arr = array($this->plugin, $this->getlang, $this->edit);
                                     $plugin->extend_module($this->plugin, 'catalog_category', $param_arr);
                                 } else {
                                     if (isset($this->clibelle)) {
                                         $this->update_category($create);
                                     } elseif (isset($this->delete_image)) {
                                         $this->remove_category_image();
                                     } else {
                                         $this->load_category_edit_data($create, $data);
                                         $create->display('catalog/category/edit.tpl');
                                     }
                                 }
                             }
                         } else {
                             if (isset($this->order_pages)) {
                                 $this->update_order_category();
                             }
                         }
                     } elseif ($this->action === 'remove') {
                         $this->remove_category($create);
                     }
                 } else {
                     $create->display('catalog/category/list.tpl');
                 }
             }
         } elseif ($this->section === 'subcategory') {
             if (isset($this->getlang)) {
                 if (isset($this->action)) {
                     if ($this->action === 'add') {
                     } elseif ($this->action === 'edit') {
                         if (isset($this->edit)) {
                             $data = parent::s_catalog_subcategory_data($this->edit);
                             $create->assign('plugin', $plugin->menu_item_plugin('catalog_subcategory'));
                             if (isset($this->tab)) {
                                 if ($this->tab === 'image') {
                                     if (magixcjquery_filter_request::isGet('ajax_subcategory_image')) {
                                         $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
                                         $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
                                         $header->pragma();
                                         $header->cache_control("nocache");
                                         $header->getStatus('200');
                                         $header->html_header("UTF-8");
                                         $this->ajax_subcategory_image($create, $data['img_s']);
                                     } elseif (isset($this->img_s)) {
                                         $this->update_subcategory_image($data);
                                     } else {
                                         $this->load_subcategory_edit_data($create, $data);
                                         $create->display('catalog/subcategory/edit.tpl');
                                     }
                                 } elseif ($this->tab === 'product') {
                                     if (isset($this->order_pages)) {
                                         $this->update_order_subcategory_product();
                                     } elseif (magixcjquery_filter_request::isGet('json_subcategory_product')) {
                                         $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
                                         $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
                                         $header->pragma();
                                         $header->cache_control("nocache");
                                         $header->getStatus('200');
                                         $header->json_header("UTF-8");
                                         $this->json_listing_subcategory_product();
                                     } elseif (isset($this->delete_product)) {
                                         $this->remove_product_category();
                                     } else {
                                         $this->load_subcategory_edit_data($create, $data);
                                         $create->display('catalog/subcategory/edit.tpl');
                                     }
                                 }
                             } else {
                                 if (magixcjquery_filter_request::isGet('json_uri_subcategory')) {
                                     $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
                                     $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
                                     $header->pragma();
                                     $header->cache_control("nocache");
                                     $header->getStatus('200');
                                     $header->json_header("UTF-8");
                                     $this->json_uri_subcategory($data);
                                 } elseif (isset($this->slibelle)) {
                                     $this->update_subcategory($create);
                                 } elseif (isset($this->delete_image)) {
                                     $this->remove_subcategory_image();
                                 } elseif (isset($this->plugin)) {
                                     // Chargement du plugin dans le produit du catalogue (edition)
                                     $this->load_subcategory_edit_data($create, $data);
                                     $param_arr = array($this->plugin, $this->getlang, $this->edit);
                                     $plugin->extend_module($this->plugin, 'catalog_subcategory', $param_arr);
                                 } else {
                                     $this->load_subcategory_edit_data($create, $data);
                                     $create->display('catalog/subcategory/edit.tpl');
                                 }
                             }
                         }
                     }
                 }
             }
         } elseif ($this->section === 'product') {
             if (isset($this->getlang)) {
                 if (isset($this->action)) {
                     if ($this->action === 'list') {
                         if (magixcjquery_filter_request::isGet('json_listing_product')) {
                             $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
                             $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
                             $header->pragma();
                             $header->cache_control("nocache");
                             $header->getStatus('200');
                             $header->json_header("UTF-8");
                             $this->json_listing_product(20);
                         } elseif (magixcjquery_filter_request::isGet('idclc')) {
                             $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
                             $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
                             $header->pragma();
                             $header->cache_control("nocache");
                             $header->getStatus('200');
                             $header->json_header("UTF-8");
                             $this->json_idcls($this->getidclc);
                         } elseif (isset($this->title_search)) {
                             $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
                             $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
                             $header->pragma();
                             $header->cache_control("nocache");
                             $header->getStatus('200');
                             $header->json_header("UTF-8");
                             $this->json_list_product();
                         } elseif (isset($this->name_product)) {
                             $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
                             $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
                             $header->pragma();
                             $header->cache_control("nocache");
                             $header->getStatus('200');
                             $header->json_header("UTF-8");
                             $this->json_autocomplete_product();
                         }
                     } elseif ($this->action === 'add') {
                         if (isset($this->titlecatalog)) {
                             $this->addProduct($create);
                         }
                     } elseif ($this->action === 'edit') {
                         $data = parent::s_catalog_data($this->edit);
                         $create->assign('plugin', $plugin->menu_item_plugin('catalog_product'));
                         if (isset($this->tab)) {
                             if ($this->tab === 'image') {
                                 if (isset($this->imgcatalog)) {
                                     $this->update_product_image($data);
                                 } elseif (magixcjquery_filter_request::isGet('ajax_product_image')) {
                                     $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
                                     $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
                                     $header->pragma();
                                     $header->cache_control("nocache");
                                     $header->getStatus('200');
                                     $header->html_header("UTF-8");
                                     $this->ajax_product_image($create, $data['imgcatalog']);
                                 } else {
                                     $this->load_product_edit_data($create, $data);
                                     $create->display('catalog/product/edit.tpl');
                                 }
                             } elseif ($this->tab === 'category') {
                                 if (magixcjquery_filter_request::isGet('json_product_category')) {
                                     $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
                                     $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
                                     $header->pragma();
                                     $header->cache_control("nocache");
                                     $header->getStatus('200');
                                     $header->json_header("UTF-8");
                                     $this->json_listing_product_category();
                                 } elseif (isset($this->idclc)) {
                                     $this->add_product_category();
                                 } elseif (isset($this->delete_product)) {
                                     $this->remove_product_category();
                                 } else {
                                     $this->load_product_edit_data($create, $data);
                                     $create->assign('array_list_category', $this->array_list_category());
                                     $create->display('catalog/product/edit.tpl');
                                 }
                             } elseif ($this->tab === 'product') {
                                 if (isset($this->idproduct)) {
                                     $this->addProductRel($create);
                                 } elseif (magixcjquery_filter_request::isGet('json_product_rel')) {
                                     $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
                                     $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
                                     $header->pragma();
                                     $header->cache_control("nocache");
                                     $header->getStatus('200');
                                     $header->json_header("UTF-8");
                                     $this->json_listing_product_rel();
                                 } elseif (isset($this->delete_product)) {
                                     $this->remove_product_rel();
                                 } else {
                                     $this->load_product_edit_data($create, $data);
                                     $create->display('catalog/product/edit.tpl');
                                 }
                             } elseif ($this->tab === 'galery') {
                                 if (magixcjquery_filter_request::isGet('json_list_galery')) {
                                     $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
                                     $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
                                     $header->pragma();
                                     $header->cache_control("nocache");
                                     $header->getStatus('200');
                                     $header->json_header("UTF-8");
                                     $this->json_list_galery();
                                 } elseif (isset($this->img_order)) {
                                     $this->update_order_galery();
                                 } elseif (isset($this->imgcatalog)) {
                                     $this->add_galery_image();
                                 } elseif (isset($this->delete_galery)) {
                                     $this->remove_product_galery();
                                 } else {
                                     $this->load_product_edit_data($create, $data);
                                     $create->display('catalog/product/edit.tpl');
                                 }
                             }
                         } else {
                             if (isset($this->delete_image)) {
                                 $this->remove_product_image();
                             }
                             if (isset($this->titlecatalog)) {
                                 $this->update_product($create);
                             } elseif (isset($this->plugin)) {
                                 // Chargement du plugin dans le produit du catalogue (edition)
                                 $this->load_product_edit_data($create, $data);
                                 $param_arr = array($this->plugin, $this->getlang, $this->edit);
                                 $plugin->extend_module($this->plugin, 'catalog_product', $param_arr);
                             } else {
                                 $this->load_product_edit_data($create, $data);
                                 $create->display('catalog/product/edit.tpl');
                             }
                         }
                     } elseif ($this->action === 'remove') {
                         $this->remove_product();
                     } elseif ($this->action === 'copy') {
                         if (isset($this->copy)) {
                             $this->copy_product();
                         }
                     } elseif ($this->action === 'move') {
                         if (isset($this->move)) {
                             $this->move_product();
                         }
                     }
                 } else {
                     $create->assign('select_lang', $this->lang_select());
                     $create->assign('pagination', $this->product_pagination(20));
                     $create->display('catalog/product/list.tpl');
                 }
             }
         }
     } else {
         if (magixcjquery_filter_request::isGet('json_graph')) {
             $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
             $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
             $header->pragma();
             $header->cache_control("nocache");
             $header->getStatus('200');
             $header->json_header("UTF-8");
             $this->json_graph();
         } elseif (isset($this->product_search)) {
             $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
             $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
             $header->pragma();
             $header->cache_control("nocache");
             $header->getStatus('200');
             $header->json_header("UTF-8");
             $this->json_url_product();
         } else {
             $create->display('catalog/index.tpl');
         }
     }
 }