Example #1
0
 function cartAction()
 {
     if (!is_object($_SESSION['jCart'])) {
         $this->_redirect(ROOT_URL . '/checkout/cartempty');
     }
     if (count($_SESSION['jCart']->items) == 0) {
         $this->_redirect(ROOT_URL . '/checkout/cartempty');
     }
     $cart =& $_SESSION['jCart'];
     if (!is_object($cart)) {
         $cart = new jCart();
     }
     $this->view->cart = $cart;
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $rowset = $tblCatalog->fetchRow("guid='lt4d197e9f8919f'", 'createdDate DESC');
     $content = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedContent');
     $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedTitle');
     $subTitle = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedSubTitle');
     $this->view->content = $content;
     $this->view->title = $title;
     $this->view->subTitle = $subTitle;
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $rowset = $tblCatalog->fetchRow("guid='lt4d196f17c9836'", 'createdDate DESC');
     $content = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedContent');
     $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedTitle');
     $subTitle = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedSubTitle');
     $this->view->cp = $content;
     $this->view->tp = $title;
     $this->view->sp = $subTitle;
     if ($this->_isStoreClosed()) {
         $this->_redirect(ROOT_URL . '/checkout/closed');
     }
 }
Example #2
0
 function newAction()
 {
     $r = $this->getRequest();
     $relatedGuid = $r->getParam('relatedGuid');
     $this->view->relatedGuid = $relatedGuid;
     if (empty($relatedGuid)) {
         throw new Zend_Exception("relatedGuid can not be empty!");
     }
     $message = '';
     $urlReferer = $_SERVER['HTTP_REFERER'];
     $node = $r->getParam('node') ? $r->getParam('node') : 'root';
     $this->view->currentNode = $node;
     $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($relatedGuid, 'fixedTitle');
     $this->view->catalogTitle = $title;
     $subTitle = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($relatedGuid, 'fixedSubTitle');
     $this->view->catalogSubTitle = $subTitle;
     $modDir = $this->getFrontController()->getModuleDirectory();
     require_once $modDir . '/components/Menu/FolderBreadcrumbs.php';
     $w = new Dms_Menu_FolderBreadcrumbs($node);
     $this->view->widget2 = $w;
     if ($r->isPost()) {
         $sessHistory = new Zend_Session_Namespace('BROWSER_HISTORY');
         $urlReferer = $sessHistory->urlReferer;
         $this->_save();
         $message = "File was successfully uploaded.";
     }
     $this->view->message = $message;
     $sessHistory = new Zend_Session_Namespace('BROWSER_HISTORY');
     $sessHistory->urlReferer = $urlReferer;
     $this->view->urlReferer = $sessHistory->urlReferer;
     $this->_helper->layout()->headerTitle = "Document Upload Management: Upload New File";
 }
Example #3
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);
 }
Example #4
0
 /**
  * getMailContent
  */
 function getMailContent($title)
 {
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $where = $tblCatalog->getAdapter()->quoteInto("shortTitle=?", $title);
     $rowset = $tblCatalog->fetchRow($where);
     $content = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedContent');
     return $content;
 }
Example #5
0
 public function getFotoAttributeName($catalogGuid)
 {
     $rowset = App_Model_Show_Catalog::show()->getCatalogByGuid($catalogGuid);
     if (isset($rowset)) {
         $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedTitle');
     }
     return $title;
 }
Example #6
0
 /**
  * @return obj
  */
 public function show()
 {
     if (!isset(self::$_instance)) {
         $show = __CLASS__;
         self::$_instance = new $show();
     }
     return self::$_instance;
 }
Example #7
0
 public function getCatalogTitle($catalogGuid, $attributeValue)
 {
     $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($catalogGuid, $attributeValue);
     if (isset($title) && !empty($title)) {
         return $title;
     } else {
         return 'No-Title';
     }
 }
Example #8
0
 function pokrolAction()
 {
     $ct = $this->_getParam('ko') ? $this->_getParam('ko') : '';
     $rowset = App_Model_Show_Catalog::show()->getCatalogByGuid("lt4b457ff0c3e1b");
     $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedTitle');
     $content = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedContent');
     $this->view->title = $title;
     $this->view->content = $content;
     $this->view->catalogGuid = "lt4b457ff0c3e1b";
     $this->view->ct = $ct;
 }
Example #9
0
 /**
  * Add link to sitemap
  */
 public function addAction()
 {
     $this->_helper->getHelper('layout')->disableLayout();
     $this->_helper->getHelper('viewRenderer')->setNoRender();
     $config = Pandamp_Config::getConfig();
     $file = ROOT_DIR . DS . 'sitemap_news.xml';
     $output = '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">' . PHP_EOL;
     //$folderGuid = array('fb16','lt4a0a533e31979','fb29');
     $profileGuid = array('article', 'klinik', 'kutu_peraturan');
     $rowset = App_Model_Show_Catalog::show()->fetchNewsCatalog($profileGuid, 0, 50);
     foreach ($rowset as $row) {
         if ($row['profileGuid'] == 'klinik') {
             $clinicTitle = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedCommentTitle');
             $url = $config->web->url->base . DS . 'klinik' . DS . 'detail' . DS . $row['guid'] . DS . App_Model_Show_CatalogAttribute::show()->getFormatedURLForKlinikTitle($clinicTitle);
         } else {
             if ($row['profileGuid'] == 'kutu_peraturan') {
                 $peraturanTitle = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedTitle');
                 $peraturanSubTitle = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedSubTitle');
                 $url = $config->web->url->base . DS . 'pusatdata' . DS . 'detail' . DS . $row['guid'] . DS . 'node' . DS . $row['folderGuid'] . DS . App_Model_Show_CatalogAttribute::show()->getFormatedURLForDetalPeraturan($peraturanTitle, $peraturanSubTitle);
             } else {
                 $url = $config->web->url->base . DS . 'berita' . DS . 'baca' . DS . $row['guid'] . DS . $row['shortTitle'];
             }
         }
         $loc = $url;
         $pubDate = date('D, d M Y h:i:s O', strtotime($row['publishedDate']));
         $keywords = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedKeywords');
         //$item = new Pandamp_Seo_Sitemap_Item($loc, $pubDate);
         //Pandamp_Seo_Sitemap::addToSitemap($file, $item);
         $output .= "\t<url>" . "\n";
         $output .= "\t\t<loc>" . "\n";
         $output .= "\t\t\t{$loc}" . "\n";
         $output .= "\t\t</loc>" . "\n";
         $output .= "\t\t<news:news>" . "\n";
         $output .= "\t\t\t<news:publication_date>" . "\n";
         $output .= "\t\t\t\t{$pubDate}" . "\n";
         $output .= "\t\t\t</news:publication_date>" . "\n";
         if ($keywords) {
             $output .= "\t\t\t<news:keywords>" . "\n";
             $output .= "\t\t\t\t{$keywords}" . "\n";
             $output .= "\t\t\t</news:keywords>" . "\n";
         }
         $output .= "\t\t</news:news>" . "\n";
         $output .= "\t</url>" . "\n";
     }
     $output .= '</urlset>';
     /**
      * Write to file
      */
     $f = fopen($file, 'w');
     fwrite($f, $output);
     fclose($f);
     return true;
 }
Example #10
0
 public function getCatalogAttribute($catalogGuid, $value)
 {
     $rowset = App_Model_Show_Catalog::show()->getCatalogByGuid($catalogGuid);
     if ($rowset) {
         $attr = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], $value);
         if (isset($attr) && !empty($attr)) {
             return $attr;
         } else {
             return 'No-Title';
         }
     }
 }
Example #11
0
 public function getClinicCategory($catalogGuid)
 {
     $rowset = App_Model_Show_Catalog::show()->getCatalogByGuid($catalogGuid);
     if ($rowset) {
         $category = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedKategoriKlinik');
         /* Get Category from profile clinic_category */
         $findCategory = App_Model_Show_Catalog::show()->getCatalogByGuid($category);
         if (isset($findCategory)) {
             $category = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($findCategory['guid'], 'fixedTitle');
         }
         return $category;
     }
 }
Example #12
0
 function fgalAction()
 {
     //$rowset = App_Model_Show_Catalog::show()->fetchFromFolder('lt4d5ca623676b2',0,5);
     $rowset = App_Model_Show_Catalog::show()->fetchFromFolder('lt4d92a915a8760', 0, 5);
     $content = 0;
     $data = array();
     foreach ($rowset as $row) {
         $data[$content][0] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedTitle');
         $data[$content][1] = $row['guid'];
         $content++;
     }
     $num_rows = count($rowset);
     $this->view->numberOfRows = $num_rows;
     $this->view->data = $data;
 }
Example #13
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();
 }
Example #14
0
 function terbaruAction()
 {
     $rowset = App_Model_Show_Catalog::show()->fetchFromFolder('fb16', 0, 5);
     $content = 0;
     $data = array();
     foreach ($rowset as $row) {
         $data[$content][0] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedTitle');
         $data[$content][1] = $row['shortTitle'];
         $data[$content][2] = date("d/m/y", strtotime($row['createdDate']));
         $data[$content][3] = $row['guid'];
         $data[$content][4] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedDescription');
         $content++;
     }
     $num_rows = count($rowset);
     $this->view->numberOfRows = $num_rows;
     $this->view->data = $data;
 }
Example #15
0
 function headerAction()
 {
     $r = $this->getRequest();
     $node = $r->getParam('node') ? $r->getParam('node') : 'root';
     $menuFolder = App_Model_Show_Folder::show()->getMenu($node);
     $this->view->menuFolder = $menuFolder;
     $rowset = App_Model_Show_Catalog::show()->getCatalogByProfile("kategoriklinik");
     $content = 0;
     $data = array();
     foreach ($rowset as $row) {
         $data[$content][0] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedTitle');
         $data[$content][1] = $row['guid'];
         $content++;
     }
     $num_rows = count($rowset);
     $this->view->numberOfRows = $num_rows;
     $this->view->data = $data;
 }
Example #16
0
 function utamaAction()
 {
     $rowset = App_Model_Show_Catalog::show()->fetchFromFolder('lt4aaa29322bdbb', 0, 4);
     $content = 0;
     $data = array();
     foreach ($rowset as $row) {
         $rowSumComment = App_Model_Show_Comment::show()->getParentCommentCount($row['guid']);
         $data[$content][0] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedTitle');
         $data[$content][1] = strftime("%H:%M", strtotime($row['createdDate']));
         $data[$content][2] = $row['guid'];
         $data[$content][3] = $row['shortTitle'];
         $data[$content][4] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedAuthor');
         $data[$content][5] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedDescription');
         $data[$content][6] = $rowSumComment;
         $content++;
     }
     $num_rows = count($rowset);
     $this->view->numberOfRows = $num_rows;
     $this->view->data = $data;
 }
Example #17
0
 function foseAction()
 {
     $r = $this->getRequest();
     $notGuid = $r->getParam('guid') ? $r->getParam('guid') : '';
     $array_hari = array(1 => "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu", "Minggu");
     $rowset = App_Model_Show_Catalog::show()->fetchFromFolderException('lt4de5c32a53bd4', $notGuid, 0, 7);
     $content = 0;
     $data = array();
     foreach ($rowset as $row) {
         $data[$content][0] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedTitle');
         $data[$content][1] = $row['guid'];
         $data[$content][2] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedContent');
         $hari = $array_hari[date("N", strtotime($row['publishedDate']))];
         $data[$content][3] = $hari . ' ' . date("d/m/y H:i", strtotime($row['publishedDate']));
         $content++;
     }
     $num_rows = count($rowset);
     $this->view->numberOfRows = $num_rows;
     $this->view->data = $data;
 }
Example #18
0
 function browseAction()
 {
     $r = $this->getRequest();
     $page = $r->getParam('page');
     $rowset = App_Model_Show_Catalog::show()->fetchFromFolder($page);
     $content = 0;
     $data = array();
     foreach ($rowset as $row) {
         $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedTitle');
         $description = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedDescription');
         $data[$content][0] = $title;
         $data[$content][1] = $row['createdDate'];
         $data[$content][2] = $description;
         $data[$content][3] = $row['guid'];
         $data[$content][4] = $row['shortTitle'];
         $content++;
     }
     $num_rows = count($rowset);
     $this->view->numberOfRows = $num_rows;
     $this->view->data = $data;
 }
Example #19
0
 function terbaruAction()
 {
     $zl = Zend_Registry::get('Zend_Locale');
     if ($zl->getLanguage() == "id") {
         $rowset = App_Model_Show_Catalog::show()->fetchFromFolder('fb16', 0, 5);
     } else {
         $rowset = App_Model_Show_Catalog::show()->fetchFromFolderEn('lt481074ef14e7a', 0, 5);
     }
     $content = 0;
     $data = array();
     foreach ($rowset as $row) {
         $data[$content][0] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedTitle');
         $data[$content][1] = $row['shortTitle'];
         $data[$content][2] = date("d/m/y", strtotime($row['createdDate']));
         $data[$content][3] = $row['guid'];
         $data[$content][4] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedDescription');
         $content++;
     }
     $num_rows = count($rowset);
     $this->view->numberOfRows = $num_rows;
     $this->view->data = $data;
 }
Example #20
0
 public function clickAction()
 {
     $this->_helper->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $request = $this->getRequest();
     $click = App_Model_Mongodb_RequestLog::click($request->getParam('periode'));
     foreach ($click['result'] as $key => $val) {
         $furl = $val['_id'];
         $url = pathinfo($furl);
         $guid = basename($url['dirname']);
         $title = basename($val['_id']);
         $catalogDb = App_Model_Show_Catalog::show()->getCatalogByGuid($guid);
         if ($catalogDb) {
             if ($catalogDb['profileGuid'] == 'klinik') {
                 $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($guid, 'fixedCommentTitle');
             } else {
                 $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($guid, 'fixedTitle');
             }
         }
         $click['result'][$key]['title'] = $title;
     }
     $this->getResponse()->setBody(Zend_Json::encode($click));
 }
Example #21
0
 function detailIndexWartaWComAction()
 {
     $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;
     $a = array();
     $rowset = App_Model_Show_Catalog::show()->fetchFromFolder($folderGuid, $start, $limit);
     $a['folderGuid'] = $folderGuid;
     $a['totalCount'] = App_Model_Show_Catalog::show()->getWartaCount($folderGuid);
     $ii = 0;
     if ($a['totalCount'] != 0) {
         foreach ($rowset as $row) {
             $a['indexcom'][$ii]['title'] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedTitle');
             $a['indexcom'][$ii]['shortTitle'] = $row['shortTitle'];
             $a['indexcom'][$ii]['createdDate'] = date("d/m/y", strtotime($row['createdDate']));
             $a['indexcom'][$ii]['guid'] = $row['guid'];
             $ii++;
         }
     }
     if ($a['totalCount'] == 0) {
         $a['indexcom'][0]['title'] = "-";
         $a['indexcom'][0]['shortTitle'] = "-";
         $a['indexcom'][0]['createdDate'] = "-";
         $a['indexcom'][0]['guid'] = "-";
     }
     echo Zend_Json::encode($a);
 }
Example #22
0
 function delete($itemGuid, $relatedGuid, $relateAs)
 {
     if (empty($relateAs)) {
         throw new Zend_Exception('relateAs can not be empty!');
     }
     $registry = Zend_Registry::getInstance();
     $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
     $cdn = $config->getOption('cdn');
     $tblRelatedItem = new App_Model_Db_Table_RelatedItem();
     $rowsetRelatedDocs = $tblRelatedItem->fetchAll("itemGuid='{$itemGuid}' AND relatedGuid='{$relatedGuid}' AND relateAs='{$relateAs}'");
     if ($rowsetRelatedDocs) {
         foreach ($rowsetRelatedDocs as $rowRelatedDoc) {
             $systemname = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowRelatedDoc->itemGuid, 'docSystemName');
             $ext = pathinfo($systemname, PATHINFO_EXTENSION);
             $ext = strtolower($ext);
             $parentGuid = $rowRelatedDoc->relatedGuid;
             //$sDir1 = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR.$systemname;
             $sDir1 = $cdn['static']['dir']['files'] . DIRECTORY_SEPARATOR . $systemname;
             $sDir2 = $cdn['static']['dir']['files'] . DIRECTORY_SEPARATOR . $parentGuid . DIRECTORY_SEPARATOR . $systemname;
             //$sDir2 = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR.$parentGuid.DIRECTORY_SEPARATOR.$systemname;
             if (file_exists($sDir1)) {
                 unlink($sDir1);
             } else {
                 if (file_exists($sDir2)) {
                     unlink($sDir2);
                 }
             }
             $systemname = $rowRelatedDoc->itemGuid;
             $parentGuid = $rowRelatedDoc->relatedGuid;
             $sDir = $cdn['static']['dir']['images'];
             $sDir2 = $cdn['static']['dir']['images'] . DIRECTORY_SEPARATOR . $parentGuid;
             //$sDir = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'images';
             //$sDir2 = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.$parentGuid;
             if (file_exists($sDir . "/" . $systemname . '.' . $ext)) {
                 unlink($sDir . "/" . $systemname . '.' . $ext);
             }
             if (file_exists($sDir . "/tn_" . $systemname . '.' . $ext)) {
                 unlink($sDir . "/tn_" . $systemname . '.' . $ext);
             }
             if (file_exists($sDir2 . "/" . $systemname . '.' . $ext)) {
                 unlink($sDir2 . "/" . $systemname . '.' . $ext);
             }
             if (file_exists($sDir2 . "/tn_" . $systemname . '.' . $ext)) {
                 unlink($sDir2 . "/tn_" . $systemname . '.' . $ext);
             }
             $file = new Zend_Config_Ini(APPLICATION_PATH . '/configs/image.ini', 'size');
             $keys = array_keys($file->toArray());
             foreach ($keys as $key) {
                 if (file_exists($sDir2 . '/' . $key . '_' . $systemname . '.' . $ext)) {
                     unlink($sDir2 . '/' . $key . '_' . $systemname . '.' . $ext);
                 }
             }
             $tblCatalog = new App_Model_Db_Table_Catalog();
             $rowCatalog = $tblCatalog->find($rowRelatedDoc->itemGuid)->current();
             $rowCatalog->delete();
         }
     }
     if ($tblRelatedItem->delete("itemGuid='{$itemGuid}' AND relatedGuid='{$relatedGuid}' AND relateAs='{$relateAs}'")) {
         return true;
     } else {
         return false;
     }
 }
Example #23
0
 function ueventAction()
 {
     $rowset = App_Model_Show_Catalog::show()->fetchFromFolder('lt4c93230c9d0a5', 0, 10);
     $content = 0;
     $data = array();
     $array_hari = array(1 => "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu", "Minggu");
     foreach ($rowset as $row) {
         $data[$content][0] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedTitle');
         $data[$content][1] = $row['guid'];
         $data[$content][2] = $row['shortTitle'];
         $data[$content][3] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedDescription');
         $hari = $array_hari[date("N", strtotime($row['publishedDate']))];
         $data[$content][4] = $hari . ', ' . date("d F Y", strtotime($row['publishedDate']));
         $data[$content][5] = $row['price'];
         $content++;
     }
     $num_rows = count($rowset);
     $this->view->numberOfRows = $num_rows;
     $this->view->data = $data;
 }
Example #24
0
 function ibgAction()
 {
     set_time_limit(0);
     ini_set('max_execution_time', '0');
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $title = "<h4>HUKUMONLINE INDONESIA: <small>search</small></h4><hr/>";
     echo $title . '<br>';
     $solr = new Apache_Solr_Service('202.153.129.35', '8983', '/solr/core-catalog');
     if (!$solr->ping()) {
         echo 'Solr service not responding.';
         exit;
     }
     $indexingEngine = Pandamp_Search::manager();
     $db = Zend_Registry::get('db1');
     $query = "SELECT * FROM KutuCatalog WHERE guid IN ('lt5211a9dc6dda3','lt5211a831ab303','lt5211a6dbc1fd7','lt521182ee9af96','lt52117c0a1da99','lt5211b4d284ae1')";
     $results = $db->query($query);
     $rowset = $results->fetchAll(PDO::FETCH_OBJ);
     $rowCount = count($rowset);
     echo $rowCount . '<br><br>';
     for ($iCount = 0; $iCount < $rowCount; $iCount++) {
         $row = $rowset[$iCount];
         $nextRow = $rowset[$iCount + 1];
         $indexingEngine->indexCatalog($row->guid);
         $modelCatalog = App_Model_Show_Catalog::show()->getCatalogByGuid($row->guid);
         if ($modelCatalog['profileGuid'] == "klinik") {
             $sTitle = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row->guid, "fixedCommentTitle");
         } else {
             $sTitle = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row->guid, "fixedTitle");
         }
         $message = "\n    \t\t<div class='box box-info closeable'>\n    \t\t<b>[urutan:{$iCount}]</b>&nbsp;id&nbsp;:&nbsp;<abbr>" . $row->guid . " - " . $sTitle . "</abbr> data has been successfully indexed.\n                <b>[next guid: " . $nextRow->guid . "]</b> - <i>" . $modelCatalog['profileGuid'] . "</i></div>";
         echo $message . '<br>';
         flush();
         //sleep(30);
     }
 }
Example #25
0
 /**
  * categoryClinicPullDown
  * @return category clinic
  */
 static function categoryClinicPullDown($cat = '')
 {
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $rowset = $tblCatalog->fetchAll("profileGuid='kategoriklinik'", 'createdDate DESC');
     $category = "<select name=\"category\">\n";
     if ($cat) {
         $rowCategory = $tblCatalog->find($cat)->current();
         $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($cat, 'fixedTitle');
         $category .= "<option value='{$rowCategory->guid}' selected>{$title}</option>";
         $category .= "<option value=''>---Semua Kategori---</option>";
     } else {
         $category .= "<option value='' selected>---Semua Kategori---</option>";
     }
     foreach ($rowset as $row) {
         $attributeTitle = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row->guid, 'fixedTitle');
         if ($cat && $row->guid == $rowCategory->guid) {
             continue;
         } else {
             $category .= "<option value='{$row->guid}'>{$attributeTitle}</option>";
         }
     }
     $category .= "</select>\n\n";
     return $category;
 }
Example #26
0
 function completeorderAction()
 {
     $modelPaymentSetting = new App_Model_Db_Table_PaymentSetting();
     $rowTaxRate = $modelPaymentSetting->fetchRow("settingKey='taxRate'");
     $cart =& $_SESSION['jCart'];
     if (!is_object($cart)) {
         $cart = new jCart();
     }
     if (empty($cart) || count($cart->items) == 0) {
         $this->_redirect(ROOT_URL . '/checkout/cartempty');
     }
     $bpm = new Pandamp_Core_Hol_Catalog();
     $result = array('subTotal' => 0, 'disc' => 0, 'taxAmount' => 0, 'grandTotal' => 0, 'items' => array());
     for ($iCart = 0; $iCart < count($cart->items); $iCart++) {
         $itemId = $cart->items[$iCart];
         $qty = $cart->itemqtys[$itemId];
         $coupon = isset($cart->coupon) ? $cart->coupon : '';
         $itemPrice = $bpm->getPrice($itemId);
         $disc = $bpm->getDiscount($coupon);
         $result['items'][$iCart]['itemId'] = $itemId;
         $result['items'][$iCart]['item_name'] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($itemId, 'fixedTitle');
         $result['items'][$iCart]['itemPrice'] = $itemPrice;
         $result['items'][$iCart]['itemTotal'] = $qty * $itemPrice;
         $result['items'][$iCart]['qty'] = $qty;
         $result['coupon'] = $coupon;
         $result['disc'] = $disc;
         $result['subTotal'] += $itemPrice * $qty;
     }
     $result['taxAmount'] = $result['subTotal'] * $rowTaxRate->settingValue / 100;
     $grandTotal = $result['subTotal'] - $result['disc'] / 100 * $result['subTotal'];
     $result['grandTotal'] = $grandTotal + $result['taxAmount'];
     $payment = $this->_request->getParam('payment');
     $orderId = $this->saveOrder($result, $payment);
     //        $cart = null;
     $data = $this->_request->getParams();
     $this->view->cart = $result;
     $this->view->data = $data;
     $this->view->orderId = $orderId;
     $modDir = $this->getFrontController()->getModuleDirectory();
     require_once $modDir . '/models/Store/Mailer.php';
     $mod = new HolSite_Model_Store_Mailer();
     switch (strtolower($payment['method'])) {
         case 'bank':
             $mod->sendBankInvoiceToUser($orderId);
             break;
         case 'nsiapay':
             //                $mod->sendInvoiceToUser($orderId);
             break;
         case 'postpaid':
             $tblUserFinance = new App_Model_Db_Table_UserFinance();
             $userFinanceInfo = $tblUserFinance->find($this->_user->kopel)->current();
             if (!$userFinanceInfo->isPostPaid) {
                 return $this->_helper->redirector('notpostpaid', 'store_payment', 'hol-site');
             }
             $mod->sendInvoiceToUser($orderId);
             break;
     }
 }
Example #27
0
 function detailIndexKlinikAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $dateDiff = new Pandamp_Lib_DateDiff();
     $folderGuid = $this->_getParam('folderGuid') ? $this->_getParam('folderGuid') : '';
     $start = $this->_getParam('start') ? $this->_getParam('start') : 0;
     $limit = $this->_getParam('limit') ? $this->_getParam('limit') : 0;
     $a = array();
     $rowset = App_Model_Show_Catalog::show()->fetchFromFolder($folderGuid, $start, $limit);
     $a['folderGuid'] = $folderGuid;
     $a['totalCount'] = App_Model_Show_Catalog::show()->getWartaCount($folderGuid);
     $ii = 0;
     if ($a['totalCount'] != 0) {
         foreach ($rowset as $row) {
             $arraypictureformat = array("jpg", "jpeg", "gif");
             $txt_allowedformat = implode('; ', $arraypictureformat);
             $registry = Zend_Registry::getInstance();
             $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
             $cdn = $config->getOption('cdn');
             $sDir = $cdn['static']['dir']['photo'];
             $sDir2 = $cdn['static']['url']['photo'] . '/';
             $smg = $cdn['static']['images'];
             $modelUser = App_Model_Show_User::show()->getUserByName($row['createdBy']);
             $x = 0;
             foreach ($arraypictureformat as $key => $val) {
                 if (is_file($sDir . "/" . $modelUser['kopel'] . "." . $val)) {
                     $myphoto = $sDir . "/" . $modelUser['kopel'] . "." . $val;
                     $myext = $val;
                     $x = 1;
                     break;
                 }
             }
             if ($x == 1) {
                 $myphotosize = getimagesize($myphoto);
                 $dis = "";
                 if (isset($myext) && is_file($sDir . "/" . $modelUser['kopel'] . "." . $myext)) {
                     $txt_existence = "<img src=\"" . $sDir2 . $modelUser['kopel'] . "." . $myext . "\" class=\"avatar\" width=\"38\" height=\"38\" />";
                 }
             } else {
                 $txt_existence = "<img src=\"" . $smg . "/gravatar-140.png\" width=\"38\" height=\"38\" class=\"avatar\" border=\"0\" />";
             }
             $rowCatalogTitle = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedCommentTitle');
             $rowCatalogQuestion = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedCommentQuestion');
             $rowCatalogSelectCat = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedKategoriKlinik');
             $author = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedSelectNama');
             $source = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row['guid'], 'fixedSelectMitra');
             $a['index'][$ii]['title'] = $rowCatalogTitle;
             $a['index'][$ii]['question'] = $rowCatalogQuestion;
             $a['index'][$ii]['secat'] = $rowCatalogSelectCat;
             $a['index'][$ii]['category'] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowCatalogSelectCat, 'fixedTitle');
             $a['index'][$ii]['guid'] = $row['guid'];
             $a['index'][$ii]['createdBy'] = $row['createdBy'];
             $a['index'][$ii]['author'] = isset($author) ? $author : '';
             if (isset($source)) {
                 $a['index'][$ii]['source'] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($source, 'fixedTitle');
                 $a['index'][$ii]['sid'] = $source;
             } else {
                 $a['index'][$ii]['source'] = '';
                 $a['index'][$ii]['sid'] = '';
             }
             $a['index'][$ii]['publishedDate'] = $dateDiff->ago(strftime('%Y-%m-%d %H:%M:%S', strtotime($row['publishedDate'])));
             $a['index'][$ii]['existence'] = '<div style="float:left;padding:2px;margin: 1px 10px 10px 0px;"><a href="">' . $txt_existence . '</a></div>';
             $ii++;
         }
     }
     if ($a['totalCount'] == 0) {
         $a['index'][0]['title'] = "-";
         $a['index'][0]['question'] = "-";
         $a['index'][0]['category'] = "-";
         $a['index'][0]['guid'] = "-";
         $a['index'][0]['createdBy'] = "-";
         $a['index'][0]['author'] = "-";
         $a['index'][0]['source'] = "-";
         $a['index'][0]['publishedDate'] = "-";
     }
     echo Zend_Json::encode($a);
 }
Example #28
0
 public function save($aData)
 {
     if (empty($aData['profileGuid'])) {
         throw new Zend_Exception('Catalog Profile can not be EMPTY!');
     }
     $profileGuid = $aData['profileGuid'];
     if ($profileGuid == 'klinik') {
         $title = $aData['fixedCommentTitle'];
     } else {
         $title = $aData['fixedTitle'];
     }
     $setsticky = false;
     $sticky = isset($aData['stickyCategory']) && !empty($aData['stickyCategory']) ? $aData['stickyCategory'] : 0;
     if ($sticky == 1) {
         $setsticky = true;
     }
     $slug = Pandamp_Utility_String::removeSign($title, '-', true);
     if (isset($aData['keywordintegrasi']) && !empty($aData['keywordintegrasi'])) {
         $ckey = explode(',', $aData['fixedKeywords']);
         $mckey = array_merge($aData['keywordintegrasi'], $ckey);
         $umckey = array_intersect_key($mckey, array_unique(array_map('strtolower', $mckey)));
         $umckey = rtrim(implode(',', $umckey), ',');
         $aData['fixedKeywords'] = $umckey;
         unset($aData['keywordintegrasi']);
     }
     if (isset($aData['fixedNarsum']) && !empty($aData['fixedNarsum'])) {
         $fn = implode(',', $aData['fixedNarsum']);
         $aData['fixedNarsum'] = $fn;
     }
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $gman = new Pandamp_Core_Guid();
     $catalogGuid = isset($aData['guid']) && !empty($aData['guid']) ? $aData['guid'] : $gman->generateGuid();
     $folderGuid = isset($aData['folderGuid']) && !empty($aData['folderGuid']) ? $aData['folderGuid'] : '';
     if (isset($aData['shortTitle']) && !empty($aData['shortTitle'])) {
         $slug = $aData['shortTitle'];
     }
     //if not empty, there are 2 possibilities
     $where = $tblCatalog->getAdapter()->quoteInto('guid=?', $catalogGuid);
     if ($tblCatalog->fetchRow($where)) {
         $rowCatalog = $tblCatalog->find($catalogGuid)->current();
         $rowCatalog->shortTitle = $slug;
         $rowCatalog->publishedDate = isset($aData['publishedDate']) ? $aData['publishedDate'] : $rowCatalog->publishedDate;
         $rowCatalog->expiredDate = isset($aData['expiredDate']) ? $aData['expiredDate'] : $rowCatalog->expiredDate;
         $rowCatalog->status = isset($aData['status']) ? $aData['status'] : $rowCatalog->status;
         $rowCatalog->price = isset($aData['price']) ? $aData['price'] : $rowCatalog->price;
         $rowCatalog->sticky = (int) $setsticky;
     } else {
         $rowCatalog = $tblCatalog->fetchNew();
         $rowCatalog->guid = $catalogGuid;
         $rowCatalog->shortTitle = $slug;
         $rowCatalog->profileGuid = $profileGuid;
         $rowCatalog->publishedDate = isset($aData['publishedDate']) ? $aData['publishedDate'] : '0000-00-00 00:00:00';
         $rowCatalog->expiredDate = isset($aData['expiredDate']) ? $aData['expiredDate'] : '0000-00-00 00:00:00';
         $rowCatalog->createdBy = isset($aData['username']) ? $aData['username'] : '';
         $rowCatalog->modifiedBy = $rowCatalog->createdBy;
         $rowCatalog->createdDate = date("Y-m-d H:i:s");
         $rowCatalog->modifiedDate = $rowCatalog->createdDate;
         $rowCatalog->deletedDate = '0000-00-00 00:00:00';
         $rowCatalog->status = isset($aData['status']) ? $aData['status'] : 0;
         $rowCatalog->price = isset($aData['price']) ? $aData['price'] : 0;
         $rowCatalog->sticky = (int) $setsticky;
     }
     try {
         $catalogGuid = $rowCatalog->save();
     } catch (Exception $e) {
         die($e->getMessage());
     }
     $tableProfileAttribute = new App_Model_Db_Table_ProfileAttribute();
     //$profileGuid = $rowCatalog->profileGuid;
     $where = $tableProfileAttribute->getAdapter()->quoteInto('profileGuid=?', $profileGuid);
     $rowsetProfileAttribute = $tableProfileAttribute->fetchAll($where, 'viewOrder ASC');
     $rowsetCatalogAttribute = $rowCatalog->findDependentRowsetCatalogAttribute();
     foreach ($rowsetProfileAttribute as $rowProfileAttribute) {
         /*$aid = $rowProfileAttribute->attributeGuid;
          	$rowCatalogAttribute = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue( $catalogGuid, $rowProfileAttribute->attributeGuid);
          	if ($rowCatalogAttribute)
          	{
          		$ca = new App_Model_Db_Table_CatalogAttribute();
          		$ca->update(
          			[
          				'value' => $aData[$aid]
          			], 
          			[
          				'catalogGuid = ?' => $catalogGuid,
          				'attributeGuid = ?'	=> $rowProfileAttribute->attributeGuid
          			]
          		);
          	}
          	else
          	{
          		$ca = new App_Model_Db_Table_CatalogAttribute();
          		$ca->insert([
          			'catalogGuid' => $catalogGuid,
          			'attributeGuid' => $rowProfileAttribute->attributeGuid,
          			'value'	=> $aData[$aid]
          		]);
          	}*/
         if ($rowsetCatalogAttribute->findByAttributeGuid($rowProfileAttribute->attributeGuid)) {
             $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid($rowProfileAttribute->attributeGuid);
         } else {
             $tblCatalogAttribute = new App_Model_Db_Table_CatalogAttribute();
             $rowCatalogAttribute = $tblCatalogAttribute->fetchNew();
             $rowCatalogAttribute->catalogGuid = $catalogGuid;
             $rowCatalogAttribute->attributeGuid = $rowProfileAttribute->attributeGuid;
         }
         $rowCatalogAttribute->value = isset($aData[$rowProfileAttribute->attributeGuid]) ? $aData[$rowProfileAttribute->attributeGuid] : '';
         $rowCatalogAttribute->save();
     }
     //category
     if (isset($aData['selectedNode']) && !empty($aData['selectedNode'])) {
         $categories = array_map('trim', explode(',', $aData['selectedNode']));
         $tblCatalogFolder = new App_Model_Db_Table_CatalogFolder();
         $cf = $tblCatalogFolder->fetchAll("catalogGuid='{$catalogGuid}'");
         if (count($cf)) {
             foreach ($cf as $cfol) {
                 $cts[] = $cfol->folderGuid;
                 if (!in_array($cfol->folderGuid, $categories)) {
                     $tblCatalogFolder->delete("catalogGuid='{$cfol->catalogGuid}' AND folderGuid='{$cfol->folderGuid}'");
                 }
             }
         }
         foreach ($categories as $category) {
             $rowCatalog->copyToFolder($category);
         }
     }
     //save to table CatalogFolder only if folderGuid is not empty
     /*if (!empty($folderGuid))
       {
           $rowCatalog->copyToFolder($folderGuid);
       }*/
     // copy to other categories
     /*if (!empty($aData['categories'])) {
       	$tblCatalogFolder = new App_Model_Db_Table_CatalogFolder();
       	$cf = $tblCatalogFolder->fetchAll("catalogGuid='$catalogGuid'");
       	if (count($cf)) {
       		$sa="";
       		foreach ($cf as $cfol) {
       			$cts[] = $cfol->folderGuid;
       			if (!in_array($cfol->folderGuid, $aData['categories']))
       			{
       				$tblCatalogFolder->delete("catalogGuid='$cfol->catalogGuid' AND folderGuid='$cfol->folderGuid'");
       				$sa="del";
       			}
       		}
       		
       		if ($sa=="del") {
       			$auth = Zend_Auth::getInstance();
       			$group = $auth->getIdentity()->name;
       			$group = strtolower(str_replace(" ", "", $group));
       			 
       			$zl = Zend_Registry::get("Zend_Locale");
       			$lang = $zl->getLanguage();
       		
       			$cache = Pandamp_Cache::getInstance();
       			$sel = join("_", $cts);
       			$cache->remove('categoryCheckbox_'.$sel.'_'.$lang.'_'.$group);
       		}
       	}
       	
       	foreach ($aData['categories'] as $category)
       	{
       		$rowCatalog->copyToFolder($category);
       	}
       }*/
     /**
      * @todo Relasi Katalog
      */
     if (isset($aData['relIds'])) {
         $relatedItemDb = new App_Model_Db_Table_RelatedItem();
         $relatedItemDb->delete(array('relatedGuid=?' => $catalogGuid, 'relateAs IN (?)' => array('RELATED_OTHER', 'RELATED_Clinic', 'RELATED_ISSUE', 'RELATED_HISTORY', 'RELATED_BASE', 'RELATED_TRANSLATION_ID', 'RELATED_TRANSLATION_EN')));
         for ($i = 0; $i < count($aData['relIds']); $i++) {
             if ($aData['relIds'][$i] and $aData['relGuids'][$i]) {
                 $relatedItemDb->insert(array('itemGuid' => $aData['relIds'][$i], 'relatedGuid' => $catalogGuid, 'relateAs' => $aData['relGuids'][$i]));
             }
         }
     }
     /**
      * @todo Upload File
      */
     if (isset($aData['filename']) && !empty($aData['filename'])) {
         $catalogDb = new App_Model_Db_Table_Catalog();
         for ($i = 0; $i < count($aData['filename']); $i++) {
             $fileName = $aData['filename'][$i];
             $fileUrls = json_decode(stripslashes($aData['fileUrl'][$i]));
             foreach ($fileUrls as $index => $value) {
                 if ($index == "original") {
                     $title = '';
                     $slug = '';
                     if (isset($aData['attr_caption_' . $value->id]) && !empty($aData['attr_caption_' . $value->id])) {
                         $title = $aData['attr_caption_' . $value->id][0];
                         $slug = Pandamp_Utility_String::removeSign($title, '-', true);
                     }
                     if ($value->type == 'file') {
                         $relatedType = 'RELATED_FILE';
                     } elseif ($value->type == 'image') {
                         $relatedType = 'RELATED_IMAGE';
                     }
                     $rowDocCatalog = $catalogDb->fetchNew();
                     $rowDocCatalog->guid = $value->id;
                     $rowDocCatalog->shortTitle = $slug;
                     $rowDocCatalog->profileGuid = $aData['profile'];
                     $docCatalogGuid = $rowDocCatalog->save();
                     $rowsetDocCatalogAttribute = $rowDocCatalog->findDependentRowsetCatalogAttribute();
                     $this->_updateCatalogAttribute($rowsetDocCatalogAttribute, $docCatalogGuid, 'docSystemName', $value->title);
                     $this->_updateCatalogAttribute($rowsetDocCatalogAttribute, $docCatalogGuid, 'docOriginalName', $fileName);
                     $this->_updateCatalogAttribute($rowsetDocCatalogAttribute, $docCatalogGuid, 'docSize', $value->size);
                     $this->_updateCatalogAttribute($rowsetDocCatalogAttribute, $docCatalogGuid, 'docMimeType', $value->filetype);
                     $this->_updateCatalogAttribute($rowsetDocCatalogAttribute, $docCatalogGuid, 'fixedTitle', $title);
                     $this->_updateCatalogAttribute($rowsetDocCatalogAttribute, $docCatalogGuid, 'docViewOrder', 0);
                     $this->relateTo($docCatalogGuid, $catalogGuid, $relatedType);
                 }
             }
         }
     }
     /**
      * Copy|Use image
      * Untuk satu article satu image
      */
     if (isset($aData['fixedFileImage'])) {
         $fixedFileImage = $aData['fixedFileImage'];
         $fixedFileImage = basename($fixedFileImage);
         if (strpos($fixedFileImage, 'tn_') !== false) {
             $basename = str_replace('tn_', '', $fixedFileImage);
         } else {
             $basename = str_replace('thumbnail_', '', $fixedFileImage);
         }
         $guidBasename = pathinfo($basename, PATHINFO_FILENAME);
         $eiTitle = $aData['fileImage'] ? $aData['fileImage'] : '';
         $eslug = Pandamp_Utility_String::removeSign($eiTitle, '-', true);
         $rel = array();
         $relatedItemDb = new App_Model_Db_Table_RelatedItem();
         $relItems = $relatedItemDb->fetchAll("relatedGuid='" . $catalogGuid . "' AND relateAs='RELATED_IMAGE'");
         if ($relItems) {
             foreach ($relItems as $relItem) {
                 $catalogDb = new App_Model_Db_Table_Catalog();
                 $catalog = $catalogDb->fetchRow("guid='" . $relItem['itemGuid'] . "' AND status!=-1");
                 if ($catalog) {
                     $rel[] = $relItem['itemGuid'];
                 }
             }
         }
         if (isset($rel[0]) && count($rel) == 1 && $rel[0] == $guidBasename) {
             $rowEImageCatalog = $tblCatalog->find($guidBasename)->current();
             $rowEImageCatalog->shortTitle = $eslug;
         } else {
             if (isset($rel[0])) {
                 $this->delete($rel[0]);
             }
             // jika ingin mengganti gambar dari yang sudah ada
             $of = $tblCatalog->find($guidBasename)->current();
             if ($of) {
                 $cd = $of->createdDate;
                 $cb = $of->createdBy;
             } else {
                 $cb = $aData['username'];
                 $cd = date("Y-m-d H:i:s");
             }
             $rowEImageCatalog = $tblCatalog->fetchNew();
             $rowEImageCatalog->shortTitle = $eslug;
             $rowEImageCatalog->profileGuid = $aData['profile'];
             $rowEImageCatalog->createdDate = $cd;
             $rowEImageCatalog->createdBy = $cb;
         }
         $catalogEGuid = $rowEImageCatalog->save();
         $rowsetEImageCatalogAttribute = $rowEImageCatalog->findDependentRowsetCatalogAttribute();
         /**
          * @TODO docSystemName
          * digunakan sebagai inti|pemisah dari image
          * jika dia hasil copy dari catalog lain atau file original nya sendiri 
          * maka yg diambil adalah attribute ini
          */
         $this->_updateCatalogAttribute($rowsetEImageCatalogAttribute, $catalogEGuid, 'docSystemName', $basename);
         $this->_updateCatalogAttribute($rowsetEImageCatalogAttribute, $catalogEGuid, 'docOriginalName', App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($guidBasename, 'docOriginalName'));
         $this->_updateCatalogAttribute($rowsetEImageCatalogAttribute, $catalogEGuid, 'docSize', App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($guidBasename, 'docSize'));
         $this->_updateCatalogAttribute($rowsetEImageCatalogAttribute, $catalogEGuid, 'docMimeType', App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($guidBasename, 'docMimeType'));
         $this->_updateCatalogAttribute($rowsetEImageCatalogAttribute, $catalogEGuid, 'docViewOrder', App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($guidBasename, 'docViewOrder'));
         $this->_updateCatalogAttribute($rowsetEImageCatalogAttribute, $catalogEGuid, 'fixedTitle', $eiTitle);
         $this->relateTo($catalogEGuid, $catalogGuid, 'RELATED_IMAGE');
     }
     /**
      * @todo BLOCK solr core-catalog	
      */
     $indexingEngine = Pandamp_Search::manager();
     $indexingEngine->indexCatalog($catalogGuid);
     /**
     		 * @todo BLOCK New solr corehol	
             $registry = Zend_Registry::getInstance();
             $application = Zend_Registry::get(Pandamp_Keys::REGISTRY_APP_OBJECT);
             
             $res = $application->getOption('resources')['indexing']['solr']['write'];
             
             $esolr = new Pandamp_Search_Adapter_Esolr($res['host'], $res['port'], $res['dir4']);
             $esolr->indexCatalog($catalogGuid); */
     /**
     		 * @todo BLOCK solr shortenerUrl core3
             $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
             if (null === $viewRenderer->view) {
             	$viewRenderer->initView();
             }
             $view = $viewRenderer->view;
             
             
             // create shortener url
             $kopel 	= Zend_Auth::getInstance()->getIdentity()->kopel;
             
             $cfg 	= Pandamp_Config::getConfig();
             
     		$config = Pandamp_Application::getOption('resources');
     		$indexingConfig = $config['indexing']['solr']['write'];
     		$hukumn = new Pandamp_Search_Adapter_Solrh($indexingConfig['host'], $indexingConfig['port'], $indexingConfig['dir3']);
     		
     		$catalogAttributeDb = new App_Model_Db_Table_CatalogAttribute();
     		
     		$zl = Zend_Registry::get('Zend_Locale');
     		
     		if ($zl->getLanguage() == 'id') {
     			
     			if ($profileGuid == 'klinik') 
     				$url_content = $cfg->web->url->base.'/klinik/detail/'.$catalogGuid.'/'.$slug;
     			else if (in_array($profileGuid, array('kutu_peraturan','kutu_putusan','kutu_peraturan_kolonial','kutu_rancangan_peraturan')))
     				$url_content = $cfg->web->url->base.'/pusatdata/detail/'.$catalogGuid.'/'.$view->getLabelNode($folderGuid).'/'.$folderGuid.'/'.$slug;
     			else
     				$url_content = $cfg->web->url->base.'/berita/baca/'.$catalogGuid.'/'.$slug;
     		
     			
     		}
     		else if ($zl->getLanguage() == 'en')
     		{
     			$url_content = $cfg->web->en->url->base.'/pages/'.$catalogGuid.'/'.$slug(strip_tags(title));
     		}
     		
     		//$q = "url:\"".$url_content."\" kopel:".$kopel;
     		$q = "url:\"".$url_content."\"";
     		
     		$db = Zend_Registry::get('db4');
     		
     		$data = array('url' => $url_content,
     		 			  'createdate' => date("Y-m-d h:i:s"),
     					  'remoteip' => Pandamp_Lib_Formater::getHttpRealIp(),
     					  'kopel' => $kopel);
     					  
     		$hits = $hukumn->find($q,0,1);
     		if (isset($hits->response->docs[0])) 
     		{
     			$row = $hits->response->docs[0];
     			$hid = $row->id;
     			
     			$db->update('urls',$data,"id=$hid");
     		}
     		else 
     		{
     			$insert = $db->insert('urls', $data);
     			
     			$hid = $db->lastInsertId('urls', 'id');
     		}
     		
     		// indexing shortener url
     		$hukumn->indexCatalog($hid); */
     /*
     try {
     	
         $url = 'http://developers.facebook.com/tools/lint/?url={'.$url_content.'}&format=json';
         $ch = curl_init($url);
         curl_setopt($ch, CURLOPT_NOBODY, true);
         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
         curl_exec($ch);
         $retcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
         curl_close($ch);
     	
     }
     catch (Exception $e)
     {
     	//die($e->getMessage());
     }
     */
     /**
      * Updated Dec 10, 2013 06:01
      */
     //$dir = $cfg->cdn->hol->static->url . DS . 'temp' . DS . 'cache';
     //Pandamp_Core_FileCache::clear($dir . DS . 'url');
     //Pandamp_Core_FileCache::clear($dir . DS . 'action');
     /*
     if (Pandamp_Pio::manager()->ping()) {
     	Pandamp_Pio::manager()->addEvent([
     		'guid' => $catalogGuid,
     		'category' => $profileGuid				
     	]);
     }
     */
     self::addCache($folderGuid);
     //after indexing, update isIndex and indexedDate in table KutuCatalog
     return $catalogGuid;
 }
Example #29
0
 function fetchClinicByCategoryAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $r = $this->getRequest();
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $start = $r->getParam('start') ? $r->getParam('start') : 0;
     $limit = $r->getParam('limit') ? $r->getParam('limit') : 20;
     $orderBy = $r->getParam('orderBy') ? $r->getParam('sortBy') : 'publishedDate';
     $sortOrder = $r->getParam('sortOrder') ? $r->getParam('sortOrder') : ' DESC';
     $query = "profile:klinik status:99 kategoriklinik:{$catalogGuid};publishedDate desc";
     $a = array();
     $a['query'] = $query;
     $vTitle = new Pandamp_Controller_Action_Helper_GetCatalogTitle();
     $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['klinikkategori'][0]['guid'] = 'XXX';
         $a['klinikkategori'][0]['title'] = 'Kategori klinik kosong';
         $a['klinikkategori'][0]['pertanyaan'] = "";
         $a['klinikkategori'][0]['createdBy'] = "";
         $a['klinikkategori'][0]['author'] = '';
         $a['klinikkategori'][0]['sid'] = '';
         $a['klinikkategori'][0]['source'] = '';
         $a['klinikkategori'][0]['publishedDate'] = '';
         $a['klinikkategori'][0]['existence'] = '';
     } else {
         if ($solrNumFound > $limit) {
             $numRowset = $limit;
         } else {
             $numRowset = $solrNumFound;
         }
         for ($ii = 0; $ii < $numRowset; $ii++) {
             if (isset($hits->response->docs[$ii])) {
                 $row = $hits->response->docs[$ii];
                 $arraypictureformat = array("jpg", "jpeg", "gif");
                 $txt_allowedformat = implode('; ', $arraypictureformat);
                 $registry = Zend_Registry::getInstance();
                 $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
                 $cdn = $config->getOption('cdn');
                 $sDir = $cdn['static']['dir']['photo'];
                 $sDir2 = $cdn['static']['url']['photo'] . '/';
                 $smg = $cdn['static']['images'];
                 $modelUser = App_Model_Show_User::show()->getUserByName($row->createdBy);
                 $x = 0;
                 foreach ($arraypictureformat as $key => $val) {
                     if (is_file($sDir . "/" . $modelUser['kopel'] . "." . $val)) {
                         $myphoto = $sDir . "/" . $modelUser['kopel'] . "." . $val;
                         $myext = $val;
                         $x = 1;
                         break;
                     }
                 }
                 if ($x == 1) {
                     $myphotosize = getimagesize($myphoto);
                     $dis = "";
                     if (isset($myext) && is_file($sDir . "/" . $modelUser['kopel'] . "." . $myext)) {
                         $txt_existence = "<img src=\"" . $sDir2 . $modelUser['kopel'] . "." . $myext . "\" class=\"avatar\" width=\"38\" height=\"38\" />";
                     }
                 } else {
                     $txt_existence = "<img src=\"" . $smg . "/gravatar-140.png\" width=\"38\" height=\"38\" class=\"avatar\" border=\"0\" />";
                 }
                 $a['klinikkategori'][$ii]['guid'] = $row->id;
                 $a['klinikkategori'][$ii]['title'] = $row->title;
                 $a['klinikkategori'][$ii]['pertanyaan'] = $row->commentQuestion;
                 $a['klinikkategori'][$ii]['createdBy'] = $row->createdBy;
                 $a['klinikkategori'][$ii]['author'] = $row->kontributor;
                 $a['klinikkategori'][$ii]['sid'] = $row->sumber;
                 $a['klinikkategori'][$ii]['source'] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row->kontributor, 'fixedTitle');
                 $a['klinikkategori'][$ii]['publishedDate'] = date("d/m/Y", strtotime($row->publishedDate));
                 $a['klinikkategori'][$ii]['existence'] = '<div style="float:left;padding:2px;margin: 1px 10px 10px 0px;"><a href="">' . $txt_existence . '</a></div>';
             }
         }
     }
     echo Zend_Json::encode($a);
 }
Example #30
-1
 function aturanpakaiAction()
 {
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $rowset = $tblCatalog->fetchRow("shortTitle='aturan-pakai' AND profileGuid='kutu_signup'");
     $this->view->title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedTitle');
     $this->view->content = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedContent');
     $this->view->identity = 'Aturan Pakai';
 }