コード例 #1
0
 private function _save()
 {
     $hol = new Pandamp_Core_Hol_Catalog();
     $r = $this->getRequest();
     $aData = $r->getParams();
     $hol->uploadFile($aData, $aData['relatedGuid']);
 }
コード例 #2
0
 function removeFromFolderAction()
 {
     $req = $this->getRequest();
     $catalogGuid = $req->getParam('guid');
     $folderGuid = $req->getParam('folderGuid');
     $hol = new Pandamp_Core_Hol_Catalog();
     $hol->removeFromFolder($catalogGuid, $folderGuid);
     exit;
 }
コード例 #3
0
ファイル: FolderViewer.php プロジェクト: hukumonline/admin
 public function __construct($catalogGuid, $folderGuid)
 {
     $this->view = new Zend_View();
     $this->view->setScriptPath(dirname(__FILE__));
     $this->catalogGuid = $catalogGuid;
     $this->view->catalogGuid = $catalogGuid;
     $this->view->folderGuid = $folderGuid;
     $this->view->addHelperPath(ROOT_DIR . '/library/Pandamp/Controller/Action/Helper', 'Pandamp_Controller_Action_Helper');
     $bpm = new Pandamp_Core_Hol_Catalog();
     $this->view->rowsetFolder = $bpm->getFolders($catalogGuid);
 }
コード例 #4
0
ファイル: StoreController.php プロジェクト: hukumonline/store
 function completeorderAction()
 {
     $modelPaymentSetting = new App_Model_Db_Table_PaymentSetting();
     $rowTaxRate = $modelPaymentSetting->fetchRow("settingKey='taxRate'");
     $cart =& $_SESSION['jCart'];
     if (!is_object($cart)) {
         $cart = new jCart();
     }
     if (empty($cart) || count($cart->items) == 0) {
         $this->_redirect(ROOT_URL . '/checkout/cartempty');
     }
     $bpm = new Pandamp_Core_Hol_Catalog();
     $result = array('subTotal' => 0, 'disc' => 0, 'taxAmount' => 0, 'grandTotal' => 0, 'items' => array());
     for ($iCart = 0; $iCart < count($cart->items); $iCart++) {
         $itemId = $cart->items[$iCart];
         $qty = $cart->itemqtys[$itemId];
         $coupon = isset($cart->coupon) ? $cart->coupon : '';
         $itemPrice = $bpm->getPrice($itemId);
         $disc = $bpm->getDiscount($coupon);
         $result['items'][$iCart]['itemId'] = $itemId;
         $result['items'][$iCart]['item_name'] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($itemId, 'fixedTitle');
         $result['items'][$iCart]['itemPrice'] = $itemPrice;
         $result['items'][$iCart]['itemTotal'] = $qty * $itemPrice;
         $result['items'][$iCart]['qty'] = $qty;
         $result['coupon'] = $coupon;
         $result['disc'] = $disc;
         $result['subTotal'] += $itemPrice * $qty;
     }
     $result['taxAmount'] = $result['subTotal'] * $rowTaxRate->settingValue / 100;
     $grandTotal = $result['subTotal'] - $result['disc'] / 100 * $result['subTotal'];
     $result['grandTotal'] = $grandTotal + $result['taxAmount'];
     $payment = $this->_request->getParam('payment');
     $orderId = $this->saveOrder($result, $payment);
     $cart = null;
     $data = $this->_request->getParams();
     $this->view->cart = $result;
     $this->view->data = $data;
     $this->view->orderId = $orderId;
     $modDir = $this->getFrontController()->getModuleDirectory();
     require_once $modDir . '/models/Store/Mailer.php';
     $mod = new Shop_Model_Store_Mailer();
     switch (strtolower($payment['method'])) {
         case 'bank':
             $mod->sendBankInvoiceToUser($orderId);
             break;
         case 'nsiapay':
             $mod->sendInvoiceToUser($orderId);
             break;
         case 'postpaid':
             $tblUserFinance = new App_Model_Db_Table_UserFinance();
             $userFinanceInfo = $tblUserFinance->find($this->_user->kopel)->current();
             if (!$userFinanceInfo->isPostPaid) {
                 return $this->_helper->redirector('notpostpaid', 'store_payment', 'hol-site');
             }
             $mod->sendInvoiceToUser($orderId);
             break;
     }
     $this->view->identity = "Menyelesaikan Pesanan";
 }
コード例 #5
0
ファイル: Folder.php プロジェクト: hukumonline/quart80
 public function forceDelete($folderGuid)
 {
     $tblFolder = new Pandamp_Modules_Dms_Folder_Model_Folder();
     $rowset = $tblFolder->fetchChildren($folderGuid);
     $rowFolder = $tblFolder->find($folderGuid)->current();
     foreach ($rowset as $row) {
         $this->forceDelete($row->guid);
     }
     $rowsetCatalogFolder = $rowFolder->findDependentRowsetCatalogFolder();
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $holCatalog = new Pandamp_Core_Hol_Catalog();
     if (count($rowsetCatalogFolder)) {
         foreach ($rowsetCatalogFolder as $rowCatalogFolder) {
             $rowCatalog = $tblCatalog->find($rowCatalogFolder->catalogGuid)->current();
             $holCatalog->delete($rowCatalog->guid);
         }
         $this->delete($rowFolder->guid);
     } else {
         $this->delete($rowFolder->guid);
     }
 }
コード例 #6
0
ファイル: Folder.php プロジェクト: hukumonline/admin
 public function forceDelete($folderGuid)
 {
     $tblFolder = new App_Model_Db_Table_Folder();
     $rowSet = $tblFolder->fetchChildren($folderGuid);
     $row1 = $tblFolder->find($folderGuid)->current();
     foreach ($rowSet as $row) {
         $this->forceDelete($row->guid);
     }
     $rowsetCatalogFolder = $row1->findDependentRowsetCatalogFolder();
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $bpmCatalog = new Pandamp_Core_Hol_Catalog();
     if (count($rowsetCatalogFolder)) {
         foreach ($rowsetCatalogFolder as $rowCatalogFolder) {
             $rowCatalog = $tblCatalog->find($rowCatalogFolder->catalogGuid)->current();
             if ($rowCatalog) {
                 $bpmCatalog->delete($rowCatalog->guid);
             }
         }
         $this->delete($row1->guid);
     } else {
         $this->delete($row1->guid);
     }
 }
コード例 #7
0
ファイル: Catalog.php プロジェクト: hukumonline/pmg
 public function jCartIsItemSellable($catalogGuid)
 {
     //apakah pernah dibeli
     $hasBought = false;
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $bpm = new Pandamp_Core_Hol_Catalog();
         $hasBought = $bpm->isBoughtByUser($catalogGuid, $auth->getIdentity()->kopel);
     }
     if ($hasBought) {
         $aReturn['isError'] = true;
         $aReturn['message'] = 'You have bought this Item before. Please check your account.';
         $aReturn['code'] = 1;
         return $aReturn;
     }
     Pandamp_Application::getResource('multidb');
     require_once ROOT_DIR . '/app/models/Db/Table/Catalog.php';
     require_once ROOT_DIR . '/app/models/Db/Table/Rowset/CatalogAttribute.php';
     require_once ROOT_DIR . '/app/models/Db/Table/Row/Catalog.php';
     // if status=draft then return false
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $rowCatalog = $tblCatalog->find($catalogGuid)->current();
     if ($rowCatalog) {
         if ($rowCatalog->status != 99) {
             $aReturn['isError'] = true;
             $aReturn['message'] = 'This item is not ready to be bought yet.';
             $aReturn['code'] = 1;
             return $aReturn;
         }
         // if price <= 0 then return false
         if ($rowCatalog->price <= 0) {
             $aReturn['isError'] = true;
             $aReturn['message'] = 'This item is for FREE.';
             $aReturn['code'] = 2;
             return $aReturn;
         }
         /*
         $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
         $where = "relatedGuid='$catalogGuid' 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 Pandamp_Modules_Dms_Catalog_Model_Catalog();
                 $rowsetCatalogFile = $tblCatalog->find($rowRelatedItem->itemGuid);
         
                 $rowCatalogFile = $rowsetCatalogFile->current();
                 $rowsetCatAtt = $rowCatalogFile->findDependentRowsetCatalogAttribute();
         
                 $contentType = $rowsetCatAtt->findByAttributeGuid('docMimeType')->value;
                 $systemname = $rowsetCatAtt->findByAttributeGuid('docSystemName')->value;
                 $filename = $rowsetCatAtt->findByAttributeGuid('docOriginalName')->value;
         
                 if(true)
                 {
                     $parentGuid = $rowRelatedItem->relatedGuid;
                     $sDir1 = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR.$systemname;
                     $sDir2 = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR.$parentGuid.DIRECTORY_SEPARATOR.$systemname;
         
                     if(file_exists($sDir1))
                     {
                         //$flagFileFound = true;
                     }
                     else
                         if(file_exists($sDir2))
                         {
                                 //$flagFileFound = true;
                         }
                         else
                         {
                                 $flagFileFound = false;
                         }
                 }
             }
         
             if($flagFileFound)
             {
                 $aReturn['isError'] = false;
                 $aReturn['message'] = 'This item is SELLABLE.';
                 $aReturn['code'] = 99;
                 return $aReturn;
             }
             else
             {
                 $aReturn['isError'] = true;
                 $aReturn['message'] = 'We are Sorry. The document(s) you are requesting is still under review. Please check back later.';
                 $aReturn['code'] = 5;
                 return $aReturn;
             }
         
         }
         else
         {
             $aReturn['isError'] = true;
             $aReturn['message'] = 'We are Sorry. The document(s) you are requesting is still being prepared. Please check back later.';
             $aReturn['code'] = 5;
             return $aReturn;
         }
         */
     } else {
         $aReturn['isError'] = true;
         $aReturn['message'] = 'Can not find your selected item(s).';
         $aReturn['code'] = 10;
         return $aReturn;
     }
     //if ada record related document, but tidak ada dokumen fisik, then return false
     // if tidak ada record related document (blm ada dokumen/file diupload), then return false
     // if pernah dibeli user sebelumnya, then return false
 }
コード例 #8
0
 function removeFromFolderAction()
 {
     $req = $this->getRequest();
     $catalogGuid = $req->getParam('guid');
     $folderGuid = $req->getParam('folderGuid');
     $hol = new Pandamp_Core_Hol_Catalog();
     try {
         $hol->removeFromFolder($catalogGuid, $folderGuid);
         $this->view->success = true;
         $this->view->message = "Data was deleted.";
     } catch (Exception $e) {
         $this->view->success = false;
         $this->view->message = $e->getMessage();
     }
 }
コード例 #9
0
 function completeorderAction()
 {
     $tblPaymentSetting = new Pandamp_Modules_Payment_Setting_Model_PaymentSetting();
     $rowTaxRate = $tblPaymentSetting->fetchRow("settingKey='taxRate'");
     $cart =& $_SESSION['jCart'];
     if (!is_object($cart)) {
         $cart = new jCart();
     }
     //		echo "<pre>";
     //		print_r($cart);
     //		echo "</pre><br>";
     if (empty($cart) || count($cart->items) == 0) {
         $this->_redirect(ROOT_URL . '/store/cartempty');
     }
     $bpm = new Pandamp_Core_Hol_Catalog();
     $result = array('subTotal' => 0, 'taxAmount' => 0, 'grandTotal' => 0, 'items' => array());
     for ($iCart = 0; $iCart < count($cart->items); $iCart++) {
         $modelCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute();
         $itemId = $cart->items[$iCart];
         $qty = $cart->itemqtys[$itemId];
         $itemPrice = $bpm->getPrice($itemId);
         $result['items'][$iCart]['itemId'] = $itemId;
         $result['items'][$iCart]['item_name'] = $modelCatalogAttribute->getCatalogAttributeValue($itemId, 'fixedTitle');
         $result['items'][$iCart]['itemPrice'] = $itemPrice;
         $result['items'][$iCart]['itemTotal'] = $qty * $itemPrice;
         $result['items'][$iCart]['qty'] = $qty;
         $result['subTotal'] += $itemPrice * $qty;
     }
     $result['taxAmount'] = $result['subTotal'] * $rowTaxRate->settingValue / 100;
     $result['grandTotal'] = $result['subTotal'] + $result['taxAmount'];
     //		echo "Result : <br><br><pre>";
     //		print_r($result);
     //		echo "</pre><br>";
     //		die;
     $method = $this->_request->getParam('paymentMethod');
     $orderId = $this->saveOrder($result, $method);
     //		$cart = null;
     $data = $this->_request->getParams();
     $this->view->cart = $result;
     $this->view->data = $data;
     $this->view->orderId = $orderId;
     $modDir = $this->getFrontController()->getModuleDirectory();
     require_once $modDir . '/models/Store/Mailer.php';
     $mod = new Holsite_Model_Store_Mailer();
     switch (strtolower($method)) {
         case 'manual':
         case 'bank':
             $mod->sendBankInvoiceToUser($orderId);
             break;
         case 'paypal':
             $mod->sendInvoiceToUser($orderId);
             break;
         case 'postpaid':
             $mod->sendInvoiceToUser($orderId);
             break;
     }
 }
コード例 #10
0
ファイル: jcart.php プロジェクト: hukumonline/pmg
 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";
 }
コード例 #11
0
ファイル: ClinicController.php プロジェクト: hukumonline/pmg
 function saveAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $request = $this->getRequest();
     if ($request->getParam('fixedCommentTitle') == '') {
         $error[] = '- Masukkan judul pertanyaan';
     }
     if ($request->getParam('fixedCommentQuestion') == '') {
         $error[] = '- Masukkan pertanyaan anda';
     }
     if (isset($error)) {
         echo '<b>Error</b>: <br />' . implode('<br />', $error);
     } else {
         $aData = $request->getParams();
         $auth = Zend_Auth::getInstance();
         $username = $auth->getIdentity()->username;
         if (!$auth->hasIdentity()) {
             echo "You are not login or your session is expired. Please login.";
         } else {
             $aData['username'] = $username;
         }
         try {
             $hol = new Pandamp_Core_Hol_Catalog();
             $hol->save($aData);
             echo "Terima kasih atas minat anda terhadap klinik kami";
         } catch (Exception $e) {
             echo $e->getMessage();
         }
     }
 }
コード例 #12
0
 function answerClinicAction()
 {
     $urlReferer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
     $request = $this->getRequest();
     $catalogGuid = $request->getParam('guid');
     $node = $request->getParam('node');
     $gen = new Pandamp_Form_Helper_ClinicInputGenerator();
     $aRender = $gen->generateFormAnswer($catalogGuid);
     $this->view->aRenderedAttributes = $aRender;
     if ($request->isPost()) {
         $sessHistory = new Zend_Session_Namespace('BROWSER_HISTORY');
         $urlReferer = $sessHistory->urlReferer;
         $aData = $request->getPost();
         $aData['username'] = $this->_user->username;
         $Bpm = new Pandamp_Core_Hol_Catalog();
         $id = $Bpm->save($aData);
         if ($id) {
             //$message = "Data was successfully saved.";
             //$this->_helper->getHelper('FlashMessenger')->addMessage($message);
             //$this->_redirect(ROOT_URL.'/'.$this->_lang->getLanguage().'/dms/clinic/browse/status/'.$aData['status'].'/node/'.$node);
             $queue = Zend_Registry::get(Bootstrap::NAME_ORDERQUEUE);
             $queue->addJob('Pandamp_Job_Catalog', ['guid' => $id, 'folderGuid' => $node, 'ip' => Pandamp_Lib_Formater::getHttpRealIp(), 'kopel' => $this->_user->kopel, 'lang' => $this->view->getLanguage()], false);
             $this->_helper->json(['response' => true, 'message' => 'Artikel berhasil disimpan. <a href="' . ROOT_URL . '/' . $this->_lang->getLanguage() . '/dms/clinic/browse/status/' . $aData['status'] . '/node/' . $node . '">Lihat artikel</a>.']);
         }
     }
     $sessHistory = new Zend_Session_Namespace('BROWSER_HISTORY');
     $sessHistory->urlReferer = $urlReferer;
     $this->view->urlReferer = $sessHistory->urlReferer;
 }
コード例 #13
0
 function saveAction()
 {
     $aResult = array();
     $request = $this->getRequest();
     $aData = $request->getParams();
     $auth = Zend_Auth::getInstance();
     $username = $auth->getIdentity()->username;
     if (!$auth->hasIdentity()) {
         $aResult['success'] = false;
         $aResult['msg'] = "You are not login or your session is expired. Please login.";
     } else {
         $aData['username'] = $username;
     }
     try {
         $hol = new Pandamp_Core_Hol_Catalog();
         $hol->save($aData);
         $aResult['success'] = true;
         $aResult['msg'] = "Catalog is successfully saved";
     } catch (Exception $e) {
         $aResult['success'] = false;
         $aResult['msg'] = $e->getMessage();
     }
     echo Zend_Json::encode($aResult);
 }
コード例 #14
0
 function editAction()
 {
     $this->_helper->layout->setLayout('layout-dms-newcatalog');
     $r = $this->getRequest();
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $sessHistory = new Zend_Session_Namespace('BROWSER_HISTORY');
     if (isset($sessHistory->currentNode)) {
         unset($sessHistory->currentNode);
     }
     $sessHistory->currentNode = $this->_getParam('node') ? $this->_getParam('node') : $sessHistory->currentNode;
     $this->view->currentNode = $sessHistory->currentNode;
     $urlReferer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
     $message = "";
     $modDir = $this->getFrontController()->getModuleDirectory();
     require_once $modDir . '/components/Menu/FolderBreadcrumbs2.php';
     $w = new Dms_Menu_FolderBreadcrumbs2($sessHistory->currentNode);
     $this->view->assign('breadcrumbs', $w);
     $modelCatalog = App_Model_Show_Catalog::show()->getCatalogByGuid($catalogGuid);
     $this->view->assign('catalog', $modelCatalog);
     $this->view->assign('catalogGuid', $catalogGuid);
     $this->view->profile = $modelCatalog['profileGuid'];
     if ($modelCatalog['profileGuid'] == "klinik") {
         $this->_forward('answer.clinic', 'clinic', 'dms', array('guid' => $catalogGuid, 'node' => $sessHistory->currentNode));
     } else {
         $gen = new Pandamp_Form_Helper_CatalogInputGenerator();
         $aRender = $gen->generateFormEdit($catalogGuid);
         $this->view->aRenderedAttributes = $aRender;
         /*$catalogFolderDb = new App_Model_Db_Table_CatalogFolder();
           $rowCategory = $catalogFolderDb->fetchAll("catalogGuid='$catalogGuid'");
           $categories = array();
           if ($rowCategory) {
           	foreach ($rowCategory as $rc)
           	{
           		$categories[] = $rc->folderGuid;
           	}
           }
           
           $this->view->assign('categories',$categories);*/
     }
     if ($r->isPost()) {
         $sessHistory = new Zend_Session_Namespace('BROWSER_HISTORY');
         $urlReferer = $sessHistory->urlReferer;
         $aData = $r->getPost();
         $aData['username'] = $this->_user->username;
         $Bpm = new Pandamp_Core_Hol_Catalog();
         $id = $Bpm->save($aData);
         if ($id) {
             /*$gen = new Pandamp_Form_Helper_CatalogInputGenerator();
              	$aRender = $gen->generateFormEdit($id);
              	$this->view->aRenderedAttributes = $aRender;*/
             //$modelCatalog = App_Model_Show_Catalog::show()->getCatalogByGuid($id);
             // 	            $message = "Data was successfully saved.";
             // 				$this->_helper->getHelper('FlashMessenger')
             // 					->addMessage($message);
             $queue = Zend_Registry::get(Bootstrap::NAME_ORDERQUEUE);
             $queue->addJob('Pandamp_Job_Catalog', ['guid' => $id, 'folderGuid' => $sessHistory->currentNode, 'ip' => Pandamp_Lib_Formater::getHttpRealIp(), 'kopel' => $this->_user->kopel, 'lang' => $this->view->getLanguage()], false);
             $this->_helper->json(['response' => true, 'message' => 'Artikel berhasil disimpan. <a href="' . ROOT_URL . '/' . $this->_lang->getLanguage() . '/dms/explorer/browse/node/' . $sessHistory->currentNode . '">Lihat artikel</a>.']);
             /*if ($modelCatalog->profileGuid == "klinik") {
             			if ($modelCatalog->status == 99) {
             				$this->_redirect(ROOT_URL.'/'.$this->_lang->getLanguage().'/dms/clinic/browse/status/99/node/lt4b11e8c86c8a4');
             			}
             			else if ($modelCatalog->status == 2) {
             				$this->_redirect(ROOT_URL.'/'.$this->_lang->getLanguage().'/dms/clinic/browse/status/2/node/lt4b11ecf5408d2');
             			}
             			else if ($modelCatalog->status == 0) {
             				$this->_redirect(ROOT_URL.'/'.$this->_lang->getLanguage().'/dms/clinic/browse/status/0/node/lt4b11e8fde1e42');
             			}
             			else if ($modelCatalog->status == 1) {
             				$this->_redirect(ROOT_URL.'/'.$this->_lang->getLanguage().'/dms/clinic/browse/status/1/node/lt4b11ece54d870');
             			}
             			else 
             			{
             				$this->_redirect(ROOT_URL.'/'.$this->_lang->getLanguage().'/dms/clinic/browse/status/'.$modelCatalog['status'].'/node/'.$sessHistory->currentNode);
             			}
             		}
             		else if (!empty($aData['fixedKeywords']))
             		{
             			if (in_array($modelCatalog->profileGuid,array('article','clinic'))) {
             			$keywords = base64_encode(trim($aData['fixedKeywords']));
             			$this->_redirect(ROOT_URL.'/'.$this->_lang->getLanguage().'/dms/catalog/relatedcatalog/guid/'.$id.'/profile/'.$modelCatalog->profileGuid.'/keywords/'.$keywords.'/node/'.$sessHistory->currentNode);
             			}
             		}
             		else 
             		{
             			$this->_redirect(ROOT_URL.'/'.$this->_lang->getLanguage().'/dms/explorer/browse/node/'.$sessHistory->currentNode);
             		}*/
         }
     }
     $this->_helper->layout()->headerTitle = "Catalog Management: Edit Catalog";
     $sessHistory = new Zend_Session_Namespace('BROWSER_HISTORY');
     $sessHistory->urlReferer = $urlReferer;
     $this->view->urlReferer = $sessHistory->urlReferer;
 }