Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 public function selectRegulation($attributes = array())
 {
     $selectedId = isset($attributes['selected']) ? $attributes['selected'] : null;
     $disableId = isset($attributes['disable']) ? $attributes['disable'] : null;
     $output = "<select onchange='javascript:document.peraturan.submit();' class='{$attributes['class']}' name='{$attributes['name']}' id='{$attributes['id']}'>" . self::EOL . '<option value="">All</option>' . self::EOL;
     $tblProAtt = new App_Model_Db_Table_ProfileAttribute();
     $rowset = $tblProAtt->fetchAll("profileGuid='{$attributes['profile']}' AND attributeGuid='{$attributes['prtJenis']}'");
     $defaultValues = array();
     $row = $rowset->current();
     $defaultValues = Zend_Json::decode($row->defaultValues);
     foreach ($defaultValues as $v) {
         $selected = $selectedId == null || $selectedId != $v['value'] ? '' : ' selected="selected"';
         $disable = $disableId == null || $disableId != $v['value'] ? '' : ' disabled';
         $output .= sprintf('<option value="%s"%s%s>%s</option>', $v['value'], $selected, $disable, $v['label']) . self::EOL;
     }
     $output .= '</select>' . self::EOL;
     return $output;
 }
Exemplo n.º 3
0
 public function save($aData)
 {
     if (empty($aData['profileGuid'])) {
         throw new Zend_Exception('Catalog Profile can not be EMPTY!');
     }
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $gman = new Pandamp_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();
         $rowCatalog->shortTitle = isset($aData['shortTitle']) ? $aData['shortTitle'] : $rowCatalog->shortTitle;
         $rowCatalog->publishedDate = isset($aData['publishedDate']) ? $aData['publishedDate'] : $rowCatalog->publishedDate;
         $rowCatalog->expiredDate = isset($aData['expiredDate']) ? $aData['expiredDate'] : $rowCatalog->expiredDate;
         $rowCatalog->status = isset($aData['status']) ? $aData['status'] : $rowCatalog->status;
         $rowCatalog->price = isset($aData['price']) ? $aData['price'] : $rowCatalog->price;
     } else {
         $rowCatalog = $tblCatalog->fetchNew();
         $rowCatalog->guid = $catalogGuid;
         $rowCatalog->shortTitle = isset($aData['shortTitle']) ? $aData['shortTitle'] : '';
         $rowCatalog->profileGuid = $aData['profileGuid'];
         $rowCatalog->publishedDate = isset($aData['publishedDate']) ? $aData['publishedDate'] : '0000-00-00 00:00:00';
         $rowCatalog->expiredDate = isset($aData['expiredDate']) ? $aData['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 App_Model_Db_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);
         } else {
             $tblCatalogAttribute = new App_Model_Db_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)) {
         $tblCatalogFolder = new App_Model_Db_Table_CatalogFolder();
         $rowsetCatalogFolder = $tblCatalogFolder->find($catalogGuid, $folderGuid);
         if (count($rowsetCatalogFolder) <= 0) {
             $rowCatalogFolder = $tblCatalogFolder->createRow(array('catalogGuid' => '', 'folderGuid' => ''));
             $rowCatalogFolder->catalogGuid = $catalogGuid;
             $rowCatalogFolder->folderGuid = $folderGuid;
             $rowCatalogFolder->save();
         }
     }
     //do indexing
     $indexingEngine = Pandamp_Search::manager();
     $indexingEngine->indexCatalog($catalogGuid);
     return $catalogGuid;
 }
Exemplo n.º 4
0
 function viewerAction()
 {
     $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $node = $this->_getParam('node') ? $this->_getParam('node') : '';
     $npts = $this->_getParam('npts') ? $this->_getParam('npts') : '';
     $nprt = $this->_getParam('nprt') ? $this->_getParam('nprt') : '';
     $tblCatalog = new App_Model_Db_Table_Catalog();
     if (!empty($catalogGuid)) {
         $rowCatalog = $tblCatalog->find($catalogGuid)->current();
         if ($rowCatalog) {
             $rowsetCatalogAttribute = $rowCatalog->findDependentRowsetCatalogAttribute();
             $tableProfileAttribute = new App_Model_Db_Table_ProfileAttribute();
             $profileGuid = $rowCatalog->profileGuid;
             $where = $tableProfileAttribute->getAdapter()->quoteInto('profileGuid=?', $profileGuid);
             $rowsetProfileAttribute = $tableProfileAttribute->fetchAll($where, 'viewOrder ASC');
             $aAttribute = array();
             $i = 0;
             $tblAttribute = new App_Model_Db_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->npts = $npts;
             $this->view->nprt = $nprt;
             $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>";
                 }
             }
         }
     }
 }
Exemplo n.º 5
0
 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} />&nbsp;<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;
 }
Exemplo n.º 6
0
 public function save($aData)
 {
     if (empty($aData['profileGuid'])) {
         throw new Zend_Exception('Catalog Profile can not be EMPTY!');
     }
     $profileGuid = $aData['profileGuid'];
     if ($profileGuid == 'klinik') {
         $title = $aData['fixedCommentTitle'];
     } else {
         $title = $aData['fixedTitle'];
     }
     $setsticky = false;
     $sticky = isset($aData['stickyCategory']) && !empty($aData['stickyCategory']) ? $aData['stickyCategory'] : 0;
     if ($sticky == 1) {
         $setsticky = true;
     }
     $slug = Pandamp_Utility_String::removeSign($title, '-', true);
     if (isset($aData['keywordintegrasi']) && !empty($aData['keywordintegrasi'])) {
         $ckey = explode(',', $aData['fixedKeywords']);
         $mckey = array_merge($aData['keywordintegrasi'], $ckey);
         $umckey = array_intersect_key($mckey, array_unique(array_map('strtolower', $mckey)));
         $umckey = rtrim(implode(',', $umckey), ',');
         $aData['fixedKeywords'] = $umckey;
         unset($aData['keywordintegrasi']);
     }
     if (isset($aData['fixedNarsum']) && !empty($aData['fixedNarsum'])) {
         $fn = implode(',', $aData['fixedNarsum']);
         $aData['fixedNarsum'] = $fn;
     }
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $gman = new Pandamp_Core_Guid();
     $catalogGuid = isset($aData['guid']) && !empty($aData['guid']) ? $aData['guid'] : $gman->generateGuid();
     $folderGuid = isset($aData['folderGuid']) && !empty($aData['folderGuid']) ? $aData['folderGuid'] : '';
     if (isset($aData['shortTitle']) && !empty($aData['shortTitle'])) {
         $slug = $aData['shortTitle'];
     }
     //if not empty, there are 2 possibilities
     $where = $tblCatalog->getAdapter()->quoteInto('guid=?', $catalogGuid);
     if ($tblCatalog->fetchRow($where)) {
         $rowCatalog = $tblCatalog->find($catalogGuid)->current();
         $rowCatalog->shortTitle = $slug;
         $rowCatalog->publishedDate = isset($aData['publishedDate']) ? $aData['publishedDate'] : $rowCatalog->publishedDate;
         $rowCatalog->expiredDate = isset($aData['expiredDate']) ? $aData['expiredDate'] : $rowCatalog->expiredDate;
         $rowCatalog->status = isset($aData['status']) ? $aData['status'] : $rowCatalog->status;
         $rowCatalog->price = isset($aData['price']) ? $aData['price'] : $rowCatalog->price;
         $rowCatalog->sticky = (int) $setsticky;
     } else {
         $rowCatalog = $tblCatalog->fetchNew();
         $rowCatalog->guid = $catalogGuid;
         $rowCatalog->shortTitle = $slug;
         $rowCatalog->profileGuid = $profileGuid;
         $rowCatalog->publishedDate = isset($aData['publishedDate']) ? $aData['publishedDate'] : '0000-00-00 00:00:00';
         $rowCatalog->expiredDate = isset($aData['expiredDate']) ? $aData['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;
         $rowCatalog->sticky = (int) $setsticky;
     }
     try {
         $catalogGuid = $rowCatalog->save();
     } catch (Exception $e) {
         die($e->getMessage());
     }
     $tableProfileAttribute = new App_Model_Db_Table_ProfileAttribute();
     //$profileGuid = $rowCatalog->profileGuid;
     $where = $tableProfileAttribute->getAdapter()->quoteInto('profileGuid=?', $profileGuid);
     $rowsetProfileAttribute = $tableProfileAttribute->fetchAll($where, 'viewOrder ASC');
     $rowsetCatalogAttribute = $rowCatalog->findDependentRowsetCatalogAttribute();
     foreach ($rowsetProfileAttribute as $rowProfileAttribute) {
         /*$aid = $rowProfileAttribute->attributeGuid;
          	$rowCatalogAttribute = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue( $catalogGuid, $rowProfileAttribute->attributeGuid);
          	if ($rowCatalogAttribute)
          	{
          		$ca = new App_Model_Db_Table_CatalogAttribute();
          		$ca->update(
          			[
          				'value' => $aData[$aid]
          			], 
          			[
          				'catalogGuid = ?' => $catalogGuid,
          				'attributeGuid = ?'	=> $rowProfileAttribute->attributeGuid
          			]
          		);
          	}
          	else
          	{
          		$ca = new App_Model_Db_Table_CatalogAttribute();
          		$ca->insert([
          			'catalogGuid' => $catalogGuid,
          			'attributeGuid' => $rowProfileAttribute->attributeGuid,
          			'value'	=> $aData[$aid]
          		]);
          	}*/
         if ($rowsetCatalogAttribute->findByAttributeGuid($rowProfileAttribute->attributeGuid)) {
             $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid($rowProfileAttribute->attributeGuid);
         } else {
             $tblCatalogAttribute = new App_Model_Db_Table_CatalogAttribute();
             $rowCatalogAttribute = $tblCatalogAttribute->fetchNew();
             $rowCatalogAttribute->catalogGuid = $catalogGuid;
             $rowCatalogAttribute->attributeGuid = $rowProfileAttribute->attributeGuid;
         }
         $rowCatalogAttribute->value = isset($aData[$rowProfileAttribute->attributeGuid]) ? $aData[$rowProfileAttribute->attributeGuid] : '';
         $rowCatalogAttribute->save();
     }
     //category
     if (isset($aData['selectedNode']) && !empty($aData['selectedNode'])) {
         $categories = array_map('trim', explode(',', $aData['selectedNode']));
         $tblCatalogFolder = new App_Model_Db_Table_CatalogFolder();
         $cf = $tblCatalogFolder->fetchAll("catalogGuid='{$catalogGuid}'");
         if (count($cf)) {
             foreach ($cf as $cfol) {
                 $cts[] = $cfol->folderGuid;
                 if (!in_array($cfol->folderGuid, $categories)) {
                     $tblCatalogFolder->delete("catalogGuid='{$cfol->catalogGuid}' AND folderGuid='{$cfol->folderGuid}'");
                 }
             }
         }
         foreach ($categories as $category) {
             $rowCatalog->copyToFolder($category);
         }
     }
     //save to table CatalogFolder only if folderGuid is not empty
     /*if (!empty($folderGuid))
       {
           $rowCatalog->copyToFolder($folderGuid);
       }*/
     // copy to other categories
     /*if (!empty($aData['categories'])) {
       	$tblCatalogFolder = new App_Model_Db_Table_CatalogFolder();
       	$cf = $tblCatalogFolder->fetchAll("catalogGuid='$catalogGuid'");
       	if (count($cf)) {
       		$sa="";
       		foreach ($cf as $cfol) {
       			$cts[] = $cfol->folderGuid;
       			if (!in_array($cfol->folderGuid, $aData['categories']))
       			{
       				$tblCatalogFolder->delete("catalogGuid='$cfol->catalogGuid' AND folderGuid='$cfol->folderGuid'");
       				$sa="del";
       			}
       		}
       		
       		if ($sa=="del") {
       			$auth = Zend_Auth::getInstance();
       			$group = $auth->getIdentity()->name;
       			$group = strtolower(str_replace(" ", "", $group));
       			 
       			$zl = Zend_Registry::get("Zend_Locale");
       			$lang = $zl->getLanguage();
       		
       			$cache = Pandamp_Cache::getInstance();
       			$sel = join("_", $cts);
       			$cache->remove('categoryCheckbox_'.$sel.'_'.$lang.'_'.$group);
       		}
       	}
       	
       	foreach ($aData['categories'] as $category)
       	{
       		$rowCatalog->copyToFolder($category);
       	}
       }*/
     /**
      * @todo Relasi Katalog
      */
     if (isset($aData['relIds'])) {
         $relatedItemDb = new App_Model_Db_Table_RelatedItem();
         $relatedItemDb->delete(array('relatedGuid=?' => $catalogGuid, 'relateAs IN (?)' => array('RELATED_OTHER', 'RELATED_Clinic', 'RELATED_ISSUE', 'RELATED_HISTORY', 'RELATED_BASE', 'RELATED_TRANSLATION_ID', 'RELATED_TRANSLATION_EN')));
         for ($i = 0; $i < count($aData['relIds']); $i++) {
             if ($aData['relIds'][$i] and $aData['relGuids'][$i]) {
                 $relatedItemDb->insert(array('itemGuid' => $aData['relIds'][$i], 'relatedGuid' => $catalogGuid, 'relateAs' => $aData['relGuids'][$i]));
             }
         }
     }
     /**
      * @todo Upload File
      */
     if (isset($aData['filename']) && !empty($aData['filename'])) {
         $catalogDb = new App_Model_Db_Table_Catalog();
         for ($i = 0; $i < count($aData['filename']); $i++) {
             $fileName = $aData['filename'][$i];
             $fileUrls = json_decode(stripslashes($aData['fileUrl'][$i]));
             foreach ($fileUrls as $index => $value) {
                 if ($index == "original") {
                     $title = '';
                     $slug = '';
                     if (isset($aData['attr_caption_' . $value->id]) && !empty($aData['attr_caption_' . $value->id])) {
                         $title = $aData['attr_caption_' . $value->id][0];
                         $slug = Pandamp_Utility_String::removeSign($title, '-', true);
                     }
                     if ($value->type == 'file') {
                         $relatedType = 'RELATED_FILE';
                     } elseif ($value->type == 'image') {
                         $relatedType = 'RELATED_IMAGE';
                     }
                     $rowDocCatalog = $catalogDb->fetchNew();
                     $rowDocCatalog->guid = $value->id;
                     $rowDocCatalog->shortTitle = $slug;
                     $rowDocCatalog->profileGuid = $aData['profile'];
                     $docCatalogGuid = $rowDocCatalog->save();
                     $rowsetDocCatalogAttribute = $rowDocCatalog->findDependentRowsetCatalogAttribute();
                     $this->_updateCatalogAttribute($rowsetDocCatalogAttribute, $docCatalogGuid, 'docSystemName', $value->title);
                     $this->_updateCatalogAttribute($rowsetDocCatalogAttribute, $docCatalogGuid, 'docOriginalName', $fileName);
                     $this->_updateCatalogAttribute($rowsetDocCatalogAttribute, $docCatalogGuid, 'docSize', $value->size);
                     $this->_updateCatalogAttribute($rowsetDocCatalogAttribute, $docCatalogGuid, 'docMimeType', $value->filetype);
                     $this->_updateCatalogAttribute($rowsetDocCatalogAttribute, $docCatalogGuid, 'fixedTitle', $title);
                     $this->_updateCatalogAttribute($rowsetDocCatalogAttribute, $docCatalogGuid, 'docViewOrder', 0);
                     $this->relateTo($docCatalogGuid, $catalogGuid, $relatedType);
                 }
             }
         }
     }
     /**
      * Copy|Use image
      * Untuk satu article satu image
      */
     if (isset($aData['fixedFileImage'])) {
         $fixedFileImage = $aData['fixedFileImage'];
         $fixedFileImage = basename($fixedFileImage);
         if (strpos($fixedFileImage, 'tn_') !== false) {
             $basename = str_replace('tn_', '', $fixedFileImage);
         } else {
             $basename = str_replace('thumbnail_', '', $fixedFileImage);
         }
         $guidBasename = pathinfo($basename, PATHINFO_FILENAME);
         $eiTitle = $aData['fileImage'] ? $aData['fileImage'] : '';
         $eslug = Pandamp_Utility_String::removeSign($eiTitle, '-', true);
         $rel = array();
         $relatedItemDb = new App_Model_Db_Table_RelatedItem();
         $relItems = $relatedItemDb->fetchAll("relatedGuid='" . $catalogGuid . "' AND relateAs='RELATED_IMAGE'");
         if ($relItems) {
             foreach ($relItems as $relItem) {
                 $catalogDb = new App_Model_Db_Table_Catalog();
                 $catalog = $catalogDb->fetchRow("guid='" . $relItem['itemGuid'] . "' AND status!=-1");
                 if ($catalog) {
                     $rel[] = $relItem['itemGuid'];
                 }
             }
         }
         if (isset($rel[0]) && count($rel) == 1 && $rel[0] == $guidBasename) {
             $rowEImageCatalog = $tblCatalog->find($guidBasename)->current();
             $rowEImageCatalog->shortTitle = $eslug;
         } else {
             if (isset($rel[0])) {
                 $this->delete($rel[0]);
             }
             // jika ingin mengganti gambar dari yang sudah ada
             $of = $tblCatalog->find($guidBasename)->current();
             if ($of) {
                 $cd = $of->createdDate;
                 $cb = $of->createdBy;
             } else {
                 $cb = $aData['username'];
                 $cd = date("Y-m-d H:i:s");
             }
             $rowEImageCatalog = $tblCatalog->fetchNew();
             $rowEImageCatalog->shortTitle = $eslug;
             $rowEImageCatalog->profileGuid = $aData['profile'];
             $rowEImageCatalog->createdDate = $cd;
             $rowEImageCatalog->createdBy = $cb;
         }
         $catalogEGuid = $rowEImageCatalog->save();
         $rowsetEImageCatalogAttribute = $rowEImageCatalog->findDependentRowsetCatalogAttribute();
         /**
          * @TODO docSystemName
          * digunakan sebagai inti|pemisah dari image
          * jika dia hasil copy dari catalog lain atau file original nya sendiri 
          * maka yg diambil adalah attribute ini
          */
         $this->_updateCatalogAttribute($rowsetEImageCatalogAttribute, $catalogEGuid, 'docSystemName', $basename);
         $this->_updateCatalogAttribute($rowsetEImageCatalogAttribute, $catalogEGuid, 'docOriginalName', App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($guidBasename, 'docOriginalName'));
         $this->_updateCatalogAttribute($rowsetEImageCatalogAttribute, $catalogEGuid, 'docSize', App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($guidBasename, 'docSize'));
         $this->_updateCatalogAttribute($rowsetEImageCatalogAttribute, $catalogEGuid, 'docMimeType', App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($guidBasename, 'docMimeType'));
         $this->_updateCatalogAttribute($rowsetEImageCatalogAttribute, $catalogEGuid, 'docViewOrder', App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($guidBasename, 'docViewOrder'));
         $this->_updateCatalogAttribute($rowsetEImageCatalogAttribute, $catalogEGuid, 'fixedTitle', $eiTitle);
         $this->relateTo($catalogEGuid, $catalogGuid, 'RELATED_IMAGE');
     }
     /**
      * @todo BLOCK solr core-catalog	
      */
     $indexingEngine = Pandamp_Search::manager();
     $indexingEngine->indexCatalog($catalogGuid);
     /**
     		 * @todo BLOCK New solr corehol	
             $registry = Zend_Registry::getInstance();
             $application = Zend_Registry::get(Pandamp_Keys::REGISTRY_APP_OBJECT);
             
             $res = $application->getOption('resources')['indexing']['solr']['write'];
             
             $esolr = new Pandamp_Search_Adapter_Esolr($res['host'], $res['port'], $res['dir4']);
             $esolr->indexCatalog($catalogGuid); */
     /**
     		 * @todo BLOCK solr shortenerUrl core3
             $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
             if (null === $viewRenderer->view) {
             	$viewRenderer->initView();
             }
             $view = $viewRenderer->view;
             
             
             // create shortener url
             $kopel 	= Zend_Auth::getInstance()->getIdentity()->kopel;
             
             $cfg 	= Pandamp_Config::getConfig();
             
     		$config = Pandamp_Application::getOption('resources');
     		$indexingConfig = $config['indexing']['solr']['write'];
     		$hukumn = new Pandamp_Search_Adapter_Solrh($indexingConfig['host'], $indexingConfig['port'], $indexingConfig['dir3']);
     		
     		$catalogAttributeDb = new App_Model_Db_Table_CatalogAttribute();
     		
     		$zl = Zend_Registry::get('Zend_Locale');
     		
     		if ($zl->getLanguage() == 'id') {
     			
     			if ($profileGuid == 'klinik') 
     				$url_content = $cfg->web->url->base.'/klinik/detail/'.$catalogGuid.'/'.$slug;
     			else if (in_array($profileGuid, array('kutu_peraturan','kutu_putusan','kutu_peraturan_kolonial','kutu_rancangan_peraturan')))
     				$url_content = $cfg->web->url->base.'/pusatdata/detail/'.$catalogGuid.'/'.$view->getLabelNode($folderGuid).'/'.$folderGuid.'/'.$slug;
     			else
     				$url_content = $cfg->web->url->base.'/berita/baca/'.$catalogGuid.'/'.$slug;
     		
     			
     		}
     		else if ($zl->getLanguage() == 'en')
     		{
     			$url_content = $cfg->web->en->url->base.'/pages/'.$catalogGuid.'/'.$slug(strip_tags(title));
     		}
     		
     		//$q = "url:\"".$url_content."\" kopel:".$kopel;
     		$q = "url:\"".$url_content."\"";
     		
     		$db = Zend_Registry::get('db4');
     		
     		$data = array('url' => $url_content,
     		 			  'createdate' => date("Y-m-d h:i:s"),
     					  'remoteip' => Pandamp_Lib_Formater::getHttpRealIp(),
     					  'kopel' => $kopel);
     					  
     		$hits = $hukumn->find($q,0,1);
     		if (isset($hits->response->docs[0])) 
     		{
     			$row = $hits->response->docs[0];
     			$hid = $row->id;
     			
     			$db->update('urls',$data,"id=$hid");
     		}
     		else 
     		{
     			$insert = $db->insert('urls', $data);
     			
     			$hid = $db->lastInsertId('urls', 'id');
     		}
     		
     		// indexing shortener url
     		$hukumn->indexCatalog($hid); */
     /*
     try {
     	
         $url = 'http://developers.facebook.com/tools/lint/?url={'.$url_content.'}&format=json';
         $ch = curl_init($url);
         curl_setopt($ch, CURLOPT_NOBODY, true);
         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
         curl_exec($ch);
         $retcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
         curl_close($ch);
     	
     }
     catch (Exception $e)
     {
     	//die($e->getMessage());
     }
     */
     /**
      * Updated Dec 10, 2013 06:01
      */
     //$dir = $cfg->cdn->hol->static->url . DS . 'temp' . DS . 'cache';
     //Pandamp_Core_FileCache::clear($dir . DS . 'url');
     //Pandamp_Core_FileCache::clear($dir . DS . 'action');
     /*
     if (Pandamp_Pio::manager()->ping()) {
     	Pandamp_Pio::manager()->addEvent([
     		'guid' => $catalogGuid,
     		'category' => $profileGuid				
     	]);
     }
     */
     self::addCache($folderGuid);
     //after indexing, update isIndex and indexedDate in table KutuCatalog
     return $catalogGuid;
 }
Exemplo n.º 7
0
 public function render()
 {
     $sReturn = '';
     switch ($this->type) {
         default:
         case 0:
             // field type = single line
             $view = new Zend_View();
             $view->name = $this->name;
             $view->value = $this->value;
             if (isset($this->attribs)) {
                 $view->attribs = $this->attribs;
             } else {
                 $view->attribs = array('rows' => 1, 'cols' => 50);
             }
             $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 '&nbsp;<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');
     }
 }