uisi.ru/uisi/general/staff1.php
2023-11-28 21:06:25 +05:00

297 lines
10 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?
require($_SERVER['DOCUMENT_ROOT'].'/bitrix/header.php');
function Http404()
{
CHTTP::SetStatus('404 Not Found');
@define('ERROR_404','Y');
$rsSites = CSite::GetByID(SITE_ID);
$arSite = $rsSites->Fetch();
include($arSite['DOC_ROOT'].'/404.php');
return;
}
function getFullName($name, $name_second, $name_last)
{
$name_full = ($name_last) ? $name_last.' ' : '' ;
$name_full .= $name;
$name_full .= ($name_second) ? ' '.$name_second : '' ;
return $name_full;
}
function getUserRows($arUser, $arFieldsBefore = array(), $arFieldsAfter = array())
{
$arPreview = array(
'UF_DISCIPLINES' => array(
'title' => 'Преподаваемые дисциплины',
'list' => true
),
'UF_TRAINING_DIRECTIO' => array(
'title' => 'Наименование направления подготовки и (или) специальности',
'list' => false
),
'UF_TOTAL_WORK_EXPERI' => array(
'title' => 'Общий стаж работы',
'list' => false
),
'UF_PROF_EXP' => array(
'title' => 'Стаж работы по специальности',
'list' => false
),
'UF_ADVANCED_TRAINING' => array(
'title' => 'Повышение квалификации',
'list' => true
),
'UF_QUALIFICATION' => array(
'title' => 'Квалификация',
'list' => false
),
'UF_EDUCATION_LEVEL' => array(
'title' => 'Уровень образования',
'list' => false
),
);
$arFields = array_merge($arFieldsBefore, $arPreview, $arFieldsAfter);
$arUserRows = array();
foreach ($arFields as $field => $data) {
$value = $arUser[$field];
if ($value) {
if ($data['list']) {
$value = renderList($value);
}
$arUserRows[] = '<tr>
<td>'.$data['title'].':</td>
<td>'.$value.'</td>
</tr>';
}
}
return $arUserRows;
}
function renderList($data)
{
$list = array();
foreach (explode(';', $data) as $item) {
$item = trim($item);
if ($item) {
$list[] = $item;
}
}
if (count($list) == 1) {
return $data;
}
return '<ul class="staff-info"><li>'.implode('</li><li>', $list).'</li></ul>';
}
$title = 'Список сотрудников';
$style = '.cont1 td,th {
font-size: 12px;
}
.staff-info {
padding-left: 10px;
}';
$script = '';
$groupsAllowed = array(13);
$id = htmlspecialcharsEx($_REQUEST['id']);
if ($id) {
$arGroups = CUser::GetUserGroup($id);
$result_intersect = array_intersect($groupsAllowed, $arGroups);
if (empty($result_intersect)) {
return Http404();
}
$rsUser = CUser::GetByID($id);
if (!$rsUser) {
return Http404();
}
$arUser = $rsUser->Fetch();
$style .= '.staff-detail-table {
border-collapse: collapse;
}
.staff-detail-table tr:nth-child(2n) {
background-color: rgba(24, 24, 24, 0.1);
}
.staff-detail-table h1 {
font-size: 16px;
}
';
$content = '<a href="/uisi/general/staff.php" title="'.$title.'"><- К списку сотрудников</a>';
$name_full = getFullName($arUser['NAME'], $arUser['SECOND_NAME'], $arUser['LAST_NAME']);
$title .= ' - '.$name_full;
$content .= '<table class="staff-detail-table"><tbody>';
$photo_path = '/uisi/media/staff/'.$arUser['LOGIN'].'-w';
$photo = CFile::Show2Images($photo_path.'-pre.png', $photo_path.'.png', 256, 256);
$content .= '<tr>
<td style="padding: 10px;">'.$photo.'</td>
<td><h1>'.$name_full.'</h1></td>
</tr>';
$arFieldsBefore = array(
'UF_DEGREE' => array(
'title' => 'Ученая степень',
'list' => false
),
'UF_ACADEMIC_TITLE' => array(
'title' => 'Ученое звание / Категория',
'list' => false
),
'WORK_POSITION' => array(
'title' => 'Должность',
'list' => false
),
);
$arFieldsAfter = array(
'WORK_PHONE' => array(
'title' => 'Внутренний телефон',
'list' => false
),
'UF_AUDITORIUM' => array(
'title' => 'Аудитория',
'list' => false
),
'UF_WING' => array(
'title' => 'Корпус',
'list' => false
),
);
$arUserRows = getUserRows($arUser, $arFieldsBefore, $arFieldsAfter);
$content .= implode($arUserRows);
$email = $arUser['UF_EMAIL'];
if ($email) {
$content .= '<tr>
<td>Электронный адрес:</td>
<td><a href="mailto:'.$email.'">'.$email.'</a></td>
</tr>';
}
$content .= '</tbody></table>';
} else {
$rsUsers = CUser::GetList(($by='LAST_NAME'), ($order='asc'), array('GROUPS_ID'=>$groupsAllowed), array('SELECT'=>array('UF_*')));
// разбиваем постранично по 50 записей
// $rsUsers->NavStart(50);
// печатаем постраничную навигацию
// echo $rsUsers->NavPrint(GetMessage('PAGES'));
$style .= '.foo {
width: 0 !important;
border: 1px solid red;
}
.staff-list-item-preview {
display: none;
border-top: 1px dotted #828282;
}
.staff-list-item-preview-link {
display: inline-block;
margin-left: 0.255em;
vertical-align: 0.255em;
content: "";
border-top: 0.3em solid;
border-right: 0.3em solid transparent;
border-bottom: 0;
border-left: 0.3em solid transparent;
font-size: 20px !important;
}
.staff-list-item-preview-table {
width: 90%;
}
.staff-list-item-preview-table td:first-child {
width: 40%;
}';
$content = '<h1>Педагогический состав</h1>';
$content = '<a href="/uisi/general/rukovodstvo.php"><- Руководство. Педагогический состав</a>';
$content .= '</div></td></tr></tbody></table></div></td><td width="20" background="/i/bg_r.png" style="-moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-bottom-colors: none; -moz-border-left-colors: none; border-image: none;"></td></tr><tr> <td width="20" height="20" background="/i/bg_b_l.png" style="-moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-bottom-colors: none; -moz-border-left-colors: none; border-image: none;"></td> <td width="720" height="20" background="/i/bg_b.png" style="-moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-bottom-colors: none; -moz-border-left-colors: none; border-image: none;"></td> <td width="20" height="20" background="/i/bg_b_r.png" style="-moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-bottom-colors: none; -moz-border-left-colors: none; border-image: none;"></td> </tr></tbody></table></div></center>';
$script .= '$(\'td[width="140"]\').empty().removeAttr("width");
$(\'td[height="600"]\').removeAttr("height");';
$content .= '<table style="border-collapse: collapse;">
<thead>
<tr>
<th>ФИО</th>
<th>Должность</th>
<th>Перечень преподаваемых дисциплин</th>
<th>Уровень профессионального образования</th>
<th>Квалификация</th>
<th>Наименование направления подготовки и специальности</th>
<th>Ученая степень</th>
<th>Ученое звание / Категория</th>
<th>Сведения о повышении квалификации</th>
<th>Общий стаж работы</th>
<th>Стаж работы по специальности</th>
<th>Наименование образовательных программ</th>
</tr>
</thead>
<tbody>';
while ($arUser = $rsUsers->GetNext()) {
$arPreviewRows = getUserRows($arUser);
$content .= '<tr style="border-top: 1px solid #828282;">';
$name_full = getFullName($arUser['NAME'], $arUser['SECOND_NAME'], $arUser['LAST_NAME']);
$content .= '<td><a href="?id='.$arUser['ID'].'" title="полные сведения">'.$name_full.'</a></td>';
$content .= '<td>'.$arUser['WORK_POSITION'].'</td>';
$content .= '<td>'.$arUser['UF_DISCIPLINES'].'</td>';
$content .= '<td>'.$arUser['UF_EDUCATION_LEVEL'].'</td>';
$content .= '<td>'.$arUser['UF_QUALIFICATION'].'</td>';
$content .= '<td>'.$arUser['UF_TRAINING_DIRECTIO'].'</td>';
$content .= '<td>'.$arUser['UF_DEGREE'].'</td>';
$content .= '<td>'.$arUser['UF_ACADEMIC_TITLE'].'</td>';
$content .= '<td>'.$arUser['UF_ADVANCED_TRAINING'].'</td>';
$content .= '<td>'.$arUser['UF_TOTAL_WORK_EXPERI'].'</td>';
$content .= '<td>'.$arUser['UF_PROF_EXP'].'</td>';
$content .= '<td><ul>';
foreach ($arUser["UF_STUDY_PROGRAM"] as $id) {
$rsRes= CUserFieldEnum::GetList(array(), array(
"ID" => $id,
));
if($studyProgram = $rsRes->GetNext()) {
$content .= '<li>'.$studyProgram["VALUE"].'</li>';
}
}
$content .= '</ul></td>';
$content .= '</tr>';
if ($arPreviewRows) {
$content .= '<tr><td class="staff-list-item-preview" colspan="5"><table class="staff-list-item-preview-table"><tbody>';
$content .= implode($arPreviewRows);
$content .= '</tbody></table></td></tr>';
}
}
$content .= '</tbody></table>';
}
$APPLICATION->SetTitle($title);
echo '<style>'.$style.'</style>';
echo $content;
echo '<script>$( function() { '.$script.' } );</script>';
echo '</body></html>';
?>
<?//require($_SERVER['DOCUMENT_ROOT'].'/bitrix/footer.php');?>