pipeline = $pipeline;
$this->name = $name;
}
public function DrawSequencer() {
?>
pipeline as $existingStep) {
if ($existingStep->name == $newStep . " $n") {
$n++;
}
}
$this->pipeline[] = new Step($newStep, $newStep . " " . $n, count($this->pipeline) + 1);
//var_dump($this->pipeline);
?>
pipeline as $step) {
if ($step->id != $targetStep) {
$tempArray[] = $step;
if ($removed) {
$step::AdjustID(-1);
}
} else {
$removed = true;
}
}
$this->pipeline = $tempArray;
}
public function GetPipeline() {
return $this->pipeline;
}
public function DrawSteps() {
//draw the actual icons in the container div.
if (!empty($this->pipeline)) {
foreach ($this->pipeline as $step) {
if ($this->numStepsInArray < $this->maxNumStepsInArray) {
//var_dump($step);
$step->DrawStep();
$this->numStepsInArray++;
if ($this->numStepsInArray < $this->maxNumStepsInArray && $this->numStepsInArray < count($this->pipeline)) {
echo "";
}
}
}
}
}
public function MoveStep($direction) {
$key = array_search($this->selectedStep, $this->pipeline);
//echo $key;
}
private function MoveEntry(&$array, $key, $dir) {
if ($dir == -1) { // move up
if ($key > 0) {
$reverseArray = array_reverse(array_slice($array, $key - 1, 2, true)); // make a reversed array of the two entries, preserving keys
array_splice($array, $key - 1, 2, $reverseArray); // replace the given range in the oldArray with the reversed Array
}
} else if ($dir == 1) { // move down
if ($key < count($array) - 1) {
$reverseArray = array_reverse(array_slice($array, $key, 2, true)); // make a reversed array of the two entries, preserving keys
array_splice($array, $key, 2, $reverseArray); // replace the given range in the oldArray with the reversed Array
}
}
}
public function SetSelected($key) {
if ($key > 0 && $key < count($this->pipeline)) {
$this->selectedStep = $key;
}
}
public function GetName($name) {
if ($name && $name != "") {
$this->name = $name;
}
}
public function GetFromDB() {
if (isset($_POST['destroy'])) {
unset($_POST['destroy']);
unset($_SESSION['currentPipeline']);
}
if (isset($_POST['clearPipeline'])) {
$this->pipeline = array();
$_SESSION['currentPipeline'] = $this->pipeline;
}
if (isset($_SESSION['currentPipeline']) && !empty($_SESSION['currentPipeline'])) { // take pipeline from session data
$this->pipeline = $_SESSION['currentPipeline'];
} else {
$pipeline = array();
}
if (isset($_POST['objectToCreate'])) { // user clicked a button in the toolbox.
//$this->pipeline[] = new Step($_POST['objectToCreate'], $_POST['objectToCreate'] . " NEW", null);
$this::AddStep($_POST['objectToCreate']);
}
if (isset($_POST['deleteSelected'])) {
if (isset($_POST['selectedStep'])) {
$this->RemoveStep($_POST['selectedStep']);
}
}
//var_dump($_POST);
if (isset($_POST['selectedStep'])) {
$this::SetSelected($_POST['selectedStep']);
}
$_SESSION['currentPipeline'] = $this->pipeline;
}
}
?>