コード例 #1
0
ファイル: users.php プロジェクト: GGF/Production-Base
// управление ползователями
require $_SERVER["DOCUMENT_ROOT"] . "/lib/engine.php";
authorize();
// вызов авторизации
$processing_type = basename(__FILE__, ".php");
// serialize form
if (isset(${'form_' . $processing_type})) {
    extract(${'form_' . $processing_type});
}
ob_start();
if (isset($edit)) {
    $sql = "SELECT * FROM users WHERE id='" . $edit . "'";
    $rs = sql::fetchOne($sql);
    $form = new Edit($processing_type);
    $form->init();
    $form->addFields(array(array("type" => CMSFORM_TYPE_TEXT, "name" => "nik", "label" => "Ник:", "value" => $rs["nik"]), array("type" => CMSFORM_TYPE_TEXT, "name" => "fullname", "label" => "Полное имя:", "value" => $rs["fullname"]), array("type" => CMSFORM_TYPE_TEXT, "name" => "position", "label" => "Должность:", "value" => $rs["position"]), array("type" => CMSFORM_TYPE_TEXT, "name" => "password1", "label" => "Пароль:", "value" => $rs["password"]), array("type" => CMSFORM_TYPE_TEXT, "name" => "password2", "label" => "Повтор пароля", "value" => $rs["password"])));
    $form->show();
} elseif (isset($delete)) {
    // удаление
    $sql = "DELETE FROM users WHERE id='{$delete}'";
    sql::query($sql);
    sql::error(true);
    echo "ok";
} else {
    // вывести таблицу
    // sql
    $sql = "SELECT * FROM users " . (isset($find) ? "WHERE (nik LIKE '%{$find}%' OR fullname LIKE '%{$find}%' OR position LIKE '%{$find}%') " : "") . (!empty($order) ? "ORDER BY " . $order . " " : "ORDER BY nik ") . (isset($all) ? "" : "LIMIT 20");
    //print $sql;
    $cols[id] = "ID";
    $cols[nik] = "Nik";
    $cols[fullname] = "Fullname";
コード例 #2
0
ファイル: orders.php プロジェクト: GGF/Production-Base
        $_SESSION[customer_id] = $rs[customer_id];
        $_SESSION[customer] = $rs[customer];
        echo "ok<script>selectmenu('tz','');</script>";
    } else {
        $sql = "SELECT * FROM orders WHERE id='{$edit}'";
        $ord = sql::fetchOne($sql);
        $form = new Edit($processing_type);
        $form->init();
        if (empty($edit) && empty($_SESSION[customer_id])) {
            $customers = array();
            $sql = "SELECT id,customer FROM customers ORDER BY customer";
            $res = sql::fetchAll($sql);
            foreach ($res as $rs) {
                $customers[$rs[id]] = $rs[customer];
            }
            $form->addFields(array(array("type" => CMSFORM_TYPE_SELECT, "name" => "customerid", "label" => "Заказчик:", "values" => $customers)));
        } else {
            $form->addFields(array(array("type" => CMSFORM_TYPE_HIDDEN, "name" => "customerid", "value" => !empty($_SESSION[customer_id]) ? $_SESSION[customer_id] : $ord["customer_id"], "options" => array("html" => "size=30"))));
        }
        $form->addFields(array(array("type" => CMSFORM_TYPE_TEXT, "name" => "orderdate", "label" => 'Дата:', "value" => date2datepicker($ord[orderdate]), "options" => array("html" => ' datepicker=1 '), "check" => array("type" => CMSFORM_CHECK_NUMERIC), "format" => array("type" => CMSFORM_FORMAT_CUSTOM, "pregPattern" => "/[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9]/"), "obligatory" => true), array("type" => CMSFORM_TYPE_TEXT, "name" => "number", "label" => "Номер письма:", "value" => $ord["number"], "options" => array("html" => "size=30"), "obligatory" => true), array("type" => CMSFORM_TYPE_FILE, "name" => "order_file", "label" => "Файл письма:"), array("type" => CMSFORM_TYPE_TEXT, "name" => "curfile", "label" => "Текущий файл:", "value" => basename(getFileNameById($ord["filelink"])), "options" => array("html" => "readonly"))));
        $form->show();
    }
} elseif (isset($delete)) {
    // удаление
    $sql = "DELETE FROM orders WHERE id='{$delete}'";
    sql::query($sql);
    // удаление связей
    $sql = "SELECT * FROM tz WHERE order_id='{$delete}'";
    $res = sql::fetchAll($sql);
    foreach ($res as $rs) {
        // удаление
コード例 #3
0
ファイル: todo.php プロジェクト: GGF/Production-Base
// отображает задачи по усовершенствованию
require $_SERVER["DOCUMENT_ROOT"] . "/lib/engine.php";
authorize();
// вызов авторизации
$processing_type = basename(__FILE__, ".php");
// serialize form
if (isset(${'form_' . $processing_type})) {
    extract(${'form_' . $processing_type});
}
if (isset($edit)) {
    $sql = "SELECT * FROM todo WHERE id='" . $edit . "'";
    $rs = sql::fetchOne($sql);
    $form = new Edit($processing_type);
    $form->init();
    $form->addFields(array(array("type" => CMSFORM_TYPE_TEXTAREA, "name" => "what", "label" => '', "value" => $rs["what"], "options" => array("rows" => "10", "html" => " cols=50 onfocus='\$(this).wysiwyg();' "))));
    $form->show();
} elseif (isset($delete)) {
    $sql = "SELECT what FROM todo WHERE id='" . $delete . "'";
    $rs = sql::fetchOne($sql);
    $sql = "UPDATE todo SET rts=NOW(), what='<del>" . $rs["what"] . "</del>' WHERE id='{$delete}'";
    sql::query($sql);
    sql::error(true);
    echo "ok";
} else {
    $sql = "SELECT *, todo.id FROM todo JOIN users ON users.id=u_id " . (isset($find) ? "WHERE (what LIKE '%{$find}%' ) " : "") . (isset($all) ? "" : (isset($find) ? " AND rtsrts='000000000000' " : " WHERE rts='000000000000' ")) . (!empty($order) ? "ORDER BY " . $order . " " : "ORDER BY cts ") . (isset($all) ? "" : "LIMIT 20");
    // echo $sql;
    $cols[id] = "ID";
    $cols[nik] = "Кто";
    $cols[cts] = "Задан";
    $cols[rts] = "Закончен";
コード例 #4
0
ファイル: rights.php プロジェクト: GGF/Production-Base
    $sql = "SELECT * FROM rrtypes";
    $res1 = sql::fetchAll($sql);
    foreach ($res as $rs) {
        $label = sprintf("<span id='rrr' rtype='" . $rs["type"] . "'>[%-10s]</span>:", $rs["type"]);
        $name = "r|" . $rs["id"] . "";
        //sprintf("[%-10s]:",$rs["type"]);
        //echo $name."<br>";
        foreach ($res1 as $rs1) {
            $sql = "SELECT * FROM rights WHERE type_id='" . $rs["id"] . "' AND u_id='{$uid}' AND rtype_id='" . $rs1["id"] . "'";
            $rs2 = sql::fetchOne($sql);
            //echo $rs1["rtype"]."-<input type=checkbox name=r[".$rs["id"]."][".$rs1["id"]."] ".($rs2["right"]=='1'?"checked":"").">";
            $value[$rs1["id"]] = $rs2["right"] == 1 ? 1 : 0;
            $values[$rs1["id"]] = '-';
        }
        //print_r($value);
        $form->addFields(array(array("type" => CMSFORM_TYPE_CHECKBOXES, "name" => $name, "label" => $label, "value" => $value, "values" => $values, "options" => array("nobr" => true, "html" => " rtype=" . $rs["type"] . " "))));
        unset($values);
        unset($value);
    }
    $form->addFields(array(array("type" => CMSFORM_TYPE_HIDDEN, "name" => "userid", "value" => $uid)));
    $form->show();
    echo "<script>\$('#rrr').live('click',function(){\$(':checkbox[rtype='+\$(this).attr('rtype')+']').attr('checked',true);});</script>";
    echo "<script>\$('#rrr').live('dblclick',function(){\$(':checkbox[rtype='+\$(this).attr('rtype')+']').attr('checked',false);});</script>";
} elseif (isset($delete)) {
    // удаление
    $sql = "DELETE FROM rights WHERE id='{$delete}'";
    sql::query($sql) or die(sql::error(true));
    echo "ok";
} else {
    // вывести таблицу
    if (isset($id)) {
コード例 #5
0
ファイル: customers.php プロジェクト: GGF/Production-Base
$processing_type = basename(__FILE__, ".php");
ob_start();
if (isset($edit)) {
    if (!empty($id)) {
        $sql = "SELECT * FROM customers WHERE id='{$id}'";
        $rs = sql::fetchOne($sql);
        $_SESSION[customer_id] = $rs[id];
        $_SESSION[customer] = $rs[customer];
        echo "ok<script>selectmenu('orders','');</script>";
        exit;
    } else {
        $sql = "SELECT * FROM customers WHERE id='{$edit}'";
        $cust = sql::fetchOne($sql);
        $form = new Edit($processing_type);
        $form->init();
        $form->addFields(array(array("type" => CMSFORM_TYPE_TEXT, "name" => "customer", "label" => "Краткое название (имя каталога):", "value" => $cust["customer"]), array("type" => CMSFORM_TYPE_TEXT, "name" => "fullname", "label" => "Полное название (для теззаданий):", "value" => $cust["fullname"], "options" => array("html" => "size=60")), array("type" => CMSFORM_TYPE_TEXT, "name" => "kdir", "label" => "Каталог на диске К (для сверловок):", "value" => $cust["kdir"])));
        $form->show();
    }
} elseif (isset($delete)) {
    // удаление
    $sql = "DELETE FROM customers WHERE id='{$delete}'";
    sql::query($sql);
    sql::error(true);
    // удаление связей
    // удалить и платы заказчика
    $sql = "SELECT * FROM plates WHERE customer_id='{$delete}'";
    $res = sql::fetchAll($sql);
    foreach ($res as $rs) {
        $sql = "DELETE FROM plates WHERE id='{$rs["id"]}'";
        sql::query($sql);
        sql::error(true);