/** * Method to remove a category * * @access public * @param array $cid * @return boolean */ public function delete($cid = array()) { if (count($cid)) { JArrayHelper::toInteger($cid); $cids = implode(',', $cid); // Check if the category is empty $query = 'SELECT `id` FROM `#__simplelists_categories` WHERE `category_id` IN ( ' . $cids . ' )'; $this->_db->setQuery($query); $rows = $this->_db->loadAssocList(); if (!empty($rows)) { $this->setError(JText::_('Category not empty')); return false; } // Check if this category serves as parent for others $query = 'SELECT `id` FROM `#__categories` WHERE `parent_id` IN ( ' . $cids . ' )'; $this->_db->setQuery($query); $rows = $this->_db->loadAssocList(); if (!empty($rows)) { $this->setError(JText::_('Category is still parent')); return false; } // Call the parent function if (parent::delete($cid) == false) { return false; } // Also remove all item/category relations $query = 'DELETE FROM `#__simplelists_categories` WHERE `category_id` IN (' . $cids . ')'; $this->_db->setQuery($query); if (!$this->_db->query()) { $this->setError($this->_db->getErrorMsg()); return false; } } return true; }
/** * Method to store the item * * @package MageBridge * @access public * @param array $data * @return bool */ public function store($data) { if (!empty($data['store'])) { $values = explode(':', $data['store']); $data['type'] = $values[0] == 'g' ? 'storegroup' : 'storeview'; $data['name'] = $values[1]; $data['title'] = $values[2]; unset($data['store']); } else { $this->setError(JText::_('COM_MAGEBRIDGE_MODEL_STORE_NO_STORE_SELECTED')); return false; } if (!empty($data['default']) && $data['default']) { $this->storeDefault($data['type'], $data['name']); return true; } if (empty($data['name']) || empty($data['title'])) { $this->setError(JText::_('COM_MAGEBRIDGE_MODEL_STORE_INVALID_STORE')); return false; } if (empty($data['label'])) { $data['label'] = $data['title']; } $rt = parent::store($data); if ($rt == true && $data['published'] == 1) { MageBridge::getConfig()->saveValue('load_stores', 1); } return $rt; }
/** * Method to store the item * * @package MageBridge * @access public * @param array $data * @return bool */ public function store($data) { if (empty($data['label'])) { $data['label'] = $data['sku']; } $data['connector'] = ''; $data['connector_value'] = ''; return parent::store($data); }
/** * Method to store the item * * @package MageBridge * @access public * @param array $data * @return bool */ public function store($data) { // Store the item $rt = parent::store($data); // Change the setting "load_urls" in the MageBridge configuration if ($data['published'] == 1) { MagebridgeModelConfig::saveValue('load_urls', 1); } return $rt; }
/** * Method to store the item * * @package MageBridge * @access public * @param array $data * @return bool */ public function store($data) { // Prepare the data $now = new JDate('now'); // Build the data $data['remote_addr'] = $_SERVER['REMOTE_ADDR']; $data['http_agent'] = $_SERVER['HTTP_USER_AGENT']; $data['timestamp'] = $now->toSql(); return parent::store($data); }
/** * Constructor method * * @access public * @param null * @return null */ public function __construct() { $this->_checkout = false; $this->_search = array('label', 'sku'); parent::__construct('product'); $connector = $this->getFilter('connector'); if (!empty($connector)) { $this->addWhere($this->_tbl_alias . '.`connector` = ' . $this->_db->Quote($connector)); } }
/** * Method to build the query WHERE segment * * @access protected * @param null * @return string */ protected function buildQueryWhere() { $category_id = (int) $this->getFilter('category_id'); if ($category_id > 0) { $this->addWhere('item.id IN (SELECT `id` FROM `#__simplelists_categories` WHERE `category_id`=' . $category_id . ')'); } $link_type = $this->getFilter('link_type'); if (!empty($link_type)) { $this->addWhere('item.link_type =' . $this->_db->Quote($link_type)); } return parent::buildQueryWhere(); }
/** * Constructor * * @access public * @param null * @return null */ public function __construct() { $this->_checkout = false; $this->_search = array('message', 'session', 'http_agent'); parent::__construct('log'); $origin = $this->getFilter('origin'); if (!empty($origin)) { $this->addWhere($this->_tbl_alias . '.`origin` = ' . $this->_db->Quote($origin)); } $remote_addr = $this->getFilter('remote_addr'); if (!empty($remote_addr)) { $this->addWhere($this->_tbl_alias . '.`remote_addr` = ' . $this->_db->Quote($remote_addr)); } $type = $this->getFilter('type'); if (!empty($type)) { $this->addWhere($this->_tbl_alias . '.`type` = ' . $this->_db->Quote($type)); } }
/** * Constructor method * * @access public * @param null * @return null */ public function __construct() { $this->_search = array('source', 'destination'); parent::__construct('url'); }
/** * Constructor method * * @access public * @param null * @return null */ public function __construct() { $this->_search = array('description'); parent::__construct('store'); }
/** * Method to build the query ORDER BY segment * * @access protected * @subpackage Yireo * @param null * @return string */ protected function buildQueryOrderBy() { if (YireoHelper::isJoomla15()) { $default_ordering = 'ordering'; } else { $default_ordering = 'lft, rgt'; } $orderby = $this->params->get('cat_orderby', $default_ordering); if ($orderby == 'alpha') { $this->addOrderBy('`category`.`title` ASC'); } elseif ($orderby == 'ralpha') { $this->addOrderBy('`category`.`title` DESC'); } else { if ($orderby == 'ordering') { $orderby = $default_ordering; } $this->addOrderBy('`category`.' . $orderby); } return parent::buildQueryOrderBy(); }
/** * Constructor * * @access public * @param null * @return null */ public function __construct() { $this->_orderby_title = 'name'; parent::__construct('plugin', 'plugins', 'id'); }
/** * Method to build the query ORDER BY segment * * @access protected * @subpackage Yireo * @param null * @return string */ protected function buildQueryOrderBy() { $ordering = $this->params->get('orderby'); switch ($ordering) { case 'alpha': $orderby = 'item.title ASC'; break; case 'ralpha': $orderby = 'item.title DESC'; break; case 'date': $orderby = 'item.created DESC, item.modified DESC'; break; case 'rdate': $orderby = 'item.created ASC, item.modified ASC'; break; case 'random': $orderby = 'RAND()'; break; case 'rorder': $orderby = 'item.ordering DESC'; break; default: $orderby = 'item.ordering'; break; } $this->addOrderby($orderby); return parent::buildQueryOrderBy(); }
/** * Method to load data * * @access public * @param null * @return boolean */ public function getData() { // Lets load the content if it doesn't already exist $this->_data = parent::getData(); // If these data exist, add extra info if (empty($this->_data)) { // Fetch the extra link data if (!isset($this->_data->link_data)) { $this->_data->link_data = array(); if (!empty($this->_data->link_type)) { $plugin = SimplelistsPluginHelper::getPlugin('simplelistslink', $this->_data->link_type); if (!empty($plugin)) { $this->_data->link_data[$this->_data->link_type] = $plugin->getName($this->_data->link); } } } } return $this->_data; }
/** * Constructor method * * @access public * @param null * @return null */ public function __construct() { $this->_orderby_title = 'description'; parent::__construct('usergroup'); }
/** * Method to build the query WHERE segment * * @access protected * @param null * @return string */ protected function buildQueryWhere() { $this->addWhere('plugin.type = "plugin"'); $this->addWhere('plugin.folder = "simplelistslink"'); return parent::buildQueryWhere(); }
/** * Constructor method * * @access public * @param null * @return null */ public function __construct() { $this->_checkout = false; $this->_search = array('description'); parent::__construct('usergroup'); }