Exemplo n.º 1
1
 /**
  * Get a connection table object
  *
  * @param   int  $id  connection id
  *
  * @return  object  connection tables
  */
 public function &getConnection($id = null)
 {
     if (!is_null($id)) {
         $this->setId($id);
     }
     if (!is_object($this->_connection)) {
         $session = JFactory::getSession();
         $key = 'fabrik.connection.' . $this->_id;
         if ($session->has($key)) {
             $connProperties = unserialize($session->get($key));
             // $$$ rob since J1.6 - connection properties stored as an array (in f2 it was an object)
             if (is_a($connProperties, '__PHP_Incomplete_Class') || JArrayHelper::getValue($connProperties, 'id') == '') {
                 $session->clear($key);
             } else {
                 $this->_connection = FabTable::getInstance('connection', 'FabrikTable');
                 $this->_connection->bind($connProperties);
                 return $this->_connection;
             }
         }
         if ($this->_id == -1 || $this->_id == '') {
             $this->_connection = $this->loadDefaultConnection();
         } else {
             $this->_connection = FabTable::getInstance('Connection', 'FabrikTable');
             $this->_connection->load($this->_id);
         }
         // $$$ rob store the connection for later use as it may be required by modules/plugins
         $session->set($key, serialize($this->_connection->getProperties()));
     }
     return $this->_connection;
 }
Exemplo n.º 2
0
 /**
  * Load the audience for a publication by version id
  *
  * @param      integer $versionid Pub version ID
  * @return     mixed False if error, Object on success
  */
 public function loadByVersion($versionid = NULL)
 {
     if ($versionid === NULL) {
         return false;
     }
     return parent::load(array('publication_version_id' => (int) $versionid));
 }
Exemplo n.º 3
0
 /**
  * Method to load a row from the database by primary key and bind the fields
  * to the JTable instance properties.
  *
  * @param   mixed   $keys  An optional primary key value to load the row by, or an array of fields to match.  If not
  *                         set the instance property value is used.
  * @param   boolean $reset True to reset the default values before loading the new row.
  *
  * @return  boolean  True if successful. False if row not found or on error (internal error state set in that case).
  *
  * @link    http://docs.joomla.org/JTable/load
  * @since   11.1
  */
 public function load($keys = null, $reset = true)
 {
     parent::load($keys, $reset);
     $this->slug = $this->id . "." . $this->alias;
     // Calculate funded percent
     if (!$this->goal) {
         $this->fundedPercent = 0;
     } else {
         $percentage = new Prism\Math();
         $percentage->calculatePercentage($this->funded, $this->goal, 0);
         $this->fundedPercent = (string) $percentage;
     }
     // Calculate end date
     if (!empty($this->funding_days)) {
         $fundingStartDateValidator = new Prism\Validator\Date($this->funding_start);
         if (!$fundingStartDateValidator->isValid()) {
             $this->funding_end = "0000-00-00";
         } else {
             $fundingStartDate = new Crowdfunding\Date($this->funding_start);
             $fundingEndDate = $fundingStartDate->calculateEndDate($this->funding_days);
             $this->funding_end = $fundingEndDate->toSql();
         }
     }
     // Calculate days left
     $today = new Crowdfunding\Date();
     $this->daysLeft = $today->calculateDaysLeft($this->funding_days, $this->funding_start, $this->funding_end);
     return true;
 }
Exemplo n.º 4
0
 function load($id = null)
 {
     parent::load($id);
     jimport('joomla.html.parameter');
     $params = new JParameter($this->settings);
     $this->settings = $params->toArray();
 }
Exemplo n.º 5
0
 /**
  * Method to load a row from the database by primary key and bind the fields
  * to the JTable instance properties.
  *
  * @param   mixed    $keys   An optional primary key value to load the row by, or an array of fields to match. If not set the instance property value is used.
  * @param   boolean  $reset  True to reset the default values before loading the new row.
  * @return  boolean  True if successful. False if row not found or on error (internal error state set in that case).
  */
 public function load($keys = null, $reset = true)
 {
     if (is_numeric($keys)) {
         return parent::load($keys, $reset);
     }
     return parent::load(array('alias' => $keys), $reset);
 }
Exemplo n.º 6
0
 public function load($key = null, $permalink = false)
 {
     static $loaded = array();
     $sig = $key . (int) $permalink;
     $doBind = true;
     if (!isset($loaded[$sig])) {
         if (!$permalink) {
             parent::load($key);
             $loaded[$sig] = $this;
             //return $this->id;
         } else {
             $db = DiscussHelper::getDBO();
             $query = 'SELECT ' . $db->nameQuote('id') . ' FROM ' . $db->nameQuote($this->_tbl) . ' ' . 'WHERE ' . $db->nameQuote('alias') . '=' . $db->Quote($key);
             $db->setQuery($query);
             $id = $db->loadResult();
             // Try replacing ':' to '-' since Joomla replaces it
             if (!$id) {
                 $query = 'SELECT id FROM ' . $this->_tbl . ' ' . 'WHERE alias=' . $db->Quote(JString::str_ireplace(':', '-', $key));
                 $db->setQuery($query);
                 $id = $db->loadResult();
             }
             parent::load($id);
             $loaded[$sig] = $this;
         }
         $doBind = false;
     }
     if ($doBind) {
         return parent::bind($loaded[$sig]);
     } else {
         return $this->id;
     }
 }
Exemplo n.º 7
0
 /**
  * Get db row/item loaded with id
  *
  * @return  JTable
  */
 protected function getRow()
 {
     if (!isset($this->row)) {
         $this->row = $this->getTable($this->_type);
         $this->row->load($this->id);
     }
     return $this->row;
 }
 /**
  * Test the publish method.
  *
  * @return  void
  *
  * @since   12.3
  */
 public function testPublish()
 {
     $this->object->publish(array(array('id1' => 25, 'id2' => 50), array('id1' => 25, 'id2' => 51)), 2);
     $this->object->load(array('id1' => 25, 'id2' => 50));
     $this->assertEquals(2, $this->object->published);
     $this->object->load(array('id1' => 25, 'id2' => 51));
     $this->assertEquals(2, $this->object->published);
 }
Exemplo n.º 9
0
 /**
  * Load by post id. Return Only ONE latest record
  */
 public function load($keys = null, $reset = true)
 {
     $db = DiscussHelper::getDBO();
     $query = 'SELECT id FROM `#__discuss_assignment_map` WHERE `post_id` = ' . $db->quote($keys) . ' ORDER BY `created` DESC LIMIT 0, 1';
     $db->setQuery($query);
     $result = $db->loadResult();
     return parent::load($result, $reset);
 }
Exemplo n.º 10
0
 public function load($oid = null)
 {
     $ret = parent::load($oid);
     if ($ret === true) {
         $this->_exists = true;
     }
     return $ret;
 }
Exemplo n.º 11
0
 public function load($keys = null, $reset = true)
 {
     if (K2_JVERSION == '15') {
         return parent::load($keys);
     } else {
         return parent::load($keys, $reset);
     }
 }
Exemplo n.º 12
0
 /**
  * Load a record and bind to $this
  *
  * @param   integer  $response_id  Answer ID
  * @param   string   $ip           IP address
  * @return  boolean  True upon success, False if errors
  */
 public function loadByIp($response_id = null, $ip = null)
 {
     $response_id = $response_id ?: $this->response_id;
     if ($response_id == null) {
         return false;
     }
     return parent::load(array('response_id' => (int) $response_id, 'ip' => (string) $ip));
 }
Exemplo n.º 13
0
 /**
  * Override parent's load behavior as we need to attach messageTable here.
  *
  * @since	3.0
  * @access	public
  */
 public function load($id = null, $ignore = array())
 {
     $state = parent::load($id);
     if (!$state) {
         return $state;
     }
     return $state;
 }
Exemplo n.º 14
0
 /**
  * Method to load a row from the database by primary key and bind the fields
  * to the JTable instance properties.
  *
  * @param   mixed    $keys   An optional primary key value to load the row by, or an array of fields to match.  If not
  *                            set the instance property value is used.
  * @param   boolean  $reset  True to reset the default values before loading the new row.
  *
  * @return  boolean  True if successful. False if row not found.
  *
  * @link    http://docs.joomla.org/JTable/load
  * @since   11.1
  * @throws  RuntimeException
  * @throws  UnexpectedValueException
  */
 public function load($keys = null, $reset = true)
 {
     $result = parent::load($keys, $reset);
     if ($result) {
         $this->tags = new JHelperTags();
         $this->tags->getTagIds($this->id, 'com_webgallery.item');
     }
     return $result;
 }
Exemplo n.º 15
0
 function load($oid = null)
 {
     $ret = parent::load($oid);
     if ($ret === true) {
         $this->_exists = true;
     }
     $this->userid = (int) $oid;
     return $ret;
 }
Exemplo n.º 16
0
 public function load($pk = null, $reset = true)
 {
     if (parent::load($pk, $reset)) {
         $this->{'type_' . $this->type} = $this->default_values;
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 17
0
 /**
  * Load a record by message ID and user ID and bind to $this
  *
  * @param   integer  $mid  Message ID
  * @param   integer  $uid  User ID
  * @return  boolean  True on success
  */
 public function loadRecord($mid = null, $uid = null)
 {
     $mid = $mid ?: $this->mid;
     $uid = $uid ?: $this->uid;
     if (!$mid || !$uid) {
         return false;
     }
     return parent::load(array('mid' => $mid, 'uid' => $uid));
 }
Exemplo n.º 18
0
 public function load($keys = null, $reset = true)
 {
     $result = parent::load($keys, $reset);
     if (isset($this->password) && !empty($this->password)) {
         $cryptor = new JSimpleCrypt();
         $this->password = $cryptor->decrypt($this->password);
     }
     return $result;
 }
Exemplo n.º 19
0
 /**
  * Get group table
  *
  * @return  FabrikTableGroup
  */
 public function &getGroup()
 {
     if (is_null($this->group)) {
         JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_fabrik/tables');
         $this->group = FabTable::getInstance('Group', 'FabrikTable');
         $this->group->load($this->getId());
     }
     return $this->group;
 }
Exemplo n.º 20
0
 function load($id = 0)
 {
     parent::load($id);
     /*$db = JFactory::getDBO();
     		$sql = "SELECT catid FROM #__digicom_product_categories WHERE productid='".$this->id."'";
     		$db->setQuery($sql);
     		$this->selection = $db->loadColumn();
     		*/
     $this->selection = $this->catid;
 }
Exemplo n.º 21
0
 /**
  * Load a record and bind to $this
  *
  * @param   mixed    $keys    Alias or ID
  * @param   inteher  $pageid  Parent page ID
  * @return  boolean  True on success
  */
 public function load($oid = NULL, $pageid = NULL)
 {
     if ($oid === NULL) {
         return false;
     }
     if (is_string($oid)) {
         return parent::load(array('filename' => $oid, 'pageid' => $pageid));
     }
     return parent::load($oid);
 }
Exemplo n.º 22
0
 /**
  * Load entry
  *
  * @param      integer 	$vid		pub version id
  * @param      integer 	$group_id	group id
  * @return     object or FALSE
  */
 public function loadEntry($vid = NULL, $group_id = NULL)
 {
     if (!$vid) {
         $vid = $this->publication_version_id;
     }
     if (!$vid || !$group_id) {
         return false;
     }
     return parent::load(array('publication_version_id' => (int) $vid, 'group_id' => (int) $group_id));
 }
Exemplo n.º 23
0
 /**
  * Get a record and bind to $this
  *
  * @param   integer  $userid  User ID
  * @param   integer  $wishid  Wish ID
  * @return  boolean  False if error, True on success
  */
 public function load_vote($userid = NULL, $wishid = NULL)
 {
     $userid = $userid ?: $this->userid;
     $wishid = $wishid ?: $this->wishid;
     if ($userid === NULL or $wishid === NULL) {
         $this->setError(Lang::txt('Missing wish or user ID'));
         return false;
     }
     return parent::load(array('userid' => $userid, 'wishid' => $wishid));
 }
Exemplo n.º 24
0
 /**
  * Load a record and bind to $this
  *
  * @param   string   $alias  Entry alias
  * @param   integer  $id     Entry ID
  * @return  boolean  True upon success, False if errors
  */
 public function loadService($alias = NULL, $id = NULL)
 {
     if ($alias === NULL && $id === NULL) {
         return false;
     }
     if ($alias) {
         return parent::load(array('alias' => $alias));
     }
     return parent::load($id);
 }
Exemplo n.º 25
0
 /**
  * get a package table object
  *
  * @return  object connection tables
  */
 public function &getPackage()
 {
     if (!isset($this->package)) {
         $this->package = FabTable::getInstance('Package', 'FabrikTable');
         $this->package->load($this->id);
         // Forms can currently only be set from form module
         $this->package->forms = '';
     }
     return $this->package;
 }
Exemplo n.º 26
0
 public function load($keys = null, $reset = true)
 {
     $return = parent::load($keys, $reset);
     if ($return !== false && (int) $this->id > 0 && empty($this->items)) {
         $db = JFactory::getDbo();
         $db->setQuery('select * from #__djc2_quote_items where quote_id=' . (int) $this->id);
         $this->items = $db->loadObjectList('id');
     }
     return $return;
 }
Exemplo n.º 27
0
 function load($id = 0, $reset = true)
 {
     $db = JFactory::getDBO();
     $sql = "select id from #__guru_customer where id='" . $id . "'";
     $db->setQuery($sql);
     $realid = $db->loadResult();
     if (isset($_POST['cid'])) {
         $realid = $id;
     }
     parent::load($realid, true);
 }
Exemplo n.º 28
0
 public function load($key = null, $customLoad = false)
 {
     if ($customLoad == false) {
         parent::load($key);
     }
     $db = DiscussHelper::getDBO();
     $query = 'SELECT * FROM ' . $db->nameQuote('#__discuss_customfields_rule') . ' WHERE ' . $db->nameQuote('field_id') . '=' . $db->Quote($key);
     $db->setQuery($query);
     $results = $db->loadObjectList();
     return !$results ? false : $results;
 }
Exemplo n.º 29
0
 function load($id = 0, $reset = true)
 {
     $db = JFactory::getDBO();
     $sql = "select aid from #__ad_agency_advertis where user_id='" . intval($id) . "'";
     $db->setQuery($sql);
     $realid = $db->loadResult();
     if (isset($_POST['cid'])) {
         $realid = $id;
     }
     parent::load($realid, true);
 }
Exemplo n.º 30
-1
 /**
  * Load a record and bind to $this
  *
  * @param   mixed  $oid  Integer or string (alias)
  * @return  void
  */
 public function load($keys = NULL, $reset = true)
 {
     if (is_numeric($keys)) {
         return parent::load($keys);
     }
     return parent::load(array('name' => trim($keys)));
 }