Пример #1
0
 function detailAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $folderGuid = $this->_getParam('folderGuid') ? $this->_getParam('folderGuid') : '';
     $start = $this->_getParam('start') ? $this->_getParam('start') : 0;
     $limit = $this->_getParam('limit') ? $this->_getParam('limit') : 0;
     $rowset = App_Model_Show_Catalog::show()->fetchFromFolder($folderGuid, $start, $limit);
     $content = 0;
     $data = array();
     $array_hari = array(1 => "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu", "Minggu");
     $a['folderGuid'] = $folderGuid;
     $a['totalCount'] = count($rowset);
     $ii = 0;
     if ($a['totalCount'] != 0) {
         foreach ($rowset as $row) {
             $registry = Zend_Registry::getInstance();
             $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
             $cdn = $config->getOption('cdn');
             $sDir = $cdn['static']['url']['images'];
             $smg = $cdn['static']['images'];
             $thumb = "";
             $rowsetRelatedItem = App_Model_Show_RelatedItem::show()->getDocumentById($row['guid'], 'RELATED_IMAGE');
             $itemGuid = isset($rowsetRelatedItem['itemGuid']) ? $rowsetRelatedItem['itemGuid'] : '';
             if ($itemGuid) {
                 if (Pandamp_Lib_Formater::thumb_exists($sDir . "/" . $rowsetRelatedItem['relatedGuid'] . "/" . $itemGuid . ".jpg")) {
                     $thumb = $sDir . "/" . $rowsetRelatedItem['relatedGuid'] . "/" . $itemGuid . ".jpg";
                 }
                 if (Pandamp_Lib_Formater::thumb_exists($sDir . "/" . $rowsetRelatedItem['relatedGuid'] . "/" . $itemGuid . ".gif")) {
                     $thumb = $sDir . "/" . $rowsetRelatedItem['relatedGuid'] . "/" . $itemGuid . ".gif";
                 }
                 if (Pandamp_Lib_Formater::thumb_exists($sDir . "/" . $rowsetRelatedItem['relatedGuid'] . "/" . $itemGuid . ".png")) {
                     $thumb = $sDir . "/" . $rowsetRelatedItem['relatedGuid'] . "/" . $itemGuid . ".png";
                 }
             }
             if ($thumb == "") {
                 $thumb = $sDir . "/slider/image1.jpg";
             }
             $screenshot = "<img src=\"" . $thumb . "\"  vspace=\"0\" width=\"104\" border=\"0\" hspace=\"0\" align=\"left\" />";
             $a['index'][$ii]['title'] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedTitle');
             $a['index'][$ii]['shortTitle'] = $row['shortTitle'];
             $a['index'][$ii]['guid'] = $row['guid'];
             $a['index'][$ii]['realprice'] = $row['price'];
             $a['index'][$ii]['price'] = 'Rp ' . number_format($row['price'], 0, ',', '.');
             $a['index'][$ii]['desc'] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedDescription');
             $hari = $array_hari[date("N", strtotime($row['publishedDate']))];
             $a['index'][$ii]['publish'] = $hari . ', ' . date("d F Y", strtotime($row['publishedDate']));
             $a['index'][$ii]['images'] = '<div class="width1 column first ta-center">' . $screenshot . '</div>';
             $ii++;
         }
     }
     if ($a['totalCount'] == 0) {
         $a['index'][0]['title'] = "-";
         $a['index'][0]['shortTitle'] = "-";
         $a['index'][0]['guid'] = "-";
         $a['index'][0]['publish'] = "-";
         $a['index'][0]['desc'] = "-";
     }
     echo Zend_Json::encode($a);
 }
Пример #2
0
 /**
  * @return obj
  */
 public function show()
 {
     if (!isset(self::$_instance)) {
         $show = __CLASS__;
         self::$_instance = new $show();
     }
     return self::$_instance;
 }
Пример #3
0
 function indexAction()
 {
     $this->_helper->layout->disableLayout();
     $this->getHelper('viewRenderer')->setNoRender(true);
     $registry = Zend_Registry::getInstance();
     $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
     $cdn = $config->getOption('cdn');
     $sDir = $cdn['static']['url']['images'];
     $content = 0;
     $entries = array();
     $rowset = App_Model_Show_Catalog::show()->fetchFromFolder('lt4aaa29322bdbb', 0, 10);
     foreach ($rowset as $row) {
         $rowsetRelatedItem = App_Model_Show_RelatedItem::show()->getDocumentById($row['guid'], 'RELATED_IMAGE');
         $itemGuid = isset($rowsetRelatedItem['itemGuid']) ? $rowsetRelatedItem['itemGuid'] : '';
         $chkDir = $sDir . "/" . $row['guid'] . "/" . $itemGuid;
         if (@getimagesize($chkDir)) {
             $pict = $sDir . "/" . $row['guid'] . "/" . $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";
         }
         $entries[$content]['title'] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedTitle');
         $entries[$content]['link'] = ROOT_URL . '/berita/baca/' . $row['guid'] . '/' . $row['shortTitle'];
         $entries[$content]['guid'] = ROOT_URL . '/berita/baca/' . $row['guid'] . '/' . $row['shortTitle'];
         $entries[$content]['pubDate'] = strtotime($row['publishedDate']);
         if (!empty($thumb)) {
             $d = "<img src=\"" . $thumb . "\" align=\"left\" hspace=\"7\" width=\"100\" />" . $this->limitword(2, App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedContent'));
             $entries[$content]['description'] = $d;
             $size = getimagesize($thumb);
             $entries[$content]['enclosure'] = array(array('url' => $thumb, 'type' => $size['mime'], 'length' => '10240'));
         } else {
             $d = $this->limitword(2, App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedContent'));
             $entries[$content]['description'] = $d;
         }
         $content++;
     }
     $feed = Zend_Feed::importArray(array('title' => 'Hukumonline Warta', 'link' => ROOT_URL, 'description' => 'hukumonline.com sindikasi', 'image' => $cdn['static']['images'] . '/logo.gif', 'charset' => 'UTF-8', 'entries' => $entries), 'rss');
     $feed->send();
 }
Пример #4
0
 function pdfAction()
 {
     $this->_helper->layout->setLayout('layout-misc-printpdf');
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $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);
     $rowset = App_Model_Show_Catalog::show()->getCatalogByGuid($catalogGuid);
     $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedTitle');
     $content = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedContent');
     $description = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedDescription');
     $author = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedAuthor');
     $array_hari = array(1 => "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu", "Minggu");
     $hari = $array_hari[date("N", strtotime($rowset['createdDate']))];
     $date = $hari . ', ' . date("d F Y", strtotime($rowset['createdDate']));
     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('Nicola Asuni');
     $pdf->SetTitle('TCPDF Example 001');
     $pdf->SetSubject('TCPDF Tutorial');
     $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'];
     //        $sDir = 'uploads/images';
     $thumb = "";
     $rowsetRelatedItem = App_Model_Show_RelatedItem::show()->getDocumentById($catalogGuid, 'RELATED_IMAGE');
     $itemGuid = isset($rowsetRelatedItem['itemGuid']) ? $rowsetRelatedItem['itemGuid'] : '';
     if (Pandamp_Lib_Formater::thumb_exists($sDir . "/" . $itemGuid . ".jpg")) {
         $thumb = $sDir . "/" . $itemGuid . ".jpg";
     }
     if (Pandamp_Lib_Formater::thumb_exists($sDir . "/" . $itemGuid . ".gif")) {
         $thumb = $sDir . "/" . $itemGuid . ".gif";
     }
     if (Pandamp_Lib_Formater::thumb_exists($sDir . "/" . $itemGuid . ".png")) {
         $thumb = $sDir . "/" . $itemGuid . ".png";
     }
     if ($thumb == "") {
         $screenshot = "";
     } else {
         $screenshot = "<img src=\"" . ROOT_URL . '/' . $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 {
         $rowset = App_Model_Show_Catalog::show()->getCatalogByGuid($rowsetRelatedItem['itemGuid']);
         if (isset($rowset)) {
             $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], '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('article.pdf', 'I');
 }