Exemple #1
0
 function poll($aData)
 {
     $voteid = isset($aData['poll']) ? $aData['poll'] : '';
     $id = $aData['id'] ? $aData['id'] : '';
     $tblPolliP = new Pandamp_Modules_Misc_Poll_Model_PollIp();
     $ip_result = $tblPolliP->fetchRow("ip='" . Pandamp_Lib_Formater::getRealIpAddr() . "' AND pollGuid='" . $id . "'");
     if (!isset($ip_result)) {
         $rowIp = $tblPolliP->fetchNew();
         $rowIp->dateOfPoll = date("Y-m-d H:i:s");
         $rowIp->ip = Pandamp_Lib_Formater::getRealIpAddr();
         $rowIp->voteId = $voteid;
         $rowIp->pollGuid = $id;
         $rowIp->save();
         if ($voteid) {
             $tblPoll = new Pandamp_Modules_Misc_Poll_Model_Poll();
             $rowPoll = $tblPoll->find($id)->current();
             if ($rowPoll) {
                 $rowPoll->voters = $rowPoll->voters + 1;
                 $rowPoll->save();
             }
             $tblOption = new Pandamp_Modules_Misc_Option_Model_Option();
             $rowOption = $tblOption->fetchRow("guid='{$voteid}' AND pollGuid='{$id}'");
             if ($rowOption) {
                 $rowOption->hits = $rowOption->hits + 1;
                 $rowOption->save();
             }
         }
     }
 }
 function viewResultAction()
 {
     $time_start = microtime(true);
     $query = $this->_getParam('query') ? $this->_getParam('query') : '';
     $a = array();
     $querynum = $query . ' profile:(kutu_peraturan OR kutu_peraturan_kolonial OR kutu_rancangan_peraturan OR kutu_putusan)';
     $a['query'] = $query;
     $indexingEngine = Pandamp_Search::manager();
     $hits = $indexingEngine->find($query, 0, 1);
     $num = Pandamp_Lib_Formater::findCatalog($querynum);
     //$num = $hits->response->numFound;
     $limit = 20;
     $a['totalCount'] = $num;
     $a['limit'] = $limit;
     $ii = 0;
     if ($a['totalCount'] == 0) {
         $a['catalogs'][0]['guid'] = 'XXX';
         $a['catalogs'][0]['title'] = "No Data";
         $a['catalogs'][0]['subTitle'] = "";
         $a['catalogs'][0]['createdDate'] = '';
         $a['catalogs'][0]['modifiedDate'] = '';
     }
     $this->view->aData = $a;
     $this->view->query = $query;
     $this->view->hits = $hits;
     $time_end = microtime(true);
     $time = $time_end - $time_start;
     $this->view->time = round($time, 2);
 }
Exemple #3
0
 public function addRating($catalogGuid, array $data)
 {
     if (!isset($catalogGuid)) {
         return 0;
     }
     $whiteList = array('guid', 'userid', 'ip', 'counter', 'value');
     $addData = array();
     foreach ($data as $key => $value) {
         if (in_array($key, $whiteList)) {
             $addData[$key] = $value;
         }
     }
     if (empty($addData)) {
         return 0;
     }
     $where = $this->getAdapter()->quoteInto('guid = ?', $catalogGuid);
     $row = $this->fetchRow($where);
     if ($row) {
         // check ip
         if ($row->ip == Pandamp_Lib_Formater::getRealIpAddr()) {
             return 0;
         }
         $row->counter = $row->counter += 1;
         $row->value = $row->value += $addData['value'];
         $id = $this->update(array('counter' => $row->counter, 'value' => $row->value), $where);
     } else {
         $id = $this->insert($addData);
     }
     if ((int) $id == 0) {
         return 0;
     }
     return $id;
 }
 function viewResultAction()
 {
     $time_start = microtime(true);
     $query = $this->_getParam('query') ? $this->_getParam('query') : '';
     $category = $this->_getParam('category') ? $this->_getParam('category') : '';
     $a = array();
     if ($category) {
         $querynum = $query . ' profile:klinik status:99 kategoriklinik:' . $category;
     } else {
         $querynum = $query . ' profile:klinik status:99';
     }
     $a['query'] = $query;
     $indexingEngine = Pandamp_Search::manager();
     $hits = $indexingEngine->find($query, 0, 1);
     $num = Pandamp_Lib_Formater::findCatalog($querynum);
     $limit = 20;
     $a['totalCount'] = $num;
     $a['limit'] = $limit;
     $ii = 0;
     if ($a['totalCount'] == 0) {
         $a['catalogs'][0]['guid'] = 'XXX';
         $a['catalogs'][0]['title'] = "No Data";
         $a['catalogs'][0]['subTitle'] = "";
         $a['catalogs'][0]['createdDate'] = '';
         $a['catalogs'][$ii]['modifiedDate'] = '';
     }
     $this->view->aData = $a;
     $this->view->query = $query;
     $this->view->ct = $category;
     $this->view->hits = $hits;
     $time_end = microtime(true);
     $time = $time_end - $time_start;
     $this->view->time = round($time, 2);
 }
 public function fetchCommentAction()
 {
     $start = $this->_getParam('start') ? $this->_getParam('start') : 0;
     $end = $this->_getParam('limit') ? $this->_getParam('limit') : 10;
     $modelComment = new Pandamp_Modules_Extension_Comment_Model_Comment();
     $decorator = new Pandamp_BeanContext_Decorator($modelComment);
     $rowset = $decorator->fetchCommentAsEntity($start, $end);
     $num_rows = $modelComment->getNumOfComment();
     $gShort = new Pandamp_Controller_Action_Helper_GetCatalogShortTitle();
     $a = array();
     $a['totalCount'] = $num_rows;
     $ii = 0;
     if ($a['totalCount'] != 0) {
         foreach ($rowset as $row) {
             $a['comment'][$ii]['guid'] = $row->getId();
             $a['comment'][$ii]['title'] = $row->getTitle();
             $a['comment'][$ii]['description'] = $row->getComment();
             $a['comment'][$ii]['user_email'] = $row->getEmail();
             $a['comment'][$ii]['guid_article'] = $row->getobjectId();
             $a['comment'][$ii]['shortarticle'] = $gShort->getCatalogShortTitle($row->getobjectId());
             $a['comment'][$ii]['createdby'] = $row->getName();
             $a['comment'][$ii]['ip'] = $row->getIp() != 0 ? $row->getIp() : '-';
             $a['comment'][$ii]['createdDate'] = Pandamp_Lib_Formater::get_date($row->getDate());
             $a['comment'][$ii]['status'] = $row->getPublished();
             $ii++;
         }
     }
     if ($a['totalCount'] == 0) {
         $a['comment'][0]['guid'] = 'XXX';
         $a['comment'][0]['title'] = "No Data";
         $a['comment'][0]['description'] = "-";
         $a['comment'][0]['createdDate'] = '';
     }
     echo Zend_Json::encode($a);
 }
Exemple #6
0
 public function shortenAction()
 {
     //$ip = $_SERVER['REMOTE_ADDR'];
     //A new URL to make short
     $f = new Zend_Filter_StripTags();
     $url = $this->_request->getPost('url');
     //strip off the %0A
     $url = trim(preg_replace('/%0A/', '', $url));
     //see if the url is in the db if it is return the id
     $shortid = $this->db->fetchCol("select * from urls where url = ?", $url);
     $return;
     $config = Zend_Registry::getInstance();
     $sh = $config->get('configuration');
     if (isset($shortid[0])) {
         $hex = dechex($shortid[0]);
         $short = $sh->siteroot . $hex;
         $return = array('shorturl' => $short);
     } else {
         //if not insert then return the id
         $data = array('url' => $url, 'createdate' => date("Y-m-d h:i:s"), 'remoteip' => Pandamp_Lib_Formater::getRealIpAddr());
         $insert = $this->db->insert('urls', $data);
         $id = $this->db->lastInsertId('urls', 'id');
         $hex = dechex($id);
         $short = $sh->siteroot . $hex;
         $return = array('shorturl' => $short);
     }
     $this->_helper->json->sendJson($return);
 }
 public function fetchEmailsInFolderAction()
 {
     $tblQueue = new Pandamp_Modules_Misc_Email_Model_Queue();
     $rowset = $tblQueue->fetchAll();
     $a = array();
     $a['totalCount'] = count($rowset);
     $i = 0;
     if ($a['totalCount'] != 0) {
         foreach ($rowset as $row) {
             $a['email'][$i]['qid'] = $row->newsletterQID;
             $a['email'][$i]['sender'] = $row->sender;
             $a['email'][$i]['recepientMail'] = $row->recepientMail;
             $a['email'][$i]['recepientName'] = $row->recepientName;
             $a['email'][$i]['subject'] = $row->subject;
             $a['email'][$i]['SendDate'] = Pandamp_Lib_Formater::get_date($row->SendDate);
             $i++;
         }
     }
     if ($a['totalCount'] == 0) {
         $a['email'][0]['qid'] = '';
         $a['email'][0]['sender'] = '';
         $a['email'][0]['recepientMail'] = '';
         $a['email'][0]['recepientName'] = '';
         $a['email'][0]['subject'] = '';
         $a['email'][0]['SendDate'] = '';
     }
     echo Zend_Json::encode($a);
 }
Exemple #8
0
 public function indexAction()
 {
     $url = $this->getRequest()->getParam('url');
     $xmlString = '<?xml version="1.0" standalone="yes"?><response></response>';
     $xml = new SimpleXMLElement($xmlString);
     if (strlen($url) < 1) {
         $xml->addChild('status', 'failed no url passed');
     } else {
         $shortid = $this->db->fetchCol("select * from urls where url = ?", $url);
         $config = Zend_Registry::getInstance();
         $sh = $config->get('configuration');
         if ($shortid[0]) {
             $hex = dechex($shortid[0]);
             $short = $sh->siteroot . $hex;
         } else {
             //if not insert then return the id
             $data = array('url' => $url, 'createdate' => date("Y-m-d h:i:s"), 'remoteip' => Pandamp_Lib_Formater::getRealIpAddr());
             $insert = $this->db->insert('urls', $data);
             $id = $this->db->lastInsertId('urls', 'id');
             $hex = dechex($id);
             $short = $sh->siteroot . $hex;
         }
         $xml->addChild('holurl', $short);
         $xml->addChild('status', 'success');
     }
     $out = $xml->asXML();
     //This returns the XML xmlreponse should be key value pairs
     $this->getResponse()->setHeader('Content-Type', 'text/xml')->setBody($out);
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
 }
 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);
 }
Exemple #10
0
 static function thumb_exists($thumbnail)
 {
     $pos = strpos($thumbnail, "://");
     if ($pos === false) {
         return file_exists($thumbnail);
     } else {
         return Pandamp_Lib_Formater::url_exists($thumbnail);
     }
 }
 static function imageDocumentType($type, $catalogGuid, $relatedGuid = NULL)
 {
     $registry = Zend_Registry::getInstance();
     $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
     $cdn = $config->getOption('cdn');
     $sDir = $cdn['static']['images'];
     switch ($type) {
         case 'pdf':
             $type = '<img src="' . $sDir . '/file_type/pdf.gif">';
             break;
         case 'doc':
             $type = '<img src="' . $sDir . '/file_type/doc.gif">';
             break;
         case 'xls':
             $type = '<img src="' . $sDir . '/file_type/xls.gif">';
             break;
         case 'html':
         case 'htm':
             $type = '<img src="' . $sDir . '/file_type/html.gif">';
             break;
         case 'avi':
         case 'mpg':
         case 'mpeg':
         case 'flv':
         case 'mp3':
             $type = '<img src="' . $sDir . '/file_type/prefs.gif">';
             break;
         case 'gif':
             //                                $sDir = ROOT_URL.'/uploads/images';
             if (Pandamp_Lib_Formater::thumb_exists($sDir . "/" . $relatedGuid . "/tn_" . $catalogGuid . ".gif")) {
                 $thumb = $sDir . "/" . $relatedGuid . "/tn_" . $catalogGuid . ".gif";
             }
             if (!isset($thumb)) {
                 $thumb = $sDir . "/file_type/image_new.gif";
             }
             $screenshot = "<img src=\"" . $thumb . "\" />";
             $type = $screenshot;
             break;
         case 'jpg':
         case 'jpeg':
             //                                $sDir = ROOT_URL.'/uploads/images';
             if (Pandamp_Lib_Formater::thumb_exists($sDir . "/" . $relatedGuid . "/tn_" . $catalogGuid . ".jpg")) {
                 $thumb = $sDir . "/" . $relatedGuid . "/tn_" . $catalogGuid . ".jpg";
             }
             if (!isset($thumb)) {
                 $thumb = $sDir . "/file_type/jpg.gif";
             }
             $screenshot = "<img src=\"" . $thumb . "\" />";
             $type = $screenshot;
             break;
         default:
             $type = '<img src="' . $sDir . '/file_type/txt.gif">';
     }
     return $type;
 }
Exemple #12
0
 public function invoiceAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->getHelper('viewRenderer')->setNoRender(TRUE);
     $tblUser = new App_Model_Db_Table_User();
     $rowUser = $tblUser->fetchRow("kopel='00015'");
     $temptime = strtotime($rowUser->createdDate);
     //$temptime = time();
     $temptime = Pandamp_Lib_Formater::DateAdd('d', 5, $temptime);
     $rowInvoice = strftime('%Y-%m-%d', $temptime);
     Pandamp_Debug::manager($rowInvoice);
 }
 function detailAction()
 {
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $page = $this->_getParam('page') ? $this->_getParam('page') : '';
     // get current ip address
     $ip = Pandamp_Lib_Formater::getRealIpAddr();
     $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);
     if (isset($rowset)) {
         $modelAsset = new Pandamp_Modules_Dms_Catalog_Model_AssetSetting();
     }
     $decorator = new Pandamp_BeanContext_Decorator($modelAsset);
     $rowAsset = $decorator->getAssetNumOfClickAsEntity($catalogGuid);
     $data = array('guid' => $catalogGuid, 'application' => 'ASSET', 'part' => 'MOST_READABLE_TICKER', 'valueType' => $ip, 'valueInt' => 1, 'valueText' => 'TICKER');
     $asset = $modelAsset->addCounterAsset($rowset->getId(), $data);
     $title = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedTitle');
     $subtitle = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedSubTitle');
     $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()))];
     // get votes
     $modelVote = new Pandamp_Modules_Extension_Vote_Model_Vote();
     $decorator = new Pandamp_BeanContext_Decorator($modelVote);
     $rowRate = $decorator->getRatingAsEntity($catalogGuid, $ip);
     $val = $rowRate ? $rowRate->getValue() : 0;
     $counter = $rowRate ? $rowRate->getCounter() : 0;
     if ($counter < 1) {
         $count = 0;
     } else {
         $count = $counter;
         //how many votes total
     }
     $current_rating = $val;
     $tense = $count == 1 ? "vote" : "votes";
     //plural form votes/vote
     $rating = @number_format($current_rating / $count, 1);
     $drawrating = '(' . $count . ' ' . $tense . ', average: ' . $rating . ' out of 5)';
     $this->view->title = $title;
     $this->view->subtitle = $subtitle;
     $this->view->content = $content;
     $this->view->description = $description;
     $this->view->author = $author;
     $this->view->date = $hari . ', ' . date("d F Y", strtotime($rowset->getPublishedDate()));
     $this->view->numOfClick = isset($rowAsset) ? $rowAsset->getValueInt() : 0;
     $this->view->drawrating = $drawrating;
     $this->view->catalogGuid = $catalogGuid;
     $this->view->page = $page;
 }
 function fetchBannerAction()
 {
     $start = $this->_getParam('start') ? $this->_getParam('start') : 0;
     $end = $this->_getParam('limit') ? $this->_getParam('limit') : 10;
     $tblPBanner = new Pandamp_Modules_Misc_Banner_Model_Powerban();
     $rowset = $tblPBanner->fetchAll(null, 'createdDate DESC', $end, $start);
     $a = array();
     $a['totalCount'] = $tblPBanner->countPowerban();
     $now = date('Y-m-d H:i:s');
     $ii = 0;
     if ($a['totalCount'] != 0) {
         foreach ($rowset as $row) {
             $a['banner'][$ii]['guid'] = $row->guid;
             $a['banner'][$ii]['title'] = $row->name;
             $a['banner'][$ii]['source'] = $row->src;
             $a['banner'][$ii]['type'] = $row->type;
             $a['banner'][$ii]['alt'] = $row->alt;
             $a['banner'][$ii]['url'] = $row->url;
             $a['banner'][$ii]['createdby'] = $row->createdBy;
             $a['banner'][$ii]['modifiedby'] = $row->modifiedBy;
             $a['banner'][$ii]['createdDate'] = Pandamp_Lib_Formater::get_date($row->createdDate);
             if ($now <= $row->publishedDate && $row->status == 99) {
                 $status = "publish_y";
             } else {
                 if (($now <= $row->expiredDate || $row->expiredDate == '0000-00-00 00:00:00') && $row->status == 99) {
                     $status = "publish_g";
                 } else {
                     if ($now > $row->expiredDate && $row->status == 99) {
                         $status = "publish_r";
                     } else {
                         if ($row->status == 0) {
                             $status = "publish_x";
                         } else {
                             if ($row->status == -1) {
                                 $status = "disabled";
                             }
                         }
                     }
                 }
             }
             $a['banner'][$ii]['status'] = $status;
             $ii++;
         }
     }
     if ($a['totalCount'] == 0) {
         $a['banner'][0]['guid'] = 'XXX';
         $a['banner'][0]['title'] = "No Data";
         $a['banner'][0]['source'] = "-";
         $a['banner'][0]['createdDate'] = '';
     }
     echo Zend_Json::encode($a);
 }
 function klideAction()
 {
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $ip = Pandamp_Lib_Formater::getRealIpAddr();
     $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);
     if ($rowset) {
         $modelAsset = new Pandamp_Modules_Dms_Catalog_Model_AssetSetting();
         $decorator = new Pandamp_BeanContext_Decorator($modelAsset);
         $rowAsset = $decorator->getAssetNumOfClickAsEntity($catalogGuid);
         $data = array('guid' => $catalogGuid, 'application' => 'ASSET', 'part' => 'MOST_READABLE_CLINIC', 'valueType' => $ip, 'valueInt' => 1, 'valueText' => 'klinik');
         $asset = $modelAsset->addCounterAsset($rowset->getId(), $data);
         $title = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedCommentTitle');
         $question = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedCommentQuestion');
         $category = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedKategoriKlinik');
         $answer = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedAnswer');
         $author = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedSelectNama');
         $source = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedSelectMitra');
         $this->view->title = isset($title) ? $title : '';
         $this->view->question = isset($question) ? $question : '';
         $this->view->category = isset($category) ? $category : '';
         $this->view->answer = isset($answer) ? $answer : '';
         $this->view->author = isset($author) ? $author : '';
         $this->view->source = isset($source) ? $source : '';
         $this->view->createdBy = $rowset->getCreatedBy();
         $this->view->publishedDate = Pandamp_Lib_Formater::get_date($rowset->getPublishedDate());
         $this->view->numofclick = isset($rowAsset) ? $rowAsset->getValueInt() : 0;
         // get votes
         $modelVote = new Pandamp_Modules_Extension_Vote_Model_Vote();
         $decorator = new Pandamp_BeanContext_Decorator($modelVote);
         $rowRate = $decorator->getRatingAsEntity($catalogGuid, $ip);
         $val = $rowRate ? $rowRate->getValue() : 0;
         $counter = $rowRate ? $rowRate->getCounter() : 0;
         if ($counter < 1) {
             $count = 0;
         } else {
             $count = $counter;
             //how many votes total
         }
         $current_rating = $val;
         $tense = $count == 1 ? "vote" : "votes";
         //plural form votes/vote
         $rating = @number_format($current_rating / $count, 1);
         $drawrating = '(' . $count . ' ' . $tense . ', average: ' . $rating . ' out of 5)';
         $this->view->drawrating = $drawrating;
         $this->view->catalogGuid = $catalogGuid;
     }
 }
Exemple #16
0
 function klideAction()
 {
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $ip = Pandamp_Lib_Formater::getRealIpAddr();
     $rowset = App_Model_Show_Catalog::show()->getCatalogByGuid($catalogGuid);
     if ($rowset) {
         $rowAsset = App_Model_Show_AssetSetting::show()->getAssetNumOfClick($catalogGuid);
         $data = array('guid' => $catalogGuid, 'application' => 'ASSET', 'part' => 'MOST_READABLE_CLINIC', 'valueType' => $ip, 'valueInt' => 1, 'valueText' => 'klinik');
         $asset = App_Model_Show_AssetSetting::show()->addCounterAsset($rowset['guid'], $data);
         $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedCommentTitle');
         $question = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedCommentQuestion');
         $category = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedKategoriKlinik');
         $answer = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedAnswer');
         $author = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedSelectNama');
         $source = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedSelectMitra');
         $dateDiff = new Pandamp_Lib_DateDiff();
         $this->view->title = isset($title) ? $title : '';
         $this->view->question = isset($question) ? $question : '';
         $this->view->category = isset($category) ? $category : '';
         $this->view->answer = isset($answer) ? $answer : '';
         $this->view->author = isset($author) ? $author : '';
         $this->view->source = isset($source) ? $source : '';
         $this->view->createdBy = $rowset['createdBy'];
         //$this->view->publishedDate	= Pandamp_Lib_Formater::get_date($rowset['publishedDate']);
         //$this->view->publishedDate	= $dateDiff->ago(strftime('%Y-%m-%d %H:%M:%S',strtotime($rowset['publishedDate'])));
         $this->view->publishedDate = date("d/m/Y", strtotime($rowset['publishedDate']));
         $this->view->createdDate = $dateDiff->ago(strftime('%Y-%m-%d %H:%M:%S', strtotime($rowset['createdDate'])));
         $this->view->numofclick = isset($rowAsset) ? $rowAsset['valueInt'] : 0;
         // get votes
         $rowRate = App_Model_Show_Vote::show()->getRating($catalogGuid, $ip);
         $val = $rowRate ? $rowRate['value'] : 0;
         $counter = $rowRate ? $rowRate['counter'] : 0;
         if ($counter < 1) {
             $count = 0;
         } else {
             $count = $counter;
             //how many votes total
         }
         $current_rating = $val;
         $tense = $count == 1 ? "vote" : "votes";
         //plural form votes/vote
         $rating = @number_format($current_rating / $count, 1);
         $drawrating = '(' . $count . ' ' . $tense . ', average: ' . $rating . ' out of 5)';
         $this->view->drawrating = $drawrating;
         $this->view->catalogGuid = $catalogGuid;
     }
 }
Exemple #17
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();
 }
Exemple #18
0
 public function save($aData)
 {
     $aResult = array();
     $parent = $aData['parent_id'];
     $objectId = $aData['guid'];
     $name = $aData['name'];
     $email = $aData['email'];
     $title = $aData['title'];
     $comment = $aData['comment'];
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $userId = $auth->getIdentity()->kopel;
     } else {
         $userId = 0;
     }
     $modelComment = new App_Model_Db_Table_Comment();
     $catalogGuid = $modelComment->addComment(array('parent' => $parent, 'object_id' => $objectId, 'userid' => $userId, 'name' => $name, 'email' => $email, 'title' => $title, 'comment' => $comment, 'ip' => Pandamp_Lib_Formater::getRealIpAddr(), 'date' => new Zend_Db_Expr('NOW()')));
     return $catalogGuid;
 }
Exemple #19
0
 function detailAction()
 {
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     // get current ip address
     $ip = Pandamp_Lib_Formater::getRealIpAddr();
     $rowset = App_Model_Show_Catalog::show()->getCatalogByGuid($catalogGuid);
     if (isset($rowset)) {
         $rowAsset = App_Model_Show_AssetSetting::show()->getAssetNumOfClick($catalogGuid);
     }
     $data = array('guid' => $catalogGuid, 'application' => 'ASSET', 'part' => 'MOST_READABLE_TICKER', 'valueType' => $ip, 'valueInt' => 1, 'valueText' => 'TICKER');
     $asset = App_Model_Show_AssetSetting::show()->addCounterAsset($rowset['guid'], $data);
     $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedTitle');
     $subtitle = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedSubTitle');
     $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']))];
     // get votes
     $rowRate = App_Model_Show_Vote::show()->getRating($catalogGuid, $ip);
     $val = $rowRate ? $rowRate['value'] : 0;
     $counter = $rowRate ? $rowRate['counter'] : 0;
     if ($counter < 1) {
         $count = 0;
     } else {
         $count = $counter;
         //how many votes total
     }
     $current_rating = $val;
     $tense = $count == 1 ? "vote" : "votes";
     //plural form votes/vote
     $rating = @number_format($current_rating / $count, 1);
     $drawrating = '(' . $count . ' ' . $tense . ', average: ' . $rating . ' out of 5)';
     $this->view->title = $title;
     $this->view->subtitle = $subtitle;
     $this->view->content = $content;
     $this->view->description = $description;
     $this->view->author = $author;
     $this->view->date = $hari . ', ' . date("d F Y", strtotime($rowset['publishedDate']));
     $this->view->numOfClick = isset($rowAsset) ? $rowAsset['valueInt'] : 0;
     $this->view->drawrating = $drawrating;
     $this->view->catalogGuid = $catalogGuid;
 }
 private function uvote($catalogGuid)
 {
     // get current ip address
     $ip = Pandamp_Lib_Formater::getRealIpAddr();
     // get votes
     $rowRate = App_Model_Show_Vote::show()->getRating($catalogGuid, $ip);
     $val = $rowRate ? $rowRate['value'] : 0;
     $counter = $rowRate ? $rowRate['counter'] : 0;
     if ($counter < 1) {
         $count = 0;
     } else {
         $count = $counter;
         //how many votes total
     }
     $current_rating = $val;
     $tense = $count == 1 ? "vote" : "votes";
     //plural form votes/vote
     $rating = @number_format($current_rating / $count, 1);
     $drawrating = '(' . $count . ' ' . $tense . ', average: ' . $rating . ' out of 5)';
     return $drawrating;
 }
Exemple #21
0
 function sendInvoiceToUser($orderId)
 {
     $config = new Zend_Config_Ini(CONFIG_PATH . '/mail.ini', 'mail');
     $siteOwner = "Hukumonline";
     $siteName = $config->mail->sender->support->name;
     $contactEmail = $config->mail->sender->support->email;
     $tblOrder = new App_Model_Db_Table_Order();
     $rowOrder = $tblOrder->find($orderId)->current();
     $userId = $rowOrder->userId;
     $tblUser = new App_Model_Db_Table_User();
     $rowUser = $tblUser->find($userId)->current();
     $userEmail = $rowUser->email;
     $userFullname = $rowUser->fullName;
     $datePurchased = Pandamp_Lib_Formater::get_date($rowOrder->datePurchased);
     if ($rowOrder->paymentMethodNote == "membership") {
         $duedate = date("d/m/y", strtotime($rowOrder->invoiceExpirationDate));
     } else {
         $duedate = "-";
     }
     $message = "Kepada Yth, \r\n{$userFullname}\r\n\r\nBerikut kami beritahukan bahwa Invoice untuk anda sudah dibuat pada tanggal {$datePurchased}.\r\n\r\nDengan metode pembayaran: {$rowOrder->paymentMethod}\r\n\r\nInvoice # {$rowOrder->invoiceNumber}\r\nJumlah tagihan: Rp. {$rowOrder->orderTotal}\r\nJatuh tempo: {$duedate}\r\n\r\nAnda bisa login di Ruang Konsumen untuk melihat status invoice ini atau melakukan pembayaran secara online di " . ROOT_URL . "/store/viewinvoice/orderId/{$orderId}.\r\n\r\nTerima kasih,\r\n\r\nHukumonline\r\n\r\n==============================";
     $this->send($config->mail->sender->support->email, $config->mail->sender->support->name, $userEmail, '', "Hukumonline Invoice: " . $rowOrder->invoiceNumber, $message);
 }
 function visitAction()
 {
     $guid = $this->_getParam('guid');
     $tblPowerban = new Pandamp_Modules_Misc_Banner_Model_Powerban();
     $rowset = $tblPowerban->find($guid);
     if (count($rowset)) {
         $row = $rowset->current();
         $row->visits = $row->visits + 1;
         $gid = $row->save();
         if ($gid) {
             $tblPowerbanVisit = new Pandamp_Modules_Misc_Banner_Statistic_Model_PowerbanStatistik();
             $rowPStatistik = $tblPowerbanVisit->fetchNew();
             $rowPStatistik->bid = $guid;
             $rowPStatistik->host = gethostbyname($_SERVER['HTTP_REFERER']);
             $rowPStatistik->address = Pandamp_Lib_Formater::getRealIpAddr();
             $rowPStatistik->agent = $_SERVER['HTTP_USER_AGENT'];
             $rowPStatistik->datetime = date("Y-m-d h:i:s");
             $rowPStatistik->referer = $_SERVER['HTTP_REFERER'];
             $rowPStatistik->save();
         }
         $this->_redirect($row->url);
     }
 }
 private function uvote($catalogGuid)
 {
     // get current ip address
     $ip = Pandamp_Lib_Formater::getRealIpAddr();
     // get votes
     $modelVote = new Pandamp_Modules_Extension_Vote_Model_Vote();
     $decorator = new Pandamp_BeanContext_Decorator($modelVote);
     $rowRate = $decorator->getRatingAsEntity($catalogGuid, $ip);
     $val = $rowRate ? $rowRate->getValue() : 0;
     $counter = $rowRate ? $rowRate->getCounter() : 0;
     if ($counter < 1) {
         $count = 0;
     } else {
         $count = $counter;
         //how many votes total
     }
     $current_rating = $val;
     $tense = $count == 1 ? "vote" : "votes";
     //plural form votes/vote
     $rating = @number_format($current_rating / $count, 1);
     $drawrating = '(' . $count . ' ' . $tense . ', average: ' . $rating . ' out of 5)';
     return $drawrating;
 }
Exemple #24
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;
     }
 }
Exemple #25
0
 function printpdfinvoiceAction()
 {
     $orderId = $this->_getParam('orderId');
     $this->_helper->layout->disableLayout();
     $items = App_Model_Show_Order::show()->getOrderDetail($orderId);
     // create new PDF document
     $pdf = new Pandamp_Lib_Pdf(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     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: layanan@hukumonline.com");
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Nihki Prihadi');
     $pdf->SetTitle('TCPDF Example');
     $pdf->SetSubject('TCPDF Tutorial');
     $pdf->SetKeywords('TCPDF, PDF, example, tutorial');
     $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', '', 10, '', true);
     // add a page
     $pdf->AddPage();
     // create address box
     $pdf->CreateTextBox('Kepada Yth,', 0, 25, 80, 10, 10, 'B');
     $pdf->CreateTextBox($items[0]['taxCompany'], 0, 30, 80, 10, 10);
     if ($items[0]['orderStatus'] == 3) {
         $status = "LUNAS";
     } else {
         $status = "BELUM LUNAS";
     }
     $html = '
         <table>
         <tr>
             <td style="color:red;font-size:3em;">' . $status . '</td>
         </tr>
         </table>
         ';
     $pdf->writeHTMLCell($w = 0, $h = 0, 90, 30, $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true);
     $pdf->CreateTextBox('ATTN: ' . $this->_user->fullName, 0, 35, 80, 10, 10);
     $pdf->CreateTextBox($items[0]['taxAddress'], 0, 40, 80, 10, 10);
     $pdf->CreateTextBox($items[0]['taxCity'] . '-' . $items[0]['taxZip'], 0, 45, 80, 10, 10);
     $modelProvince = new App_Model_Db_Table_Province();
     $rowProvince = $modelProvince->find($items[0]['taxProvince'])->current();
     if ($rowProvince) {
         $pdf->CreateTextBox($rowProvince->pname, 0, 50, 80, 10, 10);
     }
     // invoice title / number
     $pdf->CreateTextBox('Invoice #' . $items[0]['invoiceNumber'], 0, 65, 120, 20, 16);
     // date, order ref
     $pdf->CreateTextBox('Date: ' . Pandamp_Lib_Formater::get_date($items[0]['datePurchased']), 0, 75, 0, 10, 10, '', 'R');
     $pdf->CreateTextBox('Order ref.: #' . $items[0]['orderId'], 0, 80, 0, 10, 10, '', 'R');
     // list headers
     $pdf->CreateTextBox('Quantity', 0, 95, 20, 10, 10, 'B', 'C');
     $pdf->CreateTextBox('Product or service', 20, 95, 90, 10, 10, 'B');
     $pdf->CreateTextBox('Price', 110, 95, 30, 10, 10, 'B', 'R');
     $pdf->CreateTextBox('Amount', 140, 95, 30, 10, 10, 'B', 'R');
     $pdf->Line(20, 105, 195, 105);
     $currY = 108;
     $total = 0;
     for ($iCart = 0; $iCart < count($items); $iCart++) {
         $pdf->CreateTextBox($items[$iCart]['qty'], 0, $currY, 20, 10, 10, '', 'C');
         $html2 = '
         <table>
         <tr>
             <td>' . $items[$iCart]['documentName'] . '</td>
         </tr>
         </table>
         ';
         $pdf->writeHTMLCell(90, 10, 40, $currY, $html2, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true);
         //	$pdf->CreateTextBox($items[$iCart]['documentName'], 20, $currY, 90, 10, 10, '');
         $pdf->CreateTextBox('Rp ' . number_format($items[$iCart]['price'], 0, ',', '.'), 110, $currY, 30, 10, 10, '', 'R');
         $amount = $items[$iCart]['price'] * $items[$iCart]['qty'];
         $pdf->CreateTextBox('Rp ' . number_format($items[$iCart]['finalPrice'], 0, ',', '.'), 140, $currY, 30, 10, 10, '', 'R');
         $currY = $currY + 15;
         $total = $total + $amount;
     }
     $pdf->Line(195, $currY + 8, 130, $currY + 8);
     // output the total row
     $pdf->CreateTextBox('Sub Total ', 5, $currY + 7, 135, 10, 10, 'B', 'R');
     $pdf->CreateTextBox('Rp ' . number_format($total, 2, ',', '.'), 140, $currY + 7, 30, 10, 10, 'B', 'R');
     if ($items[0]['discount'] > 0) {
         $pdf->CreateTextBox('Disc ', 5, $currY + 12, 135, 10, 10, 'B', 'R');
         $pdf->CreateTextBox($items[0]['discount'] . '%', 140, $currY + 12, 30, 10, 10, 'B', 'R');
         $pdf->CreateTextBox('Grand Total ', 5, $currY + 22, 135, 10, 10, 'B', 'R');
         $grandTotal = $result['subTotal'] - $result['disc'] / 100 * $result['subTotal'];
         $total = $total - $items[0]['discount'] / 100 * $total;
         $pdf->CreateTextBox('Rp ' . number_format($total, 2, ',', '.'), 140, $currY + 22, 30, 10, 10, 'B', 'R');
     } else {
         $pdf->CreateTextBox('Grand Total ', 5, $currY + 12, 135, 10, 10, 'B', 'R');
         $pdf->CreateTextBox('Rp ' . number_format($total, 2, ',', '.'), 140, $currY + 12, 30, 10, 10, 'B', 'R');
     }
     // some payment instructions or information
     $pdf->setXY(20, $currY + 50);
     $pdf->SetFont(PDF_FONT_NAME_MAIN, '', 10);
     $ft = '
         <b>Pembayaran lewat transfer bank</b><br/>
         1. Bank BNI 46, Cabang Dukuh Bawah, No. 0073957339, a/n PT Justika Siar Publika<br/>
         2. Bank BCA, Cabang Pembantu Menara Imperium, No. 221-3028-707, a/n PT Justika Siar Publika<br><br><br>
         Jika anda sudah melakukan pembayaran, mohon konfirmasikan pembayaran anda lewat situs kami di ' . ROOT_URL . '/payment/confirm atau email ke layanan@hukumonline.com<br>
         atau fax ke (021) 8370-1826<br><br>
         Terima kasih atas kepercayaan anda atas hukumonline.com.<br><br>
         Salam,<br>
         hukumonline.com
         ';
     $pdf->MultiCell(175, 10, $ft, 0, 'L', 0, 1, '', '', true, null, true);
     //Close and output PDF document
     $pdf->Output('Hukumonline_EStore_Report.pdf', 'I');
 }
 function completeAction()
 {
     $formater = new Pandamp_Core_Hol_User();
     $defaultCurrency = 'Rp';
     $kopel = $this->_request->getParam('kopel');
     $method = $this->_request->getParam('method');
     $packageId = $this->_request->getParam('packageId');
     $paymentSubscription = $this->_request->getParam('payment');
     $tblPaymentSetting = new App_Model_Db_Table_PaymentSetting();
     $usdIdrEx = $tblPaymentSetting->fetchRow(" settingKey= 'USDIDR'");
     $currencyValue = $usdIdrEx->settingValue;
     $rowTaxRate = $tblPaymentSetting->fetchRow("settingKey='taxRate'");
     $taxRate = $rowTaxRate->settingValue;
     $tblUser = new App_Model_Db_Table_User();
     $rowUser = $tblUser->find($kopel)->current();
     /*
         	$modelGroup = new Kutu_Core_Orm_Table_Group();
         	$row = $modelGroup->fetchRow("id=".$this->_user->packageId);
     if ($row->name == "free") {
     	$rowUser->periodeId = 2;
     	$rowUser->save();
     }
     */
     $this->view->rowUser = $rowUser;
     // discount
     $disc = $formater->checkPromoValidation('Disc', $packageId, $rowUser->promotionId, $paymentSubscription);
     $total = $formater->checkPromoValidation('Total', $packageId, $rowUser->promotionId, $paymentSubscription);
     $tblPackage = new App_Model_Db_Table_Package();
     $rowPackage = $tblPackage->fetchRow("packageId={$packageId}");
     $this->view->rowPackage = $rowPackage;
     $tblOrder = new App_Model_Db_Table_Order();
     $row = $tblOrder->fetchNew();
     $row->userId = $kopel;
     if ($this->getRequest()->getPost()) {
         $value = $this->getRequest()->getPost();
         $row->taxNumber = $value['taxNumber'];
         $row->taxCompany = $value['taxCompany'];
         $row->taxAddress = $value['taxAddress'];
         $row->taxCity = $value['taxCity'];
         $row->taxZip = $value['taxZip'];
         $row->taxProvince = $value['taxProvince'];
         $row->taxCountryId = $value['taxCountry'];
         $row->paymentMethod = $method;
     }
     $row->datePurchased = date('YmdHis');
     $row->paymentMethodNote = "membership";
     if ($method == "nsiapay") {
         $row->orderStatus = 8;
     } else {
         $row->orderStatus = 1;
         //pending
     }
     $row->currency = $defaultCurrency;
     $row->currencyValue = $currencyValue;
     $row->orderTotal = $total;
     $row->ipAddress = Pandamp_Lib_Formater::getRealIpAddr();
     $orderId = $row->save();
     $rowJustInserted = $tblOrder->find($orderId)->current();
     $rowJustInserted->invoiceNumber = date('Ymd') . '.' . $orderId;
     $temptime = time();
     $temptime = Pandamp_Lib_Formater::DateAdd('d', 5, $temptime);
     $rowJustInserted->discount = $disc;
     $rowJustInserted->invoiceExpirationDate = strftime('%Y-%m-%d', $temptime);
     $rowJustInserted->save();
     $this->view->invoiceNumber = $rowJustInserted->invoiceNumber;
     $this->view->datePurchased = $rowJustInserted->datePurchased;
     $tblOrderDetail = new App_Model_Db_Table_OrderDetail();
     $rowDetail = $tblOrderDetail->fetchNew();
     $rowDetail->orderId = $orderId;
     $rowDetail->itemId = $rowPackage->packageId;
     $modelGroup = new App_Model_Db_Table_Group();
     $row = $modelGroup->fetchRow("id={$packageId}");
     $group = "Subsciption for Member " . ucwords(strtolower($row->name)) . " " . $paymentSubscription . " Months";
     $this->view->packageId = $packageId;
     $this->view->paymentSubscription = $paymentSubscription;
     $this->view->itemName = $group;
     $rowDetail->documentName = $group;
     $rowDetail->price = $total;
     $numOfUsers = $tblUser->getUserCount($rowUser->kopel);
     $this->view->numOfUsers = $numOfUsers;
     $this->view->grandtotal = $total;
     $this->view->method = $method;
     $this->view->orderId = $orderId;
     $this->view->total = $rowPackage->charge;
     $rowDetail->qty = $numOfUsers;
     $rowDetail->finalPrice = $total;
     $rowDetail->save();
     $data = $this->_request->getParams();
     $this->view->data = $data;
     $modDir = $this->getFrontController()->getModuleDirectory();
     require_once $modDir . '/models/Store/Mailer.php';
     $mod = new Membership_Model_Store_Mailer();
     switch (strtolower($method)) {
         case 'manual':
         case 'bank':
             $mod->sendBankInvoiceToUser($orderId);
             break;
         case 'nsiapay':
             $mod->sendInvoiceToUser($orderId);
             break;
     }
 }
Exemple #27
0
 public function uploadFile_old($aDataCatalog, $relatedGuid)
 {
     if ($aDataCatalog['profileGuid'] != 'kutu_doc') {
         throw new Zend_Exception('Profile does not match profile for FILE');
     }
     if (empty($relatedGuid)) {
         throw new Zend_Exception('No RELATED GUID specified!');
     }
     $id = 1 + ($aDataCatalog['id'] - 1);
     for ($x = 1; $x < $id; $x++) {
         $title = $aDataCatalog['fixedTitle' . $x] ? $aDataCatalog['fixedTitle' . $x] : 'No-Title';
         $registry = Zend_Registry::getInstance();
         $files = $registry->get('files');
         if (isset($files['uploadedFile' . $x])) {
             $file = $files['uploadedFile' . $x];
             $this->checkTitle($aDataCatalog['fixedTitle' . $x]);
         }
         $type = $aDataCatalog['fixedType' . $x] ? $aDataCatalog['fixedType' . $x] : '';
         if ($type == 'file') {
             $relatedType = 'RELATED_FILE';
         } elseif ($type == 'image') {
             $relatedType = 'RELATED_IMAGE';
         } elseif ($type == 'video') {
             $relatedType = 'RELATED_VIDEO';
         }
         $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
         $gman = new Pandamp_Core_Guid();
         $catalogGuid = isset($aDataCatalog['guid']) && !empty($aDataCatalog['guid']) ? $aDataCatalog['guid'] : $gman->generateGuid();
         $folderGuid = isset($aDataCatalog['folderGuid']) && !empty($aDataCatalog['folderGuid']) ? $aDataCatalog['folderGuid'] : '';
         $where = $tblCatalog->getAdapter()->quoteInto('guid=?', $catalogGuid);
         if ($tblCatalog->fetchRow($where)) {
             $rowCatalog = $tblCatalog->find($catalogGuid)->current();
             $rowCatalog->shortTitle = isset($aDataCatalog['shortTitle']) ? $aDataCatalog['shortTitle'] : $rowCatalog->shortTitle;
             $rowCatalog->publishedDate = isset($aDataCatalog['publishedDate']) ? $aDataCatalog['publishedDate'] : $rowCatalog->publishedDate;
             $rowCatalog->expiredDate = isset($aDataCatalog['expiredDate']) ? $aDataCatalog['expiredDate'] : $rowCatalog->expiredDate;
             $rowCatalog->status = isset($aDataCatalog['status']) ? $aDataCatalog['status'] : $rowCatalog->status;
         } else {
             $rowCatalog = $tblCatalog->fetchNew();
             $rowCatalog->guid = $catalogGuid;
             $rowCatalog->shortTitle = isset($aDataCatalog['shortTitle']) ? $aDataCatalog['shortTitle'] : '';
             $rowCatalog->profileGuid = $aDataCatalog['profileGuid'];
             $rowCatalog->publishedDate = isset($aDataCatalog['publishedDate']) ? $aDataCatalog['publishedDate'] : '0000-00-00 00:00:00';
             $rowCatalog->expiredDate = isset($aDataCatalog['expiredDate']) ? $aDataCatalog['expiredDate'] : '0000-00-00 00:00:00';
             $rowCatalog->createdBy = isset($aDataCatalog['username']) ? $aDataCatalog['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($aDataCatalog['status']) ? $aDataCatalog['status'] : 0;
         }
         $catalogGuid = $rowCatalog->save();
         $rowsetCatalogAttribute = $rowCatalog->findDependentRowsetCatalogAttribute();
         if (isset($files['uploadedFile' . $x])) {
             if (isset($files['uploadedFile' . $x]['name']) && !empty($files['uploadedFile' . $x]['name'])) {
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'docSystemName', strtoupper(str_replace(' ', '_', $file['name'])));
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'docOriginalName', strtoupper(str_replace(' ', '_', $file['name'])));
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'docSize', $file['size']);
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'docMimeType', $file['type']);
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'fixedTitle', $title);
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'docViewOrder', 0);
                 if ($type == 'file') {
                     $sDir = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $relatedGuid;
                     if (is_dir($sDir)) {
                         move_uploaded_file($file['tmp_name'], $sDir . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                     } else {
                         if (mkdir($sDir)) {
                             move_uploaded_file($file['tmp_name'], $sDir . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                         } else {
                             move_uploaded_file($file['tmp_name'], ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                         }
                     }
                 } elseif ($type == 'image') {
                     $sDir = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'images';
                     $file = $files['uploadedFile' . $x]['name'];
                     $ext = explode(".", $file);
                     $ext = strtolower(array_pop($ext));
                     if ($ext == "jpg" || $ext == "jpeg" || $ext == "gif" || $ext == "png") {
                         $target_path = $sDir . DIRECTORY_SEPARATOR . $catalogGuid . "." . $ext;
                         if (is_dir($target_path)) {
                             move_uploaded_file($files['uploadedFile' . $x]['tmp_name'], $sDir . DIRECTORY_SEPARATOR . $catalogGuid . "." . $ext);
                             chmod($target_path, 0644);
                             Pandamp_Lib_Formater::createthumb($target_path, $sDir . '/tn_' . $catalogGuid . "." . $ext, 130, 130);
                         } else {
                             move_uploaded_file($files['uploadedFile' . $x]['tmp_name'], ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . $catalogGuid . "." . $ext);
                             chmod($target_path, 0644);
                             Pandamp_Lib_Formater::createthumb($target_path, $sDir . '/tn_' . $catalogGuid . "." . $ext, 130, 130);
                         }
                     }
                 } elseif ($type == 'video') {
                     $sDir = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'video' . DIRECTORY_SEPARATOR . $relatedGuid;
                     if (is_dir($sDir)) {
                         move_uploaded_file($file['tmp_name'], $sDir . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                     } else {
                         if (mkdir($sDir)) {
                             move_uploaded_file($file['tmp_name'], $sDir . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                         } else {
                             move_uploaded_file($file['tmp_name'], ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                         }
                     }
                 }
             }
         }
         $this->relateTo($catalogGuid, $relatedGuid, $relatedType);
         $indexingEngine = Pandamp_Search::manager();
         $indexingEngine->indexCatalog($relatedGuid);
     }
 }
 private function saveOrder($cart, $method)
 {
     $defaultCurrency = 'Rp';
     $tblPaymentSetting = new Pandamp_Modules_Payment_Setting_Model_PaymentSetting();
     $usdIdrEx = $tblPaymentSetting->fetchRow(" settingKey= 'USDIDR'");
     $currencyValue = $usdIdrEx->settingValue;
     $rowTaxRate = $tblPaymentSetting->fetchRow("settingKey='taxRate'");
     $taxRate = $rowTaxRate->settingValue;
     $auth = Zend_Auth::getInstance();
     $userId = $auth->getIdentity()->guid;
     $tblOrder = new Pandamp_Modules_Payment_Order_Model_Order();
     $row = $tblOrder->fetchNew();
     $row->userId = $userId;
     //get value from post var (store/checkout.phtml)
     if ($this->getRequest()->getPost()) {
         $value = $this->getRequest()->getPost();
         $row->taxNumber = $value['taxNumber'];
         $row->taxCompany = $value['taxCompany'];
         $row->taxAddress = $value['taxAddress'];
         $row->taxCity = $value['taxCity'];
         $row->taxZip = $value['taxZip'];
         $row->taxProvince = $value['taxProvince'];
         $row->taxCountryId = $value['taxCountry'];
         $row->paymentMethod = $method;
     }
     $row->datePurchased = date('YmdHis');
     //        if ($method == "nsiapay") {
     //        	$row->orderStatus=8;
     //        }
     //        else {
     //        $row->orderStatus=1; //pending
     //        }
     $row->orderStatus = 1;
     //pending
     $row->currency = $defaultCurrency;
     $row->currencyValue = $currencyValue;
     $row->orderTotal = $cart['grandTotal'];
     $row->orderTax = $cart['taxAmount'];
     $row->ipAddress = Pandamp_Lib_Formater::getRealIpAddr();
     $orderId = $row->save();
     $rowJustInserted = $tblOrder->find($orderId)->current();
     //		$rowJustInserted->invoiceNumber = date('Ymd') . '.' . $orderId;
     $tblNumber = new Pandamp_Modules_Misc_Number_Model_GenerateNumber();
     $rowset = $tblNumber->fetchRow();
     $num = $rowset->invoice;
     $totdigit = 5;
     $num = strval($num);
     $jumdigit = strlen($num);
     $noinvoice = str_repeat("0", $totdigit - $jumdigit) . $num;
     $rowset->invoice = $rowset->invoice += 1;
     $tblNumber->update(array('invoice' => $rowset->invoice));
     $rowJustInserted->invoiceNumber = $noinvoice;
     $rowJustInserted->save();
     $this->view->invoiceNumber = $rowJustInserted->invoiceNumber;
     $this->view->datePurchased = $rowJustInserted->datePurchased;
     $tblOrderDetail = new Pandamp_Modules_Payment_OrderDetail_Model_OrderDetail();
     for ($iCart = 0; $iCart < count($cart['items']); $iCart++) {
         $rowDetail = $tblOrderDetail->fetchNew();
         $itemId = $cart['items'][$iCart]['itemId'];
         $rowDetail->orderId = $orderId;
         $rowDetail->itemId = $itemId;
         $rowDetail->documentName = $cart['items'][$iCart]['item_name'];
         $rowDetail->price = $cart['items'][$iCart]['itemPrice'];
         $itemPrice = $rowDetail->price;
         @($rowDetail->tax = ($cart['grandTotal'] - $cart['subTotal']) / $cart['subTotal'] * 100);
         $rowDetail->qty = $cart['items'][$iCart]['qty'];
         $rowDetail->finalPrice = $cart['items'][$iCart]['itemTotal'];
         $rowDetail->save();
     }
     //[TODO] MUST ALSO INSERT/UPDATE KutuUserFinance
     return $orderId;
 }
Exemple #29
0
 public function payconfirmyesAction()
 {
     $this->_helper->viewRenderer->setNoRender(TRUE);
     //print_r($this->_request->getParams());
     $id = $this->_request->getParam('orderId');
     $tblOrder = new App_Model_Db_Table_Order();
     $tblHistory = new App_Model_Db_Table_OrderHistory();
     $tblConfirm = new App_Model_Db_Table_PaymentConfirmation();
     $rowOrder = $tblOrder->find($id)->current();
     if ($rowOrder->paymentMethodNote == 'membership') {
         $oldUser = App_Model_Show_User::show()->getUserById($rowOrder->userId);
         $oldpackage = App_Model_Show_AroGroup::show()->getUserGroup($oldUser['packageId']);
         $newGroup = App_Model_Show_AroGroup::show()->getUserGroup($rowOrder->note);
         $notes = date("Y-m-d h:i:s") . " - Changed package " . $oldpackage['name'] . " TO " . $newGroup['name'];
         $notes = $oldUser['notes'] ? $oldUser['notes'] . "\n" . $notes : $notes;
         $dataUser = array('packageId' => $rowOrder->note, 'notes' => $notes, 'modifiedDate' => date("Y-m-d h:i:s"), 'modifiedBy' => Zend_Auth::getInstance()->getIdentity()->username);
         $modelUser = new App_Model_Db_Table_User();
         $dataUserDetail = array('userId' => $oldUser['kopel'], 'packageId' => $oldUser['packageId'], 'promotionId' => $oldUser['promotionId'], 'educationId' => $oldUser['educationId'], 'expenseId' => $oldUser['expenseId'], 'paymentId' => $oldUser['paymentId'], 'businessTypeId' => $oldUser['businessTypeId'], 'periodeId' => $oldUser['periodeId'], 'activationDate' => $oldUser['activationDate'], 'createdDate' => $oldUser['createdDate'], 'createdBy' => $oldUser['createdBy'], 'modifiedDate' => $oldUser['modifiedDate'], 'modifiedBy' => $oldUser['modifiedBy'], 'isActive' => $oldUser['isActive'], 'isContact' => $oldUser['isContact']);
         $modelUserDetail = new App_Model_Db_Table_UserDetail();
         $modelUserDetail->insert($dataUserDetail);
         $acl = Pandamp_Acl::manager();
         $acl->deleteUser($oldUser['username']);
         $acl->addUser($oldUser['username'], $newGroup['name']);
         $tblInvoice = new App_Model_Db_Table_Invoice();
         $where = $tblInvoice->getAdapter()->quoteInto("uid=?", $rowOrder->userId);
         $rowInvoice = $tblInvoice->fetchRow($where);
         if ($rowInvoice) {
             $rowInvoice->invoiceConfirmDate = date("Y-m-d");
             $rowInvoice->isPaid = 'Y';
             // get expiration date
             $temptime = time();
             $temptime = Pandamp_Lib_Formater::DateAdd('m', $oldUser['paymentId'], $temptime);
             $rowInvoice->expirationDate = strftime('%Y-%m-%d', $temptime);
             $rowInvoice->save();
             $dataUser['periodeId'] = 3;
         }
         $modelUser->update($dataUser, "kopel='" . $rowOrder->userId . "'");
     }
     //select payment date from paymentconfirmation
     $date = $tblConfirm->fetchAll("orderId = " . $id . " AND confirmed = 0");
     $data['paymentDate'] = $date[0]->paymentDate;
     //update order
     $data['orderStatus'] = 3;
     $tblOrder->update($data, "orderId = " . $id);
     //update paymentconfirmation
     $dataConfirm['confirmed'] = 1;
     $tblConfirm->update($dataConfirm, "orderId = " . $id);
     //add history
     $dataHistory = $tblHistory->fetchNew();
     //history data
     $dataHistory['orderId'] = $id;
     $dataHistory['orderStatusId'] = 3;
     $dataHistory['dateCreated'] = date('Y-m-d');
     $dataHistory['userNotified'] = 1;
     $dataHistory['note'] = 'confirmed';
     $dataHistory->save();
     //mailer
     //$this->Mailer($id, 'user-confirm', 'user');
     $mod = new App_Model_Store_Mailer();
     $mod->sendReceiptToUser($id, ucwords($date[0]->paymentMethod));
     //redirect to confirmation page
     $this->_redirect($this->view->serverUrl() . '/' . $this->view->getLanguage() . '/store/confirm');
 }
Exemple #30
0
 public function reIndexCatalog()
 {
     gc_enable();
     $this->emptyIndex();
     $time_start = microtime(true);
     $solr =& $this->_solr;
     $formater = new Pandamp_Lib_Formater();
     $title = new Pandamp_Controller_Action_Helper_GetCatalogTitle();
     //		$tbl = new Pandamp_Core_Orm_Table_Catalog();
     //		$rowset = $tbl->fetchAll(); //("profileGuid='Pandamp_peraturan'");
     $query = "SELECT * FROM KutuCatalog";
     $results = $this->_conn->query($query);
     $rowset = $results->fetchAll(PDO::FETCH_OBJ);
     $documents = array();
     $rowCount = count($rowset);
     for ($iCount = 0; $iCount < $rowCount; $iCount++) {
         $row = $rowset[$iCount];
         //			if($iCount == 100)
         //				break;
         //			echo 'urutan: '.$iCount .'<br>';
         $nextRow = $rowset[$iCount + 1];
         //			echo 'current guid: '.$row->guid.'  '.'next guid: '.$nextRow->guid.'<br>';
         if ($row->modifiedBy !== $row->createdBy) {
             $modified = '<font color=red>[modifiedBy:<i>' . $row->modifiedBy . '</i>]</font>&nbsp;';
         } else {
             $modified = '';
         }
         echo '<li><span style="font:11px verdana,arial,helvetica,sans-serif;">[urutan:' . $iCount . ']&nbsp;indexing:<font color=green>' . $title->getCatalogTitle($row->guid) . '</font>[current guid: ' . $row->guid . '  ' . 'next guid: ' . $nextRow->guid . '][author:<i>' . $row->createdBy . '</i>]&nbsp;' . $modified . '[createdDate:<i>' . $formater->get_date($row->createdDate) . '</i>]</span></li>';
         $documents[] = $this->_createSolrDocument($row);
         if ($iCount % 500 == 0) {
             try {
                 $solr->addDocuments($documents);
                 $solr->commit();
                 //					$solr->optimize();
                 $documents = array();
             } catch (Exception $e) {
                 //					echo "Error occured when processing record starting from number: ". ($iCount - 1000) . ' to '.$iCount.' '.$row->guid;
                 $log->err($e->getMessage());
                 throw new Zend_Exception($e->getMessage());
                 //					echo $e->getMessage().'<br>';
             }
         }
         flush();
     }
     echo '</ul></div></td></tr></table>';
     try {
         $solr->addDocuments($documents);
         $solr->commit();
         //			$solr->optimize();
     } catch (Exception $e) {
         $log->err($e->getMessage());
         throw new Zend_Exception($e->getMessage());
         //			echo $e->getMessage().'<br>';
     }
     $time_end = microtime(true);
     $time = $time_end - $time_start;
     //		echo'<br>WAKTU EKSEKUSI: '. $time;
     //		$log->info("WAKTU EKSEKUSI: ". $time." indexing catalog ".$iCount." dari ".$rowCount ." ".$username);
     echo '<br><br><span style="font:11px verdana,arial,helvetica,sans-serif;color:#00FF00">WAKTU EKSEKUSI: ' . $time . '<br>indexing catalog ' . $iCount . ' dari ' . $rowCount . '</span>';
     // log to assetSetting
     $tblAssetSetting = new App_Model_Db_Table_AssetSetting();
     $rowAsset = $tblAssetSetting->fetchRow("application='INDEX CATALOG'");
     if ($rowAsset) {
         $rowAsset->valueText = "Update {$rowCount} indexing-catalog at " . date("Y-m-d H:i:s") . $username;
         $rowAsset->valueInt = $rowAsset->valueInt + 1;
     } else {
         $gman = new Pandamp_Core_Guid();
         $catalogGuid = $gman->generateGuid();
         $rowAsset = $tblAssetSetting->fetchNew();
         $rowAsset->guid = $catalogGuid;
         $rowAsset->application = "INDEX CATALOG";
         $rowAsset->part = "KUTU";
         $rowAsset->valueType = "INDEX";
         $rowAsset->valueInt = 0;
         $rowAsset->valueText = $rowCount . " Indexing catalog at " . date("Y-m-d H:i:s") . $username;
     }
     $rowAsset->save();
 }