function generateFormAnswer($catalogGuid)
 {
     $today = date('Y-m-d H:i:s');
     $aRenderedAttributes = array();
     $aBaseAttributes = array();
     $tableCatalog = new Pandamp_Modules_Dms_Catalog_Model_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();
         }
         $attributeRenderer = new Pandamp_Form_Attribute_Renderer($rowAttribute->guid, $attributeValue, $rowAttribute->type, null, 'author', 'partner');
         $aRenderedAttributes[$rowAttribute->guid]['description'] = $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}'>";
     $aBaseAttributes['profileGuid']['description'] = '';
     $aBaseAttributes['profileGuid']['form'] = "<input type='hidden' name='profileGuid' id='profileGuid' value='{$rowCatalog->profileGuid}'>";
     $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="' . ROOT_URL . '/resources/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="' . ROOT_URL . '/resources/images/img.gif" width="16" height="16" border="0" alt="Pick a date"></a>';
     $aBaseAttributes['expiredDate']['description'] = 'Expired Date';
     $aBaseAttributes['expiredDate']['form'] = $n;
     $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';
     require_once CONFIG_PATH . '/master-status.php';
     $statusConfig = MasterStatus::getPublishingStatus();
     $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;
 }
 public function viewsearchAction()
 {
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowCatalog = $tblCatalog->find($catalogGuid)->current();
     $rowsetCatalogAttribute = $rowCatalog->findDependentRowsetCatalogAttribute();
     $this->view->catalogTitle = $rowsetCatalogAttribute->findByAttributeGuid('fixedTitle')->value;
     $this->view->catalogGuid = $catalogGuid;
 }
 public function getCatalogShortTitle($guid)
 {
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowset = $tblCatalog->find($guid)->current();
     if ($rowset) {
         return $rowset->shortTitle;
     } else {
         return 'no-title';
     }
 }
 public function viewFolderAction()
 {
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowCatalog = $tblCatalog->find($catalogGuid)->current();
     if ($rowCatalog) {
         $rowsetFolder = $rowCatalog->findManyToManyRowset('Pandamp_Modules_Dms_Folder_Model_Folder', 'Pandamp_Modules_Dms_Catalog_Model_CatalogFolder');
         $this->view->rowsetFolder = $rowsetFolder;
         $this->view->catalogGuid = $catalogGuid;
     }
 }
 public function GetCatalogIsFile($catalogGuid)
 {
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowset = $tblCatalog->find($catalogGuid)->current();
     if ($rowset) {
         if ($rowset->profileGuid == "kutu_doc") {
             return "<font color=red>[file]</font>";
         }
     } else {
         return '';
     }
 }
 public function GetCatalogDocSize($catalogGuid)
 {
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_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;
 }
 public function GetCatalogDocType($catalogGuid)
 {
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowsetCatalog = $tblCatalog->find($catalogGuid);
     if (count($rowsetCatalog)) {
         $rowCatalog = $rowsetCatalog->current();
         $rowsetCatAtt = $rowCatalog->findDependentRowsetCatalogAttribute();
         $docType = $this->imageDocumentType($this->dl_file($rowsetCatAtt->findByAttributeGuid('docOriginalName')->value));
     } else {
         $docType = '';
     }
     return $docType;
 }
 function viewAction()
 {
     $request = $this->getRequest();
     $itemGuid = $request->getParam('guid');
     //		$aclAdapter = Kutu_Acl::manager();
     //		$aUsers = $aclAdapter->getUsers();
     //		$aGroups = $aclAdapter->getGroups();
     //		$aTmp = array();
     //		for ($i=0;$i<count($aUsers);$i++)
     //		{
     //			$aTmp[$i]['username'] = $aUsers[$i];
     //			$aPerms = $aclAdapter->getPermissionsOnContent($aUsers[$i], null, $itemGuid);
     //			for($ii=0;$ii<count($aPerms);$ii++)
     //			{
     //				$aTmp[$i]['perms'][$aPerms[$ii]] = 1;
     //			}
     //		}
     //		$this->view->aDataUser = $aTmp;
     //		$aTmp = array();
     //		for($i=0;$i<count($aGroups);$i++)
     //		{
     //			$aTmp[$i]['group'] = $aGroups[$i]['value'];
     //
     //			$aPerms = $aclAdapter->getPermissionsOnContent(null, $aGroups[$i]['value'], $itemGuid);
     //			for($ii=0;$ii<count($aPerms);$ii++)
     //			{
     //				$aTmp[$i]['perms'][$aPerms[$ii]] = 1;
     //			}
     //		}
     //		$this->view->aDataGroup = $aTmp;
     $this->view->itemGuid = $itemGuid;
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowset = $tblCatalog->find($itemGuid);
     if (count($rowset) > 0) {
         $row = $rowset->current();
         $this->view->itemTitle = 'CATALOG : ' . $row->shortTitle;
     } else {
         $tblFolder = new Pandamp_Modules_Dms_Folder_Model_Folder();
         $rowset = $tblFolder->find($itemGuid);
         if (count($rowset) > 0) {
             $row = $rowset->current();
             $this->view->itemTitle = 'FOLDER : ' . $row->title;
         }
     }
 }
Exemple #9
0
 public function indexCatalog($guid)
 {
     $solr =& $this->_solr;
     $tbl = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowset = $tbl->find($guid);
     if (count($rowset)) {
         $row = $rowset->current();
         $hTitle = new Pandamp_Controller_Action_Helper_GetCatalogTitle();
         $documents = array();
         $documents[] = $this->_createSolrDocument($row);
         try {
             $solr->addDocuments($documents);
             $solr->commit();
         } catch (Exception $e) {
             throw new Zend_Exception($e->getMessage());
         }
     }
 }
 function createAction()
 {
     $req = $this->getRequest();
     $item = $req->getParam('itemGuid');
     $relatedItem = $req->getParam('relatedGuid');
     $as = $req->getParam('relateAs');
     $aResult = array();
     try {
         $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
         $rowCatalog = $tblCatalog->find($item)->current();
         $rowCatalog->relateTo($relatedItem, $as);
         $aResult['isError'] = false;
         $aResult['msg'] = 'Adding Relation Success';
     } catch (Exception $e) {
         $aResult['isError'] = true;
         $aResult['msg'] = $e->getMessage();
     }
     echo Zend_Json::encode($aResult);
 }
 function downloadFileAction()
 {
     $catalogGuid = $this->_getParam('guid');
     $parentGuid = $this->_getParam('parent');
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowsetCatalog = $tblCatalog->find($catalogGuid);
     if (count($rowsetCatalog)) {
         $rowCatalog = $rowsetCatalog->current();
         $rowsetCatAtt = $rowCatalog->findDependentRowsetCatalogAttribute();
         $contentType = $rowsetCatAtt->findByAttributeGuid('docMimeType')->value;
         $filename = $systemname = $rowsetCatAtt->findByAttributeGuid('docSystemName')->value;
         $oriName = $rowsetCatAtt->findByAttributeGuid('docOriginalName')->value;
         $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_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;
                 if (file_exists($sDir1)) {
                     $flagFileFound = true;
                     header("Content-type: {$contentType}");
                     header("Content-Disposition: attachment; filename={$filename}");
                     @readfile($sDir1);
                 } else {
                     if (file_exists($sDir2)) {
                         $flagFileFound = true;
                         header("Content-type: {$contentType}");
                         header("Content-Disposition: attachment; filename={$oriName}");
                         @readfile($sDir2);
                     } else {
                         $flagFileFound = false;
                     }
                 }
             }
         }
     } else {
         echo 'NO FILE';
     }
 }
Exemple #12
0
 public function forceDelete($folderGuid)
 {
     $tblFolder = new Pandamp_Modules_Dms_Folder_Model_Folder();
     $rowset = $tblFolder->fetchChildren($folderGuid);
     $rowFolder = $tblFolder->find($folderGuid)->current();
     foreach ($rowset as $row) {
         $this->forceDelete($row->guid);
     }
     $rowsetCatalogFolder = $rowFolder->findDependentRowsetCatalogFolder();
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $holCatalog = new Pandamp_Core_Hol_Catalog();
     if (count($rowsetCatalogFolder)) {
         foreach ($rowsetCatalogFolder as $rowCatalogFolder) {
             $rowCatalog = $tblCatalog->find($rowCatalogFolder->catalogGuid)->current();
             $holCatalog->delete($rowCatalog->guid);
         }
         $this->delete($rowFolder->guid);
     } else {
         $this->delete($rowFolder->guid);
     }
 }
Exemple #13
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) || $acl->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 Pandamp_Modules_Dms_Catalog_Model_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 Pandamp_Modules_Dms_Folder_Model_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;
 }
Exemple #14
0
 public function jCartIsItemSellable($catalogGuid)
 {
     //apakah pernah dibeli
     $auth = Zend_Auth::getInstance();
     $hasBought = false;
     if ($auth->hasIdentity()) {
         $bpm = new Pandamp_Core_Hol_Catalog();
         $hasBought = $bpm->isBoughtByUser($catalogGuid, $auth->getIdentity()->guid);
     }
     if ($hasBought) {
         $aReturn['isError'] = true;
         $aReturn['message'] = 'You have bought this Item before. Please check your account.';
         $aReturn['code'] = 1;
         return $aReturn;
     }
     // if status=draft then return false
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_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
 }
 public function viewerAction()
 {
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     if (!empty($catalogGuid)) {
         $rowCatalog = $modelCatalog->find($catalogGuid)->current();
         $rowsetCatalogAttribute = $rowCatalog->findDependentRowsetCatalogAttribute();
         $tableProfileAttribute = new Pandamp_Modules_Dms_Profile_Model_ProfileAttribute();
         $profileGuid = $rowCatalog->profileGuid;
         $where = $tableProfileAttribute->getAdapter()->quoteInto('profileGuid=?', $profileGuid);
         $rowsetProfileAttribute = $tableProfileAttribute->fetchAll($where, 'viewOrder ASC');
         $aAttribute = array();
         $i = 0;
         $tblAttribute = new Pandamp_Modules_Dms_Catalog_Model_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->rowsetCatalogAttribute = $rowsetCatalogAttribute;
     $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";
         //set what is going to happen than
         $event = "My birthday";
         //don't change anything below unless you know what you are doing
         $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;
         //echo 'sisa hari: ' . $cuntdowndays;
         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 "<script>alert('Dokumen perjanjian ini akan berakhir masa berlakunya dalam ".round($cuntdowndays)." hari.');</script>";
             echo "<br><strong>Dokumen perjanjian ini akan berakhir masa berlakunya dalam " . round($cuntdowndays) . " hari.</strong>";
         }
     }
     $this->_helper->viewRenderer('viewer-generic');
 }
 function saveAction()
 {
     $response = array();
     $request = $this->getRequest();
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $userName = $auth->getIdentity()->username;
     }
     $gman = new Pandamp_Core_Guid();
     $catalogGuid = $request->getParam('guid') ? $request->getParam('guid') : $gman->generateGuid();
     $folderGuid = $request->getParam('folderGuid') ? $request->getParam('folderGuid') : '';
     //if not empty, there are 2 possibilities
     $where = $tblCatalog->getAdapter()->quoteInto('guid=?', $catalogGuid);
     if ($tblCatalog->fetchRow($where)) {
         $rowCatalog = $tblCatalog->find($catalogGuid)->current();
         $rowCatalog->shortTitle = $request->getParam('shortTitle');
         $rowCatalog->publishedDate = $request->getParam('publishedDate');
         $rowCatalog->expiredDate = $request->getParam('expiredDate');
         $rowCatalog->modifiedBy = $userName;
         $rowCatalog->modifiedDate = date("Y-m-d h:i:s");
         $rowCatalog->status = $request->getParam('status');
     } else {
         $rowCatalog = $tblCatalog->fetchNew();
         $rowCatalog->shortTitle = $request->getParam('shortTitle');
         $rowCatalog->profileGuid = $request->getParam('profileGuid');
         $rowCatalog->publishedDate = $request->getParam('publishedDate');
         $rowCatalog->expiredDate = $request->getParam('expiredDate');
         $rowCatalog->createdBy = $userName;
         $rowCatalog->modifiedBy = $userName;
         $rowCatalog->createdDate = date("Y-m-d h:i:s");
         $rowCatalog->modifiedDate = date("Y-m-d h:i:s");
         $rowCatalog->deletedDate = '0000-00-00 00:00:00';
         $rowCatalog->status = $request->getParam('status');
     }
     $catalogGuid = $rowCatalog->save();
     $tableProfileAttribute = new Pandamp_Modules_Dms_Profile_Model_ProfileAttribute();
     $profileGuid = $rowCatalog->profileGuid;
     $where = $tableProfileAttribute->getAdapter()->quoteInto('profileGuid=?', $profileGuid);
     $rowsetProfileAttribute = $tableProfileAttribute->fetchAll($where, 'viewOrder ASC');
     $rowsetCatalogAttribute = $rowCatalog->findDependentRowsetCatalogAttribute();
     foreach ($rowsetProfileAttribute as $rowProfileAttribute) {
         if ($rowsetCatalogAttribute->findByAttributeGuid($rowProfileAttribute->attributeGuid)) {
             $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid($rowProfileAttribute->attributeGuid);
         } else {
             $tblCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute();
             $rowCatalogAttribute = $tblCatalogAttribute->fetchNew();
             $rowCatalogAttribute->catalogGuid = $catalogGuid;
             $rowCatalogAttribute->attributeGuid = $rowProfileAttribute->attributeGuid;
         }
         $rowCatalogAttribute->value = $request->getParam($rowProfileAttribute->attributeGuid);
         $rowCatalogAttribute->save();
     }
     //save to table CatalogFolder only if folderGuid is not empty
     if (!empty($folderGuid)) {
         $tblCatalogFolder = new Pandamp_Modules_Dms_Catalog_Model_CatalogFolder();
         $rowsetCatalogFolder = $tblCatalogFolder->find($catalogGuid, $folderGuid);
         if (count($rowsetCatalogFolder) <= 0) {
             $rowCatalogFolder = $tblCatalogFolder->createRow(array('catalogGuid' => '', 'folderGuid' => ''));
             $rowCatalogFolder->catalogGuid = $catalogGuid;
             $rowCatalogFolder->folderGuid = $folderGuid;
             $rowCatalogFolder->save();
         }
     }
     $response['success'] = true;
     echo Zend_Json::encode($response);
 }
Exemple #17
0
 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 Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
     $rowsetRelatedDocs = $tblRelatedItem->fetchAll("relatedGuid='{$this->guid}' AND relateAs IN ('RELATED_FILE','RELATED_IMAGE')");
     if (count($rowsetRelatedDocs)) {
         foreach ($rowsetRelatedDocs as $rowRelatedDoc) {
             $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
             $rowCatalog = $tblCatalog->find($rowRelatedDoc->itemGuid)->current();
             $rowCatalog->delete();
         }
     }
     if ($this->profileGuid == 'kutu_doc') {
         //get parentGuid
         $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
         $rowsetRelatedItem = $tblRelatedItem->fetchAll("itemGuid='{$this->guid}' AND relateAs IN ('RELATED_FILE','RELATED_IMAGE')");
         if (count($rowsetRelatedItem)) {
             foreach ($rowsetRelatedItem as $rowRelatedItem) {
                 //must delete the physical files
                 $rowsetCatAtt = $this->findDependentRowsetCatalogAttribute();
                 $systemname = $rowsetCatAtt->findByAttributeGuid('docSystemName')->value;
                 $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;
                 $sDir1 = $cdn['static']['dir']['files'] . "/" . $systemname;
                 $sDir2 = $cdn['static']['dir']['files'] . "/" . $parentGuid . "/" . $systemname;
                 $sDir1_Remote = $cdn['remote']['dir']['files'] . "/" . $systemname;
                 $sDir2_Remote = $cdn['remote']['dir']['files'] . "/" . $parentGuid . "/" . $systemname;
                 if (file_exists($sDir1)) {
                     // delete file
                     unlink($sDir1);
                     // check remote file
                     if (file_exists($sDir1_Remote)) {
                         $this->remoteDeleteFile($sDir1_Remote);
                     }
                 } else {
                     if (file_exists($sDir2)) {
                         //delete file
                         unlink($sDir2);
                         // check remote file
                         if (file_exists($sDir2_Remote)) {
                             $this->remoteDeleteFile($sDir2_Remote);
                         }
                     }
                 }
                 $img1 = $cdn['static']['dir']['images'] . "/" . $systemname;
                 $img2 = $cdn['static']['dir']['images'] . "/" . $parentGuid . "/" . $systemname;
                 $img1_Remote = $cdn['remote']['dir']['images'] . "/" . $systemname;
                 $img2_Remote = $cdn['remote']['dir']['images'] . "/" . $parentGuid . "/" . $systemname;
                 if (file_exists($img1)) {
                     // delete file
                     unlink($img1);
                     // check remote file
                     if (file_exists($img1_Remote)) {
                         $this->remoteDeleteFile($img1_Remote);
                     }
                 } else {
                     if (file_exists($img2)) {
                         //delete file
                         unlink($img2);
                         // check remote file
                         if (file_exists($img2_Remote)) {
                             $this->remoteDeleteFile($img2_Remote);
                         }
                     }
                 }
             }
         }
     }
     //delete from table CatalogAttribute
     $tblCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute();
     $tblCatalogAttribute->delete("catalogGuid='{$this->guid}'");
     //delete catalogGuid from table CatalogFolder
     $tblCatalogFolder = new Pandamp_Modules_Dms_Catalog_Model_CatalogFolder();
     $tblCatalogFolder->delete("catalogGuid='{$this->guid}'");
     //delete guid from table AssetSetting
     $tblAssetSetting = new Pandamp_Modules_Dms_Catalog_Model_AssetSetting();
     $tblAssetSetting->delete("guid='{$this->guid}'");
     //delete from table relatedItem
     $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_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 = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR.$this->guid;
     $sDir = $cdn['static']['dir']['files'] . "/" . $this->guid;
     $sDir_Remote = $cdn['remote']['dir']['files'] . "/" . $this->guid;
     try {
         if (is_dir($sDir)) {
             rmdir($sDir);
             // check remote is_dir
             if (is_dir($sDir_Remote)) {
                 $this->remoteRemoveDir($sDir_Remote);
             }
         }
     } catch (Exception $e) {
     }
     //$sDir = ROOT_DIR.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'images';
     $sDir = $cdn['static']['dir']['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) {
     }
     $sDir = $cdn['remote']['dir']['images'];
     try {
         if (file_exists($sDir . "/" . $this->guid . ".gif")) {
             $this->remoteDeleteFile($sDir . "/" . $this->guid . ".gif");
         }
         if (file_exists($sDir . "/tn_" . $this->guid . ".gif")) {
             $this->remoteDeleteFile($sDir . "/tn_" . $this->guid . ".gif");
         }
         if (file_exists($sDir . "/" . $this->guid . ".jpg")) {
             $this->remoteDeleteFile($sDir . "/" . $this->guid . ".jpg");
         }
         if (file_exists($sDir . "/tn_" . $this->guid . ".jpg")) {
             $this->remoteDeleteFile($sDir . "/tn_" . $this->guid . ".jpg");
         }
         if (file_exists($sDir . "/" . $this->guid . ".jpeg")) {
             $this->remoteDeleteFile($sDir . "/" . $this->guid . ".jpeg");
         }
         if (file_exists($sDir . "/tn_" . $this->guid . ".jpeg")) {
             $this->remoteDeleteFile($sDir . "/tn_" . $this->guid . ".jpeg");
         }
         if (file_exists($sDir . "/" . $this->guid . ".png")) {
             $this->remoteDeleteFile($sDir . "/" . $this->guid . ".png");
         }
         if (file_exists($sDir . "/tn_" . $this->guid . ".png")) {
             $this->remoteDeleteFile($sDir . "/tn_" . $this->guid . ".png");
         }
     } catch (Exception $e) {
     }
 }
 function _traverseFolderDowload($folderGuid, $sGuid, $level)
 {
     $tblFolder = new Pandamp_Modules_Dms_Folder_Model_Folder();
     $rowSet = $tblFolder->fetchChildren($folderGuid);
     $row = $tblFolder->find($folderGuid)->current();
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rows = $tblCatalog->downloadCatalog($row->guid);
     if (count($rows)) {
         foreach ($rows as $rowset) {
             $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
             $rowsetCatalog = $tblCatalog->find($rowset->itemGuid);
             if (count($rowsetCatalog)) {
                 $rowCatalog = $rowsetCatalog->current();
                 $rowsetCatAtt = $rowCatalog->findDependentRowsetCatalogAttribute();
                 $contentType = $rowsetCatAtt->findByAttributeGuid('docMimeType')->value;
                 $filename = $systemname = $rowsetCatAtt->findByAttributeGuid('docSystemName')->value;
                 $oriName = $rowsetCatAtt->findByAttributeGuid('docOriginalName')->value;
                 $parentGuid = $rowset->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;
                 //$c = ROOT_DIR.'/data/download/file';
                 echo $parentGuid . '<br>';
                 //					if(file_exists($sDir1))
                 //					{
                 //header("Content-type: $contentType");
                 //header("Content-Disposition: attachment; filename=$oriName");
                 //@readfile($sDir2);
                 //						exec('xcopy '.$sDir1.' d:\\www\holmp\data\download\file /e/i');
                 //					}
                 //					if(file_exists($sDir2))
                 //					{
                 //						exec('xcopy '.$sDir2.' d:\\www\holmp\data\download\file /e/i');
                 //					}
             }
         }
     }
 }
 function downloadFile_OldAction()
 {
     $this->_helper->layout()->disableLayout();
     $catalogGuid = $this->_getParam('guid');
     $parentGuid = $this->_getParam('parent');
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowsetCatalog = $tblCatalog->find($catalogGuid);
     if (count($rowsetCatalog)) {
         $auth = Zend_Auth::getInstance();
         if ($auth->hasIdentity()) {
             $guidUser = $auth->getIdentity()->kopel;
         }
         $tblAsetSetting = new Pandamp_Modules_Dms_Catalog_Model_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 Pandamp_Modules_Dms_Catalog_Model_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');
     }
 }
 function detailProdukAction()
 {
     $this->_helper->layout->setLayout('layout-misc');
     $this->_helper->layout->setLayoutPath(array('layoutPath' => ROOT_DIR . '/app/modules/misc/layouts'));
     $this->view->identity = "Detail Produk";
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowset = $tblCatalog->find($catalogGuid)->current();
     if ($catalogGuid) {
         $rowsetCatalogAttribute = $rowset->findDependentRowsetCatalogAttribute();
         $rowsetCatalogAttributeTitle = $rowsetCatalogAttribute->findByAttributeGuid('fixedTitle');
         $rowsetCatalogAttributeDesc = $rowsetCatalogAttribute->findByAttributeGuid('fixedDescription');
         $rowsetCatalogAttributeContent = $rowsetCatalogAttribute->findByAttributeGuid('fixedContent');
         $this->view->title = $rowsetCatalogAttributeTitle->value;
         $this->view->desc = $rowsetCatalogAttributeDesc->value;
         $this->view->content = $rowsetCatalogAttributeContent->value;
     }
 }
 function generateFormAdd($catalogGuid, $folderGuid = null)
 {
     $aRenderedAttributes = array();
     $aBaseAttributes = array();
     $tableCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowsetCatalog = $tableCatalog->find($catalogGuid);
     $rowCatalog = $rowsetCatalog->current();
     if (!isset($rowCatalog)) {
         $tableProfileAttribute = new Pandamp_Modules_Dms_Profile_Model_ProfileAttribute();
         $where = $tableProfileAttribute->getAdapter()->quoteInto('profileGuid=?', 'setting');
         $rows = $tableProfileAttribute->fetchAll($where, 'viewOrder ASC');
         $i = 0;
         foreach ($rows as $row) {
             $rowset = $row->findParentRow('Pandamp_Modules_Dms_Catalog_Model_Attribute');
             $attributeRenderer = new Pandamp_Form_Attribute_Renderer($rowset->guid, null, $rowset->type, null);
             $aRenderedAttributes[$rowset->guid]['description'] = $rowset->description;
             $aRenderedAttributes[$rowset->guid]['form'] = $attributeRenderer->render();
             $i++;
         }
         $aBaseAttributes['profileGuid']['description'] = '';
         $aBaseAttributes['profileGuid']['form'] = "<input type='hidden' name='profileGuid' id='profileGuid' value='setting'>";
         $aBaseAttributes['folderGuid']['description'] = '';
         $aBaseAttributes['folderGuid']['form'] = "<input type='hidden' name='folderGuid' id='folderGuid' value='{$folderGuid}'>";
         $aBaseAttributes['status']['description'] = '';
         $aBaseAttributes['status']['form'] = "<input type='hidden' name='status' id='status' value='1'>";
     } else {
         $tableProfileAttributes = new Pandamp_Modules_Dms_Profile_Model_ProfileAttribute();
         $where = $tableProfileAttributes->getAdapter()->quoteInto('profileGuid=?', $rowCatalog->profileGuid);
         $rowsetProfileAttributes = $tableProfileAttributes->fetchAll($where, array('viewOrder ASC'));
         $rowsetCatalogAttribute = $rowCatalog->findDependentRowsetCatalogAttribute();
         $i = 0;
         foreach ($rowsetProfileAttributes as $row) {
             $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid($row->attributeGuid);
             $rowAttribute = $row->findParentRow('Pandamp_Modules_Dms_Catalog_Model_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();
             }
             $attributeRenderer = new Pandamp_Form_Attribute_Renderer($rowAttribute->guid, $attributeValue, $rowAttribute->type, null);
             $aRenderedAttributes[$rowAttribute->guid]['description'] = $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}'>";
         $aBaseAttributes['profileGuid']['description'] = '';
         $aBaseAttributes['profileGuid']['form'] = "<input type='hidden' name='profileGuid' id='profileGuid' value='{$rowCatalog->profileGuid}'>";
         $aBaseAttributes['status']['description'] = '';
         $aBaseAttributes['status']['form'] = "<input type='hidden' name='status' id='status' value='1'>";
     }
     $aReturn = array();
     $aReturn['baseForm'] = $aBaseAttributes;
     $aReturn['attributeForm'] = $aRenderedAttributes;
     return $aReturn;
 }
 function generateFormEdit($catalogGuid)
 {
     $today = date('Y-m-d H:i:s');
     $aRenderedAttributes = array();
     $aBaseAttributes = array();
     $tableCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowsetCatalog = $tableCatalog->find($catalogGuid);
     $rowCatalog = $rowsetCatalog->current();
     $tableProfileAttribute = new Pandamp_Modules_Dms_Profile_Model_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('Pandamp_Modules_Dms_Catalog_Model_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)) {
             $attributeRenderer = new Pandamp_Form_Attribute_Renderer($rowAttribute->guid, $attributeValue, $rowAttribute->type, null, $rowCatalog->profileGuid, '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}'>";
     $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'>";*/
     $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="' . ROOT_URL . '/js/extjs/resources/images/default/custom/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="' . ROOT_URL . '/js/extjs/resources/images/default/custom/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;
 }