diff --git a/genpdf/genpdf.php b/genpdf/genpdf.php index f2c6d15..41a6eb7 100644 --- a/genpdf/genpdf.php +++ b/genpdf/genpdf.php @@ -129,7 +129,7 @@ function considerAppointment($key, &$appointment) { if ($appointment_name_words[count($appointment_name_words)-1] == $appointment_ofsubdivfull_words[0]) { unset($appointment_name_words[count($appointment_name_words)-1]); } - if ($appointment_ofsubdivfull_words[0] == 'ректората') { + if ($appointment_ofsubdivfull_words[0] == 'ректората' || $appointment_ofsubdivfull_words[0] == 'аспирантуры') { unset($appointment_ofsubdivfull_words[0]); } $appointments_full = join(' ', $appointment_name_words).' '.join(' ', $appointment_ofsubdivfull_words); @@ -223,7 +223,7 @@ if (isset($_GET['signer-serialized'])) { if (!empty($_GET['force-login'])) { $username_drupal = $_GET['force-login']; $user = json_decode(file_get_contents("https://ut.mephi.ru/getldapentry.php?username=". urlencode($username_drupal) )); - @$user->employee = json_decode(file_get_contents("https://cps.mephi.ru/?cmd=getemployeeinfo&username=".urlencode($username_drupal) )); + @$user->employee = json_decode(file_get_contents("https://cps.mephi.ru/?cmd=getemployeeinfo&usevoip=true&username=".urlencode($username_drupal) )); @$user->oauth = $user_oauth; @$user->login = $login; //print_r($user); @@ -244,9 +244,9 @@ if (isset($_GET['signer-serialized'])) { } } - if (is_null($appointment)) { + /*if (is_null($appointment)) { die('Wrong appointment ID ('.$_GET['signer-appointment-id'].')'); - } + }*/ @$appointment->employee = $user->employee; considerAppointment('signer', $appointment); @@ -296,15 +296,20 @@ foreach (array('contact', 'user', 'recipient') as $key) { $w_id = $_GET[$key.'-appointment-id']; - if ($w_id > 0) { - error_log($w_id.": https://cps.mephi.ru/?cmd=getworkpositioninfo&w_id=".urlencode($w_id) ); - $appointment = json_decode(file_get_contents("https://cps.mephi.ru/?cmd=getworkpositioninfo&w_id=".urlencode($w_id) )); - } else { - error_log($w_id.": https://voip.mephi.ru/appointments/".urlencode($w_id).".json?renderFilter=appointment_selected" ); - $appointment_voip = json_decode(file_get_contents("https://voip.mephi.ru/appointments/".urlencode($w_id).".json?renderFilter=appointment_selected" ), 1)['appointment_selected']; + $appointment = null; + + $url = "https://cps.mephi.ru/?cmd=getworkpositioninfo&usevoip=true&w_id=".urlencode($w_id); + error_log($w_id.": ".$url ); + $appointment = json_decode(file_get_contents( $url )); + /*if (empty($appointment)) { + $url = "https://voip.mephi.ru/appointments/".urlencode($w_id).".json?renderFilter=appointment_selected"; + error_log($w_id.": ".$url ); + $appointment_voip = json_decode(file_get_contents( $url ), 1)['appointment_selected']; $appointment = appointment_voip2cps($appointment_voip); - } + }*/ + + //if ($key == "recipient") { if (!empty($_COOKIE['debug'])) { print_r($_GET);var_dump($w_id);print_r($appointment);die(); } } considerAppointment($key, $appointment); } @@ -680,7 +685,7 @@ foreach ($_GET as $key => &$value) { $_GET[substr($key, 0, strlen($key)-12)] = $value; } -foreach (array('videocheck', 'confcheck', 'webtrans', 'telebridge', 'otherconf', 'record1', 'record2', 'record3') as $key ) { +foreach (array('audio', 'proektor', 'light', 'videocheck', 'confcheck', 'webtrans', 'telebridge', 'otherconf', 'record1', 'record2', 'record3') as $key ) { if (isset($_GET[$key])) $_GET[$key] = 'Да'; @@ -810,7 +815,10 @@ foreach ($files as $file) { $project_id = 1; $memo_subject = 'Заявка на сопровождение мероприятия видеосъемкой, проведение видеоконференции и веб-трансляции'; break; - // die ('working on that'); + case 'request/zal': + $project_id = 16910; + $memo_subject = 'Заявка на проведение мероприятия в актовом зале'; + break; // die ('working on that'); case 'request/iis': case 'request/php': $project_id = 12871; @@ -878,9 +886,9 @@ foreach ($files as $file) { break; default: - die('unknown memo-type'); + die('unknown memo-type - '.$file); } - + if (!is_null($me)) { // $membership = $redmine_admin->api('user')->show($me['id'], array('include' => array('memberships',))); $current_membership = $redmine_admin->api('membership')->all($project_id, array('limit' => '1000')); @@ -1027,6 +1035,18 @@ foreach ($files as $file) { $subdiv = $subdivs->result->s0; $_GET['subdiv-name'] = $subdiv->name; break; + case 'request/zal': + if (empty($_GET['subdiv-code'])) { + if (!empty($_SERVER['HTTP_REFERER'])) { + header('Location: '.$_SERVER['HTTP_REFERER'].'?errmsg='.urlencode('Не указан код подразделения')); + exit(0); + } else + die('"subdiv-code" is not set'); + } + $subdivs = json_decode(file_get_contents('https://cps.mephi.ru/?cmd=getsubdivinfo&s_code='.urlencode($_GET['subdiv-code']))); + $subdiv = $subdivs->result->s0; + $_GET['subdiv-name'] = $subdiv->name; + break; case 'request/domain-name': $_GET['domain-name'] = $_GET['domain-name'].'.mephi.ru'; @@ -1088,8 +1108,9 @@ foreach ($files as $file) { $category = $redmine_admin->api('issue_category')->show($_GET['category_id']); $_GET['category'] = $category['issue_category']['name']; } - + $body_template = file_get_contents('template/'.$file_eff.'.tex'); + $body = body_parse($body_template); switch ($file) { @@ -1116,7 +1137,10 @@ foreach ($files as $file) { $header = '\mmfullheader{Утверждаю}{Начальник управления информатизации}{/Романов Н.Н./}'; $footer = ''; break; - + case 'request/zal'; + $header = '\mmheaderzal{Начальник управления информатизации}{/Романов Н.Н./}'; + $footer = ''; + break; case 'request/itsupport': $header = '\mmheader{Начальнику отдела технической поддержки}{Солодовникову А.В}'; $footer =''; @@ -1145,8 +1169,10 @@ foreach ($files as $file) { default: + $signerAppointment = trim(my_mb_ucfirst($_GET['signer-appointment'])); + $header = '\mmheader{Начальнику управления информатизации}{Н. Н. Романову}'; - $footer = '\mmfooter{'.my_mb_ucfirst($_GET['signer-appointment']).'}{'.$_GET{'signer-name'}.'}{'.$_GET['current-date'].'}{}'; + $footer = '\mmfooter{'.(empty($signerAppointment) ? '(не сотрудник)' : $signerAppointment).'}{'.$_GET{'signer-name'}.'}{'.$_GET['current-date'].'}{}'; } file_put_contents('header.tex', $header); file_put_contents('body.tex', $body); @@ -1235,8 +1261,15 @@ foreach ($files as $file) { 'description' => $text, ); break; - - + case 'request/zal': + $issue_props = + array( + 'assigned_to_id' => USERID_VANAZAROV, + 'project_id' => $project_id, + 'subject' => $memo_subject, + 'description' => $text, + ); + break; case 'request/custom': $issue_props = array(); @@ -1389,6 +1422,10 @@ foreach ($files as $file) { case 'request/forhire': case 'request/customform': case 'request/voip-unit-operator': + break; + case 'request/zal': + $redmine_admin->api('issue')->addWatcher($issue_id, USERID_SVSOLOVYEV); + $redmine_admin->api('issue')->addWatcher($issue_id, USERID_NNROMANOV); break; default: file_put_contents('responsible.tex', '\mmresponsible{'.$_GET['contact-name'].'}{'.$_GET{'contact-phonenumber'}.'}{'.$_GET['contact-email'].'}'); @@ -1420,7 +1457,7 @@ foreach ($files as $file) { if (preg_match('/Firefox/i', $_SERVER['HTTP_USER_AGENT'])) { system('convert -density 400 memo.pdf memo.png'); - system('convert -density 400 memo.png memo_png.pdf'); + system('convert -density 400 memo*.png memo_png.pdf'); $pdfs_path[] = getcwd().'/memo_png.pdf'; $pdf_content = file_get_contents('memo_png.pdf'); } else diff --git a/mephimemo/mephimemo.cls b/mephimemo/mephimemo.cls index 117158a..0953962 100644 --- a/mephimemo/mephimemo.cls +++ b/mephimemo/mephimemo.cls @@ -75,6 +75,13 @@ \vspace{0.6cm} } +\newcommand{\mmstartzal} { + \begin{center} + {\bfseries{\MakeUppercase{ЗАЯВКА НА ПРОВЕДЕНИЕ МЕРОПРИЯТИЯ В АКТОВОМ ЗАЛЕ}}} + \end{center} + \vspace{0.6cm} +} + % memorandum recipient (while inter-organization communication) % #1 - position % #2 - name @@ -126,6 +133,16 @@ \mmstartstatement } +\newcommand{\mmheaderzal}[2]{ + \begin{flushright} + {#1}\\ + {#2} + \end{flushright} + + \vspace{5em} + \mmstartzal +} + % memorandum footer % #1 - position % #2 - name diff --git a/mephimemo/template/request/zal.tex b/mephimemo/template/request/zal.tex new file mode 100644 index 0000000..9b78754 --- /dev/null +++ b/mephimemo/template/request/zal.tex @@ -0,0 +1,52 @@ +Подразделение [{subdiv-code}] «[{subdiv-name}]»\\ +Название и вид мероприятия : [{event-description}] \\ +Ожидаемое кол-во участников : [{usersamount}] \\ + +Дата проведения: [{days-from}], время проведения с [{event-time-before}] до [{event-time-after}] \\ + +Мобильный телефон ответственного: [{phone}] \\ + +Сценарий мероприятия. Оформление сцены: [{scenario}] \\ + +\newpage + +\begin{tabular}{ l c p{1.5cm} r p{0.5cm} } +\hline +Требуемые технические средства: \\ +\hline + +Микрофоны: [{microphones}] \\ + +Мультимедиапроектор: [{proektor}] \\ + +Аудиозапись: [{audio}] \\ + +Освещение сцены: [{light}] \\ + +Видеозапись*: [{video-type}] \\ + +Видеоконференция*: [{confcheck}] & [{usersamount1}] \\ + +Онлайн-трансляция на сайте НИЯУ МИФИ*: [{webtrans}] \\ + +Прочие технические средства: [{othertech}] \\ +\hline +* - мероприятия оформляются отдельной заявкой \\ +\\ +\\ +Начальник структурного подразделения: \_\_\_\_\_\_\_\_\_\_\_\_ [{event-respons}] \\ +Служба противопожарной профилактики \_\_\_\_\_\_\_\_\_\_\_ / \hspace{6em} / \\ +\scriptsize \hspace{32em} Инструктаж по ППБ проведен \\ +\normalsize +Ответственный за проведение мероприятия \_\_\_\_\_\_\_\_\_ / [{user-name}] / \\ +\scriptsize \hspace{32em} Инструктаж по ППБ пройден \hspace{1em} ФИО \\ +\normalsize + +Заявка включена в журнал мероприятий актового зала, время забронировано \\ +И.о. начальника отдела эксплуатации мультимедийных средств \\ +\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_/В. А. Назаров/ \\ + +\end{tabular} +\newline +\smallskip +\newline \ No newline at end of file