예제 #1
0
 /**
  * Returns the number of related AutodiscoveryLogEntry objects.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      PropelPDO $con
  * @return     int Count of related AutodiscoveryLogEntry objects.
  * @throws     PropelException
  */
 public function countAutodiscoveryLogEntrys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(AutodiscoveryJobPeer::DATABASE_NAME);
     } else {
         $criteria = clone $criteria;
     }
     if ($distinct) {
         $criteria->setDistinct();
     }
     $count = null;
     if ($this->collAutodiscoveryLogEntrys === null) {
         if ($this->isNew()) {
             $count = 0;
         } else {
             $criteria->add(AutodiscoveryLogEntryPeer::JOB, $this->id);
             $count = AutodiscoveryLogEntryPeer::doCount($criteria, $con);
         }
     } else {
         // criteria has no effect for a new object
         if (!$this->isNew()) {
             // the following code is to determine if a new query is
             // called for.  If the criteria is the same as the last
             // one, just return count of the collection.
             $criteria->add(AutodiscoveryLogEntryPeer::JOB, $this->id);
             if (!isset($this->lastAutodiscoveryLogEntryCriteria) || !$this->lastAutodiscoveryLogEntryCriteria->equals($criteria)) {
                 $count = AutodiscoveryLogEntryPeer::doCount($criteria, $con);
             } else {
                 $count = count($this->collAutodiscoveryLogEntrys);
             }
         } else {
             $count = count($this->collAutodiscoveryLogEntrys);
         }
     }
     return $count;
 }
예제 #2
0
if (isset($_GET['request']) && $_GET['request'] == 'fetch') {
    // We're our AJAX client wanting to get new log data
    $result = array();
    $c = new Criteria();
    $c->add(AutodiscoveryLogEntryPeer::JOB, $_GET['id']);
    $c->setLimit($_POST['rp']);
    $c->setOffset(isset($_POST['page']) ? ($_POST['page'] - 1) * $_POST['rp'] : 0);
    $c->addDescendingOrderByColumn(AutodiscoveryLogEntryPeer::ID);
    $entries = $autodiscoveryJob->getAutodiscoveryLogEntrys($c);
    foreach ($entries as $entry) {
        $results['rows'][] = array('id' => $entry->getId(), 'cell' => array($entry->getTime(), $entry->getReadableType($entry->getType()), $entry->getText()));
    }
    $c = new Criteria();
    $c->add(AutodiscoveryLogEntryPeer::JOB, $autodiscoveryJob->getId());
    $results['page'] = $_POST['page'];
    $results['total'] = AutodiscoveryLogEntryPeer::doCount($c);
    ?>

	<?php 
    print json_encode($results);
    exit;
}
if (isset($_POST['request'])) {
    if ($_POST['request'] == "autodiscover") {
        if (!strlen(trim($_POST['job_name']))) {
            $error = "Job name must be provided.";
        } else {
            if (count($_POST['target']) == 0) {
                $error = "You must provide at least one target.";
            } else {
                ksort($_POST['target']);