Ejemplo n.º 1
0
 /**
  * Constructor
  *
  * @since 1.5
  */
 function __construct()
 {
     $input = JFactory::getApplication()->input;
     parent::__construct();
     $id = $input->getInt('id', 0);
     $this->setId($id);
 }
Ejemplo n.º 2
0
 public function getList($refresh = false)
 {
     $list = parent::getList($refresh);
     foreach ($list as $item) {
         if (version_compare(JVERSION, '1.6.0', 'ge')) {
             $item->id = $item->extension_id;
         }
         $item->link = 'index.php?option=com_citruscart&view=reports&task=view&id=' . $item->id;
     }
     return $list;
 }
Ejemplo n.º 3
0
 /**
  * Gets an item for displaying (as opposed to saving, which requires a JTable object)
  * using the query from the model and the tbl's unique identifier
  *
  * @return database->loadObject() record
  */
 public function getItem($pk = null, $refresh = false, $emptyState = true)
 {
     parent::getItem($emptyState);
     // adding this in the model so we don't have to have if statemnets all over the views and controllers'
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         if (!empty($this->_item->extension_id)) {
             $this->_item->id = $this->_item->extension_id;
         }
     }
     return $this->_item;
 }
Ejemplo n.º 4
0
 public function getItem($pk = null, $refresh = false, $emptyState = true)
 {
     if ($item = parent::getItem($pk)) {
         // Convert the params field to an array.
         if (version_compare(JVERSION, '1.6.0', 'ge')) {
             $formdata = new JRegistry();
             $formdata->loadString($item->params);
             $item->data = $formdata->toArray('data');
         }
     }
     return $item;
 }
Ejemplo n.º 5
0
 public function getList($refresh = false)
 {
     $list = parent::getList($refresh);
     // If no item in the list, return an array()
     if (empty($list)) {
         return array();
     }
     foreach ($list as $item) {
         $item->link_remove = 'index.php?option=com_citruscart&controller=shippingrates&task=delete&cid[]=' . $item->shipping_rate_id;
     }
     return $list;
 }
Ejemplo n.º 6
0
 public function getList($refresh = false)
 {
     if (empty($this->_list) || $refresh) {
         $list = parent::getList($refresh);
         $nullDate = JFactory::getDBO()->getNullDate();
         if (empty($list)) {
             return array();
         }
         foreach ($list as $item) {
             // convert working dates to localtime for display
             $item->publishing_date = $item->publishing_date != $nullDate ? JHTML::_("date", $item->publishing_date, '%Y-%m-%d %H:%M:%S') : $item->publishing_date;
         }
         $this->_list = $list;
     }
     return $this->_list;
 }
Ejemplo n.º 7
0
 public function getList($emptyState = true)
 {
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/tables');
     $list = parent::getList($emptyState);
     // If no item in the list, return an array()
     if (empty($list)) {
         return array();
     }
     foreach ($list as $item) {
         if ($product_attributes = explode(',', $item->product_attributes)) {
             $product_attribute_names = array();
             foreach ($product_attributes as $pao_id) {
                 $pao = JTable::getInstance('ProductAttributeOptions', 'CitruscartTable');
                 $pao->load($pao_id);
                 $product_attribute_names[] = JText::_($pao->productattributeoption_name);
             }
             $item->product_attribute_names = implode(', ', $product_attribute_names);
         }
     }
     return $list;
 }
Ejemplo n.º 8
0
 public function getList($refresh = false)
 {
     $list = parent::getList($refresh);
     // If no item in the list, return an array()
     if (empty($list)) {
         return array();
     }
     $filter_zip = $this->getState('filter_zip');
     foreach ($list as $key => $item) {
         // Check the zip range
         if (strlen($filter_zip)) {
             $in_range = false;
             $ranges = explode(";", $item->zip_range);
             if (empty($item->zip_range)) {
                 // no zip range defined, so assume the geozone covers all of them
                 $in_range = true;
             }
             foreach ($ranges as $range) {
                 if (strlen($range)) {
                     $temp = explode("-", $range);
                     $start = $temp[0];
                     $end = $temp[1];
                     // check that it is in range
                     if ($filter_zip <= $end && $filter_zip >= $start) {
                         $in_range = true;
                     } elseif ($filter_zip == $start) {
                         $in_range = true;
                     }
                 }
             }
             // in not in the ranges, unset it
             if (!$in_range) {
                 unset($list[$key]);
             }
         }
         $item->link = "index.php?option=com_citruscart&controller=zonerelations&view=zonerelations&tmpl=component&task=edit&geozoneid={$item->geozone_id}&id={$item->zonerelation_id}";
     }
     return $list;
 }
Ejemplo n.º 9
0
 /**
  * Set basic properties for the item, whether in a list or a singleton
  *
  * @param unknown_type $item
  * @param unknown_type $key
  * @param unknown_type $refresh
  */
 protected function prepareItem(&$item, $key = 0, $refresh = false)
 {
     $item->link = 'index.php?option=com_citruscart&view=addresses&task=edit&id=' . $item->address_id;
     /*
      * check extra fields empty or not
      */
     if (!empty($item->extra_fields)) {
         $extra_fields = new DSCParameter(trim($item->extra_fields));
         $extra_fields = $extra_fields->toArray();
         foreach ($extra_fields as $k => $v) {
             $item->{$k} = $v;
         }
     }
     /*
      * refer parent prepareItem method.
      */
     parent::prepareItem($item, $key, $refresh);
 }
Ejemplo n.º 10
0
 /**
  * Set basic properties for the item, whether in a list or a singleton
  *
  * @param unknown_type $item
  * @param unknown_type $key
  * @param unknown_type $refresh
  */
 protected function prepareItem(&$item, $key = 0, $refresh = false)
 {
     $input = JFactory::getApplication()->input;
     $getEav = $this->_getEav;
     $options = $this->_getEavOptions;
     $eavStates = count($this->getEavState()->getProperties());
     if (!empty($getEav) || $eavStates > 0) {
         $app = JFactory::getApplication();
         $editable_by = $app->isAdmin() ? 1 : 2;
         $view = $input->get('view', '');
         if ($app->isAdmin() && $view == 'pos') {
             $editable_by = array(1, 2);
         }
         Citruscart::load('CitruscartModelEavAttributes', 'models.eavattributes');
         Citruscart::load("CitruscartHelperBase", 'helpers._base');
         $eav_helper = CitruscartHelperBase::getInstance('Eav');
         $entity = $this->getTable()->get('_suffix');
         $tbl_key = $this->getTable()->getKeyName();
         $entity_id = $item->{$tbl_key};
         // add the custom fields as properties
         $eavs = $eav_helper->getAttributes($entity, $entity_id, false, $editable_by);
         // Mirrored table?
         if (!count($eavs) && strlen($this->getTable()->getLinkedTable())) {
             $entity = $this->getTable()->getLinkedTable();
             $entity_id = $item->{$this->getTable()->getLinkedTableKeyName()};
             $eavs = $eav_helper->getAttributes($entity, $entity_id, false, $editable_by);
         }
         foreach ($eavs as $eav) {
             $key = $eav->eavattribute_alias;
             $add = true;
             // Include Mode: Fetch only these fields
             if (array_key_exists('include', $options)) {
                 foreach ($options['include'] as $k) {
                     if ($key != $k) {
                         $add = false;
                     }
                 }
             } else {
                 // Exclude Mode: Fetch everything except these fields
                 if (array_key_exists('exclude', $options)) {
                     foreach ($options['exclude'] as $k) {
                         if ($key == $k) {
                             $add = false;
                         }
                     }
                 }
                 // Default Mode: Fetch Everything
             }
             if ($add) {
                 $value = $eav_helper->getAttributeValue($eav, $this->getTable()->get('_suffix'), $item->{$tbl_key}, false, true);
                 // Do NOT override properties
                 if (!property_exists($item, $key)) {
                     $item->{$key} = $value;
                 }
             }
         }
     }
     parent::prepareItem($item, $key, $refresh);
 }
Ejemplo n.º 11
0
 /**
  * Clean the cache
  *
  * @return  void
  *
  * @since   11.1
  */
 public function clearCache()
 {
     parent::clearCache();
     self::clearCacheAuxiliary();
 }
Ejemplo n.º 12
0
 public function getList($refresh = false)
 {
     Citruscart::load('CitruscartHelperBase', 'helpers._base');
     $list = parent::getList($refresh);
     // If no item in the list, return an array()
     if (empty($list)) {
         return array();
     }
     foreach ($list as $item) {
         $item->link = 'index.php?option=com_citruscart&view=orderpayments&task=edit&id=' . $item->orderpayment_id;
     }
     return $list;
 }
Ejemplo n.º 13
0
 function getTable($name = 'Config', $prefix = 'CitruscartTable', $options = array())
 {
     return parent::getTable($name, $prefix, $options);
 }
Ejemplo n.º 14
0
 function getTable($name = 'Config', $prefix = 'CitruscartTable', $options = array())
 {
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/tables');
     return parent::getTable($name, $prefix, $options);
 }
Ejemplo n.º 15
0
 public function getItem($pk = null, $refresh = false, $emptyState = true)
 {
     if ($item = parent::getItem($pk, $refresh, $emptyState)) {
         $item->productfile_path = $this->correctPath($item->productfile_path);
     }
     return $item;
 }