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


PHP PHPWS_DB::addGroupBy方法代码示例

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


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

示例1: reappAvailability

 /**
  * Report lists rooms in each residence hall that are still available, along with
  * the available beds in the room.  Also, show the number of beds allocated to the
  * lotter for each residence hall.
  *
  */
 public static function reappAvailability()
 {
     $term = Term::getSelectedTerm();
     // Available rooms in each residence hall.
     $db = new PHPWS_DB('hms_bed');
     $db->addJoin('LEFT', 'hms_bed', 'hms_room', 'room_id', 'id');
     $db->addJoin('LEFT', 'hms_room', 'hms_floor', 'floor_id', 'id');
     $db->addJoin('LEFT', 'hms_floor', 'hms_residence_hall', 'residence_hall_id', 'id');
     //$db->addWhere('hms_bed.ra_bed', 0);
     $db->addWhere('hms_room.private', 0);
     $db->addWhere('hms_room.overflow', 0);
     $db->addWhere('hms_room.reserved', 0);
     $db->addWhere('hms_room.offline', 0);
     $db->addWhere('hms_bed.term', $term);
     $db->addColumn('hms_room.room_number');
     $db->addColumn('hms_bed.bed_letter', null, null, True);
     $db->addColumn('hms_residence_hall.hall_name');
     $db->addGroupBy('hms_residence_hall.hall_name');
     $db->addGroupBy('hms_room.room_number');
     $db->addOrder('hms_residence_hall.hall_name');
     $availRooms = $db->select();
     // Allocated beds for lottery.
     $db = new PHPWS_DB('hms_bed');
     $db->addJoin('LEFT', 'hms_bed', 'hms_room', 'room_id', 'id');
     $db->addJoin('LEFT', 'hms_room', 'hms_floor', 'floor_id', 'id');
     $db->addJoin('LEFT', 'hms_floor', 'hms_residence_hall', 'residence_hall_id', 'id');
     $db->addJoin('RIGHT', 'hms_bed', 'hms_lottery_reservation', 'id', 'bed_id');
     $db->addWhere('hms_lottery_reservation.term', $term);
     $db->addColumn('hms_residence_hall.hall_name');
     $db->addColumn('hms_bed.id', null, null, True);
     $db->addGroupBy('hms_residence_hall.hall_name');
     $db->setIndexBy('hall_name');
     $lotteryBeds = $db->select();
     $tpl = new PHPWS_Template('hms');
     $tpl->setFile('admin/reports/reapp_availability.tpl');
     //
     // "The parent row must be parsed after the child rows."
     // Preload currHall with first residence hall name
     $currHall = $availRooms[0]['hall_name'];
     foreach ($availRooms as $row) {
         // Change halls, create new block.
         if ($currHall != $row['hall_name'] || $currHall == null) {
             $tpl->setCurrentBlock('halls');
             // Get allocated beds for the residence hall.
             $lottCount = isset($lotteryBeds[$currHall]['count']) ? $lotteryBeds[$currHall]['count'] : 0;
             $tpl->setData(array('HALL_NAME' => $currHall, 'LOTTERY_BEDS' => $lottCount));
             $tpl->parseCurrentBlock();
             $currHall = $row['hall_name'];
         }
         // Add room to residence hall template block.
         $tpl->setCurrentBlock('rooms');
         $tpl->setData(array('ROOM_NUM' => $row['room_number'], 'BED_COUNT' => $row['count']));
         $tpl->parseCurrentBlock();
     }
     // Get last residence hall. Can't parse parent before child with template class.
     $tpl->setCurrentBlock('halls');
     $tpl->setData(array('HALL_NAME' => $currHall));
     $tpl->parseCurrentBlock();
     return $tpl->get();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:66,代码来源:HMS_Reports.php

示例2: execute

 public function execute()
 {
     PHPWS_Core::initModClass('hms', 'HousingApplication.php');
     $this->reasons = HousingApplication::getCancellationReasons();
     // All students
     $db = new PHPWS_DB('hms_new_application');
     $db->addColumn('cancelled_reason');
     $db->addColumn('id', null, 'ount', true);
     $db->addWhere('term', $this->getTerm());
     $db->addWhere('cancelled', 1);
     $db->addGroupBy('cancelled_reason');
     $this->reasonCounts = $db->select('assoc');
     // Freshmen
     $db = new PHPWS_DB('hms_new_application');
     $db->addColumn('cancelled_reason');
     $db->addColumn('id', null, 'count', true);
     $db->addWhere('term', $this->getTerm());
     $db->addWhere('cancelled', 1);
     $db->addWhere('student_type', TYPE_FRESHMEN);
     $db->addGroupBy('cancelled_reason');
     $this->freshmenReasonCounts = $db->select('assoc');
     // Continuing
     $db = new PHPWS_DB('hms_new_application');
     $db->addColumn('cancelled_reason');
     $db->addColumn('id', null, 'count', true);
     $db->addWhere('term', $this->getTerm());
     $db->addWhere('cancelled', 1);
     $db->addWhere('student_type', TYPE_CONTINUING);
     $db->addGroupBy('cancelled_reason');
     $this->continuingReasonCounts = $db->select('assoc');
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:31,代码来源:CancelledAppsByReason.php

示例3: execute

 public function execute()
 {
     $db = new PHPWS_DB('hms_new_application');
     $db->addColumn('student_type');
     $db->addColumn('id', null, 'count', true);
     $db->addWhere('term', $this->getTerm());
     $db->addWhere('cancelled', 1);
     $db->addGroupBy('student_type');
     $this->typeCounts = $db->select('assoc');
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:10,代码来源:CancelledAppsByType.php

示例4: getModList

 public static function getModList()
 {
     $db = new PHPWS_DB('search');
     $db->addColumn('module', null, null, false, true);
     $db->addColumn('modules.proper_name');
     $db->addGroupBy('modules.proper_name');
     $db->addWhere('search.module', 'modules.title');
     $db->setIndexBy('module');
     $result = $db->select('col');
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
         $result = NULL;
     }
     $mod_list = array('all' => dgettext('search', 'All modules'));
     if (!empty($result)) {
         $mod_list = array_merge($mod_list, $result);
     }
     return $mod_list;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:19,代码来源:User.php


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