redmine

updated

@@ -129,7 +129,7 @@ function considerAppointment($key, &$appointment) { @@ -129,7 +129,7 @@ function considerAppointment($key, &$appointment) {
129 if ($appointment_name_words[count($appointment_name_words)-1] == $appointment_ofsubdivfull_words[0]) { 129 if ($appointment_name_words[count($appointment_name_words)-1] == $appointment_ofsubdivfull_words[0]) {
130 unset($appointment_name_words[count($appointment_name_words)-1]); 130 unset($appointment_name_words[count($appointment_name_words)-1]);
131 } 131 }
132 - if ($appointment_ofsubdivfull_words[0] == 'ректората') { 132 + if ($appointment_ofsubdivfull_words[0] == 'ректората' || $appointment_ofsubdivfull_words[0] == 'аспирантуры') {
133 unset($appointment_ofsubdivfull_words[0]); 133 unset($appointment_ofsubdivfull_words[0]);
134 } 134 }
135 $appointments_full = join(' ', $appointment_name_words).' '.join(' ', $appointment_ofsubdivfull_words); 135 $appointments_full = join(' ', $appointment_name_words).' '.join(' ', $appointment_ofsubdivfull_words);
@@ -223,7 +223,7 @@ if (isset($_GET['signer-serialized'])) { @@ -223,7 +223,7 @@ if (isset($_GET['signer-serialized'])) {
223 if (!empty($_GET['force-login'])) { 223 if (!empty($_GET['force-login'])) {
224 $username_drupal = $_GET['force-login']; 224 $username_drupal = $_GET['force-login'];
225 $user = json_decode(file_get_contents("https://ut.mephi.ru/getldapentry.php?username=". urlencode($username_drupal) )); 225 $user = json_decode(file_get_contents("https://ut.mephi.ru/getldapentry.php?username=". urlencode($username_drupal) ));
226 - @$user->employee = json_decode(file_get_contents("https://cps.mephi.ru/?cmd=getemployeeinfo&username=".urlencode($username_drupal) )); 226 + @$user->employee = json_decode(file_get_contents("https://cps.mephi.ru/?cmd=getemployeeinfo&usevoip=true&username=".urlencode($username_drupal) ));
227 @$user->oauth = $user_oauth; 227 @$user->oauth = $user_oauth;
228 @$user->login = $login; 228 @$user->login = $login;
229 //print_r($user); 229 //print_r($user);
@@ -244,9 +244,9 @@ if (isset($_GET['signer-serialized'])) { @@ -244,9 +244,9 @@ if (isset($_GET['signer-serialized'])) {
244 } 244 }
245 } 245 }
246 246
247 - if (is_null($appointment)) { 247 + /*if (is_null($appointment)) {
248 die('Wrong appointment ID ('.$_GET['signer-appointment-id'].')'); 248 die('Wrong appointment ID ('.$_GET['signer-appointment-id'].')');
249 - } 249 + }*/
250 250
251 @$appointment->employee = $user->employee; 251 @$appointment->employee = $user->employee;
252 considerAppointment('signer', $appointment); 252 considerAppointment('signer', $appointment);
@@ -296,15 +296,20 @@ foreach (array('contact', 'user', 'recipient') as $key) { @@ -296,15 +296,20 @@ foreach (array('contact', 'user', 'recipient') as $key) {
296 296
297 $w_id = $_GET[$key.'-appointment-id']; 297 $w_id = $_GET[$key.'-appointment-id'];
298 298
299 - if ($w_id > 0) { 299 + $appointment = null;
300 - error_log($w_id.": https://cps.mephi.ru/?cmd=getworkpositioninfo&w_id=".urlencode($w_id) ); 300 +
301 - $appointment = json_decode(file_get_contents("https://cps.mephi.ru/?cmd=getworkpositioninfo&w_id=".urlencode($w_id) )); 301 + $url = "https://cps.mephi.ru/?cmd=getworkpositioninfo&usevoip=true&w_id=".urlencode($w_id);
302 - } else { 302 + error_log($w_id.": ".$url );
303 - error_log($w_id.": https://voip.mephi.ru/appointments/".urlencode($w_id).".json?renderFilter=appointment_selected" ); 303 + $appointment = json_decode(file_get_contents( $url ));
304 - $appointment_voip = json_decode(file_get_contents("https://voip.mephi.ru/appointments/".urlencode($w_id).".json?renderFilter=appointment_selected" ), 1)['appointment_selected'];  
305 304
  305 + /*if (empty($appointment)) {
  306 + $url = "https://voip.mephi.ru/appointments/".urlencode($w_id).".json?renderFilter=appointment_selected";
  307 + error_log($w_id.": ".$url );
  308 + $appointment_voip = json_decode(file_get_contents( $url ), 1)['appointment_selected'];
306 $appointment = appointment_voip2cps($appointment_voip); 309 $appointment = appointment_voip2cps($appointment_voip);
307 - } 310 + }*/
  311 +
  312 + //if ($key == "recipient") { if (!empty($_COOKIE['debug'])) { print_r($_GET);var_dump($w_id);print_r($appointment);die(); } }
308 313
309 considerAppointment($key, $appointment); 314 considerAppointment($key, $appointment);
310 } 315 }
@@ -680,7 +685,7 @@ foreach ($_GET as $key => &$value) { @@ -680,7 +685,7 @@ foreach ($_GET as $key => &$value) {
680 $_GET[substr($key, 0, strlen($key)-12)] = $value; 685 $_GET[substr($key, 0, strlen($key)-12)] = $value;
681 } 686 }
682 687
683 -foreach (array('videocheck', 'confcheck', 'webtrans', 'telebridge', 'otherconf', 'record1', 'record2', 'record3') as $key ) { 688 +foreach (array('audio', 'proektor', 'light', 'videocheck', 'confcheck', 'webtrans', 'telebridge', 'otherconf', 'record1', 'record2', 'record3') as $key ) {
684 if (isset($_GET[$key])) 689 if (isset($_GET[$key]))
685 $_GET[$key] = 'Да'; 690 $_GET[$key] = 'Да';
686 691
@@ -810,7 +815,10 @@ foreach ($files as $file) { @@ -810,7 +815,10 @@ foreach ($files as $file) {
810 $project_id = 1; 815 $project_id = 1;
811 $memo_subject = 'Заявка на сопровождение мероприятия видеосъемкой, проведение видеоконференции и веб-трансляции'; 816 $memo_subject = 'Заявка на сопровождение мероприятия видеосъемкой, проведение видеоконференции и веб-трансляции';
812 break; 817 break;
813 - // die ('working on that'); 818 + case 'request/zal':
  819 + $project_id = 16910;
  820 + $memo_subject = 'Заявка на проведение мероприятия в актовом зале';
  821 + break; // die ('working on that');
814 case 'request/iis': 822 case 'request/iis':
815 case 'request/php': 823 case 'request/php':
816 $project_id = 12871; 824 $project_id = 12871;
@@ -878,9 +886,9 @@ foreach ($files as $file) { @@ -878,9 +886,9 @@ foreach ($files as $file) {
878 break; 886 break;
879 887
880 default: 888 default:
881 - die('unknown memo-type'); 889 + die('unknown memo-type - '.$file);
882 } 890 }
883 - 891 +
884 if (!is_null($me)) { 892 if (!is_null($me)) {
885 // $membership = $redmine_admin->api('user')->show($me['id'], array('include' => array('memberships',))); 893 // $membership = $redmine_admin->api('user')->show($me['id'], array('include' => array('memberships',)));
886 $current_membership = $redmine_admin->api('membership')->all($project_id, array('limit' => '1000')); 894 $current_membership = $redmine_admin->api('membership')->all($project_id, array('limit' => '1000'));
@@ -1027,6 +1035,18 @@ foreach ($files as $file) { @@ -1027,6 +1035,18 @@ foreach ($files as $file) {
1027 $subdiv = $subdivs->result->s0; 1035 $subdiv = $subdivs->result->s0;
1028 $_GET['subdiv-name'] = $subdiv->name; 1036 $_GET['subdiv-name'] = $subdiv->name;
1029 break; 1037 break;
  1038 + case 'request/zal':
  1039 + if (empty($_GET['subdiv-code'])) {
  1040 + if (!empty($_SERVER['HTTP_REFERER'])) {
  1041 + header('Location: '.$_SERVER['HTTP_REFERER'].'?errmsg='.urlencode('Не указан код подразделения'));
  1042 + exit(0);
  1043 + } else
  1044 + die('"subdiv-code" is not set');
  1045 + }
  1046 + $subdivs = json_decode(file_get_contents('https://cps.mephi.ru/?cmd=getsubdivinfo&s_code='.urlencode($_GET['subdiv-code'])));
  1047 + $subdiv = $subdivs->result->s0;
  1048 + $_GET['subdiv-name'] = $subdiv->name;
  1049 + break;
1030 case 'request/domain-name': 1050 case 'request/domain-name':
1031 $_GET['domain-name'] = $_GET['domain-name'].'.mephi.ru'; 1051 $_GET['domain-name'] = $_GET['domain-name'].'.mephi.ru';
1032 1052
@@ -1088,8 +1108,9 @@ foreach ($files as $file) { @@ -1088,8 +1108,9 @@ foreach ($files as $file) {
1088 $category = $redmine_admin->api('issue_category')->show($_GET['category_id']); 1108 $category = $redmine_admin->api('issue_category')->show($_GET['category_id']);
1089 $_GET['category'] = $category['issue_category']['name']; 1109 $_GET['category'] = $category['issue_category']['name'];
1090 } 1110 }
1091 - 1111 +
1092 $body_template = file_get_contents('template/'.$file_eff.'.tex'); 1112 $body_template = file_get_contents('template/'.$file_eff.'.tex');
  1113 +
1093 $body = body_parse($body_template); 1114 $body = body_parse($body_template);
1094 1115
1095 switch ($file) { 1116 switch ($file) {
@@ -1116,7 +1137,10 @@ foreach ($files as $file) { @@ -1116,7 +1137,10 @@ foreach ($files as $file) {
1116 $header = '\mmfullheader{Утверждаю}{Начальник управления информатизации}{/Романов Н.Н./}'; 1137 $header = '\mmfullheader{Утверждаю}{Начальник управления информатизации}{/Романов Н.Н./}';
1117 $footer = ''; 1138 $footer = '';
1118 break; 1139 break;
1119 - 1140 + case 'request/zal';
  1141 + $header = '\mmheaderzal{Начальник управления информатизации}{/Романов Н.Н./}';
  1142 + $footer = '';
  1143 + break;
1120 case 'request/itsupport': 1144 case 'request/itsupport':
1121 $header = '\mmheader{Начальнику отдела технической поддержки}{Солодовникову А.В}'; 1145 $header = '\mmheader{Начальнику отдела технической поддержки}{Солодовникову А.В}';
1122 $footer =''; 1146 $footer ='';
@@ -1145,8 +1169,10 @@ foreach ($files as $file) { @@ -1145,8 +1169,10 @@ foreach ($files as $file) {
1145 1169
1146 1170
1147 default: 1171 default:
  1172 + $signerAppointment = trim(my_mb_ucfirst($_GET['signer-appointment']));
  1173 +
1148 $header = '\mmheader{Начальнику управления информатизации}{Н. Н. Романову}'; 1174 $header = '\mmheader{Начальнику управления информатизации}{Н. Н. Романову}';
1149 - $footer = '\mmfooter{'.my_mb_ucfirst($_GET['signer-appointment']).'}{'.$_GET{'signer-name'}.'}{'.$_GET['current-date'].'}{}'; 1175 + $footer = '\mmfooter{'.(empty($signerAppointment) ? '(не сотрудник)' : $signerAppointment).'}{'.$_GET{'signer-name'}.'}{'.$_GET['current-date'].'}{}';
1150 } 1176 }
1151 file_put_contents('header.tex', $header); 1177 file_put_contents('header.tex', $header);
1152 file_put_contents('body.tex', $body); 1178 file_put_contents('body.tex', $body);
@@ -1235,8 +1261,15 @@ foreach ($files as $file) { @@ -1235,8 +1261,15 @@ foreach ($files as $file) {
1235 'description' => $text, 1261 'description' => $text,
1236 ); 1262 );
1237 break; 1263 break;
1238 - 1264 + case 'request/zal':
1239 - 1265 + $issue_props =
  1266 + array(
  1267 + 'assigned_to_id' => USERID_VANAZAROV,
  1268 + 'project_id' => $project_id,
  1269 + 'subject' => $memo_subject,
  1270 + 'description' => $text,
  1271 + );
  1272 + break;
1240 1273
1241 case 'request/custom': 1274 case 'request/custom':
1242 $issue_props = array(); 1275 $issue_props = array();
@@ -1389,6 +1422,10 @@ foreach ($files as $file) { @@ -1389,6 +1422,10 @@ foreach ($files as $file) {
1389 case 'request/forhire': 1422 case 'request/forhire':
1390 case 'request/customform': 1423 case 'request/customform':
1391 case 'request/voip-unit-operator': 1424 case 'request/voip-unit-operator':
  1425 + break;
  1426 + case 'request/zal':
  1427 + $redmine_admin->api('issue')->addWatcher($issue_id, USERID_SVSOLOVYEV);
  1428 + $redmine_admin->api('issue')->addWatcher($issue_id, USERID_NNROMANOV);
1392 break; 1429 break;
1393 default: 1430 default:
1394 file_put_contents('responsible.tex', '\mmresponsible{'.$_GET['contact-name'].'}{'.$_GET{'contact-phonenumber'}.'}{'.$_GET['contact-email'].'}'); 1431 file_put_contents('responsible.tex', '\mmresponsible{'.$_GET['contact-name'].'}{'.$_GET{'contact-phonenumber'}.'}{'.$_GET['contact-email'].'}');
@@ -1420,7 +1457,7 @@ foreach ($files as $file) { @@ -1420,7 +1457,7 @@ foreach ($files as $file) {
1420 1457
1421 if (preg_match('/Firefox/i', $_SERVER['HTTP_USER_AGENT'])) { 1458 if (preg_match('/Firefox/i', $_SERVER['HTTP_USER_AGENT'])) {
1422 system('convert -density 400 memo.pdf memo.png'); 1459 system('convert -density 400 memo.pdf memo.png');
1423 - system('convert -density 400 memo.png memo_png.pdf'); 1460 + system('convert -density 400 memo*.png memo_png.pdf');
1424 $pdfs_path[] = getcwd().'/memo_png.pdf'; 1461 $pdfs_path[] = getcwd().'/memo_png.pdf';
1425 $pdf_content = file_get_contents('memo_png.pdf'); 1462 $pdf_content = file_get_contents('memo_png.pdf');
1426 } else 1463 } else
@@ -75,6 +75,13 @@ @@ -75,6 +75,13 @@
75 \vspace{0.6cm} 75 \vspace{0.6cm}
76 } 76 }
77 77
  78 +\newcommand{\mmstartzal} {
  79 + \begin{center}
  80 + {\bfseries{\MakeUppercase{ЗАЯВКА НА ПРОВЕДЕНИЕ МЕРОПРИЯТИЯ В АКТОВОМ ЗАЛЕ}}}
  81 + \end{center}
  82 + \vspace{0.6cm}
  83 +}
  84 +
78 % memorandum recipient (while inter-organization communication) 85 % memorandum recipient (while inter-organization communication)
79 % #1 - position 86 % #1 - position
80 % #2 - name 87 % #2 - name
@@ -126,6 +133,16 @@ @@ -126,6 +133,16 @@
126 \mmstartstatement 133 \mmstartstatement
127 } 134 }
128 135
  136 +\newcommand{\mmheaderzal}[2]{
  137 + \begin{flushright}
  138 + {#1}\\
  139 + {#2}
  140 + \end{flushright}
  141 +
  142 + \vspace{5em}
  143 + \mmstartzal
  144 +}
  145 +
129 % memorandum footer 146 % memorandum footer
130 % #1 - position 147 % #1 - position
131 % #2 - name 148 % #2 - name
  1 +Подразделение [{subdiv-code}] «[{subdiv-name}\\
  2 +Название и вид мероприятия : [{event-description}] \\
  3 +Ожидаемое кол-во участников : [{usersamount}] \\
  4 +
  5 +Дата проведения: [{days-from}], время проведения с [{event-time-before}] до [{event-time-after}] \\
  6 +
  7 +Мобильный телефон ответственного: [{phone}] \\
  8 +
  9 +Сценарий мероприятия. Оформление сцены: [{scenario}] \\
  10 +
  11 +\newpage
  12 +
  13 +\begin{tabular}{ l c p{1.5cm} r p{0.5cm} }
  14 +\hline
  15 +Требуемые технические средства: \\
  16 +\hline
  17 +
  18 +Микрофоны: [{microphones}] \\
  19 +
  20 +Мультимедиапроектор: [{proektor}] \\
  21 +
  22 +Аудиозапись: [{audio}] \\
  23 +
  24 +Освещение сцены: [{light}] \\
  25 +
  26 +Видеозапись*: [{video-type}] \\
  27 +
  28 +Видеоконференция*: [{confcheck}] & [{usersamount1}] \\
  29 +
  30 +Онлайн-трансляция на сайте НИЯУ МИФИ*: [{webtrans}] \\
  31 +
  32 +Прочие технические средства: [{othertech}] \\
  33 +\hline
  34 +* - мероприятия оформляются отдельной заявкой \\
  35 +\\
  36 +\\
  37 +Начальник структурного подразделения: \_\_\_\_\_\_\_\_\_\_\_\_ [{event-respons}] \\
  38 +Служба противопожарной профилактики \_\_\_\_\_\_\_\_\_\_\_ / \hspace{6em} / \\
  39 +\scriptsize \hspace{32em} Инструктаж по ППБ проведен \\
  40 +\normalsize
  41 +Ответственный за проведение мероприятия \_\_\_\_\_\_\_\_\_ / [{user-name}] / \\
  42 +\scriptsize \hspace{32em} Инструктаж по ППБ пройден \hspace{1em} ФИО \\
  43 +\normalsize
  44 +
  45 +Заявка включена в журнал мероприятий актового зала, время забронировано \\
  46 +И.о. начальника отдела эксплуатации мультимедийных средств \\
  47 +\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_/В. А. Назаров/ \\
  48 +
  49 +\end{tabular}
  50 +\newline
  51 +\smallskip
  52 +\newline