Esempio n. 1
0
 public function getSessionVars($sessionContext)
 {
     $sessionContext->getObjVar("common.form.LicenseForm", "SourceURL", $this->m_SourceURL);
     $sessionContext->getObjVar("common.form.LicenseForm", "ErrorCode", $this->m_ErrorCode);
     $sessionContext->getObjVar("common.form.LicenseForm", "ErrorParams", $this->m_ErrorParams);
     parent::getSessionVars($sessionContext);
 }
Esempio n. 2
0
 public function setSessionVars($sessCtxt)
 {
     parent::setSessionVars($sessCtxt);
     $sessCtxt->setObjVar($this->m_Name, "MetaFile", $this->m_MetaFile);
     $sessCtxt->setObjVar($this->m_Name, "ElemPath", $this->m_ElemPath);
     $sessCtxt->setObjVar($this->m_Name, "AttrName", $this->m_AttrName);
 }
Esempio n. 3
0
 /**
  * Save object variable to session context
  *
  * @param SessionContext $sessionContext
  * @return void
  */
 public function setSessionVars($sessionContext)
 {
     parent::setSessionVars($sessionContext);
     $sessionContext->setObjVar($this->m_Name, "ParentFormElemName", $this->m_ParentFormElemName);
     $sessionContext->setObjVar($this->m_Name, "PickerMap", $this->m_PickerMap);
     $sessionContext->setObjVar($this->m_Name, "ParentFormRecord", $this->m_ParentFormRecord);
 }
Esempio n. 4
0
 protected function readMetaData($xmlArr)
 {
     parent::readMetaData($xmlArr);
     $this->m_TitleField = isset($xmlArr["EASYFORM"]["ATTRIBUTES"]["TITLEFIELD"]) ? $xmlArr["EASYFORM"]["ATTRIBUTES"]["TITLEFIELD"] : "title";
     $this->m_RootSearchRule = isset($xmlArr["EASYFORM"]["ATTRIBUTES"]["ROOTSEARCHRULE"]) ? $xmlArr["EASYFORM"]["ATTRIBUTES"]["ROOTSEARCHRULE"] : null;
     $this->m_TreeDepth = isset($xmlArr["EASYFORM"]["ATTRIBUTES"]["TREEDEPTH"]) ? $xmlArr["EASYFORM"]["ATTRIBUTES"]["TREEDEPTH"] : 10;
 }
Esempio n. 5
0
 function __construct(&$xmlArr)
 {
     parent::readMetadata($xmlArr);
     if ($_GET['ob_err_msg']) {
         $this->m_Errors = array("system" => $_GET['ob_err_msg']);
     }
 }
Esempio n. 6
0
 public function fetchData()
 {
     $resultRecord = parent::fetchData();
     $resultRecord['event'] = $this->getMessage($resultRecord['event']);
     $resultRecord['message'] = $this->getMessage($resultRecord['message'], unserialize($resultRecord['comment']));
     return $resultRecord;
 }
Esempio n. 7
0
 public function outputAttrs()
 {
     $profile = BizSystem::getUserProfile();
     $userId = $profile['Id'];
     $output = parent::outputAttrs();
     $output['queryString'] = "Id=" . $userId;
     return $output;
 }
Esempio n. 8
0
 protected function getPivotData()
 {
     $recordset = parent::fetchDataSet();
     // convert the normal record set to pivot data array
     $data = Pivot::factory($recordset)->pivotOn(array_keys($this->pivotConfig['rows']))->addColumn(array_keys($this->pivotConfig['columns']), array_keys($this->pivotConfig['datas']))->fullTotal()->pivotTotal()->fetch(1);
     //print_r($data); exit;
     return $data;
 }
Esempio n. 9
0
 /**
  * Default constructor that takes in initial parameters and setting prefix.
  * @param Array $paramList The list of parameters to create the form from.
  * @param String $settingPrefix The prefix to use for the settings.
  * @param String $formID The optional ID to give to the form. Ideal for when there's more than 1 form on a page. 
  */
 public function __construct($paramList, $settingPrefix, $formID = false)
 {
     parent::__construct($paramList, $formID);
     // Default save text reflects this is a settings form
     $this->buttonText = 'Save Settings';
     // Store the setting prefix.
     $this->settingPrefix = $settingPrefix;
     // Load default values
     parent::loadDefaults(TidySettings_getSettings($settingPrefix));
 }
Esempio n. 10
0
 public function fetchData()
 {
     $url = $_SERVER['REQUEST_URI'];
     $roleStartpages = BizSystem::getUserProfile("roleStartpage");
     $default_url = APP_INDEX . $roleStartpages[0];
     if ($url == $default_url) {
         $this->m_isDefaultPage = 1;
     } else {
         $this->m_isDefaultPage = 0;
     }
     return parent::fetchData();
 }
Esempio n. 11
0
 /**
  * Default constructor that takes in initial parameters and setting prefix.
  * @param Array $paramList The list of parameters to create the form from.
  * @param String $settingPrefix The prefix to use for the settings.
  * @param String $formID The optional ID to give to the form. Ideal for when there's more than 1 form on a page. 
  */
 public function __construct($paramList, $settingPrefix, $formID = false)
 {
     parent::__construct($paramList, $formID);
     // Default save text reflects this is a settings form
     $this->buttonText = __('Save Settings');
     // Store the setting prefix.
     $this->settingPrefix = $settingPrefix;
     // Messages
     $this->msg_settingsSaved = __('Settings successfully saved.');
     $this->msg_settingsProblem = __('There was a problem saving the settings.');
     // Load default values
     parent::loadDefaults(TidySettings_getSettings($settingPrefix));
 }
Esempio n. 12
0
 /**
  * Replace elements expression with value from $formObj
  *
  * @param string $expression
  * @param EasyForm $formObj
  * @return mixed
  */
 protected static function replaceElementsExpr($expression, $formObj)
 {
     $script = "";
     $start = 0;
     // replace [field] with field value
     while (true) {
         $pos0 = strpos($expression, "[", $start);
         $pos1 = strpos($expression, "]", $start);
         if ($pos0 === false) {
             $script .= substr($expression, $start);
             break;
         }
         if ($pos0 >= 0 && $pos1 > $pos0) {
             $script .= substr($expression, $start, $pos0 - $start);
             $start = $pos1 + 1;
             $elementName = substr($expression, $pos0 + 1, $pos1 - $pos0 - 1);
             // get field value
             $element = $formObj->getElement($elementName);
             if ($element) {
                 $fldval = $element->getValue();
             } else {
                 $fldval = null;
             }
             if ($fldval !== null) {
                 $script .= $fldval;
             } else {
                 //$script .= substr($expression, $pos0, $pos1 - $pos0);
                 //return "fail to evaluate $expression";
                 return $expression;
                 // return the original expression once it can't find element
             }
         } elseif ($pos0 >= 0 && $pos1 <= $pos0) {
             break;
         }
     }
     return $script;
 }
Esempio n. 13
0
 /**
  * login action
  *
  * @return void
  */
 public function Login()
 {
     $recArr = $this->readInputRecord();
     try {
         $this->ValidateForm();
     } catch (ValidationException $e) {
         $this->processFormObjError($e->m_Errors);
         return;
     }
     // get the username and password
     $this->username = BizSystem::ClientProxy()->getFormInputs("username");
     $this->password = BizSystem::ClientProxy()->getFormInputs("password");
     global $g_BizSystem;
     $svcobj = BizSystem::getService(AUTH_SERVICE);
     $eventlog = BizSystem::getService(EVENTLOG_SERIVCE);
     try {
         if ($svcobj->authenticateUser($this->username, $this->password)) {
             // after authenticate user: 1. init profile
             $profile = $g_BizSystem->InitUserProfile($this->username);
             // after authenticate user: 2. insert login event
             $logComment = array($this->username, $_SERVER['REMOTE_ADDR']);
             $eventlog->log("LOGIN", "MSG_LOGIN_SUCCESSFUL", $logComment);
             // after authenticate user: 3. update login time in user record
             if (!$this->UpdateloginTime()) {
                 return false;
             }
             $redirectPage = APP_INDEX . $profile['roleStartpage'][0];
             $cookies = BizSystem::ClientProxy()->getFormInputs("session_timeout");
             if ($cookies) {
                 $password = $this->password;
                 $password = md5(md5($password . $this->username) . md5($profile['create_time']));
                 setcookie("SYSTEM_SESSION_USERNAME", $this->username, time() + (int) $cookies, "/");
                 setcookie("SYSTEM_SESSION_PASSWORD", $password, time() + (int) $cookies, "/");
             }
             if ($profile['roleStartpage'][0]) {
                 BizSystem::clientProxy()->ReDirectPage($redirectPage);
             } else {
                 parent::processPostAction();
             }
             return true;
         } else {
             $logComment = array($this->username, $_SERVER['REMOTE_ADDR'], $this->password);
             $eventlog->log("LOGIN", "MSG_LOGIN_FAILED", $logComment);
             $errorMessage['password'] = $this->getMessage("PASSWORD_INCORRECT");
             $errorMessage['login_status'] = $this->getMessage("LOGIN_FAILED");
             $this->processFormObjError($errorMessage);
         }
     } catch (Exception $e) {
         BizSystem::ClientProxy()->showErrorMessage($e->getMessage());
     }
 }
Esempio n. 14
0
 public function setSessionVars($sessionContext)
 {
     parent::setSessionVars($sessionContext);
     $sessionContext->setObjVar("Translation", "Lang", $this->m_Lang);
 }
Esempio n. 15
0
 public function outputAttrs()
 {
     $result = parent::outputAttrs();
     $result['show_error'] = $this->m_ShowError;
     return $result;
 }
Esempio n. 16
0
 public function outputAttrs()
 {
     $output = parent::outputAttrs();
     $output['dataGroup'] = $this->fetchDataGroup();
     return $output;
 }
Esempio n. 17
0
 public function setSessionVars($sessionContext)
 {
     parent::setSessionVars($sessionContext);
     $sessionContext->setObjVar($this->m_Name, "_roleId", $this->_roleId);
 }
Esempio n. 18
0
 public function fetchData()
 {
     $resultRecords = parent::fetchDataSet();
     return $resultRecords[0];
 }
Esempio n. 19
0
 /**
  * Validate form user inputs
  *
  * @return boolean
  */
 public function validateForm()
 {
     // disable password validation if they are empty
     $password = BizSystem::ClientProxy()->GetFormInputs("fld_password");
     $password_repeat = BizSystem::ClientProxy()->GetFormInputs("fld_password_repeat");
     if (!$password_repeat) {
         $this->getElement("fld_password")->m_Validator = null;
     }
     if (!$password) {
         $this->getElement("fld_password_repeat")->m_Validator = null;
     }
     parent::ValidateForm();
     if ($password != "" && $password != $password_repeat) {
         $passRepeatElem = $this->getElement("fld_password_repeat");
         $errorMessage = $this->GetMessage("PASSOWRD_REPEAT_NOTSAME", array($passRepeatElem->m_Label));
         $this->m_ValidateErrors['fld_password_repeat'] = $errorMessage;
         throw new ValidationException($this->m_ValidateErrors);
         return false;
     }
     return true;
 }
Esempio n. 20
0
 public function outputAttrs()
 {
     $output = parent::outputAttrs();
     $output['show_widget'] = $this->m_ShowWidget;
     return $output;
 }
Esempio n. 21
0
 public function outputAttrs()
 {
     $data = parent::outputAttrs();
     $data['config'] = $this->getConfig();
     return $data;
 }
Esempio n. 22
0
 public function outputAttrs()
 {
     $output = parent::outputAttrs();
     $viewobj = $this->getViewObject();
     $forms = array();
     $viewobj->m_FormRefs->rewind();
     while ($viewobj->m_FormRefs->valid()) {
         $form = $viewobj->m_FormRefs->current();
         $forms[$form->m_Name] = $form;
         $viewobj->m_FormRefs->next();
     }
     $output['forms'] = $forms;
     $output['step'] = $viewobj->getCurrentStep();
     return $output;
 }
Esempio n. 23
0
 /** 
  * DeleteRecord() - allow delete only if no child node
  * @return avoid
  */
 public function deleteRecord()
 {
     $rec = $this->getActiveRecord();
     if (!$rec) {
         return;
     }
     $id = $rec['Id'];
     $recordList = $this->getDataObj()->directFetch("[PId]='{$id}'");
     if (count($recordList) > 0) {
         global $g_BizSystem;
         $errorMsg = "Unable to delete the record that has 1 or more children nodes.";
         BizSystem::clientProxy()->showErrorMessage($errorMsg);
         return;
     }
     return parent::deleteRecord();
 }
Esempio n. 24
0
 public function fetchData()
 {
     $result = parent::fetchData();
     $attr_str = $result['attrs'];
     $attrArr = explode(";", $attr_str);
     foreach ($attrArr as $value) {
         $itemArr = explode("=", $value);
         $result["_" . $itemArr[0]] = $itemArr[1];
     }
     $defaultRec = $this->getNewRecord();
     foreach ($defaultRec as $key => $value) {
         if (!isset($result[$key])) {
             $result[$key] = $value;
         }
     }
     return $result;
 }
Esempio n. 25
0
 public function outputAttrs()
 {
     $result = parent::outputAttrs();
     $rec = $this->fetchData();
     $result['record'] = $rec;
     $result['record_name'] = $this->m_DataRecordName;
     return $result;
 }
Esempio n. 26
0
 protected function readMetaData($xmlArr)
 {
     $result = parent::readMetaData($xmlArr);
     $this->m_DataService = APP_URL . "/ws.php/user/userService";
     return $result;
 }
Esempio n. 27
0
 /**
  * If we have primary key and table details, load details from the database to load the defaults. This method 
  * will also load the meta values if we have any.
  * 
  * @return Return the details that were loaded from the database.
  */
 protected function loadDefaultsFromDB()
 {
     if (!$this->primaryKey || !$this->tableName) {
         $this->messages = $this->showMessage('loadDefaultsFromDB(): Nothing could be loaded, as the table name and primary key details are invalid.', true);
         return false;
     }
     // Fetch any existing details for the main record.
     $this->recordDetails = getRecordDetails($this->tableName, $this->primaryKey, $this->primaryKeyValue, ARRAY_A);
     if (empty($this->recordDetails)) {
         return false;
     }
     // Try to fetch the meta values if we have any
     if (!empty($this->meta_element_list)) {
         if (!$this->metaTableName) {
             $this->messages = $this->showMessage('loadDefaultsFromDB(): The specified meta table is not valid, so meta values could not be loaded.', true);
             return $this->recordDetails;
         }
         global $wpdb;
         $wpdb->show_errors();
         foreach ($this->meta_element_list as $fieldName) {
             $SQL = $wpdb->prepare("\n\t\t\t\t\tSELECT meta_value \n\t\t\t\t\tFROM {$this->metaTableName}\n\t\t\t\t\tWHERE {$this->primaryKey} = %s\n\t\t\t\t\t  AND meta_key = %s\n\t\t\t\t\tLIMIT 1", $this->primaryKeyValue, $fieldName);
             // Add details, even if blank
             $this->recordDetails[$fieldName] = $wpdb->get_var($SQL);
         }
         // end of foreach
     }
     // end of if
     // Load the details into the defaults.
     parent::loadDefaults($this->recordDetails);
     // Exists checks
     $this->alreadyInDB = true;
     return $this->recordDetails;
 }
Esempio n. 28
0
 /**
  * Render PHP template for form object
  *
  * @param EasyForm $formObj
  * @param string $tplFile
  * @return string result of rendering process
  */
 protected static function renderPHP($formObj, $tplFile)
 {
     $view = BizSystem::getZendTemplate();
     $view->addScriptPath(dirname($tplFile));
     $view->name = $formObj->m_Name;
     $view->title = $formObj->m_Title;
     $view->errors = $formObj->m_Errors;
     $view->notices = $formObj->m_Notices;
     // if the $formobj form type is list render table, otherwise render record
     if ($formObj->m_FormType == 'LIST') {
         $recordSet = $formObj->fetchDataSet();
         $view->dataPanel = $formObj->m_DataPanel->renderTable($recordSet);
     } else {
         $record = $formObj->fetchData();
         $view->dataPanel = $formObj->m_DataPanel->renderRecord($record);
     }
     // render the formobj attributes
     $view->form = $formObj->outputAttrs();
     $view->actionPanel = $formObj->m_ActionPanel->render();
     $view->searchPanel = $formObj->m_SearchPanel->render();
     $view->navPanel = $formObj->m_NavPanel->render();
     return $view->render($formObj->m_TemplateFile);
 }
Esempio n. 29
0
 public function fetchDataSet()
 {
     $this->SetSearchRule();
     return parent::fetchDataSet();
 }
Esempio n. 30
0
 public function setSessionVars($sessionContext)
 {
     $sessionContext->setObjVar($this->m_Name, "ViewMode", $this->viewMode);
     parent::setSessionVars($sessionContext);
 }