Ejemplo n.º 1
0
 function commentAction()
 {
     $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowset = $modelCatalog->fetchAll("profileGuid='comment'");
     foreach ($rowset as $row) {
         $modelCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute();
         try {
             $modelComment = new Pandamp_Modules_Extension_Comment_Model_Comment();
             $comment = $modelComment->fetchNew();
             $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
             $rowsetRelatedItem = $tblRelatedItem->fetchRow("itemGuid='" . $row->guid . "' AND relateAs='RELATED_COMMENT'");
             $comment->object_id = $rowsetRelatedItem->relatedGuid;
             $comment->userid = 0;
             $rowsetCatalogAttribute = $row->findDependentRowsetCatalogAttribute();
             $comment->name = $rowsetCatalogAttribute->findByAttributeGuid('fixedName')->value;
             $comment->email = $rowsetCatalogAttribute->findByAttributeGuid('fixedEmail')->value;
             $comment->title = $rowsetCatalogAttribute->findByAttributeGuid('fixedJudul')->value;
             $comment->comment = $rowsetCatalogAttribute->findByAttributeGuid('fixedComment')->value;
             $comment->ip = 0;
             $comment->date = $row->createdDate;
             $comment->published = $row->status;
             $comment->checked_out_time = $row->publishedDate;
             $comment->save();
             echo $comment->title . ' saved<br>';
         } catch (Zend_Exception $e) {
             echo $e->getMessage() . '<br>';
         }
     }
 }
Ejemplo n.º 2
0
 function beritaterkaitAction()
 {
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
     $where = "relatedGuid='{$catalogGuid}' AND relateAs='RELATED_Clinic'";
     $rowsetRelatedItem = $tblRelatedItem->fetchAll($where);
     $num_rows = count($rowsetRelatedItem);
     $this->view->numberOfRows = $num_rows;
     $this->view->rowsetRelatedItem = $rowsetRelatedItem;
 }
Ejemplo n.º 3
0
 public function delete($itemGuid, $relatedGuid, $relateAs)
 {
     if (empty($relateAs)) {
         throw new Zend_Exception('relateAs can not be empty!');
     }
     $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
     if ($tblRelatedItem->delete("itemGuid='{$itemGuid}' AND relatedGuid='{$relatedGuid}' AND relateAs='{$relateAs}'")) {
         return true;
     } else {
         return false;
     }
 }
Ejemplo n.º 4
0
 function downloadFileAction()
 {
     $catalogGuid = $this->_getParam('guid');
     $parentGuid = $this->_getParam('parent');
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowsetCatalog = $tblCatalog->find($catalogGuid);
     if (count($rowsetCatalog)) {
         $rowCatalog = $rowsetCatalog->current();
         $rowsetCatAtt = $rowCatalog->findDependentRowsetCatalogAttribute();
         $contentType = $rowsetCatAtt->findByAttributeGuid('docMimeType')->value;
         $filename = $systemname = $rowsetCatAtt->findByAttributeGuid('docSystemName')->value;
         $oriName = $rowsetCatAtt->findByAttributeGuid('docOriginalName')->value;
         $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
         $rowsetRelatedItem = $tblRelatedItem->fetchAll("itemGuid='{$catalogGuid}' AND relateAs='RELATED_FILE'");
         $flagFileFound = false;
         foreach ($rowsetRelatedItem as $rowRelatedItem) {
             if (!$flagFileFound) {
                 $parentGuid = $rowRelatedItem->relatedGuid;
                 $sDir1 = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $systemname;
                 $sDir2 = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $parentGuid . DIRECTORY_SEPARATOR . $systemname;
                 if (file_exists($sDir1)) {
                     $flagFileFound = true;
                     header("Content-type: {$contentType}");
                     header("Content-Disposition: attachment; filename={$filename}");
                     @readfile($sDir1);
                 } else {
                     if (file_exists($sDir2)) {
                         $flagFileFound = true;
                         header("Content-type: {$contentType}");
                         header("Content-Disposition: attachment; filename={$oriName}");
                         @readfile($sDir2);
                     } else {
                         $flagFileFound = false;
                     }
                 }
             }
         }
     } else {
         echo 'NO FILE';
     }
 }
Ejemplo n.º 5
0
 public function getImage($catalogGuid)
 {
     $registry = Zend_Registry::getInstance();
     $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
     $cdn = $config->getOption('cdn');
     $imageUrl = $cdn['static']['url']['images'];
     $modelRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
     $rowsetRelatedItem = $modelRelatedItem->getDocumentById($catalogGuid, 'RELATED_IMAGE');
     $itemGuid = isset($rowsetRelatedItem->itemGuid) ? $rowsetRelatedItem->itemGuid : '';
     $chkDir = $imageUrl . "/" . $catalogGuid . "/" . $itemGuid;
     if (@getimagesize($chkDir)) {
         $pict = $imageUrl . "/" . $catalogGuid . "/" . $itemGuid;
     } else {
         $pict = $imageUrl . "/" . $itemGuid;
     }
     if (Pandamp_Lib_Formater::thumb_exists($pict . ".jpg")) {
         $thumb = $pict . ".jpg";
     }
     if (Pandamp_Lib_Formater::thumb_exists($pict . ".gif")) {
         $thumb = $pict . ".gif";
     }
     if (Pandamp_Lib_Formater::thumb_exists($pict . ".png")) {
         $thumb = $pict . ".png";
     }
     if (!empty($thumb)) {
         $size = @getimagesize($thumb);
         $mt = '<link rel="image_src" type="' . $size['mime'] . '" href="' . $thumb . '" />';
         $mt .= '<meta property="og:image" content="' . $thumb . '"/>';
         return $mt;
     } else {
         $th = ROOT_URL . '/resources/images/logo_hukumonline.jpg';
         $size = @getimagesize($th);
         $mt = '<link rel="image_src" type="' . $size['mime'] . '" href="' . $th . '" />';
         $mt .= '<meta property="og:image" content="' . $th . '"/>';
         return $mt;
     }
 }
Ejemplo n.º 6
0
 public function relateTo($itemGuid, $relatedGuid, $as = 'RELATED_ITEM', $valRelation = 0)
 {
     $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
     if (empty($itemGuid)) {
         throw new Zend_Exception('Can not relate to empty GUID');
     }
     $rowsetRelatedItem = $tblRelatedItem->find($itemGuid, $relatedGuid, $as);
     if (count($rowsetRelatedItem) > 0) {
         $row = $rowsetRelatedItem->current();
         $row->valueIntRelation = $valRelation;
     } else {
         $row = $tblRelatedItem->createNew();
         $row->itemGuid = $itemGuid;
         $row->relatedGuid = $relatedGuid;
         $row->relateAs = $as;
         $row->valueIntRelation = $valRelation;
     }
     $row->save();
 }
Ejemplo n.º 7
0
 function downloadFile_OldAction()
 {
     $this->_helper->layout()->disableLayout();
     $catalogGuid = $this->_getParam('guid');
     $parentGuid = $this->_getParam('parent');
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowsetCatalog = $tblCatalog->find($catalogGuid);
     if (count($rowsetCatalog)) {
         $auth = Zend_Auth::getInstance();
         if ($auth->hasIdentity()) {
             $guidUser = $auth->getIdentity()->kopel;
         }
         $tblAsetSetting = new Pandamp_Modules_Dms_Catalog_Model_AssetSetting();
         $rowAset = $tblAsetSetting->find($catalogGuid)->current();
         if ($rowAset) {
             $rowAset->valueInt = $rowAset->valueInt + 1;
         } else {
             $rowAset = $tblAsetSetting->fetchNew();
             $rowAset->guid = $catalogGuid;
             $rowAset->application = "kutu_doc";
             $rowAset->part = isset($guidUser) ? $guidUser : '';
             $rowAset->valueType = gethostbyaddr($_SERVER['REMOTE_ADDR']);
             $rowAset->valueInt = 1;
         }
         $rowAset->save();
         $rowCatalog = $rowsetCatalog->current();
         $rowsetCatAtt = $rowCatalog->findDependentRowsetCatalogAttribute();
         $contentType = $rowsetCatAtt->findByAttributeGuid('docMimeType')->value;
         $filename = $systemname = $rowsetCatAtt->findByAttributeGuid('docSystemName')->value;
         $oriName = $oname = $rowsetCatAtt->findByAttributeGuid('docOriginalName')->value;
         $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
         $rowsetRelatedItem = $tblRelatedItem->fetchAll("itemGuid='{$catalogGuid}' AND relateAs='RELATED_FILE'");
         $flagFileFound = false;
         foreach ($rowsetRelatedItem as $rowRelatedItem) {
             if (!$flagFileFound) {
                 $parentGuid = $rowRelatedItem->relatedGuid;
                 $sDir1 = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $systemname;
                 $sDir2 = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $parentGuid . DIRECTORY_SEPARATOR . $systemname;
                 $sDir3 = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $oname;
                 $sDir4 = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $parentGuid . DIRECTORY_SEPARATOR . $oname;
                 if (file_exists($sDir1)) {
                     $flagFileFound = true;
                     header("Content-type: {$contentType}");
                     header("Content-Disposition: attachment; filename={$oriName}");
                     @readfile($sDir1);
                     die;
                 } else {
                     if (file_exists($sDir2)) {
                         $flagFileFound = true;
                         header("Content-type: {$contentType}");
                         header("Content-Disposition: attachment; filename={$oriName}");
                         @readfile($sDir2);
                         die;
                     }
                 }
                 if (file_exists($sDir3)) {
                     $flagFileFound = true;
                     header("Content-type: {$contentType}");
                     header("Content-Disposition: attachment; filename={$oriName}");
                     @readfile($sDir3);
                     die;
                 }
                 if (file_exists($sDir4)) {
                     $flagFileFound = true;
                     header("Content-type: {$contentType}");
                     header("Content-Disposition: attachment; filename={$oriName}");
                     @readfile($sDir4);
                     die;
                 } else {
                     $flagFileFound = false;
                     $this->_forward('forbidden', 'browser', 'hold');
                 }
             }
         }
     } else {
         $flagFileFound = false;
         $this->_forward('forbidden', 'browser', 'hold');
     }
 }
Ejemplo n.º 8
0
 function listcommentAction()
 {
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $page = $this->_getParam('page') ? $this->_getParam('page') : 1;
     $limit = 25;
     $start = $limit * ($page - 1);
     sleep(2);
     $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
     $rowset = $tblRelatedItem->fetchAll("relatedGuid='{$catalogGuid}' AND relateAs='RELATED_COMMENT'");
     $relatedGuid = array();
     foreach ($rowset as $related) {
         $relatedGuid[] = $related->itemGuid;
     }
     if ($relatedGuid) {
         $data = Pandamp_Lib_Formater::implode_with_keys(", ", $relatedGuid, "'");
         $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
         $rowset = $tblCatalog->fetchAll("guid in({$data}) AND status=99", '', $limit, $start);
         $rowset1 = $tblCatalog->fetchAll("guid in({$data}) AND status=99");
         $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
         $decorator = new Pandamp_BeanContext_Decorator($modelCatalog);
         $row = $decorator->getCatalogByGuidAsEntity($catalogGuid);
         $st = $row->getShortTitle();
         $num_rows = count($rowset1);
         $numPage = ceil($num_rows / $limit);
         $pagination = '';
         for ($i = 1; $i <= $numPage; $i++) {
             $pagination .= "<li><a href='/berita/baca/{$catalogGuid}/{$st}/p/{$i}' title='Halaman {$i}' rev='{$i}'>{$i}</a></li>";
         }
         // check is AJAX request or not
         if (!$this->getRequest()->isXmlHttpRequest()) {
             $this->view->pagination = $pagination;
         }
         $this->view->catalogGuid = $catalogGuid;
         $this->view->numberOfRows = $num_rows;
         $this->view->rows = $rowset;
         $this->view->limit = $limit;
     }
 }
Ejemplo n.º 9
0
 public function getsearcharticleAction()
 {
     $r = $this->getRequest();
     $query = $r->getParam('query') ? $r->getParam('query') : '';
     $start = $r->getParam('start') ? $r->getParam('start') : 0;
     $limit = $r->getParam('limit') ? $r->getParam('limit') : 20;
     $orderBy = $r->getParam('orderBy') ? $r->getParam('sortBy') : 'regulationOrder';
     $sortOrder = $r->getParam('sortOrder') ? $r->getParam('sortOrder') : ' asc';
     $a = array();
     $query = $query . ' profile:article';
     $a['query'] = $query;
     $indexingEngine = Pandamp_Search::manager();
     $hits = $indexingEngine->find($query, $start, $limit);
     $num = $hits->response->numFound;
     $solrNumFound = count($hits->response->docs);
     $ii = 0;
     if ($solrNumFound == 0) {
         $a['catalogs'][0]['guid'] = 'XXX';
         $a['catalogs'][0]['title'] = "No Data";
         $a['catalogs'][0]['subTitle'] = "";
         $a['catalogs'][0]['createdDate'] = '';
         $a['catalogs'][0]['modifiedDate'] = '';
     } else {
         if ($solrNumFound > $limit) {
             $numRowset = $limit;
         } else {
             $numRowset = $solrNumFound;
         }
         for ($ii = 0; $ii < $numRowset; $ii++) {
             $row = $hits->response->docs[$ii];
             if (!empty($row)) {
                 if ($row->profile == 'kutu_doc') {
                     $title = 'File : ' . $row->title;
                     $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
                     $rowset = $tblRelatedItem->fetchRow("itemGuid='{$row->id}'");
                     if ($rowset) {
                         $guid = $rowset->relatedGuid;
                     } else {
                         $guid = $row->id;
                     }
                 } else {
                     $title = $row->title;
                     $guid = $row->id;
                 }
                 $a['catalogs'][$ii]['title'] = $title;
                 $a['catalogs'][$ii]['guid'] = $guid;
                 if (!isset($row->shortTitle)) {
                     $a['catalogs'][$ii]['subTitle'] = '';
                 } else {
                     $a['catalogs'][$ii]['subTitle'] = $row->shortTitle;
                 }
                 if ($row->profile == 'kutu_doc') {
                     $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
                     $rowsetRelatedItem = $tblRelatedItem->fetchRow("itemGuid='{$row->id}' AND relateAs='RELATED_FILE'");
                     if ($rowsetRelatedItem) {
                         $parentGuid = $rowsetRelatedItem->relatedGuid;
                     } else {
                         $parentGuid = '';
                     }
                 } else {
                     $tblCatalogFolder = new Pandamp_Modules_Dms_Catalog_Model_CatalogFolder();
                     $rowsetCatalogFolder = $tblCatalogFolder->fetchRow("catalogGuid='{$row->id}'");
                     if ($rowsetCatalogFolder) {
                         $parentGuid = $rowsetCatalogFolder->folderGuid;
                     } else {
                         $parentGuid = '';
                     }
                 }
                 $a['catalogs'][$ii]['folderGuid'] = $parentGuid;
                 $a['catalogs'][$ii]['createdDate'] = $row->createdDate;
                 $a['catalogs'][$ii]['modifiedDate'] = $row->modifiedDate;
             }
         }
     }
     echo Zend_Json::encode($a);
 }
Ejemplo n.º 10
0
 function _getNodes($node)
 {
     $a = array();
     $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
     $tblCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute();
     $where = "relatedGuid='{$node}' AND relateAs='RELATED_HISTORY'";
     $rowsetRelatedItem = $tblRelatedItem->fetchAll($where);
     foreach ($rowsetRelatedItem as $row) {
         $aTmp2['node'] = $row->itemGuid;
         $aTmp2['nodeLeft'] = $row->itemGuid;
         $aTmp2['nodeRight'] = $node;
         $aTmp2['description'] = $row->description;
         $aTmp2['relationType'] = $row->relationType;
         $where2 = "catalogGuid='{$row->itemGuid}' AND attributeGuid='fixedTitle'";
         $rowCatalogAttribute = $tblCatalogAttribute->fetchRow($where2);
         if (isset($rowCatalogAttribute->value)) {
             $aTmp2['title'] = $rowCatalogAttribute->value;
         } else {
             $aTmp2['title'] = 'No-Title';
         }
         $where2 = "catalogGuid='{$row->itemGuid}' AND attributeGuid='fixedSubTitle'";
         $rowCatalogAttribute = $tblCatalogAttribute->fetchRow($where2);
         if (isset($rowCatalogAttribute->value)) {
             $aTmp2['subTitle'] = $rowCatalogAttribute->value;
         } else {
             $aTmp2['subTitle'] = 'No-Title';
         }
         $where2 = "catalogGuid='{$row->itemGuid}' AND attributeGuid='fixedDate'";
         $rowCatalogAttribute = $tblCatalogAttribute->fetchRow($where2);
         if (isset($rowCatalogAttribute->value)) {
             $aTmp2['fixedDate'] = $rowCatalogAttribute->value;
         } else {
             $aTmp2['fixedDate'] = '';
         }
         array_push($a, $aTmp2);
     }
     $where = "itemGuid='{$node}' AND relateAs='RELATED_HISTORY' AND relatedItemType >= 1";
     $rowsetRelatedItem = $tblRelatedItem->fetchAll($where);
     foreach ($rowsetRelatedItem as $row) {
         $aTmp2['node'] = $row->relatedGuid;
         $aTmp2['nodeLeft'] = $node;
         $aTmp2['nodeRight'] = $row->relatedGuid;
         $aTmp2['description'] = $row->description;
         $aTmp2['relationType'] = $row->relationType;
         $where2 = "catalogGuid='{$row->relatedGuid}' AND attributeGuid='fixedTitle'";
         $rowCatalogAttribute = $tblCatalogAttribute->fetchRow($where2);
         if (isset($rowCatalogAttribute->value)) {
             $aTmp2['title'] = $rowCatalogAttribute->value;
         } else {
             $aTmp2['title'] = 'No-Title';
         }
         $where2 = "catalogGuid='{$row->relatedGuid}' AND attributeGuid='fixedSubTitle'";
         $rowCatalogAttribute = $tblCatalogAttribute->fetchRow($where2);
         if (isset($rowCatalogAttribute->value)) {
             $aTmp2['subTitle'] = $rowCatalogAttribute->value;
         } else {
             $aTmp2['subTitle'] = 'No-Title';
         }
         $where2 = "catalogGuid='{$row->relatedGuid}' AND attributeGuid='fixedDate'";
         $rowCatalogAttribute = $tblCatalogAttribute->fetchRow($where2);
         if (isset($rowCatalogAttribute->value)) {
             $aTmp2['fixedDate'] = $rowCatalogAttribute->value;
         } else {
             $aTmp2['fixedDate'] = '';
         }
         array_push($a, $aTmp2);
     }
     return $a;
 }
Ejemplo n.º 11
0
 function pdfAction()
 {
     $this->_helper->layout->setLayout('layout-misc-printpdf');
     $this->_helper->layout->setLayoutPath(array('layoutPath' => ROOT_DIR . '/app/modules/misc/layouts'));
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     define('K_TCPDF_EXTERNAL_CONFIG', true);
     define("K_PATH_MAIN", ROOT_DIR . "/library/PdfTool/tcpdf/");
     define("K_PATH_URL", ROOT_URL . "/library/PdfTool/tcpdf/");
     define("K_PATH_FONTS", K_PATH_MAIN . "fonts/");
     define("K_PATH_CACHE", K_PATH_MAIN . "cache/");
     define("K_PATH_URL_CACHE", K_PATH_URL . "cache/");
     define("K_PATH_IMAGES", K_PATH_MAIN . "images/");
     define("K_BLANK_IMAGE", K_PATH_IMAGES . "_blank.png");
     define("PDF_PAGE_FORMAT", "A4");
     define("PDF_PAGE_ORIENTATION", "P");
     define("PDF_CREATOR", "HUKUMONLINE");
     define("PDF_AUTHOR", "HUKUMONLINE");
     define("PDF_HEADER_LOGO", "logo_hukumonline.jpg");
     define("PDF_HEADER_LOGO_WIDTH", 30);
     define("PDF_UNIT", "mm");
     define("PDF_MARGIN_HEADER", 5);
     define("PDF_MARGIN_FOOTER", 10);
     define("PDF_MARGIN_TOP", 27);
     define("PDF_MARGIN_BOTTOM", 25);
     define("PDF_MARGIN_LEFT", 15);
     define("PDF_MARGIN_RIGHT", 15);
     define("PDF_FONT_NAME_MAIN", "vera");
     //vera
     define('PDF_FONT_MONOSPACED', 'courier');
     define("PDF_FONT_SIZE_MAIN", 10);
     define("PDF_FONT_NAME_DATA", "vera");
     //vera
     define("PDF_FONT_SIZE_DATA", 8);
     define("PDF_IMAGE_SCALE_RATIO", 4);
     define("HEAD_MAGNIFICATION", 1.1);
     define("K_CELL_HEIGHT_RATIO", 1.25);
     define("K_TITLE_MAGNIFICATION", 1.3);
     define("K_SMALL_RATIO", 2 / 3);
     $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $modelCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute();
     $decorator = new Pandamp_BeanContext_Decorator($modelCatalog);
     $rowset = $decorator->getCatalogByGuidAsEntity($catalogGuid);
     $title = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedTitle');
     $content = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedContent');
     $description = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedDescription');
     $author = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedAuthor');
     $array_hari = array(1 => "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu", "Minggu");
     $hari = $array_hari[date("N", strtotime($rowset->getCreatedDate()))];
     $date = $hari . ', ' . date("d F Y", strtotime($rowset->getCreatedDate()));
     require_once 'PdfTool/tcpdf/tcpdf.php';
     // create new PDF document
     $pdf = new TCPDF();
     define("PDF_HEADER_TITLE", "PT. Justika Siar Publika");
     define("PDF_HEADER_STRING", "Puri Imperium Office Plaza, Jl. Kuningan Madya Kav 5-6 Kuningan Jakarta 12980,\nTelepon: (62-21) 83701827 / Faksimili: (62-21) 83701826\nE-mail: redaksi@hukumonline.com");
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor($author);
     $pdf->SetTitle($title);
     $pdf->SetSubject($description);
     //$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // set default header data
     $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     //set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     //set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     //set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     //set some language-dependent strings
     //$pdf->setLanguageArray($l);
     // ---------------------------------------------------------
     // set default font subsetting mode
     $pdf->setFontSubsetting(true);
     // Set font
     // dejavusans is a UTF-8 Unicode font, if you only need to
     // print standard ASCII chars, you can use core fonts like
     // helvetica or times to reduce file size.
     $pdf->SetFont('dejavusans', '', 14, '', true);
     // Add a page
     // This method has several options, check the source code documentation for more information.
     $pdf->AddPage();
     $registry = Zend_Registry::getInstance();
     $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
     $cdn = $config->getOption('cdn');
     $sDir = $cdn['static']['url']['images'];
     $thumb = "";
     $modelRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
     $rowsetRelatedItem = $modelRelatedItem->getDocumentById($catalogGuid, 'RELATED_IMAGE');
     $itemGuid = isset($rowsetRelatedItem->itemGuid) ? $rowsetRelatedItem->itemGuid : '';
     $chkDir = $sDir . "/" . $catalogGuid . "/" . $itemGuid;
     if (@getimagesize($chkDir)) {
         $pict = $sDir . "/" . $catalogGuid . "/" . $itemGuid;
     } else {
         $pict = $sDir . "/" . $itemGuid;
     }
     if (Pandamp_Lib_Formater::thumb_exists($pict . ".jpg")) {
         $thumb = $pict . ".jpg";
     }
     if (Pandamp_Lib_Formater::thumb_exists($pict . ".gif")) {
         $thumb = $pict . ".gif";
     }
     if (Pandamp_Lib_Formater::thumb_exists($pict . ".png")) {
         $thumb = $pict . ".png";
     }
     if ($thumb == "") {
         $screenshot = "";
     } else {
         $screenshot = "<img src=\"" . $thumb . "\" />";
     }
     // Set some content to print
     $html = '<div class="kotakisi">';
     $html .= '<h2>' . $title . '</h2>';
     $html .= '<div class="tanggalterbit">' . $date . '</div>';
     if ($description) {
         $html .= '<div class="description">' . $description . '</div>';
     }
     if ($thumb == "") {
         $screenshot = "";
     } else {
         $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
         $decorator = new Pandamp_BeanContext_Decorator($modelCatalog);
         $rowset = $decorator->getCatalogByGuidAsEntity($rowsetRelatedItem->itemGuid);
         if (isset($rowset)) {
             $modelCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute();
         }
         $title = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedTitle');
         $html .= '<div class="image">' . $screenshot . '<br><span class="fname">' . $title . '</span></div>';
     }
     $html .= '<p>' . Pandamp_Lib_Formater::_cleanMsWordHtml($content) . '</p>';
     $html .= '</div>';
     // Print text using writeHTMLCell()
     $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true);
     // ---------------------------------------------------------
     // Close and output PDF document
     // This method has several options, check the source code documentation for more information.
     $pdf->Output($title . '.pdf', 'I');
 }
Ejemplo n.º 12
0
 public function otherAction()
 {
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
     $where = "relatedGuid='{$catalogGuid}' AND relateAs='RELATED_OTHER'";
     $rowsetRelatedItem = $tblRelatedItem->fetchAll($where);
     $this->view->rowsetRelatedItem = $rowsetRelatedItem;
 }
Ejemplo n.º 13
0
 public function searchAction()
 {
     $query = $this->_getParam('query');
     $category = $this->_getParam('qbox');
     $isrelate = $this->_getParam('isrelate');
     $start = $this->_getParam('start') ? $this->_getParam('start') : 0;
     $end = $this->_getParam('limit') ? $this->_getParam('limit') : 10;
     try {
         switch ($category) {
             case 1:
                 $query = $query . ' profile:article';
                 break;
             case 2:
                 $query = $query . ' profile:klinik';
                 break;
             case 3:
                 $query = $query . ' profile:(kutu_peraturan OR kutu_peraturan_kolonial OR kutu_rancangan_peraturan OR kutu_putusan)';
                 break;
             default:
                 $query = $query;
         }
         $indexingEngine = Pandamp_Search::manager();
         $hits = $indexingEngine->find($query, $start, $end);
         $a = array();
         $a['totalCount'] = $hits->response->numFound;
         $i = 0;
         if ($hits->response->numFound > 0) {
             foreach ($hits->response->docs as $hit) {
                 $a['search'][$i]['guid'] = $hit->id;
                 if ($hit->profile == 'kutu_doc') {
                     $title = 'File : ' . $hit->title;
                 } else {
                     $title = isset($hit->title) ? $hit->title : 'No-Title';
                 }
                 $a['search'][$i]['title'] = $title;
                 if (!isset($hit->subTitle)) {
                     $subTitle = '';
                 } else {
                     $subTitle = $hit->subTitle;
                 }
                 $a['search'][$i]['subtitle'] = $subTitle;
                 if ($hit->profile == 'kutu_doc') {
                     $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
                     $rowsetRelatedItem = $tblRelatedItem->fetchRow("itemGuid='{$hit->id}' AND relateAs='RELATED_FILE'");
                     if ($rowsetRelatedItem) {
                         $parentGuid = $rowsetRelatedItem->relatedGuid;
                     } else {
                         $parentGuid = '';
                     }
                 } else {
                     $tblCatalogFolder = new Pandamp_Modules_Dms_Catalog_Model_CatalogFolder();
                     $rowsetCatalogFolder = $tblCatalogFolder->fetchRow("catalogGuid='{$hit->id}'");
                     if ($rowsetCatalogFolder) {
                         $parentGuid = $rowsetCatalogFolder->folderGuid;
                     } else {
                         $parentGuid = '';
                     }
                 }
                 $a['search'][$i]['folderGuid'] = $parentGuid;
                 if ($isrelate) {
                     $a['search'][$i]['value'] = 'Select Relation';
                 }
                 $i++;
             }
         }
         if ($hits->response->numFound == 0) {
             $a['search'][0]['guid'] = 'XXX';
             $a['search'][0]['title'] = "No Data";
             $a['search'][0]['subtitle'] = "-";
         }
     } catch (Exception $e) {
         $a['search'][0]['guid'] = 'XXX';
         $a['search'][0]['title'] = "No Data";
         $a['search'][0]['subtitle'] = $e->getMessage();
     }
     echo Zend_Json::encode($a);
 }