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


PHP PHPWS_DB::setDistinct方法代码示例

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


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

示例1: modulesInUse

 public function modulesInUse()
 {
     $db = new PHPWS_DB('phpws_key');
     $db->addColumn('module');
     $db->addColumn('modules.proper_name');
     $db->addWhere('module', 'modules.title');
     $db->addOrder('phpws_key.module');
     $db->setIndexBy('module');
     $db->setDistinct(true);
     return $db->select('col');
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:11,代码来源:Key.php

示例2: getLinks

 /**
  * Returns the menu link objects associated to a menu
  */
 public function getLinks($parent = 0, $active_only = TRUE)
 {
     if (!$this->id) {
         return NULL;
     }
     // Get all records for this menu
     $db = new PHPWS_DB('menu_links');
     $db->setDistinct();
     $db->addWhere('menu_id', $this->id, NULL, NULL, 1);
     Key::restrictView($db);
     $db->addOrder('link_order');
     $db->setIndexBy('id');
     $data = $db->getObjects('Menu_Link');
     if (empty($data) || PHPWS_Error::logIfError($data)) {
         return NULL;
     }
     $final = $this->formLink($data);
     $GLOBALS['MENU_LINKS'][$this->id] = $final;
     return $final;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:23,代码来源:Menu_Item.php

示例3: getAllSlots

 public function getAllSlots($bare = false, $search = null)
 {
     PHPWS_Core::initModClass('signup', 'Slots.php');
     $db = new PHPWS_DB('signup_slots');
     $db->addOrder('s_order');
     $db->addWhere('sheet_id', $this->id);
     $db->setDistinct('true');
     // Prevents a slot from showing up multiple times in the results
     if ($search) {
         $db->addWhere('id', 'signup_peeps.slot_id');
         // Limits results to only Slots containing the search query
         $db->addWhere('signup_peeps.sheet_id', $this->id);
         $db->addWhere('signup_peeps.first_name', "{$search}%", 'like', 'and', 'search');
         $db->addWhere('signup_peeps.last_name', "{$search}%", 'like', 'or', 'search');
     }
     if ($bare) {
         $db->addColumn('id');
         $db->addColumn('title');
         $db->setIndexBy('id');
         return $db->select('col');
     } else {
         $result = $db->getObjects('Signup_Slot');
         if (empty($result) || PHPWS_Error::logIfError($result)) {
             return null;
         }
         $db = new PHPWS_DB('signup_peeps');
         $db->addColumn('id', null, null, true);
         foreach ($result as $slot) {
             $db->addWhere('slot_id', $slot->id);
             $db->addWhere('registered', 1);
             $sub = $db->select('one');
             $db->resetWhere();
             if (!PHPWS_Error::logIfError($sub)) {
                 $slot->_filled = $sub;
             }
         }
     }
     return $result;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:39,代码来源:Sheet.php

示例4: getAllFreeRooms

 public static function getAllFreeRooms($term)
 {
     $db = new PHPWS_DB('hms_room');
     $db->addColumn('id');
     $db->setDistinct();
     // Join other tables so we can do the other 'assignable' checks
     $db->addJoin('LEFT', 'hms_room', 'hms_bed', 'id', 'room_id');
     $db->addJoin('LEFT', 'hms_room', 'hms_floor', 'floor_id', 'id');
     $db->addJoin('LEFT', 'hms_floor', 'hms_residence_hall', 'residence_hall_id', 'id');
     // Term
     $db->addWhere('hms_room.term', $term);
     // Only get rooms with free beds
     $db->addJoin('LEFT OUTER', 'hms_bed', 'hms_assignment', 'id', 'bed_id');
     $db->addWhere('hms_assignment.asu_username', NULL);
     // Order by gender preference (0=>female, 1=>male, 2=>coed), rooms in a single gender hall will be first
     $db->addOrder('hms_residence_hall.gender_type ASC');
     // Make sure everything is online
     $db->addWhere('hms_room.offline', 0);
     $db->addWhere('hms_floor.is_online', 1);
     $db->addWhere('hms_residence_hall.is_online', 1);
     // Make sure nothing is reserved
     $db->addWhere('hms_room.reserved', 0);
     // Don't get RA beds
     $db->addWhere('hms_room.ra', 0);
     // Don't get lobbies
     $db->addWhere('hms_room.overflow', 0);
     // Don't get private rooms
     $db->addWhere('hms_room.private', 0);
     // Don't get rooms on floors reserved for an RLC
     $db->addWhere('hms_floor.rlc_id', NULL);
     $result = $db->select('col');
     // In case of an error, log it and return false
     if (PHPWS_Error::logIfError($result)) {
         return false;
     }
     // Make sure each room is empty and has only two beds
     $ret = array_values(array_filter($result, array('HMS_Room', 'check_two_bed_and_empty_by_id')));
     if ($randomize) {
         shuffle($ret);
     }
     return $ret;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:42,代码来源:HMS_Room.php


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