public function catalogStatus($attributes = array()) { $selectedId = isset($attributes['selected']) ? $attributes['selected'] : null; $output = "<select class='{$attributes['class']}' name='{$attributes['name']}' id='{$attributes['id']}' onchange='this.form.submit()'>" . self::EOL . '<option value="">---</option>' . self::EOL; require_once CONFIG_PATH . '/status.php'; $status = MasterStatus::getPublishingStatus(); foreach ($status as $val => $label) { $selected = $selectedId == null || $selectedId != $val ? '' : ' selected="selected"'; $output .= sprintf('<option value="%s"%s>%s</option>', $val, $selected, $label) . self::EOL; } $output .= '</select>' . self::EOL; return $output; }
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; }
function generateFormEdit($catalogGuid) { $zl = Zend_Registry::get("Zend_Locale"); $today = date('Y-m-d H:i:s'); $aRenderedAttributes = array(); $aBaseAttributes = array(); $tableCatalog = new App_Model_Db_Table_Catalog(); $rowsetCatalog = $tableCatalog->find($catalogGuid); $rowCatalog = $rowsetCatalog->current(); $tableProfileAttribute = new App_Model_Db_Table_ProfileAttribute(); $where = $tableProfileAttribute->getAdapter()->quoteInto('profileGuid=?', $rowCatalog->profileGuid); $rowsetProfileAttribute = $tableProfileAttribute->fetchAll($where, array('viewOrder ASC')); $rowsetCatalogAttribute = $rowCatalog->findDependentRowsetCatalogAttribute(); $i = 0; foreach ($rowsetProfileAttribute as $row) { $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid($row->attributeGuid); $rowAttribute = $row->findParentRow('App_Model_Db_Table_Attribute'); if (isset($rowCatalogAttribute->value)) { $attributeValue = $rowCatalogAttribute->value; } else { $attributeValue = ''; } if (isset($rowCatalogAttribute->guid)) { $catalogAttributeGuid = $rowCatalogAttribute->guid; } else { $guidMan = new Pandamp_Core_Guid(); $catalogAttributeGuid = $guidMan->generateGuid(); } if (isset($rowAttribute)) { $desc = $rowAttribute->description == 'Category' ? 'Kategori Klinik' : $rowAttribute->description; if ($zl->getLanguage() == 'en') { $attributeRenderer = new Pandamp_Form_Attribute_Renderer($rowAttribute->guid, $attributeValue, $rowAttribute->type, null, $rowCatalog->profileGuid, $desc, 'clinic_partner'); } else { $attributeRenderer = new Pandamp_Form_Attribute_Renderer($rowAttribute->guid, $attributeValue, $rowAttribute->type, null, $rowCatalog->profileGuid, $desc, 'partner'); } //$aRenderedAttributes[$rowAttribute->guid]['description'] = ($rowAttribute->description == 'Category')? 'Kategori Klinik' : $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}'>"; $checked = $rowCatalog->sticky == 1 ? 'checked="checked"' : ''; $aBaseAttributes['stickyCategory']['form'] = "<input type=\"checkbox\" name=\"stickyCategory\" value=\"1\" {$checked} /> <b>Set this article sticky</b>"; $aBaseAttributes['stickyCategory']['description'] = ""; $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'>";*/ $registry = Zend_Registry::getInstance(); $config = $registry->get(Pandamp_Keys::REGISTRY_APP_OBJECT); $cdn = $config->getOption('cdn'); $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="' . $cdn['static']['images'] . '/img.gif" width="16" height="16" border="0" alt="Pick a date"></a>'; $aBaseAttributes['publishedDate']['description'] = 'Published Date'; $aBaseAttributes['publishedDate']['form'] = $s; $n = '<input type="Text" id="expiredDate" maxlength="25" size="25" name="expiredDate" value="' . $rowCatalog->expiredDate . '"><a href="javascript:NewCal(\'expiredDate\',\'yyyymmdd\',true,24)"><img src="' . $cdn['static']['images'] . '/img.gif" width="16" height="16" border="0" alt="Pick a date"></a>'; $aBaseAttributes['expiredDate']['description'] = 'Expired Date'; $aBaseAttributes['expiredDate']['form'] = $n; /* $aBaseAttributes['publishedDate']['description'] = ''; $aBaseAttributes['publishedDate']['form'] = "<input type='hidden' name='publishedDate' id='publishedDate' value='$rowCatalog->publishedDate'>"; $aBaseAttributes['expiredDate']['description'] = ''; $aBaseAttributes['expiredDate']['form'] = "<input type='hidden' name='expiredDate' id='expiredDate' value='$rowCatalog->expiredDate'>"; */ $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'; $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 Pandamp_Form_Attribute_Renderer('status', $rowCatalog->status, 101); $aBaseAttributes['status']['form'] = $attributeRenderer->render(); $aReturn = array(); $aReturn['baseForm'] = $aBaseAttributes; $aReturn['attributeForm'] = $aRenderedAttributes; return $aReturn; }
function generateFormAnswer($catalogGuid) { $today = date('Y-m-d H:i:s'); $aRenderedAttributes = array(); $aBaseAttributes = array(); $tableCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog(); $rowsetCatalog = $tableCatalog->find($catalogGuid); $rowCatalog = $rowsetCatalog->current(); $tableProfileAttribute = new App_Model_Db_Table_ProfileAttribute(); $where = $tableProfileAttribute->getAdapter()->quoteInto('profileGuid=?', $rowCatalog->profileGuid); $rowsetProfileAttribute = $tableProfileAttribute->fetchAll($where, array('viewOrder ASC')); $rowsetCatalogAttribute = $rowCatalog->findDependentRowsetCatalogAttribute(); $i = 0; foreach ($rowsetProfileAttribute as $row) { $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid($row->attributeGuid); $rowAttribute = $row->findParentRow('App_Model_Db_Table_Attribute'); if (isset($rowCatalogAttribute->value)) { $attributeValue = $rowCatalogAttribute->value; } else { $attributeValue = ''; } if (isset($rowCatalogAttribute->guid)) { $catalogAttributeGuid = $rowCatalogAttribute->guid; } else { $guidMan = new Pandamp_Core_Guid(); $catalogAttributeGuid = $guidMan->generateGuid(); } $attributeRenderer = new Pandamp_Form_Attribute_Renderer($rowAttribute->guid, $attributeValue, $rowAttribute->type, null, 'author', 'partner'); $aRenderedAttributes[$rowAttribute->guid]['description'] = $rowAttribute->description; $aRenderedAttributes[$rowAttribute->guid]['form'] = $attributeRenderer->render(); $i++; } $aBaseAttributes['guid']['description'] = ''; $aBaseAttributes['guid']['form'] = "<input type='hidden' name='guid' id='guid' value='{$rowCatalog->guid}'>"; $aBaseAttributes['profileGuid']['description'] = ''; $aBaseAttributes['profileGuid']['form'] = "<input type='hidden' name='profileGuid' id='profileGuid' value='{$rowCatalog->profileGuid}'>"; $s = '<input type="Text" id="publishedDate" maxlength="25" size="25" name="publishedDate" value="' . $rowCatalog->publishedDate . '"><a href="javascript:NewCal(\'publishedDate\',\'yyyymmdd\',true,24)"><img src="' . ROOT_URL . '/resources/images/img.gif" width="16" height="16" border="0" alt="Pick a date"></a>'; $aBaseAttributes['publishedDate']['description'] = 'Published Date'; $aBaseAttributes['publishedDate']['form'] = $s; $n = '<input type="Text" id="expiredDate" maxlength="25" size="25" name="expiredDate" value="' . $rowCatalog->expiredDate . '"><a href="javascript:NewCal(\'expiredDate\',\'yyyymmdd\',true,24)"><img src="' . ROOT_URL . '/resources/images/img.gif" width="16" height="16" border="0" alt="Pick a date"></a>'; $aBaseAttributes['expiredDate']['description'] = 'Expired Date'; $aBaseAttributes['expiredDate']['form'] = $n; $aBaseAttributes['createdDate']['description'] = 'Created on'; $aBaseAttributes['createdDate']['form'] = $rowCatalog->createdDate . "<input type='hidden' name='createdDate' id='createdDate' value='{$rowCatalog->createdDate}'>"; $aBaseAttributes['modifiedDate']['description'] = 'Last Modified on'; $aBaseAttributes['modifiedDate']['form'] = $rowCatalog->modifiedDate . "<input type='hidden' name='modifiedDate' id='modifiedDate' value='{$today}'>"; $aBaseAttributes['deletedDate']['description'] = 'Deleted on'; $aBaseAttributes['deletedDate']['form'] = $rowCatalog->deletedDate . "<input type='hidden' name='deletedDate' id='deletedDate' value='{$rowCatalog->deletedDate}'>"; $aBaseAttributes['status']['description'] = 'Status'; require_once CONFIG_PATH . '/master-status.php'; $statusConfig = MasterStatus::getPublishingStatus(); $attributeRenderer = new Pandamp_Form_Attribute_Renderer('status', $rowCatalog->status, 101); $aBaseAttributes['status']['form'] = $attributeRenderer->render(); $aReturn = array(); $aReturn['baseForm'] = $aBaseAttributes; $aReturn['attributeForm'] = $aRenderedAttributes; return $aReturn; }
public function 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; 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; $view->defaultValues = $aStatus; $view->setScriptPath(dirname(__FILE__)); return $view->render('select2.phtml'); } }
public function inputPublishingStatus($elementName = "status", $selectedValue) { require_once CONFIG_PATH . '/master-status.php'; $aStatus = MasterStatus::getPublishingStatus(); return $this->formSelect($elementName, $selectedValue, null, $aStatus); }
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->label = $this->label; $view->name = $this->name; $view->value = $this->value; if (isset($this->attribs)) { $view->attribs = $this->attribs; } else { $view->attribs = array('rows' => 5, 'cols' => 50, 'class' => 'form-control'); } $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; $view = new Zend_View(); $view->label = $this->label; $view->name = $this->name; $view->value = $this->value; $view->setScriptPath(dirname(__FILE__)); return $view->render('TextArea2.phtml'); break; // $view = new Zend_View(); // $view->name = $this->name; // $view->value = $this->value; // // $config = Pandamp_Config::getConfig(); // $view->cdn = $config->cdn->js; // if(isset($this->attribs)) // $view->attribs = $this->attribs; // else // $view->attribs = array('class' => 'tinymce', 'style' => 'width: 440px; height: 1000px;'); // $view->setScriptPath(dirname(__FILE__)); // return $view->render('TextAreaContent.phtml'); // // break; // $view = new Zend_View(); // $view->name = $this->name; // $view->value = $this->value; // // $config = Pandamp_Config::getConfig(); // $view->cdn = $config->cdn->js; // if(isset($this->attribs)) // $view->attribs = $this->attribs; // else // $view->attribs = array('class' => 'tinymce', 'style' => 'width: 440px; height: 1000px;'); // $view->setScriptPath(dirname(__FILE__)); // return $view->render('TextAreaContent.phtml'); // // break; case 79: // 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; // $view = new Zend_View(); // $view->name = $this->name; // $view->value = $this->value; // if(isset($this->attribs)) // $view->attribs = $this->attribs; // else // $view->attribs = array('class' => 'tinymce', 'style' => 'width: 440px; height: 200px;'); // $view->setScriptPath(dirname(__FILE__)); // return $view->render('TextAreaDescription.phtml'); break; case 80: $view = new Zend_View(); $view->name = $this->name; $view->value = $this->value; $view->setScriptPath(dirname(__FILE__)); return $view->render('TextArea3.phtml'); 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->label = $this->label; $view->name = $this->name; $view->value = $this->value; $view->setScriptPath(dirname(__FILE__)); $view->addHelperPath(APPLICATION_PATH . '/../library/Pandamp/Controller/Action/Helper', 'Pandamp_Controller_Action_Helper'); 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__)); $view->addHelperPath(APPLICATION_PATH . '/../library/Pandamp/Controller/Action/Helper', 'Pandamp_Controller_Action_Helper'); 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; // updated Nov 1, 2015 // updated Nov 1, 2015 case 6: $view = new Zend_View(); $view->label = $this->label; $view->name = $this->name; $view->value = $this->value; if (isset($this->attribs)) { $view->attribs = $this->attribs; } else { $view->attribs = array('class' => 'form-control'); } $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 App_Model_Db_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->label = $this->label; $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 App_Model_Db_Table_Catalog(); $rowset = $tblCatalog->fetchAll("profileGuid='{$this->other}'", 'shortTitle asc'); $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->label = $this->label; $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 App_Model_Db_Table_Catalog(); $rowset = $tblCatalog->fetchAll("profileGuid='{$this->profileGuid}'", 'shortTitle asc'); $i = 0; $a = array(); $data = array(); foreach ($rowset as $row) { $rowsetCatalogAttribute = $row->findDependentRowsetCatalogAttribute(); $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid('fixedTitle'); $a[$i]['label'] = is_object($rowCatalogAttribute) ? trim($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->label = $this->label; $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 App_Model_Db_Table_Catalog(); $rowset = $tblCatalog->fetchAll("profileGuid='kategoriklinik'", 'shortTitle asc'); $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->label = $this->label; $view->name = $this->name; $view->value = $this->value; $view->defaultValues = $data; $view->setScriptPath(dirname(__FILE__)); return $view->render('select.phtml'); break; case 14: // tags $view = new Zend_View(); $view->label = $this->label; $view->name = $this->name; $view->value = $this->value; if (isset($this->attribs)) { $view->attribs = $this->attribs; } else { $view->attribs = array('rows' => 3, 'class' => 'form-control'); } $view->setScriptPath(dirname(__FILE__)); return $view->render('tags.phtml'); break; case 15: $tblCatalog = new App_Model_Db_Table_Catalog(); $rowset = $tblCatalog->fetchAll("profileGuid='narsum'", 'shortTitle asc'); $i = 0; $a = array(); $data = array(); foreach ($rowset as $row) { $rowsetCatalogAttribute = $row->findDependentRowsetCatalogAttribute(); $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid('fixedTitle'); $a[$i]['label'] = is_object($rowCatalogAttribute) ? trim($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->label = $this->label; $view->name = $this->name . '[]'; $view->id = $this->name; $r = explode(",", $this->value); $view->value = "'" . implode("','", $r) . "'"; $view->profile = 'narsum'; $view->defaultValues = $data; $view->setScriptPath(dirname(__FILE__)); return $view->render('select3.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(); $identity = $auth->getIdentity(); $username = $identity->username; // get group information $acl = Pandamp_Acl::manager(); $aReturn = $acl->getUserGroupIds($username); if (isset($aReturn[1])) { if ($aReturn[1] == "klinik_editor") { unset($aStatus[99]); } } $view->defaultValues = $aStatus; $view->setScriptPath(dirname(__FILE__)); return $view->render('select2.phtml'); } }
function generateFormEdit($catalogGuid) { $today = date('Y-m-d H:i:s'); $aRenderedAttributes = array(); $aBaseAttributes = array(); $tableCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog(); $rowsetCatalog = $tableCatalog->find($catalogGuid); $rowCatalog = $rowsetCatalog->current(); $tableProfileAttribute = new Pandamp_Modules_Dms_Profile_Model_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('Pandamp_Modules_Dms_Catalog_Model_Attribute'); if (isset($rowCatalogAttribute->value)) { $attributeValue = $rowCatalogAttribute->value; } else { $attributeValue = ''; } if (isset($rowCatalogAttribute->guid)) { $catalogAttributeGuid = $rowCatalogAttribute->guid; } else { $guidMan = new Pandamp_Core_Guid(); $catalogAttributeGuid = $guidMan->generateGuid(); } if (isset($rowAttribute)) { $attributeRenderer = new Pandamp_Form_Attribute_Renderer($rowAttribute->guid, $attributeValue, $rowAttribute->type, null, $rowCatalog->profileGuid, 'partner'); $aRenderedAttributes[$rowAttribute->guid]['description'] = $rowAttribute->description == 'Category' ? 'Kategori Klinik' : $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'] = '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'>";*/ $s = '<input type="Text" id="publishedDate" maxlength="25" size="25" name="publishedDate" value="' . $rowCatalog->publishedDate . '"><a href="javascript:NewCal(\'publishedDate\',\'yyyymmdd\',true,24)"><img src="' . ROOT_URL . '/js/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="' . ROOT_URL . '/js/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['publishedDate']['description'] = ''; $aBaseAttributes['publishedDate']['form'] = "<input type='hidden' name='publishedDate' id='publishedDate' value='$rowCatalog->publishedDate'>"; $aBaseAttributes['expiredDate']['description'] = ''; $aBaseAttributes['expiredDate']['form'] = "<input type='hidden' name='expiredDate' id='expiredDate' value='$rowCatalog->expiredDate'>"; */ $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'; $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 Pandamp_Form_Attribute_Renderer('status', $rowCatalog->status, 101); $aBaseAttributes['status']['form'] = $attributeRenderer->render(); $aReturn = array(); $aReturn['baseForm'] = $aBaseAttributes; $aReturn['attributeForm'] = $aRenderedAttributes; return $aReturn; }