Пример #1
0
 function getEndDatetime($format = null)
 {
     if ($format == null) {
         return $this->end_datetime;
     }
     $date = new RM_Date($this->end_datetime, self::$_dateFormat);
     return $date->toString($format);
 }
Пример #2
0
 /**
  * Returns unit that are not that have a min stay on this period more than this period
  * or don't have a prices at all for this period
  *
  * @param RM_Date $day
  * @param int $persons
  * @param int $length - period length in days
  * @return array - array with
  */
 private function _getByMinPeriod($day, $persons, $length)
 {
     $datetime = $day->toString('Y-m-d');
     $sql = "\n    \t\tSELECT\n    \t\t\t{$this->_name}.unit_id as unit_id\n    \t\tFROM\n    \t\t\t{$this->_name}\n    \t\tWHERE\n    \t\t\tnumber_persons='" . $persons->getAdults() . "'\n                AND min_stay > {$length}\n    \t\t\tAND UNIX_TIMESTAMP(start_datetime) <= UNIX_TIMESTAMP('{$datetime}')\n    \t\t\tAND UNIX_TIMESTAMP(end_datetime) >= UNIX_TIMESTAMP('{$datetime}')";
     $rowsTemp = $this->_getBySQL($sql);
     $notUnitIDs = array();
     foreach ($rowsTemp as $row) {
         $notUnitIDs[] = $row->unit_id;
     }
     return $notUnitIDs;
 }