3 require_once( dirname(__FILE__
).'/base/baserecurringdowntime.php' );
6 * Autogenerated class RecurringDowntime_Model
10 class RecurringDowntime_Model
extends BaseRecurringDowntime_Model
{
11 static public $rewrite_columns = array(
12 'objects' => array('id'),
13 'end_time_string' => array('end_time'),
14 'start_time_string' => array('start_time'),
15 'duration_string' => array('duration'),
18 public function get_weekdays()
20 $weekdays = parent
::get_weekdays();
21 if (is_string($weekdays))
22 $weekdays = unserialize($weekdays);
28 public function get_months()
30 $months = parent
::get_months();
31 if (is_string($months))
32 $months = unserialize($months);
39 * Get the start time, but format it the way times are usually
42 public function get_start_time_string()
44 $start_time = $this->get_start_time();
45 return sprintf("%02d:%02d:%02d", (int)($start_time / 3600 %
24), (int)($start_time / 60 %
60), (int)($start_time %
60));
49 * Get the end time, but format it the way times are usually
52 public function get_end_time_string()
54 $end_time = $this->get_end_time();
55 return sprintf("%02d:%02d:%02d", (int)($end_time / 3600 %
24), (int)($end_time / 60 %
60), (int)($end_time %
60));
59 * Get the duration, but format it the way times are usually
62 public function get_duration_string()
64 $duration = $this->get_duration();
65 return sprintf("%02d:%02d:%02d", (int)($duration / 3600 %
24), (int)($duration / 60 %
60), (int)($duration %
60));
69 * Get all objects in this schedule as a list
71 public function get_objects()
74 $id = $this->get_id();
76 $db = Database
::instance();
77 $res = $db->query('SELECT object_name from recurring_downtime_objects WHERE recurring_downtime_id = '.$id);
78 foreach ($res->result(false) as $row) {
79 $ret[] = $row['object_name'];