1 ) { // called from the command-line parse_str($argv[1], $_GET); } // Turn on output buffering ob_start(); // Return all released project //db_store_data("update project set sstatus='niet vrijgegeven'"); // Initial values $index = 0; //// Get all available projects (parents) //if (!isset($_GET['project'])) { // $projects = db_fetch_data("select * from project where parent is null"); //} //else { // $projects = db_fetch_data("select * from project where parent is null and id=" . $_GET['project'] . ""); //} if ((isset($_GET['project'])) || (isset($_GET['project_name'])) || (isset($_GET['customer'])) || (isset($_GET['customer_name']))) { if (isset($_GET['project'])) { // Get project info $projects = db_fetch_data("select * from project where parent is null and id=" . (int)$_GET['project'] . ""); } else if (isset($_GET['project_name'])) { // Get project info $projects = db_fetch_data("select * from project where parent is null and naam='" . mysql_real_escape_string($_GET['project_name']) . "'"); } else if (isset($_GET['customer'])) { // Get project info $projects = db_fetch_data("select * from project where parent is null and klant='" . mysql_real_escape_string($_GET['customer']) . "'"); } else if (isset($_GET['customer_name'])) { // Get customer $customer = db_fetch_data("select * from klant where klantnaam='" . mysql_real_escape_string($_GET['customer_name']) . "'"); if (is_array($customer)) { // Get project info $projects = db_fetch_data("select * from project where parent is null and klant='" . $customer[0]['id'] . "'"); } } if (is_array($projects)) { foreach($projects as $project) { // Create "project" array $items = array($project); if ($project['sstatus'] != "vrijgegeven") { // Collect all periods $periods = db_fetch_project_periods($project['id']); if (is_array($periods)) { foreach($periods as $period) { array_push($items, $period); } } // Update periods (to be sure the status are in sync with the project!) if (is_array($items)) { foreach($items as $item) { if (($item['pstatus'] != $project['pstatus']) || ($item['ostatus'] != $project['ostatus'])) { db_store_data("UPDATE project SET pstatus='" . $project['pstatus'] . "', ostatus='" . $project['ostatus'] . "' where id=" . $item['id']); } } } if (is_array($items)) { foreach($items as $item) { // Create original item $org_item = $item; // Initial pstatus/ostatus values $org_item['pstatus'] = "concept"; $org_item['ostatus'] = "concept"; // Parse step by step to the secure server if (is_null($item['parent'])) { echo "

" . ++$index . ") Project name: " . $item['naam'] . " (database id: " . $item['id'] . ")"; } else { echo "

- period name: " . $item['naam'] . " (database id: " . $item['id'] . ")"; } // Delete complete instruction echo "
- Delete phase: "; $start = microtime_float(); echo (sc_wi($item['id'], ($item['parent'] == NULL) ? TRUE : FALSE, $dummy1, "", "verwijderen")) ? "Does not exists" : "OK"; echo " (Time: " . (microtime_float() - $start) . ")"; // Store concept (Always needed) echo "
- Concept phase: "; $start = microtime_float(); echo (sc_wi($item['id'], ($item['parent'] == NULL) ? TRUE : FALSE, $dummy1, "", "", "", "", "", array("sstatus" => "niet vrijgegeven", "pstatus" => "concept", "ostatus" => "concept", "status" => ""))) ? "ERROR" : "OK"; echo " (Time: " . (microtime_float() - $start) . ")"; // Store planning ready $org_item['pstatus'] = "concept"; if (in_array($item['pstatus'], array("gereed", "geverifieerd", "gevalideerd"))) { echo "
- Planning ready phase: "; $start = microtime_float(); echo (sc_wi($item['id'], ($item['parent'] == NULL) ? TRUE : FALSE, $dummy1, array("general" => $org_item), "", "", "", "", array("sstatus" => "niet vrijgegeven", "pstatus" => "gereed", "ostatus" => "concept"))) ? "ERROR" : "OK"; echo " (Time: " . (microtime_float() - $start) . ")"; $org_item['pstatus'] = "gereed"; } // Store planning verified if (in_array($item['pstatus'], array("geverifieerd", "gevalideerd"))) { echo "
- Planning verified phase: "; $start = microtime_float(); echo (sc_wi($item['id'], ($item['parent'] == NULL) ? TRUE : FALSE, $dummy1, array("general" => $org_item), "", "", "", "", array("sstatus" => "niet vrijgegeven", "pstatus" => "geverifieerd", "ostatus" => "concept"))) ? "ERROR" : "OK"; echo " (Time: " . (microtime_float() - $start) . ")"; $org_item['pstatus'] = "geverifieerd"; } // Store planning validated if (in_array($item['pstatus'], array("gevalideerd"))) { echo "
- Planning validated phase: "; $start = microtime_float(); echo (sc_wi($item['id'], ($item['parent'] == NULL) ? TRUE : FALSE, $dummy1, array("general" => $org_item), "", "", "", "", array("sstatus" => "niet vrijgegeven", "pstatus" => "gevalideerd", "ostatus" => "concept"))) ? "ERROR" : "OK"; echo " (Time: " . (microtime_float() - $start) . ")"; $org_item['pstatus'] = "gevalideerd"; } // Store design ready if (in_array($item['ostatus'], array("gereed", "geverifieerd", "gevalideerd"))) { echo "
- Design ready phase: "; $start = microtime_float(); echo (sc_wi($item['id'], ($item['parent'] == NULL) ? TRUE : FALSE, $dummy1, array("general" => $org_item), "", "", "", "", array("sstatus" => "niet vrijgegeven", "ostatus" => "gereed"))) ? "ERROR" : "OK"; echo " (Time: " . (microtime_float() - $start) . ")"; $org_item['ostatus'] = "gereed"; } // Store design verified if (in_array($item['ostatus'], array("geverifieerd", "gevalideerd"))) { echo "
- Design verified phase: "; $start = microtime_float(); echo (sc_wi($item['id'], ($item['parent'] == NULL) ? TRUE : FALSE, $dummy1, array("general" => $org_item), "", "", "", "", array("sstatus" => "niet vrijgegeven", "ostatus" => "geverifieerd"))) ? "ERROR" : "OK"; echo " (Time: " . (microtime_float() - $start) . ")"; $org_item['ostatus'] = "geverifieerd"; } // Store design validated if (in_array($item['ostatus'], array("gevalideerd"))) { echo "
- Design validated phase: "; $start = microtime_float(); echo (sc_wi($item['id'], ($item['parent'] == NULL) ? TRUE : FALSE, $dummy1, array("general" => $org_item), "", "", "", "", array("sstatus" => "niet vrijgegeven", "ostatus" => "gevalideerd"))) ? "ERROR" : "OK"; echo " (Time: " . (microtime_float() - $start) . ")"; $org_item['ostatus'] = "gevalideerd"; } } } } else { echo "

" . ++$index . ") Project released: " . $project['naam'] . " (database id: " . $project['id'] . ")"; } } } else { echo "Invalid/no project(s)"; } } else { echo "Invalid project"; } // Display output echo ob_get_clean(); ?>