<?php use Components\Classes\Author; use Components\Classes\Napravls; use Components\Classes\Disciplines; use Components\Entity\Napravl; use Components\Entity\Discipline; $author_id = $_SESSION['user']['data']['id']; if (!empty($_POST['save'])) { $disciplines = isset($_POST['discipline']) ? $_POST['discipline'] : array(); Author::delete_napravl_all($author_id); Author::addDisciplines($author_id, array_keys($disciplines)); $GUI->OK('Сохранено'); } $napravlAll = Napravl::findAll(); $authorNapravls = Author::get_napravl($author_id); $authorDisciplines = Author::getDisciplines($author_id); $result[] = '<table style="width: 100%;">'; if (count($napravlAll)) { foreach ($napravlAll as $napravl) { $disciplines = Napravls::getDisciplines($napravl['id']); $checked = in_array($napravl['id'], $authorNapravls); $result[] = '<tr style="background-color: #d3d3d3;">'; $result[] = '<td colspan="100">'; $result[] = '<div class="module_name"> <label for="napravl[' . $napravl['id'] . ']">' . Napravls::getName($napravl['id']) . '</label> </div>'; if (count($disciplines)) { $result[] = ' '; $result[] = '<span style="vertical-align: middle;line-height: 1.9;" data-toggle="select" data-target="napravl_' . $napravl['id'] . '">выбрать все</span>'; $result[] = ' ';
$frm->Label("Группа", 260, $ypos); $t = $frm->Text(10, $ypos += 20, 230, $employer["telnum"]); $t->linkName = 'phone'; $t->AddValidator(new CGUI_VALIDATOR_NOEMPTY()); $t->AddValidator(new CGUI_VALIDATOR_TELNUM()); $group_field = $frm->Select(260, $ypos, 230, $groups, "name", $employer["group_id"]); $group_field->linkName = 'group'; $group_field->AddValidator(new CGUI_VALIDATOR_NOZERO()); $frm->Label("Филиал", 10, $ypos += 30); $l = $frm->Label("Направление автора", 260, $ypos); $l->display = 'none'; $d = $data_filials; $d[0] = array("name" => "- выберите"); $t = $frm->Select(10, $ypos += 20, 230, $d, "name", $employer["filial_id"]); $t->linkName = 'filial'; $t = $frm->Select(260, $ypos, 230, $data_napravl, "name", Author::get_napravl($id)); $t->linkName = 'author_napravl'; $t->display = 'none'; $t->Multiple = true; $t->RowSize = 4; if ($employer["group_id"] == $author_group_id) { $t->display = 'block'; $l->display = 'block'; $ypos += 45; } $group_field->AddJsEvent('change', 'check_is_author(' . $author_group_id . ', ' . $group_field->idname . ', ' . $t->idname . ')'); $frm->Label("Дополнительные контакты", 10, $ypos += 30); $t = $frm->TextArea(10, $ypos += 20, 480, $wcn, $employer["cont"]); $t->linkName = 'contacts'; $frm->Label("Комментарии", 10, $ypos += $wcn + 30); $t = $frm->TextArea(10, $ypos += 20, 480, $wc, $employer["comments"]);