当前位置: 首页>>代码示例>>PHP>>正文


PHP JDatabaseDriver::loadResult方法代码示例

本文整理汇总了PHP中JDatabaseDriver::loadResult方法的典型用法代码示例。如果您正苦于以下问题:PHP JDatabaseDriver::loadResult方法的具体用法?PHP JDatabaseDriver::loadResult怎么用?PHP JDatabaseDriver::loadResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JDatabaseDriver的用法示例。


在下文中一共展示了JDatabaseDriver::loadResult方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isValid

 /**
  * Validate project owner.
  *
  * <code>
  * $projectId = 1;
  * $userId = 2;
  *
  * $owner = new Crowdfunding\Validator\Project\Owner(\JFactory::getDbo(), $projectId, $userId);
  * if(!$owner->isValid()) {
  * ......
  * }
  * </code>
  *
  * @return bool
  */
 public function isValid()
 {
     $query = $this->db->getQuery(true);
     $query->select('COUNT(*)')->from($this->db->quoteName('#__crowdf_projects', 'a'))->where('a.id = ' . (int) $this->projectId)->where('a.user_id = ' . (int) $this->userId);
     $this->db->setQuery($query, 0, 1);
     return (bool) $this->db->loadResult();
 }
开发者ID:sis-direct,项目名称:CrowdFunding,代码行数:22,代码来源:Owner.php

示例2: isValid

 /**
  * Validate project owner.
  *
  * <code>
  * $projectId = 1;
  * $userId = 2;
  *
  * $owner = new Crowdfunding\Validator\Project\Owner(\JFactory::getDbo(), $projectId, $userId);
  * if(!$owner->isValid()) {
  * ......
  * }
  * </code>
  *
  * @return bool
  */
 public function isValid()
 {
     $query = $this->db->getQuery(true);
     $query->select("COUNT(*)")->from($this->db->quoteName("#__crowdf_projects", "a"))->where("a.id = " . (int) $this->projectId)->where("a.user_id = " . (int) $this->userId);
     $this->db->setQuery($query, 0, 1);
     $result = $this->db->loadResult();
     return (bool) $result;
 }
开发者ID:pashakiz,项目名称:crowdf,代码行数:23,代码来源:Owner.php

示例3: getTotalComments

 /**
  * This method returns a number of all comments.
  *
  * @return int
  */
 public function getTotalComments()
 {
     $query = $this->db->getQuery(true);
     $query->select("COUNT(*)")->from($this->db->quoteName("#__uideas_comments", "a"));
     $this->db->setQuery($query);
     $result = $this->db->loadResult();
     if (!$result) {
         $result = 0;
     }
     return $result;
 }
开发者ID:pippogsm,项目名称:UserIdeas,代码行数:16,代码来源:basic.php

示例4: getNumberOfCampaignsInPeriod

 /**
  * Count the number of campaigns in a period.
  * If star date and end date are not provides, the system will get default values.
  * The default values will be the beginning of the year and the end of the year.
  *
  * <code>
  * $usersId = 1;
  *
  * $statistics        = new Crowdfunding\Statistics\Users(\JFactory::getDbo(), $usersId);
  * $numberOfCampaigns = $statistics->getNumberOfActiveCampaigns();
  * </code>
  *
  * @param string $startDate
  * @param string $endDate
  *
  * @return int
  */
 public function getNumberOfCampaignsInPeriod($startDate = null, $endDate = null)
 {
     // Set default start date.
     if (!(int) $startDate) {
         $date = new Prism\Date();
         $date = $date->getBeginOfYear();
         $startDate = $date->toSql();
     }
     // Set default end date.
     if (!(int) $endDate) {
         $date = new Prism\Date();
         $date = $date->getEndOfYear();
         $endDate = $date->toSql();
     }
     $startDate = new \JDate($startDate);
     $endDate = new \JDate($endDate);
     $query = $this->db->getQuery(true);
     $query->select("COUNT(*) AS number")->from($this->db->quoteName("#__crowdf_projects", "a"))->where("a.user_id = " . (int) $this->id)->where("a.funding_start >= " . $this->db->quote($startDate->toSql()))->where("a.funding_start <= " . $this->db->quote($endDate->toSql()));
     $this->db->setQuery($query, 0, 1);
     $result = $this->db->loadResult();
     if (!$result) {
         $result = 0;
     }
     return $result;
 }
开发者ID:pashakiz,项目名称:crowdf,代码行数:42,代码来源:User.php

示例5: createTable

 protected function createTable()
 {
     $this->debug('createTable: Check if plugin table exists.');
     // Create plugin table if doesn't exist
     $query = "SHOW TABLES LIKE '{$this->db->getPrefix()}kunenadiscuss'";
     $this->db->setQuery($query);
     if (!$this->db->loadResult()) {
         KunenaError::checkDatabaseError();
         $query = "CREATE TABLE IF NOT EXISTS `#__kunenadiscuss`\n\t\t\t\t\t(`content_id` int(11) NOT NULL default '0',\n\t\t\t\t\t `thread_id` int(11) NOT NULL default '0',\n\t\t\t\t\t PRIMARY KEY  (`content_id`)\n\t\t\t\t\t )";
         $this->db->setQuery($query);
         $this->db->query();
         KunenaError::checkDatabaseError();
         $this->debug("Created #__kunenadiscuss cross reference table.");
         // Migrate data from old FireBoard discussbot if it exists
         $query = "SHOW TABLES LIKE '{$this->db->getPrefix()}fb_discussbot'";
         $this->db->setQuery($query);
         if ($this->db->loadResult()) {
             $query = "REPLACE INTO `#__kunenadiscuss`\n\t\t\t\t\tSELECT `content_id` , `thread_id`\n\t\t\t\t\tFROM `#__fb_discussbot`";
             $this->db->setQuery($query);
             $this->db->query();
             KunenaError::checkDatabaseError();
             $this->debug("Migrated old data.");
         }
     }
 }
开发者ID:810,项目名称:Kunena-Addons,代码行数:25,代码来源:kunenadiscuss.php

示例6: getProjectsNumber

 /**
  * Count and return projects number of users.
  *
  * <code>
  * $usersId = 1;
  *
  * $statistics     = new CrowdFundingStatisticsUser(JFactory::getDbo(), $usersId);
  * $projectsNumber = $statistics->getProjectsNumber();
  * </code>
  *
  * @return array
  */
 public function getProjectsNumber()
 {
     // If there are no IDs, return empty array.
     if (!$this->id) {
         return array();
     }
     // Create a new query object.
     $query = $this->db->getQuery(true);
     $query->select("COUNT(*) as number")->from($this->db->quoteName("#__crowdf_projects", "a"))->where("a.user_id = " . (int) $this->id);
     $this->db->setQuery($query, 0, 1);
     $results = $this->db->loadResult();
     if (!$results) {
         $results = array();
     }
     return $results;
 }
开发者ID:phpsource,项目名称:CrowdFunding,代码行数:28,代码来源:user.php

示例7: getTotalGlobalTags

 /**
  * This method returns a number of all global tags.
  *
  * <code>
  * $statistics   = new ItpMeta\Statistics\Basic(\JFactory::getDbo());
  * echo $statistics->getTotalGlobalTags();
  * </code>
  *
  * @return int
  */
 public function getTotalGlobalTags()
 {
     $query = $this->db->getQuery(true);
     $query->select('COUNT(*)')->from($this->db->quoteName('#__itpm_global_tags', 'a'));
     $this->db->setQuery($query);
     $result = (int) $this->db->loadResult();
     return $result;
 }
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:18,代码来源:Basic.php

示例8: isValid

 /**
  * Validate project record.
  *
  * <code>
  * $projectId = 1;
  *
  * $record = new Crowdfunding\Validator\Project\Record(\JFactory::getDbo(), $projectId);
  * if(!$record->isValid()) {
  * //......
  * }
  * </code>
  *
  * @throws \RuntimeException
  * @return bool
  */
 public function isValid()
 {
     $query = $this->db->getQuery(true);
     $query->select('COUNT(*)')->from($this->db->quoteName('#__crowdf_projects', 'a'))->where('a.id = ' . (int) $this->projectId);
     // Filter by user.
     $userId = array_key_exists('user_id', $this->options) ? (int) $this->options['user_id'] : 0;
     if ($userId > 0) {
         $query->where('a.user_id = ' . (int) $userId);
     }
     // Filter by state.
     $state = array_key_exists('state', $this->options) ? $this->options['state'] : null;
     if ($state !== null) {
         $query->where('a.published = ' . (int) $state);
     }
     $this->db->setQuery($query, 0, 1);
     return (bool) $this->db->loadResult();
 }
开发者ID:ITPrism,项目名称:CrowdfundingDistribution,代码行数:32,代码来源:Record.php

示例9: getUpdatesNumber

 /**
  * Return the number of updates.
  *
  * <code>
  * $projectId    = 1;
  *
  * $statistics   = new Crowdfunding\Statistics\Project(\JFactory::getDbo(), $projectId);
  * $numberOfUpdates = $statistics->getUpdatesNumber();
  * </code>
  *
  * @return int
  */
 public function getUpdatesNumber()
 {
     // Create a new query object.
     $query = $this->db->getQuery(true);
     $query->select('COUNT(*)')->from($this->db->quoteName('#__crowdf_updates', 'a'))->where('a.project_id = ' . (int) $this->id);
     $this->db->setQuery($query);
     return (int) $this->db->loadResult();
 }
开发者ID:bellodox,项目名称:CrowdFunding,代码行数:20,代码来源:Project.php

示例10: isSelectedByUser

 /**
  * This method checks for selected reward from user.
  * It will be checked, if the reward is part of transactions.
  *
  * <code>
  * $rewardId  = 1;
  *
  * $reward    = new CrowdFundingReward(JFactory::getDbo());
  * $reward->load($rewardId);
  *
  * if ($reward->isSelectedByUser()) {
  * ...
  * }
  * </code>
  *
  * @return bool
  */
 public function isSelectedByUser()
 {
     $query = $this->db->getQuery(true);
     // Count number of selections.
     $query->select("COUNT(*)")->from($this->db->quoteName("#__crowdf_transactions", "a"))->where("a.reward_id = " . (int) $this->id);
     $this->db->setQuery($query, 0, 1);
     $number = $this->db->loadResult();
     return !$number ? false : true;
 }
开发者ID:phpsource,项目名称:CrowdFunding,代码行数:26,代码来源:reward.php

示例11: getContactId

 /**
  * Retrieve Contact
  *
  * @param   int  $created_by  Id of the user who created the contact
  *
  * @return  mixed|null|integer
  */
 protected function getContactId($created_by)
 {
     static $contacts = array();
     if (isset($contacts[$created_by])) {
         return $contacts[$created_by];
     }
     $query = $this->db->getQuery(true);
     $query->select('MAX(contact.id) AS contactid');
     $query->from($this->db->quoteName('#__contact_details', 'contact'));
     $query->where('contact.published = 1');
     $query->where('contact.user_id = ' . (int) $created_by);
     if (JLanguageMultilang::isEnabled() == 1) {
         $query->where('(contact.language in ' . '(' . $this->db->quote(JFactory::getLanguage()->getTag()) . ',' . $this->db->quote('*') . ') ' . ' OR contact.language IS NULL)');
     }
     $this->db->setQuery($query);
     $contacts[$created_by] = $this->db->loadResult();
     return $contacts[$created_by];
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:25,代码来源:contact.php

示例12: getTotalAmount

 /**
  * Get total amount of all transactions.
  *
  * <code>
  * $statistics   = new CrowdFundingStatisticsBasic(JFactory::getDbo());
  * $total = $statistics->getTotalAmount();
  * </code>
  */
 public function getTotalAmount()
 {
     $query = $this->db->getQuery(true);
     $query->select("SUM(a.txn_amount)")->from($this->db->quoteName("#__crowdf_transactions", "a"));
     $this->db->setQuery($query);
     $result = $this->db->loadResult();
     if (!$result) {
         $result = 0;
     }
     return $result;
 }
开发者ID:phpsource,项目名称:CrowdFunding,代码行数:19,代码来源:basic.php

示例13: remove

 /**
  * Remove an extra image from database and file system.
  *
  * <code>
  * $fileId = 1;
  * $filesFolder = "/.../folder";
  *
  * $file   = new CrowdfundingFiles\File\Remover(JFactory::getDbo(), $fileId, $mediaFolder);
  * $file->remove();
  * </code>
  */
 public function remove()
 {
     // Get the image
     $query = $this->db->getQuery(true);
     $query->select("a.filename")->from($this->db->quoteName("#__cffiles_files", "a"))->where("a.id = " . (int) $this->fileId);
     $this->db->setQuery($query, 0, 1);
     $fileName = $this->db->loadResult();
     if (!empty($fileName)) {
         // Remove the file from the filesystem
         $file = \JPath::clean($this->mediaFolder . DIRECTORY_SEPARATOR . $fileName);
         if (\JFile::exists($file)) {
             \JFile::delete($file);
         }
         // Delete the record
         $query = $this->db->getQuery(true);
         $query->delete($this->db->quoteName("#__cffiles_files"))->where($this->db->quoteName("id") . " = " . (int) $this->fileId);
         $this->db->setQuery($query);
         $this->db->execute();
     }
 }
开发者ID:pashakiz,项目名称:crowdf,代码行数:31,代码来源:Remover.php

示例14: getUpdatesNumber

 /**
  * Return the number of updates.
  *
  * <code>
  * $projectId    = 1;
  *
  * $statistics   = new CrowdfundingStatisticsProject(\JFactory::getDbo(), $projectId);
  * $numberOfUpdates = $statistics->getUpdatesNumber();
  * </code>
  *
  * @return int
  */
 public function getUpdatesNumber()
 {
     // Create a new query object.
     $query = $this->db->getQuery(true);
     $query->select("COUNT(*)")->from($this->db->quoteName("#__crowdf_updates", "a"))->where("a.project_id = " . (int) $this->id);
     $this->db->setQuery($query);
     $result = $this->db->loadResult();
     if (!$result) {
         $result = 0;
     }
     return $result;
 }
开发者ID:pashakiz,项目名称:crowdf,代码行数:24,代码来源:Project.php

示例15: getTypeId

 /**
  * Retrieves the UCM type ID
  *
  * @param   string  $alias  The string of the type alias
  *
  * @return  integer  The ID of the requested type
  *
  * @since   3.1
  */
 public function getTypeId($alias = null)
 {
     if (!$alias) {
         $alias = $this->alias;
     }
     $query = $this->db->getQuery(true);
     $query->select('ct.type_id');
     $query->from($this->db->quoteName('#__content_types', 'ct'));
     $query->where($this->db->quoteName('ct.type_alias') . ' = ' . $this->db->q($alias));
     $this->db->setQuery($query);
     $id = $this->db->loadResult();
     return $id;
 }
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:22,代码来源:type.php


注:本文中的JDatabaseDriver::loadResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。