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;
 }
Exemple #2
0
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");
}
Exemple #3
0
 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));
 }
Exemple #4
0
 public static function getDisciplines($author_id)
 {
     return db::get_single_values_array("SELECT discipline_id FROM " . TABLE_AUTHOR_TO_DISCIPLINE . " WHERE author_id = " . db::input($author_id));
 }
Exemple #5
0
 public static function getNapravListAsArray($discipline_id)
 {
     return db::get_single_values_array("\n      SELECT n.id\n      FROM " . TABLE_NAPRAVL . " n\n      JOIN " . TABLE_DISCIPLINE_TO_NAPRAVL . " d ON d.napravl_id = n.id\n      WHERE d.discipline_id = " . db::input($discipline_id) . "\n    ");
 }
Exemple #6
0
<?php

use Components\Classes\db;
if (!empty($_REQUEST['term'])) {
    echo json_encode(array_unique(db::get_single_values_array("SELECT `name` FROM " . TABLE_EXPENSES . " WHERE `name` LIKE '%" . db::input($_REQUEST['term']) . "%'")));
    die;
}
Exemple #7
0
function city_modal($hidden_field_id, $filial_id = null)
{
    global $GUI, $filial_module_root, $data_city;
    need_data('data_city');
    $GUI->tmpls[] = $filial_module_root . "city.tmpl.php";
    $frm = $GUI->ModalFormEx("Города филиала", 300, 280);
    $frm->Nosubmit = true;
    $GUI->Vars["city_modal_form"] = $frm;
    if (empty($filial_id)) {
        $exlude_cities = db::get_single_values_array("SELECT DISTINCT city_id FROM " . TBL_PREF . "filial_to_city");
    } else {
        $exlude_cities = db::get_single_values_array("SELECT DISTINCT city_id FROM " . TBL_PREF . "filial_to_city WHERE filial_id != " . $filial_id);
    }
    $ypos = 0;
    $cities = array();
    foreach ($data_city as $city) {
        if (in_array($city['id'], $exlude_cities)) {
            continue;
        }
        $cities[$city['id']] = $city['name'];
    }
    ksort($cities);
    $s = $frm->Select(10, $ypos += 20, 280, $cities, '', 0);
    $s->Multiple = true;
    $s->RowSize = 10;
    $s->linkName = 'cities';
    $s->name = 'cities[]';
    $b = $frm->Button("Выбрать", 50, $ypos += 190, 80);
    $b->Event = "check_cities('" . $hidden_field_id . "', '" . $frm->idname . "');";
    $b = $frm->Button("Отмена", 150, $ypos, 80);
    $b->Event = 'jQuery.modal.close();';
}
Exemple #8
0
<?php

use Components\Classes\db;
if (!empty($_REQUEST['term']) && !empty($_REQUEST['entity'])) {
    $result = array();
    switch ($_REQUEST['entity']) {
        case 'disciplina':
            $result = db::get_single_values_array("SELECT `name` FROM " . TABLE_DISCIPLINE . " WHERE `name` LIKE '" . db::input($_REQUEST['term']) . "%' ORDER BY `name`");
            break;
    }
    echo json_encode(array_unique($result));
    die;
}