public function __construct($minute, $hour = null, $dom = null, $month = null, $dow = null)
 {
     parent::__construct();
     if ($minute != null && $hour == null && $dom == null && $month == null && $dow == null) {
         // Single task based on timestamp
         $this->lngSingle = $minute;
         $this->debug = false;
         $this->blSingle = true;
     } else {
         $this->cron = $minute . ' ' . $hour . ' ' . $dom . ' ' . $month . ' ' . $dow;
         $this->lngSingle = self::parse($this->cron);
         $this->debug = false;
         $this->blSingle = false;
     }
 }
 public function scheduled()
 {
     // Set title
     $this->title = 'Scheduled Tasks';
     // Header row
     $this->headerData = array(_('Name:'), _('Is Group'), _('Task Name'), _('Task Type'), _('Start Time'), _('Active/Type'), _('Kill'));
     // Row templates
     $this->templates = array('<a href="?node=${hostgroup}&sub=edit&id=${id}" title="Edit ${hostgroupname}">${hostgroupname}</a>', '${groupbased}<form method="post" action="?node=task&sub=scheduled">', '${details_taskname}', '${task_type}', '<small>${time}</small>', '${active}/${type}', '<input type="checkbox" name="rmid" id="r${schedtaskid}" class="delid" value="${schedtaskid}" onclick="this.form.submit()" /><label for="r${schedtaskid}" class="icon fa fa-minus-circle" title="' . _('Delete') . '">&nbsp;</label></form>');
     // Row attributes
     $this->attributes = array(array('width' => 120, 'class' => 'l'), array(), array('width' => 110, 'class' => 'l'), array('class' => 'c', 'width' => 80), array('width' => 70, 'class' => 'c'), array('width' => 100, 'class' => 'c', 'style' => 'padding-right: 10px'), array('class' => 'c'));
     foreach ((array) $this->getClass('ScheduledTaskManager')->find() as $task) {
         if ($task && $task->isValid()) {
             $Host = $task->getHost();
             if ($Host && $Host->isValid()) {
                 $taskType = $task->getTaskType();
                 if ($task->get('type') == 'C') {
                     $taskTime = FOGCron::parse($task->get('minute') . ' ' . $task->get('hour') . ' ' . $task->get('dayOfMonth') . ' ' . $task->get('month') . ' ' . $task->get('dayOfWeek'));
                 } else {
                     $taskTime = $task->get('scheduleTime');
                 }
                 $taskTime = $this->nice_date()->setTimestamp($taskTime);
                 $hostGroupName = $task->isGroupBased() ? $task->getGroup() : $task->getHost();
                 $this->data[] = array('columnkill' => '${details_taskforce} <a href="?node=task&sub=cancel-task&id=${id}"><i class="icon fa fa-minus-circle" title="' . _('Cancel Task') . '"></i></a>', 'hostgroup' => $task->isGroupBased() ? 'group' : 'host', 'hostgroupname' => $hostGroupName, 'id' => $hostGroupName->get('id'), 'groupbased' => $task->isGroupBased() ? _('Yes') : _('No'), 'details_taskname' => $task->get('name'), 'time' => $this->formatTime($taskTime), 'active' => $task->get('isActive') ? 'Yes' : 'No', 'type' => $task->get('type') == 'C' ? 'Cron' : 'Delayed', 'schedtaskid' => $task->get('id'), 'task_type' => $taskType);
             }
         }
     }
     // Hook
     $this->HookManager->processEvent('TaskScheduledData', array('headerData' => &$this->headerData, 'data' => &$this->data, 'templates' => &$this->templates, 'attributes' => &$this->attributes));
     // Output
     $this->render();
 }