Beispiel #1
1
 protected function _postDelete()
 {
     $registry = Zend_Registry::getInstance();
     $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
     $cdn = $config->getOption('cdn');
     //find related docs and delete them
     $tblRelatedItem = new App_Model_Db_Table_RelatedItem();
     $rowsetRelatedDocs = $tblRelatedItem->fetchAll("relatedGuid='{$this->relatedGuid}' AND relateAs IN ('RELATED_FILE','RELATED_IMAGE','RELATED_VIDEO')");
     if (count($rowsetRelatedDocs)) {
         foreach ($rowsetRelatedDocs as $rowRelatedDoc) {
             $systemname = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowRelatedDoc->itemGuid, 'docSystemName');
             $parentGuid = $rowRelatedDoc->relatedGuid;
             $sDir1 = $cdn['static']['dir']['images'] . DIRECTORY_SEPARATOR . $systemname;
             $sDir2 = $cdn['static']['dir']['images'] . DIRECTORY_SEPARATOR . $parentGuid . DIRECTORY_SEPARATOR . $systemname;
             //$sDir1 = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.$systemname;
             //$sDir2 = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'images'.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 . ".gif")) {
                 unlink($sDir . "/" . $systemname . ".gif");
             }
             if (file_exists($sDir . "/tn_" . $systemname . ".gif")) {
                 unlink($sDir . "/tn_" . $systemname . ".gif");
             }
             if (file_exists($sDir . "/" . $systemname . ".jpg")) {
                 unlink($sDir . "/" . $systemname . ".jpg");
             }
             if (file_exists($sDir . "/tn_" . $systemname . ".jpg")) {
                 unlink($sDir . "/tn_" . $systemname . ".jpg");
             }
             if (file_exists($sDir . "/" . $systemname . ".jpeg")) {
                 unlink($sDir . "/" . $systemname . ".jpeg");
             }
             if (file_exists($sDir . "/tn_" . $systemname . ".jpeg")) {
                 unlink($sDir . "/tn_" . $systemname . ".jpeg");
             }
             if (file_exists($sDir . "/" . $systemname . ".png")) {
                 unlink($sDir . "/" . $systemname . ".png");
             }
             if (file_exists($sDir . "/tn_" . $systemname . ".png")) {
                 unlink($sDir . "/tn_" . $systemname . ".png");
             }
             if (file_exists($sDir2 . "/" . $systemname . ".gif")) {
                 unlink($sDir2 . "/" . $systemname . ".gif");
             }
             if (file_exists($sDir2 . "/tn_" . $systemname . ".gif")) {
                 unlink($sDir2 . "/tn_" . $systemname . ".gif");
             }
             if (file_exists($sDir2 . "/" . $systemname . ".jpg")) {
                 unlink($sDir2 . "/" . $systemname . ".jpg");
             }
             if (file_exists($sDir2 . "/tn_" . $systemname . ".jpg")) {
                 unlink($sDir2 . "/tn_" . $systemname . ".jpg");
             }
             if (file_exists($sDir2 . "/" . $systemname . ".jpeg")) {
                 unlink($sDir2 . "/" . $systemname . ".jpeg");
             }
             if (file_exists($sDir2 . "/tn_" . $systemname . ".jpeg")) {
                 unlink($sDir2 . "/tn_" . $systemname . ".jpeg");
             }
             if (file_exists($sDir2 . "/" . $systemname . ".png")) {
                 unlink($sDir2 . "/" . $systemname . ".png");
             }
             if (file_exists($sDir2 . "/tn_" . $systemname . ".png")) {
                 unlink($sDir2 . "/tn_" . $systemname . ".png");
             }
             $tblCatalog = new App_Model_Db_Table_Catalog();
             $rowCatalog = $tblCatalog->find($rowRelatedDoc->itemGuid)->current();
             $rowCatalog->delete();
         }
     }
 }
 public function getCatalogRelation($catalogGuid)
 {
     $relatedItemDb = new App_Model_Db_Table_RelatedItem();
     $relatedItem = $relatedItemDb->fetchAll("relatedGuid='{$catalogGuid}' AND relateAs IN ('RELATED_OTHER','RELATED_ISSUE','RELATED_Clinic')");
     if (count($relatedItem) > 0) {
         return $relatedItem;
     }
     return;
 }
Beispiel #3
0
 public function getLegalBasis($catalogGuid)
 {
     $relatedItemDb = new App_Model_Db_Table_RelatedItem();
     $relatedItems = $relatedItemDb->fetchAll("relatedGuid='{$catalogGuid}' AND relateAs='RELATED_BASE'");
     if (count($relatedItems) > 0) {
         return $relatedItems;
     }
     return;
 }
 public function getImplementingRegulations($catalogGuid)
 {
     $relatedItemDb = new App_Model_Db_Table_RelatedItem();
     $relatedItems = $relatedItemDb->fetchAll("itemGuid='{$catalogGuid}' AND relateAs='RELATED_BASE'");
     if (count($relatedItems) > 0) {
         return $relatedItems;
     }
     return;
 }
Beispiel #5
0
 function dasarhukumAction()
 {
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $tblRelatedItem = new App_Model_Db_Table_RelatedItem();
     $where = "relatedGuid='{$catalogGuid}' AND relateAs='RELATED_CLINIC_BASE'";
     $rowsetRelatedItem = $tblRelatedItem->fetchAll($where);
     $num_rows = count($rowsetRelatedItem);
     $this->view->numberOfRows = $num_rows;
     $this->view->rowsetRelatedItem = $rowsetRelatedItem;
 }
 function deletehistoryAction()
 {
     $req = $this->getRequest();
     $itemGuid = $req->getParam('itemGuid') ? $req->getParam('itemGuid') : 'XXX';
     $relatedGuid = $req->getParam('relatedGuid') ? $req->getParam('relatedGuid') : 'XXX';
     $relateAs = $req->getParam('relateAs') ? $req->getParam('relateAs') : 'XXX';
     $tblRelatedItem = new App_Model_Db_Table_RelatedItem();
     $tblRelatedItem->delete("itemGuid='{$itemGuid}' AND relatedGuid='{$relatedGuid}' AND relateAs='{$relateAs}'");
     exit;
 }
Beispiel #7
0
 public function getChildHistory($guid, $parent)
 {
     $helper = new Pandamp_Core_Hol_Relation();
     $tblRelatedItem = new App_Model_Db_Table_RelatedItem();
     $h1 = $tblRelatedItem->fetchAll("relatedGuid='{$guid}' AND relateAs IN ('ISROOT','AMEND','REPEAL','ESTABLISH')");
     if (count($h1) > 0) {
         $data1 = array();
         $content1 = 0;
         foreach ($h1 as $h1story) {
             $data1[$content1]['itemGuid'] = $h1story->itemGuid;
             $data1[$content1]['relatedGuid'] = $h1story->relatedGuid;
             $data1[$content1]['relateAs'] = $h1story->relateAs;
             $data1[$content1]['parent'] = $parent;
             $content1++;
         }
     }
     $h2 = $tblRelatedItem->fetchAll("itemGuid='{$guid}' AND relateAs IN ('ISROOT','AMEND','REPEAL','ESTABLISH')");
     if (count($h2) > 0) {
         $data2 = array();
         $content2 = 0;
         foreach ($h2 as $h) {
             $data2[$content2]['itemGuid'] = $h->relatedGuid;
             $data2[$content2]['relatedGuid'] = $h->relatedGuid;
             $data2[$content2]['relateAs'] = $h->relateAs;
             $data2[$content2]['parent'] = $parent;
             $content2++;
         }
         if (count($h1) > 0) {
             $merge = array_merge($data1, $data2);
             $merge = $helper->findperaturanyear($merge, $parent);
             return $merge;
         }
         return $helper->findperaturanyear($data2, $parent);
     }
     if (isset($data1)) {
         return $helper->findperaturanyear($data1, $parent);
     }
 }
Beispiel #8
0
 function _getNodes($node, $relateAs = 'RELATED_ITEM')
 {
     $a = array();
     $tblRelatedItem = new App_Model_Db_Table_RelatedItem();
     $tblCatalogAttribute = new App_Model_Db_Table_CatalogAttribute();
     $where = "relatedGuid='{$node}' AND relateAs='{$relateAs}'";
     $rowsetRelatedItem = $tblRelatedItem->fetchAll($where);
     foreach ($rowsetRelatedItem as $row) {
         $aTmp2['node'] = $row->itemGuid;
         $aTmp2['nodeLeft'] = $row->itemGuid;
         $aTmp2['nodeRight'] = $node;
         $aTmp2['description'] = $row->description;
         $aTmp2['relationType'] = $row->relationType;
         $where2 = "catalogGuid='{$row->itemGuid}' AND attributeGuid='fixedTitle'";
         $rowCatalogAttribute = $tblCatalogAttribute->fetchRow($where2);
         if (isset($rowCatalogAttribute->value)) {
             $aTmp2['title'] = $rowCatalogAttribute->value;
         } else {
             $aTmp2['title'] = 'No-Title';
         }
         $where2 = "catalogGuid='{$row->itemGuid}' AND attributeGuid='fixedSubTitle'";
         $rowCatalogAttribute = $tblCatalogAttribute->fetchRow($where2);
         if (isset($rowCatalogAttribute->value)) {
             $aTmp2['subTitle'] = $rowCatalogAttribute->value;
         } else {
             $aTmp2['subTitle'] = 'No-Title';
         }
         $where2 = "catalogGuid='{$row->itemGuid}' AND attributeGuid='fixedDate'";
         $rowCatalogAttribute = $tblCatalogAttribute->fetchRow($where2);
         if (isset($rowCatalogAttribute->value)) {
             $aTmp2['fixedDate'] = $rowCatalogAttribute->value;
         } else {
             $aTmp2['fixedDate'] = '';
         }
         array_push($a, $aTmp2);
     }
     $where = "itemGuid='{$node}' AND relateAs='{$relateAs}'";
     $rowsetRelatedItem = $tblRelatedItem->fetchAll($where);
     foreach ($rowsetRelatedItem as $row) {
         $aTmp2['node'] = $row->relatedGuid;
         $aTmp2['nodeLeft'] = $node;
         $aTmp2['nodeRight'] = $row->relatedGuid;
         $aTmp2['description'] = $row->description;
         $aTmp2['relationType'] = $row->relationType;
         $where2 = "catalogGuid='{$row->relatedGuid}' AND attributeGuid='fixedTitle'";
         $rowCatalogAttribute = $tblCatalogAttribute->fetchRow($where2);
         if (isset($rowCatalogAttribute->value)) {
             $aTmp2['title'] = $rowCatalogAttribute->value;
         } else {
             $aTmp2['title'] = 'No-Title';
         }
         $where2 = "catalogGuid='{$row->relatedGuid}' AND attributeGuid='fixedSubTitle'";
         $rowCatalogAttribute = $tblCatalogAttribute->fetchRow($where2);
         if (isset($rowCatalogAttribute->value)) {
             $aTmp2['subTitle'] = $rowCatalogAttribute->value;
         } else {
             $aTmp2['subTitle'] = 'No-Title';
         }
         $where2 = "catalogGuid='{$row->relatedGuid}' AND attributeGuid='fixedDate'";
         $rowCatalogAttribute = $tblCatalogAttribute->fetchRow($where2);
         if (isset($rowCatalogAttribute->value)) {
             $aTmp2['fixedDate'] = $rowCatalogAttribute->value;
         } else {
             $aTmp2['fixedDate'] = '';
         }
         array_push($a, $aTmp2);
     }
     return $a;
 }
Beispiel #9
0
 public function relateTo($itemGuid, $relatedGuid, $as = 'RELATED_ITEM', $valRelation = 0)
 {
     $tblRelatedItem = new App_Model_Db_Table_RelatedItem();
     if (empty($itemGuid)) {
         throw new Zend_Exception('Can not relate to empty GUID');
     }
     $rowsetRelatedItem = $tblRelatedItem->find($itemGuid, $relatedGuid, $as);
     if (count($rowsetRelatedItem) > 0) {
         $row = $rowsetRelatedItem->current();
         $row->valueIntRelation = $valRelation;
     } else {
         $row = $tblRelatedItem->createNew();
         $row->itemGuid = $itemGuid;
         $row->relatedGuid = $relatedGuid;
         $row->relateAs = $as;
         $row->valueIntRelation = $valRelation;
     }
     $row->save();
 }
Beispiel #10
0
 /**
  * Find images
  */
 public function findimageAction()
 {
     $request = $this->getRequest();
     $pageIndex = $request->getParam('pageIndex', 1);
     $perPage = $request->getParam('perpage');
     $perPage = $perPage ? $perPage : 20;
     $offset = ($pageIndex - 1) * $perPage;
     $params = null;
     $exp = array();
     $params = $request->getParam('q');
     if (null != $params) {
         $exp = rawurldecode(base64_decode($params));
         $exp = Zend_Json::decode($exp);
     } else {
         $params = rawurlencode(base64_encode(Zend_Json::encode($exp)));
     }
     $indexingEngine = Pandamp_Search::manager();
     if ($exp['keyword'] == '*' || $exp['keyword'] == '') {
         $exp['keyword'] = '*:*';
     }
     $hits = $indexingEngine->find($exp['keyword'] . ' mimeType:image* profile:kutu_doc', $offset, $perPage, 'createdDate desc');
     $solrNumFound = count($hits->response->docs);
     $num_rows = $hits->response->numFound;
     $paginator = Zend_Paginator::factory($num_rows);
     $cache = Pandamp_Cache::getInstance();
     if ($cache) {
         Zend_Paginator::setCache($cache);
     }
     $paginator->setCacheEnabled(true);
     $paginator->setCurrentPageNumber($pageIndex);
     $paginator->setItemCountPerPage($perPage);
     $paginator = get_object_vars($paginator->getPages('Sliding'));
     $paginatorOptions = array('path' => $this->view->url(array('lang' => $this->view->getLanguage()), 'search_catalog_findimage'), 'itemLink' => null == $params ? 'page-%d' : 'page-%d?perpage=' . $perPage . '&q=' . $params);
     /**
      * Support searching from other page
      * For example, search files at adding set page
      */
     if (isset($exp['format']) && $exp['format'] == 'JSON') {
         $this->_helper->getHelper('viewRenderer')->setNoRender();
         $this->_helper->getHelper('layout')->disableLayout();
         $config = Pandamp_Application::getOption('cdn');
         if ($solrNumFound > $perPage) {
             $numRowset = $perPage;
         } else {
             $numRowset = $solrNumFound;
         }
         $res = array('files' => array(), 'paginator' => $this->view->paginator()->slide($paginator, $paginatorOptions));
         for ($i = 0; $i < $numRowset; $i++) {
             $row = $hits->response->docs[$i];
             $fs = 'thumbnail_';
             //$filename = $row->systemName; <-- metode ini kadang suka kosong
             $filename = $this->view->getCatalogAttribute($row->id, 'docSystemName');
             $fn = pathinfo($filename, PATHINFO_FILENAME);
             $ext = pathinfo($filename, PATHINFO_EXTENSION);
             //$ext = strtolower($ext);
             if (substr($fn, 0, 2) !== 'lt') {
                 $fn = $row->id;
                 $fs = 'tn_';
                 $filename = $fn . '.' . strtolower($ext);
             }
             $title = $this->view->getCatalogAttribute($fn, 'fixedTitle');
             $relDb = new App_Model_Db_Table_RelatedItem();
             $rel = $relDb->fetchRow("itemGuid='" . $fn . "' AND relateAs='RELATED_IMAGE'");
             $relGuid = isset($rel->relatedGuid) ? $rel->relatedGuid : '';
             if (is_array(@getimagesize($config['static']['url']['images'] . '/' . $relGuid . '/' . $fs . $filename))) {
                 $url = $config['static']['url']['images'] . '/' . $relGuid . '/' . $fs . $filename;
             } elseif (is_array(@getimagesize($config['static']['url']['images'] . '/' . $fs . $filename))) {
                 $url = $config['static']['url']['images'] . '/' . $fs . $filename;
             } else {
                 $url = 'http://static.hukumonline.com/frontend/default/images/kaze/karticle-img.jpg';
             }
             //$url = $config['static']['url']['images'].'/'.$rel->relatedGuid.'/'.$rel->itemGuid.'.'.strtolower($ext);
             //$url = $config['static']['url']['images'].'/upload/'.$pd1.'/'.$pd2.'/'.$pd3.'/'.$pd4.'/'.$fn.'_square'.'.'.$ext;
             $res['files'][] = array('id' => isset($fn) ? $fn : '', 'relatedGuid' => isset($relGuid) ? $relGuid : '', 'title' => isset($title) ? $title : '', 'url' => isset($url) ? $url : '');
         }
         $this->getResponse()->setBody(Zend_Json::encode($res));
     }
 }
Beispiel #11
0
 public function otherAction()
 {
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $tblRelatedItem = new App_Model_Db_Table_RelatedItem();
     $where = "relatedGuid='{$catalogGuid}' AND relateAs='RELATED_OTHER'";
     $rowsetRelatedItem = $tblRelatedItem->fetchAll($where);
     $this->view->rowsetRelatedItem = $rowsetRelatedItem;
 }
Beispiel #12
0
 function display_shoppingcart($jcart)
 {
     // JCART ARRAY HOLDS USER CONFIG SETTINGS
     extract($jcart);
     // ASSIGN USER CONFIG VALUES TO POST VARS
     // VALUES ARE HTML NAME ATTRIBUTES FROM THE ADD-TO-CART FORM
     @($item_id = $_POST[$item_id]);
     @($item_qty = ltrim($_POST[$item_qty], '-'));
     // PREVENT QTY FROM BEING NEGATIVE
     @($item_price = ltrim($_POST[$item_price], '-'));
     // PREVENT PRICE FROM BEING NEGATIVE
     @($item_name = $_POST[$item_name]);
     // ADD ITEM
     if (@$_POST[$item_add]) {
         $sanitized_item_id = filter_var($item_id, FILTER_SANITIZE_SPECIAL_CHARS);
         $valid_item_qty = filter_var($item_qty, FILTER_VALIDATE_INT);
         $valid_item_price = filter_var($item_price, FILTER_VALIDATE_FLOAT);
         $sanitized_item_name = filter_var($item_name, FILTER_SANITIZE_SPECIAL_CHARS);
         // VALIDATION
         if (!$valid_item_qty) {
             $error_message = $text['quantity_error'];
         } else {
             if (!$valid_item_price) {
                 //[CUSTOM]
                 if (empty($valid_item_price)) {
                     $error_message = '<script>alert("This is a Free Item.");</script>';
                 } else {
                     $error_message = $text['price_error'];
                 }
             } else {
                 /*//[CUSTOM]
                 					// check if catalog has documents
                 					$tblRelatedItem = new Kutu_Core_Orm_Table_RelatedItem();
                 					$where = "relatedGuid='$sanitized_item_id' AND relateAs='RELATED_FILE'";
                 					$rowsetRelatedItem = $tblRelatedItem->fetchAll($where);
                 					if(count($rowsetRelatedItem) > 0)
                 					{
                 						//check if the physical FILE is available in uploads directory.
                 						$flagFileFound = true;
                 
                 						foreach($rowsetRelatedItem as $rowRelatedItem)
                 						{
                 							$tblCatalog = new Kutu_Core_Orm_Table_Catalog();
                 					    	$rowsetCatalog = $tblCatalog->find($rowRelatedItem->itemGuid);
                 				
                 							$rowCatalog = $rowsetCatalog->current();
                 				    		$rowsetCatAtt = $rowCatalog->findDependentRowsetCatalogAttribute();
                 
                 					    	$contentType = $rowsetCatAtt->findByAttributeGuid('docMimeType')->value;
                 							$systemname = $rowsetCatAtt->findByAttributeGuid('docSystemName')->value;
                 							$filename = $rowsetCatAtt->findByAttributeGuid('docOriginalName')->value;
                 							
                 							if(true)
                 							{
                 								$parentGuid = $rowRelatedItem->relatedGuid;
                 								$sDir1 = KUTU_ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR.$systemname;
                 								$sDir2 = KUTU_ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR.$parentGuid.DIRECTORY_SEPARATOR.$systemname;
                 
                 								if(file_exists($sDir1))
                 								{
                 									//$flagFileFound = true;
                 								}
                 								else 
                 									if(file_exists($sDir2))
                 									{
                 										//$flagFileFound = true;
                 									}
                 									else 
                 									{
                 										$flagFileFound = false;
                 									}
                 							}
                 						}
                 						
                 						//echo "punya file kok";
                 						//$error_message = '<script>alert("");</script>';
                 						// ADD THE ITEM
                 						if($flagFileFound)
                 						{
                 							$auth =  Zend_Auth::getInstance();
                 							$hasBought = false;
                 							
                 							if($auth->hasIdentity())
                 							{
                 								$bpm = new Kutu_Core_Bpm_Catalog();
                 								$hasBought = $bpm->isBoughtByUser($sanitized_item_id, $auth->getIdentity()->guid);
                 							}
                 							
                 							if($hasBought)
                 							{
                 								$error_message = '<script>alert("You have bought this Item before. Please check your account.");</script>';
                 							}
                 							else
                 								$this->add_item($sanitized_item_id, $valid_item_qty, $valid_item_price, $sanitized_item_name);
                 						}
                 						else
                 							$error_message = '<script>alert("We are Sorry. The document(s) you are requesting is still not complete. Please check back later.");</script>';
                 					}
                 					else
                 					{
                 						$error_message = '<script>alert("We are Sorry. The document(s) you are requesting is still under review. Please check back later.");</script>';
                 					}
                 					*/
                 require_once 'Pandamp/Core/Hol/Catalog.php';
                 $bpmCatalog = new Pandamp_Core_Hol_Catalog();
                 $aReturn = $bpmCatalog->jCartIsItemSellable($sanitized_item_id);
                 if ($aReturn['isError']) {
                     $error_message = '<script>alert("' . $aReturn['message'] . '");</script>';
                 } else {
                     $this->add_item($sanitized_item_id, $valid_item_qty, $valid_item_price, $sanitized_item_name);
                 }
             }
         }
     }
     // REMOVE ITEM
     /*
     GET VAR COMES FROM A LINK, WITH THE ITEM ID TO BE REMOVED IN ITS QUERY STRING
     AFTER AN ITEM IS REMOVED ITS ID STAYS SET IN THE QUERY STRING, PREVENTING THE SAME ITEM FROM BEING ADDED BACK TO THE CART
     SO WE CHECK TO MAKE SURE ONLY THE GET VAR IS SET, AND NOT THE POST VARS
     
     USING POST VARS TO REMOVE ITEMS DOESN'T WORK BECAUSE WE HAVE TO PASS THE ID OF THE ITEM TO BE REMOVED AS THE VALUE OF THE BUTTON
     IF USING AN INPUT WITH TYPE SUBMIT, ALL BROWSERS DISPLAY THE ITEM ID, INSTEAD OF ALLOWING FOR USER FRIENDLY TEXT SUCH AS 'remove'
     IF USING AN INPUT WITH TYPE IMAGE, INTERNET EXPLORER DOES NOT SUBMIT THE VALUE, ONLY X AND Y COORDINATES WHERE BUTTON WAS CLICKED
     CAN'T USE A HIDDEN INPUT EITHER SINCE THE CART FORM HAS TO ENCOMPASS ALL ITEMS TO RECALCULATE TOTAL WHEN A QUANTITY IS CHANGED, WHICH MEANS THERE ARE MULTIPLE REMOVE BUTTONS AND NO WAY TO ASSOCIATE THEM WITH THE CORRECT HIDDEN INPUT
     */
     if (@$_GET['jcart_remove'] && @(!$_POST[$item_add]) && @(!$_POST['jcart_update_cart']) && @(!$_POST['jcart_check_out'])) {
         // ENSURE THE VALUE IS AN INTEGER
         //$rid = intval($_GET['jcart_remove']);
         $rid = $_GET['jcart_remove'];
         // REMOVE THE ITEM
         //die($rid);
         $this->del_item($rid);
     }
     // EMPTY CART
     if (@$_POST['jcart_empty']) {
         $this->empty_cart();
     }
     // UPDATE ALL ITEMS IN CART SINCE VISITOR MAY UPDATE MULTIPLE FIELDS BEFORE CLICKING UPDATE
     // ONLY USED WHEN JAVASCRIPT IS DISABLED
     // WHEN JAVASCRIPT IS ENABLED, THE CART IS UPDATED WHEN AN ITEM QTY IS CHANGED
     if (@$_POST['jcart_update_cart']) {
         // POST VALUE IS AN ARRAY OF ALL ITEM IDs IN THE CART
         $item_ids = $_POST['jcart_item_id'];
         // IF NO ITEM IDs, THE CART IS EMPTY
         if ($item_ids) {
             // POST VALUE IS AN ARRAY OF ALL ITEM QUANTITIES IN THE CART
             // TREAT VALUES AS A STRING FOR VALIDATION
             $item_qtys = implode($_POST['jcart_item_qty']);
             $valid_item_qtys = filter_var($item_qtys, FILTER_VALIDATE_INT);
             // VALIDATION
             // ITEM QTY CAN ONLY BE AN INTEGER OR ZERO
             if (!$valid_item_qtys && $item_qtys !== '0') {
                 $error_message = $text['quantity_error'];
             } else {
                 // THE INDEX OF THE ITEM AND ITS QUANTITY IN THEIR RESPECTIVE ARRAYS
                 $count = 0;
                 // FOR EACH ITEM IN THE CART
                 foreach ($item_ids as $item_id) {
                     // SANITIZE THE ITEM ID
                     $sanitized_item_id = filter_var($item_id, FILTER_SANITIZE_SPECIAL_CHARS);
                     // GET THE ITEM QTY AND DOUBLE-CHECK THAT THE VALUE IS AN INTEGER
                     $update_item_qty = intval($_POST['jcart_item_qty'][$count]);
                     // UPDATE THE ITEM
                     $this->edit_item($sanitized_item_id, $update_item_qty);
                     // INCREMENT INDEX FOR THE NEXT ITEM
                     $count++;
                 }
             }
         }
     }
     // CHECKING POST VALUE AGAINST $text ARRAY FAILS??
     // HAVE TO CHECK AGAINST $jcart ARRAY
     if (@$_POST['jcart_update_item'] == $jcart['text']['update_button']) {
         // SANITIZE THE ITEM ID
         $item_id = $_POST['item_id'];
         $sanitized_item_id = filter_var($item_id, FILTER_SANITIZE_SPECIAL_CHARS);
         // GET THE ITEM QTY AND CHECK THAT THE VALUE IS AN INTEGER
         $item_qty = $_POST['item_qty'];
         $valid_item_qty = filter_var($item_qty, FILTER_VALIDATE_INT);
         // VALIDATION
         // ITEM QTY CAN ONLY BE AN INTEGER, OR ZERO, OR EMPTY
         if (!$valid_item_qty && $item_qty !== '0' && $item_qty !== '') {
             $error_message = $text['quantity_error'];
         } else {
             // UPDATE THE ITEM
             $this->edit_item($sanitized_item_id, $valid_item_qty);
         }
     }
     // OUTPUT THE CART
     // DETERMINE WHICH TEXT TO USE FOR THE NUMBER OF ITEMS IN THE CART
     if ($this->itemcount >= 0) {
         $text['items_in_cart'] = $text['multiple_items'];
     }
     if ($this->itemcount == 1) {
         $text['items_in_cart'] = $text['single_item'];
     }
     // IF THERE'S AN ERROR MESSAGE WRAP IT IN SOME HTML
     if (@$error_message) {
         $error_message = "<p class='jcart-error'>{$error_message}</p>";
     }
     $registry = Zend_Registry::getInstance();
     $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
     $cdn = $config->getOption('cdn');
     $smg = $cdn['static']['images'];
     // DISPLAY THE CART HEADER
     echo "<!-- BEGIN JCART -->\n<div id='jcartshop'>\n";
     echo "<img src='" . $smg . "/shopping_cart_hukumonline.png' />\n";
     echo "<div style='padding-top:5px;'></div>\n";
     echo "<h4>Anda mempunyai <span style='color:#EE1625;'>" . $this->itemcount . "</span>&nbsp;barang di dalam keranjang belanja Anda</h4>\n";
     echo "<p>Berbelanja di hukumonline.com adalah aman. Pesanan Anda akan diproses melalui server yang aman.</p>\n";
     echo "<h5>Lihat Pesanan &raquo; <a href='" . ROOT_URL . "/store/payment/list'>sebelumnya</a></h5>\n";
     echo "<div style='padding-top:15px;'></div>\n";
     echo @$error_message . "\n";
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $coupon = null;
         if (!isset($coupon) && isset($_REQUEST['coupon_code'])) {
             $coupon = $_REQUEST['coupon_code'];
             require_once APPLICATION_PATH . '/models/Db/Table/Promotion.php';
             $promo = new App_Model_Db_Table_Promotion();
             $rowPromo = $promo->find($coupon)->current();
             if (isset($rowPromo)) {
                 $disc = $rowPromo->discount;
             } else {
                 $err = "\r\n                                <div class='box box-error'>\r\n                                Kode Promosi tidak ditemukan\r\n                                </div>\r\n                            ";
                 echo $err . "\n";
             }
         }
     }
     echo "<form method='post' action='" . ROOT_URL . "/store/confirmorder'>\n\n";
     echo "<table cellspacing='0' border='0' cellpadding='0' id='shopping-cart-table' class='data-table box-table shopping-cart'>\n";
     echo "<thead>\n";
     echo "<tr>\n";
     echo "<th rowspan='1' colspan='2' class='a-left' style='padding-left:23px;border-left: 1px solid #cacaca;'>Product Name</th>\n";
     echo "<th class='a-center' colspan='1'>Price</th>\n";
     echo "<th rowspan='1' class='a-center'>Quantity</th>\n";
     echo "<th class='a-center last' colspan='1'>Total</th>\n";
     echo "</tr></thead>" . "\n";
     echo "<tbody>\n";
     // IF ANY ITEMS IN THE CART
     if ($this->itemcount > 0) {
         // DISPLAY LINE ITEMS
         foreach ($this->get_contents() as $item) {
             $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'];
             //					$sDir = ROOT_URL.'/uploads/images';
             $thumb = "";
             require_once APPLICATION_PATH . '/models/Db/Table/RelatedItem.php';
             $modelRelatedItem = new App_Model_Db_Table_RelatedItem();
             $rowsetRelatedItem = $modelRelatedItem->fetchRow("relatedGuid='" . $item['id'] . "' AND relateAs='RELATED_IMAGE'");
             //					$rowsetRelatedItem = App_Model_Show_RelatedItem::show()->getDocumentById($item['id'],'RELATED_IMAGE');
             $itemGuid = isset($rowsetRelatedItem['itemGuid']) ? $rowsetRelatedItem['itemGuid'] : '';
             if (Pandamp_Lib_Formater::thumb_exists($sDir . "/" . $itemGuid . ".jpg")) {
                 $thumb = $sDir . "/" . $itemGuid . ".jpg";
             }
             if (Pandamp_Lib_Formater::thumb_exists($sDir . "/" . $itemGuid . ".gif")) {
                 $thumb = $sDir . "/" . $itemGuid . ".gif";
             }
             if (Pandamp_Lib_Formater::thumb_exists($sDir . "/" . $itemGuid . ".png")) {
                 $thumb = $sDir . "/" . $itemGuid . ".png";
             }
             if ($thumb == "") {
                 $thumb = $smg . "/nothumb.jpg";
             }
             $screenshot = "<img src=\"" . $thumb . "\" width=\"125\" />";
             echo "<tr>\n";
             // ADD THE ITEM ID AS THE INPUT ID ATTRIBUTE
             // THIS ALLOWS US TO ACCESS THE ITEM ID VIA JAVASCRIPT ON QTY CHANGE, AND THEREFORE UPDATE THE CORRECT ITEM
             // NOTE THAT THE ITEM ID IS ALSO PASSED AS A SEPARATE FIELD FOR PROCESSING VIA PHP
             if ($thumb == "") {
                 $screenshot = "";
             } else {
                 echo "<td><a href=''>{$screenshot}</a></td>\n";
             }
             require_once APPLICATION_PATH . '/models/Db/Table/Catalog.php';
             $modelCatalog = new App_Model_Db_Table_Catalog();
             $row = $modelCatalog->fetchRow("guid='" . $item['id'] . "'");
             //$row = App_Model_Show_Catalog::show()->getCatalogByGuid($item['id']);
             echo "<td class='attributes-col'>\n";
             echo "<h5 class='title' style='margin-bottom:5px;'><a href=''>" . $item['info'] . "</a></h5><span style='font-size:11px;'><a href='?jcart_remove=" . $item['id'] . "'>" . $text['remove_link'] . "</a></span><input type='hidden' name='jcart_item_info[ ]' value='" . $item['info'] . "' /><input type='hidden' name='jcart_item_display' value='1' />\n";
             echo "<input type='hidden' name='jcart_item_id[ ]' value='" . $item['id'] . "' />\n";
             echo "</td>\n";
             echo "<td class='a-right'><div class='cart-price'><span class='price'>\n";
             echo $text['currency_symbol'] . number_format($row['price'], 2) . "</span></div><input type='hidden' name='jcart_item_price[ ]' value='" . $item['price'] . "' />\n";
             echo "</td>\n";
             echo "<td class='a-center'>\n";
             echo "<input type='text' size='2' id='jcart-item-id-" . $item['id'] . "' name='jcart_item_qty[ ]' value='" . $item['qty'] . "' style='width:30px;font-size:11px;text-align:center;' />\n";
             echo "</td>\n";
             echo "<td class='a-right last'>\n";
             echo "<div class='cart-price'>\n";
             echo "<span class='price'>" . $text['currency_symbol'] . number_format($item['subtotal'], 2) . "</span>\n";
             echo "</div>\n";
             echo "</td>\n";
             echo "</tr>\n";
         }
     } else {
         echo "<tr><th colspan='5' class='empty'>" . $text['empty_message'] . "</th></tr>\n";
     }
     echo "</tbody></table>\n";
     echo "</form>\n";
     // DISPLAY THE CART FOOTER
     echo "<table style='width:100%;'>\n";
     echo "<tr>\n";
     echo "<td valign='top'>\n";
     echo "<div class='shopping-cart-totals'>\n";
     echo "<table style='border: 1px solid rgb(202, 202, 202); border-width: 0pt 1px 1px; border-style: none solid solid; border-color: -moz-use-text-color rgb(202, 202, 202) rgb(202, 202, 202); width:100%;'>\n";
     echo "<tr>\n";
     echo "<td colspan='2' style='height: 10px;'>\n";
     echo "</td>\n";
     echo "</tr>\n";
     echo "<tr>\n";
     echo "<td style='padding: 0px 0px 0px 10px;' valign='top'>\n";
     echo "<div class='shopping-cart-collaterals'>\n";
     echo "<div class='discount-codes boxs'>";
     echo "<form method='post' action='" . ROOT_URL . "/store/checkout'>";
     echo "<h5>Kode Promosi</h5><p>[optional]</p>";
     echo "<div class='align-left' style='padding-bottom: 5px;'><input type='text' id='coupon_code' name='coupon_code' value='" . $coupon . "'/></div>";
     echo "<div class='align-left'>&nbsp;<input class='form-button-alt' type='submit' value='Apply Coupon' /></div>";
     echo "<div class='clean'></div>";
     echo "</form>";
     echo "</div>";
     echo "</div>";
     echo "</td>\n";
     echo "<td valign='top' style='width:100%;'>\n";
     echo "<div class='shopping-cart-totals'>";
     echo "<table id='shopping-cart-totals-table'>";
     echo "<tfoot>";
     echo "<tr class='grand-total'>";
     echo "<td style='color: rgb(68, 68, 68); text-transform: uppercase;' colspan='2' align='right' valign='middle'><strong>Grand Total</strong></td>";
     echo "<td>:</td>";
     if (isset($disc)) {
         $grandTotal = $this->total - $disc / 100 * $this->total;
     } else {
         $grandTotal = $this->total;
     }
     echo "<td class='ta-right'><strong>" . $text['currency_symbol'] . number_format($grandTotal, 2) . "</strong></td>";
     echo "</tr>";
     echo "</tfoot>";
     echo "<tbody><tr>";
     echo "<td style='color: rgb(68, 68, 68); text-transform: uppercase;' colspan='2' align='right' valign='middle'>" . $text['subtotal'] . "</td>";
     echo "<td>:</td>";
     echo "<td class='ta-right'><span class='price'>" . $text['currency_symbol'] . number_format($this->total, 2) . "</span></td>";
     echo "</tr>";
     if (isset($disc)) {
         echo "<tr>";
         echo "<td style='color: rgb(68, 68, 68); text-transform: uppercase;' colspan='2' align='right' valign='middle'>Disc</td>";
         echo "<td>:</td>";
         echo "<td class='ta-right'><span class='price'>" . $disc . "%</span></td>";
         echo "</tr>";
     }
     echo "</tbody></table>";
     echo "</div>";
     echo "</td>\n";
     echo "</tr>\n";
     echo "<tr>\n";
     echo "<td valign='top'><input type='submit' value='Continue Shopping' class='btn btn-green big' style='margin-left: 10px;' /></td>\n";
     echo "<td valign='top' style='padding-left:19em;'><input type='submit' value='Proceed to Checkout' class='btn btn-blue big' /></td>\n";
     echo "</tr>\n";
     echo "<tr>\n";
     echo "<td colspan='2' class='ta-right' style='padding: 30px 10px 10px 10px;'>\n";
     echo "<div style='margin-bottom: 20px;'><a href='" . ROOT_URL . "/customer-service/shipping'>Shipping and Returns Policy</a> &nbsp; | &nbsp; <a href='" . ROOT_URL . "/customer-service/privacy-policy'>Privacy Policy</a></div>\n";
     echo "<div style='font-weight: bold; margin-bottom: 8px;'>Ada pertanyaan? Pilih order melalui telepon atau faks?<br>Hubungi kami di 0800-140-7890 dan kami akan dengan senang hati membantu Anda</div>\n";
     echo "atau <a href='" . ROOT_URL . "/contacts'>Email tim Customer Service hukumonline.com</a>\n";
     echo "</td>";
     echo "</tr>\n";
     echo "</table>\n";
     echo "</div>\n";
     echo "<div class='clean'></div>";
     echo "</td>\n";
     echo "</tr>\n";
     echo "</table>\n\n";
     echo "<div class='jcart-hide'>\n";
     echo "<input type='submit' name='jcart_update_cart' value='" . $text['update_button'] . "' class='jcart-button' />\n";
     echo "<input type='submit' name='jcart_empty' value='" . $text['empty_button'] . "' class='jcart-button' />\n";
     echo "</div>\n";
     echo "</div>\n<!-- END JCART -->\n";
 }
Beispiel #13
0
 private function copycatalog($folderGuid, $space, $source, $target)
 {
     $source = "http://files.hukumonline.com/uploads/files";
     $catalogDb = new App_Model_Db_Table_Catalog();
     $catalogs = $catalogDb->fetchCatalogInFolder($folderGuid);
     $count = 1;
     foreach ($catalogs as $data) {
         $catalogs0 = $catalogDb->getCatalogByGuid($data->guid);
         $rowsetCatalogAttribute0 = $catalogs0->findDependentRowsetCatalogAttribute();
         $fixedTitle0 = $rowsetCatalogAttribute0->findByAttributeGuid('fixedTitle');
         $message = $space . $count . " > " . $data->guid . " ( " . $fixedTitle0['value'] . " )<br>";
         $this->printMessage($message, "", "");
         $count++;
         $relatedItemDb = new App_Model_Db_Table_RelatedItem();
         $filesCatalog = $relatedItemDb->fetchDocumentById($data->guid, "RELATED_FILE");
         $count1 = 1;
         foreach ($filesCatalog as $data1) {
             $catalogs1 = $catalogDb->getCatalogByGuid($data1->itemGuid);
             $rowsetCatalogAttribute = $catalogs1->findDependentRowsetCatalogAttribute();
             $docSystemName = $rowsetCatalogAttribute->findByAttributeGuid('docSystemName');
             $docSystemName = $docSystemName['value'];
             $docOriginalName = $rowsetCatalogAttribute->findByAttributeGuid('docOriginalName');
             $docOriginalName = $docOriginalName['value'];
             $success = false;
             $sDir1 = $source . "/" . $docSystemName;
             $sDir2 = $source . "/" . $data->guid . "/" . $docSystemName;
             $sDir3 = $source . "/" . $docOriginalName;
             $sDir4 = $source . "/" . $data->guid . "/" . $docOriginalName;
             if ($this->url_exists($sDir1)) {
                 $url = $sDir1;
                 $outputfile = $target . '/' . $docOriginalName;
                 $success = true;
                 echo $space . "&nbsp;&nbsp;&nbsp;96 -> sDir1 : " . $sDir1 . "<br>";
                 echo $space . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\$docOriginalName : " . $docOriginalName . "<br>";
                 //exec('wget -O '.$docOriginalName.' -P '.$sDir1);
                 $cmd = "/usr/bin/wget -O \"{$outputfile}\" \"{$url}\"";
                 exec($cmd);
             } else {
                 if ($this->url_exists($sDir2)) {
                     $url = $sDir2;
                     $outputfile = $target . '/' . $docOriginalName;
                     //$cmd = "wget -O - -P \"$url\" > $outputfile";
                     $cmd = "/usr/bin/wget -O \"{$outputfile}\" \"{$url}\"";
                     /*set_time_limit(0);
                     		 $file = file_get_contents($url);
                     		file_put_contents($outputfile, $file);*/
                     //exec('wget -O '.$docOriginalName.' -P '.$sDir2);
                     //exec('wget -O - -P '.$sDir2.' > '.$docOriginalName);
                     exec($cmd);
                     $success = true;
                     echo $space . "&nbsp;&nbsp;&nbsp;96 -> sDir2 : " . $sDir2 . "<br>";
                     echo $space . "\$docOriginalName : " . $docOriginalName . "<br>";
                 } else {
                     if ($this->url_exists($sDir3)) {
                         $url = $sDir3;
                         $outputfile = $target . '/' . $docOriginalName;
                         $cmd = "/usr/bin/wget -O \"{$outputfile}\" \"{$url}\"";
                         $success = true;
                         echo $space . "&nbsp;&nbsp;&nbsp;96 -> sDir3 : " . $sDir3 . "<br>";
                         //exec('wget -O '.$docOriginalName.' -P '.$sDir3);
                         exec($cmd);
                         echo $space . "\$docOriginalName : " . $docOriginalName . "<br>";
                     } else {
                         if ($this->url_exists($sDir4)) {
                             $url = $sDir4;
                             $outputfile = $target . '/' . $docOriginalName;
                             $cmd = "/usr/bin/wget -O \"{$outputfile}\" \"{$url}\"";
                             $success = true;
                             echo $space . "&nbsp;&nbsp;&nbsp;96 -> sDir4 : " . $sDir4 . "<br>";
                             //exec('wget -O '.$docOriginalName.' -P '.$sDir4);
                             exec($cmd);
                         } else {
                             $this->failCatalog[] = $data->guid . " ( " . $fixedTitle0['value'] . " )";
                         }
                     }
                 }
             }
             $count1++;
         }
     }
 }
 public function ppcommentAction()
 {
     $this->_helper->layout->disableLayout();
     $request = $this->getRequest();
     $relatedGuid = $request->getParam('relatedGuid');
     $itemGuid = $request->getParam('itemGuid');
     $relateAs = $request->getParam('relateAs');
     if ($request->isPost()) {
         $komentar = $request->getPost('komentar');
         $itemGuid = $request->getPost('itemGuid');
         for ($i = 0; $i < count($komentar); $i++) {
             //$where[] = "relatedGuid='$relatedGuid'";
             //$where[] = "itemGuid='$itemGuid[$i]'";
             //$where[] = "relateAs='$relateAs'";
             $ig = $itemGuid[$i];
             $desc = $komentar[$i];
             $tblRelatedItem = new App_Model_Db_Table_RelatedItem();
             $tblRelatedItem->update(['description' => $desc], ['relatedGuid = ?' => $relatedGuid, 'itemGuid = ?' => $ig, 'relateAs = ?' => $relateAs]);
         }
         //echo "<script>parent.$.nyroModalRemove();</script>";
         exit('sukses');
     }
     $guidArray = explode(',', $itemGuid);
     $this->view->assign('relateAs', $relateAs);
     $this->view->assign('relatedGuid', $relatedGuid);
     $this->view->assign('itemGuid', $guidArray);
 }
Beispiel #15
0
 protected function _traverseFolder_($folderGuid, $sGuid, $level)
 {
     $tblFolder = new App_Model_Db_Table_Folder();
     $rowSet = $tblFolder->fetchChildren($folderGuid);
     $row = $tblFolder->find($folderGuid)->current();
     $sGuid = '';
     /*
     if(count($rowSet))
     {
     	$sGuid = $row->guid;
     }
     else
     {
     	$sGuid = $row->guid;
     }
     */
     //		if(true)
     //		{
     //echo $level;
     foreach ($rowSet as $row) {
         //$sTab = '<ul>';
         //$sTab = '';
         //for($i=0;$i<$level;$i++)
         //$sTab .= '<li>';
         //$option = '<option value="'.$row->guid.'">'.$sTab.$row->title.'</option>';
         //$option = '"'.$row->guid.'" :'.'"'.$sTab.$row->title.'",';
         //$option = $sTab.$row->title;
         $sGuid .= $this->_traverseFolder_($row->guid, '', $level + 1) . "";
         //echo $row->guid.'<br>';
         echo 'Insert ' . $row->title . '<br>';
         $tblFolder = new App_Model_Db_Table_Migration_Detik_Folder();
         $rowFolder = $tblFolder->fetchNew();
         $rowFolder->guid = $row->guid;
         $rowFolder->title = $row->title;
         $rowFolder->description = $row->description;
         $rowFolder->parentGuid = $row->parentGuid;
         $rowFolder->path = $row->path;
         $rowFolder->type = $row->type;
         $rowFolder->viewOrder = $row->viewOrder;
         $rowFolder->cmsParams = $row->cmsParams;
         //$rowFolder->save();
         $rowCatalog = App_Model_Show_Catalog::show()->fetchCatalogInFolder4Mig($row->guid);
         //print_r($row->guid);die();
         if ($rowCatalog) {
             foreach ($rowCatalog as $rc) {
                 $rowsetCatalogAttributeJenis = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rc['guid'], 'prtJenis');
                 //print_r($rowsetCatalogAttributeJenis);
                 if ($rowsetCatalogAttributeJenis == 'Undang-Undang ' || $rowsetCatalogAttributeJenis == "uu" || $rowsetCatalogAttributeJenis == "pp" || $rowsetCatalogAttributeJenis == "Peraturan Pemerintah" || $rowsetCatalogAttributeJenis == "konstitusi") {
                     $modelMigrationCatalog = new App_Model_Db_Table_Migration_Detik_Catalog();
                     $where = $modelMigrationCatalog->getAdapter()->quoteInto('guid=?', $rc['guid']);
                     if (!$modelMigrationCatalog->fetchRow($where)) {
                         $data1 = array('guid' => $rc['guid'], 'shortTitle' => $rc['shortTitle'], 'profileGuid' => $rc['profileGuid'], 'publishedDate' => $rc['publishedDate'], 'expiredDate' => $rc['expiredDate'], 'createdBy' => $rc['createdBy'], 'modifiedBy' => $rc['modifiedBy'], 'createdDate' => $rc['createdDate'], 'modifiedDate' => $rc['modifiedDate'], 'deletedDate' => $rc['deletedDate'], 'price' => isset($rc['price']) ? $rc['price'] : 0, 'status' => $rc['status']);
                         $modelMigrationCatalog->insert($data1);
                         $tblCatalogAttribute = new App_Model_Db_Table_CatalogAttribute();
                         $rcam = $tblCatalogAttribute->fetchAll("catalogGuid='" . $rc['guid'] . "'");
                         foreach ($rcam as $rowca) {
                             $modelMigrationCatalogAttribute = new App_Model_Db_Table_Migration_Detik_CatalogAttribute();
                             $data2 = array('catalogGuid' => $rowca->catalogGuid, 'attributeGuid' => $rowca->attributeGuid, 'value' => $rowca->value);
                             $modelMigrationCatalogAttribute->insert($data2);
                         }
                         $tblCatalogFolder = new App_Model_Db_Table_CatalogFolder();
                         $rcfm = $tblCatalogFolder->fetchAll("catalogGuid='" . $rc['guid'] . "'");
                         foreach ($rcfm as $rowcf) {
                             $modelMigrationCatalogFolder = new App_Model_Db_Table_Migration_Detik_CatalogFolder();
                             $data3 = array('catalogGuid' => $rowcf->catalogGuid, 'folderGuid' => $rowcf->folderGuid);
                             $modelMigrationCatalogFolder->insert($data3);
                         }
                         $tblRelatedItem = new App_Model_Db_Table_RelatedItem();
                         $rrim = $tblRelatedItem->fetchAll("relatedGuid='" . $rc['guid'] . "'");
                         foreach ($rrim as $rowri) {
                             $modelMigrationRelatedItem = new App_Model_Db_Table_Migration_Detik_RelatedItem();
                             $rowRelated = $modelMigrationRelatedItem->createNew();
                             $rowRelated->itemGuid = $rowri->itemGuid;
                             $rowRelated->relatedGuid = $rowri->relatedGuid;
                             $rowRelated->relateAs = $rowri->relateAs;
                             $rowRelated->valueIntRelation = $rowri->valueIntRelation;
                             $rowRelated->save();
                         }
                     }
                 }
             }
         }
         //$sGuid .= $sTab.$row->title . '|<br>'. $this->_traverseFolder($row->guid, '', $level+1);
     }
     //			if(count($rowSet))
     //			{
     //				return $sGuid;
     //			}
     //			else
     //			{
     //				return $sGuid;
     //			}
     //		}
 }
Beispiel #16
0
 public function relateTo($relatedGuid, $as = 'RELATED_ITEM', $valRelation = 0)
 {
     if (empty($this->guid)) {
         throw new Zend_Exception('Can not relate to empty GUID');
     }
     if (empty($relatedGuid)) {
         throw new Zend_Exception('Can not relate to empty related GUID');
     }
     if ($this->guid == $relatedGuid && in_array($as, array('REPEAL', 'AMEND', 'ISROOT'))) {
         return;
     }
     $tblRelatedItem = new App_Model_Db_Table_RelatedItem();
     $rowsetRelatedItem = $tblRelatedItem->find($this->guid, $relatedGuid, $as);
     if (count($rowsetRelatedItem) > 0) {
         $row = $rowsetRelatedItem->current();
         $row->valueIntRelation = $valRelation;
     } else {
         $row = $tblRelatedItem->createNew();
         $row->itemGuid = $this->guid;
         $row->relatedGuid = $relatedGuid;
         $row->relateAs = $as;
         $row->valueIntRelation = $valRelation;
         if (in_array($as, array('REPEAL', 'AMEND', 'ESTABLISH', 'ISROOT'))) {
             $tblRelatedItem = new App_Model_Db_Table_RelatedItem();
             $rowVal = $tblRelatedItem->fetchRow("itemGuid='{$relatedGuid}' AND relateAs IN ('REPEAL','AMEND','ESTABLISH','ISROOT')");
             if ($rowVal && $rowVal->valueStringRelation) {
                 $row->valueStringRelation = $rowVal->valueStringRelation;
             } else {
                 $row->valueStringRelation = $relatedGuid;
             }
             $row->itemType = "history";
         }
     }
     $row->save();
 }
Beispiel #17
0
 function downloadFileAction()
 {
     $this->_helper->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $catalogGuid = $this->_getParam('guid');
     $parentGuid = $this->_getParam('parent');
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $rowsetCatalog = $tblCatalog->find($catalogGuid);
     if (count($rowsetCatalog)) {
         $auth = Zend_Auth::getInstance();
         if ($auth->hasIdentity()) {
             $identity = $auth->getIdentity();
             $guidUser = $identity->kopel;
         }
         $tblAsetSetting = new App_Model_Db_Table_AssetSetting();
         $rowAset = $tblAsetSetting->find($catalogGuid)->current();
         if ($rowAset) {
             $rowAset->valueInt = $rowAset->valueInt + 1;
         } else {
             $rowAset = $tblAsetSetting->fetchNew();
             $rowAset->guid = $catalogGuid;
             $rowAset->application = "kutu_doc";
             $rowAset->part = isset($guidUser) ? $guidUser : '';
             $rowAset->valueType = gethostbyaddr($_SERVER['REMOTE_ADDR']);
             $rowAset->valueInt = 1;
         }
         $rowAset->save();
         $rowCatalog = $rowsetCatalog->current();
         $rowsetCatAtt = $rowCatalog->findDependentRowsetCatalogAttribute();
         $contentType = $rowsetCatAtt->findByAttributeGuid('docMimeType')->value;
         $filename = $systemname = $rowsetCatAtt->findByAttributeGuid('docSystemName')->value;
         $oriName = $oname = $rowsetCatAtt->findByAttributeGuid('docOriginalName')->value;
         $tblRelatedItem = new App_Model_Db_Table_RelatedItem();
         $rowsetRelatedItem = $tblRelatedItem->fetchAll("itemGuid='{$catalogGuid}' AND relateAs='RELATED_FILE'");
         $registry = Zend_Registry::getInstance();
         $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
         $cdn = $config->getOption('cdn');
         $flagFileFound = false;
         foreach ($rowsetRelatedItem as $rowRelatedItem) {
             if (!$flagFileFound) {
                 $parentGuid = $rowRelatedItem->relatedGuid;
                 $sDir1 = $cdn['static']['dir']['files'] . "/" . $systemname;
                 $sDir2 = $cdn['static']['dir']['files'] . "/" . $parentGuid . "/" . $systemname;
                 $sDir3 = $cdn['static']['dir']['files'] . "/" . $oname;
                 $sDir4 = $cdn['static']['dir']['files'] . "/" . $parentGuid . "/" . $oname;
                 if (file_exists($sDir1)) {
                     $flagFileFound = true;
                     header("Content-type: {$contentType}");
                     header("Content-Disposition: attachment; filename={$oriName}");
                     @readfile($sDir1);
                     die;
                 } else {
                     if (file_exists($sDir2)) {
                         $flagFileFound = true;
                         header("Content-type: {$contentType}");
                         header("Content-Disposition: attachment; filename={$oriName}");
                         @readfile($sDir2);
                         die;
                     }
                 }
                 if (file_exists($sDir3)) {
                     $flagFileFound = true;
                     header("Content-type: {$contentType}");
                     header("Content-Disposition: attachment; filename={$oriName}");
                     @readfile($sDir3);
                     die;
                 }
                 if (file_exists($sDir4)) {
                     $flagFileFound = true;
                     header("Content-type: {$contentType}");
                     header("Content-Disposition: attachment; filename={$oriName}");
                     @readfile($sDir4);
                     die;
                 } else {
                     $flagFileFound = false;
                     $this->_redirect(ROOT_URL . '/' . $this->_zl->getLanguage() . '/dms/browser/forbidden');
                 }
             }
         }
     } else {
         $flagFileFound = false;
         $this->_redirect(ROOT_URL . '/' . $this->_zl->getLanguage() . '/dms/browser/forbidden');
     }
 }
Beispiel #18
0
 function downloadFileAction()
 {
     $this->_helper->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $catalogGuid = $this->_getParam('guid');
     $parentGuid = $this->_getParam('parent');
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $rowsetCatalog = $tblCatalog->find($catalogGuid);
     if (count($rowsetCatalog)) {
         $auth = Zend_Auth::getInstance();
         //$sso = new Pandamp_Session_Remote();
         //$user = $sso->getInfo();
         if ($auth->hasIdentity()) {
             $guidUser = $auth->getIdentity()->guid;
         }
         $tblAsetSetting = new App_Model_Db_Table_AssetSetting();
         $rowAset = $tblAsetSetting->find($catalogGuid)->current();
         if ($rowAset) {
             $rowAset->valueInt = $rowAset->valueInt + 1;
         } else {
             $rowAset = $tblAsetSetting->fetchNew();
             $rowAset->guid = $catalogGuid;
             $rowAset->application = "kutu_doc";
             $rowAset->part = isset($guidUser) ? $guidUser : '';
             $rowAset->valueType = gethostbyaddr($_SERVER['REMOTE_ADDR']);
             $rowAset->valueInt = 1;
         }
         $rowAset->save();
         $rowCatalog = $rowsetCatalog->current();
         $rowsetCatAtt = $rowCatalog->findDependentRowsetCatalogAttribute();
         $contentType = $rowsetCatAtt->findByAttributeGuid('docMimeType')->value;
         $filename = $systemname = $rowsetCatAtt->findByAttributeGuid('docSystemName')->value;
         $oriName = $oname = $rowsetCatAtt->findByAttributeGuid('docOriginalName')->value;
         $tblRelatedItem = new App_Model_Db_Table_RelatedItem();
         $rowsetRelatedItem = $tblRelatedItem->fetchAll("itemGuid='{$catalogGuid}' AND relateAs='RELATED_FILE'");
         $flagFileFound = false;
         foreach ($rowsetRelatedItem as $rowRelatedItem) {
             if (!$flagFileFound) {
                 $parentGuid = $rowRelatedItem->relatedGuid;
                 $sDir1 = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $systemname;
                 $sDir2 = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $parentGuid . DIRECTORY_SEPARATOR . $systemname;
                 $sDir3 = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $oname;
                 $sDir4 = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $parentGuid . DIRECTORY_SEPARATOR . $oname;
                 if (file_exists($sDir1)) {
                     $flagFileFound = true;
                     header("Content-type: {$contentType}");
                     header("Content-Disposition: attachment; filename={$oriName}");
                     @readfile($sDir1);
                     die;
                 } else {
                     if (file_exists($sDir2)) {
                         $flagFileFound = true;
                         header("Content-type: {$contentType}");
                         header("Content-Disposition: attachment; filename={$oriName}");
                         @readfile($sDir2);
                         die;
                     }
                 }
                 if (file_exists($sDir3)) {
                     $flagFileFound = true;
                     header("Content-type: {$contentType}");
                     header("Content-Disposition: attachment; filename={$oriName}");
                     @readfile($sDir3);
                     die;
                 }
                 if (file_exists($sDir4)) {
                     $flagFileFound = true;
                     header("Content-type: {$contentType}");
                     header("Content-Disposition: attachment; filename={$oriName}");
                     @readfile($sDir4);
                     die;
                 } else {
                     $flagFileFound = false;
                     $this->_forward('forbidden', 'browser', 'hold');
                 }
             }
         }
     } else {
         $flagFileFound = false;
         $this->_forward('forbidden', 'browser', 'hold');
     }
 }
Beispiel #19
0
 private function _extractText_ZendDb($guid, $systemName, $fileName, $mimeType)
 {
     //$c = $this->_registry->get('config');
     $tblRelatedItem = new App_Model_Db_Table_RelatedItem();
     $rowset = $tblRelatedItem->fetchAll("itemGuid='{$guid}' AND relateAs='RELATED_FILE'");
     if (count($rowset)) {
         $row = $rowset->current();
         $parentCatalogGuid = $row->relatedGuid;
         if (!empty($systemName)) {
             $fileName = $systemName;
         }
         $sDir1 = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $fileName;
         $sDir2 = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $parentCatalogGuid . DIRECTORY_SEPARATOR . $fileName;
         $sDir = '';
         if (file_exists($sDir1)) {
             $sDir = $sDir1;
         } else {
             if (file_exists($sDir2)) {
                 $sDir = $sDir2;
             }
         }
         if (!empty($sDir)) {
             $outpath = $sDir . '.txt';
             switch ($mimeType) {
                 case 'application/pdf':
                     $pdfExtractor = $this->_pdfExtractor;
                     system("{$pdfExtractor} " . $sDir . ' ' . $outpath, $ret);
                     if ($ret == 0) {
                         $value = file_get_contents($outpath);
                         unlink($outpath);
                         //echo 'content PDF: '. $sDir.' ' . strlen($value);
                         if (strlen($value) > 20) {
                             return $this->clean_string_input($value);
                         } else {
                             echo 'content file kosong';
                             return '';
                         }
                     }
                     if ($ret == 127) {
                         //print "Could not find pdftotext tool.";
                         return '';
                     }
                     if ($ret == 1) {
                         //print "Could not find pdf file.";
                         return '';
                     }
                     break;
                 case 'text/html':
                 case 'text/plain':
                     $docHtml = Zend_Search_Lucene_Document_Html::loadHTMLFile($sDir);
                     return $docHtml->getFieldValue('body');
                     break;
                 case 'application/x-javascript':
                 case 'application/octet-stream':
                 case 'application/msword':
                     if (strpos(strtolower($fileName), '.doc')) {
                         $extractor = $this->_wordExtractor;
                         system("{$extractor} -m cp850.txt " . $sDir . ' > ' . $outpath, $ret);
                         if ($ret == 0) {
                             $value = file_get_contents($outpath);
                             unlink($outpath);
                             //echo $value;
                             return $value;
                         }
                         if ($ret == 127) {
                             //print "Could not find pdftotext tool.";
                             return '';
                         }
                         if ($ret == 1) {
                             //print "Could not find pdf file.";
                             return '';
                         }
                     } else {
                         return '';
                     }
                     break;
                 default:
                     return '';
                     break;
             }
         }
     }
     return '';
 }
Beispiel #20
0
 public function getItemRelated($itemGuid, $relateAs)
 {
     $relItemDb = new App_Model_Db_Table_RelatedItem();
     $relItem = $relItemDb->fetchRow("itemGuid='{$itemGuid}' AND relateAs='{$relateAs}'");
     return $relItem;
 }
Beispiel #21
0
 public function getFilesImg($catalogGuid)
 {
     $tblRelatedItem = new App_Model_Db_Table_RelatedItem();
     //$where = "relatedGuid='$catalogGuid' AND relateAs='RELATED_FILE'";
     $where = "relatedGuid='{$catalogGuid}' AND relateAs = 'RELATED_IMAGE'";
     $rowsetRelatedItem = $tblRelatedItem->fetchAll($where);
     return $rowsetRelatedItem;
 }
Beispiel #22
0
 function isroot($guid)
 {
     $where = "itemGuid='{$guid}' AND relateAs='ISROOT'";
     $tblRelatedItem = new App_Model_Db_Table_RelatedItem();
     $rowsetRelatedItem = $tblRelatedItem->fetchRow($where);
     if ($rowsetRelatedItem) {
         $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowsetRelatedItem->relatedGuid, 'fixedTitle');
         echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='{$rowsetRelatedItem->relatedGuid}'>{$title}</a>[mencabut sebagian]<br>";
     }
 }