コード例 #1
0
ファイル: Element.php プロジェクト: Why-Not-Sky/cubi-ng
 public function getInvokeAction()
 {
     if ($this->m_FormedFunction) {
         return $this->m_FormedFunction;
     }
     $name = $this->_elemName;
     $ehName = $this->m_Name;
     $formobj = BizSystem::objectFactory()->getObject($this->_formName);
     if (!$this->m_FormedFunction) {
         // add direct URL support
         if ($this->m_URL) {
             $_func = "loadPage('" . $this->m_URL . "');";
         } else {
             if (strpos($this->m_Function, "js:") === 0) {
                 $_func = substr($this->m_Function, 3) . ";";
             } else {
                 $temp = $this->m_FunctionType == null ? "" : ",'" . $this->m_FunctionType . "'";
                 //$_func = "SetOnElement('$name:$ehName'); Openbiz.CallFunction('" . $this->m_Function . "'$temp);";
                 list($funcName, $funcParams) = $this->parseFunction($this->m_Function);
                 $funcParams = Expression::evaluateExpression($funcParams, $formobj);
                 $action = "{$name}:{$ehName}";
                 // TODO: encrypt paramString to add more security
                 $_func = "Openbiz.invoke('{$this->_formName}','{$action}','{$funcParams}'{$temp});";
             }
         }
         //$_func = Expression::evaluateExpression($_func, $formobj);
         $this->m_FormedFunction = $_func;
     }
     return $this->m_FormedFunction;
 }
コード例 #2
0
ファイル: SessionContext.php プロジェクト: que273/siremis
 /**
  * Save session variables of all stateful objects into sessionid_obj file
  *
  * @return void
  **/
 public function saveSessionObjects()
 {
     if ($this->_sessObjFileName == null) {
         return;
     }
     // loop all objects (bizview, bizform, bizdataobj) collect their session vars
     $allobjs = BizSystem::objectFactory()->getAllObjects();
     foreach ($allobjs as $obj) {
         if (method_exists($obj, "SetSessionVars")) {
             //after calling $obj->setSessionVars SessObjArr and StatefulSessObjArr are filled
             $obj->setSessionVars($this);
         }
         // if previous view's object is used in current view, don't discard its session data
         if (isset($obj->m_Name) && key_exists($obj->m_Name, $this->_prevViewObjNames)) {
             unset($this->_prevViewObjNames[$obj->m_Name]);
         }
     }
     // discard useless previous view's session objects
     //foreach($this->_prevViewObjNames as $objName=>$tmp)
     //    unset($this->_sessObjArr[$objName]);
     $this->_sessObjArr["ViewHist"] = $this->_viewHistory;
     $this->setVar(OB_TRANSIENT_DATA_SESSION_INDEX, $this->_sessObjArr);
     $this->setVar(OB_STATEFUL_DATA_SESSION_INDEX, $this->_statefulSessObjArr);
 }
コード例 #3
0
ファイル: EasyViewWizard.php プロジェクト: que273/siremis
 /**
  * Cancel, clean up the sessions of view and all forms
  *
  * @return void
  */
 public function cancel()
 {
     // call all step forms Cancel method
     foreach ($this->m_FormStates as $formName => $state) {
         if ($state['visited']) {
             BizSystem::objectFactory()->getObject($formName)->cancel();
         }
     }
     $this->m_DropSession = true;
 }
コード例 #4
0
ファイル: PickerForm.php プロジェクト: Why-Not-Sky/cubi-ng
 /**
  * Add a record (popup) to the parent form if OK button clicked, (M-M or M-1/1-1)
  *
  * @return void
  */
 public function addToParent($recIds = null)
 {
     if (!is_array($recIds)) {
         $recIdArr = array();
         $recIdArr[] = $recIds;
     } else {
         $recIdArr = $recIds;
     }
     /* @var $parentForm EasyForm */
     $parentForm = BizSystem::objectFactory()->getObject($this->m_ParentFormName);
     foreach ($recIdArr as $recId) {
         //clear parent form search rules
         $this->m_SearchRule = "";
         $parentForm->getDataObj()->clearSearchRule();
         $do = $this->getDataObj();
         $baseSearchRule = $do->m_BaseSearchRule;
         $do->m_BaseSearchRule = "";
         $do->clearSearchRule();
         $rec = $do->fetchById($recId);
         $do->m_BaseSearchRule = $baseSearchRule;
         if (!$rec) {
             $rec = BizSystem::getObject($do->m_Name, 1)->fetchById($recId);
         }
         // add record to parent form's dataObj who is M-M or M-1/1-1 to its parent dataobj
         $ok = $parentForm->getDataObj()->addRecord($rec, $bPrtObjUpdated);
         if (!$ok) {
             return $parentForm->processDataObjError($ok);
         }
     }
     $this->close();
     $parentForm->rerender();
     if ($parentForm->m_ParentFormName) {
         $parentForm->renderParent();
     }
 }
コード例 #5
0
ファイル: DynaView.php プロジェクト: que273/siremis
 /**
  * Process URL to get the form param and add the form in the FormRefs
  *
  * @return void
  */
 protected function processURL()
 {
     // if url has form=...
     $paramForm = isset($_GET['form']) ? $_GET['form'] : null;
     $paramCForm = isset($_GET['cform']) ? $_GET['cform'] : null;
     if (!$paramForm) {
         return;
     }
     // add the form in FormRefs
     if ($paramForm) {
         if ($this->isInFormRefLibs($paramForm)) {
             $xmlArr["ATTRIBUTES"]["NAME"] = $paramForm;
             $xmlArr["ATTRIBUTES"]["SUBFORMS"] = $paramCForm ? $paramCForm : "";
             $formRef = new FormReference($xmlArr);
             $this->m_FormRefs->set($paramForm, $formRef);
             if ($paramCForm) {
                 if ($this->isInFormRefLibs($paramCForm)) {
                     $xmlArr["ATTRIBUTES"]["NAME"] = $paramCForm;
                     $xmlArr["ATTRIBUTES"]["SUBFORMS"] = "";
                     $cformRef = new FormReference($xmlArr);
                     $this->m_FormRefs->set($paramCForm, $cformRef);
                 }
             }
         }
     }
     // check url arg as fld:name=val
     $getKeys = array_keys($_GET);
     $paramFields = null;
     foreach ($getKeys as $key) {
         if (substr($key, 0, 4) == "fld:") {
             $fieldName = substr($key, 4);
             $fieldValue = $_GET[$key];
             $paramFields[$fieldName] = $fieldValue;
         }
     }
     if (!$paramFields) {
         return;
     }
     $paramForm = $this->prefixPackage($paramForm);
     $formObj = BizSystem::objectFactory()->getObject($paramForm);
     $formObj->setRequestParams($paramFields);
 }
コード例 #6
0
ファイル: excelService.php プロジェクト: Why-Not-Sky/cubi-ng
 /**
  * Get raw data to display in the spreadsheet. header and data table
  *
  * @param string $objName
  * @return array
  */
 protected function getDataTable($objName)
 {
     /* @var $formObj EasyForm */
     $formObj = BizSystem::objectFactory()->getObject($objName);
     // get the existing EasyForm|BizForm object
     // if BizForm, call BizForm::renderTable
     if ($formObj instanceof BizForm) {
         $dataTable = $formObj->renderTable();
     }
     // if EasyForm, call EasyForm->DataPanel::renderTable
     if ($formObj instanceof EasyForm) {
         $recordSet = $formObj->fetchDataSet();
         $dataSet = $formObj->m_DataPanel->renderTable($recordSet);
         foreach ($dataSet['elems'] as $elem) {
             $labelRow[] = $elem['label'];
         }
         $dataTable = array_merge(array($labelRow), $dataSet['data']);
     }
     return $dataTable;
 }
コード例 #7
0
ファイル: PickerForm.php プロジェクト: que273/siremis
 /**
  * Add a record (popup) to the parent form if OK button clicked, (M-M or M-1/1-1)
  *
  * @return void
  */
 public function addToParent($recId = null)
 {
     $rec = $this->getActiveRecord($recId);
     /* @var $parentForm EasyForm */
     $parentForm = BizSystem::objectFactory()->getObject($this->m_ParentFormName);
     // add record to parent form's dataObj who is M-M or M-1/1-1 to its parent dataobj
     $ok = $parentForm->getDataObj()->addRecord($rec, $bPrtObjUpdated);
     if (!$ok) {
         return $parentForm->processDataObjError($ok);
     }
     $this->close();
     $parentForm->rerender();
     // just keep it simple, don't refresh parent's parent form :)
 }
コード例 #8
0
ファイル: EasyView.php プロジェクト: que273/siremis
 /**
  * Process request
  *
  * @return void
  */
 protected function processRequest()
 {
     // if url has form=...
     $paramForm = isset($_REQUEST['form']) ? $_REQUEST['form'] : null;
     // check url arg as fld:name=val
     $getKeys = array_keys($_REQUEST);
     $pageid = $_GET["pageid"];
     $paramFields = null;
     foreach ($getKeys as $key) {
         if (substr($key, 0, 4) == "fld:") {
             $fieldName = substr($key, 4);
             $fieldValue = $_REQUEST[$key];
             $paramFields[$fieldName] = $fieldValue;
         }
     }
     if (!$paramFields && !$pageid) {
         return;
     }
     // get the form object
     if (!$paramForm) {
         // get the first form name if no form is given
         foreach ($this->m_FormRefs as $formRef) {
             $paramForm = $formRef->m_Name;
             break;
         }
     }
     if (!$paramForm) {
         return;
     }
     $paramForm = $this->prefixPackage($paramForm);
     $formObj = BizSystem::objectFactory()->getObject($paramForm);
     $formObj->setRequestParams($paramFields);
     if ($pageid) {
         $formObj->setCurrentPage($pageid);
     }
 }
コード例 #9
0
ファイル: excelService.php プロジェクト: Why-Not-Sky/cubi-ng
 /**
  * Get raw data to display in the spreadsheet. header and data table
  *
  * @param string $objName
  * @return array
  */
 protected function getDataTable($objName)
 {
     /* @var $formObj EasyForm */
     $formObj = BizSystem::objectFactory()->getObject($objName);
     // get the existing EasyForm|BizForm object
     // if BizForm, call BizForm::renderTable
     if ($formObj instanceof BizForm) {
         $dataTable = $formObj->renderTable();
     }
     // if EasyForm, call EasyForm->DataPanel::renderTable
     if ($formObj instanceof EasyForm) {
         $recordSet = $formObj->fetchDataSet();
         $dataSet = $formObj->m_DataPanel->renderTable($recordSet);
         foreach ($dataSet['elems'] as $elem) {
             $labelRow[] = $elem['label'];
         }
         //If no datasets, return only labelrow to enable gracful export
         //to avoid error message as a result of trying to apply array_merge
         //on a null variable
         //Cyril Ogana 2012-01-28 23:30
         if (count($dataSet['data'])) {
             $dataTable = array_merge(array($labelRow), $dataSet['data']);
         } else {
             $dataTable = array($labelRow);
         }
     }
     return $dataTable;
 }
コード例 #10
0
ファイル: BaseForm.php プロジェクト: Why-Not-Sky/cubi-ng
 protected function prepareSubFormsDataObj()
 {
     if ($this->m_SubForms && $this->getDataObj()) {
         foreach ($this->m_SubForms as $subForm) {
             $formObj = BizSystem::objectFactory()->getObject($subForm);
             $dataObj = $this->getDataObj()->getRefObject($formObj->m_DataObjName);
             if ($dataObj) {
                 $formObj->setDataObj($dataObj);
             }
         }
     }
 }
コード例 #11
0
ファイル: Panel.php プロジェクト: que273/siremis
 protected function getFormObj()
 {
     return BizSystem::objectFactory()->getObject($this->m_FormName);
 }
コード例 #12
0
ファイル: EasyForm.php プロジェクト: que273/siremis
 /**
  * Rerender sub forms who has dependecy on this form.
  * This method is called when parent form's change affect the sub forms
  *
  * @return void
  */
 protected function rerenderSubForms()
 {
     if (!$this->m_SubForms) {
         return;
     }
     foreach ($this->m_SubForms as $subForm) {
         $formObj = BizSystem::objectFactory()->getObject($subForm);
         $dataObj = $this->getDataObj()->getRefObject($formObj->m_DataObjName);
         if ($dataObj) {
             $formObj->setDataObj($dataObj);
         }
         $formObj->rerender();
     }
     return;
 }
コード例 #13
0
ファイル: BizForm_Lite.php プロジェクト: que273/siremis
 /**
  * Run search on query mode, then go read mode
  *
  * @return void
  */
 public function runSearch($targetForm = null)
 {
     BizSystem::log(LOG_DEBUG, "FORMOBJ", $this->m_Name . "::runSearch(), SearchRule=" . $this->m_SearchRule);
     global $g_BizSystem;
     $searchRule = "";
     foreach ($this->m_RecordRow as $fldCtrl) {
         $value = BizSystem::clientProxy()->getFormInputs($fldCtrl->m_Name);
         if ($value) {
             $searchStr = $this->inputValToRule($fldCtrl->m_BizFieldName, $value);
             if ($searchRule == "") {
                 $searchRule .= $searchStr;
             } else {
                 $searchRule .= " AND " . $searchStr;
             }
         }
     }
     if ($targetForm) {
         $tgtForm = BizSystem::objectFactory()->getObject($targetForm);
         if ($tgtForm) {
             $tgtForm->setSearchRule($searchRule);
             return $tgtForm->rerender();
         }
         return;
     }
     $this->m_SearchRule = $searchRule;
     //$this->SetDisplayMode (MODE_R);
     $this->gotoPage(1);
     $this->m_ClearSearchRule = true;
     $this->rerender();
 }