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


PHP JDatabaseQuery类代码示例

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


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

示例1: modifyQuery

 protected function modifyQuery(JDatabaseQuery &$query)
 {
     $query->where("NOT deleted");
     if (isset($this->leader)) {
         if ($this->leader instanceof Leader) {
             $query->where("leaderid = " . $this->leader->id);
         } else {
             if (is_int($this->leader)) {
                 $query->where("leaderid = " . $this->leader);
             } else {
                 if (ctype_digit($this->leader)) {
                     $query->where("leaderid = " . (int) $this->leader);
                 }
             }
         }
     }
     if (isset($this->walkProgramme)) {
         if ($this->walkProgramme instanceof WalkProgramme) {
             $wpID = $this->walkProgramme->id;
         } else {
             $wpID = (int) $this->walkProgramme;
         }
         $query->join('INNER', 'walkprogrammewalklinks ON WalkProgrammeWalkID = walkprogrammewalks.SequenceID');
         $query->where("walkprogrammewalklinks.ProgrammeID = " . $wpID);
     }
     if (isset($this->startTimeMax)) {
         $query->where("meettime <= '" . strftime("%H:%M", $this->startTimeMax) . "'");
     }
 }
开发者ID:SheffieldWalkingGroup,项目名称:swgwebsite,代码行数:29,代码来源:WalkInstanceFactory.php

示例2: prepareOrder

 /**
  * Prepare result ordering.
  *
  * @param \JDatabaseQuery $query
  * @param array $options
  */
 protected function prepareOrder(&$query, $options)
 {
     // Filter by state.
     if (array_key_exists('order', $options)) {
         // Prepare direction of ordering.
         $direction = !array_key_exists('order_dir', $options) ? 'DESC' : $options['order_dir'];
         if (!in_array($direction, $this->allowedDirections, true)) {
             $direction = 'DESC';
         }
         switch ($options['order']) {
             case Constants::ORDER_BY_LOCATION_NAME:
                 // Order by location name.
                 $query->order('l.name ' . $direction);
                 break;
             case Constants::ORDER_BY_NUMBER_OF_PROJECTS:
                 // Order by location name.
                 $query->order('project_number ' . $direction);
                 break;
             default:
                 // Order by project title.
                 $query->order('a.title ' . $direction);
                 break;
         }
     }
 }
开发者ID:bellodox,项目名称:CrowdFunding,代码行数:31,代码来源:Base.php

示例3: toDatabase

 /**
  * Adds fields on this event to a query being prepared to go into the database
  * @param JDatabaseQuery &$query Query being prepared. Modified in place.
  */
 public function toDatabase(JDatabaseQuery &$query)
 {
     foreach ($this->dbmappings as $var => $dbField) {
         if (isset($this->{$var})) {
             $query->set($dbField . " = '" . $query->escape($this->{$var}) . "'");
         }
     }
 }
开发者ID:SheffieldWalkingGroup,项目名称:swgwebsite,代码行数:12,代码来源:SWGBaseModel.php

示例4: modifyQuery

 protected function modifyQuery(JDatabaseQuery &$query)
 {
     $showWhat = array();
     if ($this->getNormal) {
         $showWhat[] = "shownormal";
     }
     if ($this->getNewMember) {
         $showWhat[] = "shownewmember";
     }
     $query->where("(" . implode(" OR ", $showWhat) . ")");
 }
开发者ID:SheffieldWalkingGroup,项目名称:swgwebsite,代码行数:11,代码来源:SocialFactory.php

示例5: addFilter

 /**
  * add filter to query
  *
  * @param   JDatabaseQuery  $query  query object
  *
  * @return JDatabaseQuery
  */
 public function addFilter(JDatabaseQuery $query)
 {
     if (!$this->filterField) {
         return $query;
     }
     $db = JFactory::getDbo();
     //since joomla 3.0 filter_value can be '' too not only filterNullValue
     if (isset($this->filter_value) && strlen($this->filter_value) > 0 && $this->filter_value != $this->filterNullValue) {
         $query->where(" c." . $this->filterField . " = " . $db->escape($this->filter_value, true));
     }
     return $query;
 }
开发者ID:jaanusnurmoja,项目名称:redjoomla,代码行数:19,代码来源:translationRwf_formFilter.php

示例6: addFilter

 /**
  * add filter to query
  *
  * @param   JDatabaseQuery  $query  query object
  *
  * @return JDatabaseQuery
  */
 public function addFilter(JDatabaseQuery $query)
 {
     if (!$this->filterField) {
         return $query;
     }
     $db = JFactory::getDbo();
     //since joomla 3.0 filter_value can be '' too not only filterNullValue
     if (isset($this->filter_value) && strlen($this->filter_value) > 0 && $this->filter_value != $this->filterNullValue) {
         $query->join('INNER', '#__rwf_fields AS rwff ON rwff.id = c.field_id');
         $query->where("rwff.form_id = " . $db->escape($this->filter_value, true));
     }
     return $query;
 }
开发者ID:jaanusnurmoja,项目名称:redjoomla,代码行数:20,代码来源:translationRwf_valueformFilter.php

示例7: sqlValues

 /**
  * Converts an array of values to a string that can be used in SQL to set
  * the according values in a query.
  *
  * @param   array           $data  Values that should be processed.
  * @param   JDatabaseQuery  $q     Optional query object for escaping.
  *
  * @return array
  */
 public static function sqlValues($data, $q = null)
 {
     $output = array();
     foreach ($data as $key => $value) {
         if ($value !== null) {
             if ($q) {
                 $value = $q->escape($value);
             }
             $output[] = $key . ' = "' . $value . '"';
         }
     }
     return $output;
 }
开发者ID:Harmageddon,项目名称:com_monitor,代码行数:22,代码来源:helper.php

示例8: modifyQuery

 protected function modifyQuery(JDatabaseQuery &$query)
 {
     $showWhat = array();
     if ($this->getWithWalks) {
         $showWhat[] = "showWithWalks";
     }
     if ($this->getWithSocials) {
         $showWhat[] = "showWithSocials";
     }
     if ($this->getWithWeekends) {
         $showWhat[] = "showWithWeekends";
     }
     $query->where("(" . implode(" OR ", $showWhat) . ")");
 }
开发者ID:SheffieldWalkingGroup,项目名称:swgwebsite,代码行数:14,代码来源:DummyEventFactory.php

示例9: prepareOrder

 /**
  * Prepare result ordering.
  *
  * @param \JDatabaseQuery $query
  * @param array $options
  */
 protected function prepareOrder(&$query, $options)
 {
     // Filter by state.
     if (isset($options["order"])) {
         // Prepare direction of ordering.
         $direction = !isset($options["order_dir"]) ? "DESC" : $options["order_dir"];
         if (!in_array($direction, $this->allowedDirections)) {
             $direction = "DESC";
         }
         switch ($options["order"]) {
             case Constants::ORDER_BY_LOCATION_NAME:
                 // Order by location name.
                 $query->order("l.name " . $direction);
                 break;
             case Constants::ORDER_BY_NUMBER_OF_PROJECTS:
                 // Order by location name.
                 $query->order("project_number " . $direction);
                 break;
             default:
                 // Order by project title.
                 $query->order("a.title " . $direction);
                 break;
         }
     }
 }
开发者ID:Eautentik,项目名称:CrowdFunding,代码行数:31,代码来源:Base.php

示例10: countItems

 /**
  * Adds Count Items for Category Manager.
  *
  * @param   JDatabaseQuery  $query  The query object of com_categories
  *
  * @return  JDatabaseQuery
  *
  * @since   3.4
  */
 public static function countItems($query)
 {
     // Join articles to categories and count published items
     $query->select('COUNT(DISTINCT cp.id) AS count_published');
     $query->join('LEFT', '#__newsfeeds AS cp ON cp.catid = a.id AND cp.published = 1');
     // Count unpublished items
     $query->select('COUNT(DISTINCT cu.id) AS count_unpublished');
     $query->join('LEFT', '#__newsfeeds AS cu ON cu.catid = a.id AND cu.published = 0');
     // Count archived items
     $query->select('COUNT(DISTINCT ca.id) AS count_archived');
     $query->join('LEFT', '#__newsfeeds AS ca ON ca.catid = a.id AND ca.published = 2');
     // Count trashed items
     $query->select('COUNT(DISTINCT ct.id) AS count_trashed');
     $query->join('LEFT', '#__newsfeeds AS ct ON ct.catid = a.id AND ct.published = -2');
     return $query;
 }
开发者ID:SysBind,项目名称:joomla-cms,代码行数:25,代码来源:newsfeeds.php

示例11: testUnionAllTwo

 /**
  * Tests the JDatabaseQuery::unionAll method.
  *
  * @return  void
  *
  * @since   13.1
  */
 public function testUnionAllTwo()
 {
     TestReflection::setValue($this->_instance, 'unionAll', null);
     $this->_instance->unionAll('SELECT name FROM foo');
     $this->_instance->unionAll('SELECT name FROM bar');
     $teststring = (string) TestReflection::getValue($this->_instance, 'unionAll');
     $this->assertThat($teststring, $this->equalTo(PHP_EOL . "UNION ALL (SELECT name FROM foo)" . PHP_EOL . "UNION ALL (SELECT name FROM bar)"), 'Tests rendered query with two union alls sequentially.');
 }
开发者ID:akirsoft,项目名称:joomla-cms,代码行数:15,代码来源:JDatabaseQueryTest.php

示例12: getOptions

 /**
  * Method to get a list of options for a list input.
  *
  * @return      array           An array of JHtml options.
  */
 protected function getOptions()
 {
     $db = JFactory::getDBO();
     $query = new JDatabaseQuery();
     $query->select('#__helloworld.id as id,greeting,#__categories.title as category,catid');
     $query->from('#__helloworld');
     $query->leftJoin('#__categories on catid=#__categories.id');
     $db->setQuery((string) $query);
     $messages = $db->loadObjectList();
     $options = array();
     if ($messages) {
         foreach ($messages as $message) {
             $options[] = JHtml::_('select.option', $message->id, $message->greeting . ($message->catid ? ' (' . $message->category . ')' : ''));
         }
     }
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
开发者ID:TFToto,项目名称:playjoom-builds,代码行数:23,代码来源:playjoom.php

示例13: getOptions

 /**
  * Method to get a list of options for a list input.
  *
  * @return      array           An array of JHtml options.
  */
 protected function getOptions()
 {
     $db = JFactory::getDBO();
     $query = new JDatabaseQuery();
     $query->select('#__jpaudiotracks.id as id,
                                                    pathatweb,
                                                    pathatlocal,
                                                    file,
                                                    title,
                                                    alias,
                                                    tracknumber,
                                                    mediatype,
                                                    bit_rate,
                                                    sample_rate,
                                                    channels,
                                                    channelmode,
                                                    filesize,
                                                    length,
                                                    catid,
                                                    add_datetime,
                                                    artist,
                                                    album,
                                                    year,
                                                    description,
                                                    lyrics,
                                                    frontcover,
                                                    backcover,
                                                    encoder,
                                                    metakey,
                                                    metadesc,
                             #__categories.title as category,catid');
     $query->from('#__jpaudiotracks');
     $query->leftJoin('#__categories on catid=#__categories.id');
     $db->setQuery((string) $query);
     $tracks = $db->loadObjectList();
     $options = array();
     if ($tracks) {
         foreach ($tracks as $track) {
             $options[] = JHtml::_('select.option', $track->id, $track->name . ($track->catid ? ' (' . $track->category . ')' : ''));
         }
     }
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
开发者ID:TFToto,项目名称:playjoom-builds,代码行数:49,代码来源:audiotrack.php

示例14: implode

	static function &getModules()
	{
		static $modules;
		
		if (!is_null($modules))
			return $modules;

		$mainframe = JFactory::getApplication();

		$user =& JFactory::getUser();
		$db	=& JFactory::getDBO();
		$aid = $user->get('aid', 0);

		$groups	= implode(',', $user->getAuthorisedViewLevels());
		$query = new JDatabaseQuery;
		$query->select('id, title, module, position, content, showtitle, params, mm.menuid');
		$query->from('#__modules AS m');
		$query->join('LEFT','#__modules_menu AS mm ON mm.moduleid = m.id');
		$query->where('m.published = 1');

		if (!$user->authorise('core.admin',1)) {
			$query->where('m.access IN (' . $groups . ')');
		}

		$query->where('m.client_id = ' . (int)$mainframe->getClientId());
		$query->order('position, ordering'); 

		$db->setQuery($query);
		$modules = $db->loadObjectList('id');

		if ($db->getErrorNum()) 
		{
			$modules = array();
		}

		foreach ($modules as $key => $mod)
		{
			$module =& $modules[$key];
			$file = $module->module;
			$custom = substr($file, 0, 4) == 'mod_' ? 0 : 1;
			$module->user = $custom;
			$module->name = $custom ? $module->title : substr( $file, 4 );
			$module->style	= null;
			$module->position = strtolower($module->position);
		}
			
		return $modules;
	}
开发者ID:rkern21,项目名称:videoeditor,代码行数:48,代码来源:class.ModuleHelper.php

示例15: getOptions

 /**
  * Method to get a list of options for a list input.
  *
  * @return      array           An array of JHtml options.
  */
 protected function getOptions()
 {
     $db = JFactory::getDBO();
     $query = new JDatabaseQuery();
     $query->select('#__quipforum_boards.id as id,topic');
     $query->from('#__quipforum_boards');
     $db->setQuery((string) $query);
     $messages = $db->loadObjectList();
     $options = array();
     if ($messages) {
         //if($this->allow_all)
         //	$options[] = JHtml::_('select.option', 0, 'Any');
         foreach ($messages as $message) {
             $options[] = JHtml::_('select.option', $message->id, $message->topic);
         }
     }
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
开发者ID:rgeraldporter,项目名称:com_quipforum,代码行数:24,代码来源:board.php


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