Пример #1
0
 /**
  * Edit the product - shows the edit form
  *
  * @return html Full page edit form
  */
 function editForm()
 {
     $cat_id = (int) $this->request('cat_id');
     if ($cat_id) {
         $this->setVar('cat_id', $cat_id);
         $model = rad_instances::get('model_coremenus_tree');
         $model->setState('pid', $this->request('pid', $this->_pid))->setState('lang', $this->getContentLangID());
         $this->setVar('trees', $model->getItems(true));
         $model->setState('pid', $this->_pid_types);
         $producttypes = $model->getItems(true);
         $firest_el = new struct_coremenus_tree();
         $firest_el->tre_name = $this->lang('-pleaseselect');
         array_unshift($producttypes, $firest_el);
         $this->setVar('producttypes', $producttypes);
         $this->setVar('currencys', rad_instances::get('model_corecatalog_currency')->getItems());
         /** FOR MEASUREMENT IN RIGHT PANEL WHITCH NAMED "MAGAZINE"
             $model = new model_core_table('measurement','corecatalog');
             $model->setState('order by','ms_position,ms_value');
             $measurements = $model->getItems();
             $this->setVar( 'measurements', $measurements );
              */
         $model_product = rad_instances::get('model_corecatalog_catalog');
         if ($this->_have_downloads) {
             $model_product->setState('with_download_files', true);
         }
         if ($this->_have_tags) {
             $model_product->setState('with_tags', true);
         }
         $product = $model_product->getItem($cat_id);
         $this->addBC('product', $product->cat_name);
         $model->clearState();
         $tree_link = $this->product ? $this->product->tree_link : $product->tree_catin_link;
         if (count($tree_link)) {
             $curr_cat = $model->getItem($tree_link[0]->cit_tre_id);
             $this->addBC('curr_cat', $curr_cat);
             $cat_path = $model->getCategoryPath($curr_cat, $this->_pid, 0);
             unset($cat_path[0]);
             $this->addBC('parents', $cat_path);
             $mas = array();
             foreach ($tree_link as $id) {
                 $mas[] = $id->cit_tre_id;
             }
             $this->setVar('selected_tree', $mas);
         }
         //if count catin_link
         $model = rad_instances::get('model_corecatalog_brands');
         $this->setVar('brands', $model->getListBrands());
         $this->setVar('product', $product);
         $this->setVar('cleanurl_enabled', rad_config::getParam('cleanurl.on'));
         if ($cat_id && rad_config::getParam('cleanurl.on')) {
             $this->setVar('url_alias', rad_cleanurl::getAlias('product', $cat_id));
         }
         include_once 'helpers' . DS . 'fileuploader.php';
         $uploader = new fileuploader($this);
         $imageWidgets = array($uploader->initWidget('images', array(), '', CORECATALOG_IMG_PATH, 'catalog', true));
         $this->setVar('widgets', $imageWidgets);
         $this->get3DBinItems($cat_id);
     } else {
         //if $cat_id
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
 }