コード例 #1
0
ファイル: inc_out.php プロジェクト: yonkon/diplom
<?php

use Components\Classes\Roles;
use Components\Classes\db;
$tbl = $GUI->Table("mls_out", array("cur_sort_up" => true));
$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;
コード例 #2
0
ファイル: edit.php プロジェクト: yonkon/diplom
if (!$client) {
    $GUI->ERR("Клиент не найден");
    page_ReloadSec();
}
if (Roles::isActionAllowed($GUI->mmenu->selected->id, $GUI->mmenu->selected->selected->id, $_SESSION["user"]["data"]["group_id"], "Назначить встречу")) {
    $GUI->cmdmenu->AddItem("Назначить встречу", "?section=vis&subsection=1&kln=" . $client["id"]);
}
if (Roles::isActionAllowed($GUI->mmenu->selected->id, $GUI->mmenu->selected->selected->id, $_SESSION["user"]["data"]["group_id"], "Принять заказ")) {
    $GUI->cmdmenu->AddItem("Принять заказ", "?section=ord&subsection=1&kln_id=" . $client["id"]);
}
if (Roles::isActionAllowed($GUI->mmenu->selected->id, $GUI->mmenu->selected->selected->id, $_SESSION["user"]["data"]["group_id"], "Заказы")) {
    $GUI->cmdmenu->AddItem("Заказы", "?section=ord&subsection=2&kln_id=" . $client["id"]);
    $GUI->cmdmenu->AddItem("Заказы (архив)", "?section=ord&subsection=3&kln_id=" . $client["id"]);
    // maxf 30.03.2014 Чтобы видеть арихивные заказы
}
if (Roles::isActionAllowed($GUI->mmenu->selected->id, $GUI->mmenu->selected->selected->id, $_SESSION["user"]["data"]["group_id"], "История клиента")) {
    $GUI->cmdmenu->AddItem("История клиента", "?section=kln&subsection=2&action=history_table&kln_id=" . $client["id"]);
}
$ypos = 10;
$frm = $GUI->Form("Данные о клиенте #" . $client["id"], 400, 610);
$frm->OnExecute = "editclient_exec";
$h = $frm->Hidden($client["id"]);
$h->linkName = "id";
$frm->Label("Имя", 10, $ypos);
$t = $frm->Text(40, $ypos - 5, 350, $client["fio"]);
//1
$t->AddValidator(new CGUI_VALIDATOR_NOEMPTY());
$t->linkName = "fio";
$frm->Label("Город", 10, $ypos += 30);
$t = $frm->Text(60, $ypos - 5, 120, $client["city"]);
//8
コード例 #3
0
ファイル: index.php プロジェクト: yonkon/diplom
 if ($_SESSION["user"]["data"]["group_id"] != 0) {
     $office_modules = db::get_arrays("\n      SELECT m.internal_name, m.name, m.id\n      FROM " . TBL_PREF . "modules m\n      JOIN " . TBL_PREF . "roles_to_modules rtm ON m.id = rtm.module_id\n      WHERE rtm.role_id = " . $_SESSION["user"]["data"]["group_id"] . "\n      ORDER BY m.order ASC\n    ");
 } else {
     $office_modules = Module::findAll();
 }
 $i = 1;
 $default = false;
 foreach ($office_modules as $module) {
     $module_root = DIR_FS_MODULES . $module["internal_name"] . "/";
     if ($i == 1) {
         $default = true;
         $i++;
     }
     $module_tab = $GUI->mmenu->AddItem($module['id'], $module['name'], $module['internal_name'], $default);
     $module_tab->caption = $module['name'];
     $submodules = Roles::getSubmodules($_SESSION["user"]["data"]["group_id"], $module['id']);
     if (is_array($submodules)) {
         foreach ($submodules as $submodule) {
             $submodule_tab = $module_tab->AddItem($submodule['id'], $submodule['name'], $submodule['order'], $submodule['default']);
             $submodule_tab->caption = $submodule['name'];
         }
     } else {
         $GUI->ERR($modules);
     }
     include_once $module_root . "init.php";
 }
 // use selected module
 $GUI->mmenu->Update();
 $active_module_root = DIR_FS_MODULES . $GUI->mmenu->selected->section . "/";
 include_once $active_module_root . "inc.php";
 $page_title = $GUI->mmenu->selected->caption;
コード例 #4
0
ファイル: archive.inc.php プロジェクト: yonkon/diplom
 if (Roles::isActionAllowed($GUI->mmenu->selected->id, $GUI->mmenu->selected->selected->id, $_SESSION["user"]["data"]["group_id"], "Распределение")) {
     $GUI->cmdmenu->AddItem("Распределение", "?section=ord&subsection=2&order=" . $order_id . "&p=3");
 }
 if (Roles::isActionAllowed($GUI->mmenu->selected->id, $GUI->mmenu->selected->selected->id, $_SESSION["user"]["data"]["group_id"], "Файлы")) {
     $GUI->cmdmenu->AddItem("Файлы", "?section=ord&subsection=2&order=" . $order_id . "&p=4");
 }
 if (Roles::isActionAllowed($GUI->mmenu->selected->id, $GUI->mmenu->selected->selected->id, $_SESSION["user"]["data"]["group_id"], "Назначить встречу")) {
     $GUI->cmdmenu->AddItem("Назначить встречу", "?section=vis&subsection=1&kln=" . $order_info["klient_id"] . "&ord=" . $order_id);
 }
 if (Roles::isActionAllowed($GUI->mmenu->selected->id, $GUI->mmenu->selected->selected->id, $_SESSION["user"]["data"]["group_id"], "Показать встречи")) {
     $GUI->cmdmenu->AddItem("Показать встречи", "?section=vis&subsection=2&kln=" . $order_info["klient_id"] . "&ord=" . $order_id);
 }
 if (Roles::isActionAllowed($GUI->mmenu->selected->id, $GUI->mmenu->selected->selected->id, $_SESSION["user"]["data"]["group_id"], "История заказа")) {
     $GUI->cmdmenu->AddItem("История заказа", "?section=ord&subsection=2&order=" . $order_id . "&p=5");
 }
 if (Roles::isActionAllowed($GUI->mmenu->selected->id, $GUI->mmenu->selected->selected->id, $_SESSION["user"]["data"]["group_id"], "Отправить сообщение")) {
     $GUI->cmdmenu->AddItem("Отправить сообщение", "?section=mls&subsection=1&_order=" . $order_id);
 }
 $p = 1;
 if (isset($_REQUEST["p"])) {
     $p = intval($_REQUEST["p"]);
 }
 $defdata = array();
 $defdata["klient"] = false;
 $defdata["vuz"] = 0;
 $defdata["vuz_usr"] = "";
 $defdata["kurs"] = 0;
 $defdata["work"] = 0;
 $defdata["work_usr"] = "";
 $defdata["napr"] = 0;
 $defdata["disc"] = 0;
コード例 #5
0
ファイル: list.php プロジェクト: yonkon/diplom
    $column->Caption = "Долг клиента";
    $column->Key = "client_debt";
}
if ($isAuthor || $isDirector || $isManager) {
    $column = $stat_tbl->NewColumn();
    $column->Caption = "Гонорар автора";
    $column->Key = "author_price";
}
if ($isDirector || $isManager) {
    $column = $stat_tbl->NewColumn();
    $column->Caption = "Оплачено автору";
    $column->Key = "author_payed";
    $column = $stat_tbl->NewColumn();
    $column->Caption = "Долг перед автором";
    $column->Key = "debt_to_author";
    if (Roles::isActionAllowed($GUI->mmenu->selected->id, $GUI->mmenu->selected->selected->id, $_SESSION["user"]["data"]["group_id"], "Редактировать Долг перед автором")) {
        $column->instantEdit = true;
    }
    $column = $stat_tbl->NewColumn();
    $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();
コード例 #6
0
ファイル: functions.php プロジェクト: yonkon/diplom
/**
 * @deprecated
 * @param $module_name
 * @param $submodule_id
 * @param $role_id
 * @param $command_name
 *
 * @return bool
 */
function user_can($module_name, $submodule_id, $role_id, $command_name)
{
    return Roles::isActionAllowed($module_name, $submodule_id, $role_id, $command_name);
}
コード例 #7
0
ファイル: edit.php プロジェクト: yonkon/diplom
<?php

use Components\Entity\Filial;
use Components\Entity\Role;
use Components\Classes\Roles;
use Components\Exceptions\AccessDeniedException;
use Components\Classes\db;
if (!Roles::isActionAllowed($GUI->mmenu->selected->id, $GUI->mmenu->selected->selected->id, $_SESSION["user"]["data"]["group_id"], "Редактировать")) {
    throw new AccessDeniedException();
}
$id = intval($_REQUEST["edit"]);
$filial = Filial::find($id);
if ($filial) {
    if (Roles::isActionAllowed($GUI->mmenu->selected->id, $GUI->mmenu->selected->selected->id, $_SESSION["user"]["data"]["group_id"], "Удалить")) {
        $GUI->cmdmenu->AddItem("Удалить", "?section=fils&subsection=2&del=" . $id);
    }
    $frm = $GUI->Form("Редактировать филиал", 600, 420);
    $frm->Hidden($id);
    $ypos = 10;
    $frm->Label("Название", 10, $ypos);
    $frm->Label("Руководитель", 310, $ypos);
    $t = $frm->Text(10, $ypos += 20, 278, $filial["name"]);
    $t->linkName = 'name';
    $t->AddValidator(new CGUI_VALIDATOR_NOEMPTY());
    $t->AddValidator(new CGUI_VALIDATOR_MAXLEN(40));
    $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"]) {
コード例 #8
0
ファイル: list.php プロジェクト: yonkon/diplom
     $export = new MysqlToExcel();
     $export->setWorkSheetName('База клиентов');
     $export->setModuleName('kln');
     $export->setSubModuleName('Список');
     if (is_director($_SESSION["user"]["data"]["id"])) {
         $clients = Client::findAll();
     } else {
         $clients = Client::findBy(array('filial_id' => $_SESSION["user"]["data"]["filial_id"]));
     }
     $export->setData($clients);
     $export->writeData();
     $export->getOutput('Клиенты');
     die;
     break;
 case 'users':
     if (!Roles::isActionAllowed($GUI->mmenu->selected->id, $GUI->mmenu->selected->selected->id, $_SESSION["user"]["data"]["group_id"], "Скачать базу сотрудников")) {
         $GUI->ERR('У вас нету прав');
         page_reloadSubSec();
     }
     $export = new MysqlToExcel();
     $export->setWorkSheetName('База сотрудников');
     $export->setModuleName('sotr');
     $export->setSubModuleName('Список');
     if (is_director($_SESSION["user"]["data"]["id"])) {
         $employers = Employee::findAll();
     } else {
         $employers = Employee::findBy(array('filial_id' => $_SESSION["user"]["data"]["filial_id"]));
     }
     $export->setData($employers);
     $export->writeData();
     $export->getOutput('Сотрудники');