Exemplo n.º 1
0
 function getItems()
 {
     if (!$this->_langCache or true) {
         $table = new model_core_table('lang');
         $table->setState('order by', 'lng_position, lng_name');
         if ($this->getState('where')) {
             $table->setState('where', $this->getState('where'));
         }
         $this->_langCache = $table->getItems();
     }
     return $this->_langCache;
 }
Exemplo n.º 2
0
 /**
  * Assign Votes in category ans for showing on site
  */
 function assignRubricVotes()
 {
     $vt_id = (int) $this->request('v');
     if ($vt_id) {
         $this->setVar('$showOneVote', true);
         $this->showVoteRandom($vt_id);
     } else {
         $table = new model_core_table('votes', 'coreothers');
         $table->setState('where', 'vt_lngid=' . $this->getCurrentLangID() . ' and vt_treid=' . (int) $this->request('vcp', $this->_pid));
         $table->setState('showSQL', true);
         $items = $table->getItems();
         $this->setVar('votes', $items);
     }
 }
Exemplo n.º 3
0
 function getQuestions($limit = NULL)
 {
     $item_id = (int) $this->getState('item_id', $this->getState('vt_id'));
     if ($item_id) {
         $table = new model_core_table('votes_questions', 'coreothers');
         $table->setState('where', 'vtq_vtid=' . $item_id);
         return $table->getItems($limit);
     } else {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
 }
Exemplo n.º 4
0
 function assignItems()
 {
     $model = new model_core_table('delivery', 'corecatalog');
     $model->setState('where', 'rdl_lang=' . (int) $this->getContentLangID());
     $items = $model->getItems();
     $this->setVar('items', $items);
 }
Exemplo n.º 5
0
 function addProductForm()
 {
     $model = rad_instances::get('model_coremenus_tree');
     $model->setState('pid', $this->request('pid', $this->_pid));
     $this->setVar('trees', $model->getItems(true));
     $this->setVar('selected_tree', array($this->request('node_id')));
     $model->setState('pid', $this->_pid_types);
     $producttypes = $model->getItems(true);
     $firest_el = new struct_coremenus_tree(array('tre_name' => $this->lang('-pleaseselect')));
     array_unshift($producttypes, $firest_el);
     $this->setVar('producttypes', $producttypes);
     $this->setVar('currencys', rad_instances::get('model_corecatalog_currency')->getItems());
     $model->clearState();
     // -- breadcrumbs
     if ($this->product) {
         if ($this->product->cat_id == 0) {
             $this->product->tags = array('req' => $this->request('producttags'), 'error' => true);
         } else {
             $product = $this->product;
             if ($this->_have_tags) {
                 $product->tags = array();
                 if (strlen(trim($this->request('producttags')))) {
                     $model_tags = rad_instances::get('model_coreresource_tags');
                     $model_tags->setState('tag_type', 'product');
                     $model_tags->asignTagsToItem($product);
                 }
             }
         }
         $this->setVar('product', $this->product);
         if (count($this->product->tree_link)) {
             $curr_cat = $model->getItem($this->product->tree_link[0]->cit_tre_id);
             $mas = array();
             foreach ($this->product->tree_link as $id) {
                 $mas[] = $id->cit_tre_id;
             }
             $this->setVar('selected_tree', $mas);
         }
     } else {
         $this->setVar('product', new struct_corecatalog_catalog());
         $curr_cat = $model->getItem($this->request('node_id'));
         $this->setVar('selected_tree', array($this->request('node_id')));
     }
     $this->setVar('cleanurl_enabled', rad_config::getParam('cleanurl.on'));
     $this->addBC('curr_cat', $curr_cat);
     $cat_path = $model->getCategoryPath($curr_cat, $this->_pid, 0);
     unset($cat_path[0]);
     $this->addBC('parents', $cat_path);
     // -- end
     /** 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 = rad_instances::get('model_corecatalog_brands');
     $this->setVar('brands', $model->getListBrands());
     $this->setVar('max_post', $this->configSys('max_post'));
     $this->setVar('max_post', $this->configSys('max_post'));
     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);
 }
Exemplo n.º 6
0
 /**
  * Saves the type showed fields
  * @param integer $type_id
  */
 private function saveTypeFieldsShow($type_id)
 {
     if ($type_id) {
         $model = new model_core_table('ct_showing', 'corecatalog');
         $model->setState('where', ' cts_vl_id=' . $type_id . ' ');
         $items = $model->getItems();
         if (count($items)) {
             foreach ($items as $id) {
                 $model->deleteItem($id);
             }
             //foreach
         }
         //if
         $added_items = array();
         if ($this->_showinlist) {
             if ($this->request('CTshowing_showinlist_catalog_option')) {
                 $added_items[] = new struct_corecatalog_ct_showing(array('cts_vl_id' => $type_id, 'cts_show' => $this->_showinlistID));
             }
         }
         if ($this->_showindetail) {
             if ($this->request('CTshowing_showindetail_catalog_option')) {
                 $added_items[] = new struct_corecatalog_ct_showing(array('cts_vl_id' => $type_id, 'cts_show' => $this->_showindetailID));
             }
         }
         if ($this->_showinbin) {
             if ($this->request('CTshowing_showinbin_catalog_option')) {
                 $added_items[] = new struct_corecatalog_ct_showing(array('cts_vl_id' => $type_id, 'cts_show' => $this->_showinbinID));
             }
         }
         $rows = 0;
         if (count($added_items)) {
             foreach ($added_items as $id) {
                 $rows += $model->insertItem($id);
             }
             if (!count($rows)) {
                 throw new rad_exception('Can\'t save the showing type! file: ' . __FILE__ . ', line: ' . __LINE__);
             }
             return $rows;
         }
     } else {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
 }
Exemplo n.º 7
0
 function getItems($limit = NULL)
 {
     $table = new model_core_table('includes');
     $table->setState('left join', RAD . 'modules m on m.m_id = id_module');
     return $table->getItems($limit);
 }
Exemplo n.º 8
0
 function assignPositions()
 {
     $table = new model_core_table('positions');
     $table->setState('order by', 'rp_name');
     $this->setVar('positions', $table->getItems());
 }
Exemplo n.º 9
0
 /**
  * Special offers module, for New products, Sales, hit of sales e t.c.
  *
  * @param unknown_type $item
  */
 function updateOffers(struct_corecatalog_catalog $item)
 {
     $table = new model_core_table('cat_special', 'corecatalog');
     $table->setState('where', 'cs_catid=' . (int) $item->cat_id);
     $offers = $table->getItems();
     $exist_offers = array();
     if (count($offers)) {
         for ($i = 0; $i < count($offers); $i++) {
             $exist_offers[$offers[$i]->cs_type] =& $offers[$i];
         }
     }
     //NEW PRODUCT
     if ($item->cat_special_spnews and !isset($exist_offers[1])) {
         $exist_offers[1] = new struct_corecatalog_cat_special();
         $exist_offers[1]->cs_type = 1;
         $exist_offers[1]->cs_catid = $item->cat_id;
         $exist_offers[1]->insert();
     } elseif (!$item->cat_special_spnews and isset($exist_offers[1])) {
         $exist_offers[1]->remove();
     }
     //SPECIAL OFFER
     if ($item->cat_special_sp and !isset($exist_offers[2])) {
         $exist_offers[2] = new struct_corecatalog_cat_special();
         $exist_offers[2]->cs_type = 2;
         $exist_offers[2]->cs_catid = $item->cat_id;
         $exist_offers[2]->insert();
     } elseif (!$item->cat_special_sp and isset($exist_offers[2])) {
         $exist_offers[2]->remove();
     }
     //SALES
     if ($item->cat_special_spoffer and !isset($exist_offers[3])) {
         $exist_offers[3] = new struct_corecatalog_cat_special();
         $exist_offers[3]->cs_type = 3;
         $exist_offers[3]->cs_catid = $item->cat_id;
         $exist_offers[3]->insert();
     } elseif (!$item->cat_special_spoffer and isset($exist_offers[3])) {
         $exist_offers[3]->remove();
     }
     //HIT OF SALES
     if ($item->cat_special_sphit and !isset($exist_offers[4])) {
         $exist_offers[4] = new struct_corecatalog_cat_special();
         $exist_offers[4]->cs_type = 4;
         $exist_offers[4]->cs_catid = $item->cat_id;
         $exist_offers[4]->insert();
     } elseif (!$item->cat_special_sphit and isset($exist_offers[4])) {
         $exist_offers[4]->remove();
     }
 }
Exemplo n.º 10
0
 function getItems()
 {
     $model = new model_core_table('measurement', 'corecatalog');
     $model->setState('where', 'ms_langid=' . (int) $this->getContentLangID());
     $this->setVar('items', $model->getItems());
 }