Ejemplo n.º 1
0
 public function deploy()
 {
     try {
         $Host = new Host($_REQUEST['id']);
         // Title
         $this->title = $this->foglang['QuickImageMenu'];
         unset($this->headerData);
         $this->attributes = array(array());
         $this->templates = array('${task_started}');
         if (!$Host->getImageMemberFromHostID($_REQUEST['id'])) {
             throw new Exception($this->foglang['ErrorImageAssoc']);
         }
         if (!$Host->createImagePackage('1', "Mobile: " . $ImageMembers->getHost()->get('name'), false, false, true, false, $_SESSION['FOG_USERNAME'])) {
             throw new Exception($this->foglang['FailedTask']);
         }
         $this->data[] = array($this->foglang['TaskStarted']);
     } catch (Exception $e) {
         $this->data[] = array($e->getMessage());
     }
     $this->render();
     $this->FOGCore->redirect('?node=tasks');
 }
Ejemplo n.º 2
0
         $realhost = strtoupper($autoregSysName) == 'MAC' ? $macsimple : str_replace($paddingString, $paddedInsert, $autoregSysName);
         $FOGCore->setSetting('FOG_QUICKREG_SYS_NUMBER', $autoregSysNumber + 1);
     } else {
         $realhost = strtoupper($autoregSysName) == 'MAC' ? $macsimple : $autoregSysName;
     }
     if (!$Host || !$Host->isValid()) {
         $Host = new Host(array('name' => $realhost, 'description' => sprintf('%s %s', _('Created by FOG Reg on'), date('F j, Y, g:i a')), 'imageID' => $realimageid, 'createdTime' => $FOGCore->formatTime('now', 'Y-m-d H:i:s'), 'createdBy' => 'FOGREG'));
     }
     $Host->addModule($ids);
     $Host->addGroup($groupid);
     $Host->addPriMAC($PriMAC);
     $Host->addAddMAC($MACs);
     if (!$Host->save()) {
         throw new Exception(_('Failed to save new Host!'));
     }
     if ($Image->isValid() && $Host->getImageMemberFromHostID()) {
         if ($Host->createImagePackage(1, 'AutoRegTask')) {
             print _('Done, with imaging!');
         } else {
             print _('Done, but unable to create task!');
         }
     } else {
         print _('Done!');
     }
 } else {
     $realhost = $macsimple;
     if (!$Host || !$Host->isValid()) {
         $Host = new Host(array('name' => $realhost, 'description' => sprintf('%s %s', _('Created by FOG Reg on'), date('F j, Y, g:i a')), 'createdTime' => $FOGCore->formatTime('now', 'Y-m-d H:i:s'), 'createdBy' => 'FOGREG'));
         $Host->addPriMAC($PriMAC);
         $Host->addAddMAC($MACs);
         $Host->addModule($ids);