fogproject  1.5.9
About: FOG is a Linux-based network computer cloning solution for Windows, Mac OSX and various Linux distributions that ties together a few open-source tools with a PHP-based web interface. FOG doesn’t use any boot disks, or CDs; everything is done via TFTP and PXE.
  Fossies Dox: fogproject-1.5.9.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

scheduledtask.class.php
Go to the documentation of this file.
1 <?php
23 {
29  protected $databaseTable = 'scheduledTasks';
35  protected $databaseFields = array(
36  'id' => 'stID',
37  'name' => 'stName',
38  'description' => 'stDesc',
39  'type' => 'stType',
40  'taskType' => 'stTaskTypeID',
41  'minute' => 'stMinute',
42  'hour' => 'stHour',
43  'dayOfMonth' => 'stDOM',
44  'month' => 'stMonth',
45  'dayOfWeek' => 'stDOW',
46  'isGroupTask' => 'stIsGroup',
47  'hostID' => 'stGroupHostID',
48  'shutdown' => 'stShutDown',
49  'other1' => 'stOther1',
50  'other2' => 'stOther2',
51  'other3' => 'stOther3',
52  'other4' => 'stOther4',
53  'other5' => 'stOther5',
54  'scheduleTime' => 'stDateTime',
55  'isActive' => 'stActive',
56  'imageID' => 'stImageID',
57  );
63  protected $databaseFieldsRequired = array(
64  'type',
65  'taskType',
66  'hostID',
67  );
73  public function getHost()
74  {
75  return new Host($this->get('hostID'));
76  }
82  public function getGroup()
83  {
84  return new Group($this->get('hostID'));
85  }
91  public function getImage()
92  {
93  return new Image($this->get('imageID'));
94  }
100  public function getTimer()
101  {
102  if ($this->get('type') == 'C') {
103  $minute = trim($this->get('minute'));
104  } else {
105  $minute = trim($this->get('scheduleTime'));
106  }
107  $hour = trim($this->get('hour'));
108  $dom = trim($this->get('dayOfMonth'));
109  $month = trim($this->get('month'));
110  $dow = trim($this->get('dayOfWeek'));
111  return new Timer($minute, $hour, $dom, $month, $dow);
112  }
118  public function isMulticast()
119  {
120  return (bool)self::getClass('TaskType', $this->get('taskType'))
121  ->isMulticast();
122  }
128  public function getScheduledType()
129  {
130  return $this->get('type') == 'C' ? _('Cron') : _('Delayed');
131  }
137  public function getTaskType()
138  {
139  return new TaskType($this->get('taskType'));
140  }
146  public function isGroupBased()
147  {
148  return (bool)$this->get('isGroupTask') > 0;
149  }
155  public function isActive()
156  {
157  return (bool)$this->get('isActive') > 0;
158  }
164  public function getTime()
165  {
166  return self::niceDate()
167  ->setTimestamp(
168  (
169  $this->get('type') == 'C' ?
171  sprintf(
172  '%s %s %s %s %s',
173  $this->get('minute'),
174  $this->get('hour'),
175  $this->get('dayOfMonth'),
176  $this->get('month'),
177  $this->get('dayOfWeek')
178  )
179  ) :
180  $this->get('scheduleTime')
181  )
182  )->format('Y-m-d H:i');
183  }
189  public function cancel()
190  {
191  return $this->destroy();
192  }
193 }
FOGBase\niceDate
static niceDate($date='now', $utc=false)
Definition: fogbase.class.php:1105
FOGBase\getClass
static getClass($class, $data='', $props=false)
Definition: fogbase.class.php:439
ScheduledTask\getImage
getImage()
Definition: scheduledtask.class.php:91
TaskType
Definition: tasktype.class.php:23
Image
Definition: image.class.php:23
ScheduledTask\getHost
getHost()
Definition: scheduledtask.class.php:73
FOGCron\parse
static parse($cron, $lastrun=false)
Definition: fogcron.class.php:64
ScheduledTask\isActive
isActive()
Definition: scheduledtask.class.php:155
Timer
Definition: timer.class.php:25
FOGController\destroy
destroy($key='id')
Definition: fogcontroller.class.php:656
ScheduledTask\getGroup
getGroup()
Definition: scheduledtask.class.php:82
ScheduledTask\$databaseFieldsRequired
$databaseFieldsRequired
Definition: scheduledtask.class.php:63
ScheduledTask
Definition: scheduledtask.class.php:23
ScheduledTask\$databaseFields
$databaseFields
Definition: scheduledtask.class.php:35
FOGController
Definition: fogcontroller.class.php:29
Group
Definition: group.class.php:23
ScheduledTask\$databaseTable
$databaseTable
Definition: scheduledtask.class.php:29
ScheduledTask\getTime
getTime()
Definition: scheduledtask.class.php:164
ScheduledTask\isGroupBased
isGroupBased()
Definition: scheduledtask.class.php:146
ScheduledTask\getTaskType
getTaskType()
Definition: scheduledtask.class.php:137
ScheduledTask\getTimer
getTimer()
Definition: scheduledtask.class.php:100
ScheduledTask\cancel
cancel()
Definition: scheduledtask.class.php:189
ScheduledTask\getScheduledType
getScheduledType()
Definition: scheduledtask.class.php:128
Host
Definition: host.class.php:23
ScheduledTask\isMulticast
isMulticast()
Definition: scheduledtask.class.php:118