00001 <?PHP
00025 class Element extends MetaObject implements iUIControl
00026 {
00027 public $m_Style;
00028 public $m_cssClass;
00029 public $m_cssErrorClass;
00030 public $m_Width;
00031 public $m_Height;
00032 public $m_Hidden = "N";
00033 public $m_HTMLAttr;
00034 public $m_Label;
00035 public $m_EventHandlers;
00036 public $m_Translatable;
00037 public $m_FuzzySearch;
00038 public $m_OnEventLog;
00039 public $m_AllowURLParam = 'N';
00040 public $m_XMLMeta;
00041
00042 public $m_SortFlag;
00043 public $m_Value = "";
00044 public $m_FormName;
00045 public $m_ElementSet;
00046 public $m_ElementSetCode;
00047 public $m_TabSet;
00048 public $m_TabSetCode;
00049 public $m_FieldName;
00050 public $m_Required = null;
00051 public $m_Validator = null;
00052 public $m_ClientValidator = null;
00053 public $m_KeepCookie = null;
00054 public $m_CookieLifetime = 3600;
00055 public $m_BackgroundColor;
00056
00063 function __construct(&$xmlArr, $formObj)
00064 {
00065 $this->m_XMLMeta = $xmlArr;
00066 $this->m_FormName = $formObj->m_Name;
00067 $this->m_Package = $formObj->m_Package;
00068
00069 $this->readMetaData($xmlArr);
00070
00071 $this->translate();
00072 }
00073
00080 protected function readMetaData(&$xmlArr)
00081 {
00082 $this->m_Name = isset($xmlArr["ATTRIBUTES"]["NAME"]) ? $xmlArr["ATTRIBUTES"]["NAME"] : null;
00083 $this->m_BackgroundColor = isset($xmlArr["ATTRIBUTES"]["BACKGROUNDCOLOR"]) ? $xmlArr["ATTRIBUTES"]["BACKGROUNDCOLOR"] : null;
00084 $this->m_Class = isset($xmlArr["ATTRIBUTES"]["CLASS"]) ? $xmlArr["ATTRIBUTES"]["CLASS"] : null;
00085 $this->m_Description = isset($xmlArr["ATTRIBUTES"]["DESCRIPTION"]) ? $xmlArr["ATTRIBUTES"]["DESCRIPTION"] : null;
00086 $this->m_Access = isset($xmlArr["ATTRIBUTES"]["ACCESS"]) ? $xmlArr["ATTRIBUTES"]["ACCESS"] : null;
00087 $this->m_DefaultValue = isset($xmlArr["ATTRIBUTES"]["DEFAULTVALUE"]) ? $xmlArr["ATTRIBUTES"]["DEFAULTVALUE"] : null;
00088 $this->m_cssClass = isset($xmlArr["ATTRIBUTES"]["CSSCLASS"]) ? $xmlArr["ATTRIBUTES"]["CSSCLASS"] : null;
00089 $this->m_cssErrorClass = isset($xmlArr["ATTRIBUTES"]["CSSERRORCLASS"]) ? $xmlArr["ATTRIBUTES"]["CSSERRORCLASS"] : "input_error";
00090 $this->m_Style = isset($xmlArr["ATTRIBUTES"]["STYLE"]) ? $xmlArr["ATTRIBUTES"]["STYLE"] : null;
00091 $this->m_Width = isset($xmlArr["ATTRIBUTES"]["WIDTH"]) ? $xmlArr["ATTRIBUTES"]["WIDTH"] : null;
00092 $this->m_Height = isset($xmlArr["ATTRIBUTES"]["HEIGHT"]) ? $xmlArr["ATTRIBUTES"]["HEIGHT"] : null;
00093 $this->m_Hidden = isset($xmlArr["ATTRIBUTES"]["HIDDEN"]) ? $xmlArr["ATTRIBUTES"]["HIDDEN"] : null;
00094 $this->m_HTMLAttr = isset($xmlArr["ATTRIBUTES"]["HTMLATTR"]) ? $xmlArr["ATTRIBUTES"]["HTMLATTR"] : null;
00095 $this->m_ElementSet = isset($xmlArr["ATTRIBUTES"]["ELEMENTSET"]) ? $xmlArr["ATTRIBUTES"]["ELEMENTSET"] : null;
00096 $this->m_ElementSetCode = isset($xmlArr["ATTRIBUTES"]["ELEMENTSET"]) ? $xmlArr["ATTRIBUTES"]["ELEMENTSET"] : null;
00097 $this->m_TabSet = isset($xmlArr["ATTRIBUTES"]["TABSET"]) ? $xmlArr["ATTRIBUTES"]["TABSET"] : null;
00098 $this->m_TabSetCode = isset($xmlArr["ATTRIBUTES"]["TABSET"]) ? $xmlArr["ATTRIBUTES"]["TABSET"] : null;
00099 $this->m_Text = isset($xmlArr["ATTRIBUTES"]["TEXT"]) ? $xmlArr["ATTRIBUTES"]["TEXT"] : null;
00100 $this->m_Translatable = isset($xmlArr["ATTRIBUTES"]["TRANSLATABLE"]) ? $xmlArr["ATTRIBUTES"]["TRANSLATABLE"] : null;
00101 $this->m_FuzzySearch = isset($xmlArr["ATTRIBUTES"]["FUZZYSEARCH"]) ? $xmlArr["ATTRIBUTES"]["FUZZYSEARCH"] : null;
00102 $this->m_OnEventLog = isset($xmlArr["ATTRIBUTES"]["ONEVENTLOG"]) ? $xmlArr["ATTRIBUTES"]["ONEVENTLOG"] : null;
00103 $this->m_Required = isset($xmlArr["ATTRIBUTES"]["REQUIRED"]) ? $xmlArr["ATTRIBUTES"]["REQUIRED"] : null;
00104 $this->m_Validator = isset($xmlArr["ATTRIBUTES"]["VALIDATOR"]) ? $xmlArr["ATTRIBUTES"]["VALIDATOR"] : null;
00105 $this->m_ClientValidator = isset($xmlArr["ATTRIBUTES"]["CLIENTVALIDATOR"]) ? $xmlArr["ATTRIBUTES"]["CLIENTVALIDATOR"] : null;
00106 $this->m_AllowURLParam = isset($xmlArr["ATTRIBUTES"]["ALLOWURLPARAM"]) ? $xmlArr["ATTRIBUTES"]["ALLOWURLPARAM"] : 'Y';
00107 $this->m_KeepCookie = isset($xmlArr["ATTRIBUTES"]["KEEPCOOKIE"]) ? $xmlArr["ATTRIBUTES"]["KEEPCOOKIE"] : 'N';
00108 $this->m_CookieLifetime = isset($xmlArr["ATTRIBUTES"]["COOKIELIFETIME"]) ? (int)$xmlArr["ATTRIBUTES"]["COOKIELIFETIME"] : '3600';
00109
00110
00111 if (isset($xmlArr["EVENTHANDLER"]))
00112 $this->m_EventHandlers = new MetaIterator($xmlArr["EVENTHANDLER"],"EventHandler");
00113
00114 if ($this->m_EventHandlers != null)
00115 {
00116 foreach ($this->m_EventHandlers as $eventHandler)
00117 $eventHandler->setFormName($this->m_FormName, $this->m_Name);
00118 }
00119
00120
00121 $this->m_HTMLAttr .= " title='".$this->m_Description."'"." clientValidator='".$this->m_ClientValidator."'";
00122 }
00123
00129 protected function getFormObj()
00130 {
00131 return BizSystem::objectFactory()->getObject($this->m_FormName);
00132 }
00133
00134
00142 public function adjustFormName($formName)
00143 {
00144 if ($this->m_FormName == $formName)
00145 return;
00146 $this->m_FormName = $formName;
00147 if ($this->m_EventHandlers != null)
00148 {
00149 foreach ($this->m_EventHandlers as $eventHandler)
00150 $eventHandler->adjustFormName($this->m_FormName);
00151 }
00152 }
00153
00154 public function reset()
00155 {
00156 $this->m_Value = null;
00157 if ($this->m_EventHandlers != null)
00158 {
00159 foreach ($this->m_EventHandlers as $eventHandler)
00160 $eventHandler->m_FormedFunction = null;
00161 }
00162 }
00163
00169 public function setValue($value)
00170 {
00171 $this->m_Value = $value;
00172 if($this->m_KeepCookie=='Y'){
00173 if($value!=""){
00174 $formName = $this->getFormObj()->m_Name;
00175 setcookie($formName."-".$this->m_Name,$value,time()+(int)$this->m_CookieLifetime,"/");
00176 }
00177 }
00178 }
00179
00185 public function getValue()
00186 {
00187 return $this->m_Value;
00188 }
00189
00196 public function getProperty($propertyName)
00197 {
00198 if ($propertyName == "Value") return $this->m_Value;
00199 $ret = parent::getProperty($propertyName);
00200 if ($ret) return $ret;
00201 return $this->$propertyName;
00202 }
00203
00209 public function canDisplayed()
00210 {
00211 if (!$this->allowAccess())
00212 return false;
00213 if ($this->getHidden() == "Y")
00214 return false;
00215 return true;
00216 }
00217
00223 public function getDefaultValue()
00224 {
00225 if ($this->m_DefaultValue == "" && $this->m_KeepCookie!='Y')
00226 return "";
00227 $formObj = $this->getFormObj();
00228 if($this->m_KeepCookie=='Y'){
00229 $cookieName = $formObj->m_Name."-".$this->m_Name;
00230 $cookieName = str_replace(".","_",$cookieName);
00231 $defValue = $_COOKIE[$cookieName];
00232 }
00233 if(!$defValue){
00234 $defValue = Expression::evaluateExpression($this->m_DefaultValue, $formObj);
00235 }
00236
00237 if($this->m_DefaultValueRename!='N'){
00238 if(!is_numeric($defValue)){
00239 $dataobj = $formObj->getDataObj();
00240 if($this->m_FieldName && $dataobj){
00241 if(substr($this->m_FieldName,0,1)!='_'){
00242 $recs = $dataobj->directfetch("[".$this->m_FieldName."] = '$defValue' OR "."[".$this->m_FieldName."] LIKE '$defValue (%)'" );
00243 if($recs->count()>0){
00244 $defValue.= " ( ".$recs->count()." )";
00245 }
00246 }
00247 }
00248 }
00249 }
00250 return $defValue;
00251 }
00252
00258 public function render()
00259 {
00260 return "";
00261 }
00262
00263 public function renderLabel()
00264 {
00265 $sHTML = $this->translateString($this->m_Label);
00266 return $sHTML;
00267 }
00268
00274 protected function getHidden()
00275 {
00276 $formObj = $this->getFormObj();
00277 return Expression::evaluateExpression($this->m_Hidden, $formObj);
00278 }
00279
00285 protected function getStyle()
00286 {
00287 $formobj = $this->getFormObj();
00288 $htmlClass = Expression::evaluateExpression($this->m_cssClass, $formobj);
00289 $htmlClass = "CLASS='$htmlClass'";
00290 if(!$htmlClass){
00291 $htmlClass = null;
00292 }
00293 $style ='';
00294 if ($this->m_Width && $this->m_Width>=0)
00295 $style .= "width:".$this->m_Width."px;";
00296 if ($this->m_Height && $this->m_Height>=0)
00297 $style .= "height:".$this->m_Height."px;";
00298 if ($this->m_Style)
00299 $style .= $this->m_Style;
00300 if (!isset($style) && !$htmlClass)
00301 return null;
00302 if (isset($style))
00303 {
00304
00305 $style = Expression::evaluateExpression($style, $formobj);
00306 $style = "STYLE='$style'";
00307 }
00308 if($formobj->m_Errors[$this->m_Name])
00309 {
00310 $htmlClass = "CLASS='".$this->m_cssErrorClass."'";
00311 }
00312 if ($htmlClass)
00313 $style = $htmlClass." ".$style;
00314 return $style;
00315 }
00316
00317 protected function getBackgroundColor()
00318 {
00319 if ($this->m_BackgroundColor == null)
00320 return null;
00321 $formObj = $this->getFormObj();
00322 return Expression::evaluateExpression($this->m_BackgroundColor, $formObj);
00323 }
00324
00330 protected function getText()
00331 {
00332 if ($this->m_Text == null)
00333 return null;
00334 $formobj = $this->getFormObj();
00335 return Expression::evaluateExpression($this->m_Text, $formobj);
00336 }
00337
00338 public function getDescription()
00339 {
00340 if ($this->m_Description == null)
00341 return null;
00342 $formobj = $this->getFormObj();
00343 return Expression::evaluateExpression($this->m_Description, $formobj);
00344 }
00345
00351 public function getSCKeyFuncMap()
00352 {
00353 if (!$this->canDisplayed()) return null;
00354
00355 $map = array();
00359
00360
00361 if ($this->m_EventHandlers == null)
00362 return null;
00363 foreach ($this->m_EventHandlers as $eventHandler)
00364 {
00365 if ($eventHandler->m_ShortcutKey)
00366 {
00367 $map[$eventHandler->m_ShortcutKey] = $eventHandler->getFormedFunction();
00368 }
00369 }
00370 return $map;
00371 }
00372
00378 public function getContextMenu()
00379 {
00380 if (!$this->canDisplayed()) return null;
00381 $menus = array();
00382 $formObj = $this->getFormObj();
00383 if ($this->m_EventHandlers == null)
00384 return null;
00385 $i = 0;
00386 foreach ($this->m_EventHandlers as $eventHandler)
00387 {
00388 if ($eventHandler->m_ContextMenu)
00389 {
00390 $menus[$i]['text'] = $eventHandler->m_ContextMenu;
00391 $menus[$i]['func'] = $eventHandler->getFormedFunction();
00392 $menus[$i]['key'] = $eventHandler->m_ShortcutKey;
00393 }
00394 $i++;
00395 }
00396 return $menus;
00397 }
00398
00404 protected function getFunction()
00405 {
00406 $events = $this->getEvents();
00407 foreach ($events as $event=>$function){
00408 if(is_array($function)){
00409 foreach($function as $f){
00410 $function_str.=$f.";";
00411 }
00412 $func .= " $event=\"$function_str\"";
00413 }else{
00414 $func .= " $event=\"$function\"";
00415 }
00416 }
00417 return $func;
00418 }
00419
00420 public function getEvents(){
00421 $name = $this->m_Name;
00422
00423 $func = "";
00424
00425 $events = array();
00426
00427 if ($this->m_EventHandlers == null)
00428 return $events;
00429 $formobj = $this->getFormObj();
00430
00431 foreach ($this->m_EventHandlers as $eventHandler)
00432 {
00433 $ehName = $eventHandler->m_Name;
00434 $event = $eventHandler->m_Event;
00435 $type = $eventHandler->m_FunctionType;
00436 if (!$event) continue;
00437 if($events[$event]!=""){
00438 $events[$event]=array_merge(array($events[$event]),array($eventHandler->getFormedFunction()));
00439 }else{
00440 $events[$event]=$eventHandler->getFormedFunction();
00441 }
00442 }
00443 return $events;
00444 }
00445
00446 public function getFunctionByEventHandlerName($eventHandlerName)
00447 {
00448 if ($this->m_EventHandlers == null)
00449 return null;
00450 $eventHandler = $this->m_EventHandlers->get($eventHandlerName);
00451 if ($eventHandler)
00452 $func = Expression::evaluateExpression($eventHandler->m_Function, $formobj);
00453 return $func;
00454 }
00455
00462 public function getRedirectPage($eventHandlerName)
00463 {
00464 $formObj = $this->getFormObj();
00465 $eventHandler = $this->m_EventHandlers->get($eventHandlerName);
00466 if (!$eventHandler) return null;
00467
00468 return Expression::evaluateExpression($eventHandler->m_RedirectPage, $formObj);
00469 }
00470
00477 public function getParameter($eventHandlerName){
00478 $formObj = $this->getFormObj();
00479 $eventHandler = $this->m_EventHandlers->get($eventHandlerName);
00480 if (!$eventHandler) return null;
00481
00482 return Expression::evaluateExpression($eventHandler->m_Parameter, $formObj);
00483 }
00484
00491 public function getFunctionType($eventHandlerName)
00492 {
00493 $eventHandler = $this->m_EventHandlers->get($eventHandlerName);
00494 if (!$eventHandler) return null;
00495 return $eventHandler->m_FunctionType;
00496 }
00497
00503 public function checkRequired()
00504 {
00505 if (!$this->m_Required || $this->m_Required == "")
00506 return false;
00507 else if ($this->m_Required == "Y")
00508 $required = true;
00509 else if($required != "N")
00510 $required = false;
00511 else
00512 $required = Expression::evaluateExpression($this->m_Required, $this->getFormObj());
00513
00514 return $required;
00515 }
00516
00522 public function validate()
00523 {
00524 $ret = true;
00525 if ($this->m_Validator)
00526 $ret = Expression::evaluateExpression($this->m_Validator, $this->getFormObj());
00527 return $ret;
00528 }
00529
00535 public function getClientValidator()
00536 {
00537 if ($this->m_ClientValidator)
00538 return $this->m_ClientValidator;
00539
00540
00541 return null;
00542 }
00543
00544 public function matchRemoteMethod($method)
00545 {
00546 return false;
00547 }
00548
00549 protected function translate()
00550 {
00551 $module = $this->getModuleName($this->m_FormName);
00552 if (!empty($this->m_Text))
00553 $this->m_Text = I18n::t($this->m_Text, $this->getTransKey('Text'), $module);
00554 if (!empty($this->m_Label))
00555 $this->m_Label = I18n::t($this->m_Label, $this->getTransKey('Label'), $module);
00556 if (!empty($this->m_Description))
00557 $this->m_Description = I18n::t($this->m_Description, $this->getTransKey('Description'), $module);
00558 if (!empty($this->m_DefaultValue) && !preg_match("/\{/si",$this->m_DefaultValue))
00559 $this->m_DefaultValue = I18n::t($this->m_DefaultValue, $this->getTransKey('DefaultValue'), $module);
00560 if (!empty($this->m_ElementSet))
00561 $this->m_ElementSet = I18n::t($this->m_ElementSet, $this->getTransKey('ElementSet'), $module);
00562 if (!empty($this->m_TabSet))
00563 $this->m_TabSet = I18n::t($this->m_TabSet, $this->getTransKey('TabSet'), $module);
00564 }
00565
00566 protected function getTransKey($name)
00567 {
00568 $shortFormName = substr($this->m_FormName,intval(strrpos($this->m_FormName,'.')+1));
00569 return strtoupper($shortFormName.'_'.$this->m_Name.'_'.$name);
00570 }
00571
00572 protected function translateString($value)
00573 {
00574 $module = $this->getModuleName($this->m_FormName);
00575 if(defined($value)) $value = constant($value);
00576 return I18n::t($value, 'STRING_'.$value, $module);
00577 }
00578 }
00579
00588 class EventHandler
00589 {
00590 public $m_Name;
00591 public $m_Event;
00592 public $m_Function;
00593 public $m_FunctionType;
00594 public $m_PostAction;
00595 public $m_ShortcutKey;
00596 public $m_ContextMenu;
00597 public $m_RedirectPage;
00598 public $m_Parameter;
00599 public $m_EventLogMsg;
00600 public $m_FormedFunction;
00601 private $_formName;
00602 private $_elemName;
00603
00604
00605 public $m_URL;
00606
00613 function __construct(&$xmlArr)
00614 {
00615 $this->m_Name = isset($xmlArr["ATTRIBUTES"]["NAME"]) ? $xmlArr["ATTRIBUTES"]["NAME"] : null;
00616 $this->m_Event = isset($xmlArr["ATTRIBUTES"]["EVENT"]) ? $xmlArr["ATTRIBUTES"]["EVENT"] : null;
00617 $this->m_Function = isset($xmlArr["ATTRIBUTES"]["FUNCTION"]) ? $xmlArr["ATTRIBUTES"]["FUNCTION"] : null;
00618 $this->m_OrigFunction = $this->m_Function;
00619 $this->m_FunctionType = isset($xmlArr["ATTRIBUTES"]["FUNCTIONTYPE"]) ? $xmlArr["ATTRIBUTES"]["FUNCTIONTYPE"] : null;
00620 $this->m_PostAction = isset($xmlArr["ATTRIBUTES"]["POSTACTION"]) ? $xmlArr["ATTRIBUTES"]["POSTACTION"] : null;
00621 $this->m_ShortcutKey = isset($xmlArr["ATTRIBUTES"]["SHORTCUTKEY"]) ? $xmlArr["ATTRIBUTES"]["SHORTCUTKEY"] : null;
00622 $this->m_ContextMenu = isset($xmlArr["ATTRIBUTES"]["CONTEXTMENU"]) ? $xmlArr["ATTRIBUTES"]["CONTEXTMENU"] : null;
00623 $this->m_RedirectPage = isset($xmlArr["ATTRIBUTES"]["REDIRECTPAGE"]) ? $xmlArr["ATTRIBUTES"]["REDIRECTPAGE"] : null;
00624 $this->m_Parameter = isset($xmlArr["ATTRIBUTES"]["PARAMETER"]) ? $xmlArr["ATTRIBUTES"]["PARAMETER"] : null;
00625 $this->m_EventLogMsg = isset($xmlArr["ATTRIBUTES"]["EVENTLOGMSG"]) ? $xmlArr["ATTRIBUTES"]["EVENTLOGMSG"] : null;
00626 $this->m_URL = isset($xmlArr["ATTRIBUTES"]["URL"]) ? $xmlArr["ATTRIBUTES"]["URL"] : null;
00627 }
00628
00636 public function setFormName($formName, $elemName)
00637 {
00638 $this->_formName = $formName;
00639 $this->_elemName = $elemName;
00640 if (strpos($this->m_Function, "js:")===0)
00641 return;
00642
00643 if ($this->m_Function)
00644 {
00645 $pos_dot = strpos($this->m_Function, ".");
00646 $pos_lpt = strpos($this->m_Function, "(");
00647 if (!$pos_dot || $pos_lpt < $pos_dot)
00648 $this->m_Function = $this->_formName.".".$this->m_Function;
00649 }
00650 $this->translate();
00651 }
00652
00659 public function adjustFormName($formName)
00660 {
00661 $this->_formName = $formName;
00662
00663 if ($this->m_Function)
00664 {
00665 if(strtolower(substr($this->m_Function,0,3))!='js:'){
00666 $pos0 = strpos($this->m_Function, "(");
00667 $len = strlen($this->m_Function);
00668 if ($pos0 > 0)
00669 $pos = strrpos($this->m_Function, ".", $pos0-$len);
00670 else
00671 $pos = strrpos($this->m_Function, ".");
00672 if ($pos > 0)
00673 $this->m_Function = $this->_formName.".".substr($this->m_Function, $pos+1);
00674 }
00675 }
00676 }
00677
00683 public function getFormedFunction()
00684 {
00685
00686 $name = $this->_elemName;
00687 $ehName = $this->m_Name;
00688 $formobj = BizSystem::objectFactory()->getObject($this->_formName);
00689 if ($this->m_FormedFunction)
00690 {
00691 return $this->m_FormedFunction;
00692 }
00693 if (!$this->m_FormedFunction || $isDataPanelElement==true)
00694 {
00695
00696 if ($this->m_URL)
00697 {
00698 $_func = "loadPage('" . $this->m_URL . "');";
00699 $_func = Expression::evaluateExpression($_func, $formobj);
00700 }
00701 else if (strpos($this->m_Function, "js:") === 0)
00702 {
00703 $_func = substr($this->m_Function, 3).";";
00704 $_func = Expression::evaluateExpression($_func, $formobj);
00705 }
00706 else
00707 {
00708
00709
00710
00711 $_func = Expression::evaluateExpression($this->m_Function, $formobj);
00712 $options = "{'type':'$this->m_FunctionType','target':'','evthdl':'$name:$ehName'}";
00713 $_func = "Openbiz.CallFunction('$_func',$options);";
00714 }
00715 $this->m_FormedFunction = $_func;
00716 }
00717 return $this->m_FormedFunction;
00718 }
00719
00720 public function getInvokeAction()
00721 {
00722 if ($this->m_FormedFunction)
00723 return $this->m_FormedFunction;
00724 $name = $this->_elemName;
00725 $ehName = $this->m_Name;
00726 $formobj = BizSystem::objectFactory()->getObject($this->_formName);
00727
00728 if (!$this->m_FormedFunction)
00729 {
00730
00731 if ($this->m_URL)
00732 $_func = "loadPage('" . $this->m_URL . "');";
00733 else if (strpos($this->m_Function, "js:") === 0)
00734 $_func = substr($this->m_Function, 3).";";
00735 else
00736 {
00737 $temp = ($this->m_FunctionType==null) ? "" : ",'".$this->m_FunctionType."'";
00738
00739 list($funcName, $funcParams) = $this->parseFunction($this->m_Function);
00740 $funcParams = Expression::evaluateExpression($funcParams, $formobj);
00741 $action = "$name:$ehName";
00742
00743 $_func = "Openbiz.invoke('$this->_formName','$action','$funcParams'$temp);";
00744 }
00745
00746 $this->m_FormedFunction = $_func;
00747 }
00748 return $this->m_FormedFunction;
00749 }
00750
00751
00752 public function parseFunction($funcString)
00753 {
00754 $pos = strpos($funcString, "(");
00755 $pos1 = strpos($funcString, ")");
00756 if ($pos>0 && $pos1>$pos)
00757 {
00758 $funcName = substr($funcString,0,$pos);
00759 $funcParams = substr($funcString,$pos+1,$pos1-$pos-1);
00760 return array($funcName, $funcParams);
00761 }
00762 return null;
00763 }
00764
00765 protected function translate()
00766 {
00767 $module = substr($this->_formName,0,intval(strpos($this->_formName,'.')));
00768 if (!empty($this->m_ContextMenu))
00769 $this->m_ContextMenu = I18n::t($this->m_ContextMenu, $this->getTransKey('ContextMenu'), $module);
00770 }
00771
00772 protected function getTransKey($name)
00773 {
00774 $shortFormName = substr($this->m_FormName,intval(strrpos($this->m_FormName,'.'))+1);
00775 return strtoupper($shortFormName.'_'.$this->m_Name.'_'.$name);
00776 }
00777 }
00778 ?>