/**
  * 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;
 }
Example #2
0
 public function loadAssignment()
 {
     $db = new PHPWS_DB('hms_assignment');
     $db->addWhere('bed_id', $this->id);
     $db->addWhere('term', $this->term);
     $db->loadClass('hms', 'HMS_Assignment.php');
     $result = $db->getObjects('HMS_Assignment');
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     } else {
         if ($result == null) {
             return true;
         } elseif (sizeof($result) > 1) {
             PHPWS_Error::log(HMS_MULTIPLE_ASSIGNMENTS, 'hms', 'HMS_Bed::loadAssignment', "bedid : {$this->id}");
             return false;
         } else {
             $this->_curr_assignment = $result[0];
             return TRUE;
         }
     }
 }
Example #3
0
 /**
  * Pulls all the rooms associated with this floor and stores
  * them in the _room variable.
  */
 public function loadRooms()
 {
     $db = new PHPWS_DB('hms_room');
     $db->addWhere('floor_id', $this->id);
     $db->addOrder('room_number', 'ASC');
     $db->loadClass('hms', 'HMS_Room.php');
     $result = $db->getObjects('HMS_Room');
     //test($result);
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     } else {
         $this->_rooms =& $result;
         return true;
     }
 }
 /**
  * Pulls all the floors associated with this hall and stores them in
  * the _floors variable.
  */
 public function loadFloors()
 {
     if (!$this->id) {
         $this->_floor = null;
         return null;
     }
     $db = new PHPWS_DB('hms_floor');
     $db->addWhere('residence_hall_id', $this->id);
     $db->addOrder('floor_number', 'ASC');
     $db->loadClass('hms', 'HMS_Floor.php');
     $result = $db->getObjects('HMS_Floor');
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     }
     $this->_floors =& $result;
     return true;
 }
Example #5
0
 /**
  * Function called by mod developer to add their
  * link or to just show the menu on that item
  */
 public static function show()
 {
     \Layout::addJSHeader("<script type='text/javascript' src='" . PHPWS_SOURCE_HTTP . "javascript/responsive_img/responsive-img.min.js'></script>", 81);
     $seen = array();
     $key = Key::getCurrent();
     if (empty($key) || empty($key->title) || empty($key->url)) {
         return;
     }
     $db = new PHPWS_DB('menus');
     $db->addWhere('menu_assoc.key_id', $key->id);
     $db->addWhere('id', 'menu_assoc.menu_id');
     $db->loadClass('menu', 'Menu_Item.php');
     Key::restrictView($db, 'menu');
     $result = $db->getObjects('Menu_Item');
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
     } elseif (!empty($result)) {
         foreach ($result as $menu) {
             $seen[] = $menu->id;
             if ($menu->assoc_image) {
                 Layout::set($menu->showAssocImage(), 'menu', 'image');
             }
             Layout::set($menu->view(), 'menu', 'menu_' . $menu->id);
         }
     }
 }
Example #6
0
 /**
  * Pulls all beds associated with this room and stores them in
  * the _beds variable.
  *
  */
 public function loadBeds()
 {
     $db = new PHPWS_DB('hms_bed');
     $db->addWhere('room_id', $this->id);
     $db->addOrder('bedroom_label', 'ASC');
     $db->addOrder('bed_letter', 'ASC');
     $db->loadClass('hms', 'HMS_Bed.php');
     $result = $db->getObjects('HMS_Bed');
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     } else {
         $this->_beds =& $result;
         return true;
     }
 }
Example #7
0
 public static function getEntries(PHPWS_DB $db, $limit, $offset = 0)
 {
     $db->resetColumns();
     $db->setLimit($limit, $offset);
     $db->addOrder('sticky desc');
     $db->addOrder('publish_date desc');
     $db->loadClass('blog', 'Blog.php');
     return $db->getObjects('Blog');
 }