Пример #1
0
 /**
  * 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;
 }
Пример #2
0
 /**
  * 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;
 }
Пример #3
0
 /**
  * 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);
 }
Пример #4
0
 /**
  * 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;
 }
Пример #5
0
 /**
  * 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);
 }
Пример #6
0
 /**
  * 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));
     }
 }
Пример #7
0
 /**
  * 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();
 }
Пример #8
0
 /**
  * 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));
     }
 }
Пример #9
0
 /**
  * Constructor method
  *
  * @access public
  * @param null
  * @return null
  */
 public function __construct()
 {
     $this->_search = array('source', 'destination');
     parent::__construct('url');
 }
Пример #10
0
 /**
  * Constructor method
  *
  * @access public
  * @param null
  * @return null
  */
 public function __construct()
 {
     $this->_search = array('description');
     parent::__construct('store');
 }
Пример #11
0
 /**
  * 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();
 }
Пример #12
0
 /**
  * Constructor
  *
  * @access public
  * @param null
  * @return null
  */
 public function __construct()
 {
     $this->_orderby_title = 'name';
     parent::__construct('plugin', 'plugins', 'id');
 }
Пример #13
0
 /**
  * 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();
 }
Пример #14
0
 /**
  * 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;
 }
Пример #15
0
 /**
  * Constructor method
  *
  * @access public
  * @param null
  * @return null
  */
 public function __construct()
 {
     $this->_orderby_title = 'description';
     parent::__construct('usergroup');
 }
Пример #16
0
 /**
  * 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();
 }
Пример #17
0
 /**
  * Constructor method
  *
  * @access public
  * @param null
  * @return null
  */
 public function __construct()
 {
     $this->_checkout = false;
     $this->_search = array('description');
     parent::__construct('usergroup');
 }