/** deploy() build the tasking output * @return void */ public function deploy() { $Data = $this->obj; $TaskType = new TaskType($_REQUEST['type'] ? $_REQUEST['type'] : 1); // Title $this->title = sprintf('%s %s %s %s', _('Create'), $TaskType->get('name'), _('task for'), $Data->get('name')); // Deploy printf('%s%s%s', '<p class="c"><b>', _('Are you sure you wish to deploy task to these machines'), '</b></p>'); printf('<form method="post" action="%s" id="deploy-container">', $this->formAction); print '<div class="confirm-message">'; if ($TaskType->get('id') == 13) { printf('<center><p>%s</p>', _('Please select the snapin you want to deploy')); if ($Data instanceof Host) { foreach ((array) $Data->get('snapins') as $Snapin) { if ($Snapin && $Snapin->isValid()) { $optionSnapin .= sprintf('<option value="%s">%s - (%s)</option>', $Snapin->get('id'), $Snapin->get('name'), $Snapin->get('id')); } } if ($optionSnapin) { printf('<select name="snapin">%s</select></center>', $optionSnapin); } else { printf('%s</center>', _('No snapins associated')); } } if ($Data instanceof Group) { printf($this->getClass('SnapinManager')->buildSelectBox() . '</center>'); } } printf("%s", '<div class="advanced-settings">'); printf("<h2>%s</h2>", _('Advanced Settings')); printf("%s%s%s <u>%s</u> %s%s", '<p class="hideFromDebug">', '<input type="checkbox" name="shutdown" id="shutdown" value="1" autocomplete="off"><label for="shutdown">', _('Schedule'), _('Shutdown'), _('after task completion'), '</label></p>'); if (!$TaskType->isDebug() && $TaskType->get('id') != 11) { printf("%s%s%s", '<p><input type="checkbox" name="isDebugTask" id="isDebugTask" autocomplete="off" /><label for="isDebugTask">', _('Schedule task as a debug task'), '</label></p>'); printf("%s%s %s%s%s", '<p><input type="radio" name="scheduleType" id="scheduleInstant" value="instant" autocomplete="off" checked/><label for="scheduleInstant">', _('Schedule '), '<u>', _('Instant Deployment'), '</u></label></p>'); printf("%s%s %s%s%s", '<p class="hideFromDebug"><input type="radio" name="scheduleType" id="scheduleSingle" value="single" autocomplete="off" /><label for="scheduleSingle">', _('Schedule '), '<u>', _('Delayed Deployment'), '</u></label></p>'); printf("%s", '<p class="hidden hideFromDebug" id="singleOptions"><input type="text" name="scheduleSingleTime" id="scheduleSingleTime" autocomplete="off" /></p>'); printf("%s%s %s%s%s", '<p class="hideFromDebug"><input type="radio" name="scheduleType" id="scheduleCron" value="cron" autocomplete="off"><label for="scheduleCron">', _('Schedule'), '<u>', _('Cron-style Deployment'), '</u></label></p>'); printf("%s", '<p class="hidden hideFromDebug" id="cronOptions">'); printf("%s", '<input type="text" name="scheduleCronMin" id="scheduleCronMin" placeholder="min" autocomplete="off" />'); printf("%s", '<input type="text" name="scheduleCronHour" id="scheduleCronHour" placeholder="hour" autocomplete="off" />'); printf("%s", '<input type="text" name="scheduleCronDOM" id="scheduleCronDOM" placeholder="dom" autocomplete="off" />'); printf("%s", '<input type="text" name="scheduleCronMonth" id="scheduleCronMonth" placeholder="month" autocomplete="off" />'); printf("%s", '<input type="text" name="scheduleCronDOW" id="scheduleCronDOW" placeholder="dow" autocomplete="off" /></p>'); } else { if ($TaskType->isDebug() || $TaskType->get('id') == 11) { printf("%s%s %s%s%s", '<p><input type="radio" name="scheduleType" id="scheduleInstant" value="instant" autocomplete="off" checked/><label for="scheduleInstant">', _('Schedule '), '<u>', _('Instant Deployment'), '</u></label></p>'); } } if ($TaskType->get('id') == 11) { printf("<p>%s</p>", _('Which account would you like to reset the pasword for')); printf("%s", '<input type="text" name="account" value="Administrator" />'); } print '</div></div><h2>' . _('Hosts in Task') . '</h2>'; unset($this->headerData); $this->attributes = array(array(), array(), array()); $this->templates = array('<a href="${host_link}" title="${host_title}">${host_name}</a>', '${host_mac}', '<a href="${image_link}" title="${image_title}">${image_name}</a>'); if ($Data instanceof Host) { $this->data[] = array('host_link' => $_SERVER['PHP_SELF'] . '?node=host&sub=edit&id=${host_id}', 'image_link' => $_SERVER['PHP_SELF'] . '?node=image&sub=edit&id=${image_id}', 'host_id' => $Data->get('id'), 'image_id' => $Data->getImage()->get('id'), 'host_name' => $Data->get('name'), 'host_mac' => $Data->get('mac'), 'image_name' => $Data->getImage()->get('name'), 'host_title' => _('Edit Host'), 'image_title' => _('Edit Image')); } if ($Data instanceof Group) { foreach ($Data->get('hosts') as $Host) { if ($Host && $Host->isValid()) { $this->data[] = array('host_link' => $_SERVER['PHP_SELF'] . '?node=host&sub=edit&id=${host_id}', 'image_link' => $_SERVER['PHP_SELF'] . '?node=image&sub=edit&id=${image_id}', 'host_id' => $Host->get('id'), 'image_id' => $Host->getImage()->get('id'), 'host_name' => $Host->get('name'), 'host_mac' => $Host->get('mac'), 'image_name' => $Host->getImage()->get('name'), 'host_title' => _('Edit Host'), 'image_title' => _('Edit Image')); } } } // Hook $this->HookManager->processEvent(strtoupper($this->childClass . '_DEPLOY'), array('headerData' => &$this->headerData, 'data' => &$this->data, 'templates' => &$this->templates, 'attributes' => &$this->attributes)); // Output $this->render(); printf('%s%s%s', '<p class="c"><input type="submit" value="', $this->title, '" /></p>'); print '</form>'; }