public function SetSearchRule() { $url = $this->GetURL(); if (!$url) { return; } //search cat_id from mapping table $mappingObj = BizSystem::GetObject($this->m_CategoryMappingDO, 1); //@todo: $url need to be filtered before use in database $records = $mappingObj->directFetch("[url]='{$url}'"); if (count($records) == 1) { $cat_id = (int) $records[0]['cat_id']; } else { //if no matched, generate record from category table url_match $categoryObj = BizSystem::GetObject($this->m_CategoryDO, 1); $records = $categoryObj->directFetch(); foreach ($records as $record) { $match = $record['url_match']; if ($match) { $pattern = "/" . str_replace('/', '\\/', $match) . "/si"; $pattern = "@" . $match . "@si"; if (preg_match($pattern, "/" . $url)) { $cat_id = $record['Id']; //cache it into database; $obj_array = array("cat_id" => $cat_id, "url" => $url); $mappingObj->insertRecord($obj_array); break; } } } } $this->m_SearchRule = "[category_id]='{$cat_id}'"; }
public function UpdateRecord() { $result = parent::UpdateRecord(); $mappingObj = BizSystem::GetObject($this->m_CategoryMappingDO, 1); $Id = $this->m_RecordId; $mappingObj->deleteRecords("[cat_id]='{$Id}'"); return $result; }
public function getDefaultMainForm(&$xmlArr) { $newForm = array("ATTRIBUTES" => array("NAME" => $this->m_FormSelector), "VALUE" => null); $xmlArr = $newForm; $formObj = BizSystem::GetObject($this->m_FormSelector); if (!$formObj) { return; } $targetForm = $formObj->getViewMode(); $newForm = array("ATTRIBUTES" => array("NAME" => $targetForm), "VALUE" => null); $newArr = array($xmlArr, $newForm); return $newArr; }
public function switchViewMode() { if (!$this->lastViewMode) { $this->lastViewMode = $this->getViewMode(); } $viewObj = $this->getViewObject(); //$viewObj = $this->getView(); if ($viewObj->m_LastRenderedForm && $viewObj->m_LastRenderedForm != 'help.form.HelpWidgetListForm' && $viewObj->m_LastRenderedForm != 'notification.widget.NotificationWidgetForm') { $this->lastViewMode = $viewObj->m_LastRenderedForm; } $recArr = $this->readInputRecord(); $this->viewMode = $recArr['viewmode']; $targetForm = $recArr['viewmode']; $formObj = BizSystem::GetObject($targetForm); $formHTML = $formObj->render(); BizSystem::clientProxy()->redrawForm($this->lastViewMode, $formHTML); $this->lastViewMode = $this->viewMode; }
protected function getFormReferences() { // get user widgets of this view $user_id = BizSystem::GetUserProfile("Id"); $viewName = $this->m_Name; $searchRule = "[user_id]='{$user_id}' AND [view]='{$viewName}'"; $do = BizSystem::GetObject($this->m_UserWidgetDO); $formRecs = $do->directfetch($searchRule); // if no user widgets found, get system widgets of this view if (count($formRecs) == 0) { $searchRule = "[user_id]=0 AND [view]='{$viewName}'"; $formRecs = $do->directfetch($searchRule); } $formRefXML = array(); foreach ($formRecs as $form) { $formRefXML[] = array("ATTRIBUTES" => array("NAME" => $form['widget']), "VALUE" => null); $this->columns[$form['column']][] = $form['widget']; } return $formRefXML; }
public function addAcl() { $inputs = $this->readInputs(); $acl_user = $inputs['fld_acl_uid']; $acl_perm = $inputs['fld_acl_perm']; //get UserID $userRec = BizSystem::getObject("system.do.UserDO", 1)->fetchOne("[username]='{$acl_user}'"); $acl_user_id = $userRec['Id']; $parent_record_id = $this->m_ParentRecordId; //get parent do table $prtForm = $this->m_ParentFormName; $prtFormObj = BizSystem::GetObject($prtForm); $dataObj = $prtFormObj->getDataObj(); $parent_record_table = $dataObj->m_MainTable; $aclDO = BizSystem::getObject("common.do.DataACLDO"); $sql = "\n\t\t\t[record_table]='{$parent_record_table}' AND \n\t\t\t[record_id]='{$parent_record_id}' AND\n\t\t\t[user_id]='{$acl_user_id}' \n\t\t"; $rec = $aclDO->fetchOne($sql); if (!$rec) { $aclRecord = array("record_table" => $parent_record_table, "record_id" => $parent_record_id, "user_id" => $acl_user_id, "user_perm" => $acl_perm); $aclDO->insertRecord($aclRecord); } $this->rerender(); }
protected function installChangeLog($xml) { $this->log("Install Module Change Logs."); $module_name = $xml['Name']; if (!isset($xml->ChangeLog->Version)) { return true; } foreach ($xml->ChangeLog->Version as $version) { $version_name = (string) $version['Name']; if (isset($version->Change)) { $changelogDO = BizSystem::GetObject("system.do.ModuleChangeLogDO"); foreach ($version->Change as $change) { $changelogRec = array(); $changelogRec['module'] = (string) $module_name; $changelogRec['name'] = (string) $change['Name']; $changelogRec['description'] = (string) $change['Description']; $changelogRec['status'] = (string) $change['Status']; $changelogRec['version'] = (string) $version_name; $changelogRec['type'] = (string) $change['Type']; $changelogRec['publish_date'] = (string) $change['PublishDate']; try { if (strtolower($changelogRec['status']) != '') { $oldRec = $changelogDO->fetchOne("[name]='" . $changelogRec['name'] . "'"); if ($oldRec) { $changelogRec['Id'] = $oldRec['Id']; $changelogDO->updateRecord($changelogRec, $oldRec); } else { $changelogDO->insertRecord($changelogRec); } } } catch (Exception $e) { //var_dump($e->getMessage()); } } } } }
#!/usr/bin/env php <?php /* * Cubi package discovery */ include_once "../app_init.php"; if (!defined("CLI")) { exit; } $packageService = "package.lib.PackageService"; // get package service $pkgsvc = BizSystem::GetObject($packageService); $categories = $pkgsvc->discoverCategories(); print_r($categories); $packages = $pkgsvc->discoverPackages(); print_r($packages); //$pkgsvc->downloadPackage('grm');
public function hasOwnerField() { $prtForm = $this->m_ParentFormName; $prtFormObj = BizSystem::GetObject($prtForm); $field = $prtFormObj->getDataObj()->getField('owner_id'); if ($field) { return true; } else { return false; } }
#!/usr/bin/env php <?php /* * Cubi license acquisition */ include_once "../app_init.php"; if (!defined("CLI")) { exit; } $licenseClient = "service.licenseClient"; // get package service //echo "get license client service"; $licsvc = BizSystem::GetObject($licenseClient); $activationCode = "hacq2b"; $contactEmail = "*****@*****.**"; $serverData = ""; //base64_encode(ioncube_server_data()); $license = $licsvc->acquireLicense($activationCode, $contactEmail, $serverData); print_r($license);
public function getConfig($widget = null) { if (!$widget) { if ($this->widgetForm) { $widget = $this->widgetForm; } else { $widget = $this->m_Name; } } $user_id = BizSystem::GetUserProfile("Id"); $searchRule = "[widget]='{$widget}' AND [user_id]='{$user_id}'"; $do = BizSystem::GetObject($this->m_UserWidgetDO); $configRec = $do->fetchOne($searchRule); $config = $configRec['config']; $configArr = unserialize($config); return $configArr; }
public function getValue() { if ($this->allowAccess()) { $formElementObj = BizSystem::GetObject($this->m_FormReference); if (method_exists($formElementObj, "getValue")) { return $formElementObj->getValue(); } } }
protected function uninstallChangeLog($xml) { $this->log("Install Module Change Logs."); $module_name = $xml['Name']; $changelogDO = BizSystem::GetObject("system.do.ModuleChangeLogDO"); $changelogDO->deleteRecords("[module]='{$module_name}'"); }
public function ShareRecord() { $prtForm = $this->m_ParentFormName; $prtFormObj = BizSystem::GetObject($prtForm); $recId = $this->m_RecordId; $dataObj = $prtFormObj->getDataObj(); $dataRec = $dataObj->fetchById($recId); $recArr = $this->readInputRecord(); $DataRec = $dataRec; //notice users has new published data //test if changed a new owner if ($recArr['notify_user'] && $recArr['group_perm']) { $data = $this->fetchData(); $data['app_index'] = APP_INDEX; $data['app_url'] = APP_URL; $data['operator_name'] = BizSystem::GetProfileName(BizSystem::getUserProfile("Id")); $emailSvc = BizSystem::getService(USER_EMAIL_SERVICE); //test if changes for group level visiable if ($recArr['group_perm'] >= 1) { $group_id = $recArr['group_id']; $userList = $this->_getGroupUserList($group_id); foreach ($userList as $user_id) { $emailSvc->DataPublishEmail($user_id, $data); } } //test if changes for other group level visiable if ($recArr['other_perm'] >= 1) { $groupList = $this->_getGroupList(); foreach ($groupList as $group_id) { $userList = $this->_getGroupUserList($group_id); foreach ($userList as $user_id) { $emailSvc->DataPublishEmail($user_id, $data); } } } } if (isset($recArr['group_perm'])) { $DataRec['group_perm'] = $recArr['group_perm']; } if (isset($recArr['other_perm'])) { $DataRec['other_perm'] = $recArr['other_perm']; } if (isset($recArr['group_id'])) { $DataRec['group_id'] = $recArr['group_id']; } if (isset($recArr['owner_id'])) { $DataRec['owner_id'] = $recArr['owner_id']; } if ($DataRec['group_perm'] == '0') { $DataRec['other_perm'] = '0'; } $DataRec->save(); //$prtFormObj->getDataObj()->updateRecord($newDataRec,$dataRec); if ($recArr['update_ref_data']) { if ($dataObj->m_ObjReferences->count()) { $this->_casacadeUpdate($dataObj, $recArr); } } if ($this->m_ParentFormName) { $this->close(); $this->renderParent(); } $this->processPostAction(); }