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; }
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 __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; }
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; }
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 ' <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; } }
public function __construct($node) { $time_start = microtime(true); $this->view = new Zend_View(); $this->view->setScriptPath(dirname(__FILE__) . '/views'); $folderGuid = $node ? $node : 'root'; $this->view->addHelperPath(KUTU_ROOT_DIR . '/mix_lib/Kutu/View/Helper', 'Kutu_View_Helper'); Zend_Loader::loadClass('Kutu_Core_Orm_Table_Catalog'); $tblCatalog = new Kutu_Core_Orm_Table_Catalog(); if ($folderGuid == 'root') { $time = time(); $date = date("Y-m-d H:i:s", $time); $rowset = $tblCatalog->fetchAll("createdDate < '{$date}' and profileGuid = 'kutu_peraturan'", 'createdDate DESC', 12, 0); $a = array(); //$a['totalCount'] = count($rowset); $a['totalCount'] = 0; $a['folderGuid'] = $folderGuid; $solrNumFound = 0; } else { $a = array(); //$a['totalCount'] = $tblCatalog->countCatalogsInFolder($folderGuid); $a['folderGuid'] = $folderGuid; $db = Zend_Db_Table::getDefaultAdapter()->query("SELECT guid from KutuCatalog, KutuCatalogFolder where guid=catalogGuid AND folderGuid='{$folderGuid}'"); $rowset = $db->fetchAll(Zend_Db::FETCH_OBJ); $solrAdapter = Kutu_Search::factory('solr', array('host' => 'localhost', 'port' => '8983', 'homedir' => '/solr/core0')); $numi = count($rowset); $sSolr = "id:("; for ($i = 0; $i < $numi; $i++) { $row = $rowset[$i]; $sSolr .= $row->guid . ' '; } $sSolr .= ')'; if (!$numi) { $sSolr = "id:(hfgjhfdfka)"; } $start = 0; $a['totalCount'] = $numi; $limit = 20; $a['limit'] = $limit; $solrResult = $solrAdapter->findAndSort($sSolr, $start, $limit, array('regulationOrder asc')); $solrNumFound = $solrResult->response->numFound; //die('hi'.$solrNumFound); } $ii = 0; //for($i=$start;$i<($limit+$start);$i++) if ($solrNumFound == 0) { $a['catalogs'][0]['guid'] = 'XXX'; $a['catalogs'][0]['title'] = "No Data"; $a['catalogs'][0]['subTitle'] = ""; $a['catalogs'][0]['createdDate'] = ''; $a['catalogs'][$ii]['modifiedDate'] = ''; } else { if ($solrNumFound > $limit) { $numRowset = $limit; } else { $numRowset = $solrNumFound; } for ($ii = 0; $ii < $numRowset; $ii++) { $row = $solrResult->response->docs[$ii]; $a['catalogs'][$ii]['guid'] = $row->id; $a['catalogs'][$ii]['title'] = $row->title; $a['catalogs'][$ii]['subTitle'] = $row->subTitle; $a['catalogs'][$ii]['createdDate'] = $row->createdDate; $a['catalogs'][$ii]['modifiedDate'] = $row->modifiedDate; } } $this->view->aData = $a; //$sNav = $this->renderNavigation($a['totalCount'], $limit); $time_end = microtime(true); $time = $time_end - $time_start; echo '<br>WAKTU EKSEKUSI: ' . $time; }