Example #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();
         }
     }
 }
Example #2
1
 protected function _postDelete()
 {
     //find related docs and delete them
     $tblRelatedItem = new App_Model_Db_Table_RelatedItem();
     $rowsetRelatedDocs = $tblRelatedItem->fetchAll("relatedGuid='{$this->guid}' AND relateAs IN ('RELATED_FILE','RELATED_IMAGE','RELATED_VIDEO')");
     if (count($rowsetRelatedDocs)) {
         foreach ($rowsetRelatedDocs as $rowRelatedDoc) {
             $tblCatalog = new App_Model_Db_Table_Catalog();
             $rowCatalog = $tblCatalog->find($rowRelatedDoc->itemGuid)->current();
             if ($rowCatalog) {
                 $rowCatalog->delete();
             }
         }
     }
     $registry = Zend_Registry::getInstance();
     $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
     $cdn = $config->getOption('cdn');
     if ($this->profileGuid == 'kutu_doc') {
         //get parentGuid
         $tblRelatedItem = new App_Model_Db_Table_RelatedItem();
         $rowsetRelatedItem = $tblRelatedItem->fetchAll("itemGuid='{$this->guid}' AND relateAs IN ('RELATED_FILE','RELATED_IMAGE','RELATED_VIDEO')");
         if (count($rowsetRelatedItem)) {
             foreach ($rowsetRelatedItem as $rowRelatedItem) {
                 //must delete the physical files
                 $rowsetCatAtt = $this->findDependentRowsetCatalogAttribute();
                 $systemname = $rowsetCatAtt->findByAttributeGuid('docSystemName')->value;
                 $parentGuid = $rowRelatedItem->relatedGuid;
                 $sDir1 = $cdn['static']['dir']['files'] . DIRECTORY_SEPARATOR . $systemname;
                 $sDir2 = $cdn['static']['dir']['files'] . DIRECTORY_SEPARATOR . $parentGuid . DIRECTORY_SEPARATOR . $systemname;
                 //$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)) {
                     //delete file
                     unlink($sDir1);
                 } else {
                     if (file_exists($sDir2)) {
                         //delete file
                         unlink($sDir2);
                     }
                 }
             }
         }
     }
     //delete from table CatalogAttribute
     $tblCatalogAttribute = new App_Model_Db_Table_CatalogAttribute();
     $tblCatalogAttribute->delete("catalogGuid='{$this->guid}'");
     //delete catalogGuid from table CatalogFolder
     $tblCatalogFolder = new App_Model_Db_Table_CatalogFolder();
     $tblCatalogFolder->delete("catalogGuid='{$this->guid}'");
     //delete guid from table AssetSetting
     $tblAssetSetting = new App_Model_Db_Table_AssetSetting();
     $tblAssetSetting->delete("guid='{$this->guid}'");
     //delete from table relatedItem
     $tblRelatedItem = new App_Model_Db_Table_RelatedItem();
     $tblRelatedItem->delete("itemGuid='{$this->guid}'");
     $tblRelatedItem->delete("relatedGuid='{$this->guid}'");
     $indexingEngine = Pandamp_Search::manager();
     try {
         $hits = $indexingEngine->deleteCatalogFromIndex($this->guid);
     } catch (Exception $e) {
     }
     //delete physical catalog folder from uploads/files/[catalogGuid]
     $sDir = $cdn['static']['dir']['files'] . DIRECTORY_SEPARATOR . $this->guid;
     //$sDir = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR.$this->guid;
     try {
         if (is_dir($sDir)) {
             rmdir($sDir);
         }
     } catch (Exception $e) {
     }
     $sDir = $cdn['static']['dir']['images'];
     //$sDir = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'images';
     try {
         if (file_exists($sDir . "/" . $this->guid . ".gif")) {
             unlink($sDir . "/" . $this->guid . ".gif");
         }
         if (file_exists($sDir . "/tn_" . $this->guid . ".gif")) {
             unlink($sDir . "/tn_" . $this->guid . ".gif");
         }
         if (file_exists($sDir . "/" . $this->guid . ".jpg")) {
             unlink($sDir . "/" . $this->guid . ".jpg");
         }
         if (file_exists($sDir . "/tn_" . $this->guid . ".jpg")) {
             unlink($sDir . "/tn_" . $this->guid . ".jpg");
         }
         if (file_exists($sDir . "/" . $this->guid . ".jpeg")) {
             unlink($sDir . "/" . $this->guid . ".jpeg");
         }
         if (file_exists($sDir . "/tn_" . $this->guid . ".jpeg")) {
             unlink($sDir . "/tn_" . $this->guid . ".jpeg");
         }
         if (file_exists($sDir . "/" . $this->guid . ".png")) {
             unlink($sDir . "/" . $this->guid . ".png");
         }
         if (file_exists($sDir . "/tn_" . $this->guid . ".png")) {
             unlink($sDir . "/tn_" . $this->guid . ".png");
         }
     } catch (Exception $e) {
     }
 }
Example #3
0
 function cartAction()
 {
     if (!is_object($_SESSION['jCart'])) {
         $this->_redirect(ROOT_URL . '/checkout/cartempty');
     }
     if (count($_SESSION['jCart']->items) == 0) {
         $this->_redirect(ROOT_URL . '/checkout/cartempty');
     }
     $cart =& $_SESSION['jCart'];
     if (!is_object($cart)) {
         $cart = new jCart();
     }
     $this->view->cart = $cart;
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $rowset = $tblCatalog->fetchRow("guid='lt4d197e9f8919f'", 'createdDate DESC');
     $content = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedContent');
     $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedTitle');
     $subTitle = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedSubTitle');
     $this->view->content = $content;
     $this->view->title = $title;
     $this->view->subTitle = $subTitle;
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $rowset = $tblCatalog->fetchRow("guid='lt4d196f17c9836'", 'createdDate DESC');
     $content = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedContent');
     $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedTitle');
     $subTitle = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedSubTitle');
     $this->view->cp = $content;
     $this->view->tp = $title;
     $this->view->sp = $subTitle;
     if ($this->_isStoreClosed()) {
         $this->_redirect(ROOT_URL . '/checkout/closed');
     }
 }
Example #4
0
 /**
  * getMailContent
  */
 function getMailContent($title)
 {
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $where = $tblCatalog->getAdapter()->quoteInto("shortTitle=?", $title);
     $rowset = $tblCatalog->fetchRow($where);
     $content = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedContent');
     return $content;
 }
Example #5
0
 public function getLocation($catalogGuid)
 {
     $catalogDb = new App_Model_Db_Table_Catalog();
     $catalogs = $catalogDb->find($catalogGuid)->current();
     $folders = $catalogs->findManyToManyRowset('App_Model_Db_Table_Folder', 'App_Model_Db_Table_CatalogFolder');
     if ($folders) {
         return $folders;
     }
     return;
 }
Example #6
0
 public function viewFolderAction()
 {
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $rowCatalog = $tblCatalog->find($catalogGuid)->current();
     if ($rowCatalog) {
         $rowsetFolder = $rowCatalog->findManyToManyRowset('App_Model_Db_Table_Folder', 'App_Model_Db_Table_CatalogFolder');
         $this->view->rowsetFolder = $rowsetFolder;
         $this->view->catalogGuid = $catalogGuid;
     }
 }
Example #7
0
 public function GetCatalogDocSize($catalogGuid)
 {
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $rowsetCatalog = $tblCatalog->find($catalogGuid);
     if (count($rowsetCatalog)) {
         $rowCatalog = $rowsetCatalog->current();
         $rowsetCatAtt = $rowCatalog->findDependentRowsetCatalogAttribute();
         $docSize = $this->bytesToString($rowsetCatAtt->findByAttributeGuid('docSize')->value);
     } else {
         $docSize = '0kB';
     }
     return $docSize;
 }
Example #8
0
 public function GetCatalogDocType($catalogGuid, $relatedGuid = NULL)
 {
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $rowsetCatalog = $tblCatalog->find($catalogGuid);
     if (count($rowsetCatalog)) {
         $rowCatalog = $rowsetCatalog->current();
         $rowsetCatAtt = $rowCatalog->findDependentRowsetCatalogAttribute();
         $docType = $this->imageDocumentType($this->dl_file($rowsetCatAtt->findByAttributeGuid('docOriginalName')->value), $catalogGuid, $relatedGuid);
     } else {
         $docType = '';
     }
     return $docType;
 }
Example #9
0
 function browseAction()
 {
     $request = $this->getRequest();
     $pageIndex = $request->getParam('page', 1);
     $node = $request->getParam('node', 'root');
     $limit = $request->getParam('showperpage', 25);
     $status = $request->getParam('status');
     $sortby = $request->getParam('sortby', 'publishedDate desc');
     $offset = $pageIndex > 0 ? ($pageIndex - 1) * $limit : 0;
     if ($node == "lt4b11ece54d870") {
         // Approved
         $status = "1";
     } elseif ($node == "lt4b11e8fde1e42") {
         // Draft
         $status = "0";
     } elseif ($node == "lt4b11ecf5408d2") {
         // NA (Not Available)
         $status = "2";
     } elseif ($node == "lt4b11e8c86c8a4") {
         // Published
         $status = "99";
         $sortby = "publishedDate desc";
     }
     $catalogDb = new App_Model_Db_Table_Catalog();
     $rowset = $catalogDb->fetchCatalogInFolder($node, $offset, $limit, $sortby, ['status' => $status]);
     $numOfRows = $catalogDb->getCountCatalogInFolder($node, ['status' => $status]);
     $paginator = new Zend_Paginator(new Pandamp_Utility_PaginatorAdapter($rowset, $numOfRows));
     /*$cache = Pandamp_Cache::getInstance();
     		if ($cache) {
     			Zend_Paginator::setCache($cache);
     		}
     		$paginator->setCacheEnabled(true);*/
     $paginator->setCurrentPageNumber($pageIndex);
     $paginator->setItemCountPerPage($limit);
     $paginator = get_object_vars($paginator->getPages('Sliding'));
     $modDir = $this->getFrontController()->getModuleDirectory();
     require_once $modDir . '/components/Menu/FolderBreadcrumbs2.php';
     $w = new Dms_Menu_FolderBreadcrumbs2($node);
     $this->view->assign('breadcrumbs', $w);
     $this->view->assign('currentNode', $node);
     $this->view->assign('limit', $limit);
     $this->view->assign('totalItems', $numOfRows);
     $this->view->assign('rowset', $rowset);
     $this->view->assign('paginator', $paginator);
     $this->view->assign('sortby', $sortby);
     $this->_helper->layout()->showperpage = $limit;
     $this->_helper->layout()->status = $status;
     $sortby = str_replace(array("desc", "asc"), "", $sortby);
     $this->_helper->layout()->sort = trim($sortby);
 }
Example #10
0
 function _mitraKlinikAction()
 {
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $rowset = $tblCatalog->fetchAll("guid!='lt4b1a5aadda0f1' AND profileGuid='partner'", 'createdDate DESC');
     $content = 0;
     $data = array();
     foreach ($rowset as $row) {
         $data[$content][0] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row->guid, 'fixedTitle');
         $data[$content][1] = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row->guid, 'fixedContent');
         $data[$content][2] = $row->guid;
         $content++;
     }
     $num_row = count($rowset);
     $this->view->numberOfRows = $num_row;
     $this->view->aData = $data;
 }
Example #11
0
 public function indexCatalog($guid)
 {
     $solr =& $this->_solr;
     $tbl = new App_Model_Db_Table_Catalog();
     $rowset = $tbl->find($guid);
     if (count($rowset)) {
         $row = $rowset->current();
         $documents = array();
         $documents[] = $this->_createSolrDocument($row);
         try {
             $solr->addDocuments($documents);
             $solr->commit();
             //$solr->optimize();
         } catch (Exception $e) {
             throw new Zend_Exception($e->getMessage());
         }
     }
 }
Example #12
0
 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);
     }
 }
 function generateFormEdit($catalogGuid)
 {
     $zl = Zend_Registry::get("Zend_Locale");
     $today = date('Y-m-d H:i:s');
     $aRenderedAttributes = array();
     $aBaseAttributes = array();
     $tableCatalog = new App_Model_Db_Table_Catalog();
     $rowsetCatalog = $tableCatalog->find($catalogGuid);
     $rowCatalog = $rowsetCatalog->current();
     $tableProfileAttribute = new App_Model_Db_Table_ProfileAttribute();
     $where = $tableProfileAttribute->getAdapter()->quoteInto('profileGuid=?', $rowCatalog->profileGuid);
     $rowsetProfileAttribute = $tableProfileAttribute->fetchAll($where, array('viewOrder ASC'));
     $rowsetCatalogAttribute = $rowCatalog->findDependentRowsetCatalogAttribute();
     $i = 0;
     foreach ($rowsetProfileAttribute as $row) {
         $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid($row->attributeGuid);
         $rowAttribute = $row->findParentRow('App_Model_Db_Table_Attribute');
         if (isset($rowCatalogAttribute->value)) {
             $attributeValue = $rowCatalogAttribute->value;
         } else {
             $attributeValue = '';
         }
         if (isset($rowCatalogAttribute->guid)) {
             $catalogAttributeGuid = $rowCatalogAttribute->guid;
         } else {
             $guidMan = new Pandamp_Core_Guid();
             $catalogAttributeGuid = $guidMan->generateGuid();
         }
         if (isset($rowAttribute)) {
             $desc = $rowAttribute->description == 'Category' ? 'Kategori Klinik' : $rowAttribute->description;
             if ($zl->getLanguage() == 'en') {
                 $attributeRenderer = new Pandamp_Form_Attribute_Renderer($rowAttribute->guid, $attributeValue, $rowAttribute->type, null, $rowCatalog->profileGuid, $desc, 'clinic_partner');
             } else {
                 $attributeRenderer = new Pandamp_Form_Attribute_Renderer($rowAttribute->guid, $attributeValue, $rowAttribute->type, null, $rowCatalog->profileGuid, $desc, 'partner');
             }
             //$aRenderedAttributes[$rowAttribute->guid]['description'] = ($rowAttribute->description == 'Category')? 'Kategori Klinik' : $rowAttribute->description;
             $aRenderedAttributes[$rowAttribute->guid]['form'] = $attributeRenderer->render();
         }
         $i++;
     }
     $aBaseAttributes['guid']['description'] = '';
     $aBaseAttributes['guid']['form'] = "<input type='hidden' name='guid' id='guid' value='{$rowCatalog->guid}'>";
     $checked = $rowCatalog->sticky == 1 ? 'checked="checked"' : '';
     $aBaseAttributes['stickyCategory']['form'] = "<input type=\"checkbox\" name=\"stickyCategory\" value=\"1\" {$checked} />&nbsp;<b>Set this article sticky</b>";
     $aBaseAttributes['stickyCategory']['description'] = "";
     $aBaseAttributes['shortTitle']['description'] = 'shortTitle';
     $aBaseAttributes['shortTitle']['form'] = "<textarea name='shortTitle' id='shortTitle' rows='1'' cols='50'>{$rowCatalog->shortTitle}</textarea>";
     $aBaseAttributes['profileGuid']['description'] = 'Profile';
     $aBaseAttributes['profileGuid']['form'] = $rowCatalog->profileGuid . "<input type='hidden' name='profileGuid' id='profileGuid' value='{$rowCatalog->profileGuid}'>";
     //TO DO: I don't think we should put category/folder input here in cataloginputgenerator.
     /*$aBaseAttributes['folderGuid']['description'] = 'Category';
     		$aBaseAttributes['folderGuid']['form'] = $folderGuid."<input type='hidden' name='folderGuid' id='folderGuid' value='$folderGuid'>";*/
     $registry = Zend_Registry::getInstance();
     $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
     $cdn = $config->getOption('cdn');
     $s = '<input type="Text" id="publishedDate" maxlength="25" size="25" name="publishedDate" value="' . $rowCatalog->publishedDate . '"><a href="javascript:NewCal(\'publishedDate\',\'yyyymmdd\',true,24)"><img src="' . $cdn['static']['images'] . '/img.gif" width="16" height="16" border="0" alt="Pick a date"></a>';
     $aBaseAttributes['publishedDate']['description'] = 'Published Date';
     $aBaseAttributes['publishedDate']['form'] = $s;
     $n = '<input type="Text" id="expiredDate" maxlength="25" size="25" name="expiredDate" value="' . $rowCatalog->expiredDate . '"><a href="javascript:NewCal(\'expiredDate\',\'yyyymmdd\',true,24)"><img src="' . $cdn['static']['images'] . '/img.gif" width="16" height="16" border="0" alt="Pick a date"></a>';
     $aBaseAttributes['expiredDate']['description'] = 'Expired Date';
     $aBaseAttributes['expiredDate']['form'] = $n;
     /*
     $aBaseAttributes['publishedDate']['description'] = '';
     $aBaseAttributes['publishedDate']['form'] = "<input type='hidden' name='publishedDate' id='publishedDate' value='$rowCatalog->publishedDate'>";
     $aBaseAttributes['expiredDate']['description'] = '';
     $aBaseAttributes['expiredDate']['form'] = "<input type='hidden' name='expiredDate' id='expiredDate' value='$rowCatalog->expiredDate'>";
     */
     $aBaseAttributes['createdDate']['description'] = 'Created on';
     $aBaseAttributes['createdDate']['form'] = $rowCatalog->createdDate . "<input type='hidden' name='createdDate' id='createdDate' value='{$rowCatalog->createdDate}'>";
     $aBaseAttributes['modifiedDate']['description'] = 'Last Modified on';
     $aBaseAttributes['modifiedDate']['form'] = $rowCatalog->modifiedDate . "<input type='hidden' name='modifiedDate' id='modifiedDate' value='{$today}'>";
     $aBaseAttributes['deletedDate']['description'] = 'Deleted on';
     $aBaseAttributes['deletedDate']['form'] = $rowCatalog->deletedDate . "<input type='hidden' name='deletedDate' id='deletedDate' value='{$rowCatalog->deletedDate}'>";
     $aBaseAttributes['status']['description'] = 'Status';
     $aBaseAttributes['price']['description'] = 'Price';
     $aBaseAttributes['price']['form'] = "<input type='text' name='price' id='price' value='{$rowCatalog->price}'>";
     require_once CONFIG_PATH . '/master-status.php';
     $statusConfig = MasterStatus::getPublishingStatus();
     //$aBaseAttributes['status']['form'] = $statusConfig[$rowCatalog->status]."<input type='hidden' name='status' id='status' value='$rowCatalog->status'>";
     $attributeRenderer = new Pandamp_Form_Attribute_Renderer('status', $rowCatalog->status, 101);
     $aBaseAttributes['status']['form'] = $attributeRenderer->render();
     $aReturn = array();
     $aReturn['baseForm'] = $aBaseAttributes;
     $aReturn['attributeForm'] = $aRenderedAttributes;
     return $aReturn;
 }
Example #14
0
 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
 }
Example #15
0
 function viewerClinic80Action()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $dateDiff = new Pandamp_Lib_DateDiff();
     $author = $this->_getParam('folderGuid') ? $this->_getParam('folderGuid') : '';
     $start = $this->_getParam('start') ? $this->_getParam('start') : 0;
     $limit = $this->_getParam('limit') ? $this->_getParam('limit') : 10;
     $a = array();
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $tblCatalogAttribute = new App_Model_Db_Table_CatalogAttribute();
     $clinic = $tblCatalogAttribute->fetchAll("value='" . $author . "'", '', $limit, $start);
     $clinic1 = $tblCatalogAttribute->fetchAll("value='" . $author . "'");
     $a['folderGuid'] = $author;
     $a['totalCount'] = count($clinic1);
     $ii = 0;
     if ($clinic) {
         $value_clinic = array();
         foreach ($clinic as $c) {
             $value_clinic[] = $c->catalogGuid;
         }
         //			$value_clinic = $tblCatalog->implode_with_keys(", ", $value_clinic, "'");
         echo '<pre>';
         print_r($value_clinic);
         echo '</pre>';
         die;
         if (isset($value_clinic)) {
             $rowset = $tblCatalog->fetchAll("guid IN({$value_clinic}) AND status=99", "publishedDate desc");
             foreach ($rowset as $row) {
                 $arraypictureformat = array("jpg", "jpeg", "gif");
                 $txt_allowedformat = implode('; ', $arraypictureformat);
                 $registry = Zend_Registry::getInstance();
                 $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
                 $cdn = $config->getOption('cdn');
                 $sDir = $cdn['static']['dir']['photo'];
                 $sDir2 = $cdn['static']['url']['photo'] . '/';
                 $smg = $cdn['static']['images'];
                 $modelUser = App_Model_Show_User::show()->getUserByName($row->createdBy);
                 $x = 0;
                 foreach ($arraypictureformat as $key => $val) {
                     if (is_file($sDir . "/" . $modelUser['kopel'] . "." . $val)) {
                         $myphoto = $sDir . "/" . $modelUser['kopel'] . "." . $val;
                         $myext = $val;
                         $x = 1;
                         break;
                     }
                 }
                 if ($x == 1) {
                     $myphotosize = getimagesize($myphoto);
                     $dis = "";
                     if (isset($myext) && is_file($sDir . "/" . $modelUser['kopel'] . "." . $myext)) {
                         $txt_existence = "<img src=\"" . $sDir2 . $modelUser['kopel'] . "." . $myext . "\" class=\"avatar\" width=\"38\" height=\"38\" />";
                     }
                 } else {
                     $txt_existence = "<img src=\"" . $smg . "/gravatar-140.png\" width=\"38\" height=\"38\" class=\"avatar\" border=\"0\" />";
                 }
                 $rowsetCatalogAttribute = $row->findDependentRowsetCatalogAttribute();
                 $rowCatalogTitle = $rowsetCatalogAttribute->findByAttributeGuid('fixedCommentTitle');
                 $rowCatalogQuestion = $rowsetCatalogAttribute->findByAttributeGuid('fixedCommentQuestion');
                 $rowCatalogSelectCat = $rowsetCatalogAttribute->findByAttributeGuid('fixedKategoriKlinik');
                 $author = $rowsetCatalogAttribute->findByAttributeGuid('fixedSelectNama');
                 $source = $rowsetCatalogAttribute->findByAttributeGuid('fixedSelectMitra');
                 /* Get Category from profile clinic_category */
                 $findCategory = $tblCatalog->find($rowCatalogSelectCat->value)->current();
                 $rowCategory = $findCategory->findDependentRowsetCatalogAttribute();
                 $category = $rowCategory->findByAttributeGuid('fixedTitle');
                 $a['index'][$ii]['title'] = $rowCatalogTitle->value;
                 $a['index'][$ii]['question'] = $rowCatalogQuestion->value;
                 $a['index'][$ii]['secat'] = $rowCatalogSelectCat->value;
                 $a['index'][$ii]['category'] = $category->value;
                 $a['index'][$ii]['guid'] = $row->guid;
                 $a['index'][$ii]['createdBy'] = $row->createdBy;
                 $a['index'][$ii]['author'] = isset($author->value) ? $author->value : '';
                 if (isset($source->value)) {
                     $findSource = $tblCatalog->find($source->value)->current();
                     $rowSource = $findCategory->findDependentRowsetCatalogAttribute();
                     $sc = $rowSource->findByAttributeGuid('fixedTitle');
                     $a['index'][$ii]['source'] = $sc->value;
                     $a['index'][$ii]['sid'] = $source->value;
                 } else {
                     $a['index'][$ii]['source'] = '';
                     $a['index'][$ii]['sid'] = '';
                 }
                 $a['index'][$ii]['publishedDate'] = $dateDiff->ago(strftime('%Y-%m-%d %H:%M:%S', strtotime($row->publishedDate)));
                 $a['index'][$ii]['existence'] = '<div style="float:left;padding:2px;margin: 1px 10px 10px 0px;"><a href="">' . $txt_existence . '</a></div>';
                 $ii++;
             }
         }
     }
     echo Zend_Json::encode($a);
 }
Example #16
0
 public function render()
 {
     $sReturn = '';
     switch ($this->type) {
         default:
         case 0:
             // field type = single line
             $view = new Zend_View();
             $view->name = $this->name;
             $view->value = $this->value;
             if (isset($this->attribs)) {
                 $view->attribs = $this->attribs;
             } else {
                 $view->attribs = array('rows' => 1, 'cols' => 50);
             }
             $view->setScriptPath(dirname(__FILE__));
             return $view->render('TextArea.phtml');
             break;
         case 1:
             // field type = textarea paragraph
             $view = new Zend_View();
             $view->label = $this->label;
             $view->name = $this->name;
             $view->value = $this->value;
             if (isset($this->attribs)) {
                 $view->attribs = $this->attribs;
             } else {
                 $view->attribs = array('rows' => 5, 'cols' => 50, 'class' => 'form-control');
             }
             $view->setScriptPath(dirname(__FILE__));
             return $view->render('TextArea.phtml');
             break;
         case 2:
             // field type = html paragraph
             //				require_once('FCKeditor/fckeditor.php');
             //				$oFCKeditor = new FCKeditor($this->name) ;
             //				$oFCKeditor->BasePath = ROOT_URL.'/library/FCKeditor/';
             //				$oFCKeditor->Value = $this->value;
             //				$oFCKeditor->Width  = '100%' ;
             //				$oFCKeditor->Height = '400' ;
             //				$sReturn = $oFCKeditor->CreateHtml() ;
             //	            return $sReturn;
             $view = new Zend_View();
             $view->label = $this->label;
             $view->name = $this->name;
             $view->value = $this->value;
             $view->setScriptPath(dirname(__FILE__));
             return $view->render('TextArea2.phtml');
             break;
             //	        	$view = new Zend_View();
             //				$view->name = $this->name;
             //				$view->value = $this->value;
             //
             //				$config = Pandamp_Config::getConfig();
             //				$view->cdn = $config->cdn->js;
             //				if(isset($this->attribs))
             //					$view->attribs = $this->attribs;
             //				else
             //					$view->attribs = array('class' => 'tinymce', 'style' => 'width: 440px; height: 1000px;');
             //				$view->setScriptPath(dirname(__FILE__));
             //				return $view->render('TextAreaContent.phtml');
             //
             //				break;
         //	        	$view = new Zend_View();
         //				$view->name = $this->name;
         //				$view->value = $this->value;
         //
         //				$config = Pandamp_Config::getConfig();
         //				$view->cdn = $config->cdn->js;
         //				if(isset($this->attribs))
         //					$view->attribs = $this->attribs;
         //				else
         //					$view->attribs = array('class' => 'tinymce', 'style' => 'width: 440px; height: 1000px;');
         //				$view->setScriptPath(dirname(__FILE__));
         //				return $view->render('TextAreaContent.phtml');
         //
         //				break;
         case 79:
             // field type = html paragraph
             require_once 'FCKeditor/fckeditor.php';
             $oFCKeditor = new FCKeditor($this->name);
             $oFCKeditor->BasePath = ROOT_URL . '/library/FCKeditor/';
             $oFCKeditor->Value = $this->value;
             $oFCKeditor->Width = '100%';
             $oFCKeditor->Height = '400';
             $sReturn = $oFCKeditor->CreateHtml();
             return $sReturn;
             //	        	$view = new Zend_View();
             //				$view->name = $this->name;
             //				$view->value = $this->value;
             //				if(isset($this->attribs))
             //					$view->attribs = $this->attribs;
             //				else
             //					$view->attribs = array('class' => 'tinymce', 'style' => 'width: 440px; height: 200px;');
             //				$view->setScriptPath(dirname(__FILE__));
             //				return $view->render('TextAreaDescription.phtml');
             break;
         case 80:
             $view = new Zend_View();
             $view->name = $this->name;
             $view->value = $this->value;
             $view->setScriptPath(dirname(__FILE__));
             return $view->render('TextArea3.phtml');
             break;
         case 3:
             // field type = hidden
             $n = "<input type='hidden' name='{$this->name}' value='{$this->value}'>";
             return $n;
             break;
         case -400:
             //$value = $this->convertDate($fieldValue);
             $value = $fieldValue;
             echo '<script language="Javascript" src="calendar/calendar.js"></script>';
             echo '<input type="text" name="' . $attributeId . '" value="' . $value . '">';
             $fieldTblGuid = $attributeId . '_guid';
             echo "<input type='hidden' name='{$fieldTblGuid}' value='{$tblGuid}'>";
             echo '&nbsp;<a href="javascript: void(0);" onclick="return getCalendar(document.forms[0].' . $attributeId . ');" onChange="AddCurrentTime(document.forms[0].' . $attributeId . ');">Pilih Tanggal</a>';
             break;
         case 4:
             $view = new Zend_View();
             $view->label = $this->label;
             $view->name = $this->name;
             $view->value = $this->value;
             $view->setScriptPath(dirname(__FILE__));
             $view->addHelperPath(APPLICATION_PATH . '/../library/Pandamp/Controller/Action/Helper', 'Pandamp_Controller_Action_Helper');
             return $view->render('datetime.phtml');
             break;
             //datetime field
         //datetime field
         case 5:
             /*echo 
             		'<link rel="stylesheet" type="text/css" media="all" href="calendar2/calendar-mos.css" title="green" />	
             		<script type="text/javascript" src="calendar2/calendar.js"></script>
             		<script type="text/javascript" src="calendar2/lang/calendar-en.js"></script>
             		<script language="javascript" src="calendar2/mambojavascript.js"></script>';*/
             $view = new Zend_View();
             $view->name = $this->name;
             $view->value = $this->value;
             $view->setScriptPath(dirname(__FILE__));
             $view->addHelperPath(APPLICATION_PATH . '/../library/Pandamp/Controller/Action/Helper', 'Pandamp_Controller_Action_Helper');
             return $view->render('datetime.phtml');
             /*$fieldTblGuid = $attributeId.'_guid';
             		echo "<input type='hidden' name='$fieldTblGuid' value='$tblGuid'>";
             		echo '<input class="inputbox" type="text" name="'.$attributeId.'" id="'.$attributeId.'" size="25" maxlength="25" value="'.$fieldValue.'" />';
                      	
             		echo '<input type="reset" class="button" value="..." onClick="return showCalendar'."('$attributeId', 'dd/mm/Y')".';">';*/
             break;
             // updated Nov 1, 2015
         // updated Nov 1, 2015
         case 6:
             $view = new Zend_View();
             $view->label = $this->label;
             $view->name = $this->name;
             $view->value = $this->value;
             if (isset($this->attribs)) {
                 $view->attribs = $this->attribs;
             } else {
                 $view->attribs = array('class' => 'form-control');
             }
             $view->setScriptPath(dirname(__FILE__));
             return $view->render('Text.phtml');
             break;
         case -5:
             // field type = Image Area
             $frm = new FormInputImageAreaUc();
             $frm->fieldName = $attributeId;
             $frm->fieldValue = $fieldValue;
             $frm->renderMe();
             $fieldTblGuid = $attributeId . '_guid';
             echo "<input type='hidden' name='{$fieldTblGuid}' value='{$tblGuid}'>";
             break;
         case -6:
             // field type = LABEL
             echo $fieldValue;
             echo "<input type='hidden' name='{$attributeId}' value='{$fieldValue}'>";
             $fieldTblGuid = $attributeId . '_guid';
             echo "<input type='hidden' name='{$fieldTblGuid}' value='{$tblGuid}'>";
             break;
         case 7:
             // field type = MULTI VALUE (SELECT:OPTIONS)
             /*$oAttGenerator = new UiFormInputAttributeGenerator();
              	$s = $oAttGenerator->generateFormInputAttributeByDmsProfileGuidAndAttributeGuid($this->dmsProfileGuid,$attributeId,$attributeId,$fieldValue);
              	
              	echo $s;
                  //echo "<textarea name='$attributeId' rows='0' cols='50'>$fieldValue</textarea>";
                  
                  $fieldTblGuid = $attributeId.'_guid';
                  echo "<input type='hidden' name='$fieldTblGuid' value='$tblGuid'>";
                  break;*/
             $tblProAtt = new App_Model_Db_Table_ProfileAttribute();
             $rowset = $tblProAtt->fetchAll("profileGuid='{$this->profileGuid}' AND attributeGuid='{$this->name}'");
             $defaultValues = array();
             if (count($rowset) == 1) {
                 $row = $rowset->current();
                 $defaultValues = Zend_Json::decode($row->defaultValues);
                 if (is_array($defaultValues)) {
                     //var_dump($defaultValues);
                 } else {
                     $defaultValues = array();
                 }
             }
             $view = new Zend_View();
             $view->label = $this->label;
             $view->name = $this->name;
             $view->value = $this->value;
             $view->defaultValues = $defaultValues;
             /*if(isset($this->attribs))
             			$view->attribs = $this->attribs;
             		else
             			$view->attribs = array('rows' => 5, 'cols' =>50);*/
             $view->setScriptPath(dirname(__FILE__));
             return $view->render('select.phtml');
             break;
         case 8:
             $tblCatalog = new App_Model_Db_Table_Catalog();
             $rowset = $tblCatalog->fetchAll("profileGuid='{$this->other}'", 'shortTitle asc');
             $i = 0;
             $a = array();
             $data = array();
             foreach ($rowset as $row) {
                 $rowsetCatalogAttribute = $row->findDependentRowsetCatalogAttribute();
                 $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid('fixedTitle');
                 $a[$i]['label'] = is_object($rowCatalogAttribute) ? $rowCatalogAttribute->value : '';
                 $a[$i]['value'] = "{$row->guid}";
                 $a[$i]['selected'] = $i == 0 ? "true" : "false";
                 $i++;
             }
             $data = Zend_Json::decode(Zend_Json::encode($a));
             $view = new Zend_View();
             $view->label = $this->label;
             $view->name = $this->name;
             $view->value = $this->value;
             $view->defaultValues = $data;
             $view->setScriptPath(dirname(__FILE__));
             return $view->render('select.phtml');
             break;
         case 9:
             $n = "<input type='text' class='txt' name='{$this->name}' value='{$this->value}' size='5'>";
             return $n;
             break;
         case 10:
             $n = '<textarea id="html" name="jTagEditor" class="jTagEditor">' . $this->value . '</textarea>';
             return $n;
             break;
         case 11:
             if ($this->value == 1) {
                 $check = 'checked';
             } else {
                 $check = '';
             }
             $n = "<input type='checkbox' name='{$this->name}' value='1' {$check}>";
             return $n;
             break;
         case 12:
             $tblCatalog = new App_Model_Db_Table_Catalog();
             $rowset = $tblCatalog->fetchAll("profileGuid='{$this->profileGuid}'", 'shortTitle asc');
             $i = 0;
             $a = array();
             $data = array();
             foreach ($rowset as $row) {
                 $rowsetCatalogAttribute = $row->findDependentRowsetCatalogAttribute();
                 $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid('fixedTitle');
                 $a[$i]['label'] = is_object($rowCatalogAttribute) ? trim($rowCatalogAttribute->value) : '';
                 $a[$i]['value'] = "{$row->guid}";
                 $a[$i]['selected'] = $i == 0 ? "true" : "false";
                 $i++;
             }
             $data = Zend_Json::decode(Zend_Json::encode($a));
             $view = new Zend_View();
             $view->label = $this->label;
             $view->name = $this->name;
             $view->value = $this->value;
             $view->defaultValues = $data;
             $view->setScriptPath(dirname(__FILE__));
             return $view->render('select.phtml');
             break;
             /*
              * @TODO category clinic
              */
         /*
          * @TODO category clinic
          */
         case 13:
             $tblCatalog = new App_Model_Db_Table_Catalog();
             $rowset = $tblCatalog->fetchAll("profileGuid='kategoriklinik'", 'shortTitle asc');
             $i = 0;
             $a = array();
             $data = array();
             foreach ($rowset as $row) {
                 $rowsetCatalogAttribute = $row->findDependentRowsetCatalogAttribute();
                 $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid('fixedTitle');
                 $a[$i]['label'] = is_object($rowCatalogAttribute) ? $rowCatalogAttribute->value : '';
                 $a[$i]['value'] = "{$row->guid}";
                 $a[$i]['selected'] = $i == 0 ? "true" : "false";
                 $i++;
             }
             $data = Zend_Json::decode(Zend_Json::encode($a));
             $view = new Zend_View();
             $view->label = $this->label;
             $view->name = $this->name;
             $view->value = $this->value;
             $view->defaultValues = $data;
             $view->setScriptPath(dirname(__FILE__));
             return $view->render('select.phtml');
             break;
         case 14:
             // tags
             $view = new Zend_View();
             $view->label = $this->label;
             $view->name = $this->name;
             $view->value = $this->value;
             if (isset($this->attribs)) {
                 $view->attribs = $this->attribs;
             } else {
                 $view->attribs = array('rows' => 3, 'class' => 'form-control');
             }
             $view->setScriptPath(dirname(__FILE__));
             return $view->render('tags.phtml');
             break;
         case 15:
             $tblCatalog = new App_Model_Db_Table_Catalog();
             $rowset = $tblCatalog->fetchAll("profileGuid='narsum'", 'shortTitle asc');
             $i = 0;
             $a = array();
             $data = array();
             foreach ($rowset as $row) {
                 $rowsetCatalogAttribute = $row->findDependentRowsetCatalogAttribute();
                 $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid('fixedTitle');
                 $a[$i]['label'] = is_object($rowCatalogAttribute) ? trim($rowCatalogAttribute->value) : '';
                 $a[$i]['value'] = "{$row->guid}";
                 $a[$i]['selected'] = $i == 0 ? "true" : "false";
                 $i++;
             }
             $data = Zend_Json::decode(Zend_Json::encode($a));
             $view = new Zend_View();
             $view->label = $this->label;
             $view->name = $this->name . '[]';
             $view->id = $this->name;
             $r = explode(",", $this->value);
             $view->value = "'" . implode("','", $r) . "'";
             $view->profile = 'narsum';
             $view->defaultValues = $data;
             $view->setScriptPath(dirname(__FILE__));
             return $view->render('select3.phtml');
             break;
         case 101:
             //publishing status
             require_once CONFIG_PATH . '/master-status.php';
             $aStatus = MasterStatus::getPublishingStatus();
             $view = new Zend_View();
             $view->name = $this->name;
             $view->value = $this->value;
             $auth = Zend_Auth::getInstance();
             $identity = $auth->getIdentity();
             $username = $identity->username;
             // get group information
             $acl = Pandamp_Acl::manager();
             $aReturn = $acl->getUserGroupIds($username);
             if (isset($aReturn[1])) {
                 if ($aReturn[1] == "klinik_editor") {
                     unset($aStatus[99]);
                 }
             }
             $view->defaultValues = $aStatus;
             $view->setScriptPath(dirname(__FILE__));
             return $view->render('select2.phtml');
     }
 }
Example #17
0
 function delete($itemGuid, $relatedGuid, $relateAs)
 {
     if (empty($relateAs)) {
         throw new Zend_Exception('relateAs can not be empty!');
     }
     $registry = Zend_Registry::getInstance();
     $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
     $cdn = $config->getOption('cdn');
     $tblRelatedItem = new App_Model_Db_Table_RelatedItem();
     $rowsetRelatedDocs = $tblRelatedItem->fetchAll("itemGuid='{$itemGuid}' AND relatedGuid='{$relatedGuid}' AND relateAs='{$relateAs}'");
     if ($rowsetRelatedDocs) {
         foreach ($rowsetRelatedDocs as $rowRelatedDoc) {
             $systemname = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowRelatedDoc->itemGuid, 'docSystemName');
             $ext = pathinfo($systemname, PATHINFO_EXTENSION);
             $ext = strtolower($ext);
             $parentGuid = $rowRelatedDoc->relatedGuid;
             //$sDir1 = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR.$systemname;
             $sDir1 = $cdn['static']['dir']['files'] . DIRECTORY_SEPARATOR . $systemname;
             $sDir2 = $cdn['static']['dir']['files'] . DIRECTORY_SEPARATOR . $parentGuid . DIRECTORY_SEPARATOR . $systemname;
             //$sDir2 = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR.$parentGuid.DIRECTORY_SEPARATOR.$systemname;
             if (file_exists($sDir1)) {
                 unlink($sDir1);
             } else {
                 if (file_exists($sDir2)) {
                     unlink($sDir2);
                 }
             }
             $systemname = $rowRelatedDoc->itemGuid;
             $parentGuid = $rowRelatedDoc->relatedGuid;
             $sDir = $cdn['static']['dir']['images'];
             $sDir2 = $cdn['static']['dir']['images'] . DIRECTORY_SEPARATOR . $parentGuid;
             //$sDir = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'images';
             //$sDir2 = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.$parentGuid;
             if (file_exists($sDir . "/" . $systemname . '.' . $ext)) {
                 unlink($sDir . "/" . $systemname . '.' . $ext);
             }
             if (file_exists($sDir . "/tn_" . $systemname . '.' . $ext)) {
                 unlink($sDir . "/tn_" . $systemname . '.' . $ext);
             }
             if (file_exists($sDir2 . "/" . $systemname . '.' . $ext)) {
                 unlink($sDir2 . "/" . $systemname . '.' . $ext);
             }
             if (file_exists($sDir2 . "/tn_" . $systemname . '.' . $ext)) {
                 unlink($sDir2 . "/tn_" . $systemname . '.' . $ext);
             }
             $file = new Zend_Config_Ini(APPLICATION_PATH . '/configs/image.ini', 'size');
             $keys = array_keys($file->toArray());
             foreach ($keys as $key) {
                 if (file_exists($sDir2 . '/' . $key . '_' . $systemname . '.' . $ext)) {
                     unlink($sDir2 . '/' . $key . '_' . $systemname . '.' . $ext);
                 }
             }
             $tblCatalog = new App_Model_Db_Table_Catalog();
             $rowCatalog = $tblCatalog->find($rowRelatedDoc->itemGuid)->current();
             $rowCatalog->delete();
         }
     }
     if ($tblRelatedItem->delete("itemGuid='{$itemGuid}' AND relatedGuid='{$relatedGuid}' AND relateAs='{$relateAs}'")) {
         return true;
     } else {
         return false;
     }
 }
Example #18
0
 public function findRowsetCatalog($startFrom = 0, $limit = 0)
 {
     $tblCatalog = new App_Model_Db_Table_Catalog();
     return $tblCatalog->fetchFromFolder($this->guid, $startFrom, $limit);
 }
Example #19
0
 function newAction()
 {
     $this->_helper->layout->disableLayout();
     $aResult = array();
     $req = $this->getRequest();
     $item = $req->getParam('guid');
     $relatedItem = $req->getParam('relatedGuid');
     $as = $req->getParam('relateAs');
     $tblCatalog = new App_Model_Db_Table_Catalog();
     if (empty($relatedItem)) {
         $aResult['isError'] = true;
         $aResult['msg'] = 'No relatedGuid specified!';
     }
     if (is_array($item)) {
         $item = implode(',', $item);
         $item = explode(',', $item);
         foreach ($item as $guid) {
             $rowCatalog = $tblCatalog->find($guid)->current();
             $rowCatalog->relateTo($relatedItem, $as);
             $aResult['isError'] = false;
             $aResult['msg'] = 'Adding Multi Relation Success';
             $aResult['relateAs'] = $as;
             $aResult['relatedGuid'] = $relatedItem;
             $aResult['itemGuid'] = $guid;
         }
     } else {
         $rowCatalog = $tblCatalog->find($item)->current();
         $rowCatalog->relateTo($relatedItem, $as);
         $aResult['isError'] = false;
         $aResult['msg'] = 'Adding Relation Success';
         $aResult['relateAs'] = $as;
         $aResult['relatedGuid'] = $relatedItem;
         $aResult['itemGuid'] = $item;
     }
     echo Zend_Json::encode($aResult);
 }
Example #20
0
 public function reIndexCatalog_ZendDb()
 {
     $this->emptyIndex();
     $time_start = microtime(true);
     $solr =& $this->_solr;
     $tbl = new App_Model_Db_Table_Catalog();
     $rowset = $tbl->fetchAll();
     //("profileGuid='kutu_peraturan'");
     $documents = array();
     $rowCount = count($rowset);
     for ($iCount = 0; $iCount < $rowCount; $iCount++) {
         $row = $rowset->current();
         //			if($iCount == 100)
         //				break;
         echo 'urutan: ' . $iCount . '<br>';
         $documents[] = $this->_createSolrDocument($row);
         $rowset->next();
         if ($iCount % 1000 == 0) {
             try {
                 $solr->addDocuments($documents);
                 $solr->commit();
                 //$solr->optimize();
                 $documents = array();
             } catch (Exception $e) {
                 echo "Error occured when processing record starting from number: " . ($iCount - 1000) . ' to ' . $iCount;
                 throw new Zend_Exception($e->getMessage());
                 //echo $e->getMessage();
             }
         }
     }
     try {
         $solr->addDocuments($documents);
         $solr->commit();
         $solr->optimize();
     } catch (Exception $e) {
         throw new Zend_Exception($e->getMessage());
         //echo $e->getMessage();
     }
     $time_end = microtime(true);
     $time = $time_end - $time_start;
     echo '<br>WAKTU EKSEKUSI: ' . $time;
 }
Example #21
0
 function viewerAction()
 {
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $node = $this->_getParam('node') ? $this->_getParam('node') : '';
     $npts = $this->_getParam('npts') ? $this->_getParam('npts') : '';
     $nprt = $this->_getParam('nprt') ? $this->_getParam('nprt') : '';
     $tblCatalog = new App_Model_Db_Table_Catalog();
     if (!empty($catalogGuid)) {
         $rowCatalog = $tblCatalog->find($catalogGuid)->current();
         if ($rowCatalog) {
             $rowsetCatalogAttribute = $rowCatalog->findDependentRowsetCatalogAttribute();
             $tableProfileAttribute = new App_Model_Db_Table_ProfileAttribute();
             $profileGuid = $rowCatalog->profileGuid;
             $where = $tableProfileAttribute->getAdapter()->quoteInto('profileGuid=?', $profileGuid);
             $rowsetProfileAttribute = $tableProfileAttribute->fetchAll($where, 'viewOrder ASC');
             $aAttribute = array();
             $i = 0;
             $tblAttribute = new App_Model_Db_Table_Attribute();
             foreach ($rowsetProfileAttribute as $rowProfileAttribute) {
                 if ($rowsetCatalogAttribute->findByAttributeGuid($rowProfileAttribute->attributeGuid)) {
                     $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid($rowProfileAttribute->attributeGuid);
                     $rowsetAttribute = $tblAttribute->find($rowCatalogAttribute->attributeGuid);
                     if (count($rowsetAttribute)) {
                         $rowAttribute = $rowsetAttribute->current();
                         $aAttribute[$i]['name'] = $rowAttribute->name;
                     } else {
                         $aAttribute[$i]['name'] = '';
                     }
                     $aAttribute[$i]['value'] = $rowCatalogAttribute->value;
                 } else {
                 }
                 $i++;
             }
             $this->view->aAttribute = $aAttribute;
             $this->view->rowCatalog = $rowCatalog;
             $this->view->rowsetCatalogAttribute = $rowsetCatalogAttribute;
             $this->view->node = $node;
             $this->view->npts = $npts;
             $this->view->nprt = $nprt;
             $this->view->catalogGuid = $catalogGuid;
             $this->view->profileGuid = $profileGuid;
             $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid('fixedExpired');
             if (!empty($rowCatalogAttribute->value)) {
                 $tDate = $rowCatalogAttribute->value;
                 $aDate = explode('-', $tDate);
                 $year = $aDate[0];
                 $month = $aDate[1];
                 $day = $aDate[2];
                 $hour = "00";
                 $minute = "00";
                 $second = "00";
                 $event = "My birthday";
                 $time = mktime($hour, $minute, $second, $month, $day, $year);
                 $timecurrent = date('U');
                 $cuntdowntime = $time - $timecurrent;
                 $cuntdownminutes = $cuntdowntime / 60;
                 $cuntdownhours = $cuntdowntime / 3600;
                 $cuntdowndays = $cuntdownhours / 24;
                 $cuntdownmonths = $cuntdowndays / 30;
                 $cuntdownyears = $cuntdowndays / 365;
                 if ($cuntdowndays < 0) {
                     echo "<script>alert('Dokumen perjanjian ini telah berakhir masa berlakunya.');</script>";
                     echo "<br><strong>Dokumen perjanjian ini telah berakhir masa berlakunya.</strong>";
                 } else {
                     echo "<br><strong>Dokumen perjanjian ini akan berakhir masa berlakunya dalam " . round($cuntdowndays) . " hari.</strong>";
                 }
             }
         }
     }
 }
Example #22
0
 public function uploadFile($aDataCatalog, $relatedGuid)
 {
     if ($aDataCatalog['profileGuid'] != 'kutu_doc') {
         throw new Zend_Exception('Profile does not match profile for FILE');
     }
     if (empty($relatedGuid)) {
         throw new Zend_Exception('No RELATED GUID specified!');
     }
     $registry = Zend_Registry::getInstance();
     $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT);
     $cdn = $config->getOption('cdn');
     $id = 1 + ($aDataCatalog['id'] - 1);
     for ($x = 1; $x < $id; $x++) {
         $title = $aDataCatalog['fixedTitle' . $x] ? $aDataCatalog['fixedTitle' . $x] : '';
         $registry = Zend_Registry::getInstance();
         $files = $registry->get('files');
         if (isset($files['uploadedFile' . $x])) {
             $file = $files['uploadedFile' . $x];
             //$this->checkTitle($aDataCatalog['fixedTitle'.$x]);
         }
         $type = $aDataCatalog['fixedType' . $x] ? $aDataCatalog['fixedType' . $x] : '';
         if ($type == 'file') {
             $relatedType = 'RELATED_FILE';
         } elseif ($type == 'image') {
             $relatedType = 'RELATED_IMAGE';
             $this->checkSize($file['size'], $aDataCatalog['fixedTitle' . $x]);
         } elseif ($type == 'video') {
             $relatedType = 'RELATED_VIDEO';
         }
         $tblCatalog = new App_Model_Db_Table_Catalog();
         $gman = new Pandamp_Core_Guid();
         $catalogGuid = isset($aDataCatalog['guid']) && !empty($aDataCatalog['guid']) ? $aDataCatalog['guid'] : $gman->generateGuid();
         $folderGuid = isset($aDataCatalog['folderGuid']) && !empty($aDataCatalog['folderGuid']) ? $aDataCatalog['folderGuid'] : '';
         $where = $tblCatalog->getAdapter()->quoteInto('guid=?', $catalogGuid);
         if ($tblCatalog->fetchRow($where)) {
             $rowCatalog = $tblCatalog->find($catalogGuid)->current();
             $rowCatalog->shortTitle = isset($aDataCatalog['shortTitle']) ? $aDataCatalog['shortTitle'] : $rowCatalog->shortTitle;
             $rowCatalog->publishedDate = isset($aDataCatalog['publishedDate']) ? $aDataCatalog['publishedDate'] : $rowCatalog->publishedDate;
             $rowCatalog->expiredDate = isset($aDataCatalog['expiredDate']) ? $aDataCatalog['expiredDate'] : $rowCatalog->expiredDate;
             $rowCatalog->status = isset($aDataCatalog['status']) ? $aDataCatalog['status'] : $rowCatalog->status;
         } else {
             $rowCatalog = $tblCatalog->fetchNew();
             $rowCatalog->guid = $catalogGuid;
             $rowCatalog->shortTitle = isset($aDataCatalog['shortTitle']) ? $aDataCatalog['shortTitle'] : '';
             $rowCatalog->profileGuid = $aDataCatalog['profileGuid'];
             $rowCatalog->publishedDate = isset($aDataCatalog['publishedDate']) ? $aDataCatalog['publishedDate'] : '0000-00-00 00:00:00';
             $rowCatalog->expiredDate = isset($aDataCatalog['expiredDate']) ? $aDataCatalog['expiredDate'] : '0000-00-00 00:00:00';
             $rowCatalog->createdBy = isset($aDataCatalog['username']) ? $aDataCatalog['username'] : '';
             $rowCatalog->modifiedBy = $rowCatalog->createdBy;
             $rowCatalog->createdDate = date("Y-m-d h:i:s");
             $rowCatalog->modifiedDate = $rowCatalog->createdDate;
             $rowCatalog->deletedDate = '0000-00-00 00:00:00';
             $rowCatalog->status = isset($aDataCatalog['status']) ? $aDataCatalog['status'] : 0;
         }
         $catalogGuid = $rowCatalog->save();
         $rowsetCatalogAttribute = $rowCatalog->findDependentRowsetCatalogAttribute();
         if (isset($files['uploadedFile' . $x])) {
             if (isset($files['uploadedFile' . $x]['name']) && !empty($files['uploadedFile' . $x]['name'])) {
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'docSystemName', strtoupper(str_replace(' ', '_', $file['name'])));
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'docOriginalName', strtoupper(str_replace(' ', '_', $file['name'])));
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'docSize', $file['size']);
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'docMimeType', $file['type']);
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'fixedTitle', $title);
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'docViewOrder', 0);
                 if ($type == 'file') {
                     //$sDir = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR.$relatedGuid;
                     $sDir = $cdn['static']['dir']['files'] . DIRECTORY_SEPARATOR . $relatedGuid;
                     if (is_dir($sDir)) {
                         move_uploaded_file($file['tmp_name'], $sDir . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                     } else {
                         if (mkdir($sDir)) {
                             move_uploaded_file($file['tmp_name'], $sDir . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                         } else {
                             move_uploaded_file($file['tmp_name'], $cdn['static']['dir']['files'] . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                         }
                     }
                 } elseif ($type == 'image') {
                     $sDir = $cdn['static']['dir']['images'];
                     //$sDir = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'images';
                     $file = $files['uploadedFile' . $x]['name'];
                     $ext = explode(".", $file);
                     $ext = strtolower(array_pop($ext));
                     if ($ext == "jpg" || $ext == "jpeg" || $ext == "gif" || $ext == "png") {
                         //$target_path = $sDir.DIRECTORY_SEPARATOR.$catalogGuid.".".$ext;
                         $thumb_mode = $sDir . DIRECTORY_SEPARATOR . $catalogGuid . "." . $ext;
                         $thumb = $sDir . DIRECTORY_SEPARATOR . $relatedGuid . DIRECTORY_SEPARATOR . $catalogGuid . "." . $ext;
                         $target_path = $sDir . DIRECTORY_SEPARATOR . $relatedGuid;
                         if (is_dir($target_path)) {
                             move_uploaded_file($files['uploadedFile' . $x]['tmp_name'], $target_path . DIRECTORY_SEPARATOR . $catalogGuid . "." . $ext);
                             //chmod($target_path,0644);
                             Pandamp_Lib_Formater::createthumb($thumb, $target_path . '/tn_' . $catalogGuid . "." . $ext, 275, 160);
                             // sebelumnya 130x130
                         } else {
                             if (mkdir($target_path)) {
                                 move_uploaded_file($files['uploadedFile' . $x]['tmp_name'], $target_path . DIRECTORY_SEPARATOR . $catalogGuid . "." . $ext);
                                 //chmod($target_path,0644);
                                 Pandamp_Lib_Formater::createthumb($thumb, $target_path . '/tn_' . $catalogGuid . "." . $ext, 275, 160);
                             } else {
                                 move_uploaded_file($files['uploadedFile' . $x]['tmp_name'], $sDir . DIRECTORY_SEPARATOR . $catalogGuid . "." . $ext);
                                 //chmod($target_path,0644);
                                 Pandamp_Lib_Formater::createthumb($thumb_mode, $sDir . '/tn_' . $catalogGuid . "." . $ext, 275, 160);
                             }
                         }
                     }
                 } elseif ($type == 'video') {
                     $sDir = $cdn['static']['dir']['video'] . DIRECTORY_SEPARATOR . $relatedGuid;
                     //$sDir = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'video'.DIRECTORY_SEPARATOR.$relatedGuid;
                     if (is_dir($sDir)) {
                         move_uploaded_file($file['tmp_name'], $sDir . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                     } else {
                         if (mkdir($sDir)) {
                             move_uploaded_file($file['tmp_name'], $sDir . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                         } else {
                             move_uploaded_file($file['tmp_name'], $cdn['static']['dir']['video'] . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                         }
                     }
                 }
             }
         }
         $this->relateTo($catalogGuid, $relatedGuid, $relatedType);
         $indexingEngine = Pandamp_Search::manager();
         $indexingEngine->indexCatalog($catalogGuid);
         $registry = Zend_Registry::getInstance();
         $application = Zend_Registry::get(Pandamp_Keys::REGISTRY_APP_OBJECT);
         $res = $application->getOption('resources')['indexing']['solr']['write'];
         $esolr = new Pandamp_Search_Adapter_Esolr($res['host'], $res['port'], $res['dir4']);
         $esolr->indexCatalog($catalogGuid);
     }
 }
Example #23
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";
 }
Example #24
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');
     }
 }
Example #25
0
 function isAllowed($username, $itemGuid, $action, $section = 'content')
 {
     if ($this->checkAcl("action", 'all', 'user', $username, 'content', 'all-access')) {
         return true;
     }
     if ($section == 'content') {
         //			if($this->checkAcl("dms",'all','user', $username, false,false))
         //				return true;
         /**
          * TODO
          */
         switch ($action) {
             case 'create':
                 if ($this->checkAcl("action", 'create', 'user', $username, false, false)) {
                     return true;
                 }
             case 'read':
                 if ($this->checkAcl("action", 'read', 'user', $username, false, false) || $this->checkAcl("action", 'update', 'user', $username, false, false)) {
                     return true;
                 }
             case 'update':
                 if ($this->checkAcl("action", 'update', 'user', $username, false, false)) {
                     return true;
                 }
             case 'delete':
                 if ($this->checkAcl("action", 'delete', 'user', $username, false, false)) {
                     return true;
                 }
         }
         //			if ($this->checkAcl('action', $action, 'user', $username, 'admin', 'content'))
         //				return true;
         //check if itemGuid exist in table KutuCatalog
         $tblCatalog = new App_Model_Db_Table_Catalog();
         $rowset = $tblCatalog->find($itemGuid);
         if (count($rowset) > 0) {
             $row = $rowset->current();
             if ($row->profileGuid != 'kutu_folder') {
                 //if user was the creator of the item, allow everything
                 if ($row->createdBy == $username) {
                     return true;
                 }
                 $aAclId = $this->searchAcl('action', false, false, false, false, 'content', $itemGuid);
                 if (count($aAclId) > 0) {
                     return $this->checkAcl('action', $action, 'user', $username, 'content', $itemGuid);
                 } else {
                     //check permission of the folder which this catalog belongs to
                     $rowset1 = $row->findDependentRowset('Pandamp_Modules_Dms_Catalog_Model_CatalogFolder');
                     $flagFolderPermission = false;
                     foreach ($rowset1 as $row1) {
                         if ($this->_traverseFolderPermission($username, $row1->folderGuid, $action)) {
                             $flagFolderPermission = true;
                         }
                     }
                     return $flagFolderPermission;
                 }
             }
         }
         //check if itemGuid exist in table KutuFolder
         $tblFolder = new App_Model_Db_Table_Folder();
         $rowset = $tblFolder->find($itemGuid);
         if (count($rowset) > 0) {
             return $this->_traverseFolderPermission($username, $itemGuid, $action);
         }
     }
     //check at section
     $aAclId = $this->searchAcl('action', false, false, false, false, $section, $itemGuid);
     if (count($aAclId) > 0) {
         return $this->checkAcl('action', $action, 'user', $username, $section, $itemGuid);
     }
     //check at feature section
     /*$aAclId = $this->searchAcl('action', false, false, false, false, 'feature', $itemGuid);
     		if(count($aAclId)>0)
     		{
     			return $this->checkAcl('action', $action, 'user', $username, 'feature', $itemGuid);
     		}*/
     return false;
 }
Example #26
0
 /**
  * categoryClinicPullDown
  * @return category clinic
  */
 static function categoryClinicPullDown($cat = '')
 {
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $rowset = $tblCatalog->fetchAll("profileGuid='kategoriklinik'", 'createdDate DESC');
     $category = "<select name=\"category\">\n";
     if ($cat) {
         $rowCategory = $tblCatalog->find($cat)->current();
         $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($cat, 'fixedTitle');
         $category .= "<option value='{$rowCategory->guid}' selected>{$title}</option>";
         $category .= "<option value=''>---Semua Kategori---</option>";
     } else {
         $category .= "<option value='' selected>---Semua Kategori---</option>";
     }
     foreach ($rowset as $row) {
         $attributeTitle = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($row->guid, 'fixedTitle');
         if ($cat && $row->guid == $rowCategory->guid) {
             continue;
         } else {
             $category .= "<option value='{$row->guid}'>{$attributeTitle}</option>";
         }
     }
     $category .= "</select>\n\n";
     return $category;
 }
Example #27
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++;
         }
     }
 }
Example #28
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');
     }
 }
Example #29
0
 function detailProdukAction()
 {
     $this->_helper->layout->setLayout('layout-misc');
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $rowset = $tblCatalog->find($catalogGuid)->current();
     if ($catalogGuid) {
         $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedTitle');
         $desc = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedDescription');
         $content = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedContent');
         $this->view->title = $title;
         $this->view->desc = $desc;
         $this->view->content = $content;
     }
 }
Example #30
-1
 function aturanpakaiAction()
 {
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $rowset = $tblCatalog->fetchRow("shortTitle='aturan-pakai' AND profileGuid='kutu_signup'");
     $this->view->title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedTitle');
     $this->view->content = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedContent');
     $this->view->identity = 'Aturan Pakai';
 }