Пример #1
0
          }
          function sort_by(field, reverse, primer) {
            var key = primer ?
              function(x) {return primer(x[field])} :
              function(x) {return x[field]};

            reverse = [-1, 1][+!!reverse];

            return function(a, b) {
              return a = key(a), b = key(b), reverse * ((a > b) - (b > a));
            }
          }

          var disciplines = [], worktypes = [];
          disciplines = <?php 
    echo json_encode(Discipline::findAll());
    ?>
;
          $('.select2[name=zf_work_predm]').select2({
            data: {
              results: disciplines,
              text: 'name'
            },
            containerCssClass: 'select2_container',
            formatSelection: format,
            formatResult: format,
            createSearchChoice: own_choise,
            sortResults: function(results, container, query) {
              if (query.term) {
                return results.sort(sort_by('name', true, function(a){return a.length}));
              }
Пример #2
0
// 5
$t->linkName = "work_usr";
$ypos += 30;
$s->AddJsEvent("change", " jQuery('#" . $t->idname . "').val(''); ");
$t->AddJsEvent("keyup", " jQuery('#" . $s->idname . "').val(0); ");
$frm->Label("Направление (факультет)", 10, $ypos);
$frm->Label("Дисциплина", 190, $ypos);
$ypos += 20;
$s = $frm->Select(10, $ypos, 160, array(0 => array("name" => "-выберите-")) + $data_napravl, "name", $order_info["napr_id"]);
//6
$s->linkName = "napr";
$t = $frm->Hidden(isset($data_discip[$order_info["disc_id"]]) ? $order_info["disc_id"] : $order_info["disc_user"]);
// 8
$t->linkName = "disc_usr";
$t->class = 'discipline_select2';
$disciplines = Discipline::findAll();
foreach ($disciplines as &$discipline) {
    $discipline['authors_qt'] = Disciplines::getAuthorsQt($discipline['id']);
}
unset($discipline);
page_AddScriptText('var disciplines = ' . json_encode($disciplines) . ';');
$ypos += 30;
$frm->Label("Тема работы", 10, $ypos);
$ypos += 20;
$t = $frm->TextArea(10, $ypos, 625, 60, $order_info["subject"]);
//9
$t->linkName = "subj";
$t->AddValidator(new CGUI_VALIDATOR_NOEMPTY());
$t->AddValidator(new CGUI_VALIDATOR_MAXLEN(512));
$ypos += 70;
$frm->Label("Дата сдачи", 10, $ypos);
Пример #3
0
    $r = $tbl->NewColumn();
    $r->Caption = "Название";
    $r->DoSort = true;
    $r->Key = "name";
    $r->Align = "left";
    $r = $tbl->NewColumn();
    $r->Caption = "Направление";
    $r->Align = "left";
    $r->Process = "get_discipline_napravl";
    $r = $tbl->NewColumn();
    $r->Caption = "Количество авторов";
    $r->Process = "get_authors_qt_for_discipline";
    $r = $tbl->NewColumn();
    $r->Caption = "";
    $r->Process = "tp_discip_cmds";
    foreach (Discipline::findAll() as $d) {
        $tbl->AddRow($d, "id");
    }
    $tbl->InlineSort(true);
    if (user_can($GUI->mmenu->selected->id, $GUI->mmenu->selected->selected->id, $_SESSION["user"]["data"]["group_id"], "Добавить")) {
        $GUI->cmdmenu->AddItem("Добавить", "?section=sprav&subsection=5&add");
    }
    if (user_can($GUI->mmenu->selected->id, $GUI->mmenu->selected->selected->id, $_SESSION["user"]["data"]["group_id"], "Импорт Excel")) {
        $GUI->cmdmenu->AddItem("Импорт Excel", "?section=sprav&subsection=5&imp");
    }
}
function get_discipline_napravl($value, $row, $table, $info)
{
    return Disciplines::get_napravl_list_as_string($row['id']);
}
function get_authors_qt_for_discipline($value, $row, $table, $info)