Exemple #1
0
<?php

if ($safe != "U,,5Enc!") {
    die("nepovoleny prístup k súboru!!");
}
$table = "cp";
$actions = array("create", "display_all", "email_send", "email");
if (isset($action) and !empty($action) and in_array($action, $actions)) {
    if ($action == "create") {
        formular_cp($order, $revision, 1, "", $page);
    }
    if ($action == "display_all") {
        if ($message == "ok") {
            echo "<div id=\"ok_message\">Email s Cenovou ponukou bol úspešne odoslaný</div>";
        }
        display_all_revisions_cp($order, $revision);
    }
    if ($action == "email_send") {
        sql_update("UPDATE cp SET datum_email=now() WHERE id=\"{$cp}\"");
        send_email_revision_cp($revision, $cp);
        //die();
        header("location: ?vyber=cp&order={$order}&revision={$revision}&action=display_all&message=ok");
    }
    if ($action == "email") {
        echo "<div class=\"confirm_order_another\"><a href=\"?vyber={$vyber}&order={$order}&revision={$revision}&action=email_send&cp={$cp}\"><strong>Odošli email s cenovou ponukou zákazníkovi</strong></a></div>";
        echo "<div class=\"print\">";
        echo print_revision_cp($cp, $revision);
        echo "</div>";
    }
}
function riadok_cp_simple($table, $cenova_hladina, $field_name, $field_title, $where = "", $field_value = "", $field_price = "", $hidden_id = "")
             } else {
                 echo "<div id=error_message>" . implode("<br>", $error_msg) . "</div>";
             }
         } else {
             $query = "SELECT * FROM revizia_vyrobny_plan \r\n                                WHERE id_vyrobny_plan = {$id}\r\n                                  ";
         }
         echo "<form method=\"POST\">";
         echo textfield("meno", $meno, "Meno plánu *", 40, 20);
         echo textfield("datum_vyvozu", $datum_vyvozu, "Dátum vývozu *", 40, 20);
         $zobraz_vo = array(0 => "štandard", 1 => "48 hodín");
         echo select("delivery", "typ dopravy", "", $delivery, "", "", "", "NO", $zobraz_vo);
         echo textarea("popis", $popis, "Popis", 25, 3, "popis", "");
         echo submit("submit", "Odoslať");
         echo "</form>";
     } else {
         formular_cp($id, $revision);
     }
 }
 if ($action == "edit") {
     $query = "SELECT * FROM vyrobny_plan_row \r\n                        WHERE id_vyrobny_plan = {$id} AND\r\n                                id_revizia_vyrobny_plan = {$revision}\r\n                                AND vymaz = 0\r\n                            ORDER BY id ASC\r\n                          ";
     $all_rows = sql_query($query);
     //var_dump($all_rows);
     $query = "INSERT INTO revizia_vyrobny_plan (id_vyrobny_plan, vytvoril)\r\n                        VALUES (\"{$id}\", \"{$upravil}\")\r\n                        ";
     $vyrobny_plan_rev = sql_insert($query);
     $id_rev = $vyrobny_plan_rev["inserted_id"];
     foreach ($all_rows as $row) {
         sql_insert("INSERT INTO vyrobny_plan_row (id_vyrobny_plan, id_revizia_vyrobny_plan, id_objednavka_row)\r\n                                  VALUES (\"{$row["id_vyrobny_plan"]}\", \"{$id_rev}\", \"{$row["id_objednavka_row"]}\")\r\n                                  ");
     }
     header("location: index.php?vyber={$vyber}&action=create&id={$id}&revision={$id_rev}");
 }
 if ($action == "email_send") {