Ejemplo n.º 1
0
 public function getResult($model, $onlyFile = false)
 {
     $_images = array();
     $date3 = $this->application_data ? strtotime($this->application_data) : time();
     if ($this->form_type == 'prosecutor') {
         $date3 = strtotime($this->application_data);
     }
     $date2 = ($this->form_type == 'prosecutor' || $this->form_type == 'prosecutor2') && $model->request_gibdd ? $model->request_gibdd->date_sent : time();
     $_data = array('chief' => $this->to, 'fio' => $this->from, 'address' => $this->postaddress, 'date1.day' => date('d', $model->DATE_CREATED ? $model->DATE_CREATED : time()), 'date1.month' => date('m', $model->DATE_CREATED ? $model->DATE_CREATED : time()), 'date1.year' => date('Y', $model->DATE_CREATED ? $model->DATE_CREATED : time()), 'street' => $this->address, 'date2.day' => date('d', $date2), 'date2.month' => date('m', $date2), 'date2.year' => date('Y', $date2), 'signature' => $this->signature, 'reason' => $this->comment, 'date3.day' => date('d', $date3), 'date3.month' => date('m', $date3), 'date3.year' => date('Y', $date3), 'gibdd' => $this->gibdd, 'gibdd_reply' => $this->gibdd_reply);
     if ($this->html) {
         foreach ($model->pictures_fresh as $picture) {
             $_images[] = $picture->original;
         }
         header('Content-Type: text/html; charset=utf8', true);
         $HT = new html1234();
         if (!$this->holes) {
             $HT->models = array($model);
             $HT->requestForm = $this;
             $HT->gethtml($this->form_type ? $this->form_type : $model->type, $_data, $_images);
         } else {
             $HT->models = Holes::model()->findAllByPk($this->holes);
             $HT->requestForm = $this;
             $HT->gethtml('gibdd', $_data, array(), $this->printAllPictures);
         }
     } else {
         foreach ($model->pictures_fresh as $picture) {
             $_images[] = $_SERVER['DOCUMENT_ROOT'] . $picture->original;
         }
         $PDF = new pdf1234();
         if (!$this->holes) {
             $PDF->models = array($model);
             $PDF->requestForm = $this;
             $pdfresult = $PDF->getpdf($this->form_type ? $this->form_type : $model->type, $_data, $_images);
         } else {
             $PDF->models = Holes::model()->findAllByPk($this->holes);
             $PDF->requestForm = $this;
             $pdfresult = $PDF->getpdf('gibdd', $_data, array(), $this->printAllPictures);
         }
         if ($this->sendToGibddru && !$onlyFile) {
             $gibdd = isset($PDF->models[0]) && $PDF->models[0]->subject ? $PDF->models[0]->subject->region_num : 0;
             $this->holes = array($model);
             return $this->RequestGibddru($pdfresult, $gibdd);
         } elseif ($this->sendToGibddru && $onlyFile) {
             return $this->savePdfFile($pdfresult);
         }
     }
 }
Ejemplo n.º 2
0
 public function actionRequest($id = null)
 {
     if ($id) {
         $model = $this->loadModel($id);
     } else {
         $model = new Holes();
     }
     $request = new HoleRequestForm();
     if (isset($_POST['HoleRequestForm'])) {
         $request->attributes = $_POST['HoleRequestForm'];
         $_images = array();
         $date3 = $request->application_data ? strtotime($request->application_data) : time();
         if ($request->form_type == 'prosecutor') {
             $date3 = strtotime($request->application_data);
         }
         $date2 = $request->form_type == 'prosecutor' && $model->request_gibdd ? $model->request_gibdd->date_sent : time();
         $_data = array('chief' => $request->to, 'fio' => $request->from, 'address' => $request->postaddress, 'date1.day' => date('d', $model->DATE_CREATED ? $model->DATE_CREATED : time()), 'date1.month' => date('m', $model->DATE_CREATED ? $model->DATE_CREATED : time()), 'date1.year' => date('Y', $model->DATE_CREATED ? $model->DATE_CREATED : time()), 'street' => $request->address, 'date2.day' => date('d', $date2), 'date2.month' => date('m', $date2), 'date2.year' => date('Y', $date2), 'signature' => $request->signature, 'reason' => $request->comment, 'date3.day' => date('d', $date3), 'date3.month' => date('m', $date3), 'date3.year' => date('Y', $date3), 'gibdd' => $request->gibdd, 'gibdd_reply' => $request->gibdd_reply);
         if ($request->html) {
             foreach ($model->pictures_fresh as $picture) {
                 $_images[] = $picture->original;
             }
             header('Content-Type: text/html; charset=utf8', true);
             $HT = new html1234();
             if (!$request->holes) {
                 $HT->gethtml($request->form_type ? $request->form_type : $model->type, $_data, $_images);
             } else {
                 $HT->models = Holes::model()->findAllByPk($request->holes);
                 $HT->gethtml('gibdd', $_data, array(), $request->printAllPictures);
             }
         } else {
             header_remove('Content-Type');
             foreach ($model->pictures_fresh as $picture) {
                 $_images[] = $_SERVER['DOCUMENT_ROOT'] . $picture->original;
             }
             header('Content-Type: application/pdf; charset=utf-8', true);
             $PDF = new pdf1234();
             if (!$request->holes) {
                 $PDF->getpdf($request->form_type ? $request->form_type : $model->type, $_data, $_images);
             } else {
                 $PDF->models = Holes::model()->findAllByPk($request->holes);
                 $PDF->getpdf('gibdd', $_data, array(), $request->printAllPictures);
             }
         }
     }
 }
Ejemplo n.º 3
0
 public function makepdf($attribs, $model)
 {
     $request = new HoleRequestForm();
     if ($attribs) {
         $request->attributes = $attribs;
         $_images = array();
         $date3 = $request->application_data ? strtotime($request->application_data) : time();
         if ($request->form_type == 'prosecutor') {
             $date3 = strtotime($request->application_data);
         }
         $date2 = $request->form_type == 'prosecutor' && $model->request_gibdd ? $model->request_gibdd->date_sent : time();
         $_data = array('chief' => $request->to, 'fio' => $request->from, 'address' => $request->postaddress, 'date1.day' => date('d', $model->DATE_CREATED), 'date1.month' => date('m', $model->DATE_CREATED), 'date1.year' => date('Y', $model->DATE_CREATED), 'street' => $request->address, 'date2.day' => date('d', $date2), 'date2.month' => date('m', $date2), 'date2.year' => date('Y', $date2), 'signature' => $request->signature, 'reason' => $request->comment, 'date3.day' => date('d', $date3), 'date3.month' => date('m', $date3), 'date3.year' => date('Y', $date3), 'gibdd' => $request->gibdd, 'gibdd_reply' => $request->gibdd_reply);
         if ($request->html) {
             foreach ($model->pictures_fresh as $picture) {
                 $_images[] = $picture->original;
             }
             header('Content-Type: text/html; charset=utf8', true);
             $HT = new html1234();
             $HT->gethtml($request->form_type ? $request->form_type : $model->type, $_data, $_images);
         } else {
             header_remove('Content-Type');
             foreach ($model->pictures_fresh as $picture) {
                 $_images[] = $_SERVER['DOCUMENT_ROOT'] . $picture->original;
             }
             header('Content-Type: application/pdf; charset=utf-8', true);
             $PDF = new pdf1234();
             $PDF->getpdf($request->form_type ? $request->form_type : $model->type, $_data, $_images);
         }
     }
 }
Ejemplo n.º 4
0
    $res = CIBlockElement::GetList(array(), array('IBLOCK_CODE' => 'PROSECUTORS', 'PROPERTY_SUBJECT_ID' => $arResult['HOLE']['ADR_SUBJECTRF']));
    $arResult['PROSECUTOR_DATA'] = $res->Fetch();
}
if (isset($_GET['pdf'])) {
    ob_end_clean();
    ob_end_clean();
    ob_end_clean();
    ob_end_clean();
    $_images = array();
    $date3 = isset($_POST['application_data']) ? strtotime($_POST['application_data']) : time();
    $date2 = $_POST['form_type'] == 'prosecutor' ? $arResult['HOLE']['DATE_SENT'] : time();
    $_data = array('chief' => iconv('utf-8', 'windows-1251', $_POST['to']), 'fio' => iconv('utf-8', 'windows-1251', $_POST['from']), 'address' => iconv('utf-8', 'windows-1251', $_POST['postaddress']), 'date1.day' => date('d', $arResult['HOLE']['DATE_CREATED']), 'date1.month' => date('m', $arResult['HOLE']['DATE_CREATED']), 'date1.year' => date('Y', $arResult['HOLE']['DATE_CREATED']), 'street' => iconv('utf-8', 'windows-1251', $_POST['address']), 'date2.day' => date('d', $date2), 'date2.month' => date('m', $date2), 'date2.year' => date('Y', $date2), 'signature' => iconv('utf-8', 'windows-1251', $_POST['signature']), 'reason' => iconv('utf-8', 'windows-1251', $_POST['comment']), 'date3.day' => date('d', $date3), 'date3.month' => date('m', $date3), 'date3.year' => date('Y', $date3), 'gibdd' => iconv('utf-8', 'windows-1251', $_POST['gibdd']), 'gibdd_reply' => iconv('utf-8', 'windows-1251', $_POST['gibdd_reply']));
    header_remove('Content-Type');
    if (isset($_REQUEST['html'])) {
        foreach ($arResult['HOLE']['pictures']['original']['fresh'] as $src) {
            $_images[] = $src;
        }
        header('Content-Type: text/html; charset=utf8', true);
        $HT = new html1234();
        $HT->gethtml($_POST['form_type'] ? $_POST['form_type'] : $arResult['HOLE']['TYPE'], $_data, $_images);
    } else {
        foreach ($arResult['HOLE']['pictures']['original']['fresh'] as $src) {
            $_images[] = $_SERVER['DOCUMENT_ROOT'] . $src;
        }
        header('Content-Type: application/pdf; charset=cp1251', true);
        $PDF = new pdf1234();
        $PDF->getpdf($_POST['form_type'] ? $_POST['form_type'] : $arResult['HOLE']['TYPE'], $_data, $_images);
    }
    die;
}
$this->IncludeComponentTemplate();