예제 #1
0
파일: functions.php 프로젝트: yonkon/diplom
function addvisit_2_exec($Frm, $Err)
{
    if (!$Err) {
        if (!isset($_SESSION["make_visit_tmp"]["klient"])) {
            $Frm->_gui->ERR("Клиент не определен");
            return;
        }
        $kln = kln_get($_SESSION["make_visit_tmp"]["klient"]);
        if (!$kln) {
            $Frm->_gui->ERR("Клиент не определен");
            return;
        }
        $ord_id = 0;
        if (isset($_SESSION["make_visit_tmp"]["order"]) && intval($_SESSION["make_visit_tmp"]["order"])) {
            $ord_id = intval($_SESSION["make_visit_tmp"]["order"]);
            if (!Order::find($ord_id)) {
                $Frm->_gui->ERR("Заказ не найден");
                return;
            }
        }
        // Проверить время
        $t1 = $Frm->GetNmValue("start");
        $t2 = $Frm->GetNmValue("finish");
        if ($t2 <= $t1) {
            $Frm->_gui->ERR("Некорректно задано время");
            return;
        }
        $dt = explode("-", $_SESSION["make_visit_tmp"]["date"]);
        $dt = mktime(0, 0, 0, $dt[1], $dt[0], $dt[2]);
        $fil = intval($_SESSION["make_visit_tmp"]["filial_id"]);
        if ($fil <= 0) {
            $Frm->_gui->ERR("Некорректный филиал");
            return false;
        }
        $courier_id = $Frm->GetNmValueI("user");
        $visits = db::get_single_value("SELECT COUNT(*) FROM " . TABLE_VISITS . " WHERE user_id = " . db::input($courier_id) . " AND tm_start <= " . db::input($t1) . " AND tm_finish > " . db::input($t1) . " AND date = " . db::input($dt));
        if ($visits) {
            $Frm->_gui->ERR("На это время уже назначена встреча");
            return false;
        }
        $vis_id = Meeting::create(array("user_id" => $courier_id, "date" => $dt, "status" => 0, "tm_start" => $t1, "tm_finish" => $t2, "client_id" => $kln["id"], "order_id" => $ord_id, "filial_id" => $fil, "created" => time(), "creator_id" => $_SESSION["user"]["data"]["id"], "summa" => $_SESSION["make_visit_tmp"]["summa1"], "about" => $_SESSION["make_visit_tmp"]["about"], "opisanie_klienta" => $Frm->GetNmValueH("opisanie_klienta"), "opisanie_pyti" => $Frm->GetNmValueH("opisanie_pyti"), "station_id" => $Frm->GetNmValueI("station")));
        $Frm->_gui->OK("Встреча создана");
        // Создаем сообщение при необходимости
        if ($courier_id != $_SESSION["user"]["data"]["id"]) {
            $prior = 1;
            $msg_id = mls_Send("u" . $courier_id, "u" . $_SESSION["user"]["data"]["id"], "Новая встреча №" . $vis_id, "Вы проводите встречу " . date("d.m.Y", $dt) . " c " . utils_cvt_i2times($t1) . " по " . utils_cvt_i2times($t2) . "." . " <a href='?section=vis&subsection=2&visit=" . $vis_id . "'>Подробнее...</a><br>Внимание! Ответ на данное сообщение обязателен!", $prior, 0, 0, 0, 0, $vis_id, 0);
            if ($msg_id) {
                \Components\Classes\Author::enqueue_message_to_email($msg_id, array($courier_id), \Components\Entity\EmailNotificationType::TO_CLIENT_ON_ORDER_CHANGE);
                Meeting::update($vis_id, array('uved_umsg' => $msg_id));
            }
        }
        page_reloadToSec("2");
    }
}
예제 #2
0
 public static function getPersistable($checkDb = null)
 {
     if ($checkDb == null) {
         $checkDb = EmailNotificationType::$_checkDbChanges;
     }
     if ($checkDb || empty(EmailNotificationType::$_persistable)) {
         //EmailNotificationType::$_persistable = EmailNotificationType::findBy(array('persist'=>1));
         EmailNotificationType::$_persistable = db::get_single_values_array("SELECT id FROM " . TABLE_EMAIL_NOTIFICATION_TYPES . " WHERE action_type in (1,2)");
         //EmailNotificationType::$_persistable = EmailNotificationType::findBy(array('action_type'=>array(0,1,2)));
     }
     return EmailNotificationType::$_persistable;
 }
예제 #3
0
function edit_description_exec($Frm, $Err)
{
    global $email_notifications_types;
    if (!$Err) {
        $id = intval($Frm->GetValue(0));
        $descr = str_replace("'", '"', htmlspecialchars($Frm->GetValue(1)));
        //$persist = (null !== $Frm->GetValue(2)) ? 1 : 0;
        //$send = (null !== $Frm->GetValue(3)) ? 1 : 0;
        $action_type = $Frm->GetValue(2);
        in_array($action_type, array(0, 1, 2)) or $action_type = 0;
        if (isset($email_notifications_types[$id])) {
            db::update(TABLE_EMAIL_NOTIFICATION_TYPES, array('description' => $descr, 'action_type' => $action_type), "id=" . $id);
            $Frm->_gui->informer->OK("Сохранено");
            page_reloadAll();
        }
    }
}
예제 #4
0
파일: functions.php 프로젝트: yonkon/diplom
function editclient_exec($Frm, $Err)
{
    if (!$Err) {
        $client_info = Client::find($Frm->GetNmValueI("id"));
        if (!$client_info) {
            $Frm->_gui->ERR("Клиент не найден");
            page_reloadToSec(2);
        }
        $filial_id = $Frm->GetNmValueI("filial_id");
        if (empty($filial_id)) {
            $Frm->_gui->ERR("Не указан филиал");
            return;
        }
        $new_password = $client_info['hpwd'];
        $pwd = $client_info['password'];
        if ($Frm->GetNmValueH("newpwd") != "") {
            if ($Frm->GetNmValueI("genpwd")) {
                $pwd = generate_pasw(5);
            } else {
                $pwd = $Frm->GetNmValueI("newpwd");
            }
            if (strlen($pwd) < 5) {
                $Frm->_gui->ERR("Длина пароля должна быть не менее 5 символов");
                return;
            }
            if (strlen($pwd) > 20) {
                $Frm->_gui->ERR("Длина пароля должна быть не более 20 символов");
                return;
            }
            $eml = strtolower($Frm->GetNmValueH("email"));
            $new_password = md5($pwd . $eml);
        }
        db::insert(TABLE_CLIENTS_HISTORY, array('change_date' => time(), 'change_user_id' => $_SESSION['user']['data']['id'], 'client_id' => $client_info["id"], 'filial_id_new' => $filial_id, 'fio_new' => $Frm->GetNmValueH("fio"), 'hpwd_new' => $new_password, 'email_new' => $Frm->GetNmValueH("email"), 'telnum_new' => $Frm->GetNmValueH("telnum"), 'city_new' => $Frm->GetNmValueH("city"), 'icq_new' => $Frm->GetNmValueH("icq"), 'skype_new' => $Frm->GetNmValueH("skype"), 'contacts_new' => $Frm->GetNmValueH("contacts"), 'about_new' => $Frm->GetNmValueH("about"), 'filial_id_old' => $client_info['filial_id'], 'fio_old' => $client_info['fio'], 'hpwd_old' => $client_info['hpwd'], 'email_old' => $client_info['email'], 'telnum_old' => $client_info['telnum'], 'city_old' => $client_info['city'], 'icq_old' => $client_info['icq'], 'skype_old' => $client_info['skype'], 'contacts_old' => $client_info['contacts'], 'about_old' => $client_info['about']));
        Client::update($client_info['id'], array('filial_id' => $filial_id, 'fio' => $Frm->GetNmValueH("fio"), 'email' => $Frm->GetNmValueH("email"), 'telnum' => $Frm->GetNmValueH("telnum"), 'city' => $Frm->GetNmValueH("city"), 'hpwd' => $new_password, 'password' => $pwd, 'icq' => $Frm->GetNmValueH("icq"), 'skype' => $Frm->GetNmValueH("skype"), 'contacts' => $Frm->GetNmValueH("contacts"), 'about' => $Frm->GetNmValueH("about"), 'ref_id' => $Frm->GetNmValueI('ref'), 'from_id' => $Frm->GetNmValueI('client_from')));
        db::update(TABLE_ORDERS, array('filial_id' => $filial_id), 'klient_id = ' . $client_info["id"]);
        $Frm->_gui->OK("Сохранено");
        page_reloadAll();
    }
}
예제 #5
0
파일: Author.php 프로젝트: yonkon/diplom
 public static function getActiveAuthorsId_Fio()
 {
     $activeAuthorsId_Fio = db::get_assoc('SELECT id, fio
  FROM ' . TABLE_USERS . '
  WHERE group_id=' . Author::ROLE_ID . ' AND
   blocked = 0 AND
   black_list = 0');
     if (is_array($activeAuthorsId_Fio)) {
         asort($activeAuthorsId_Fio);
     } else {
         $activeAuthorsId_Fio = array();
     }
     return $activeAuthorsId_Fio;
 }
예제 #6
0
파일: makeorder.php 프로젝트: yonkon/diplom
 function add_order($client_id, &$err)
 {
     $err = "";
     try {
         $client = Client::find($client_id);
     } catch (Exception $e) {
         $err = "Ошибка - не указан клиент";
         return false;
     }
     try {
         $filial = Filial::find($client['filial_id']);
     } catch (Exception $e) {
         $filial = Filials::getDefault();
         Client::update($client['id'], array('filial_id' => $filial['id']));
         db::update(TABLE_ORDERS, array('filial_id' => $filial['id']), 'klient_id = ' . $client['id']);
     }
     $pgs = get_min_max_from_str($_SESSION["zf_work_pages"]);
     // disc id
     try {
         $discipline = Discipline::find($_SESSION["zf_work_predm"]);
         $disc_id = $discipline['id'];
     } catch (Exception $e) {
         $discipline = Discipline::findOneBy(array('name' => $_SESSION["zf_work_predm"]));
         if ($discipline) {
             $disc_id = $discipline['id'];
         } else {
             $disc_id = Discipline::create(array('name' => $_SESSION["zf_work_predm"]));
         }
     }
     $info = $_SESSION["zf_work_dopinfo"];
     $worktype_custom = '';
     $worktype = null;
     try {
         $worktype = Worktypes::find($_SESSION["zf_work_type"]);
     } catch (Exception $e) {
         $worktype = Worktypes::findOneBy(array('name' => $_SESSION["zf_work_type"]));
         if (!$worktype) {
             $worktype_custom = $_SESSION["zf_work_type"];
             $worktype['id'] = null;
         }
     }
     $id = Order::create(array("filial_id" => $filial['id'], "klient_id" => $client['id'], "type_id" => $worktype['id'], "type_user" => $worktype_custom, "disc_id" => $disc_id, "time_kln" => strtotime($_SESSION["zf_work_date"]), "subject" => $_SESSION["zf_work_tema"], "about_kln" => $info, "pages_min" => $pgs["min"], "pages_max" => $pgs["max"]));
     if ($id > 0) {
         ////////////////////////
         // Текст клиенту
         $txt = "<p>Здравствуйте, " . $client["fio"] . "!</p>";
         // Если первый раз
         if (@$_SESSION["new_klient_added"]) {
             $txt .= "<p>Мы очень рады, что Вы решили воспользоваться нашими услугами и высоко ценим Ваше доверие!</p>" . "<p>Теперь Вы можете войти в личный кабинет:<br>" . "&nbsp;Логин: " . $client["email"] . "<br>" . "&nbsp;Пароль: " . $client["password"] . "<br></p>";
         } else {
             $txt .= "<p>Спасибо, что Вы с нами! Для постоянных клиентов у нас всегда есть интересные и выгодные предложения!</p>";
         }
         $zak = "<p>Номер заказа: " . $id . "<br>" . "Дата: " . date("d.m.Y") . "<br>";
         $zak .= "Вид работы: ";
         if (!empty($worktype_custom)) {
             $zak .= $worktype_custom . "<br>";
         } else {
             $zak .= $worktype["name"] . "<br>";
         }
         $zak .= "Дисциплина: ";
         if ($discipline) {
             $zak .= $discipline['name'] . "<br>";
         } else {
             $zak .= $_SESSION["zf_work_predm"] . "<br>";
         }
         $zak .= "Тема работы: " . $_SESSION["zf_work_tema"] . "<br>" . "Требования: " . $_SESSION["zf_work_dopinfo"] . "<br>" . "Дата сдачи: " . $_SESSION["zf_work_date"] . "<br>" . "Число страниц: " . $_SESSION["zf_work_pages"] . "<br>" . ($txt .= "<p>Ваш заказ принят, и в ближайшее время наш менеджер свяжется с Вами.</p>" . "<p>Содержание заказа: <br>" . $zak . "</p>");
         $txt .= "<p><i>С уважением, компания по написанию студенческих работ.</i></p>";
         $email = new Email();
         $email->setData(array('email' => $client['email'], 'name' => $client['fio']), "Ваш заказ принят!", $txt, array(), true, array(), array('email' => $filial['email'], 'name' => $filial['name']));
         //$m->SMTPDebug = true;
         if ($email->send()) {
             $user_send_res = "Письмо клиенту отправлено";
         } else {
             $user_send_res = "Ошибки при отправке письма клиенту: " . $email->ErrorInfo;
         }
         ////////////////////////
         // Текст в приемную заказов
         $zak .= "<p>Заказчик:<br>";
         if (@$_SESSION["new_klient_added"]) {
             $zak .= "Новая регистрация<br>";
         }
         $zak .= "id: " . $client["id"] . "<br>" . "Имя: " . $client["fio"] . "<br>" . "Почта: " . $client["email"] . "<br>" . "Телефон: " . $client["telnum"] . "<br>" . "Город: " . $client["city"] . "<br>" . "Другие контакты: " . $client["contacts"] . "<br>";
         $zak .= $user_send_res;
         // Прикалываем файлы
         $files = check_user_files();
         $message_id = \Components\Entity\Message::create(array('parent_id' => 0, 'order_id' => $id, 'klient_id' => $client["id"], 'visit_id' => 0, 'tender_id' => 0, 'created' => time(), 'creator_id' => 'k' . $client["id"], 'addr' => 'u' . $filial['id'], 'subject' => "Поступил новый заказ #" . $id, 'text' => $zak, 'prior' => 1, 'uvedom' => 1, 'readed' => 0, 'needansv' => 0, 'basket' => 0));
         if (!empty($message_id)) {
             \Components\Classes\Author::enqueue_message_to_email($message_id, $filial['id'], EmailNotification::TO_MANAGER_ON_CLIENT_CREATED_ORDER);
         }
         /* ОТПРАВИТЬ В РЕАЛЬНОМ ВРЕМЕНИ
            $email = new Email();
            $email->setData(array(
              'email' => FIRM_ORD_MAIL,
              'name' => 'Приемная заказов',
            ), "Поступил новый заказ #" . $id, $zak, $files, true, array(), array(
              'email' => $filial['email'],
              'name' => $filial['name'],
            ));
            $email->send();
            ENDOF ОТПРАВИТЬ В РЕАЛЬНОМ ВРЕМЕНИ */
         // move file
         if (count($files)) {
             $path = DIR_FS_ORDER_FILES . $id;
             if (!file_exists($path)) {
                 mkdir($path);
             }
             foreach ($files as $f) {
                 $fid = OrderFile::create(array('order_id' => $id, 'creator_id' => 0, 'created' => time(), 'name' => $f["name"], 'size' => $f["size"]));
                 if ($fid > 0) {
                     $ext = substr($f["name"], strrpos($f["name"], ".") + 1);
                     $f_s = fopen($f["path"], "r");
                     $f_d = fopen($path . "/" . $fid . "." . $ext, "w");
                     fwrite($f_d, fread($f_s, $f["size"]));
                     fclose($f_s);
                     fclose($f_d);
                 }
                 unlink($f["path"]);
             }
         }
         $path = TMPFILES_PATH . session_id();
         if (file_exists($path)) {
             rmdir($path);
         }
         return true;
     } else {
         return false;
     }
 }
예제 #7
0
파일: ajax.php 프로젝트: yonkon/diplom
function get_role_rights($role_id)
{
    $modules = get_modules();
    $module_rights = db::get_single_values_array("SELECT module_id FROM " . TABLE_ROLES_TO_MODULES . " WHERE role_id = " . $role_id);
    $submodule_rights = db::get_single_values_array("SELECT submodule_id FROM " . TABLE_ROLES_TO_SUBMODULES . " WHERE role_id = " . $role_id);
    $command_rights = db::get_single_values_array("SELECT command_id FROM " . TABLE_ROLES_TO_COMMANDS . " WHERE role_id = " . $role_id);
    $column_rights = db::get_single_values_array("SELECT column_id FROM " . TABLE_ROLES_TO_COLUMNS . " WHERE role_id = " . $role_id);
    $result = array();
    $result[] = '<table style="width: 100%;">';
    if (count($modules)) {
        foreach ($modules as $module_id => $module_name) {
            $result[] = '<tr style="background-color: #d3d3d3;">';
            $result[] = '<td style="width: 100px;">';
            $result[] = '<i>модуль</i>';
            $result[] = '</td>';
            $result[] = '<td colspan="100">';
            //      $result[] = '<div class="module">';
            $result[] = '<div class="module_name"><label for="module[' . $module_id . ']">' . $module_name . '</label></div>';
            $result[] = '<input type="checkbox" ' . (in_array($module_id, $module_rights) ? 'checked="checked"' : '') . ' name="module[' . $module_id . ']" class="module_checkbox" id="module[' . $module_id . ']">';
            $result[] = '</td>';
            //      $result[] = '<div class="clear"></div>';
            $result[] = '</tr>';
            $submodules = get_submodules($module_id);
            if (count($submodules)) {
                foreach ($submodules as $submodule_id => $submodule_name) {
                    $result[] = '<tr>';
                    $result[] = '<td>';
                    $result[] = '</td>';
                    $result[] = '<td style="width: 100px;">';
                    $result[] = '<i>подмодуль</i>';
                    $result[] = '</td>';
                    $result[] = '<td colspan="2">';
                    //          $result[] = '<div class="submodule">';
                    $result[] = '<div class="submodule_name"><label for="submodule[' . $submodule_id . ']">' . $submodule_name . '</label></div>';
                    $result[] = '<input type="checkbox" ' . (in_array($submodule_id, $submodule_rights) ? 'checked="checked"' : '') . ' name="submodule[' . $submodule_id . ']" class="submodule_checkbox" id="submodule[' . $submodule_id . ']">';
                    //          $result[] = '</div>';
                    $result[] = '</tr>';
                    $commands = get_commands($submodule_id);
                    if (count($commands)) {
                        $result[] = '<tr>';
                        $result[] = '<td>';
                        $result[] = '</td>';
                        $result[] = '<td>';
                        $result[] = '</td>';
                        $result[] = '<td style="width: 100px;">';
                        $result[] = '<i>команды</i>';
                        $result[] = '</td>';
                        $result[] = '<td>';
                        foreach ($commands as $command_id => $command_name) {
                            $result[] = '<div class="command_wrap">';
                            $result[] = '<div class="command_name"><label for="command[' . $command_id . ']">' . $command_name . '</label></div>';
                            $result[] = '<input type="checkbox" ' . (in_array($command_id, $command_rights) ? 'checked="checked"' : '') . ' name="command[' . $command_id . ']" class="command_checkbox" id="command[' . $command_id . ']">';
                            $result[] = '</div>';
                        }
                        $result[] = '</td>';
                        $result[] = '</tr>';
                    }
                    $columns = get_columns($submodule_id);
                    if (count($columns)) {
                        $result[] = '<tr style="background-color: lightCyan;">';
                        $result[] = '<td>';
                        $result[] = '</td>';
                        $result[] = '<td>';
                        $result[] = '</td>';
                        $result[] = '<td style="width: 100px;">';
                        $result[] = '<i>колонки</i>';
                        $result[] = '</td>';
                        $result[] = '<td>';
                        foreach ($columns as $column_id => $column_name) {
                            $result[] = '<div class="column_wrap">';
                            $result[] = '<div class="column_name"><label for="column[' . $column_id . ']">' . $column_name . '</label></div>';
                            $result[] = '<input type="checkbox" ' . (in_array($column_id, $column_rights) ? 'checked="checked"' : '') . ' name="column[' . $column_id . ']" class="column_checkbox" id="column[' . $column_id . ']">';
                            $result[] = '</div>';
                        }
                        $result[] = '</td>';
                        $result[] = '</tr>';
                    }
                    $result[] = '</td>';
                }
                //        $result[] = '</tr>';
            }
            //      $result[] = '</div>';
            //      $result[] = '</tr>';
            //      $result[] = '<div class="clear"></div>';
        }
    }
    $result[] = '</table>';
    return join($result, "\n");
}
예제 #8
0
if (!defined('DIR_FS_DOCUMENT_ROOT')) {
    define('DIR_FS_DOCUMENT_ROOT', dirname(dirname(__FILE__)));
}
require_once DIR_FS_DOCUMENT_ROOT . "/config/config.php";
if (MAINTENANCE_MODE && isset($_SESSION["user"]['data'])) {
    if ($_SESSION["user"]["data"]["group_id"] != 0) {
        echo '<h1>Проводятся технические работы. Работа сайта будет восстановлена в ближайшее время</h1>';
        die;
    }
}
require_once DIR_FS_DOCUMENT_ROOT . "/config/constants.php";
require_once DIR_FS_CONFIGS . "db_config.php";
require_once DIR_FS_CONFIGS . "email_config.php";
require_once DIR_FS_CONFIGS . "tables.php";
require_once DIR_FS_INCLUDES . "autoloader.php";
db::connect();
set_error_handler('Components\\Classes\\ErrorLogger::all_error_handler');
set_exception_handler('Components\\Classes\\ErrorLogger::exception_handler');
if (!isset(ErrorLogger::$hostname)) {
    if (!isset($_SERVER) || !isset($_SERVER["HTTP_HOST"]) || $_SERVER["HTTP_HOST"] == "") {
        ErrorLogger::$hostname = getenv("HOSTNAME");
    } else {
        ErrorLogger::$hostname = $_SERVER["HTTP_HOST"];
    }
}
ErrorLogger::create_path(DIR_FS_LOGFILES, DIR_FS_DOCUMENT_ROOT);
require_once DIR_FS_INCLUDES . "functions.php";
if (get_magic_quotes_gpc()) {
    $_GET = stripslashes_array($_GET);
    $_POST = stripslashes_array($_POST);
    $_REQUEST = stripslashes_array($_REQUEST);
예제 #9
0
파일: list.php 프로젝트: yonkon/diplom
    $column->Caption = "Доход фирмы";
    $column->Key = "company_profit";
    $column = $stat_tbl->NewColumn();
    $column->Caption = "Оплачено фирме";
    $column->Key = "company_paid";
    $column = $stat_tbl->NewColumn();
    $column->Caption = "Долг перед фирмой";
    $column->Key = "debt_to_company";
    if ($isDirector) {
        $column->instantEdit = true;
    }
    $column = $stat_tbl->NewColumn();
    $column->Caption = "Заказы";
    $column->Key = "orders";
    $column->hidden = true;
    $column->id = 'orders_list';
}
$result = array('id' => 'Стоимость, руб.', 'client_price' => 0, 'client_payed' => 0, 'client_debt' => 0, 'author_price' => 0, 'author_payed' => 0, 'debt_to_author' => 0, 'company_profit' => 0, 'company_paid' => 0, 'debt_to_company' => 0, 'orders' => '');
foreach (db::get_arrays("SELECT cost_kln, cost_auth, oplata_kln, author_paid, filial_id, id, company_paid FROM " . TBL_PREF . $Filter->DstTable . " WHERE " . (!empty($result_filter) ? $result_filter : "1")) as $row) {
    $result['client_price'] += $row['cost_kln'];
    $result['client_payed'] += $row['oplata_kln'];
    $result['client_debt'] += $row['cost_kln'] - $row['oplata_kln'];
    $result['author_price'] += $row['cost_auth'];
    $result['author_payed'] += $row['author_paid'] ? $row['author_paid'] : 0;
    $result['company_profit'] += calculate_debt_to_company($row['cost_kln'], $row['cost_auth'], $row['filial_id']);
    $result['company_paid'] += $row['company_paid'];
    $result['orders'] .= empty($result['orders']) ? $row['id'] : ',' . $row['id'];
}
$result['debt_to_author'] = $result['author_price'] - $result['author_payed'];
$result['debt_to_company'] = $result['company_profit'] - $result['company_paid'];
$stat_tbl->AddRow($result, "id");
예제 #10
0
파일: functions.php 프로젝트: yonkon/diplom
function _before_start_table($tbl)
{
    // get client names
    global $clients_info;
    $ids = $clients_info = array();
    foreach ($tbl->Rows as $r) {
        $ids[$r["data"]["klient_id"]] = $r["data"]["klient_id"];
        $ids[$r["data"]["referrer_id"]] = $r["data"]["referrer_id"];
    }
    if (count($ids)) {
        $clients = db::get_assoc_arrays("SELECT id, fio, telnum, email, city FROM " . TABLE_CLIENTS . " WHERE id IN (" . join(', ', $ids) . ")");
        foreach ($clients as $r) {
            $clients_info[$r["id"]] = $r;
        }
    }
}
예제 #11
0
파일: gui_table.php 프로젝트: yonkon/diplom
 function MakeHTML()
 {
     $this->_check_sort_links();
     if ($this->isort) {
         $this->_inlinesort();
     }
     $where = "";
     if ($this->mysql_filter != "") {
         $where = " WHERE " . $this->mysql_filter;
     }
     if ($this->mysql_source) {
         $this->Rows = array();
         $limit = "";
         if ($this->pager) {
             $this->pager->allcount = intval(db::get_single_value("SELECT COUNT(" . $this->mysql_source_alias . "id) AS cnt FROM " . TBL_PREF . $this->mysql_source . $where));
             $limit = $this->pager->GetLimitStr();
         }
         $ord_str = "ORDER BY ";
         if (!is_null($this->order_rules)) {
             $ord_str .= $this->order_rules . ",";
         }
         $ord_str .= !$this->GetCurSortKey() ? $this->mysql_source_alias . "id" : $this->mysql_source_alias . $this->GetCurSortKey();
         foreach (db::get_arrays("SELECT " . $this->mysql_flds . " FROM " . TBL_PREF . $this->mysql_source . $where . " " . $ord_str . $limit) as $r) {
             $this->AddRow($r, $this->mysql_source_alias . "id");
         }
     } else {
         if ($this->pager) {
             $this->pager->allcount = count($this->Rows);
             if ($this->pager->GetLimitStr() != '') {
                 $tmp = $this->Rows;
                 $this->Rows = array();
                 for ($i = 0; $i < $this->pager->onPage; $i++) {
                     if (isset($tmp[$this->pager->curPage * $this->pager->onPage + $i])) {
                         $this->Rows[$i] = $tmp[$this->pager->curPage * $this->pager->onPage + $i];
                     }
                 }
             }
         }
     }
     $this->StartTable();
     $this->HtmlB = "";
     foreach ($this->Rows as $kr => $r) {
         $rdata = $r["data"];
         $r["style"]["cursor"] = "arrow";
         $r["style"]["background-color"] = "";
         if ($this->OnRowStart) {
             eval("\$" . "s = " . $this->OnRowStart . "(\$" . "r);");
         }
         if (is_array($this->Highlite)) {
             if ($rdata[$this->Highlite[0]] == $this->Highlite[1]) {
                 $r["style"]["background-color"] = "yellow";
             }
         }
         if (!empty($_SESSION['user']['data']['conf_ord_colors']) && $this->useColors) {
             $currentColors = unserialize($_SESSION['user']['data']['conf_ord_colors']);
             $r["style"]["background-color"] = isset($currentColors[$rdata['id']]) ? $currentColors[$rdata['id']] : '#FFFFFF';
         } else {
             $currentColors = array();
         }
         $st = $this->makeRowStyle($r);
         $this->HtmlB .= "<tr style='" . $st . "'  data-color='" . (isset($currentColors[$rdata['id']]) ? $currentColors[$rdata['id']] : '#FFFFFF') . "' data-row-id='" . $rdata['id'] . "'";
         if ($this->RowSelect) {
             $this->HtmlB .= " onmouseover='jQuery(this).css(\"background-color\", \"" . $this->RowSelectCol . "\");' onmouseout='jQuery(this).css(\"background-color\", \"" . $r["style"]["background-color"] . "\");'";
             if ($this->RowEvent != "") {
                 $this->HtmlB .= " onclick='" . $this->RowEvent . "(" . $r["data"][$r["ek"]] . ");'";
             } else {
                 if ($this->RowEvent2 != "") {
                     if (strpos($this->RowEvent2, "%var%") != false) {
                         $s = str_replace("%var%", $r["data"][$r["ek"]], $this->RowEvent2);
                     } else {
                         $attr_index = strpos($this->RowEvent2, "%var.");
                         $s = str_replace("%var.", '', $this->RowEvent2);
                         $attr_ends = strpos($s, '%', $attr_index);
                         $attr_name = substr($s, $attr_index, $attr_ends - $attr_index);
                         $s = str_replace($attr_name . '%', $r["data"][$attr_name], $s);
                     }
                     $this->HtmlB .= " onclick='" . $s . "'";
                 }
             }
         }
         $this->HtmlB .= ">" . "\n";
         foreach ($this->Columns as $k => $v) {
             $s = "";
             if (count($v->Custom)) {
                 $v = $v->Custom[$this->Settings["cust"][$k]];
             }
             if ($v->Key != "" && isset($rdata[$v->Key])) {
                 if (is_array($v->ExtData)) {
                     $s = $v->ExtData[$rdata[$v->Key]];
                 } else {
                     $s = $rdata[$v->Key];
                 }
             }
             if ($v->Process != "") {
                 $this->Rows[$kr]['info'][$k] = '';
                 eval("\$" . "s=" . $v->Process . "(\$" . "s, \$" . "rdata, \$" . "this, \$" . "this->Rows[\$" . "kr]['info'][\$" . "k]);");
             } elseif ($v->Format) {
                 switch ($v->Format) {
                     case CGUI_TABLE_FMT_SIZE:
                         $s = _tbl_fmt_size($s);
                         break;
                     case CGUI_TABLE_FMT_DATE:
                         $s = _tbl_fmt_date($s);
                         break;
                     case CGUI_TABLE_FMT_DATETIME:
                         $s = _tbl_fmt_datetime($s);
                         break;
                 }
             }
             if (!empty($this->Rows[$kr]["info"][$k])) {
                 $s = $this->Rows[$kr]["info"][$k]->GetHTML($s);
             }
             $this->HtmlB .= "<td";
             if ($v->NoWrap) {
                 $this->HtmlB .= " nowrap";
             }
             if ($v->Align) {
                 $this->HtmlB .= " style='text-align: " . $v->Align . "'";
             }
             if ($v->hidden) {
                 $this->HtmlB .= ' class="hide"';
             }
             if ($v->id) {
                 $this->HtmlB .= ' id="' . $v->id . '"';
             }
             $this->HtmlB .= ">";
             if ($v->instantEdit) {
                 $this->HtmlB .= '<span class="instantEditOldValue">' . $s . '</span><span class="instantEdit" data-title="' . $v->Caption . '" data-field="' . $v->Key . '" data-value="' . $rdata[$v->Key] . '"></span>' . "\n";
             } else {
                 $this->HtmlB .= $s . "\n";
             }
             $this->HtmlB .= "</td>" . "\n";
         }
         $this->HtmlB .= "</tr>" . "\n";
     }
     $this->EndTable();
 }
예제 #12
0
파일: index.php 프로젝트: yonkon/diplom
 function loginform_exec($Frm, $Err)
 {
     if ($Err) {
         $Frm->_gui->Vars["login_message"] = "Ошибки при заполнении формы";
         return;
     }
     // clr
     db::delete(TABLE_LOGIN_HOST, "time < " . (time() - 900));
     $last_login_time = db::get_arrays("SELECT time FROM " . TABLE_LOGIN_HOST . " WHERE ip = '" . db::input($_SERVER["REMOTE_ADDR"]) . "' ORDER BY time");
     $cnt = count($last_login_time);
     $rowx["time"] = 0;
     if ($cnt) {
         $rowx = $last_login_time[0];
     }
     $user = Employee::findOneBy(array('email' => strtolower($Frm->GetValue(0)), 'hpwd' => md5($Frm->GetValue(1) . $Frm->GetValue(0))));
     if (!$user || $cnt > 2) {
         if ($cnt > 1) {
             $t = 900 - time() + $rowx["time"];
             if ($t > 60) {
                 $w = floor($t / 60) . " мин.";
             } else {
                 $w = " минуту";
             }
             $Frm->_gui->Vars["login_message"] = "Попытки исчерпаны. Подождите " . $w;
         } else {
             $Frm->_gui->Vars["login_message"] = "Ошибка. Осталось попыток: " . (2 - $cnt);
             db::insert(TABLE_LOGIN_HOST, array('ip' => $_SERVER['REMOTE_ADDR'], 'time' => time()));
         }
         return;
     } else {
         // ok
         if ($user["blocked"] || $user["black_list"]) {
             $Frm->_gui->Vars["login_message"] = "Доступ запрещен";
             return;
         }
         $ll = array();
         if ($user["last_login"]) {
             $ll = unserialize($user["last_login"]);
             while (count($ll) > 99) {
                 array_shift($ll);
             }
         }
         $ll[] = array("ip" => $_SERVER['REMOTE_ADDR'], "time" => time());
         Employee::update($user['id'], array('last_act' => time(), 'last_login' => serialize($ll)));
         unset($user["last_act"]);
         unset($user["last_login"]);
         $_SESSION["user"]["auth"] = true;
         $_SESSION["user"]["data"] = $user;
         page_reload();
     }
 }
예제 #13
0
파일: _checkvis.php 프로젝트: yonkon/diplom
    print "<div style='overflow:auto; background:white; border: 1px solid gray; height: 78px'>" . "<table cellpadding=0 cellspacing=0 style='font-size:8pt; margin-left:2px;'>" . "<tr style='color:gray'><td>Сотрудник</td><td style='width:10px' nowrap></td><td>Занятость</td></tr>";
    // Филиал сотрудника. Если нет филиала, то используем 8 часов раб день
    $worklong = 0;
    if ($_SESSION["user"]["data"]["filial_id"]) {
        $fil = fils_get($_SESSION["user"]["data"]["filial_id"]);
        $dweek = date("w", $date) - 1;
        if ($dweek == -1) {
            $dweek = 6;
        }
        fils_getworktime($fil, $dweek, $st, $en);
        $worklong = $en - $st;
    }
    if (!$worklong) {
        $worklong = 480;
    }
    foreach ($users as $u) {
        print "<tr><td>" . $u["fio"] . "</td><td></td><td>" . round(100 * $u["visits_sum"] / $worklong) . "%</td></tr>";
    }
    print "</table></div>";
} else {
    $meetings = db::get_arrays("SELECT tm_start, tm_finish, station_id FROM " . TABLE_VISITS . " WHERE user_id = " . $uid . " AND date = " . $date);
    if ($meetings) {
        print "<div style='font-size:10pt'>";
        foreach ($meetings as $r) {
            print utils_cvt_i2times($r["tm_start"]) . "-" . utils_cvt_i2times($r["tm_finish"]) . ' - ' . get_station_name($r['station_id']) . "<br>";
        }
        print "</div>";
    } else {
        print "на выбранную дату у сотрудника нет встреч";
    }
}
예제 #14
0
파일: functions.php 프로젝트: yonkon/diplom
/**
 * @deprecated
 * @return array
 */
function kln_getrawlist()
{
    if ($_SESSION["user"]["data"]["group_id"] == 1 || $_SESSION["user"]["data"]["group_id"] == 0) {
        $sql = "SELECT * FROM " . TABLE_CLIENTS;
    } else {
        $sql = "SELECT * FROM " . TABLE_CLIENTS . " WHERE filial_id = " . db::input($_SESSION["user"]["data"]["filial_id"]);
    }
    return db::get_assoc_arrays($sql);
}
예제 #15
0
파일: history.php 프로젝트: yonkon/diplom
<?php

use Components\Classes\db;
$client_change_history = db::get_single_row("SELECT * FROM " . TABLE_CLIENTS_HISTORY . " WHERE id = " . db::input($_REQUEST['change']));
/******************** before edit start ********************/
$h = 580;
$frm = $GUI->Form("Данные о клиенте до изменений", 400, $h);
$frm->VLine(10, $h - 80, 380);
$b = $frm->Button("Назад", 155, $h - 60, 100);
$b->Event = "document.location.href=\"?section=kln&subsection=2&kln_id=" . $_REQUEST['kln_id'] . "&action=history_table\"";
$ypos = 10;
$frm->Label("Имя", 10, $ypos);
$t = $frm->Text(10, $ypos += 20, 380, $client_change_history["fio_old"]);
//1
$t->linkName = "fio";
$frm->Label("Филиал", 10, $ypos += 30);
$t = $frm->Text(10, $ypos += 20, 380, get_filial_name($client_change_history["filial_id_old"]));
//1
$t->linkName = "filial_id";
$before_edit_pass = '******';
$frm->Label("Пароль", 10, $ypos += 30);
$t = $frm->Text(10, $ypos += 20, 380, $before_edit_pass);
//1
$t->linkName = "hpwd";
$frm->Label("Почта", 10, $ypos += 30);
$t = $frm->Text(10, $ypos += 20, 180, $client_change_history["email_old"]);
//4
$t->linkName = "email";
$frm->Label("Телефон", 210, $ypos - 20);
$t = $frm->Text(210, $ypos, 180, $client_change_history["telnum_old"]);
//5
예제 #16
0
 public static function getAuthors($discipline_id)
 {
     return db::get_assoc("\n      SELECT u.id, u.fio\n      FROM " . TABLE_USERS . " u\n      JOIN " . TABLE_AUTHOR_TO_DISCIPLINE . " atd ON atd.author_id = u.id\n      WHERE\n        u.group_id in ( " . Author::ROLE_ID . " ) AND\n        u.blocked = 0 AND\n        u.black_list = 0 AND\n        atd.discipline_id = " . db::input($discipline_id));
 }
예제 #17
0
 /**
  * @param $id
  *
  * @return bool
  * @throws InvalidArgumentException
  */
 public static function delete($id)
 {
     if (empty($id) || !is_numeric($id)) {
         throw new InvalidArgumentException(self::getEntity());
     }
     db::delete(static::TABLE, 'id = ' . $id);
     return true;
 }
예제 #18
0
파일: _checknew.php 프로젝트: yonkon/diplom
<?php

use Components\Classes\db;
require_once '../../includes/application_top.php';
if (!$_SESSION["user"]["auth"]) {
    die("запрещено");
}
if (db::get_single_value("SELECT id FROM " . TABLE_MESSAGES . " WHERE addr = 'u" . db::input($_SESSION["user"]["data"]["id"]) . "' AND readed = '0' AND basket = '0'")) {
    die("1");
} else {
    die("0");
}
예제 #19
0
파일: edit.php 프로젝트: yonkon/diplom
 $usrs = array();
 $usrs[0] = "-выберите-";
 $ruk_group = Role::findOneBy(array('name' => 'Руководитель'));
 $elder_manager_group = Role::findOneBy(array('name' => 'Старший менеджер'));
 foreach ($data_users as $u) {
     if ($u["black_list"]) {
         continue;
     }
     if ($u["group_id"] == $ruk_group['id'] || $u["group_id"] == $elder_manager_group['id']) {
         $usrs[$u["id"]] = sotr_getFullName($u["id"]);
     }
 }
 $f = $frm->Select(310, $ypos, 278, $usrs, "", $filial["user_id"]);
 $f->linkName = 'manager';
 $f->AddValidator(new CGUI_VALIDATOR_NOZERO());
 $h = $frm->Hidden(db::get_single_values_string("SELECT city_id FROM " . TBL_PREF . "filial_to_city WHERE filial_id = " . db::input($filial['id']), '_'));
 $h->linkName = 'city';
 city_modal($h->idname, $id);
 $b = $frm->Button("Города", 10, $ypos += 30, 70);
 $b->Event = 'open_cities("' . $h->idname . '", "' . $GUI->Vars["city_modal_form"]->idname . '");';
 $frm->Label("Email филиала", 10, $ypos += 30);
 $t = $frm->Text(10, $ypos += 20, 573, $filial["email"]);
 $t->linkName = 'email';
 $frm->Label("Адрес сайта", 10, $ypos += 30);
 $t = $frm->Text(10, $ypos += 20, 573, $filial["web"]);
 $t->linkName = 'url';
 $frm->Label("Путь к форме заказа", 10, $ypos += 30);
 $t = $frm->Text(10, $ypos += 20, 573, $filial["order_form_path"]);
 $t->linkName = 'order_form_path';
 $frm->Label("Описание", 10, $ypos += 30);
 $t = $frm->TextArea(10, $ypos += 20, 573, 50, $filial["about"]);
예제 #20
0
        $column = $stat_tbl->NewColumn();
        $column->Caption = "Итого";
        $column = $stat_tbl->NewColumn();
        $column->Caption = "Стоимость";
        $column->Key = "client_price";
        $column = $stat_tbl->NewColumn();
        $column->Caption = "Оплачено";
        $column->Key = "client_paid";
        $column = $stat_tbl->NewColumn();
        $column->Caption = "Долг";
        $column->Key = "client_debt";
        $column = $stat_tbl->NewColumn();
        $column->Caption = "Мой доход";
        $column->Key = "consumption";
        $result = array('client_price' => 0, 'client_paid' => 0, 'client_debt' => 0, 'consumption' => 0, 'id' => 0);
        foreach (db::get_arrays("SELECT id, cost_kln, oplata_kln FROM " . TBL_PREF . $Filter->DstTable) as $row) {
            $info = '';
            $result['client_price'] += $row['cost_kln'];
            $result['client_paid'] += $row['oplata_kln'];
            $result['client_debt'] += $row['cost_kln'] - $row['oplata_kln'];
            $result['consumption'] += get_consumption(0, $row, null, $info);
        }
        $stat_tbl->AddRow($result);
        echo '<div style="margin: 10px auto 0;width: 50%;" class="gui_style">';
        echo $GUI->tables[1]->PrintTable();
        echo '</div>';
    } else {
        echo 'text';
    }
}
function tp_users_cmds_frame($value, $row, $table, &$info)
예제 #21
0
            $r1->DoSort = $custom_column['do_sort'];
            $r1->Key = $custom_column['internal_name'];
            $r1->Align = $custom_column['align'];
            $r1->Process = $custom_column['on_execute'];
            $r->Custom[] = $r1;
        }
    } else {
        $r = $tbl->NewColumn();
        $r->Caption = $column['name'];
        $r->DoSort = $column['do_sort'];
        $r->Key = $column['internal_name'];
        $r->Align = $column['align'];
        $r->Process = $column['on_execute'];
    }
}
$GUI->Vars['tm_started'] = db::get_single_value("select p_value from ofc_sys_log where p_name='email_notify_last_tm_start'");
$ds = time() - $GUI->Vars['tm_started'];
if ($ds < 60) {
    $GUI->Vars['tm_info'] = "менее минуты";
} else {
    if ($ds < 60 * 15) {
        $GUI->Vars['tm_info'] = ceil($ds / 60) . " мин.";
    } else {
        $GUI->Vars['tm_info'] = "более 15 мнут";
    }
}
$GUI->Vars['tm_needcnt'] = db::get_single_value("select count(id) from ofc_email_notifications");
$GUI->Vars['tm_working'] = db::get_single_value("select p_value from ofc_sys_log where p_name='email_notify_last_tm_work'");
$GUI->Vars['tm_allcnt'] = db::get_single_value("select p_value from ofc_sys_log where p_name='email_notify_last_all_cnt'");
$GUI->Vars['tm_goodcnt'] = db::get_single_value("select p_value from ofc_sys_log where p_name='email_notify_last_good_cnt'");
예제 #22
0
파일: functions.php 프로젝트: yonkon/diplom
function imp_station_exec($Frm, $Err)
{
    if (!$Err) {
        $file = $Frm->GetValue(0);
        if (!strpos($file["type"], "ms-excel")) {
            $Frm->_gui->informer->ERR("Неправильный тип файла");
            page_reloadSubSec();
        } else {
            $trancate = "";
            if ($Frm->GetValue(1)) {
                db::truncate(TABLE_SUBWAY_STATIONS);
                $trancate = "Таблица очищена. ";
            }
            include_once "ext/Excel/reader.php";
            $data = new Spreadsheet_Excel_Reader($file["tmp_name"]);
            if ($data->sheets[0]['numCols'] != 1) {
                $Frm->_gui->informer->ERR("В таблице должна быть 1 колонка (" . $data->sheets[0]['numCols'] . ")");
                page_reloadSubSec();
                return;
            }
            $names = array();
            $addcnt = 0;
            for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) {
                $name = $data->sheets[0]['cells'][$i][1];
                if (!isset($names[$name])) {
                    SubwayStation::create(array('name' => $name));
                    $names[$name] = true;
                    $addcnt++;
                }
            }
            $Frm->_gui->informer->OK($trancate . "Добавлено " . $addcnt . " строк");
            page_reloadSubSec();
        }
    }
}
예제 #23
0
 $r->Caption = "Сдать клиенту";
 $r->DoSort = true;
 $r->Key = "time_kln";
 $r->Align = "left";
 $r->Process = "format_date";
 foreach ($orders as $row) {
     $tbl->AddRow($row, 'id');
 }
 $visits_fields = array('id', 'status', 'date', 'client_id');
 $visits_order_by = ' ORDER BY id ASC';
 if (isset($_REQUEST['sort_cgui_table_id_usotr_visits2'])) {
     $visits_order_by = ' ORDER BY ' . $visits_fields[$_REQUEST['sort_cgui_table_id_usotr_visits2']] . ' ASC';
 } elseif (isset($_REQUEST['sort_cgui_table_id_usotr_visits2_up'])) {
     $visits_order_by = ' ORDER BY ' . $visits_fields[$_REQUEST['sort_cgui_table_id_usotr_visits2_up']] . ' DESC';
 }
 $visits = db::get_assoc_arrays("SELECT " . join(", ", $visits_fields) . " FROM " . TABLE_VISITS . " WHERE user_id = " . $id . $visits_order_by);
 $tbl = $GUI->Table("sotr_visits" . $n);
 $tbl->Width = "50%";
 $tbl->RowEvent2 = "document.location.href=\"?section=vis&subsection=2&visit=%var%\"";
 $r = $tbl->NewColumn();
 $r->Caption = "Номер встречи";
 $r->DoSort = true;
 $r->Key = "id";
 $r = $tbl->NewColumn();
 $r->Caption = "Статус";
 $r->DoSort = true;
 $r->Key = "status";
 $r->Align = "left";
 $r->Process = "get_status";
 $r = $tbl->NewColumn();
 $r->Caption = "Дата";
예제 #24
0
파일: list.php 프로젝트: yonkon/diplom
$column = $stat_tbl->NewColumn();
$column->Caption = "Долг";
$column->Key = "client_debt";
$column = $stat_tbl->NewColumn();
$column->Caption = "Расход";
$column->Key = "consumption";
$column = $stat_tbl->NewColumn();
$column->Caption = "Статус выплат";
$column->Key = "referrer_payment_status_all";
if (is_director($_SESSION['user']['data']['id'])) {
    $column->instantEdit = true;
}
$column = $stat_tbl->NewColumn();
$column->Caption = "Заказы";
$column->Key = "orders";
$column->hidden = true;
$column->id = 'orders_list';
$result = array('id' => '', 'client_price' => 0, 'client_paid' => 0, 'client_debt' => 0, 'consumption' => 0, 'referrer_payment_status_all' => 0, 'orders' => '');
$result['referrer_payment_status_all'] = 'Не оплачено';
foreach (db::get_arrays("SELECT id, cost_kln, oplata_kln, referrer_payment_status FROM " . TBL_PREF . $Filter->DstTable) as $row) {
    $info = null;
    $result['client_price'] += $row['cost_kln'];
    $result['client_paid'] += $row['oplata_kln'];
    $result['client_debt'] += $row['cost_kln'] - $row['oplata_kln'];
    $result['consumption'] += get_consumption(0, $row, null, $info);
    if ($row['referrer_payment_status'] == 1) {
        $result['referrer_payment_status_all'] = 'Оплачено';
    }
    $result['orders'] .= empty($result['orders']) ? $row['id'] : ',' . $row['id'];
}
$stat_tbl->AddRow($result);
예제 #25
0
파일: inc_out.php 프로젝트: yonkon/diplom
$tbl->Width = "100%";
$tbl->DataMYSQL("messages");
$tbl->FilterMYSQL("creator_id='u" . $_SESSION["user"]["data"]["id"] . "'");
$tbl->Pager(CGUI_PAGER_FLAG_SEL | CGUI_PAGER_FLAG_RR | CGUI_PAGER_FLAG_R | CGUI_PAGER_FLAG_FF | CGUI_PAGER_FLAG_F, 10, array(10, 20, 50, 100, 0));
global $n;
if (Roles::isActionAllowed($GUI->mmenu->selected->id, $GUI->mmenu->selected->selected->id, $_SESSION["user"]["data"]["group_id"], "Просмотр сообщения")) {
    $tbl->RowEvent2 = "document.location.href=\"?section=mls&subsection=2&type=o&read=%var%\"";
}
$columns_resource = Roles::getColumns($GUI->mmenu->selected->id, $GUI->mmenu->selected->selected->id, $_SESSION["user"]["data"]["group_id"]);
if (!is_resource($columns_resource)) {
    $GUI->ERR($columns_resource);
    page_reload();
}
$new_columns = array();
$column_group_name = array();
while ($row = db::fetch_array($columns_resource)) {
    if ($row['group_internal_name'] != "") {
        $column_group_name[] = $row['group_internal_name'];
        $new_columns[$row['group_internal_name']]['custom'][] = $row;
    } else {
        $new_columns[] = $row;
    }
}
foreach ($new_columns as $column) {
    if (isset($column['internal_name']) && in_array($column['internal_name'], $column_group_name)) {
        continue;
    }
    if (isset($column['custom']) && count($column['custom'])) {
        $r = $tbl->NewColumn();
        foreach ($column['custom'] as $custom_column) {
            $r1 = new CGUI_TableColumn();
예제 #26
0
파일: list.php 프로젝트: yonkon/diplom
    $i++;
}
$tbl->FilterMYSQL($result_filter);
$totals = db::get_arrays("\n  SELECT filial_id, SUM(`value`) as total_expenses\n  FROM " . TBL_PREF . $Filter->DstTable . "\n  WHERE " . $result_filter . "\n  GROUP BY filial_id\n");
if ($totals) {
    $stat_tbl = $GUI->Table("expenses_stat" . $n);
    $stat_tbl->Width = "50%";
    $column = $stat_tbl->NewColumn();
    $column->Caption = "Филиал";
    $column->Key = "id";
    $column = $stat_tbl->NewColumn();
    $column->Caption = "Общий расход";
    $column->Key = "total_expenses";
    if (is_director($_SESSION['user']['data']['id'])) {
        $column = $stat_tbl->NewColumn();
        $column->Caption = "Итого расход руководителя";
        $column->Key = "director_expenses";
    }
    foreach ($totals as $row) {
        $res = array();
        if ($row['filial_id'] == 0) {
            $res['id'] = 'Руководитель';
            $res['director_expenses'] = '';
        } else {
            $res['id'] = get_filial_name($row['filial_id']);
            $res['director_expenses'] = $row['total_expenses'] * (1 - db::get_single_value("SELECT consumption FROM " . TBL_PREF . "data_filials WHERE id = " . $row['filial_id']));
        }
        $res['total_expenses'] = $row['total_expenses'];
        $stat_tbl->AddRow($res);
    }
}
예제 #27
0
function import_city_exec($Frm, $Err)
{
    if (!$Err) {
        $v = $Frm->GetValue(0);
        if (!strpos($v["type"], "ms-excel")) {
            $Frm->_gui->informer->ERR("Неправильный тип файла");
            page_reloadSubSec();
        } else {
            $s = "";
            if ($Frm->GetValue(1)) {
                db::truncate(TABLE_CITIES);
                $s = "Таблица очищена. ";
            }
            include_once "ext/Excel/reader.php";
            $data = new Spreadsheet_Excel_Reader($v["tmp_name"]);
            if ($data->sheets[0]['numCols'] != 1) {
                $Frm->_gui->informer->ERR("В таблице должна быть 1 колонка");
                page_reloadSubSec();
                return;
            }
            for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) {
                db::insert(TABLE_CITIES, array('name' => htmlspecialchars($data->sheets[0]['cells'][$i][1])));
            }
            $Frm->_gui->informer->OK($s . "Добавлено " . $data->sheets[0]['numRows'] . " строк");
            page_reloadSubSec();
        }
    }
}
예제 #28
0
파일: _gettext.php 프로젝트: yonkon/diplom
<?php

use Components\Classes\db;
require_once '../../includes/application_top.php';
if (!$_SESSION["user"]["auth"]) {
    die("запрещено");
}
if (!isset($_REQUEST["num"])) {
    die("нет данных");
}
$num = intval($_REQUEST["num"]);
$message = db::get_single_row("SELECT * FROM " . TABLE_MESSAGES . " WHERE id = " . db::input($num) . " AND (creator_id = 'u" . $_SESSION["user"]["data"]["id"] . "' OR addr = 'u" . $_SESSION["user"]["data"]["id"] . "')");
if (!$message) {
    die("сообщение не найдено");
}
$tp = "i";
if ($message["addr"] != "u" . $_SESSION["user"]["data"]["id"]) {
    $tp = "o";
}
if ($message["basket"]) {
    $tp = "b";
}
die("<p><input type='button' value='Перейти' onclick='document.location.href=\"?section=mls&subsection=2&type=" . $tp . "&read=" . $num . "\"'></p>" . text_to_html($message["text"]));
예제 #29
0
         if ($bDoUpdate) {
             Order::update($_GET['order_id'], array($_GET['field'] => $value));
             $order_info = Order::find($_GET['order_id']);
             if ($bDoHistoryUpdate) {
                 $data = array('change_date' => time(), 'change_user_id' => $_SESSION['user']['data']['id'], 'order_id' => $_GET['order_id'], 'filial_id_new' => $order_info['filial_id'], 'klient_id_new' => $order_info['klient_id'], 'vuz_id_new' => $order_info['vuz_id'], 'vuz_user_new' => $order_info['vuz_user'], 'type_id_new' => $order_info['type_id'], 'type_user_new' => $order_info['type_user'], 'napr_id_new' => $order_info['napr_id'], 'disc_id_new' => $order_info['disc_id'], 'disc_user_new' => $order_info['disc_user'], 'time_kln_new' => $order_info['time_kln'], 'cost_kln_new' => $order_info['cost_kln'], 'payment_id_new' => $order_info['payment_id'], 'subject_new' => $order_info['subject'], 'about_kln_new' => $order_info['about_kln'], 'about_mng_new' => $order_info['about_mng'], 'kurs_new' => $order_info['kurs'], 'prakt_pc_new' => $order_info['prakt_pc'], 'pages_min_new' => $order_info['pages_min'], 'pages_max_new' => $order_info['pages_max'], 'src_min_new' => $order_info['src_min'], 'src_max_new' => $order_info['src_max'], 'from_id_new' => $order_info['from_id'], 'oform_new' => $order_info['oform'], 'next_rel_date_new' => $order_info['next_rel_date'], 'status_id_new' => $order_info['status_id'], 'ok_comment_new' => $order_info['ok_comment'], 'ok_comment_date_new' => $order_info['ok_comment_date'], 'payment_comment_new' => $order_info['payment_comment'], 'cost_auth_new' => $order_info['cost_auth'], 'time_auth_new' => $order_info['time_auth'], 'oplata_kln_new' => $order_info['oplata_kln'], 'author_paid_new' => $order_info['author_paid'], 'company_paid_new' => $order_info['company_paid'], 'filial_id_old' => $order_info['filial_id'], 'klient_id_old' => $order_info['klient_id'], 'vuz_id_old' => $order_info['vuz_id'], 'vuz_user_old' => $order_info['vuz_user'], 'type_id_old' => $order_info['type_id'], 'type_user_old' => $order_info['type_user'], 'napr_id_old' => $order_info['napr_id'], 'disc_id_old' => $order_info['disc_id'], 'disc_user_old' => $order_info['disc_user'], 'time_kln_old' => $order_info['time_kln'], 'cost_kln_old' => $order_info['cost_kln'], 'payment_id_old' => $order_info['payment_id'], 'subject_old' => $order_info['subject'], 'about_kln_old' => $order_info['about_kln'], 'about_mng_old' => $order_info['about_mng'], 'kurs_old' => $order_info['kurs'], 'prakt_pc_old' => $order_info['prakt_pc'], 'pages_min_old' => $order_info['pages_min'], 'pages_max_old' => $order_info['pages_max'], 'src_min_old' => $order_info['src_min'], 'src_max_old' => $order_info['src_max'], 'from_id_old' => $order_info['from_id'], 'oform_old' => $order_info['oform'], 'next_rel_date_old' => $order_info['next_rel_date'], 'status_id_old' => $order_info['status_id'], 'ok_comment_old' => $order_info['ok_comment'], 'ok_comment_date_old' => $order_info['ok_comment_date'], 'payment_comment_old' => $order_info['payment_comment'], 'cost_auth_old' => $order_info['cost_auth'], 'time_auth_old' => $order_info['time_auth'], 'oplata_kln_old' => $order_info['oplata_kln'], 'author_paid_old' => $order_info['author_paid'], 'company_paid_old' => $order_info['company_paid']);
                 $data[$_GET['field'] . '_new'] = $_GET['value'];
                 OrderHistory::create($data);
             }
         }
     }
     break;
 case 'get':
     if (!empty($_GET['field'])) {
         switch ($_GET['field']) {
             case 'status_id':
                 $result[] = db::get_select("SELECT id, status_name FROM " . TBL_PREF . "orders_status", 'status', '', $_GET['value'], 'class="instantEditNewValue"');
                 break;
             case 'referrer_payment_status':
                 $result[] = 'Оплатить?<input type="hidden" value="1" class="instantEditNewValue"/>';
                 break;
             case 'oplata_kln':
             case 'cost_kln':
             case 'cost_auth':
             case 'author_paid':
             case 'company_paid':
                 $result[] = '<input type="text" class="instantEditNewValue" value="' . $_GET['value'] . '"/>';
                 break;
             case 'time_auth':
                 $result[] = '<input type="text" class="instantEditNewValue" value="' . _get_fmt_date($_GET['value']) . '"/>';
                 break;
             case 'debt_to_author':
예제 #30
0
파일: Napravls.php 프로젝트: yonkon/diplom
 public static function getDisciplines($napravl_id)
 {
     return db::get_single_values_array("SELECT discipline_id FROM " . TABLE_DISCIPLINE_TO_NAPRAVL . " WHERE napravl_id = " . db::input($napravl_id));
 }