function commentAction()
 {
     $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowset = $modelCatalog->fetchAll("profileGuid='comment'");
     foreach ($rowset as $row) {
         $modelCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute();
         try {
             $modelComment = new Pandamp_Modules_Extension_Comment_Model_Comment();
             $comment = $modelComment->fetchNew();
             $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
             $rowsetRelatedItem = $tblRelatedItem->fetchRow("itemGuid='" . $row->guid . "' AND relateAs='RELATED_COMMENT'");
             $comment->object_id = $rowsetRelatedItem->relatedGuid;
             $comment->userid = 0;
             $rowsetCatalogAttribute = $row->findDependentRowsetCatalogAttribute();
             $comment->name = $rowsetCatalogAttribute->findByAttributeGuid('fixedName')->value;
             $comment->email = $rowsetCatalogAttribute->findByAttributeGuid('fixedEmail')->value;
             $comment->title = $rowsetCatalogAttribute->findByAttributeGuid('fixedJudul')->value;
             $comment->comment = $rowsetCatalogAttribute->findByAttributeGuid('fixedComment')->value;
             $comment->ip = 0;
             $comment->date = $row->createdDate;
             $comment->published = $row->status;
             $comment->checked_out_time = $row->publishedDate;
             $comment->save();
             echo $comment->title . ' saved<br>';
         } catch (Zend_Exception $e) {
             echo $e->getMessage() . '<br>';
         }
     }
 }
Example #2
0
 function catalogAction()
 {
     $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $row = $modelCatalog->getCatalogByGuid('hol20748');
     $rowsetCatalogAttribute = $row->findDependentRowsetCatalogAttribute();
     $this->view->rca = $rowsetCatalogAttribute;
 }
 function panelCommentAction()
 {
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowset = $tblCatalog->fetchAll("profileGuid='comment' and status=0");
     $num_rows = count($rowset);
     $this->view->numDocs = $num_rows;
 }
Example #4
0
 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;
 }
Example #6
0
 /**
  * getMailContent
  */
 function getMailContent($title)
 {
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $where = $tblCatalog->getAdapter()->quoteInto("shortTitle=?", $title);
     $rowset = $tblCatalog->fetchRow($where);
     $rowsetCatalogAttribute = $rowset->findDependentRowsetCatalogAttribute();
     $content = $rowsetCatalogAttribute->findByAttributeGuid('fixedContent')->value;
     return $content;
 }
 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;
     }
 }
 function terbaruAction()
 {
     $time_start = microtime(true);
     $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $data = array();
     $num_rows = $modelCatalog->getWartaCount("lt4a0a533e31979");
     $limit = 50;
     $data['totalCount'] = $num_rows;
     $data['limit'] = $limit;
     $this->view->aData = $data;
 }
Example #10
0
 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 '';
     }
 }
Example #11
0
 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;
 }
Example #12
0
 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;
 }
Example #13
0
 function mitraKlinikAction()
 {
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowset = $tblCatalog->fetchAll("guid!='lt4b1a5aadda0f1' AND profileGuid='partner'", 'createdDate DESC');
     $content = 0;
     $data = array();
     foreach ($rowset as $row) {
         $modelCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute();
         $data[$content][0] = $modelCatalogAttribute->getCatalogAttributeValue($row->guid, 'fixedTitle');
         $data[$content][1] = $modelCatalogAttribute->getCatalogAttributeValue($row->guid, 'fixedContent');
         $data[$content][2] = $row->guid;
         $content++;
     }
     $num_row = count($rowset);
     $this->view->numberOfRows = $num_row;
     $this->view->aData = $data;
 }
Example #14
0
 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;
         }
     }
 }
 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);
 }
Example #16
0
 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';
     }
 }
Example #17
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);
     }
 }
 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);
 }
Example #19
0
 public function reIndexCatalog_ZendDb()
 {
     $this->emptyIndex();
     $time_start = microtime(true);
     $solr =& $this->_solr;
     $tbl = new Pandamp_Modules_Dms_Catalog_Model_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 #20
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) {
     }
 }
Example #21
0
 function indexAction()
 {
     $r = $this->getRequest();
     $start = $r->getParam('start') ? $r->getParam('start') : 0;
     $limit = $r->getParam('limit') ? $r->getParam('limit') : 20;
     $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $decorator = new Pandamp_BeanContext_Decorator($modelCatalog);
     //$rowset = $decorator->fetchFromFolderAsEntity('lt4a0a533e31979',$start,$limit,"indexklinik");
     $rowset = $decorator->fetchFromFolderAsEntity('lt4a0a533e31979', $start, $limit);
     $a = array();
     $solrNumFound = $modelCatalog->getWartaCount("lt4a0a533e31979");
     $ii = 0;
     if ($solrNumFound == 0) {
         $a['terbaru'][0]['guid'] = 'XXX';
         $a['terbaru'][0]['title'] = 'Kategori klinik kosong';
         $a['terbaru'][0]['pertanyaan'] = "";
         $a['terbaru'][0]['createdBy'] = "";
         $a['terbaru'][0]['kategori'] = '';
         $a['terbaru'][0]['author'] = '';
         $a['terbaru'][0]['sumber'] = '';
     } else {
         foreach ($rowset as $row) {
             $modelCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute();
             $rowCatalogTitle = $modelCatalogAttribute->getCatalogAttributeValue($row->getId(), 'fixedCommentTitle');
             $rowCatalogQuestion = $modelCatalogAttribute->getCatalogAttributeValue($row->getId(), 'fixedCommentQuestion');
             $rowCatalogSelectCat = $modelCatalogAttribute->getCatalogAttributeValue($row->getId(), 'fixedKategoriKlinik');
             $author = $modelCatalogAttribute->getCatalogAttributeValue($row->getId(), 'fixedSelectNama');
             $source = $modelCatalogAttribute->getCatalogAttributeValue($row->getId(), 'fixedSelectMitra');
             /* Get Category from profile clinic_category */
             $findCategory = $decorator->getCatalogByGuidAsEntity($rowCatalogSelectCat);
             $category = $modelCatalogAttribute->getCatalogAttributeValue($findCategory->getId(), 'fixedTitle');
             /* Get Author from profile author */
             $findAuthor = $decorator->getCatalogByGuidAsEntity($author);
             $author = $modelCatalogAttribute->getCatalogAttributeValue($findAuthor->getId(), 'fixedTitle');
             /* Get Source from profile partner */
             $findSource = $decorator->getCatalogByGuidAsEntity($source);
             if ($findSource) {
                 $source = $modelCatalogAttribute->getCatalogAttributeValue($findSource->getId(), 'fixedTitle');
             }
             $a['terbaru'][$ii]['guid'] = $row->getId();
             $a['terbaru'][$ii]['title'] = $rowCatalogTitle;
             $a['terbaru'][$ii]['pertanyaan'] = $rowCatalogQuestion;
             $a['terbaru'][$ii]['createdBy'] = 'Penanya:' . $row->getCreatedBy();
             $a['terbaru'][$ii]['kategori'] = $category;
             $a['terbaru'][$ii]['author'] = 'Jawaban oleh : ' . $author;
             $a['terbaru'][$ii]['sumber'] = 'Sumber : ' . $source;
             $ii++;
         }
     }
     echo Zend_Json::encode($a);
 }
Example #22
0
 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');
 }
Example #23
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;
 }
 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;
 }
Example #25
0
 public function fetchClinicAction()
 {
     $start = $this->_getParam('start') ? $this->_getParam('start') : 0;
     $end = $this->_getParam('limit') ? $this->_getParam('limit') : 10;
     $status = $this->_getParam('status') ? $this->_getParam('status') : 0;
     //$folderGuid	= 'lt4a0a533e31979'; // Klinik
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowset = $tblCatalog->fetchFromFolderAdminClinic($status, $start, $end);
     $a = array();
     $a['totalCount'] = $tblCatalog->countCatalogsInFolderClinic($status);
     $now = date('Y-m-d H:i:s');
     $ii = 0;
     if ($a['totalCount'] != 0) {
         foreach ($rowset as $row) {
             $modelCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute();
             $a['clinic'][$ii]['guid'] = $row->guid;
             $a['clinic'][$ii]['title'] = $modelCatalogAttribute->getCatalogAttributeValue($row->guid, 'fixedCommentTitle');
             $a['clinic'][$ii]['question'] = $modelCatalogAttribute->getCatalogAttributeValue($row->guid, 'fixedCommentQuestion');
             $a['clinic'][$ii]['content'] = $modelCatalogAttribute->getCatalogAttributeValue($row->guid, 'fixedContent');
             $findPartner = $tblCatalog->getCatalogByGuid($modelCatalogAttribute->getCatalogAttributeValue($row->guid, 'fixedSelect'));
             if ($findPartner) {
                 $a['clinic'][$ii]['partner'] = $modelCatalogAttribute->getCatalogAttributeValue($findPartner->guid, 'fixedTitle');
             }
             $a['clinic'][$ii]['createdby'] = $row->createdBy;
             $a['clinic'][$ii]['modifiedby'] = $row->modifiedBy;
             $a['clinic'][$ii]['createdDate'] = Pandamp_Lib_Formater::get_date($row->createdDate);
             if ($now <= $row->publishedDate && $row->status == 99) {
                 $status = "publish_y";
             } else {
                 if (($now <= $row->expiredDate || $row->expiredDate == '0000-00-00 00:00:00') && $row->status == 99) {
                     $status = "publish_g";
                 } else {
                     if ($now > $row->expiredDate && $row->status == 99) {
                         $status = "publish_r";
                     } else {
                         if ($row->status == 0) {
                             $status = "publish_x";
                         } else {
                             if ($row->status == 1) {
                                 $status = "ruby";
                             } else {
                                 if ($row->status == 2) {
                                     $status = "pill";
                                 } else {
                                     if ($row->status == -1) {
                                         $status = "disabled";
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             $a['clinic'][$ii]['status'] = $status;
             $ii++;
         }
     }
     if ($a['totalCount'] == 0) {
         $a['clinic'][0]['guid'] = 'XXX';
         $a['clinic'][0]['title'] = "No Data";
         $a['clinic'][0]['question'] = "-";
         $a['clinic'][0]['createdDate'] = '';
     }
     echo Zend_Json::encode($a);
 }
Example #26
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->name = $this->name;
             $view->value = $this->value;
             if (isset($this->attribs)) {
                 $view->attribs = $this->attribs;
             } else {
                 $view->attribs = array('rows' => 5, 'cols' => 50);
             }
             $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;
             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->name = $this->name;
             $view->value = $this->value;
             $view->setScriptPath(dirname(__FILE__));
             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__));
             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;
         case 6:
             $view = new Zend_View();
             $view->name = $this->name;
             $view->value = $this->value;
             if (isset($this->attribs)) {
                 $view->attribs = $this->attribs;
             } else {
                 $view->attribs = array('size' => 25, 'maxlength' => '50');
             }
             $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 Pandamp_Modules_Dms_Profile_Model_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->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 Pandamp_Modules_Dms_Catalog_Model_Catalog();
             $rowset = $tblCatalog->fetchAll("profileGuid='{$this->other}'");
             $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->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 Pandamp_Modules_Dms_Catalog_Model_Catalog();
             $rowset = $tblCatalog->fetchAll("profileGuid='{$this->profileGuid}'");
             $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->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 Pandamp_Modules_Dms_Catalog_Model_Catalog();
             $rowset = $tblCatalog->fetchAll("profileGuid='kategoriklinik'");
             $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->name = $this->name;
             $view->value = $this->value;
             $view->defaultValues = $data;
             $view->setScriptPath(dirname(__FILE__));
             return $view->render('select.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();
             $username = $auth->getIdentity()->username;
             // get group information
             $acl = Pandamp_Acl::manager();
             $aReturn = $acl->getUserGroupIds($username);
             if (isset($aReturn[1])) {
                 if ($aReturn[1] == "clinicEditor") {
                     unset($aStatus[99]);
                 }
             }
             $view->defaultValues = $aStatus;
             $view->setScriptPath(dirname(__FILE__));
             return $view->render('select2.phtml');
     }
 }
Example #27
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
 }
Example #28
0
 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');
     }
 }
Example #29
0
 function listcommentAction()
 {
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $page = $this->_getParam('page') ? $this->_getParam('page') : 1;
     $limit = 25;
     $start = $limit * ($page - 1);
     sleep(2);
     $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem();
     $rowset = $tblRelatedItem->fetchAll("relatedGuid='{$catalogGuid}' AND relateAs='RELATED_COMMENT'");
     $relatedGuid = array();
     foreach ($rowset as $related) {
         $relatedGuid[] = $related->itemGuid;
     }
     if ($relatedGuid) {
         $data = Pandamp_Lib_Formater::implode_with_keys(", ", $relatedGuid, "'");
         $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
         $rowset = $tblCatalog->fetchAll("guid in({$data}) AND status=99", '', $limit, $start);
         $rowset1 = $tblCatalog->fetchAll("guid in({$data}) AND status=99");
         $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
         $decorator = new Pandamp_BeanContext_Decorator($modelCatalog);
         $row = $decorator->getCatalogByGuidAsEntity($catalogGuid);
         $st = $row->getShortTitle();
         $num_rows = count($rowset1);
         $numPage = ceil($num_rows / $limit);
         $pagination = '';
         for ($i = 1; $i <= $numPage; $i++) {
             $pagination .= "<li><a href='/berita/baca/{$catalogGuid}/{$st}/p/{$i}' title='Halaman {$i}' rev='{$i}'>{$i}</a></li>";
         }
         // check is AJAX request or not
         if (!$this->getRequest()->isXmlHttpRequest()) {
             $this->view->pagination = $pagination;
         }
         $this->view->catalogGuid = $catalogGuid;
         $this->view->numberOfRows = $num_rows;
         $this->view->rows = $rowset;
         $this->view->limit = $limit;
     }
 }
 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');
                 //					}
             }
         }
     }
 }