コード例 #1
0
 /**
  * Ajouter un processus enfant.
  * @param Process $proc Le processus a ajouter.
  */
 public function addChildProcess(Process $proc)
 {
     $this->childs[] = $proc->getId();
 }
コード例 #2
0
ファイル: Process.php プロジェクト: sapray/ampersand-models
    $session['judge'] = array();
    for ($i0 = 0; isset($r['0.1.' . $i0]); $i0++) {
        $session['judge'][$i0] = @$r['0.1.' . $i0 . ''];
    }
    $case = array('id' => @$r['1'], 'area of law' => @$r['1.0']);
    $case['type of case'] = array();
    for ($i0 = 0; isset($r['1.1.' . $i0]); $i0++) {
        $case['type of case'][$i0] = @$r['1.1.' . $i0 . ''];
    }
    $case['session'] = array();
    for ($i0 = 0; isset($r['1.2.' . $i0]); $i0++) {
        $case['session'][$i0] = @$r['1.2.' . $i0 . ''];
    }
    $Process = new Process($ID, $session, $case);
    if ($Process->save() !== false) {
        die('ok:' . $_SERVER['PHP_SELF'] . '?Process=' . urlencode($Process->getId()));
    } else {
        die('');
    }
    exit;
    // do not show the interface
}
$buttons = "";
if (isset($_REQUEST['new'])) {
    $new = true;
} else {
    $new = false;
}
if (isset($_REQUEST['edit']) || $new) {
    $edit = true;
} else {
コード例 #3
0
    /**
     * Insert a new process.
     * @param $processType integer one of the PROCESS_TYPE_* constants
     * @param $maxParallelism integer the max. number
     *  of parallel processes allowed for the given
     *  process type.
     * @return Process the new process instance, boolean
     *  false if there are too many parallel processes.
     */
    function &insertObject($processType, $maxParallelism)
    {
        // Free processing slots occupied by zombie processes.
        $this->deleteZombies();
        // Cap the parallelism to the max. parallelism.
        $maxParallelism = min($maxParallelism, PROCESS_MAX_PARALLELISM);
        // Check whether we're allowed to spawn another process.
        $currentParallelism = $this->getNumberOfObjectsByProcessType($processType);
        if ($currentParallelism >= $maxParallelism) {
            $falseVar = false;
            return $falseVar;
        }
        // We create a process instance from the given data.
        $process = new Process();
        $process->setProcessType($processType);
        // Generate a new process ID. See classdoc for process ID
        // requirements.
        $process->setId(uniqid('', true));
        // Generate the timestamp.
        $process->setTimeStarted(time());
        // Persist the process.
        $this->update(sprintf('INSERT INTO processes
				(process_id, process_type, time_started, obliterated)
				VALUES
				(?, ?, ?, 0)'), array($process->getId(), (int) $process->getProcessType(), (int) $process->getTimeStarted()));
        $process->setObliterated(false);
        return $process;
    }
コード例 #4
0
ファイル: ProcessList.php プロジェクト: sgc-fireball/libphp
 /**
  * @param Process $process
  * @return self
  */
 public function addProcess(Process $process) : self
 {
     $this->processes[$process->getId()] = $process;
     return $this;
 }