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


PHP PHPWS_DB::getObjects方法代码示例

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


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

示例1: execute

 public function execute(CommandContext $context)
 {
     $term = Term::getSelectedTerm();
     $messageAll = Current_User::allow('hms', 'email_all');
     $db = new PHPWS_DB('hms_residence_hall');
     $db->addWhere('term', $term);
     $results = $db->getObjects('HMS_Residence_Hall');
     if (PHPWS_Error::logIfError($results) || is_null($results)) {
         $errorMsg = array();
         if (is_null($results)) {
             $errorMsg['error'] = 'You do not have permission to message any halls, sorry.';
         } else {
             $errorMsg['error'] = 'There was a problem reading the database, please try reloading the page.  If the problem persists contact ESS.';
         }
         echo json_encode($errorMsg);
         exit;
     }
     $permission = new HMS_Permission();
     $data = array();
     foreach ($results as $hall) {
         $somethingEnabled = false;
         $floors = $hall->get_floors();
         unset($obj);
         $obj = new stdClass();
         $obj->name = $hall->getHallName();
         $obj->id = $hall->getId();
         $obj->floors = array();
         //$blah = 'Verify: ' . ($permission->verify(UserStatus::getUsername(), $hall, 'email') ? 'true' : 'false');
         if ($permission->verify(UserStatus::getUsername(), $hall, 'email') || $messageAll) {
             $obj->enabled = true;
             $somethingEnabled = true;
             foreach ($floors as $floor) {
                 unset($floor_obj);
                 $floor_obj = new stdClass();
                 $floor_obj->name = "Floor: " . $floor->getFloorNumber();
                 $floor_obj->id = $floor->getId();
                 $floor_obj->enabled = true;
                 $obj->floors[] = $floor_obj;
             }
         } else {
             $obj->enabled = false;
             foreach ($floors as $floor) {
                 unset($floor_obj);
                 $floor_obj = new stdClass();
                 $floor_obj->name = "Floor: " . $floor->getFloorNumber();
                 $floor_obj->id = $floor->getId();
                 $floor_obj->enabled = $permission->verify(Current_User::getUsername(), $floor, 'email');
                 $obj->floors[] = $floor_obj;
                 if ($floor_obj->enabled) {
                     $somethingEnabled = true;
                 }
             }
         }
         if ($somethingEnabled) {
             $data[] = $obj;
         }
     }
     echo json_encode($data);
     exit;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:60,代码来源:ListAllowedHallsCommand.php

示例2: processAll

 public static function processAll($term)
 {
     $db = new PHPWS_DB('hms_banner_queue');
     $db->addWhere('term', $term);
     $db->addOrder('id');
     $items = $db->getObjects('BannerQueueItem');
     $errors = array();
     foreach ($items as $item) {
         $result = null;
         try {
             $result = $item->process();
         } catch (Exception $e) {
             $error = array();
             $error['username'] = $item->asu_username;
             $error['code'] = $e->getCode();
             $error['message'] = $e->getMessage();
             $errors[] = $error;
             continue;
         }
         if ($result === TRUE) {
             $item->delete();
         }
     }
     if (empty($errors)) {
         return TRUE;
     }
     return $errors;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:28,代码来源:BannerQueue.php

示例3: calendar_uninstall

/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function calendar_uninstall(&$content)
{
    PHPWS_Core::initModClass('calendar', 'Schedule.php');
    // Need functions to remove old event tables
    $db = new PHPWS_DB('calendar_schedule');
    $schedules = $db->getObjects('Calendar_Schedule');
    if (PHPWS_Error::isError($schedules)) {
        return $schedules;
    } elseif (empty($schedules)) {
        $result = PHPWS_DB::dropTable('calendar_schedule');
        if (PHPWS_Error::isError($result)) {
            return $result;
        }
        $result = PHPWS_DB::dropTable('calendar_notice');
        if (PHPWS_Error::isError($result)) {
            return $result;
        }
        $result = PHPWS_DB::dropTable('calendar_suggestions');
        if (PHPWS_Error::isError($result)) {
            return $result;
        }
        return true;
    }
    $error = false;
    foreach ($schedules as $sch) {
        $result = $sch->delete();
        if (PHPWS_Error::isError($result)) {
            PHPWS_Error::log($result);
            $error = true;
        }
    }
    $result = PHPWS_DB::dropTable('calendar_schedule');
    if (PHPWS_Error::isError($result)) {
        return $result;
    }
    $result = PHPWS_DB::dropTable('calendar_notice');
    if (PHPWS_Error::isError($result)) {
        return $result;
    }
    $result = PHPWS_DB::dropTable('calendar_suggestions');
    if (PHPWS_Error::isError($result)) {
        return $result;
    }
    if (PHPWS_DB::isTable('converted')) {
        $db2 = new PHPWS_DB('converted');
        $db2->addWhere('convert_name', array('schedule', 'calendar'));
        $db2->delete();
        $content[] = dgettext('calendar', 'Removed convert flag.');
    }
    if (!$error) {
        $content[] = dgettext('calendar', 'Calendar tables removed.');
    } else {
        $content[] = dgettext('calendar', 'Some errors occurred when uninstalling Calendar.');
    }
    return true;
}
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:60,代码来源:uninstall.php

示例4: getAssignmentsByTermStateType

 public static function getAssignmentsByTermStateType($term, $state, $type)
 {
     $db = new PHPWS_DB('hms_learning_community_applications');
     $db->addColumn('hms_learning_community_applications.*');
     $db->addColumn('hms_learning_community_assignment.*');
     $db->addJoin('', 'hms_learning_community_applications', 'hms_learning_community_assignment', 'id', 'application_id');
     $db->addWhere('term', $term);
     $db->addWhere('hms_learning_community_assignment.state', $state);
     $db->addWhere('application_type', $type);
     return $db->getObjects('HMS_RLC_Assignment');
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:11,代码来源:RlcAssignmentFactory.php

示例5: getChangesForInternship

 public static function getChangesForInternship(Internship $internship)
 {
     $db = new \PHPWS_DB('intern_change_history');
     $db->addWhere('internship_id', $internship->getId());
     $db->addOrder('timestamp ASC');
     $results = $db->getObjects('\\Intern\\ChangeHistory');
     if (\PHPWS_Error::logIfError($results)) {
         throw new \Exception($results->toString());
     }
     return $results;
 }
开发者ID:jlbooker,项目名称:InternshipInventory,代码行数:11,代码来源:ChangeHistoryFactory.php

示例6: getForTerm

 public static function getForTerm($term)
 {
     $db = new PHPWS_DB('hms_application_feature');
     $db->addWhere('term', $term);
     $result = $db->getObjects('ApplicationFeature');
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     }
     // TODO: Reorg so the array is indexed by the class name.
     return $result;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:11,代码来源:ApplicationFeatureFactory.php

示例7: __construct

 public function __construct($term)
 {
     parent::__construct($term);
     $db = new PHPWS_DB('hms_special_assignment');
     $db->addWhere('term', $this->term);
     $result = $db->getObjects('SpecialAssignment');
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->getMessage());
     }
     $this->specials = $result;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:11,代码来源:SpecialAssignmentStrategy.php

示例8: getChangesForInternship

 public static function getChangesForInternship(Internship $internship)
 {
     PHPWS_Core::initModClass('intern', 'ChangeHistory.php');
     $db = new PHPWS_DB('intern_change_history');
     $db->addWhere('internship_id', $internship->getId());
     $db->addOrder('timestamp ASC');
     $results = $db->getObjects('ChangeHistory');
     if (PHPWS_Error::logIfError($results)) {
         throw new Exception($results->toString());
     }
     return $results;
 }
开发者ID:jeffrafter,项目名称:InternshipInventory,代码行数:12,代码来源:ChangeHistoryFactory.php

示例9: showFeeds

 public static function showFeeds()
 {
     PHPWS_Core::initModClass('rss', 'Feed.php');
     $db = new PHPWS_DB('rss_feeds');
     $db->addWhere('display', 1);
     $result = $db->getObjects('RSS_Feed');
     if (empty($result)) {
         return;
     }
     foreach ($result as $feed) {
         $listing[] = $feed->view();
     }
     Layout::add(implode('', $listing), 'rss', 'feeds');
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:14,代码来源:RSS.php

示例10: getDamagesBefore

 /**
  * Returns the set of RoomDamage objects that were created before
  * the give timestmap.
  *
  * @param HMS_Room $room
  * @param unknown $timestamp
  * @throws DatabaseException
  * @throws InvalidArgumentException
  * @return Array<RoomDamage> null
  */
 public static function getDamagesBefore(HMS_Room $room, $timestamp)
 {
     if (!isset($timestamp)) {
         throw new InvalidArgumentException('Missing timestamp.');
     }
     $db = new PHPWS_DB('hms_room_damage');
     $db->addWhere('room_persistent_id', $room->getPersistentId());
     $db->addWhere('repaired', 0);
     $db->addWhere('reported_on', $timestamp, '<=');
     $result = $db->getObjects('RoomDamageDb');
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     }
     return $result;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:25,代码来源:RoomDamageFactory.php

示例11: init

 /**
  * initialize this object (fill the array) with assignment histories
  *
  * @param int $bannerID banner id of student
  * @param int $term term to be searching
  * @return boolean flag to signal if the initialization was a success
  */
 private function init()
 {
     $db = new PHPWS_DB('hms_assignment_history');
     $db->addWhere('banner_id', $this->bannerId);
     $db->loadClass('hms', 'AssignmentHistory.php');
     $db->addOrder(array('term DESC', 'assigned_on DESC'));
     $result = $db->getObjects('AssignmentHistory');
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     }
     if (isset($result)) {
         $this->assignmentHistory = $result;
     }
     return true;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:22,代码来源:StudentAssignmentHistory.php

示例12: loadPeeps

 public function loadPeeps($registered = true)
 {
     PHPWS_Core::initModClass('signup', 'Peeps.php');
     $db = new PHPWS_DB('signup_peeps');
     $db->addWhere('slot_id', $this->id);
     if ($registered) {
         $db->addWhere('registered', 1);
     } else {
         $db->addWhere('registered', 0);
     }
     $db->addOrder('last_name');
     $peeps = $db->getObjects('Signup_Peep');
     if (PHPWS_Error::logIfError($peeps)) {
         return false;
     } else {
         $this->_peeps =& $peeps;
         return true;
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:19,代码来源:Slots.php

示例13: layout_unregister

/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function layout_unregister($module, &$content)
{
    PHPWS_Core::initModClass('layout', 'Box.php');
    $content[] = dgettext('layout', 'Removing old layout components.');
    $db = new PHPWS_DB('layout_box');
    $db->addWhere('module', $module);
    $moduleBoxes = $db->getObjects('Layout_Box');
    if (empty($moduleBoxes)) {
        return;
    }
    if (PHPWS_Error::isError($moduleBoxes)) {
        return $moduleBoxes;
    }
    foreach ($moduleBoxes as $box) {
        $box->kill();
    }
    // below makes sure box doesn't get echoed
    unset($GLOBALS['Layout'][$module]);
    unset($_SESSION['Layout_Settings']->_boxes[$module]);
}
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:24,代码来源:unregister.php

示例14: getContactsForInternship

 /**
  * Returns an array of EmergencyContact objects for the given Internship.
  *
  * @param Internship $i
  * @return Array<EmergencyContact> Array of EmergencyContact objects for the given Internship, or an empty array if none exist.
  * @throws InvalidArgumentException
  * @throws Exception
  * @see EmergencyContactDB
  */
 public static function getContactsForInternship(Internship $i)
 {
     $internshipId = $i->getId();
     if (is_null($internshipId) || !isset($internshipId)) {
         throw new \InvalidArgumentException('Internship ID is required.');
     }
     $db = new \PHPWS_DB('intern_emergency_contact');
     $db->addWhere('internship_id', $internshipId);
     $db->addOrder('id ASC');
     // Get them in order of ID, so earliest contacts come first
     $result = $db->getObjects('Intern\\EmergencyContactDB');
     if (\PHPWS_Error::logIfError($result)) {
         throw new \Exception($result->toString());
     }
     if (sizeof($result) <= 0) {
         return array();
         // Return an empty array
     }
     return $result;
 }
开发者ID:jlbooker,项目名称:InternshipInventory,代码行数:29,代码来源:EmergencyContactFactory.php

示例15: get_movein_times_array

 public static function get_movein_times_array($term = NULL)
 {
     if (!isset($term)) {
         PHPWS_Core::initModClass('hms', 'Term.php');
         $term = Term::getSelectedTerm();
     }
     $db = new PHPWS_DB('hms_movein_time');
     $db->addWhere('term', $term);
     $db->addOrder('begin_timestamp', 'ASC');
     $result = $db->getObjects('HMS_Movein_Time');
     if (PEAR::isError($result)) {
         return false;
     }
     $timestamps = array();
     $timestamps[0] = 'None';
     if (!empty($result)) {
         foreach ($result as $movein) {
             $timestamps[$movein->id] = $movein->get_formatted_begin_end();
         }
     }
     return $timestamps;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:22,代码来源:HMS_Movein_Time.php


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