function generateFormAdd($relatedGuid) { $aBaseAttributes = array(); $aBaseAttributes['profileGuid']['description'] = ''; $aBaseAttributes['profileGuid']['form'] = "<input type='hidden' name='profileGuid' id='profileGuid' value='kutu_doc'>"; $aBaseAttributes['uploadedFile']['description'] = 'Upload File'; $aBaseAttributes['uploadedFile']['form'] = "<input type='file' size='60' name='uploadedFile' id='uploadedFile'>"; $aBaseAttributes['relatedGuid']['description'] = ''; $aBaseAttributes['relatedGuid']['form'] = "<input type='hidden' name='relatedGuid' id='relatedGuid' value='{$relatedGuid}'>"; $tableProfileAttribute = new Kutu_Core_Orm_Table_ProfileAttribute(); $where = $tableProfileAttribute->getAdapter()->quoteInto('profileGuid=?', 'kutu_doc'); $rows = $tableProfileAttribute->fetchAll($where, 'viewOrder ASC'); $aRenderedAttributes = array(); $i = 0; foreach ($rows as $row) { $row3 = $row->findParentRow('Kutu_Core_Orm_Table_Attribute'); $attributeRenderer = new Kutu_Form_Attribute_Renderer($row3->guid, null, $row3->type, null, 'kutu_doc'); $aRenderedAttributes[$row3->guid]['description'] = $row3->description; $aRenderedAttributes[$row3->guid]['form'] = $attributeRenderer->render(); $i++; } $aReturn = array(); $aReturn['baseForm'] = $aBaseAttributes; $aReturn['attributeForm'] = $aRenderedAttributes; return $aReturn; }
function generateFormAdd($profileGuid, $folderGuid = null, $relatedGuid = null) { if (empty($folderGuid)) { throw new Zend_Exception('Kutu_Form_Helper_CommentsInputGenerator: Can not generate form with empty folderGuid'); } $tableProfileAttribute = new Kutu_Core_Orm_Table_ProfileAttribute(); $where = $tableProfileAttribute->getAdapter()->quoteInto('profileGuid=?', $profileGuid); $rows = $tableProfileAttribute->fetchAll($where, 'viewOrder ASC'); $aRenderedAttributes = array(); $aBaseAttributes = array(); $i = 0; foreach ($rows as $row) { $row3 = $row->findParentRow('Kutu_Core_Orm_Table_Attribute'); $attributeRenderer = new Kutu_Form_Attribute_Renderer($row3->guid, null, $row3->type, null); $aRenderedAttributes[$row3->guid]['description'] = $row3->description; $aRenderedAttributes[$row3->guid]['form'] = $attributeRenderer->render(); $i++; } $aBaseAttributes['relatedGuid']['description'] = ''; $aBaseAttributes['relatedGuid']['form'] = "<input type='hidden' name='relatedGuid' id='relatedGuid' value='{$relatedGuid}'>"; $aBaseAttributes['profileGuid']['description'] = ''; $aBaseAttributes['profileGuid']['form'] = "<input type='hidden' name='profileGuid' id='profileGuid' value='{$profileGuid}'>"; $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='0'>"; $aReturn = array(); $aReturn['baseForm'] = $aBaseAttributes; $aReturn['attributeForm'] = $aRenderedAttributes; return $aReturn; }
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; }
protected function _populateCatalogAttribute() { $this->_aRowCatalogAttribute = array(); $tableProfileAttribute = new Kutu_Core_Orm_Table_ProfileAttribute(); $profileGuid = $this->_rowCatalog->profileGuid; $where = $tableProfileAttribute->getAdapter()->quoteInto('profileGuid=?', $profileGuid); $rowsetProfileAttribute = $tableProfileAttribute->fetchAll($where, 'viewOrder ASC'); $rowsetCatalogAttribute = $this->_rowCatalog->findDependentRowsetCatalogAttribute(); foreach ($rowsetProfileAttribute as $rowProfileAttribute) { if ($rowsetCatalogAttribute->findByAttributeGuid($rowProfileAttribute->attributeGuid)) { $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid($rowProfileAttribute->attributeGuid); //array_push($this->_aRowCatalogAttribute); $this->_aRowCatalogAttribute[$rowCatalogAttribute->attributeGuid] = $rowCatalogAttribute; //echo "rowcatalogattribute:" . $rowCatalogAttribute->attributeGuid; } else { $tblCatalogAttribute = new Kutu_Core_Orm_Table_CatalogAttribute(); $rowCatalogAttribute = $tblCatalogAttribute->fetchNew(); $rowCatalogAttribute->catalogGuid = $this->_rowCatalog->guid; $rowCatalogAttribute->attributeGuid = $rowProfileAttribute->attributeGuid; $this->_aRowCatalogAttribute[$rowCatalogAttribute->attributeGuid] = $rowCatalogAttribute; } } }
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; }
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>"; } } }
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; } }
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; }
function getMailContent($title) { // table Folder $tblFolder = new Kutu_Core_Orm_Table_Folder(); $where = $tblFolder->getAdapter()->quoteInto("title=?", $title); $rowFolder = $tblFolder->fetchRow($where); // table CatalogFolder $tblCatalogFolder = new Kutu_Core_Orm_Table_CatalogFolder(); $find = $tblCatalogFolder->getAdapter()->quoteInto("folderGuid=?", $rowFolder->guid); $rowCatFolder = $tblCatalogFolder->fetchRow($find); if (isset($rowCatFolder)) { $catalogGuid = $rowCatFolder->catalogGuid; } else { $catalogGuid = ''; } // table Catalog $tblCatalog = new Kutu_Core_Orm_Table_Catalog(); $rowCatalog = $tblCatalog->find($catalogGuid)->current(); // table ProfileAttribute $tblProfileAttributes = new Kutu_Core_Orm_Table_ProfileAttribute(); $search = $tblProfileAttributes->getAdapter()->quoteInto("profileGuid=?", $rowCatalog->profileGuid); $rowsetProfileAttributes = $tblProfileAttributes->fetchAll($search, 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 = ''; } $mailcontent = $attributeValue; $i++; } return $mailcontent; }
function convertPeraturanPrtRancangan($sourceValue) { $tblProfileAttribute = new Kutu_Core_Orm_Table_ProfileAttribute(); $rowProfileAttribute = $tblProfileAttribute->fetchAll("attributeGuid='prtRancangan'")->current(); $json = new Zend_Json(); $aJson = $json->decode($rowProfileAttribute->defaultValues); foreach ($aJson as $rowTmp) { /*switch ($rowCatalogAttribute->value) { case 'Tambahan Lembaran Daerah DKI Jakarta': $rowCatalogAttribute->value = 'Tambahan Lembaran Daerah'; break; }*/ if (strtolower($sourceValue) == strtolower($rowTmp['label'])) { return $rowTmp['value']; break; } } echo "<br>NOT FOUND: " . $sourceValue; return $sourceValue; }
public function save($aData) { //do minimal pre-requisite of aData if (empty($aData['fixedTitle'])) { throw new Zend_Exception('Catalog Title can not be EMPTY!'); } if (empty($aData['profileGuid'])) { throw new Zend_Exception('Catalog Profile can not be EMPTY!'); } $tblCatalog = new Kutu_Core_Orm_Table_Catalog(); $gman = new Kutu_Core_Guid(); $catalogGuid = isset($aData['guid']) && !empty($aData['guid']) ? $aData['guid'] : $gman->generateGuid(); $folderGuid = isset($aData['folderGuid']) && !empty($aData['folderGuid']) ? $aData['folderGuid'] : ''; //if not empty, there are 2 possibilities $where = $tblCatalog->getAdapter()->quoteInto('guid=?', $catalogGuid); if ($tblCatalog->fetchRow($where)) { $rowCatalog = $tblCatalog->find($catalogGuid)->current(); //echo "guid ditemukan:" .$rowCatalog->guid; $rowCatalog->shortTitle = isset($aData['shortTitle']) ? $aData['shortTitle'] : $rowCatalog->shortTitle; //$rowCatalog->profileGuid = $request->getParam('profileGuid'); $rowCatalog->publishedDate = isset($aData['publishedDate']) ? $aData['publishedDate'] : $rowCatalog->publishedDate; $rowCatalog->expiredDate = isset($aData['expiredDate']) ? $aData['expiredDate'] : $rowCatalog->expiredDate; //$rowCatalog->createdBy = $request->getParam('createdBy'); //$rowCatalog->modifiedBy = ($aData['username'])?$aData['username']:''; //$rowCatalog->createdDate = $request->getParam('createdDate'); //$rowCatalog->modifiedDate = $aData['modifiedDate']; //$rowCatalog->deletedDate = $request->getParam('deletedDate'); $rowCatalog->status = isset($aData['status']) ? $aData['status'] : $rowCatalog->status; $rowCatalog->price = isset($aData['price']) ? $aData['price'] : $rowCatalog->price; } else { $rowCatalog = $tblCatalog->fetchNew(); //echo "guid tidak ditemukan"; $rowCatalog->guid = $catalogGuid; $rowCatalog->shortTitle = isset($aData['shortTitle']) ? $aData['shortTitle'] : ''; $rowCatalog->profileGuid = $aData['profileGuid']; $rowCatalog->publishedDate = '0000-00-00 00:00:00'; $rowCatalog->expiredDate = '0000-00-00 00:00:00'; $rowCatalog->createdBy = isset($aData['username']) ? $aData['username'] : ''; $rowCatalog->modifiedBy = $rowCatalog->createdBy; $rowCatalog->createdDate = date("Y-m-d h:i:s"); $rowCatalog->modifiedDate = $rowCatalog->createdDate; $rowCatalog->deletedDate = '0000-00-00 00:00:00'; $rowCatalog->status = isset($aData['status']) ? $aData['status'] : 0; $rowCatalog->price = isset($aData['price']) ? $aData['price'] : 0; } try { $catalogGuid = $rowCatalog->save(); } catch (Exception $e) { die($e->getMessage()); } $tableProfileAttribute = new Kutu_Core_Orm_Table_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); //echo "rowcatalogattribute:" . $rowCatalogAttribute->attributeGuid; } else { $tblCatalogAttribute = new Kutu_Core_Orm_Table_CatalogAttribute(); $rowCatalogAttribute = $tblCatalogAttribute->fetchNew(); $rowCatalogAttribute->catalogGuid = $catalogGuid; $rowCatalogAttribute->attributeGuid = $rowProfileAttribute->attributeGuid; } $rowCatalogAttribute->value = isset($aData[$rowProfileAttribute->attributeGuid]) ? $aData[$rowProfileAttribute->attributeGuid] : ''; $rowCatalogAttribute->save(); } //save to table CatalogFolder only if folderGuid is not empty if (!empty($folderGuid)) { $rowCatalog->copyToFolder($folderGuid); } //do indexing $indexingEngine = Kutu_Search::manager(); $indexingEngine->indexCatalog($catalogGuid); //after indexing, update isIndex and indexedDate in table KutuCatalog return $catalogGuid; }
function viewerAction() { $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : ''; $node = $this->_getParam('node') ? $this->_getParam('node') : ''; $tblCatalog = new Kutu_Core_Orm_Table_Catalog(); if (!empty($catalogGuid)) { $rowCatalog = $tblCatalog->find($catalogGuid)->current(); if ($rowCatalog) { $rowsetCatalogAttribute = $rowCatalog->findDependentRowsetCatalogAttribute(); $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; $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; $this->view->profileGuid = $profileGuid; $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"; $event = "My birthday"; $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; 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 "<br><strong>Dokumen perjanjian ini akan berakhir masa berlakunya dalam " . round($cuntdowndays) . " hari.</strong>"; } } } } }