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; }
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>'; } } }
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; }
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; }
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; } }
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 ' <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'); } }
function mitrakamiAction() { $this->_helper->layout->setLayout('layout-misc'); $this->_helper->layout->setLayoutPath(array('layoutPath' => ROOT_DIR . '/app/modules/misc/layouts')); $this->view->identity = "Mitra Kami"; $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog(); $rowset = $tblCatalog->fetchAll("profileGuid='kutu_mitra'", 'createdDate DESC'); $content = 0; $data = array(); foreach ($rowset as $row) { $rowsetCatalogAttribute = $row->findDependentRowsetCatalogAttribute(); $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid('fixedContent'); $data[$content][0] = $rowCatalogAttribute->value; $data[$content][1] = $row->guid; $content++; } $num_rows = count($rowset); $this->view->numberOfRows = $num_rows; $this->view->data = $data; }
public function fetchCatalogsInFolderAction() { $prof = $this->_getParam('prof') ? $this->_getParam('prof') : ''; $profAuth = $this->_getParam('profAuth') ? $this->_getParam('profAuth') : ''; $startdt = $this->_getParam('startdt') ? $this->_getParam('startdt') : ''; $enddt = $this->_getParam('enddt') ? $this->_getParam('enddt') : ''; $report = $this->_getParam('report') ? $this->_getParam('report') : ''; $start = $this->_getParam('start') ? $this->_getParam('start') : 0; $end = $this->_getParam('limit') ? $this->_getParam('limit') : 10; $folderGuid = $this->_getParam('folderGuid') ? $this->_getParam('folderGuid') : ''; $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog(); $a = array(); if ($startdt && $enddt) { if ($report == 'msk') { $rowset = $modelCatalog->fetchAll("createdDate BETWEEN '{$startdt}' AND '{$enddt}'", '', $end, $start); $rowCount = $modelCatalog->countCatalogsInBetween($startdt, $enddt); } elseif ($report == 'tbt') { $rowset = $modelCatalog->fetchAll("publishedDate BETWEEN '{$startdt}' AND '{$enddt}'", '', $end, $start); $rowCount = $modelCatalog->countCatalogsPubBetween($startdt, $enddt); } elseif ($prof !== "") { $rowset = $modelCatalog->fetchAll("createdDate BETWEEN '{$startdt}' AND '{$enddt}' AND profileGuid='{$prof}'", '', $end, $start); $rowCount = $modelCatalog->countCatalogsInBetweenProfile($startdt, $enddt, $prof); } $a['totalCount'] = $rowCount; } elseif ($prof) { $rowset = $modelCatalog->fetchAll("profileGuid = '{$prof}'", '', $end, $start); $rowCount = $modelCatalog->countCatalogsProfile($prof); $a['totalCount'] = $rowCount; } elseif ($profAuth) { $rowset = $modelCatalog->fetchAll("createdBy = '{$profAuth}'", '', $end, $start); $rowCount = $modelCatalog->countCatalogsForAuthor($profAuth); $a['totalCount'] = $rowCount; } else { $rowset = $modelCatalog->fetchCatalogInFolder($folderGuid, $start, $end); $a['totalCount'] = $modelCatalog->getCountCatalogsInFolder($folderGuid); } $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['catalogs'][$ii]['guid'] = $row->guid; $a['catalogs'][$ii]['title'] = $modelCatalogAttribute->getCatalogAttributeValue($row->guid, 'fixedTitle'); $a['catalogs'][$ii]['subtitle'] = $modelCatalogAttribute->getCatalogAttributeValue($row->guid, 'fixedSubTitle'); $modelProfile = new Pandamp_Modules_Dms_Profile_Model_Profile(); $p = $modelProfile->getProfileByPG($row->profileGuid); $a['catalogs'][$ii]['profile_column'] = $p->title; $a['catalogs'][$ii]['createdby'] = $row->createdBy; $a['catalogs'][$ii]['modifiedby'] = $row->modifiedBy; $a['catalogs'][$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 = "disabled"; } } } } } $a['catalogs'][$ii]['status'] = $status; $ii++; } } if ($a['totalCount'] == 0) { $a['catalogs'][0]['guid'] = 'XXX'; $a['catalogs'][0]['title'] = "No Data"; $a['catalogs'][0]['subtitle'] = "-"; $a['catalogs'][0]['createdDate'] = ''; } echo Zend_Json::encode($a); }