Ejemplo n.º 1
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(ImportLogEntryPeer::JOB, $_GET['id']);
    $c->setLimit($_POST['rp']);
    $c->setOffset(isset($_POST['page']) ? ($_POST['page'] - 1) * $_POST['rp'] : 0);
    $c->addDescendingOrderByColumn(ImportLogEntryPeer::ID);
    $entries = $importJob->getImportLogEntrys($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(ImportLogEntryPeer::JOB, $importJob->getId());
    $results['page'] = $_POST['page'];
    $results['total'] = ImportLogEntryPeer::doCount($c);
    ?>

	<?php 
    print json_encode($results);
    exit;
}
if (isset($_POST['request'])) {
    if (!strlen(trim($_POST['job_name']))) {
        $error = "Job name must be provided.";
    } else {
        // Instantiate an engine
        $engineClass = $_POST['job_engine'];
        $engine = new $engineClass(null);
        // Wonky, I know.
        $error = $engine->validateConfig();
Ejemplo n.º 2
0
 /**
  * Returns the number of related ImportLogEntry objects.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      PropelPDO $con
  * @return     int Count of related ImportLogEntry objects.
  * @throws     PropelException
  */
 public function countImportLogEntrys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(ImportJobPeer::DATABASE_NAME);
     } else {
         $criteria = clone $criteria;
     }
     if ($distinct) {
         $criteria->setDistinct();
     }
     $count = null;
     if ($this->collImportLogEntrys === null) {
         if ($this->isNew()) {
             $count = 0;
         } else {
             $criteria->add(ImportLogEntryPeer::JOB, $this->id);
             $count = ImportLogEntryPeer::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(ImportLogEntryPeer::JOB, $this->id);
             if (!isset($this->lastImportLogEntryCriteria) || !$this->lastImportLogEntryCriteria->equals($criteria)) {
                 $count = ImportLogEntryPeer::doCount($criteria, $con);
             } else {
                 $count = count($this->collImportLogEntrys);
             }
         } else {
             $count = count($this->collImportLogEntrys);
         }
     }
     return $count;
 }