Ejemplo n.º 1
0
 /**
  * Constructor
  *
  * @param HMS_Room $room
  * @param integer $damageType
  * @param string $note
  */
 public function __construct(HMS_Room $room, $term, $damageType, $side, $note)
 {
     $this->id = null;
     $this->room_persistent_id = $room->getPersistentId();
     $this->term = $term;
     $this->damage_type = $damageType;
     $this->side = $side;
     $this->repaired = false;
     $this->note = $note;
     $this->reported_by = Current_User::getUsername();
     $this->reported_on = time();
 }
Ejemplo n.º 2
0
 /**
  * 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;
 }