Esempio n. 1
0
 protected function _insert()
 {
     if (empty($this->guid)) {
         $guidMan = new Pandamp_Core_Guid();
         $this->guid = $guidMan->generateGuid();
     }
     if (!empty($this->shortTitle)) {
         $sTitleLower = strtolower($this->shortTitle);
         $sTitleLower = preg_replace("/[^a-zA-Z0-9 s]/", "", $sTitleLower);
         $sTitleLower = str_replace(' ', '-', $sTitleLower);
         $this->shortTitle = $sTitleLower;
     }
     $today = date('Y-m-d H:i:s');
     if (empty($this->createdDate)) {
         $this->createdDate = $today;
     }
     if (empty($this->modifiedDate) || $this->modifiedDate == '0000-00-00 00:00:00') {
         $this->modifiedDate = $today;
     }
     $this->deletedDate = '0000-00-00 00:00:00';
     if (empty($this->createdBy)) {
         $auth = Zend_Auth::getInstance();
         if ($auth->hasIdentity()) {
             $this->createdBy = $auth->getIdentity()->username;
         }
     }
     if (empty($this->modifiedBy)) {
         $this->modifiedBy = $this->createdBy;
     }
     if (empty($this->status)) {
         $this->status = 0;
     }
 }
Esempio n. 2
0
 function ajaxActionRenderer($url)
 {
     $o = new Pandamp_Core_Guid();
     $guid = $o->generateGuid('ajact');
     $s = "\n\t\t<div id='out{$guid}'></div>\n\t\t<div id='progress{$guid}'>&nbsp;Loading...</div>\n\n\t\t\t<script type='text/javascript'>\n\t\t\t\$(document).ready(function()\n\t\t\t//setTimeout(function()\n\t\t\t{\n\t\t\t\t   \$.ajax({\n\t\t\t\t   type: 'POST',\n\t\t\t\t   url: '{$url}',\n\t\t\t\t   beforeSend: function()\n\t\t\t\t   {\n\t\t\t\t   \t\t\$('#progress{$guid}').show();\n\t\t\t\t   },\n\t\t\t\t   success: function(msg){\n\t\t\t\t     \$('#out{$guid}').html(msg);\n\t\t\t\t     \$('#progress{$guid}').hide();\n\t\t\t\t   }\n\t\t\t\t });\n\t\t\t //}, 50);\n\t\t\t});\n\t\t\t</script>\n\n\t\t";
     return $s;
 }
Esempio n. 3
0
 public function insert(array $data)
 {
     if (empty($data['guid'])) {
         $guidMan = new Pandamp_Core_Guid();
         $data['guid'] = $guidMan->generateGuid();
     }
     return parent::insert($data);
 }
Esempio n. 4
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;
 }
Esempio n. 5
0
 public function insert(array $data)
 {
     if (empty($data['guid'])) {
         $guidMan = new Pandamp_Core_Guid();
         $data['guid'] = $guidMan->generateGuid();
     }
     if (empty($data['createdDate'])) {
         $data['createdDate'] = date('Y-m-d H:i:s');
     }
     return parent::insert($data);
 }
Esempio n. 6
0
 protected function _insert()
 {
     if (empty($this->guid)) {
         $guidMan = new Pandamp_Core_Guid();
         $this->guid = $guidMan->generateGuid();
     }
     if ($this->parentGuid == 'root') {
         $this->path = '';
         $this->parentGuid = $this->guid;
     } else {
         $parentFolder = $this->_getTable()->find($this->parentGuid)->current();
         $this->path = $parentFolder->path . $parentFolder->guid . '/';
     }
 }
Esempio n. 7
0
 protected function _insert()
 {
     if (empty($this->guid)) {
         $generateGuid = new Pandamp_Core_Guid();
         $this->guid = $generateGuid->generateGuid();
     }
     //		if (empty($this->kopel))
     //		{
     //			$num = new Pandamp_Core_Number();
     //			$this->kopel = $num->generateNumber();
     //		}
     $today = date('Y-m-d h:i:s');
     if (empty($this->createdDate)) {
         $this->createdDate = $today;
     }
     if (empty($this->updatedDate)) {
         $this->updatedDate = $today;
     }
     $userName = '';
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $userName = $auth->getIdentity()->username;
     }
     if (empty($this->createdBy)) {
         $this->createdBy = $userName;
     }
     if (empty($this->updatedBy)) {
         $this->updatedBy = $userName;
     }
     if (empty($this->educationId)) {
         $this->educationId = 0;
     }
     if (empty($this->expenseId)) {
         $this->expenseId = 0;
     }
     if (empty($this->activationDate)) {
         $this->activationDate = '0000-00-00 00:00:00';
     }
     if (empty($this->paymentId)) {
         $this->paymentId = 0;
     }
     if (empty($this->periodeId)) {
         $this->periodeId = 1;
     }
     if (empty($this->isEmailSent)) {
         $this->isEmailSent = 'N';
     }
 }
Esempio n. 8
0
 protected function _insert()
 {
     if (empty($this->guid)) {
         $guidMan = new Pandamp_Core_Guid();
         $this->guid = $guidMan->generateGuid();
     }
     if (empty($this->parentGuid)) {
         throw new Zend_Exception('parentGuid can not be empty');
     }
     if (empty($this->title)) {
         throw new Zend_Exception('Title can not be empty');
     }
     if ($this->parentGuid == 'root') {
         $this->path = '';
         $this->parentGuid = $this->guid;
     } else {
         $parentFolder = $this->_getTable()->find($this->parentGuid)->current();
         $this->path = $parentFolder->path . $parentFolder->guid . '/';
     }
 }
Esempio n. 9
0
 function indexingCatalogAction()
 {
     $guid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $catalogGuid = $this->_getParam('catalogGuid') ? $this->_getParam('catalogGuid') : '';
     $solrAdapter = Pandamp_Search::manager();
     try {
         $solrAdapter->indexCatalog($catalogGuid);
         $tblTmpIndex = new Pandamp_Modules_Extension_Index_Model_TmpIndex();
         $tblTmpIndex->delete("guid='{$guid}'");
         $auth = Zend_Auth::getInstance();
         if ($auth->hasIdentity()) {
             $username = '******' . $auth->getIdentity()->username;
         } else {
             $username = '******';
         }
         // log to assetSetting
         $tblAssetSetting = new Pandamp_Modules_Dms_Catalog_Model_AssetSetting();
         $rowAsset = $tblAssetSetting->fetchRow("application='INDEX CATALOG'");
         if ($rowAsset) {
             $rowAsset->valueText = "Update indexing-catalog at " . date("d-m-Y H:i:s") . $username;
             $rowAsset->valueInt = $rowAsset->valueInt + 1;
         } else {
             $gman = new Pandamp_Core_Guid();
             $catalogGuid = $gman->generateGuid();
             $rowAsset = $tblAssetSetting->fetchNew();
             $rowAsset->guid = $catalogGuid;
             $rowAsset->application = "INDEX CATALOG";
             $rowAsset->part = "KUTU";
             $rowAsset->valueType = "INDEX";
             $rowAsset->valueInt = 0;
             $rowAsset->valueText = "Indexing catalog at " . date("d-m-Y H:i:s") . $username;
         }
         $rowAsset->save();
         $this->view->success = true;
     } catch (Exception $e) {
         $this->view->success = false;
     }
 }
Esempio n. 10
0
 public function insert(array $data)
 {
     if (empty($data['id'])) {
         $guidMan = new Pandamp_Core_Guid();
         $data['id'] = $guidMan->generateGuid();
     }
     $today = date('Y-m-d h:i:s');
     $data['createdDate'] = $today;
     $data['updatedDate'] = $today;
     $userName = '';
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $userName = $auth->getIdentity()->username;
     }
     $data['createdBy'] = $userName;
     $data['updatedBy'] = $userName;
     if (empty($data['educationId'])) {
         $data['educationId'] = 0;
     }
     if (empty($data['expenseId'])) {
         $data['expenseId'] = 0;
     }
     if (empty($data['activationDate'])) {
         $data['activationDate'] = '0000-00-00 00:00:00';
     }
     if (empty($data['paymentId'])) {
         $data['paymentId'] = 0;
     }
     if (empty($data['periodeId'])) {
         $data['periodeId'] = 1;
     }
     if (empty($data['isEmailSent'])) {
         $data['isEmailSent'] = 'N';
     }
     return parent::insert($data);
 }
Esempio n. 11
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;
 }
Esempio n. 12
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;
 }
Esempio n. 13
0
 public function uploadFile_old($aDataCatalog, $relatedGuid)
 {
     if ($aDataCatalog['profileGuid'] != 'kutu_doc') {
         throw new Zend_Exception('Profile does not match profile for FILE');
     }
     if (empty($relatedGuid)) {
         throw new Zend_Exception('No RELATED GUID specified!');
     }
     $id = 1 + ($aDataCatalog['id'] - 1);
     for ($x = 1; $x < $id; $x++) {
         $title = $aDataCatalog['fixedTitle' . $x] ? $aDataCatalog['fixedTitle' . $x] : 'No-Title';
         $registry = Zend_Registry::getInstance();
         $files = $registry->get('files');
         if (isset($files['uploadedFile' . $x])) {
             $file = $files['uploadedFile' . $x];
             $this->checkTitle($aDataCatalog['fixedTitle' . $x]);
         }
         $type = $aDataCatalog['fixedType' . $x] ? $aDataCatalog['fixedType' . $x] : '';
         if ($type == 'file') {
             $relatedType = 'RELATED_FILE';
         } elseif ($type == 'image') {
             $relatedType = 'RELATED_IMAGE';
         } elseif ($type == 'video') {
             $relatedType = 'RELATED_VIDEO';
         }
         $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
         $gman = new Pandamp_Core_Guid();
         $catalogGuid = isset($aDataCatalog['guid']) && !empty($aDataCatalog['guid']) ? $aDataCatalog['guid'] : $gman->generateGuid();
         $folderGuid = isset($aDataCatalog['folderGuid']) && !empty($aDataCatalog['folderGuid']) ? $aDataCatalog['folderGuid'] : '';
         $where = $tblCatalog->getAdapter()->quoteInto('guid=?', $catalogGuid);
         if ($tblCatalog->fetchRow($where)) {
             $rowCatalog = $tblCatalog->find($catalogGuid)->current();
             $rowCatalog->shortTitle = isset($aDataCatalog['shortTitle']) ? $aDataCatalog['shortTitle'] : $rowCatalog->shortTitle;
             $rowCatalog->publishedDate = isset($aDataCatalog['publishedDate']) ? $aDataCatalog['publishedDate'] : $rowCatalog->publishedDate;
             $rowCatalog->expiredDate = isset($aDataCatalog['expiredDate']) ? $aDataCatalog['expiredDate'] : $rowCatalog->expiredDate;
             $rowCatalog->status = isset($aDataCatalog['status']) ? $aDataCatalog['status'] : $rowCatalog->status;
         } else {
             $rowCatalog = $tblCatalog->fetchNew();
             $rowCatalog->guid = $catalogGuid;
             $rowCatalog->shortTitle = isset($aDataCatalog['shortTitle']) ? $aDataCatalog['shortTitle'] : '';
             $rowCatalog->profileGuid = $aDataCatalog['profileGuid'];
             $rowCatalog->publishedDate = isset($aDataCatalog['publishedDate']) ? $aDataCatalog['publishedDate'] : '0000-00-00 00:00:00';
             $rowCatalog->expiredDate = isset($aDataCatalog['expiredDate']) ? $aDataCatalog['expiredDate'] : '0000-00-00 00:00:00';
             $rowCatalog->createdBy = isset($aDataCatalog['username']) ? $aDataCatalog['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($aDataCatalog['status']) ? $aDataCatalog['status'] : 0;
         }
         $catalogGuid = $rowCatalog->save();
         $rowsetCatalogAttribute = $rowCatalog->findDependentRowsetCatalogAttribute();
         if (isset($files['uploadedFile' . $x])) {
             if (isset($files['uploadedFile' . $x]['name']) && !empty($files['uploadedFile' . $x]['name'])) {
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'docSystemName', strtoupper(str_replace(' ', '_', $file['name'])));
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'docOriginalName', strtoupper(str_replace(' ', '_', $file['name'])));
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'docSize', $file['size']);
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'docMimeType', $file['type']);
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'fixedTitle', $title);
                 $this->_updateCatalogAttribute($rowsetCatalogAttribute, $catalogGuid, 'docViewOrder', 0);
                 if ($type == 'file') {
                     $sDir = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $relatedGuid;
                     if (is_dir($sDir)) {
                         move_uploaded_file($file['tmp_name'], $sDir . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                     } else {
                         if (mkdir($sDir)) {
                             move_uploaded_file($file['tmp_name'], $sDir . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                         } else {
                             move_uploaded_file($file['tmp_name'], ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                         }
                     }
                 } elseif ($type == 'image') {
                     $sDir = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'images';
                     $file = $files['uploadedFile' . $x]['name'];
                     $ext = explode(".", $file);
                     $ext = strtolower(array_pop($ext));
                     if ($ext == "jpg" || $ext == "jpeg" || $ext == "gif" || $ext == "png") {
                         $target_path = $sDir . DIRECTORY_SEPARATOR . $catalogGuid . "." . $ext;
                         if (is_dir($target_path)) {
                             move_uploaded_file($files['uploadedFile' . $x]['tmp_name'], $sDir . DIRECTORY_SEPARATOR . $catalogGuid . "." . $ext);
                             chmod($target_path, 0644);
                             Pandamp_Lib_Formater::createthumb($target_path, $sDir . '/tn_' . $catalogGuid . "." . $ext, 130, 130);
                         } else {
                             move_uploaded_file($files['uploadedFile' . $x]['tmp_name'], ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . $catalogGuid . "." . $ext);
                             chmod($target_path, 0644);
                             Pandamp_Lib_Formater::createthumb($target_path, $sDir . '/tn_' . $catalogGuid . "." . $ext, 130, 130);
                         }
                     }
                 } elseif ($type == 'video') {
                     $sDir = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'video' . DIRECTORY_SEPARATOR . $relatedGuid;
                     if (is_dir($sDir)) {
                         move_uploaded_file($file['tmp_name'], $sDir . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                     } else {
                         if (mkdir($sDir)) {
                             move_uploaded_file($file['tmp_name'], $sDir . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                         } else {
                             move_uploaded_file($file['tmp_name'], ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . strtoupper(str_replace(' ', '_', $file['name'])));
                         }
                     }
                 }
             }
         }
         $this->relateTo($catalogGuid, $relatedGuid, $relatedType);
         $indexingEngine = Pandamp_Search::manager();
         $indexingEngine->indexCatalog($relatedGuid);
     }
 }
Esempio n. 14
0
 function generateGuid($prefix = null)
 {
     $o = new Pandamp_Core_Guid();
     return $o->generateGuid($prefix);
 }
 function saveAction()
 {
     $response = array();
     $request = $this->getRequest();
     $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $userName = $auth->getIdentity()->username;
     }
     $gman = new Pandamp_Core_Guid();
     $catalogGuid = $request->getParam('guid') ? $request->getParam('guid') : $gman->generateGuid();
     $folderGuid = $request->getParam('folderGuid') ? $request->getParam('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 = $request->getParam('shortTitle');
         $rowCatalog->publishedDate = $request->getParam('publishedDate');
         $rowCatalog->expiredDate = $request->getParam('expiredDate');
         $rowCatalog->modifiedBy = $userName;
         $rowCatalog->modifiedDate = date("Y-m-d h:i:s");
         $rowCatalog->status = $request->getParam('status');
     } else {
         $rowCatalog = $tblCatalog->fetchNew();
         $rowCatalog->shortTitle = $request->getParam('shortTitle');
         $rowCatalog->profileGuid = $request->getParam('profileGuid');
         $rowCatalog->publishedDate = $request->getParam('publishedDate');
         $rowCatalog->expiredDate = $request->getParam('expiredDate');
         $rowCatalog->createdBy = $userName;
         $rowCatalog->modifiedBy = $userName;
         $rowCatalog->createdDate = date("Y-m-d h:i:s");
         $rowCatalog->modifiedDate = date("Y-m-d h:i:s");
         $rowCatalog->deletedDate = '0000-00-00 00:00:00';
         $rowCatalog->status = $request->getParam('status');
     }
     $catalogGuid = $rowCatalog->save();
     $tableProfileAttribute = new Pandamp_Modules_Dms_Profile_Model_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 Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute();
             $rowCatalogAttribute = $tblCatalogAttribute->fetchNew();
             $rowCatalogAttribute->catalogGuid = $catalogGuid;
             $rowCatalogAttribute->attributeGuid = $rowProfileAttribute->attributeGuid;
         }
         $rowCatalogAttribute->value = $request->getParam($rowProfileAttribute->attributeGuid);
         $rowCatalogAttribute->save();
     }
     //save to table CatalogFolder only if folderGuid is not empty
     if (!empty($folderGuid)) {
         $tblCatalogFolder = new Pandamp_Modules_Dms_Catalog_Model_CatalogFolder();
         $rowsetCatalogFolder = $tblCatalogFolder->find($catalogGuid, $folderGuid);
         if (count($rowsetCatalogFolder) <= 0) {
             $rowCatalogFolder = $tblCatalogFolder->createRow(array('catalogGuid' => '', 'folderGuid' => ''));
             $rowCatalogFolder->catalogGuid = $catalogGuid;
             $rowCatalogFolder->folderGuid = $folderGuid;
             $rowCatalogFolder->save();
         }
     }
     $response['success'] = true;
     echo Zend_Json::encode($response);
 }
Esempio n. 16
0
 public function reIndexCatalog()
 {
     gc_enable();
     $this->emptyIndex();
     $time_start = microtime(true);
     $solr =& $this->_solr;
     $formater = new Pandamp_Lib_Formater();
     $title = new Pandamp_Controller_Action_Helper_GetCatalogTitle();
     //		$tbl = new Pandamp_Core_Orm_Table_Catalog();
     //		$rowset = $tbl->fetchAll(); //("profileGuid='Pandamp_peraturan'");
     $query = "SELECT * FROM KutuCatalog";
     $results = $this->_conn->query($query);
     $rowset = $results->fetchAll(PDO::FETCH_OBJ);
     $documents = array();
     $rowCount = count($rowset);
     for ($iCount = 0; $iCount < $rowCount; $iCount++) {
         $row = $rowset[$iCount];
         //			if($iCount == 100)
         //				break;
         //			echo 'urutan: '.$iCount .'<br>';
         $nextRow = $rowset[$iCount + 1];
         //			echo 'current guid: '.$row->guid.'  '.'next guid: '.$nextRow->guid.'<br>';
         if ($row->modifiedBy !== $row->createdBy) {
             $modified = '<font color=red>[modifiedBy:<i>' . $row->modifiedBy . '</i>]</font>&nbsp;';
         } else {
             $modified = '';
         }
         echo '<li><span style="font:11px verdana,arial,helvetica,sans-serif;">[urutan:' . $iCount . ']&nbsp;indexing:<font color=green>' . $title->getCatalogTitle($row->guid) . '</font>[current guid: ' . $row->guid . '  ' . 'next guid: ' . $nextRow->guid . '][author:<i>' . $row->createdBy . '</i>]&nbsp;' . $modified . '[createdDate:<i>' . $formater->get_date($row->createdDate) . '</i>]</span></li>';
         $documents[] = $this->_createSolrDocument($row);
         if ($iCount % 500 == 0) {
             try {
                 $solr->addDocuments($documents);
                 $solr->commit();
                 //					$solr->optimize();
                 $documents = array();
             } catch (Exception $e) {
                 //					echo "Error occured when processing record starting from number: ". ($iCount - 1000) . ' to '.$iCount.' '.$row->guid;
                 $log->err($e->getMessage());
                 throw new Zend_Exception($e->getMessage());
                 //					echo $e->getMessage().'<br>';
             }
         }
         flush();
     }
     echo '</ul></div></td></tr></table>';
     try {
         $solr->addDocuments($documents);
         $solr->commit();
         //			$solr->optimize();
     } catch (Exception $e) {
         $log->err($e->getMessage());
         throw new Zend_Exception($e->getMessage());
         //			echo $e->getMessage().'<br>';
     }
     $time_end = microtime(true);
     $time = $time_end - $time_start;
     //		echo'<br>WAKTU EKSEKUSI: '. $time;
     //		$log->info("WAKTU EKSEKUSI: ". $time." indexing catalog ".$iCount." dari ".$rowCount ." ".$username);
     echo '<br><br><span style="font:11px verdana,arial,helvetica,sans-serif;color:#00FF00">WAKTU EKSEKUSI: ' . $time . '<br>indexing catalog ' . $iCount . ' dari ' . $rowCount . '</span>';
     // log to assetSetting
     $tblAssetSetting = new App_Model_Db_Table_AssetSetting();
     $rowAsset = $tblAssetSetting->fetchRow("application='INDEX CATALOG'");
     if ($rowAsset) {
         $rowAsset->valueText = "Update {$rowCount} indexing-catalog at " . date("Y-m-d H:i:s") . $username;
         $rowAsset->valueInt = $rowAsset->valueInt + 1;
     } else {
         $gman = new Pandamp_Core_Guid();
         $catalogGuid = $gman->generateGuid();
         $rowAsset = $tblAssetSetting->fetchNew();
         $rowAsset->guid = $catalogGuid;
         $rowAsset->application = "INDEX CATALOG";
         $rowAsset->part = "KUTU";
         $rowAsset->valueType = "INDEX";
         $rowAsset->valueInt = 0;
         $rowAsset->valueText = $rowCount . " Indexing catalog at " . date("Y-m-d H:i:s") . $username;
     }
     $rowAsset->save();
 }
 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;
 }
Esempio n. 18
0
 public function save($aData)
 {
     $gman = new Pandamp_Core_Guid();
     $guid = isset($aData['guid']) && !empty($aData['guid']) ? $aData['guid'] : $gman->generateGuid();
     //if not empty, there are 2 possibilities
     $tblUser = new Pandamp_Modules_Identity_User_Model_User();
     $row = $tblUser->fetchRow("guid='{$guid}'");
     if (empty($row)) {
         if (empty($aData['username'])) {
             throw new Zend_Exception('Username can not be EMPTY!');
         }
         if (empty($aData['password'])) {
             throw new Zend_Exception('Password can not be EMPTY!');
         }
         $row = $tblUser->createRow();
         if (isset($aData['password']) && !empty($aData['password'])) {
             $password = $aData['password'];
             $crypt = new Pandamp_Crypt_Password();
             $password = $crypt->encryptPassword($password);
             $row->password = $password;
         }
     }
     if (isset($aData['username']) && !empty($aData['username'])) {
         //check if username was already taken
         $username = $aData['username'];
         $tblUser = new Pandamp_Modules_Identity_User_Model_User();
         $rowUsername = $tblUser->fetchRow("username='******'");
         if ($rowUsername) {
             throw new Zend_Exception('Username exists');
         }
         $row->username = $aData['username'];
     }
     if (isset($aData['email'])) {
         $row->email = $aData['email'];
     }
     if (isset($aData['fullName'])) {
         $row->fullName = $aData['fullName'];
     }
     if (isset($aData['chkGender'])) {
         $row->gender = $aData['chkGender'] == 1 ? 'L' : 'P';
     }
     if (isset($aData['year'])) {
         $row->birthday = $aData['year'] . '-' . $aData['month'] . '-' . $aData['day'];
     }
     if (isset($aData['education'])) {
         $row->educationId = $aData['education'];
     }
     if (isset($aData['expense'])) {
         $row->expenseId = $aData['expense'];
     }
     if (isset($aData['company'])) {
         $row->company = $aData['company'];
     }
     if (isset($aData['businessType'])) {
         $row->businessTypeId = $aData['businessType'];
     }
     if (isset($aData['phone'])) {
         $row->phone = $aData['phone'];
     }
     if (isset($aData['fax'])) {
         $row->phone = $aData['fax'];
     }
     if (isset($aData['packageId'])) {
         $row->packageId = $aData['packageId'];
     }
     if (isset($aData['newArtikel']) && $aData['newArtikel'] == 1) {
         $row->newArticle = 'Y';
     } else {
         if (!isset($aData['email']) && !isset($aData['username'])) {
             $row->newArticle = 'N';
         }
     }
     if (isset($aData['newRegulation']) && $aData['newRegulation'] == 1) {
         $row->monthlyList = 'Y';
     } else {
         if (!isset($aData['email']) && !isset($aData['username'])) {
             $row->monthlyList = 'N';
         }
     }
     if (isset($aData['newWeeklyRegulation']) && $aData['newWeeklyRegulation'] == 1) {
         $row->weeklyList = 'Y';
     } else {
         if (!isset($aData['email']) && !isset($aData['username'])) {
             $row->weeklyList = 'N';
         }
     }
     $row->save();
     return $row;
 }
Esempio n. 19
0
 function generateFormAdd($catalogGuid, $folderGuid = null)
 {
     $aRenderedAttributes = array();
     $aBaseAttributes = array();
     $tableCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog();
     $rowsetCatalog = $tableCatalog->find($catalogGuid);
     $rowCatalog = $rowsetCatalog->current();
     if (!isset($rowCatalog)) {
         $tableProfileAttribute = new Pandamp_Modules_Dms_Profile_Model_ProfileAttribute();
         $where = $tableProfileAttribute->getAdapter()->quoteInto('profileGuid=?', 'setting');
         $rows = $tableProfileAttribute->fetchAll($where, 'viewOrder ASC');
         $i = 0;
         foreach ($rows as $row) {
             $rowset = $row->findParentRow('Pandamp_Modules_Dms_Catalog_Model_Attribute');
             $attributeRenderer = new Pandamp_Form_Attribute_Renderer($rowset->guid, null, $rowset->type, null);
             $aRenderedAttributes[$rowset->guid]['description'] = $rowset->description;
             $aRenderedAttributes[$rowset->guid]['form'] = $attributeRenderer->render();
             $i++;
         }
         $aBaseAttributes['profileGuid']['description'] = '';
         $aBaseAttributes['profileGuid']['form'] = "<input type='hidden' name='profileGuid' id='profileGuid' value='setting'>";
         $aBaseAttributes['folderGuid']['description'] = '';
         $aBaseAttributes['folderGuid']['form'] = "<input type='hidden' name='folderGuid' id='folderGuid' value='{$folderGuid}'>";
         $aBaseAttributes['status']['description'] = '';
         $aBaseAttributes['status']['form'] = "<input type='hidden' name='status' id='status' value='1'>";
     } else {
         $tableProfileAttributes = new Pandamp_Modules_Dms_Profile_Model_ProfileAttribute();
         $where = $tableProfileAttributes->getAdapter()->quoteInto('profileGuid=?', $rowCatalog->profileGuid);
         $rowsetProfileAttributes = $tableProfileAttributes->fetchAll($where, array('viewOrder ASC'));
         $rowsetCatalogAttribute = $rowCatalog->findDependentRowsetCatalogAttribute();
         $i = 0;
         foreach ($rowsetProfileAttributes as $row) {
             $rowCatalogAttribute = $rowsetCatalogAttribute->findByAttributeGuid($row->attributeGuid);
             $rowAttribute = $row->findParentRow('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();
             }
             $attributeRenderer = new Pandamp_Form_Attribute_Renderer($rowAttribute->guid, $attributeValue, $rowAttribute->type, null);
             $aRenderedAttributes[$rowAttribute->guid]['description'] = $rowAttribute->description;
             $aRenderedAttributes[$rowAttribute->guid]['form'] = $attributeRenderer->render();
             $i++;
         }
         $aBaseAttributes['guid']['description'] = '';
         $aBaseAttributes['guid']['form'] = "<input type='hidden' name='guid' id='guid' value='{$rowCatalog->guid}'>";
         $aBaseAttributes['profileGuid']['description'] = '';
         $aBaseAttributes['profileGuid']['form'] = "<input type='hidden' name='profileGuid' id='profileGuid' value='{$rowCatalog->profileGuid}'>";
         $aBaseAttributes['status']['description'] = '';
         $aBaseAttributes['status']['form'] = "<input type='hidden' name='status' id='status' value='1'>";
     }
     $aReturn = array();
     $aReturn['baseForm'] = $aBaseAttributes;
     $aReturn['attributeForm'] = $aRenderedAttributes;
     return $aReturn;
 }