当前位置: 首页>>代码示例>>PHP>>正文


PHP Host::isValid方法代码示例

本文整理汇总了PHP中Host::isValid方法的典型用法代码示例。如果您正苦于以下问题:PHP Host::isValid方法的具体用法?PHP Host::isValid怎么用?PHP Host::isValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Host的用法示例。


在下文中一共展示了Host::isValid方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: snapin_log_post

 /** snapin_log_post()
 		Display's the dates to filter through.
 	*/
 public function snapin_log_post()
 {
     // Set title
     $this->title = _('FOG Snapin Log');
     // This gets the download links for which type of file you want.
     print "\n\t\t\t\t<h2>" . '<a href="export.php?type=csv&filename=SnapinLog" alt="Export CSV" title="Export CSV" target="_blank">' . $this->csvfile . '</a> <a href="export.php?type=pdf&filename=SnapinLog" alt="Export PDF" title="Export PDF" target="_blank">' . $this->pdffile . '</a></h2>';
     // Header Data
     $this->headerData = array(_('Snapin Name'), _('State'), _('Return Code'), _('Return Desc'), _('Create Date'), _('Create Time'));
     // Templates
     $this->templates = array('${snap_name}', '${snap_state}', '${snap_return}', '${snap_detail}', '${snap_create}', '${snap_time}');
     // Setup Report Maker for this class.
     $ReportMaker = new ReportMaker();
     // Set dates and check order is proper
     $date1 = $_REQUEST['date1'];
     $date2 = $_REQUEST['date2'];
     if ($date1 > $date2) {
         $date1 = $_REQUEST['date2'];
         $date2 = $_REQUEST['date1'];
     }
     $date2 = date('Y-m-d', strtotime($date2 . '+1 day'));
     // This is just for the header in the CSV:
     $csvHead = array(_('Host ID'), _('Host Name'), _('Host MAC'), _('Snapin ID'), _('Snapin Name'), _('Snapin Description'), _('Snapin File'), _('Snapin Args'), _('Snapin Run With'), _('Snapin Run With Args'), _('Snapin State'), _('Snapin Return Code'), _('Snapin Return Detail'), _('Snapin Creation Date'), _('Snapin Creation Time'), _('Job Create Date'), _('Job Create Time'), _('Task Checkin Date'), _('Task Checkin Time'));
     foreach ((array) $csvHead as $csvHeader) {
         $ReportMaker->addCSVCell($csvHeader);
     }
     $ReportMaker->endCSVLine();
     // Find all snapin tasks
     $SnapinTasks = $this->getClass('SnapinTaskManager')->find(array('checkin' => '', 'complete' => ''), 'OR', '', '', "BETWEEN '{$date1}' AND '{$date2}'");
     foreach ((array) $SnapinTasks as $SnapinTask) {
         $SnapinCheckin1 = $this->nice_date($SnapinTask->get('checkin'));
         $SnapinCheckin2 = $this->nice_date($SnapinTask->get('complete'));
         // Get the Task based on create date thru complete date
         // Get the snapin
         $Snapin = new Snapin($SnapinTask->get('snapinID'));
         // Get the Job
         $SnapinJob = new SnapinJob($SnapinTask->get('jobID'));
         // Get the Host
         $Host = new Host($SnapinJob->get('hostID'));
         $hostID = $SnapinJob->get('hostID');
         $hostName = $Host->isValid() ? $Host->get('name') : '';
         $hostMac = $Host->isValid() ? $Host->get('mac') : '';
         $snapinID = $SnapinTask->get('snapinID');
         $snapinName = $Snapin->isValid() ? $Snapin->get('name') : '';
         $snapinDesc = $Snapin->isValid() ? $Snapin->get('description') : '';
         $snapinFile = $Snapin->isValid() ? $Snapin->get('file') : '';
         $snapinArgs = $Snapin->isValid() ? $Snapin->get('args') : '';
         $snapinRw = $Snapin->isValid() ? $Snapin->get('runWith') : '';
         $snapinRwa = $Snapin->isValid() ? $Snapin->get('runWithArgs') : '';
         $snapinState = $SnapinTask->get('stateID');
         $snapinReturn = $SnapinTask->get('return');
         $snapinDetail = $SnapinTask->get('detail');
         $snapinCreateDate = $Snapin->isValid() ? $this->formatTime($Snapin->get('createdTime'), 'Y-m-d') : '';
         $snapinCreateTime = $Snapin->isValid() ? $this->formatTime($Snapin->get('createdTime'), 'H:i:s') : '';
         $jobCreateDate = $this->formatTime($SnapinJob->get('createdTime'), 'Y-m-d');
         $jobCreateTime = $this->formatTime($SnapinJob->get('createdTime'), 'H:i:s');
         $TaskCheckinDate = $SnapinCheckin1->format('Y-m-d');
         $TaskCheckinTime = $SnapinCheckin2->format('H:i:s');
         $this->data[] = array('snap_name' => $snapinName, 'snap_state' => $snapinState, 'snap_return' => $snapinReturn, 'snap_detail' => $snapinDetail, 'snap_create' => $snapinCreateDate, 'snap_time' => $snapinCreateTime);
         $ReportMaker->addCSVCell($hostID);
         $ReportMaker->addCSVCell($hostName);
         $ReportMaker->addCSVCell($HostMac);
         $ReportMaker->addCSVCell($snapinID);
         $ReportMaker->addCSVCell($snapinName);
         $ReportMaker->addCSVCell($snapinDesc);
         $ReportMaker->addCSVCell($snapinFile);
         $ReportMaker->addCSVCell($snapinArgs);
         $ReportMaker->addCSVCell($snapinRw);
         $ReportMaker->addCSVCell($snapinRwa);
         $ReportMaker->addCSVCell($snapinState);
         $ReportMaker->addCSVCell($snapinReturn);
         $ReportMaker->addCSVCell($snapinDetail);
         $ReportMaker->addCSVCell($snapinCreateDate);
         $ReportMaker->addCSVCell($snapinCreateTime);
         $ReportMaker->addCSVCell($jobCreateDate);
         $ReportMaker->addCSVCell($jobCreateTime);
         $ReportMaker->addCSVCell($TaskCheckinDate);
         $ReportMaker->addCSVCell($TaskCheckinTime);
         $ReportMaker->endCSVLine();
     }
     // This is for the pdf.
     $ReportMaker->appendHTML($this->process());
     $ReportMaker->outputReport(false);
     $_SESSION['foglastreport'] = serialize($ReportMaker);
 }
开发者ID:bramverstraten,项目名称:fogproject,代码行数:87,代码来源:ReportManagementPage.class.php

示例2: updateDefault

 public function updateDefault($hostid, $onoff)
 {
     foreach ((array) $hostid as $id) {
         $Host = new Host($id);
         if ($Host && $Host->isValid()) {
             $Host->updateDefault($this->get('id'), in_array($Host->get('id'), $onoff));
         }
     }
     return $this;
 }
开发者ID:bramverstraten,项目名称:fogproject,代码行数:10,代码来源:Printer.class.php

示例3: Exception

         $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);
             if (!$Host->save()) {
                 throw new Exception(_('Failed to save new Host!'));
             }
             print _('Done');
         } else {
             print _('Already registered as') . ': ' . $Host->get('name');
         }
     }
 } else {
     print _('Already registered as') . ': ' . $Host->get('name');
 }
开发者ID:bramverstraten,项目名称:fogproject,代码行数:31,代码来源:auto.register.php

示例4: active_snapins

 public function active_snapins()
 {
     // Set title
     $this->title = 'Active Snapins';
     // Header row
     $this->headerData = array(_('Host Name'), _('Snapin'), _('Start Time'), _('State'), _('Kill'));
     $this->templates = array('${host_name}', '<form method="post" method="?node=task&sub=active-snapins">${name}', '${startDate}', '${state}', '<input type="checkbox" id="${id}" class="delid" name="rmid" value="${id}" onclick="this.form.submit()" title="Kill Task" /><label for="${id}" class="icon fa fa-minus-circle" title="' . _('Delete') . '">&nbsp;</label></form>');
     $this->attributes = array(array(), array('class' => 'c'), array('class' => 'c'), array('class' => 'c'), array('width' => 40, 'class' => 'c'));
     $SnapinTasks = $this->getClass('SnapinTaskManager')->find(array('stateID' => array(-1, 0, 1)));
     foreach ((array) $SnapinTasks as $SnapinTask) {
         if ($SnapinTask && $SnapinTask->isValid()) {
             $SnapinJobs = $this->getClass('SnapinJobManager')->find(array('id' => $SnapinTask->get('jobID')));
             foreach ((array) $SnapinJobs as $SnapinJob) {
                 if ($SnapinJob && $SnapinJob->isValid()) {
                     $Host = new Host($SnapinJob->get('hostID'));
                     if ($Host && $Host->isValid()) {
                         foreach ($Host->get('snapins') as $Snapin) {
                             if ($Snapin && $Snapin->isValid() && $Snapin->get('id') == $SnapinTask->get('snapinID')) {
                                 $this->data[] = array('id' => $SnapinTask->get('id'), 'name' => $Snapin->get('name'), 'hostID' => $Host->get('id'), 'host_name' => $Host->get('name'), 'startDate' => $SnapinTask->get('checkin'), 'state' => $SnapinTask->get('stateID') == 0 ? 'Queued' : ($SnapinTask->get('stateID') == 1 ? 'In-Progress' : 'N/A'));
                             }
                         }
                     }
                 }
             }
         }
     }
     // Hook
     $this->HookManager->processEvent('TaskActiveSnapinsData', array('headerData' => &$this->headerData, 'data' => &$this->data, 'templates' => &$this->templates, 'attributes' => &$this->attributes));
     // Output
     $this->render();
 }
开发者ID:BlackstarGroup,项目名称:fogproject,代码行数:31,代码来源:TaskManagementPage.class.php


注:本文中的Host::isValid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。