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 getItem($id = null)
 {
     $id = $id ? $id : $this->getState('id');
     $table = new model_core_table('langvalues');
     if ($this->getState('lang_id')) {
         $table->setState('lnv_id', $id);
     }
     return $table->getItem($id);
 }
Exemplo n.º 5
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.º 6
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.º 7
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.º 8
0
 protected function activateUser()
 {
     $c = urldecode($this->request('c'));
     $this->setVar('onlymessage', true);
     if ($c) {
         $this->setVar('action', 'c');
         $model = rad_instances::get('model_core_users');
         $model->setState('code', $c);
         $user = $model->getItem();
         if (isset($user->u_id) and $user->u_id) {
             if ($user->u_email_confirmed) {
                 $table = new model_core_table('subscribers_activationurl', 'coremail');
                 $table->setState('sac_url', $c);
                 $activation = $table->getItem();
                 if ($activation) {
                     if ($model->emailExists($activation->email, $user->u_id)) {
                         $this->setVar('message', $this->lang('mail_alreadyregistred.registration.text', null, true));
                     } else {
                         $user->u_email = $activation->email;
                         $model->updateItem($user);
                         rad_session::updateUserData($user->u_id);
                         rad_instances::get('model_coremail_subscribes')->confirm($c);
                         $this->setVar('message', $this->lang('subscribers.mailactivated.text', null, true));
                     }
                 } else {
                     $this->setVar('message', $this->lang($this->config('registration.code_not_found')));
                 }
             } elseif (!($error = $this->beforeActivateUser($user))) {
                 $user->u_email_confirmed = 1;
                 $model->updateItem($user);
                 rad_instances::get('model_coremail_subscribes')->confirm($c);
                 /* make referals component */
                 if ($this->config('referals.on') and class_exists('struct_coresession_referals_users')) {
                     $this->setReferral($user);
                 }
                 $this->setVar('message', $this->lang($this->config('registration.mailactivated_text')));
                 //send message to user
                 $this->_sendMail($user, 'register_ok');
                 $this->_sendMail($user, 'send_admin');
             } else {
                 $this->setVar('message', is_array($error) ? implode('<br />', $error) : $error);
             }
         } else {
             //code not found
             $this->setVar('message', $this->lang($this->config('registration.code_not_found')));
         }
     } else {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
 }
Exemplo n.º 9
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.º 10
0
 /**
  * Copy components from theme
  */
 private function copyComponentsFromTheme()
 {
     $theme = trim($this->request('theme'));
     $alias_id = (int) $this->request('alias_id');
     $from = trim($this->request('from'));
     if ($alias_id && $theme != $from && (!$from || is_dir(THEMESPATH . $from)) && (!$theme || is_dir(THEMESPATH . $theme))) {
         $model = rad_instances::get('model_core_aliases');
         if (strlen($from)) {
             $model->setState('theme', $from);
         }
         $item = $model->getItem($alias_id);
         $struct = new struct_core_includes_in_aliases();
         if ($theme) {
             $table = new model_core_table('themes');
             $table->setState('where', 'theme_aliasid=' . $alias_id . ' and theme_folder="' . $theme . '"');
             $themes_obj = $table->getItem();
             $struct->theme_id = $themes_obj->theme_id;
         }
         $struct->alias_id = $alias_id;
         if (!empty($item->includes)) {
             $this->deleteComponentsFromTheme($alias_id, $theme);
             $ret = true;
             foreach ($item->includes as $include) {
                 /** @var struct_core_include $include */
                 $struct->include_id = $include->inc_id;
                 $struct->controller = $include->controller;
                 $struct->order_sort = $include->order_sort;
                 $struct->position_id = $include->rp_id;
                 $struct->params_hash = $include->params_hash;
                 $model = rad_instances::get('model_core_includes');
                 if (!$model->insertItem($struct)) {
                     $ret = false;
                     break;
                 }
             }
             $this->clearAliasCache(rad_instances::get('model_core_aliases')->getItem($struct->alias_id));
             if (!$ret) {
                 echo "ERROR!!!! '.__LINE__.' Problem in DB";
             }
         } else {
             echo $this->lang('nocomponentstocopy.aliases.error');
         }
     } else {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
 }
Exemplo n.º 11
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.º 12
0
 function getItems()
 {
     $model = new model_core_table('measurement', 'corecatalog');
     $model->setState('where', 'ms_langid=' . (int) $this->getContentLangID());
     $this->setVar('items', $model->getItems());
 }