public function newAction()
 {
     $this->view->message = "Nothing is saved";
     $req = $this->getRequest();
     $item = $req->getParam('guid');
     $relatedItem = $req->getParam('relatedGuid');
     $as = $req->getParam('relateAs');
     Zend_Loader::loadClass('Kutu_Core_Orm_Table_Catalog');
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     if (empty($relatedItem)) {
         $this->view->message = "No relatedGuid specified!";
     }
     //check if $guid is an array
     if (is_array($item)) {
         foreach ($item as $guid) {
             echo "<br>" . $guid;
             $rowCatalog = $tblCatalog->find($guid)->current();
             echo $rowCatalog->guid;
             $rowCatalog->relateTo($relatedItem, $as);
         }
     } else {
         $rowCatalog = $tblCatalog->find($item)->current();
         $rowCatalog->relateTo($relatedItem, $as);
         $this->view->message = "Data was successfully saved";
     }
 }
Exemplo n.º 2
0
 public function detailsAction()
 {
     $this->_helper->layout()->setLayout('layout-iht');
     $r = $this->getRequest();
     $catalogGuid = $r->getParam('guid');
     $this->view->catalogGuid = $catalogGuid;
     $folderGuid = $r->getParam('node');
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     $rowCatalog = $tblCatalog->find($catalogGuid)->current();
     $rowsetAttribute = $rowCatalog->findDependentRowsetCatalogAttribute();
     $rowTitle = $rowsetAttribute->findByAttributeGuid('fixedTitle');
     $this->view->catalogTitle = $rowTitle->value;
     $rowSubTitle = $rowsetAttribute->findByAttributeGuid('fixedSubTitle');
     $this->view->catalogSubTitle = $rowSubTitle->value;
     $modDir = $this->getFrontController()->getModuleDirectory();
     require_once $modDir . '/components/Dms/Catalog/DetailsViewer.php';
     $w = new Dms_Catalog_DetailsViewer($catalogGuid, 'root');
     $this->view->widget1 = $w;
     if (empty($folderGuid)) {
         $rowsetFolder = $rowCatalog->findManyToManyRowset('Kutu_Core_Orm_Table_Folder', 'Kutu_Core_Orm_Table_CatalogFolder');
         if (count($rowsetFolder) > 0) {
             $rowFolder = $rowsetFolder->current();
             $folderGuid = $rowFolder->guid;
         }
     }
     require_once $modDir . '/components/Dms/FolderBreadcrumbs.php';
     $w2 = new Dms_FolderBreadcrumbs($folderGuid);
     $this->view->widget2 = $w2;
 }
Exemplo n.º 3
0
 /**
  * getMailContent
  */
 function getMailContent($title)
 {
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     $where = $tblCatalog->getAdapter()->quoteInto("shortTitle=?", $title);
     $rowset = $tblCatalog->fetchRow($where);
     $rowsetCatalogAttribute = $rowset->findDependentRowsetCatalogAttribute();
     $content = $rowsetCatalogAttribute->findByAttributeGuid('fixedContent')->value;
     return $content;
 }
Exemplo n.º 4
0
 public function fetchCatalogs($folderGuid, $offset = 0, $limit = 0)
 {
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     //$select = $tblCatalog->select();
     $select = $tblCatalog->select();
     $select->setIntegrityCheck(false);
     $select->from(array('kc' => 'KutuCatalog'))->join(array('kcf' => 'KutuCatalogFolder'), 'kc.guid = kcf.catalogGuid', array())->where('kcf.folderGuid = ?', $folderGuid)->order('kc.createdDate DESC')->limit($limit, $offset);
     //print_r($select->__toString()); die();
     return $tblCatalog->fetchAll($select);
 }
 public function indexAction()
 {
     //		$model = $this->_getModel();
     //		$this->view->entries = $model->fetchEntries();
     $model = new Kutu_Core_Orm_Table_Order();
     $rows = $model->fetchAll();
     $model2 = new Kutu_Core_Orm_Table_Catalog();
     $rows2 = $model2->fetchAll();
     $this->view->rows = $rows;
 }
Exemplo n.º 6
0
 static function find($catalogGuid)
 {
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     $rowsetCatalog = $tblCatalog->find($catalogGuid);
     if ($rowsetCatalog->count()) {
         return new Kutu_Core_Model_Catalog($rowsetCatalog->current());
     } else {
         return false;
     }
 }
Exemplo n.º 7
0
 public function getPrice($catalogGuid)
 {
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     $rowset = $tblCatalog->find($catalogGuid);
     if (count($rowset)) {
         $row = $rowset->current();
         return $row->price;
     } else {
         return 0;
     }
 }
 function generateFormAnswer($catalogGuid)
 {
     $aRenderedAttributes = array();
     $aBaseAttributes = array();
     $tableCatalog = new Kutu_Core_Orm_Table_Catalog();
     $rowsetCatalog = $tableCatalog->find($catalogGuid);
     $rowCatalog = $rowsetCatalog->current();
     $tableProfileAttribute = new Kutu_Core_Orm_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('Kutu_Core_Orm_Table_Attribute');
         if (isset($rowCatalogAttribute->value)) {
             $attributeValue = $rowCatalogAttribute->value;
         } else {
             $attributeValue = '';
         }
         if (isset($rowCatalogAttribute->guid)) {
             $catalogAttributeGuid = $rowCatalogAttribute->guid;
         } else {
             $guidMan = new Kutu_Core_Guid();
             $catalogAttributeGuid = $guidMan->generateGuid();
         }
         $attributeRenderer = new Kutu_Form_Attribute_Renderer($rowAttribute->guid, $attributeValue, $rowAttribute->type, null, 'clinic', 'clinic_category');
         $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['shortTitle']['description'] = 'shortTitle';
     //		$aBaseAttributes['shortTitle']['form'] = "<textarea name='shortTitle' id='shortTitle' rows='1'' cols='50'>$rowCatalog->shortTitle</textarea>";
     $aBaseAttributes['profileGuid']['description'] = '';
     $aBaseAttributes['profileGuid']['form'] = "<input type='hidden' name='profileGuid' id='profileGuid' value='{$rowCatalog->profileGuid}'>";
     $aBaseAttributes['profileGuid']['description'] = 'Sender';
     $aBaseAttributes['profileGuid']['form'] = "{$rowCatalog->createdBy}";
     //		$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="'.KUTU_ROOT_URL.'/mix_lib/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="'.KUTU_ROOT_URL.'/mix_lib/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['status']['description'] = '';
     $aBaseAttributes['status']['form'] = "<input type='hidden' name='status' id='status' value='{$rowCatalog->status}'>";
     $aReturn = array();
     $aReturn['baseForm'] = $aBaseAttributes;
     $aReturn['attributeForm'] = $aRenderedAttributes;
     return $aReturn;
 }
Exemplo n.º 9
0
 public function GetCatalogDocSize($catalogGuid)
 {
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     $rowsetCatalog = $tblCatalog->find($catalogGuid);
     if (count($rowsetCatalog)) {
         $rowCatalog = $rowsetCatalog->current();
         $rowsetCatAtt = $rowCatalog->findDependentRowsetCatalogAttribute();
         $docSize = $this->bytesToString($rowsetCatAtt->findByAttributeGuid('docSize')->value);
     } else {
         $docSize = '0kB';
     }
     return $docSize;
 }
Exemplo n.º 10
0
 public function GetCatalogDocType($catalogGuid)
 {
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     $rowsetCatalog = $tblCatalog->find($catalogGuid);
     if (count($rowsetCatalog)) {
         $rowCatalog = $rowsetCatalog->current();
         $rowsetCatAtt = $rowCatalog->findDependentRowsetCatalogAttribute();
         $docType = $this->imageDocumentType($this->dl_file($rowsetCatAtt->findByAttributeGuid('docOriginalName')->value));
     } else {
         $docType = '';
     }
     return $docType;
 }
 public function GetCatalogDownloadTitle($catalogGuid)
 {
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     $rowsetCatalog = $tblCatalog->find($catalogGuid);
     if (count($rowsetCatalog)) {
         $rowCatalog = $rowsetCatalog->current();
         $rowsetCatAtt = $rowCatalog->findDependentRowsetCatalogAttribute();
         $oriName = $rowsetCatAtt->findByAttributeGuid('docOriginalName')->value;
     } else {
         $oriName = 'No-Title';
     }
     return $oriName;
 }
Exemplo n.º 12
0
 public function genericAction()
 {
     $r = $this->getRequest();
     $guid = $r->getParam('g');
     $this->view->catalogGuid = $guid;
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     $rowCatalog = $tblCatalog->find($guid)->current();
     $this->view->row = $rowCatalog;
     $rowsetFolder = $rowCatalog->findManyToManyRowset('Kutu_Core_Orm_Table_Folder', 'Kutu_Core_Orm_Table_CatalogFolder');
     if (count($rowsetFolder) > 0) {
         $rowFolder = $rowsetFolder->current();
         $folderGuid = $rowFolder->guid;
         $this->view->folderGuid = $folderGuid;
         $this->view->folderTitle = $rowFolder->title;
     }
 }
Exemplo n.º 13
0
 public function __construct($profile = 'kutu_peraturan', $start = 0)
 {
     $this->view = new Zend_View();
     $this->view->setScriptPath(dirname(__FILE__) . '/views');
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     $rowset = $tblCatalog->fetchAll("profileGuid='{$profile}'", 'createdDate DESC', 5, $start);
     $content = 0;
     $data = array();
     foreach ($rowset as $row) {
         $rowsetCatalogAttribute = $row->findDependentRowsetCatalogAttribute();
         $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid('fixedTitle');
         $data[$content][0] = $rowCatalogAttribute->value;
         $data[$content][1] = strftime("%H:%M", strtotime($row->createdDate));
         $data[$content][2] = $row->guid;
         $content++;
     }
     $num_rows = count($rowset);
     $this->view->numberOfRows = $num_rows;
     $this->view->data = $data;
 }
Exemplo n.º 14
0
 function indexAction()
 {
     $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $sReturn = base64_encode($sReturn);
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         $registry = Zend_Registry::getInstance();
         $config = $registry->get('config');
         $loginUrl = $config->identity->config->local->login->url;
         $this->_redirect(KUTU_ROOT_URL . $loginUrl . '?returnTo=' . $sReturn);
     }
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     $rowset = $tblCatalog->fetchRow("shortTitle='halaman-depan-login' AND status=99");
     if (!empty($rowset)) {
         $rowsetCatalogAttribute = $rowset->findDependentRowsetCatalogAttribute();
         $fixedContent = $rowsetCatalogAttribute->findByAttributeGuid('fixedContent')->value;
     } else {
         $fixedContent = '';
     }
     $this->view->content = $fixedContent;
     $this->view->sReturn = $sReturn;
 }
Exemplo n.º 15
0
 public function forceDelete($folderGuid)
 {
     Zend_Loader::loadClass('Kutu_Core_Orm_Table_Folder');
     $tblFolder = new Kutu_Core_Orm_Table_Folder();
     $rowSet = $tblFolder->fetchChildren($folderGuid);
     $row1 = $tblFolder->find($folderGuid)->current();
     foreach ($rowSet as $row) {
         $this->forceDelete($row->guid);
     }
     echo $row1->title . ' ';
     $rowsetCatalogFolder = $row1->findDependentRowsetCatalogFolder();
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     $bpmCatalog = new Kutu_Core_Bpm_Catalog();
     if (count($rowsetCatalogFolder)) {
         foreach ($rowsetCatalogFolder as $rowCatalogFolder) {
             $rowCatalog = $tblCatalog->find($rowCatalogFolder->catalogGuid)->current();
             echo $rowCatalog->guid . '<br>';
             $bpmCatalog->delete($rowCatalog->guid);
         }
         $this->delete($row1->guid);
     } else {
         $this->delete($row1->guid);
     }
 }
Exemplo n.º 16
0
 function generateFormEdit($catalogGuid)
 {
     $today = date('Y-m-d H:i:s');
     Zend_Loader::loadClass('Kutu_Form_Attribute_Renderer');
     Zend_Loader::loadClass('Kutu_Core_Orm_Table_ProfileAttribute');
     Zend_Loader::loadClass('Kutu_Core_Orm_Table_Catalog');
     $aRenderedAttributes = array();
     $aBaseAttributes = array();
     $tableCatalog = new Kutu_Core_Orm_Table_Catalog();
     $rowsetCatalog = $tableCatalog->find($catalogGuid);
     $rowCatalog = $rowsetCatalog->current();
     $tableProfileAttribute = new Kutu_Core_Orm_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('Kutu_Core_Orm_Table_Attribute');
         if (isset($rowCatalogAttribute->value)) {
             $attributeValue = $rowCatalogAttribute->value;
         } else {
             $attributeValue = '';
         }
         if (isset($rowCatalogAttribute->guid)) {
             $catalogAttributeGuid = $rowCatalogAttribute->guid;
         } else {
             Zend_Loader::loadClass('Kutu_Core_Guid');
             $guidMan = new Kutu_Core_Guid();
             $catalogAttributeGuid = $guidMan->generateGuid();
         }
         if (isset($rowAttribute)) {
             $attributeRenderer = new Kutu_Form_Attribute_Renderer($rowAttribute->guid, $attributeValue, $rowAttribute->type, null, $rowCatalog->profileGuid);
             $aRenderedAttributes[$rowAttribute->guid]['description'] = $rowAttribute->description;
             $aRenderedAttributes[$rowAttribute->guid]['form'] = $attributeRenderer->render();
         }
         $i++;
     }
     $aBaseAttributes['guid']['description'] = 'Guid';
     $aBaseAttributes['guid']['form'] = $rowCatalog->guid . "<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'>";*/
     //$aBaseAttributes['publishedDate']['description'] = 'Published Date';
     //$aBaseAttributes['publishedDate']['form'] = "<input type='text' name='publishedDate' id='publishedDate' value='$rowCatalog->publishedDate'>";
     //$aBaseAttributes['expiredDate']['description'] = 'Expired Date';
     //$aBaseAttributes['expiredDate']['form'] = "<input type='text' name='expiredDate' id='expiredDate' value='$rowCatalog->expiredDate'>";
     $aBaseAttributes['createdBy']['description'] = 'Created By';
     $aBaseAttributes['createdBy']['form'] = $rowCatalog->createdBy;
     //"<input type='text' name='createdBy' id='createdBy' value='$rowCatalog->createdBy'>";
     $aBaseAttributes['modifiedBy']['description'] = 'Modified By';
     $aBaseAttributes['modifiedBy']['form'] = $rowCatalog->modifiedBy;
     //"<input type='text' name='modifiedBy' id='modifiedBy' value='$rowCatalog->modifiedBy'>";
     $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 (in USD)';
     $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 Kutu_Form_Attribute_Renderer('status', $rowCatalog->status, 101);
     $aBaseAttributes['status']['form'] = $attributeRenderer->render();
     $aReturn = array();
     $aReturn['baseForm'] = $aBaseAttributes;
     $aReturn['attributeForm'] = $aRenderedAttributes;
     return $aReturn;
 }
Exemplo n.º 17
0
 public function reIndexCatalog_ZendDb()
 {
     $this->emptyIndex();
     $time_start = microtime(true);
     $solr =& $this->_solr;
     $tbl = new Kutu_Core_Orm_Table_Catalog();
     $rowset = $tbl->fetchAll();
     //("profileGuid='kutu_peraturan'");
     $documents = array();
     $rowCount = count($rowset);
     for ($iCount = 0; $iCount < $rowCount; $iCount++) {
         $row = $rowset->current();
         //			if($iCount == 100)
         //				break;
         echo 'urutan: ' . $iCount . '<br>';
         $documents[] = $this->_createSolrDocument($row);
         $rowset->next();
         if ($iCount % 1000 == 0) {
             try {
                 $solr->addDocuments($documents);
                 $solr->commit();
                 //$solr->optimize();
                 $documents = array();
             } catch (Exception $e) {
                 echo "Error occured when processing record starting from number: " . ($iCount - 1000) . ' to ' . $iCount;
                 throw new Zend_Exception($e->getMessage());
                 //echo $e->getMessage();
             }
         }
     }
     try {
         $solr->addDocuments($documents);
         $solr->commit();
         $solr->optimize();
     } catch (Exception $e) {
         throw new Zend_Exception($e->getMessage());
         //echo $e->getMessage();
     }
     $time_end = microtime(true);
     $time = $time_end - $time_start;
     echo '<br>WAKTU EKSEKUSI: ' . $time;
 }
Exemplo n.º 18
0
 public function sampleAction()
 {
     $req = $this->getRequest();
     //$this->view->message = "We detected that you don't have yet access to this resource. If you believe you have one, please contact our support. Thank you.";
     $catalogGuid = $req->getParam('guid');
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     $rowsetCatalog = $tblCatalog->find($catalogGuid);
     $this->_helper->layout()->disableLayout();
     if (count($rowsetCatalog)) {
         $rowCatalog = $rowsetCatalog->current();
         $rowsetCatAtt = $rowCatalog->findDependentRowsetCatalogAttribute();
         $contentType = $rowsetCatAtt->findByAttributeGuid('docMimeType')->value;
         $systemname = $rowsetCatAtt->findByAttributeGuid('docSystemName')->value;
         $filename = $rowsetCatAtt->findByAttributeGuid('docOriginalName')->value;
         $tblRelatedItem = new Kutu_Core_Orm_Table_RelatedItem();
         $rowsetRelatedItem = $tblRelatedItem->fetchAll("itemGuid='{$catalogGuid}' AND relateAs='RELATED_FILE'");
         $flagFileFound = false;
         foreach ($rowsetRelatedItem as $rowRelatedItem) {
             if (!$flagFileFound) {
                 $parentGuid = $rowRelatedItem->relatedGuid;
                 $sDir1 = KUTU_ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $systemname;
                 $sDir2 = KUTU_ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $parentGuid . DIRECTORY_SEPARATOR . $systemname;
                 if (file_exists($sDir1)) {
                     $flagFileFound = true;
                     if (trim($contentType) == 'application/pdf') {
                         $this->_generatePdfSamplePage($sDir1);
                     } else {
                         echo 'NO SAMPLE PAGE';
                     }
                 } else {
                     if (file_exists($sDir2)) {
                         $flagFileFound = true;
                         if (trim($contentType) == 'application/pdf') {
                             $this->_generatePdfSamplePage($sDir2);
                         } else {
                             echo 'NO SAMPLE PAGE';
                         }
                     } else {
                         echo 'No FILE';
                         $flagFileFound = false;
                     }
                 }
             }
         }
     } else {
         echo 'NO FILE';
     }
 }
Exemplo n.º 19
0
 public function homeAction()
 {
     $this->view->pageTitle = 'Home';
     $this->_helper->layout()->setLayout('layout-nosidebar');
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     $rowset = $tblCatalog->fetchFromFolder('nlrp4a35276c91693', 0, 1);
     if (count($rowset)) {
         $row = $rowset->current();
         $this->view->row = $row;
         /*$modDir = $this->getFrontController()->getModuleDirectory();
         			require_once($modDir.'/components/Pages/DetailsViewer.php');
         			$w = new Site_Pages_DetailsViewer($solrResult->response->docs[0]->id, 'root');
         			$this->view->widget1 = $w;
         
         			$this->view->showHeadline = 1;
         			$this->view->listTitle = Kutu_Core_Util::getCatalogAttributeValue($solrResult->response->docs[0]->id, 'fixedTitle');*/
     }
     $cms = new Kutu_Cms_Bpm_Folder();
     $this->view->rows = $cms->fetchCatalogs('nlrp4a40810bd0d63', 0, 5);
 }
Exemplo n.º 20
0
 public function indexCatalog($catalogGuid)
 {
     $index = $this->_index;
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     $rowsetCatalog = $tblCatalog->find($catalogGuid);
     if (count($rowsetCatalog)) {
         //check if guid exist in index, then delete
         $term = new Zend_Search_Lucene_Index_Term($catalogGuid, 'guid');
         $docIds = $index->termDocs($term);
         foreach ($docIds as $id) {
             $doc = $index->getDocument($id);
             $index->delete($id);
         }
         $rowCatalog = $rowsetCatalog->current();
         $doc = new Zend_Search_Lucene_Document();
         $doc->addField(Zend_Search_Lucene_Field::Keyword('guid', $rowCatalog->guid));
         //fill parentGuid with catalogGuid if it's kutu_doc
         if ($rowCatalog->profileGuid == 'kutu_doc') {
             $tblRelatedItem = new Kutu_Core_Orm_Table_RelatedItem();
             $rowset = $tblRelatedItem->fetchAll("itemGuid='{$rowCatalog->guid}' AND relateAs='RELATED_FILE'");
             if (count($rowset)) {
                 $row = $rowset->current();
                 $parentCatalogGuid = $row->relatedGuid;
                 $doc->addField(Zend_Search_Lucene_Field::Keyword('parentGuid', $parentCatalogGuid));
             }
         } else {
             $doc->addField(Zend_Search_Lucene_Field::Keyword('parentGuid', $rowCatalog->guid));
         }
         $doc->addField(Zend_Search_Lucene_Field::Text('profile', $rowCatalog->profileGuid));
         $doc->addField(Zend_Search_Lucene_Field::Keyword('publishedDate', $this->_filterDateTime($rowCatalog->publishedDate)));
         $doc->addField(Zend_Search_Lucene_Field::Keyword('expiredDate', $this->_filterDateTime($rowCatalog->expiredDate)));
         $doc->addField(Zend_Search_Lucene_Field::Keyword('createdBy', $rowCatalog->createdBy));
         $doc->addField(Zend_Search_Lucene_Field::Keyword('modifiedBy', $rowCatalog->modifiedBy));
         $doc->addField(Zend_Search_Lucene_Field::Keyword('createdDate', $this->_filterDateTime($rowCatalog->createdDate)));
         $doc->addField(Zend_Search_Lucene_Field::Keyword('modifiedDate', $this->_filterDateTime($rowCatalog->modifiedDate)));
         $doc->addField(Zend_Search_Lucene_Field::Keyword('status', $rowCatalog->status));
         if ($rowCatalog->profileGuid == 'kutu_doc') {
             $doc->addField(Zend_Search_Lucene_Field::Keyword('objectType', 'file'));
         } else {
             $doc->addField(Zend_Search_Lucene_Field::Keyword('objectType', 'catalog'));
         }
         $rowsetCatalogAttribute = $rowCatalog->findDependentRowsetCatalogAttribute();
         if (count($rowsetCatalogAttribute)) {
             foreach ($rowsetCatalogAttribute as $rowCatalogAttribute) {
                 switch ($rowCatalogAttribute->attributeGuid) {
                     case 'fixedTitle':
                     case 'title':
                         $doc->addField(Zend_Search_Lucene_Field::Text('title', $rowCatalogAttribute->value));
                         break;
                     case 'fixedSubTitle':
                     case 'subTitle':
                         $doc->addField(Zend_Search_Lucene_Field::Text('subtitle', $rowCatalogAttribute->value));
                         break;
                     case 'fixedContent':
                     case 'content':
                         $docHtml = Zend_Search_Lucene_Document_Html::loadHTML($rowCatalogAttribute->value);
                         $cleanedText = $docHtml->getFieldValue('body');
                         $doc->addField(Zend_Search_Lucene_Field::UnStored('content', $cleanedText));
                         break;
                     case 'fixedKeywords':
                     case 'keywords':
                         $doc->addField(Zend_Search_Lucene_Field::UnStored('keywords', $rowCatalogAttribute->value));
                         break;
                     case 'fixedDescription':
                     case 'description':
                         $doc->addField(Zend_Search_Lucene_Field::Text('description', $rowCatalogAttribute->value));
                         break;
                     case 'ptsKetua':
                         $doc->addField(Zend_Search_Lucene_Field::Text('judge', $rowCatalogAttribute->value));
                         break;
                     case 'prtNomor':
                     case 'fixedNomor':
                     case 'fixedNumber':
                     case 'nomor':
                     case 'ptsNomor':
                         $doc->addField(Zend_Search_Lucene_Field::UnStored('number', $rowCatalogAttribute->value));
                         break;
                     case 'prtTahun':
                     case 'fixedTahun':
                     case 'fixedYear':
                     case 'tahun':
                     case 'ptsTahun':
                         $doc->addField(Zend_Search_Lucene_Field::UnStored('year', $rowCatalogAttribute->value));
                         break;
                     default:
                         //check if attribute is a datetime field
                         $tblAttribute = new Kutu_Core_Orm_Table_Attribute();
                         $rowAttribute = $tblAttribute->find($rowCatalogAttribute->attributeGuid)->current();
                         if ($rowAttribute->type == 4) {
                             $doc->addField(Zend_Search_Lucene_Field::UnStored(strtolower($rowCatalogAttribute->attributeGuid), $this->_filterDateTime($rowCatalogAttribute->value)));
                         } else {
                             if ($rowAttribute->type == 2) {
                                 $docHtml = Zend_Search_Lucene_Document_Html::loadHTML($rowCatalogAttribute->value);
                                 $cleanedText = $docHtml->getFieldValue('body');
                                 $doc->addField(Zend_Search_Lucene_Field::UnStored(strtolower($rowCatalogAttribute->attributeGuid), $cleanedText));
                             } else {
                                 $doc->addField(Zend_Search_Lucene_Field::UnStored(strtolower($rowCatalogAttribute->attributeGuid), $rowCatalogAttribute->value));
                             }
                         }
                         break;
                 }
             }
             //if profile=kutu_doc, extract text from its file and put it in content field
             if ($rowCatalog->profileGuid == 'kutu_doc') {
                 $row = $rowsetCatalogAttribute->findByAttributeGuid('docSystemName');
                 $systemName = $row->value;
                 $row = $rowsetCatalogAttribute->findByAttributeGuid('docMimeType');
                 $mimeType = $row->value;
                 $extactedText = $this->_extractText($rowCatalog->guid, $systemName, $mimeType);
                 $doc->addField(Zend_Search_Lucene_Field::UnStored('content', $extactedText));
             }
         }
         // if catalog is a kutu_doc, and if field content empty (this means
         // file can't be read, text can't be extracted, or file empty), do not index
         if ($rowCatalog->profileGuid == 'kutu_doc') {
             $tmpS = $doc->getFieldValue('content');
             if (!empty($tmpS)) {
                 $index->addDocument($doc);
             } else {
             }
         } else {
             $index->addDocument($doc);
         }
     } else {
         // do nothing
     }
 }
Exemplo n.º 21
0
 function generateFormAdd($catalogGuid, $folderGuid = null)
 {
     $aRenderedAttributes = array();
     $aBaseAttributes = array();
     $tableCatalog = new Kutu_Core_Orm_Table_Catalog();
     $rowsetCatalog = $tableCatalog->find($catalogGuid);
     $rowCatalog = $rowsetCatalog->current();
     if (!isset($rowCatalog)) {
         $tableProfileAttribute = new Kutu_Core_Orm_Table_ProfileAttribute();
         $where = $tableProfileAttribute->getAdapter()->quoteInto('profileGuid=?', 'setting');
         $rows = $tableProfileAttribute->fetchAll($where, 'viewOrder ASC');
         $i = 0;
         foreach ($rows as $row) {
             $rowset = $row->findParentRow('Kutu_Core_Orm_Table_Attribute');
             $attributeRenderer = new Kutu_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 Kutu_Core_Orm_Table_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('Kutu_Core_Orm_Table_Attribute');
             if (isset($rowCatalogAttribute->value)) {
                 $attributeValue = $rowCatalogAttribute->value;
             } else {
                 $attributeValue = '';
             }
             if (isset($rowCatalogAttribute->guid)) {
                 $catalogAttributeGuid = $rowCatalogAttribute->guid;
             } else {
                 $guidMan = new Kutu_Core_Guid();
                 $catalogAttributeGuid = $guidMan->generateGuid();
             }
             $attributeRenderer = new Kutu_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;
 }
Exemplo n.º 22
0
 function isAllowed($username, $itemGuid, $action, $section = 'content')
 {
     if ($this->checkAcl("site", 'all', 'user', $username, false, false)) {
         return true;
     }
     if ($section == 'content') {
         if ($this->checkAcl("dms", 'all', 'user', $username, false, false)) {
             return true;
         }
         switch ($action) {
             case 'create':
                 if ($this->checkAcl("dms", 'createCatalog', 'user', $username, false, false)) {
                     return true;
                 }
             case 'read':
                 if ($this->checkAcl("dms", 'readCatalog', 'user', $username, false, false) || $acl->checkAcl("dms", 'updateCatalog', 'user', $username, false, false)) {
                     return true;
                 }
             case 'update':
                 if ($this->checkAcl("dms", 'updateCatalog', 'user', $username, false, false)) {
                     return true;
                 }
             case 'delete':
                 if ($this->checkAcl("dms", 'deleteCatalog', '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 Kutu_Core_Orm_Table_Catalog();
         $rowset = $tblCatalog->find($itemGuid);
         if (count($rowset) > 0) {
             $row = $rowset->current();
             if ($row->profileGuid != 'kutu_folder') {
                 //if user was the creator of the item, allow everything
                 if ($row->createdBy == $username) {
                     return true;
                 }
                 $aAclId = $this->searchAcl('action', false, false, false, false, 'content', $itemGuid);
                 if (count($aAclId) > 0) {
                     return $this->checkAcl('action', $action, 'user', $username, 'content', $itemGuid);
                 } else {
                     //check permission of the folder which this catalog belongs to
                     $rowset1 = $row->findDependentRowset('Kutu_Core_Orm_Table_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 Kutu_Core_Orm_Table_Folder();
         $rowset = $tblFolder->find($itemGuid);
         if (count($rowset) > 0) {
             return $this->_traverseFolderPermission($username, $itemGuid, $action);
         }
     }
     //check at section
     $aAclId = $this->searchAcl('action', false, false, false, false, $section, $itemGuid);
     if (count($aAclId) > 0) {
         return $this->checkAcl('action', $action, 'user', $username, $section, $itemGuid);
     }
     //check at feature section
     /*$aAclId = $this->searchAcl('action', false, false, false, false, 'feature', $itemGuid);
     		if(count($aAclId)>0)
     		{
     			return $this->checkAcl('action', $action, 'user', $username, 'feature', $itemGuid);
     		}*/
     return false;
 }
Exemplo n.º 23
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, 'style' => "width:250px;height:22px;padding:5px;");
             }
             $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 = KUTU_ROOT_URL . '/lib/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 -4:
             //$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 -41:
             $n = '<textarea id="html" name="jTagEditor" class="jTagEditor">' . $this->value . '</textarea>';
             return $n;
             break;
             //datetime field
         //datetime field
         case 4:
             /*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 -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 Kutu_Core_Orm_Table_ProfileAttribute();
             $rowset = $tblProAtt->fetchAll("profileGuid='{$this->profileGuid}' AND attributeGuid='{$this->name}'");
             $defaultValues = array();
             if (count($rowset) == 1) {
                 $row = $rowset->current();
                 $defaultValues = Zend_Json::decode($row->defaultValues);
                 if (is_array($defaultValues)) {
                     //var_dump($defaultValues);
                 } else {
                     $defaultValues = array();
                 }
             }
             $view = new Zend_View();
             $view->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 Kutu_Core_Orm_Table_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;
     }
 }
Exemplo n.º 24
0
 public function addTranslation($itemGuid, $relatedGuid)
 {
     $tblRelatedItem = new Kutu_Core_Orm_Table_RelatedItem();
     //check apakah relatedGuid adalah seorang parent atau child
     $rowsetRelatedItem = $tblRelatedItem->fetchAll("relatedGuid='{$relatedGuid}' AND relateAs='RELATED_TRANSLATION'");
     if (count($rowsetRelatedItem)) {
         //do nothing
     }
     $rowsetRelatedItem = $tblRelatedItem->fetchAll("itemGuid='{$relatedGuid}' AND relateAs='RELATED_TRANSLATION'");
     if (count($rowsetRelatedItem)) {
         $relatedGuid = $rowsetRelatedItem->current()->relatedGuid;
     }
     //check if $itemGuid adalah parent atau child
     $rowsetRelatedItem = $tblRelatedItem->fetchAll("relatedGuid='{$itemGuid}' AND relateAs='RELATED_TRANSLATION'");
     if (count($rowsetRelatedItem)) {
         //check apakah sudah ada
         $rs1 = $tblRelatedItem->find($this->itemGuid, $relatedGuid, "RELATED_TRANSLATION");
         if (count($rs1)) {
         } else {
             $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
             $rowset = $tblCatalog->find($itemGuid);
             if (count($rowset)) {
                 $row = $rowset->current();
                 $row->relateTo($relatedGuid, "RELATED_TRANSLATION");
             }
         }
         //get all children and set its current relatedGuid to the new relatedGuid
         foreach ($rowsetRelatedItem as $row) {
             $row->relatedGuid = $relatedGuid;
             $row->save();
         }
     } else {
         //check apakah itemGuid adalah child
         $rs1 = $tblRelatedItem->fetchAll("itemGuid='{$itemGuid}' AND relateAs='RELATED_TRANSLATION'");
         if (count($rs1)) {
             //update bapaknya dan anak dari bapaknya
             $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
             $rowset = $tblCatalog->find($rs1->current()->relatedGuid);
             if (count($rowset)) {
                 $row = $rowset->current();
                 $row->relateTo($relatedGuid, "RELATED_TRANSLATION");
             }
             $bapak = $rs1->current()->relatedGuid;
             $rs2 = $tblRelatedItem->fetchAll("relatedGuid='{$bapak}' AND relateAs='RELATED_TRANSLATION'");
             if (count($rs2)) {
                 foreach ($rs2 as $row) {
                     $row->relatedGuid = $relatedGuid;
                     $row->save();
                 }
             }
         }
     }
     /*$rowsetRelatedItem = $tblRelatedItem->find($this->itemGuid, $relatedGuid, "RELATED_TRANSLATION");
     		if(count($rowsetRelatedItem))
     		{
     			
     		}
     		else
     		{
     			$rowsetRelatedItem = $tblRelatedItem->find($relatedGuid, $this->itemGuid, "RELATED_TRANSLATION");
     			if(count($rowsetRelatedItem))
     			{
     				
     			}
     			else
     			{
     				$tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     				$rowset = $tblCatalog->find($itemGuid);
     				if(count($rowset))
     				{
     					$row = $rowset->current();
     					$row->relateTo($relatedGuid, "RELATED_TRANSLATION");
     				}
     			}
     		}*/
 }
Exemplo n.º 25
0
 public function view()
 {
     $this->view->addHelperPath(KUTU_ROOT_DIR . '/lib/Kutu/View/Helper', 'Kutu_View_Helper');
     $catalogGuid = $this->catalogGuid ? $this->catalogGuid : '';
     $node = $this->folderGuid ? $this->folderGuid : 'root';
     Zend_Loader::loadClass('Kutu_Core_Orm_Table_Catalog');
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     if (!empty($catalogGuid)) {
         $rowCatalog = $tblCatalog->find($catalogGuid)->current();
         $rowsetCatalogAttribute = $rowCatalog->findDependentRowsetCatalogAttribute();
         Zend_Loader::loadClass('Kutu_Core_Orm_Table_ProfileAttribute');
         $tableProfileAttribute = new Kutu_Core_Orm_Table_ProfileAttribute();
         $profileGuid = $rowCatalog->profileGuid;
         $where = $tableProfileAttribute->getAdapter()->quoteInto('profileGuid=?', $profileGuid);
         $rowsetProfileAttribute = $tableProfileAttribute->fetchAll($where, 'viewOrder ASC');
         $aAttribute = array();
         $i = 0;
         Zend_Loader::loadClass('Kutu_Core_Orm_Table_Attribute');
         $tblAttribute = new Kutu_Core_Orm_Table_Attribute();
         foreach ($rowsetProfileAttribute as $rowProfileAttribute) {
             if ($rowsetCatalogAttribute->findByAttributeGuid($rowProfileAttribute->attributeGuid)) {
                 $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid($rowProfileAttribute->attributeGuid);
                 $rowsetAttribute = $tblAttribute->find($rowCatalogAttribute->attributeGuid);
                 if (count($rowsetAttribute)) {
                     $rowAttribute = $rowsetAttribute->current();
                     $aAttribute[$i]['name'] = $rowAttribute->name;
                 } else {
                     $aAttribute[$i]['name'] = '';
                 }
                 $aAttribute[$i]['value'] = $rowCatalogAttribute->value;
             } else {
             }
             $i++;
         }
     }
     $this->view->aAttribute = $aAttribute;
     $this->view->rowCatalog = $rowCatalog;
     $this->view->rowsetCatalogAttribute = $rowsetCatalogAttribute;
     $this->view->node = $node;
     $this->view->catalogGuid = $catalogGuid;
     $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid('fixedExpired');
     //set your year, month, daym hour, minute, second you want to cuntdown to, Change the numbers beetwen " and "
     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>";
         }
     }
 }
Exemplo n.º 26
0
 function signupAction()
 {
     $this->_helper->layout->setLayout('layout-newhukumonlineid-daftar');
     $this->view->identity = 'Daftar';
     $r = $this->getRequest();
     if ($r->isPost()) {
         $fullName = $r->getParam('fullname');
         $username = $r->getParam('username');
         $password = $r->getParam('password');
         $email = $r->getParam('email');
         $package = $r->getParam('aro_groups');
         $kopel = $this->generateKopel();
         $obj = new Kutu_Crypt_Password();
         $data = array('kopel' => $kopel, 'username' => $username, 'password' => $obj->encryptPassword($password), 'fullName' => $fullName, 'email' => $email, 'packageId' => $package, 'periodeId' => 1, 'createdDate' => date('Y-m-d H:i:s'), 'createdBy' => $username);
         $modelUser = new Kutu_Core_Orm_Table_User();
         $modelUser->insert($data);
         $this->updateKopel();
         $acl = new Kutu_Acl_Adapter_Local();
         //$acl->addUser($username,"Free");
         $acl->addUserToGroup($username, "Free");
         $formater = new Kutu_Core_Hol_User();
         $mailcontent = $formater->getMailContent('konfirmasi email gratis');
         $m = $formater->_writeConfirmFreeEmail($mailcontent, $fullName, $username, $password, base64_encode($kopel), $email, 'gratis');
         $this->view->message = $m;
     }
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     $rowset = $tblCatalog->fetchRow("shortTitle='halaman-depan-login' AND status=99");
     if (!empty($rowset)) {
         $rowsetCatalogAttribute = $rowset->findDependentRowsetCatalogAttribute();
         $fixedContent = $rowsetCatalogAttribute->findByAttributeGuid('fixedContent')->value;
     } else {
         $fixedContent = '';
     }
     $this->view->content = $fixedContent;
 }
Exemplo n.º 27
0
 static function getCatalogAuthor($guid)
 {
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     $rowset = $tblCatalog->find($guid)->current();
     if ($rowset) {
         return $rowset->createdBy;
     }
 }
Exemplo n.º 28
0
 public function findRowsetCatalog($startFrom = 0, $limit = 0)
 {
     $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
     return $tblCatalog->fetchFromFolder($this->guid, $startFrom, $limit);
 }
Exemplo n.º 29
0
 protected function _postDelete()
 {
     //find related docs and delete them
     $tblRelatedItem = new Kutu_Core_Orm_Table_RelatedItem();
     $rowsetRelatedDocs = $tblRelatedItem->fetchAll("relatedGuid='{$this->guid}' AND relateAs='RELATED_FILE'");
     if (count($rowsetRelatedDocs)) {
         foreach ($rowsetRelatedDocs as $rowRelatedDoc) {
             $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
             $rowCatalog = $tblCatalog->find($rowRelatedDoc->itemGuid)->current();
             $rowCatalog->delete();
         }
     }
     if ($this->profileGuid == 'kutu_doc') {
         //get parentGuid
         $tblRelatedItem = new Kutu_Core_Orm_Table_RelatedItem();
         $rowsetRelatedItem = $tblRelatedItem->fetchAll("itemGuid='{$this->guid}' AND relateAs='RELATED_FILE'");
         if (count($rowsetRelatedItem)) {
             foreach ($rowsetRelatedItem as $rowRelatedItem) {
                 //must delete the physical files
                 $rowsetCatAtt = $this->findDependentRowsetCatalogAttribute();
                 $systemname = $rowsetCatAtt->findByAttributeGuid('docSystemName')->value;
                 $parentGuid = $rowRelatedItem->relatedGuid;
                 $sDir1 = KUTU_ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $systemname;
                 $sDir2 = KUTU_ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $parentGuid . DIRECTORY_SEPARATOR . $systemname;
                 if (file_exists($sDir1)) {
                     //delete file
                     unlink($sDir1);
                 } else {
                     if (file_exists($sDir2)) {
                         //delete file
                         unlink($sDir2);
                     }
                 }
             }
         }
     }
     //delete from table CatalogAttribute
     $tblCatalogAttribute = new Kutu_Core_Orm_Table_CatalogAttribute();
     $tblCatalogAttribute->delete("catalogGuid='{$this->guid}'");
     //delete catalogGuid from table CatalogFolder
     $tblCatalogFolder = new Kutu_Core_Orm_Table_CatalogFolder();
     $tblCatalogFolder->delete("catalogGuid='{$this->guid}'");
     //delete guid from table AssetSetting
     $tblAssetSetting = new Kutu_Core_Orm_Table_AssetSetting();
     $tblAssetSetting->delete("guid='{$this->guid}'");
     //delete from table relatedItem
     $tblRelatedItem = new Kutu_Core_Orm_Table_RelatedItem();
     $tblRelatedItem->delete("itemGuid='{$this->guid}'");
     $tblRelatedItem->delete("relatedGuid='{$this->guid}'");
     //delete physical catalog folder from uploads/files/[catalogGuid]
     $sDir = KUTU_ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $this->guid;
     try {
         if (is_dir($sDir)) {
             rmdir($sDir);
         }
     } catch (Exception $e) {
     }
     //delete from index
     try {
         $indexingEngine = Kutu_Search::manager();
         $indexingEngine->deleteCatalogFromIndex($this->guid);
     } catch (Exception $e) {
     }
     //delete from ACL
 }
Exemplo n.º 30
0
 protected function _postDelete()
 {
     //find related docs and delete them
     $tblRelatedItem = new Kutu_Core_Orm_Table_RelatedItem();
     $rowsetRelatedDocs = $tblRelatedItem->fetchAll("relatedGuid='{$this->guid}' AND relateAs='RELATED_FILE'");
     if (count($rowsetRelatedDocs)) {
         foreach ($rowsetRelatedDocs as $rowRelatedDoc) {
             $tblCatalog = new Kutu_Core_Orm_Table_Catalog();
             $rowCatalog = $tblCatalog->find($rowRelatedDoc->itemGuid)->current();
             $rowCatalog->delete();
         }
     }
     if ($this->profileGuid == 'kutu_doc') {
         //get parentGuid
         $tblRelatedItem = new Kutu_Core_Orm_Table_RelatedItem();
         $rowsetRelatedItem = $tblRelatedItem->fetchAll("itemGuid='{$this->guid}' AND relateAs='RELATED_FILE'");
         if (count($rowsetRelatedItem)) {
             foreach ($rowsetRelatedItem as $rowRelatedItem) {
                 //must delete the physical files
                 $rowsetCatAtt = $this->findDependentRowsetCatalogAttribute();
                 $systemname = $rowsetCatAtt->findByAttributeGuid('docSystemName')->value;
                 $parentGuid = $rowRelatedItem->relatedGuid;
                 $sDir1 = KUTU_ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $systemname;
                 $sDir2 = KUTU_ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $parentGuid . DIRECTORY_SEPARATOR . $systemname;
                 if (file_exists($sDir1)) {
                     //delete file
                     unlink($sDir1);
                 } else {
                     if (file_exists($sDir2)) {
                         //delete file
                         unlink($sDir2);
                     }
                 }
             }
         }
     }
     //delete from table CatalogAttribute
     $tblCatalogAttribute = new Kutu_Core_Orm_Table_CatalogAttribute();
     $tblCatalogAttribute->delete("catalogGuid='{$this->guid}'");
     //delete catalogGuid from table CatalogFolder
     $tblCatalogFolder = new Kutu_Core_Orm_Table_CatalogFolder();
     $tblCatalogFolder->delete("catalogGuid='{$this->guid}'");
     //delete guid from table AssetSetting
     $tblAssetSetting = new Kutu_Core_Orm_Table_AssetSetting();
     $tblAssetSetting->delete("guid='{$this->guid}'");
     //delete from table relatedItem
     $tblRelatedItem = new Kutu_Core_Orm_Table_RelatedItem();
     $tblRelatedItem->delete("itemGuid='{$this->guid}'");
     $tblRelatedItem->delete("relatedGuid='{$this->guid}'");
     //delete from lucene index
     //check if guid exist in index, then delete
     //		$indexEngine = new Kutu_Search_Index_Engine();
     //		$indexEngine->deleteCatalogFromIndex($this->guid);
     $registry = Zend_Registry::getInstance();
     $conf = $registry->get('config');
     $indexingEngine = Kutu_Search::manager();
     try {
         $hits = $indexingEngine->deleteCatalogFromIndex($this->guid);
     } catch (Exception $e) {
     }
     /*
     $tblTmpIndex = new Kutu_Core_Orm_Table_TmpIndex();
     $rowTmpIndex = $tblTmpIndex->fetchNew();
     $rowTmpIndex->catalogGuid = $this->guid;
     $rowTmpIndex->status = 'delete';
     $rowTmpIndex->save();
     */
     $tblTmpIndex = new Kutu_Core_Orm_Table_TmpIndex();
     $tblTmpIndex->delete("catalogGuid='{$this->guid}'");
     //delete physical catalog folder from uploads/files/[catalogGuid]
     $sDir = KUTU_ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $this->guid;
     try {
         if (is_dir($sDir)) {
             rmdir($sDir);
         }
     } catch (Exception $e) {
     }
     $sDir = KUTU_ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'images';
     try {
         if (file_exists($sDir . "/" . $this->guid . ".gif")) {
             unlink($sDir . "/" . $this->guid . ".gif");
         }
         if (file_exists($sDir . "/tn_" . $this->guid . ".gif")) {
             unlink($sDir . "/tn_" . $this->guid . ".gif");
         }
         if (file_exists($sDir . "/" . $this->guid . ".jpg")) {
             unlink($sDir . "/" . $this->guid . ".jpg");
         }
         if (file_exists($sDir . "/tn_" . $this->guid . ".jpg")) {
             unlink($sDir . "/tn_" . $this->guid . ".jpg");
         }
         if (file_exists($sDir . "/" . $this->guid . ".jpeg")) {
             unlink($sDir . "/" . $this->guid . ".jpeg");
         }
         if (file_exists($sDir . "/tn_" . $this->guid . ".jpeg")) {
             unlink($sDir . "/tn_" . $this->guid . ".jpeg");
         }
         if (file_exists($sDir . "/" . $this->guid . ".png")) {
             unlink($sDir . "/" . $this->guid . ".png");
         }
         if (file_exists($sDir . "/tn_" . $this->guid . ".png")) {
             unlink($sDir . "/tn_" . $this->guid . ".png");
         }
     } catch (Exception $e) {
     }
     //delete from ACL
 }