コード例 #1
0
 /**
  * This method loads data about e-mail template from a database.
  *
  * <code>
  * $emailId = 1;
  *
  * $email   = new Emailtemplates\Email();
  * $email->setDb(JFactory::getDbo());
  * $email->load($emailId);
  * </code>
  * 
  * @param int $id
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select('a.id, a.title, a.subject, a.body, a.sender_name, a.sender_email, a.catid')->from($this->db->quoteName('#__emailtemplates_emails', 'a'))->where('a.id = ' . (int) $id);
     $this->db->setQuery($query);
     $result = (array) $this->db->loadAssoc();
     $this->bind($result);
 }
コード例 #2
0
ファイル: category.php プロジェクト: pippogsm/UserIdeas
 /**
  * This method loads data about category from a database.
  *
  * <code>
  * $db         = JFactory::getDbo();
  * $categoryId = 1;
  *
  * $category   = new UserIdeasCategory();
  * $category->setDb($db);
  * $category->load($categoryId);
  * </code>
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select("a.title, a.description," . $query->concatenate(array("a.id", "a.alias"), ":") . " AS slug")->from($this->db->quoteName("#__categories", "a"))->where("a.id = " . (int) $id)->where("a.extension = " . $this->db->quote("com_userideas"));
     $this->db->setQuery($query);
     $result = $this->db->loadAssoc();
     if (!empty($result)) {
         $this->bind($result);
     }
 }
コード例 #3
0
ファイル: email.php プロジェクト: pippogsm/UserIdeas
 /**
  * This method loads data about e-mail template from a database.
  *
  * <code>
  * $emailId = 1;
  *
  * $email   = new UserIdeasEmail();
  * $email->setDb(JFactory::getDbo());
  * $email->load($emailId);
  * </code>
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select("a.id, a.title, a.subject, a.body, a.sender_name, a.sender_email")->from($this->db->quoteName("#__uideas_emails", "a"))->where("a.id = " . (int) $id);
     $this->db->setQuery($query);
     $result = $this->db->loadAssoc();
     if (!empty($result)) {
         $this->bind($result);
     }
 }
コード例 #4
0
ファイル: country.php プロジェクト: phpsource/CrowdFunding
 /**
  * Load country data from database.
  *
  * <code>
  * $countryId = 1;
  *
  * $country   = new CrowdFundingCountry(JFactory::getDbo());
  * $country->load($countryId);
  * </code>
  *
  * @param int $id
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select("a.id, a.name, a.code, a.code4, a.latitude, a.longitude, a.currency, a.code")->from($this->db->quoteName("#__crowdf_countries", "a"))->where("a.id = " . (int) $id);
     $this->db->setQuery($query);
     $result = $this->db->loadAssoc();
     if (!empty($result)) {
         $this->bind($result);
     }
 }
コード例 #5
0
 /**
  * Load location data from database.
  *
  * <code>
  * $locationId = 1;
  *
  * $location   = new Crowdfunding\Location(\JFactory::getDbo());
  * $location->load($locationId);
  * </code>
  *
  * @param int $id
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select("a.id, a.name, a.latitude, a.longitude, a.country_code, a.state_code, a.timezone, a.published")->from($this->db->quoteName("#__crowdf_locations", "a"))->where("a.id = " . (int) $id);
     $this->db->setQuery($query);
     $result = $this->db->loadAssoc();
     if (!empty($result)) {
         $this->bind($result);
     }
 }
コード例 #6
0
ファイル: session.php プロジェクト: bellodox/VirtualCurrency
 /**
  * Load account data from database.
  *
  * <code>
  * $id = 1;
  *
  * $paymentSession   = new VirtualCurrencyPaymentSession(JFactory::getDbo());
  * $paymentSession->load($id);
  * </code>
  *
  * @param int $id
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select("a.id, a.user_id, a.currency_id, a.amount, a.record_date")->from($this->db->quoteName("#__vc_paymentsessions", "a"))->where("a.id = " . (int) $id);
     $this->db->setQuery($query);
     $result = $this->db->loadAssoc();
     if (!$result) {
         $result = array();
     }
     $this->bind($result);
 }
コード例 #7
0
ファイル: user.php プロジェクト: xop32/Proof-of-Identity
 /**
  * Load user data from database.
  *
  * <code>
  * $keys = array(
  *    "user_id" => 1
  * );
  *
  * $user    = new IdentityProofUser();
  * $user->setDb(JFactory::getDbo());
  * $user->load($keys);
  * </code>
  *
  * @param int $id Primary Key
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select("a.id, a.state, " . "b.name")->from($this->db->quoteName("#__identityproof_users", "a"))->leftJoin($this->db->quoteName("#__users", "b") . " ON a.id = b.id")->where("a.id = " . (int) $id);
     $this->db->setQuery($query);
     $result = $this->db->loadAssoc();
     if (!$result) {
         $result = array();
     }
     $this->bind($result);
 }
コード例 #8
0
ファイル: kunena.php プロジェクト: johngrange/wookeyholeweb
 /**
  * Load user data
  *
  * <code>
  * $userId = 1;
  *
  * $profile = new ITPrismIntegrateProfileKunena();
  * $profile->load($userId);
  * </code>
  *
  * @param int $id
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select("a.userid AS user_id, a.avatar")->from($this->db->quoteName("#__kunena_users", "a"))->where("a.userid = " . (int) $id);
     $this->db->setQuery($query);
     $result = $this->db->loadAssoc();
     if (!empty($result)) {
         // Set values to variables
         $this->bind($result);
     }
 }
コード例 #9
0
ファイル: Partner.php プロジェクト: pashakiz/crowdf
 /**
  * Load data of a record from database.
  *
  * <code>
  * $id = 1;
  *
  * $partner    = new CrowdfundingPartners\Partner();
  * $partner->setDb(\JFactory::getDbo());
  * $partner->load($id);
  * </code>
  *
  * @param int $keys
  * @param array $options
  */
 public function load($keys, $options = array())
 {
     $query = $this->db->getQuery(true);
     $query->select("a.id, a.name, a.project_id, a.partner_id")->from($this->db->quoteName("#__cfpartners_partners", "a"))->where("a.id = " . (int) $keys);
     $this->db->setQuery($query);
     $result = $this->db->loadAssoc();
     if (!$result) {
         $result = array();
     }
     $this->bind($result);
 }
コード例 #10
0
ファイル: type.php プロジェクト: phpsource/CrowdFunding
 /**
  * Load a data about a type from database.
  *
  * @param int $id Type ID
  *
  * <code>
  * $typeId  = 1;
  *
  * $type    = new CrowdFundingType(JFactory::getDbo());
  * $type->load($typeId);
  * </code>
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select("a.id, a.title, a.description, a.params")->from($this->db->quoteName("#__crowdf_types", "a"))->where("a.id = " . (int) $id);
     $this->db->setQuery($query);
     $result = $this->db->loadAssoc();
     if (!$result) {
         $result = array();
     }
     $this->bind($result);
 }
コード例 #11
0
ファイル: status.php プロジェクト: johngrange/wookeyholeweb
 /**
  * This method loads data about a status from a database.
  *
  * <code>
  * $statusId = 1;
  *
  * $status   = new UserIdeasStatus(JFactory::getDbo());
  * $status->load($statusId);
  * </code>
  */
 public function load()
 {
     $query = $this->db->getQuery(true);
     $query->select("a.id, a.name, a.default, a.params")->from($this->db->quoteName("#__uideas_statuses", "a"))->where("a.id = " . (int) $this->id);
     $this->db->setQuery($query);
     $result = $this->db->loadAssoc();
     if (!empty($result)) {
         if (!empty($result["params"])) {
             $params = json_decode($result["params"]);
             if (!empty($params)) {
                 $result["params"] = $params;
             }
         }
         $this->bind($result);
     }
 }
コード例 #12
0
 /**
  * Load user data
  *
  * <code>
  * $keys = array(
  *     'user_id' => $userId
  * );
  *
  * $profile = new Prism\Integration\Profile\Socialcommunity(\JFactory::getDbo());
  * $profile->load($keys);
  * </code>
  * 
  * @param array $keys
  * @param array $options
  */
 public function load($keys, array $options = array())
 {
     $query = $this->db->getQuery(true);
     $query->select('a.id, a.user_id, a.image_icon, a.image_small, a.image_square, a.image, a.active, ' . $query->concatenate(array('a.id', 'a.alias'), ':') . ' AS slug, ' . 'b.name as location, b.country_code')->from($this->db->quoteName('#__itpsc_profiles', 'a'))->leftJoin($this->db->quoteName('#__itpsc_locations', 'b') . ' ON a.location_id = b.id');
     // Filter by keys.
     if (!is_array($keys)) {
         $query->where('a.id = ' . (int) $keys);
     } else {
         foreach ($keys as $key => $value) {
             $query->where($this->db->quoteName('a.' . $key) . ' = ' . $this->db->quote($value));
         }
     }
     $this->db->setQuery($query);
     $result = (array) $this->db->loadAssoc();
     $this->bind($result);
 }
コード例 #13
0
ファイル: EasySocial.php プロジェクト: bellodox/PrismLibrary
 /**
  * Load user data from database.
  *
  * <code>
  * $userId = 1;
  *
  * $profile = new Prism\Integration\Profile\EasySocial(\JFactory::getDbo());
  * $profile->load($userId);
  * </code>
  *
  * @param int $id
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select('a.id AS user_id, a.name, a.username, ' . 'b.alias, b.permalink, ' . 'c.small, c.medium, c.square, c.large')->from($this->db->quoteName('#__users', 'a'))->leftJoin($this->db->quoteName('#__social_users', 'b') . ' ON a.id = b.user_id')->leftJoin($this->db->quoteName('#__social_avatars', 'c') . ' ON a.id = c.uid')->where('a.id =' . (int) $id);
     $this->db->setQuery($query);
     $result = (array) $this->db->loadAssoc();
     $this->bind($result);
 }
コード例 #14
0
ファイル: EasyProfile.php プロジェクト: pashakiz/crowdf
 /**
  * Load user data
  *
  * <code>
  * $userId = 1;
  *
  * $profile = new Prism\Integration\Profile\EasyProfile(\JFactory::getDbo());
  * $profile->load($userId);
  * </code>
  * 
  * @param int $id User ID.
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select("a.id AS user_id, a.avatar, " . $query->concatenate(array("b.id", "b.username"), ":") . " AS slug")->from($this->db->quoteName("#__jsn_users", "a"))->innerJoin($this->db->quoteName("#__users", "b") . " ON a.id = b.id")->where("a.id = " . (int) $id);
     $this->db->setQuery($query);
     $result = (array) $this->db->loadAssoc();
     $this->bind($result);
 }
コード例 #15
0
ファイル: Gravatar.php プロジェクト: pashakiz/crowdf
 /**
  * Load user data
  *
  * <code>
  * $userId = 1;
  *
  * $profile = new Prism\Integration\Profile\Gravatar(\JFactory::getDbo());
  * $profile->load($userId);
  * </code>
  * 
  * @param int $id
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select("a.id AS user_id, a.email, MD5(a.email) as hash")->from($this->db->quoteName("#__users", "a"))->where("a.id = " . (int) $id);
     $this->db->setQuery($query);
     $result = (array) $this->db->loadAssoc();
     $this->bind($result);
 }
コード例 #16
0
ファイル: Kunena.php プロジェクト: bellodox/PrismLibrary
 /**
  * Load user data
  *
  * <code>
  * $userId = 1;
  *
  * $profile = new Prism\Integration\Profile\Kunena(\JFactory::getDbo());
  * $profile->load($userId);
  * </code>
  *
  * @param int $id
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select('a.userid AS user_id, a.avatar, a.location')->from($this->db->quoteName('#__kunena_users', 'a'))->where('a.userid = ' . (int) $id);
     $this->db->setQuery($query);
     $result = (array) $this->db->loadAssoc();
     $this->bind($result);
 }
コード例 #17
0
ファイル: SocialCommunity.php プロジェクト: pashakiz/crowdf
 /**
  * Load user data
  *
  * <code>
  * $userId = 1;
  *
  * $profile = new Prism\Integration\Profile\SocialCommunity(\JFactory::getDbo());
  * $profile->load($userId);
  * </code>
  * 
  * @param int $id User ID.
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select("a.id AS user_id, a.image_icon, a.image_small, a.image_square, a.image, " . $query->concatenate(array("a.id", "a.alias"), ":") . " AS slug, " . "b.name as location, b.country_code")->from($this->db->quoteName("#__itpsc_profiles", "a"))->leftJoin($this->db->quoteName("#__itpsc_locations", "b") . " ON a.location_id = b.id")->where("a.id = " . (int) $id);
     $this->db->setQuery($query);
     $result = (array) $this->db->loadAssoc();
     $this->bind($result);
 }
コード例 #18
0
 /**
  * Load user data
  *
  * <code>
  * $userId = 1;
  *
  * $profile = new Prism\Integration\Profile\CommunityBuilder(\JFactory::getDbo());
  * $profile->load($userId);
  * </code>
  * 
  * @param int $id User ID.
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select('a.id AS user_id, a.name, ' . 'b.avatar, ' . $query->concatenate(array('a.id', 'a.username'), ':') . ' AS slug')->from($this->db->quoteName('#__users', 'a'))->innerJoin($this->db->quoteName('#__comprofiler', 'b') . ' ON a.id = b.user_id')->where('a.id = ' . (int) $id);
     $this->db->setQuery($query);
     $result = (array) $this->db->loadAssoc();
     $this->bind($result);
 }
コード例 #19
0
 /**
  * Load user data
  *
  * <code>
  * $userId = 1;
  *
  * $profile = new Prism\Integration\Profile\SocialCommunity(\JFactory::getDbo());
  * $profile->load($userId);
  * </code>
  * 
  * @param int $id User ID.
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select('a.id AS user_id, a.image_icon, a.image_small, a.image_square, a.image, ' . $query->concatenate(array('a.id', 'a.alias'), ':') . ' AS slug, ' . 'b.name as location, b.country_code')->from($this->db->quoteName('#__itpsc_profiles', 'a'))->leftJoin($this->db->quoteName('#__itpsc_locations', 'b') . ' ON a.location_id = b.id')->where('a.id = ' . (int) $id);
     $this->db->setQuery($query);
     $result = (array) $this->db->loadAssoc();
     $this->bind($result);
 }
コード例 #20
0
ファイル: table.php プロジェクト: Rai-Ka/joomla-cms
 /**
  * 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.
  *
  * @since   11.1
  * @throws  InvalidArgumentException
  * @throws  RuntimeException
  * @throws  UnexpectedValueException
  */
 public function load($keys = null, $reset = true)
 {
     // Pre-processing by observers
     $event = AbstractEvent::create('onTableBeforeLoad', ['subject' => $this, 'keys' => $keys, 'reset' => $reset]);
     $this->getDispatcher()->dispatch('onTableBeforeLoad', $event);
     if (empty($keys)) {
         $empty = true;
         $keys = array();
         // If empty, use the value of the current key
         foreach ($this->_tbl_keys as $key) {
             $empty = $empty && empty($this->{$key});
             $keys[$key] = $this->{$key};
         }
         // If empty primary key there's is no need to load anything
         if ($empty) {
             return true;
         }
     } elseif (!is_array($keys)) {
         // Load by primary key.
         $keyCount = count($this->_tbl_keys);
         if ($keyCount) {
             if ($keyCount > 1) {
                 throw new InvalidArgumentException('Table has multiple primary keys specified, only one primary key value provided.');
             }
             $keys = array($this->getKeyName() => $keys);
         } else {
             throw new RuntimeException('No table keys defined.');
         }
     }
     if ($reset) {
         $this->reset();
     }
     // Initialise the query.
     $query = $this->_db->getQuery(true)->select('*')->from($this->_tbl);
     $fields = array_keys($this->getProperties());
     foreach ($keys as $field => $value) {
         // Check that $field is in the table.
         if (!in_array($field, $fields)) {
             throw new UnexpectedValueException(sprintf('Missing field in database: %s &#160; %s.', get_class($this), $field));
         }
         // Add the search tuple to the query.
         $query->where($this->_db->quoteName($field) . ' = ' . $this->_db->quote($value));
     }
     $this->_db->setQuery($query);
     $row = $this->_db->loadAssoc();
     // Check that we have a result.
     if (empty($row)) {
         $result = false;
     } else {
         // Bind the object with the row and return.
         $result = $this->bind($row);
     }
     // Post-processing by observers
     $event = AbstractEvent::create('onTableAfterLoad', ['subject' => $this, 'result' => &$result, 'row' => $row]);
     $this->getDispatcher()->dispatch('onTableAfterLoad', $event);
     return $result;
 }
コード例 #21
0
ファイル: db.php プロジェクト: RenatoToasa/Pagina-Web
 public function findByAttributes(array $attributes, $fields = false, $order = false)
 {
     $query = $this->db->getQuery(true);
     if ($fields) {
         $query->select($this->quoteName($fields));
     } else {
         $query->select(array('*'));
     }
     $query->from($this->quoteName($this->tableName));
     foreach ($attributes as $key => $val) {
         $query->where($this->quoteName($key) . ' = ' . (is_numeric($val) ? $val : $this->quote($val)));
     }
     if ($order) {
         $query->order($order);
     }
     $this->db->setQuery($query);
     return $this->db->loadAssoc();
 }
コード例 #22
0
ファイル: item.php プロジェクト: pippogsm/UserIdeas
 /**
  * This method loads data about an item from a database.
  *
  * <code>
  * $itemId = 1;
  *
  * $item   = new UserIdeasItem(JFactory::getDbo());
  * $item->load($itemId);
  * </code>
  *
  * @param integer $id Item ID.
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select("a.id, a.title, a.alias, a.description, a.votes, a.record_date, " . "a.ordering, a.published, a.status_id, a.catid, a.user_id, " . "b.title AS category, " . "c.name AS username, " . "d.name AS status, " . $query->concatenate(array("a.id", "a.alias"), ":") . " AS slug, " . $query->concatenate(array("b.id", "b.alias"), ":") . " AS catslug")->from($this->db->quoteName("#__uideas_items", "a"))->leftJoin($this->db->quoteName("#__categories", "b") . " ON a.catid = b.id")->leftJoin($this->db->quoteName("#__users", "c") . " ON a.user_id = c.id")->leftJoin($this->db->quoteName("#__uideas_statuses", "d") . " ON a.status_id = d.id")->where("a.id = " . (int) $id);
     $this->db->setQuery($query);
     $result = $this->db->loadAssoc();
     if (!empty($result)) {
         $this->bind($result);
     }
 }
コード例 #23
0
ファイル: EasySocial.php プロジェクト: pashakiz/crowdf
 /**
  * Load user data from database.
  *
  * <code>
  * $userId = 1;
  *
  * $profile = new Prism\Integration\Profile\EasySocial(\JFactory::getDbo());
  * $profile->load($userId);
  * </code>
  *
  * @param int $id
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select("a.id AS user_id, a.name, a.username, " . "b.alias, b.permalink, " . "c.small, c.medium, c.square, c.large")->from($this->db->quoteName("#__users", "a"))->leftJoin($this->db->quoteName("#__social_users", "b") . " ON a.id = b.user_id")->leftJoin($this->db->quoteName("#__social_avatars", "c") . " ON a.id = c.uid")->where("a.id =" . (int) $id);
     $this->db->setQuery($query);
     $result = $this->db->loadAssoc();
     if (!empty($result)) {
         // Set values to variables
         $this->bind($result);
     }
 }
コード例 #24
0
ファイル: Reward.php プロジェクト: bharatthakkar/CrowdFunding
 /**
  * Load reward data from database by reward ID or combination of keys ( id, project_id,...).
  *
  * <code>
  * $keys = array(
  *     "id" => 1,
  *     "project_id" => 2
  * );
  *
  * $reward    = new Crowdfunding\Reward(\JFactory::getDbo());
  * $reward->load($keys);
  * </code>
  *
  * @param int|array $keys Reward IDs.
  * @param array $options
  */
 public function load($keys, $options = array())
 {
     $query = $this->db->getQuery(true);
     $query->select("a.id, a.title, a.description, a.amount, a.number, a.distributed, a.delivery, " . "a.shipping, a.image, a.image_thumb, a.image_square, a.published, a.project_id, " . "b.user_id")->from($this->db->quoteName("#__crowdf_rewards", "a"))->innerJoin($this->db->quoteName("#__crowdf_projects", "b") . " ON a.project_id = b.id");
     if (!is_array($keys)) {
         $query->where("a.id = " . (int) $keys);
     } else {
         foreach ($keys as $key => $value) {
             $query->where($this->db->quoteName("a." . $key) . "=" . $this->db->quote($value));
         }
     }
     $this->db->setQuery($query);
     $result = $this->db->loadAssoc();
     if (!$result) {
         $result = array();
     }
     $this->bind($result);
     // Calculate available
     $this->available = $this->calculateAvailable();
 }
コード例 #25
0
ファイル: currency.php プロジェクト: phpsource/CrowdFunding
 /**
  * Load currency data from database.
  *
  * <code>
  * $currencyCode = "EUR";
  *
  * $currency   = new CrowdFundingCurrency();
  * $currency->setDb(JFactory::getDbo());
  *
  * $currency->loadByAbbr($currencyCode);
  * </code>
  *
  * @param string $abbr
  */
 public function loadByAbbr($abbr)
 {
     $query = $this->db->getQuery(true);
     $query->select("a.id, a.title, a.abbr, a.symbol, a.position")->from($this->db->quoteName("#__crowdf_currencies", "a"))->where("a.abbr = " . $this->db->quote($abbr));
     $this->db->setQuery($query);
     $result = $this->db->loadAssoc();
     if (!$result) {
         $result = array();
     }
     $this->bind($result);
 }
コード例 #26
0
ファイル: currency.php プロジェクト: bellodox/VirtualCurrency
 /**
  * Load currency data from database.
  *
  * <code>
  * $currencyId = 1;
  *
  * $currency   = new VirtualCurrencyCurrency(JFactory::getDbo());
  * $currency->load($currencyId);
  * </code>
  *
  * @param int $id
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select("a.id, a.title, a.description, a.code, a.symbol, a.params, a.published")->from($this->db->quoteName("#__vc_currencies", "a"))->where("a.id = " . (int) $id);
     $this->db->setQuery($query);
     $result = $this->db->loadAssoc();
     if (!$result) {
         $result = array();
     }
     $this->bind($result);
 }
コード例 #27
0
 /**
  * Load user data
  *
  * <code>
  * $userId = 1;
  *
  * $profile = new Prism\Integration\Profile\JomSocial(\JFactory::getDbo());
  * $profile->load($userId);
  * </code>
  *
  * @param int $id
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select('a.userid AS user_id, a.avatar, a.thumb')->from($this->db->quoteName('#__community_users', 'a'))->where('a.userid = ' . (int) $id);
     $this->db->setQuery($query);
     $result = $this->db->loadAssoc();
     if (!empty($result)) {
         // Set values to variables
         $this->bind($result);
     }
 }
コード例 #28
0
 /**
  * Load currency data from database.
  *
  * <code>
  * $currencyId = 1;
  *
  * $currency   = new VirtualCurrencyRealCurrency();
  * $currency->setDb(JFactory::getDbo());
  * $currency->load($currencyId);
  * </code>
  *
  * @param int $id
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select("a.id, a.title, a.abbr, a.symbol, a.position")->from($this->db->quoteName("#__vc_realcurrencies", "a"))->where("a.id = " . (int) $id);
     $this->db->setQuery($query);
     $result = $this->db->loadAssoc();
     if (!$result) {
         $result = array();
     }
     $this->bind($result);
 }
コード例 #29
0
 /**
  * Load user data
  *
  * <code>
  * $userId = 1;
  *
  * $profile = new ITPrismIntegrateProfileSocialCommunity();
  * $profile->load($userId);
  * </code>
  * 
  * @param int $id User ID.
  */
 public function load($id)
 {
     $query = $this->db->getQuery(true);
     $query->select("a.id AS user_id, a.image_square AS avatar, a.image_small as avatar_small, " . $query->concatenate(array("a.id", "a.alias"), ":") . " AS slug, " . "b.name as location, b.country_code")->from($this->db->quoteName("#__itpsc_profiles", "a"))->leftJoin($this->db->quoteName("#__itpsc_locations", "b") . " ON a.location_id = b.id")->where("a.id = " . (int) $id);
     $this->db->setQuery($query);
     $result = $this->db->loadAssoc();
     if (!empty($result)) {
         // Set the values to the object properties.
         $this->bind($result);
     }
 }
コード例 #30
0
ファイル: object.php プロジェクト: BillVGN/PortalPRP
	protected function load($keys = null, $reset = true)
	{
		try
		{
			$keys = $this->getKeyValues($keys);
		}
		catch (UnexpectedValueException $e)
		{
			if ($e->getCode() == 0)
			{
				// Key not fully given, no need to load the item.
				foreach ($keys as $field => $value)
				{
					// Make sure the object contains the search fields.
					$this->$field = $value;
				}

				return false;
			}
			// Error, throw it forward.
			throw $e;
		}

		if ($reset) {
			$this->reset();
		}

		// Initialise the query.
		$query = static::$db->getQuery(true)->select('*')->from(static::$tbl);

		foreach ($keys as $field => $value)
		{
			// Make sure the object contains the search fields.
			// This is incompatible to JTable, but needed by this class.
			$this->$field = $value;

			// Add the search tuple to the query.
			$query->where(static::$db->quoteName($field).' = '.static::$db->quote($value));
		}

		static::$db->setQuery($query, 0, 1);

		$row = static::$db->loadAssoc();

		// Check that we have a result.
		if (empty($row))
		{
			return false;
		}

		// Bind the object with the row and return.
		return $this->_exists = $this->bind($row);
	}