Esempio n. 1
0
function edit_allocations_for_transaction($type, $trans_no)
{
    global $systypes_array;
    $cart = $_SESSION['alloc'];
    display_heading(sprintf(_("Allocation of %s # %d"), $systypes_array[$cart->type], $cart->trans_no));
    display_heading($cart->person_name);
    display_heading2(_("Date:") . " <b>" . $cart->date_ . "</b>");
    display_heading2(_("Total:") . " <b>" . price_format($cart->bank_amount) . ' ' . $cart->currency . "</b>");
    if ($cart->currency != $cart->person_curr) {
        $total = _("Total in clearing currency:") . " <b>" . price_format($cart->amount) . "</b>" . sprintf(" %s (%s %s/%s)", $cart->person_curr, exrate_format($cart->bank_amount / $cart->amount), $cart->currency, $cart->person_curr);
        display_heading2($total);
    }
    echo "<br>";
    start_form();
    div_start('alloc_tbl');
    if (count($cart->allocs) > 0) {
        show_allocatable(true);
        submit_center_first('UpdateDisplay', _("Refresh"), _('Start again allocation of selected amount'), true);
        submit('Process', _("Process"), true, _('Process allocations'), 'default');
        submit_center_last('Cancel', _("Back to Allocations"), _('Abandon allocations and return to selection of allocatable amounts'), 'cancel');
    } else {
        display_note(_("There are no unsettled transactions to allocate."), 0, 1);
        submit_center('Cancel', _("Back to Allocations"), true, _('Abandon allocations and return to selection of allocatable amounts'), 'cancel');
    }
    div_end();
    end_form();
}
Esempio n. 2
0
function edit($table, $vyber, $id)
{
    $error_msg = array();
    if ($_POST[submit]) {
        $meno = sec_sql(sec_input($_POST["meno"]));
        $hodnota = sec_sql(sec_input($_POST["hodnota"]));
        if (strlen($meno) > 30 or strlen($meno) < 3) {
            $error_msg[] = "Meno môže mať od 4 do 30 znakov";
        }
        if (strlen($hodnota) > 30 or strlen($hodnota) < 3) {
            $error_msg[] = "Hodnota môže mať od 4 do 30 znakov";
        }
        //var_dump($error_msg);
        if (empty($error_msg)) {
            echo "ok";
        } else {
            echo "<div id=error_message>" . implode("<br>", $error_msg) . "</div>";
        }
    }
    $id = sec_sql($id);
    $query = "Select id, hodnota, meno from " . PREFIX . "{$table} WHERE id={$id}";
    $value = sql_query($query);
    $value = $value[0];
    echo "<form method=\"POST\">";
    hidden("id", $value[id]);
    textfield("meno", $value[meno], "Meno", 50, 20);
    textfield("hodnota", $value[hodnota], "Hodnota", 40, 20);
    submit("submit", "Odoslať");
    echo "</form>";
}
function showCustomerForm($data, $action, $badFields)
{
    formHeader($action, "<h1>Customer Info Form</h1>", "customerForm", "void");
    customerFields($data, $badFields);
    tableRow(array(tableData(""), tableData(""), tableData(""), tableData(""), tableData(""), tableData(submit("Enter/Edit Customer!"), "right")));
    echo getWordpressHiddenFormField();
    formFooter("customerForm");
}
function showPackageForm($data, $action, $badFields)
{
    formHeader($action, "Package Form", "packageForm", "void");
    packageFields($data, $badFields);
    tableRow(array(tableData(""), tableData(""), tableData(""), tableData(""), tableData(""), tableData(submit("Submit!"))));
    echo getWordpressHiddenFormField();
    formFooter("packageForm");
}
Esempio n. 5
0
 public function parse($orig_name)
 {
     global $CORE;
     ob_start();
     if (is_action()) {
         try {
             $name = post('name');
             if (!$name) {
                 throw new FieldInputError('name', l('Please provide a map name.'));
             }
             if (!preg_match(MATCH_MAP_NAME, $name)) {
                 throw new FieldInputError('name', l('This is not a valid map name (need to match [M])', array('M' => MATCH_MAP_NAME)));
             }
             if (count($CORE->getAvailableMaps('/^' . $name . '$/')) > 0) {
                 throw new FieldInputError('name', l('A map with this name already exists.'));
             }
             // Read the old config
             $MAPCFG = new GlobalMapCfg($orig_name);
             $MAPCFG->readMapConfig();
             // Create a new map config
             $NEW = new GlobalMapCfg($name);
             $NEW->createMapConfig();
             foreach ($MAPCFG->getMapObjects() as $object_id => $cfg) {
                 $NEW->addElement($cfg['type'], $cfg, $perm = true, $object_id);
             }
             success(l('The map has been created.'));
             reload(cfg('paths', 'htmlbase') . '/frontend/nagvis-js/index.php?mod=Map&show=' . $name, 1);
         } catch (FieldInputError $e) {
             form_error($e->field, $e->msg);
         } catch (NagVisException $e) {
             form_error(null, $e->message());
         } catch (Exception $e) {
             if (isset($e->msg)) {
                 form_error(null, $e->msg);
             } else {
                 throw $e;
             }
         }
     }
     echo $this->error;
     echo '<div class="simple_form">' . N;
     js_form_start('to_new_map');
     input('name');
     submit(l('Save'));
     focus('name');
     // Keep the view parameters the users has set
     $params = ltrim(req('view_params'), '&');
     if ($params) {
         $parts = explode('&', $params);
         foreach ($parts as $part) {
             list($key, $val) = explode('=', $part);
             hidden($key, $val);
         }
     }
     form_end();
     echo '</div>' . N;
     return ob_get_clean();
 }
Esempio n. 6
0
function delete_ngi()
{
    checkUserIsAdmin();
    if ($_POST) {
        submit();
    } else {
        draw();
    }
}
function showShippingForm($data, $action, $badFields = array())
{
    prepDatePicker();
    formHeader($action, "<h1>Shipping Info Form</h1>", "shippingForm", "void");
    shippingFields($data, $badFields);
    tableRow(array(tableData(""), tableData(""), tableData(""), tableData(""), tableData(""), tableData(submit("Enter Shipping Details!"), "right")));
    if (inWordPress()) {
        echo getWordpressHiddenFormField();
    }
    formFooter("shippingForm");
}
function submit_add_or_update_center2($add = true, $title = false, $async = false)
{
    echo "<center>";
    if ($add) {
        submit('ADD_ITEM2', _("Add new"), true, $title, $async);
    } else {
        submit('UPDATE_ITEM2', _("Update"), true, $title, $async);
        submit('RESET2', _("Cancel"), true, $title, $async);
    }
    echo "</center>";
}
function showOrderEntryForm($data, $badFields = array())
{
    formHeader("", "", "orderEntry", "void");
    customerFields($data, $badFields);
    orderFields($data, $badFields);
    if (inWordPress()) {
        echo getWordpressHiddenFormField();
    }
    tableRow(array(tableData(""), tableData(""), tableData(""), tableData(""), tableData(""), tableData(submit("Enter Order!"), "right")));
    formFooter("orderEntryForm");
}
Esempio n. 10
0
/**
 * Controller for a service move request
 * @global array $_POST only set if the browser has POSTed data
 * @return null
 */
function move_service_end_point()
{
    //The following line will be needed if this controller is ever used for non administrators:
    //checkPortalIsNotReadOnlyOrUserIsAdmin($user);
    if ($_POST) {
        // If we receive a POST request it's for a service movement
        submit();
    } else {
        // If there is no post data, draw the select old site form
        drawSelectOldSite();
    }
}
Esempio n. 11
0
/**
 * Controller for an add service type request
 * @global array $_POST only set if the browser has POSTed data
 * @return null
 */
function add_type()
{
    //The following line will be needed if this controller is ever used for non administrators:
    //checkPortalIsNotReadOnlyOrUserIsAdmin($user);
    if ($_POST) {
        // If we receive a POST request it's to add a service type
        submit();
    } else {
        // If there is no post data, draw the add service type form
        draw();
    }
}
Esempio n. 12
0
/**
 * Controller for an edit user_dn request
 * @global array $_POST only set if the browser has POSTed data
 * @return null
 */
function edit_dn()
{
    //The following line will be needed if this controller is ever used for non administrators:
    //checkPortalIsNotReadOnlyOrUserIsAdmin($user);
    if ($_POST) {
        // If we receive a POST request it's to edit a user dn
        submit();
    } else {
        // If there is no post data, draw the edit DN page
        draw();
    }
}
Esempio n. 13
0
/**
 * Controller for a retrieve account request.
 * @global array $_POST only set if the browser has POSTed data
 * @return null
 */
function retrieve()
{
    //Check the portal is not in read only mode, returns exception if it is
    checkPortalIsNotReadOnly();
    if ($_POST) {
        // If we receive a POST request it's to update a user
        submit();
    } else {
        // If there is no post data, draw the edit user form
        draw();
    }
}
/**
 * Controller for an edit site property request
 * @global array $_POST only set if the browser has POSTed data
 * @return null
 */
function edit_property()
{
    $dn = Get_User_Principle();
    $user = \Factory::getUserService()->getUserByPrinciple($dn);
    //Check the portal is not in read only mode, returns exception if it is and user is not an admin
    checkPortalIsNotReadOnlyOrUserIsAdmin($user);
    if ($_POST) {
        submit($user);
    } else {
        draw($user);
    }
}
Esempio n. 15
0
function edit_form($file)
{
    global $PHP_SELF;
    if (@is_readable($file)) {
        $data = join('', file($file));
    } elseif (EDIT_USE_SUOPEN and $f = suopen($file, "r")) {
        while (!feof($f)) {
            $data .= fread($f, 16000);
        }
        suclose($f);
    }
    return form($PHP_SELF, textarea('data', $data) . submit('Save'));
}
Esempio n. 16
0
/**
 * Controller for an edit service request
 * @global array $_POST only set if the browser has POSTed data
 * @return null
 */
function edit_service()
{
    $dn = Get_User_Principle();
    $user = \Factory::getUserService()->getUserByPrinciple($dn);
    //Check the portal is not in read only mode, returns exception if it is and user is not an admin
    checkPortalIsNotReadOnlyOrUserIsAdmin($user);
    if ($_POST) {
        // If we receive a POST request it's for a new site
        submit($user);
    } else {
        // If there is no post data, draw the edit site form
        draw($user);
    }
}
Esempio n. 17
0
function delete()
{
    if (!isset($_REQUEST['id']) || !is_numeric($_REQUEST['id'])) {
        throw new Exception("An id must be specified");
    }
    $dn = Get_User_Principle();
    $user = \Factory::getUserService()->getUserByPrinciple($dn);
    //get the site
    $site = \Factory::getSiteService()->getSite($_REQUEST['id']);
    if ($_POST or sizeof($site->getServices()) == 0) {
        submit($site, $user);
    } else {
        draw($site);
    }
}
/**
 * Controller for a new_property request
 * @global array $_POST only set if the browser has POSTed data
 * @return null
 */
function add_service_group_property()
{
    $dn = Get_User_Principle();
    $user = \Factory::getUserService()->getUserByPrinciple($dn);
    //Check the portal is not in read only mode, returns exception if it is and user is not an admin
    checkPortalIsNotReadOnlyOrUserIsAdmin($user);
    //Check user has modification rights for this entity
    if ($_POST) {
        // If we receive a POST request it's for a new property
        submit($user);
    } else {
        // If there is no post data, draw the New property form
        draw($user);
    }
}
Esempio n. 19
0
function etable($datos, $tablea = [], $tha = [], $tra = [], $tda = [])
{
    global $d, $t, $columnas;
    $res = "\n" . t("tr", tarray("th", $columnas, $tha), $tra);
    // aqui acumulamos el resultado parcial - los headings + rows
    // intentamos hacer una fila de edit controls
    $edits = "";
    foreach ($columnas as $i) {
        $edits .= "\n" . t("td", input(["name" => $i]), $tda);
    }
    $res .= t("tr", $edits . t("td", submit("Insertar") . hidden("d", $d) . hidden("t", $t) . hidden("c", "i"), $tda), $tra);
    foreach ($datos[1] as $arr) {
        $res .= "\n" . t("tr", tarray("td", $arr, $tda), $tra);
    }
    return t("table", $res, $tablea);
}
Esempio n. 20
0
/**
 * Controller for a request to add NGIs to a project
 * @global array $_POST only set if the browser has POSTed data
 * @return null
 */
function add_ngis_to_project()
{
    $dn = Get_User_Principle();
    $user = \Factory::getUserService()->getUserByPrinciple($dn);
    //Check the portal is not in read only mode, returns exception if it is and user is not an admin
    checkPortalIsNotReadOnlyOrUserIsAdmin($user);
    ////Check the user has permission to see the page, will throw exception
    //if correct permissions are lacking
    checkUserIsAdmin();
    if ($_POST) {
        // If we receive a POST request it's to add ngis
        submit();
    } else {
        // If there is no post data, draw the add NGI page
        draw();
    }
}
function delete()
{
    $dn = Get_User_Principle();
    $user = \Factory::getUserService()->getUserByPrinciple($dn);
    //get the site
    if (isset($_REQUEST['propertyid']) || !is_numeric($_REQUEST['propertyid'])) {
        $property = \Factory::getServiceGroupService()->getProperty($_REQUEST['propertyid']);
        $serviceGroup = \Factory::getServiceGroupService()->getServiceGroup($_REQUEST['id']);
    } else {
        throw new \Exception("A service group must be specified");
    }
    if ($_POST) {
        submit($property, $user, $serviceGroup);
    } else {
        draw($property, $serviceGroup, $user);
    }
}
Esempio n. 22
0
function form_task($minimized, $vyber, $order)
{
    //var_dump($vyber);
    $cls = "ghost";
    if (!empty($_SESSION["username"])) {
        $upozornenie_d = sql_query("Select id from dodavatel\r\n                            WHERE upozornenie = " . $_SESSION["username"] . " ");
    }
    if (count($upozornenie_d) > 0) {
        $up_id = array();
        foreach ($upozornenie_d as $up) {
            $up_id[] = $up["id"];
        }
        $pocet_upozorneni = sql_query("Select count(id) as counter from do_objednavka\r\n                            WHERE vymaz=0 AND komplet=0 AND id_dodavatel IN (" . implode(",", $up_id) . ") ")[0]["counter"];
    }
    if ($pocet_upozorneni > 0) {
        $cls .= " red";
    } else {
        $cls .= " silver";
    }
    echo "<div id=\"tasker\" class=\"{$cls}\">\r\n            \r\n        <div class=\"tasker_title\">Objednávka <span></span>\r\n        <div class=\"minimize\">_</div>\r\n        </div>\r\n            ";
    echo "<div class=\"tasker_content {$minimized}\">";
    echo "<div class=\"new_task\">";
    echo "<form method=\"POST\" id=\"do_objednavka\">";
    echo select("task_dodavatel", "Dodávateľ", "SELECT id, meno from dodavatel \r\n                            WHERE vymaz=0 \r\n                            ORDER BY meno", "", "", "", "", "NO");
    echo textfield("task_ks", "", "množstvo", 10, 2);
    $jednotky = array("ks" => "ks", "m" => "m");
    echo select("jednotky", "", "", "", "", "", "", "NO", $jednotky);
    echo textfield("task_text", "", "Text", 150, 32);
    //echo hidden("task_produkt", "");
    $ord = "";
    $zakaznik = "";
    if ($vyber == "objednavky" && $order > 0) {
        $ord = sql_query("\r\n                            SELECT c_obj\r\n                            FROM objednavka                            \r\n                            WHERE id = " . $order . "\r\n                            LIMIT 1\r\n                            ")[0]["c_obj"];
        $zakaznik = sql_query("\r\n                            SELECT meno\r\n                            FROM revizia                            \r\n                            WHERE id_obj = " . $order . "\r\n                            ORDER BY datum DESC LIMIT 1\r\n                            ")[0]["meno"];
    }
    echo textfield("task_zakaznik", $zakaznik, "Zákazník", 100, 20);
    echo textfield("task_order", $ord, "č. obj.", 15, 5);
    echo select("task_from", "Zadal", "SELECT id, meno from uzivatel \r\n                            WHERE skupina=1 AND perm_uroven_id<=2 AND vymaz=0 \r\n                            ORDER BY meno", $_SESSION["username"], "", "", "", "NO");
    echo submit("submit", "Odoslať");
    echo "</form>";
    echo "</div>";
    echo "</div>";
    echo "</div>";
}
Esempio n. 23
0
function delete()
{
    $dn = Get_User_Principle();
    $user = \Factory::getUserService()->getUserByPrinciple($dn);
    if (!isset($_REQUEST['propertyid']) || !is_numeric($_REQUEST['propertyid'])) {
        throw new Exception("A propertyid must be specified");
    }
    if (!isset($_REQUEST['serviceid']) || !is_numeric($_REQUEST['serviceid'])) {
        throw new Exception("A service id must be specified");
    }
    //get the service and property
    $property = \Factory::getServiceService()->getProperty($_REQUEST['propertyid']);
    $service = \Factory::getServiceService()->getService($_REQUEST['serviceid']);
    if ($_POST) {
        submit($property, $service, $user);
    } else {
        draw($property, $service, $user);
    }
}
Esempio n. 24
0
function delete_endpoint()
{
    $dn = Get_User_Principle();
    $user = \Factory::getUserService()->getUserByPrinciple($dn);
    if (!isset($_REQUEST['endpointid']) || !is_numeric($_REQUEST['endpointid'])) {
        throw new Exception("An endpointid must be specified");
    }
    if (!isset($_REQUEST['serviceid']) || !is_numeric($_REQUEST['serviceid'])) {
        throw new Exception("A service id must be specified");
    }
    //get the service and endpoint
    $endpoint = \Factory::getServiceService()->getEndpoint($_REQUEST['endpointid']);
    $service = \Factory::getServiceService()->getService($_REQUEST['serviceid']);
    if ($_POST) {
        submit($endpoint, $service, $user);
    } else {
        draw($endpoint, $service, $user);
    }
}
Esempio n. 25
0
function edit_allocations_for_transaction($type, $trans_no)
{
    global $systypes_array;
    start_form();
    display_heading(_("Allocation of") . " " . $systypes_array[$_SESSION['alloc']->type] . " # " . $_SESSION['alloc']->trans_no);
    display_heading($_SESSION['alloc']->person_name);
    display_heading2(_("Date:") . " <b>" . $_SESSION['alloc']->date_ . "</b>");
    display_heading2(_("Total:") . " <b>" . price_format(-$_SESSION['alloc']->amount) . "</b>");
    echo "<br>";
    div_start('alloc_tbl');
    if (count($_SESSION['alloc']->allocs) > 0) {
        show_allocatable(true);
        submit_center_first('UpdateDisplay', _("Refresh"), _('Start again allocation of selected amount'), true);
        submit('Process', _("Process"), true, _('Process allocations'), 'default');
        submit_center_last('Cancel', _("Back to Allocations"), _('Abandon allocations and return to selection of allocatable amounts'), 'cancel');
    } else {
        display_note(_("There are no unsettled transactions to allocate."), 0, 1);
        submit_center('Cancel', _("Back to Allocations"), true, _('Abandon allocations and return to selection of allocatable amounts'), 'cancel');
    }
    div_end();
    end_form();
}
Esempio n. 26
0
/**
 * Wrapper to call required function(s) to generate current active form.
 * @since 2.0.0
 * @version 2.1.0
 * @return void
 */
function get_form()
{
    global $hc_cfg, $eID, $lID;
    if (HCCOM == '') {
        return 0;
    }
    switch (HCCOM) {
        case 'send':
            send_to_friend();
            break;
        case 'signup':
            news_signup();
            break;
        case 'edit':
            news_edit();
            break;
        case 'filter':
            filter();
            break;
        case 'search':
            search();
            break;
        case 'searchresult':
            search_result();
            break;
        case 'submit':
            if ($eID > 0 || isset($_GET['sID'])) {
                submit_update();
            } else {
                submit();
            }
            break;
        case 'rsvp':
            rsvp();
            break;
    }
}
Esempio n. 27
0
                    stdfoot();
                    die;
                }
                if ($type == 'saved') {
                    print "<tr><td colspan=2 class=\"heading\" valign=\"top\" align=\"center\"><font color=red>" . $lang_usercp['text_saved'] . ($_GET["mail"] == "1" ? $lang_usercp['std_confirmation_email_sent'] : "") . " " . ($_GET["passkey"] == "1" ? $lang_usercp['std_passkey_reset'] : "") . " " . ($_GET["password"] == "1" ? $lang_usercp['std_password_changed'] : "") . " " . ($_GET["privacy"] == "1" ? $lang_usercp['std_privacy_level_updated'] : "") . "</font></td></tr>\n";
                }
                form("security");
                tr_small($lang_usercp['row_reset_passkey'], "<input type=checkbox name=resetpasskey value=1 />" . $lang_usercp['checkbox_reset_my_passkey'] . "<br /><font class=small>" . $lang_usercp['text_reset_passkey_note'] . "</font>", 1);
                if ($disableemailchange != 'no' && $smtptype != 'none') {
                    //system-wide setting
                    tr_small($lang_usercp['row_email_address'], "<input type=\"text\" name=\"email\" style=\"width: 200px\" value=\"" . htmlspecialchars($CURUSER["email"]) . "\" /> <br /><font class=small>" . $lang_usercp['text_email_address_note'] . "</font>", 1);
                }
                tr_small($lang_usercp['row_change_password'], "<input type=\"password\" name=\"chpassword\" style=\"width: 200px\" />", 1);
                tr_small($lang_usercp['row_type_password_again'], "<input type=\"password\" name=\"passagain\" style=\"width: 200px\" />", 1);
                tr_small($lang_usercp['row_privacy_level'], priv("normal", $lang_usercp['radio_normal']) . " " . priv("low", $lang_usercp['radio_low']) . " " . priv("strong", $lang_usercp['radio_strong']), 1);
                submit();
                print "</table>";
                stdfoot();
                die;
                break;
        }
    }
}
stdhead($lang_usercp['head_control_panel'] . $lang_usercp['head_home']);
usercpmenu();
//Comment Results
$commentcount = get_row_count("comments", "WHERE user="******"id"]));
//Join Date
if ($CURUSER['added'] == "0000-00-00 00:00:00") {
    $joindate = 'N/A';
} else {
Esempio n. 28
0
function formular_cp($order, $revision = 0, $fieldsets_c = 1, $form_data = "", $page = "")
{
    if (isset($_GET["cp"])) {
        $cp = sec_input($_GET["cp"]);
    }
    if (!empty($form_data)) {
        foreach ($form_data as $key => $value) {
            ${$key} = $value;
        }
    }
    $data = sql_query("SELECT r.id, r.id_obj, r.meno, adresa, ico, telefon, email, komentar,\r\n                                    DATE_FORMAT(datum, '%d. %m. %Y, %H:%i') AS datum\r\n                                    FROM revizia r \r\n                                    \r\n                                    WHERE r.id={$revision} \r\n                                    LIMIT 1");
    $data = $data[0];
    //var_dump($data);
    $data_obj = sql_query("SELECT DATE_FORMAT(datum, '%d. %m. %Y, %H:%i') AS datum, c_obj, id_zakaznik\r\n                                    FROM objednavka \r\n                                    WHERE id=" . $data["id_obj"] . " LIMIT 1");
    $data_obj = $data_obj[0];
    //var_dump($data);
    $message = "";
    $message .= "<h1>Cenová ponuka pre objednávku č. " . $data_obj["c_obj"] . " / " . $data["id"] . "</h1>";
    $message .= "<h5>Objednávka zo dňa: " . $data_obj["datum"] . "</h5>";
    $message .= "<div class=\"print_hlavicka\">";
    if ($data_obj[id_zakaznik] > 0) {
        $meno_zakaznika = sql_query("SELECT meno, adresa, mesto, psc, ico, dic, telefon, email \r\n                                          \r\n                                        FROM uzivatel WHERE id={$data_obj['id_zakaznik']} LIMIT 1");
        $meno_zakaznika = $meno_zakaznika[0];
        $data[meno] = $meno_zakaznika[meno];
        $data[adresa] = $meno_zakaznika[adresa];
        $data[mesto] = $meno_zakaznika[mesto];
        $data[psc] = $meno_zakaznika[psc];
        $data[ico] = $meno_zakaznika[ico];
        $data[dic] = $meno_zakaznika[dic];
        $data[telefon] = $meno_zakaznika[telefon];
        $data[email] = $meno_zakaznika[email];
        //$cenova_hladina = sql_query("SELECT id_c_hladina FROM uzivatel WHERE id=$data_obj[id_zakaznik]");
        //$cenova_hladina = $cenova_hladina[0][id_c_hladina];
    }
    $message .= "<div class=\"print_odberatel\"><table class=\"print_odberatel\"><tr><td></td><td><strong>Objednávateľ:</strong></td></tr>";
    $message .= "<tr><td></td><td class=\"print_bigger\">" . $data["meno"] . "</td></tr>";
    $message .= "<tr><td></td><td>" . $data["adresa"] . "</td></tr>";
    $message .= "<tr><td></td><td>" . $data["psc"] . " " . $data["mesto"] . "</td></tr>";
    $message .= "<tr><td>IČO:</td><td>" . $data["ico"] . "</td></tr>";
    $message .= "<tr><td>DIČ:</td><td>" . $data["dic"] . "</td></tr>";
    $message .= "<tr><td>tel.:</td><td>" . $data["telefon"] . "</td></tr>";
    $message .= "<tr><td>email:</td><td>" . $data["email"] . "</td></tr>";
    $message .= "</table>";
    $message .= "</div>";
    //var_dump($dekor);
    echo "<div class=\"print\">";
    echo $message;
    echo "</div>";
    echo "</div>";
    echo "<div id=\"content\" class=\"print_hlavicka4\">";
    if (empty($page) or $page == 1) {
        if ($_POST["submit_page1"]) {
            $fieldsets_c = count($_POST["id"]);
            for ($i = 0; $i < $fieldsets_c; $i++) {
                $id_objednavka_row[] = sec_input(sec_sql($_POST["id"][$i]));
                $zlava[] = str_replace(',', '.', sec_input(sec_sql($_POST["zlava"][$i])));
                $product_price[] = str_replace(',', '.', sec_input(sec_sql($_POST["product_price"][$i])));
                $id_cp_product[] = sec_input(sec_sql($_POST["id_cp_product"][$i]));
                $ks[] = sec_input(sec_sql($_POST["ks"][$i]));
            }
            $form_data[id_objednavka_row] = $id_objednavka_row;
            $form_data[id_cp_product] = $id_cp_product;
            $form_data[ks] = $ks;
            $form_data[zlava] = $zlava;
            $form_data[product_price] = $product_price;
            //var_dump($order);
            //var_dump($revision);
            if (empty($error_msg)) {
                $query = "INSERT INTO cp ( id_objednavka, id_revizia, vytvoril )\r\n                    VALUES ( {$order}, {$revision}, {$_SESSION['username']} )\r\n                    ";
                //print_r($query);
                //die();
                mysql_query("BEGIN");
                $sql_cp = sql_insert($query);
                $cp_id = $sql_cp["inserted_id"];
                for ($i = 0; $i < count($form_data[id_objednavka_row]); $i++) {
                    if (empty($form_data[product_price][$i])) {
                        $product_price = sql_query("SELECT cena FROM cp_product WHERE id=" . $form_data[id_cp_product][$i] . " ORDER BY id DESC LIMIT 1")[0]["cena"];
                    } else {
                        $product_price = $form_data[product_price][$i];
                    }
                    //echo $product_price."<br>";
                    //$product_ks_sum = $product_ks_sum + sec_input($form_data["ks"][$i]);
                    $product_price_sum = $product_price * sec_input($form_data["ks"][$i]);
                    $products_prices_sums = $products_prices_sums + $product_price_sum;
                    $zlava_E = $product_price_sum * $form_data["zlava"][$i] / 100;
                    $po_zlave = $product_price_sum - $zlava_E;
                    $po_zlave_sum = $po_zlave_sum + $po_zlave;
                    $query_cp_row = "INSERT into cp_row (id_cp, id_objednavka_row, id_cp_product, \r\n                                                            ks, cena, zlava, sum)\r\n                                        VALUES ({$cp_id},\r\n                                        {$form_data[id_objednavka_row][$i]}, \r\n                                        \"{$form_data[id_cp_product][$i]}\", \r\n                                        {$form_data[ks][$i]},\r\n                                        \"{$form_data[product_price][$i]}\",\r\n                                        \"{$form_data[zlava][$i]}\",\r\n                                        \"{$po_zlave}\"\r\n                                        )";
                    //echo $query_cp_row."<br>";
                    sql_insert($query_cp_row);
                    //var_dump($query_poznamka);
                }
                sql_update("UPDATE cp SET all_sum={$po_zlave_sum} WHERE id={$cp_id}");
                mysql_query("COMMIT");
                //dd($form_data);
                //$_SESSION["posted_form_from_cp"]=$form_data;
                header("location: ?vyber=cp&order={$order}&revision={$revision}&action=display_all");
            } else {
                echo "<div id=error_message>" . implode("<br>", $error_msg) . "</div>";
            }
        }
        echo "<form method=\"POST\" id=\"formular\" enctype=\"multipart/form-data\">";
        echo "<fieldset id=\"cp_rows\">";
        // pre editaciu cenovej ponuky....
        //=========================================
        $data_row = sql_query("SELECT * \r\n                            FROM objednavka_row\r\n                            WHERE id_revizia = " . $revision . "\r\n                            ");
        //var_dump($data_row);
        $fieldsets_c = count($data_row);
        for ($i = 0; $i < $fieldsets_c; $i++) {
            $ks[$i] = $data_row[$i][ks];
            $id[$i] = $data_row[$i][id];
            $product_type[$i] = $data_row[$i][id_product_type];
            $product[$i] = $data_row[$i][id_product];
            $product_delivery[$i] = $data_row[$i][id_product_delivery];
            $atyp_text[$i] = $data_row[$i][atyp_text];
            $data_row_option = sql_query("SELECT id_product_atribute, id_product_atribute_option \r\n                                    FROM objednavka_row_atribute \r\n                                    WHERE id_revizia=\"{$revision}\" AND id_objednavka_row=\"{$data_row[$i][id]}\"");
            //dd($form_data_row_option);
            foreach ($data_row_option as $option) {
                $data_rows[$i][$option["id_product_atribute"]] = $option["id_product_atribute_option"];
            }
            if (isset($_GET["cp"]) and !empty($_GET["cp"])) {
                $query = "SELECT * from cp_row WHERE id_cp=" . sec_input(sec_sql($_GET["cp"])) . " AND id_objednavka_row=" . $data_row[$i][id] . "";
                $cp_row = sql_query($query)[0];
                $cena[$i] = $cp_row[cena];
                $zlava[$i] = $cp_row[zlava];
                //var_dump($cp_row);
            }
        }
        $data[id_all] = $id;
        $data[ks_all] = $ks;
        $data[product_type_all] = $product_type;
        $data[product_all] = $product;
        $data[product_delivery_all] = $product_delivery;
        $data[atyp_text_all] = $atyp_text;
        $data[product_atribute_options_all] = $data_rows;
        $data[product_price_all] = $cena;
        $data[zlava_all] = $zlava;
        $message = "<div class=\"print_hlavicka3\">\r\n            <table>\r\n               <tr>\r\n               <th></th>               \r\n               <th style=\"width: 380px;\">produkt</th>\r\n               <th style=\"width: 40px;\">množstvo</th>\r\n               <th style=\"width: 70px;\">doprava</th>              \r\n               <th style=\"width: 50px;\">j.cena</th>\r\n               <th style=\"width: 50px;\">Spolu</th>\r\n               <th style=\"width: 90px;\">zľava %</th>\r\n               <th style=\"width: 50px;\">po zľave</th>\r\n               </tr>";
        //echo hidden("name", "value");
        //var_dump($data);
        $fieldsets_c = count($data["ks_all"]);
        for ($i = 0; $i < $fieldsets_c; $i++) {
            $poradie = 0;
            $poradie = $i + 1;
            $message .= "<tr>\r\n                     <td class=\"form_poradie\">{$poradie}. </td>\r\n                     ";
            $product_type = sql_query("SELECT meno FROM product_type WHERE id=" . sec_sql(sec_input($data["product_type_all"][$i])) . " LIMIT 1");
            $product_type = $product_type[0];
            $product = sql_query("SELECT id, meno FROM product WHERE id=" . sec_sql(sec_input($data["product_all"][$i])) . " LIMIT 1")[0];
            $message .= hidden("id[]", $data["id_all"][$i]);
            $options_str = array();
            //var_dump($data);
            if (!isset($data["product_atribute_options_all"][$i]) or empty($data["product_atribute_options_all"][$i])) {
                $data["product_atribute_options_all"][$i] = array();
            }
            $option_c_hladina = 1;
            foreach ($data["product_atribute_options_all"][$i] as $option) {
                //var_dump($option);
                $options = sql_query("SELECT id, meno, id_c_hladina FROM product_atribute_option WHERE id=" . sec_sql(sec_input($option)) . " LIMIT 1");
                $options_str[] = $options[0]["meno"];
                if ($options[0]["id_c_hladina"] > $option_c_hladina) {
                    $option_c_hladina = $options[0]["id_c_hladina"];
                }
                //$options["price"] = sql_query("SELECT id, cena FROM product_atribute_option WHERE id=".sec_sql(sec_input($option))." LIMIT 1");
            }
            $options_str = empty($options_str) ? "" : " (" . join(", ", $options_str) . ")";
            $message .= "<td class=\"form_nazov_siroky\">" . $product_type["meno"] . " " . $product["meno"] . "" . $options_str . "" . (empty($data["atyp_text_all"][$i]) ? "" : "<br>Atyp: " . sec_input($data["atyp_text_all"][$i])) . "</td>";
            $product_delivery = sql_query("SELECT meno FROM product_delivery WHERE id=" . sec_sql(sec_input($data["product_delivery_all"][$i])) . " LIMIT 1");
            $product_delivery = $product_delivery[0];
            $message .= "<td class=\"form_ks\">" . sec_input($data["ks_all"][$i]) . " ks</td>";
            $message .= "<td class=\"form_hrana\">" . $product_delivery["meno"] . "</td>";
            $message .= hidden("ks[]", $data["ks_all"][$i]);
            if (empty($data[product_price_all][$i])) {
                $product_prices = sql_query("SELECT id, cena FROM cp_product WHERE id_c_hladina=" . $option_c_hladina . " AND id_product=" . $product["id"] . " ORDER BY id DESC LIMIT 1")[0];
                $product_price = $product_prices[cena];
            } else {
                $product_price = $data[product_price_all][$i];
            }
            $product_ks_sum = $product_ks_sum + sec_input($data["ks_all"][$i]);
            $product_price_sum = $product_price * sec_input($data["ks_all"][$i]);
            $message .= hidden("id_cp_product[]", $product_prices[id]);
            // spocitanie ceny spolu za vsetky produkty
            $products_prices_sums = $products_prices_sums + $product_price_sum;
            $zlava_E = $product_price_sum * $data[zlava_all][$i] / 100;
            $po_zlave = $product_price_sum - $zlava_E;
            $po_zlave_sum = $po_zlave_sum + $po_zlave;
            if (!empty($data["atyp_text_all"][$i])) {
                $product_price = textfield("product_price[{$i}]", $data[product_price_all][$i], "", 5, 3, "product_price");
            } else {
                $product_price = $product_price . " €";
            }
            $message .= "<td class=\"form_nazov ali-center product-price\">" . $product_price . "</td>";
            $message .= "<td class=\"form_nazov ali-center bold\"><span class=\"cena-spolu-product\">" . $product_price_sum . "</span> €</td>";
            $message .= "<td class=\"form_nazov\">" . textfield("zlava[]", $data[zlava_all][$i], "", 4, 2, "zlava") . "<span class=\"zlava-E bold\">" . ($zlava_E > 0 ? "-" . $zlava_E . " €" : "") . "</span></td>";
            $message .= "<td class=\"form_nazov ali-center po-zlave-sum\">" . $po_zlave . "</td>";
            $message .= "</tr>";
        }
        $message .= "<tr class=\"cp_spolu bold\">\r\n                            <td></td>\r\n                            <td>Spolu:</td>\r\n                            <td class=\"ali-center\">" . $product_ks_sum . " ks</td>\r\n                            <td></td>\r\n                            <td></td>\r\n                            <td class=\"ali-center\">" . $products_prices_sums . " €</td>\r\n                            <td></td>\r\n                            <td class=\"ali-center po-zlave-sum-all\">" . $po_zlave_sum . " €</td>\r\n                            \r\n                    <tr>";
        $message .= "</table></div>";
        echo $message;
        echo "</fieldset>";
        echo submit("submit_page1", "Pokračovať");
    }
    echo "</form>";
}
Esempio n. 29
0
 private function changeForm()
 {
     global $CORE, $AUTH;
     if (is_action()) {
         try {
             $user = $AUTH->getUser();
             $password_old = post('password_old');
             if (!$password_old) {
                 throw new FieldInputError('password_old', l('You need to specify the old password.'));
             }
             $password_new1 = post('password_new1');
             if (!$password_new1) {
                 throw new FieldInputError('password_new1', l('You need to specify the new password.'));
             }
             $password_new2 = post('password_new2');
             if (!$password_new2) {
                 throw new FieldInputError('password_new2', l('You need to specify to confirm the new password.'));
             }
             if ($password_new1 != $password_new2) {
                 throw new FieldInputError('password_new1', l('The new passwords do not match.'));
             }
             if ($password_old == $password_new1) {
                 throw new FieldInputError('password_new1', l('The new and old passwords are equal. Won\'t change anything.'));
             }
             // Set new passwords in authentication module, then change it
             $AUTH->passNewPassword(array('user' => $user, 'password' => $password_old, 'passwordNew' => $password_new1));
             if (!$AUTH->changePassword()) {
                 throw new NagVisException(l('Your password could not be changed.'));
             }
             success(l('Your password has been changed.'));
             js('setTimeout(popupWindowClose, 1000);');
             // close window after 1 sec
         } catch (FieldInputError $e) {
             form_error($e->field, $e->msg);
         } catch (NagVisException $e) {
             form_error(null, $e->message());
         } catch (Exception $e) {
             if (isset($e->msg)) {
                 form_error(null, $e->msg);
             } else {
                 throw $e;
             }
         }
     }
     echo $this->error;
     js_form_start('change_password');
     echo '<table class="mytable">';
     echo '<tr><td class="tdlabel">' . l('Old password') . '</td>';
     echo '<td class="tdfield">';
     password('password_old');
     echo '</td></tr>';
     echo '<tr><td class="tdlabel">' . l('New password') . '</td>';
     echo '<td class="tdfield">';
     password('password_new1');
     echo '</td></tr>';
     echo '<tr><td class="tdlabel">' . l('New password (confirm)') . '</td>';
     echo '<td class="tdfield">';
     password('password_new2');
     echo '</td></tr>';
     echo '</table>';
     js('try{document.getElementById(\'password_old\').focus();}catch(e){}');
     submit(l('Change password'));
     form_end();
 }
Esempio n. 30
0
<?php

include_once 'includes/header.php';
session_start();
if (empty($_POST['user_name'])) {
    echo "<div id='hello'>";
    echo "<label for='login'>Здравейте, Моля попълнете полетo за да продължим : </label>";
    echo "<p><form action='page2.php' method='post'>";
    input('login', 'text', 'user_name', 'Enter user name...');
    echo "</p>";
    echo "<p>";
    submit('Continue', 'btn btn-info');
    echo "</p></form>";
    echo "</div>";
    echo "<div id='deny' class='alert alert-danger'  role='alert' >Ако не въведете потребителско име в полето неможе да продължите ...</div>";
} else {
    echo "<div id='success' class='alert alert-success'  role='alert' >Здравейте " . $_POST['user_name'] . "</div>";
}
?>
	








<?php 
include_once 'includes/footer.php';