protected function getStyle() { $formobj = $this->getFormObj(); $htmlClass = Expression::evaluateExpression($this->m_cssClass, $formobj); $htmlClass = "CLASS='{$htmlClass}'"; if (!$htmlClass) { $htmlClass = null; } $style = ''; if ($this->m_Style) { $style .= $this->m_Style; } if (!isset($style) && !$htmlClass) { return null; } if (isset($style)) { $style = Expression::evaluateExpression($style, $formobj); $style = "STYLE='{$style}'"; } if ($formobj->m_Errors[$this->m_Name]) { $htmlClass = "CLASS='" . $this->m_cssErrorClass . "'"; } if ($htmlClass) { $style = $htmlClass . " " . $style; } return $style; }
/** * Render, draw the control according to the mode * * @return string HTML text */ public function render() { $value = $this->m_Value ? $this->m_Value : $this->getText(); $disabledStr = $this->getEnabled() == "N" ? "READONLY=\"true\"" : ""; $style = $this->getStyle(); $func = $this->getFunction(); $optionList = $this->renderList(); $htmlClass = Expression::evaluateExpression($this->m_cssClass, $formobj); $htmlClass = "CLASS='{$htmlClass}'"; $sHTML .= "<div class=\"div_" . $this->m_cssClass . "\" style=\"float:left;\">"; if ($this->m_ReadOnly == 'Y') { $display_input = "style=\"display:none;\""; $display_span = ""; } else { $display_span = "style=\"display:none;\""; $display_input = ""; } $sHTML .= "<div {$display_span}>"; $sHTML .= "<span ID=\"span_" . $this->m_Name . "\" {$this->m_HTMLAttr} {$style}\n\t\t \t\t\tonclick=\"if(\$('" . $this->m_Name . "_list').visible()){\$('" . $this->m_Name . "_list').hide();\$('" . $this->m_Name . "').className='" . $this->m_cssClass . "'}else{\$('" . $this->m_Name . "_list').show();\$('" . $this->m_Name . "').className='" . $this->m_cssFocusClass . "'}\"\n\t\t \t\t\tonmouseover=\"\$('span_" . $this->m_Name . "').className='" . $this->m_cssHoverClass . "'\"\n\t\t \t\t\tonmouseout=\"\$('span_" . $this->m_Name . "').className='" . $this->m_cssClass . "'\"\n\t\t \t\t\t>" . $this->m_DefaultDisplayValue . "</span>"; $sHTML .= "</div>"; $sHTML .= "<div {$display_input}>"; $sHTML .= "<INPUT NAME=\"" . $this->m_Name . "\" ID=\"" . $this->m_Name . "\" VALUE=\"" . $value . "\" {$disabledStr} {$this->m_HTMLAttr} {$style} {$func}\n\t\t \t\t\tonclick=\"if(\$('" . $this->m_Name . "_list').visible()){\$('" . $this->m_Name . "_list').hide();\$('" . $this->m_Name . "').className='" . $this->m_cssClass . "'}else{\$('" . $this->m_Name . "_list').show();\$('" . $this->m_Name . "').className='" . $this->m_cssFocusClass . "'}\"\n\t\t \t\t\tonmouseover=\"\$('" . $this->m_Name . "').className='" . $this->m_cssHoverClass . "'\"\n\t\t \t\t\tonmouseout=\"\$('" . $this->m_Name . "').className='" . $this->m_cssClass . "'\"\n\t\t \t\t\t/>"; $sHTML .= "</div>"; $sHTML .= $optionList; $sHTML .= "</div>"; $sHTML .= "<script>\$('" . $this->m_Name . "_list').hide()</script>"; return $sHTML; }
/** * Initialize Node * * @param array $rec * @return void */ function __construct($rec) { $this->m_Id = $rec['Id']; $this->m_PId = $rec['PId']; $this->m_Name = $rec['title']; $this->m_Module = $rec['module']; $this->m_Description = $rec['description']; $this->m_URL = $rec['link']; if (strpos($this->m_URL, '{') === 0) { $this->m_URL = Expression::evaluateExpression($this->m_URL, $this); } else { if (!empty($this->m_URL)) { if (strpos($this->m_URL, '/') === 0) { $this->m_URL = APP_INDEX . $this->m_URL; } else { $this->m_URL = APP_INDEX . '/' . $this->m_URL; } } } $this->m_URL_Match = $rec['alias']; //$this->m_CssClass = $rec['Id']; $this->m_IconImage = $rec['icon']; $this->m_IconCSSClass = $rec['icon_css']; $this->m_Access = $rec['access']; $this->translate(); // translate for multi-language support }
/** * Get style of element * * @return string style of Element */ protected function getStyle() { $htmlClass = $this->m_cssClass ? "class='" . $this->m_cssClass . "' " : "class='editcombobox'"; /* $width = $this->m_Width ? $this->m_Width : 146; $this->m_WidthInput = ($width-18).'px'; $this->m_Width = $width.'px'; $style = "position: absolute; width: $this->m_Width; z-index: 1; clip: rect(auto, auto, auto, $this->m_WidthInput);"; */ if ($this->m_Style) { $style .= $this->m_Style; } if (!isset($style) && !$htmlClass) { return null; } if (isset($style)) { $formObj = $this->getFormObj(); $style = Expression::evaluateExpression($style, $formObj); $style = "style='{$style}'"; } if ($htmlClass) { $style = $htmlClass . " " . $style; } return $style; }
/** * Get text of element * * @return string */ protected function getText() { if ($this->m_Text == null) { return null; } $formObj = $this->getFormObj(); return Expression::evaluateExpression($this->m_Text, $formObj); }
/** * Get link that evaluated by Expression::evaluateExpression * * @return string link */ protected function getLink() { if ($this->m_Link == null) { return null; } $formobj = $this->getFormObj(); return Expression::evaluateExpression($this->m_Link, $formobj); }
/** * Render smarty template for view object * * @param EasyView $viewObj * @param string $tplFile * @return string result of rendering process */ protected static function renderSmarty($viewObj, $tplFile) { $smarty = BizSystem::getSmartyTemplate(); $newClntObjs = ''; // render the viewobj attributes $smarty->assign("view", $viewObj->outputAttrs()); $smarty->assign("module", $viewObj->getModuleName($viewObj->m_Name)); if ($viewObj->m_Tiles) { foreach ($viewObj->m_Tiles as $tname => $tile) { foreach ($tile as $formRef) { if ($formRef->m_Display == false) { continue; } $tiles[$tname][$formRef->m_Name] = BizSystem::getObject($formRef->m_Name)->render(); $tiletabs[$tname][$formRef->m_Name] = $formRef->m_Description; } } } else { foreach ($viewObj->m_FormRefs as $formRef) { if ($formRef->m_Display == false) { continue; } $forms[$formRef->m_Name] = BizSystem::getObject($formRef->m_Name)->render(); $formtabs[$formRef->m_Name] = $formRef->m_Description; } } // add clientProxy scripts $includedScripts = BizSystem::clientProxy()->getAppendedScripts(); $styles = BizSystem::clientProxy()->getAppendedStyles(); if ($viewObj->m_IsPopup && $bReRender == false) { $moveToCenter = "moveToCenter(self, " . $viewObj->m_Width . ", " . $viewObj->m_Height . ");"; $scripts = $includedScripts . "\n<script>\n" . $newClntObjs . $moveToCenter . "</script>\n"; } else { $scripts = $includedScripts . "\n<script>\n" . $newClntObjs . "</script>\n"; } if ($viewObj->m_Title) { $title = Expression::evaluateExpression($viewObj->m_Title, $viewObj); } else { $title = $viewObj->m_Description; } $smarty->assign("scripts", $scripts); $smarty->assign("style_sheets", $styles); $smarty->assign("title", $title); $smarty->assign("description", $viewObj->m_Description); $smarty->assign("keywords", $viewObj->m_Keywords); $smarty->assign("forms", $forms); $smarty->assign("formtabs", $formtabs); $smarty->assign("tiles", $tiles); $smarty->assign("tiletabs", $tiletabs); if ($viewObj->m_ConsoleOutput) { $smarty->display(BizSystem::getTplFileWithPath($viewObj->m_TemplateFile, $viewObj->m_Package)); } else { return $smarty->fetch(BizSystem::getTplFileWithPath($viewObj->m_TemplateFile, $viewObj->m_Package)); } }
public function render() { $fromList = array(); $this->getFromList($fromList); $value = $this->getValue() != 'null' ? $this->getValue() : $this->getDefaultValue(); $value = $value === null ? $this->getDefaultValue() : $value; $valueArray = explode(',', $value); $disabledStr = $this->getEnabled() == "N" ? "DISABLED=\"true\"" : ""; $style = $this->getStyle(); $func = $this->getFunction(); $formobj = $this->GetFormObj(); if ($formobj->m_Errors[$this->m_Name]) { $func .= "onclick=\"this.className='{$this->m_cssClass}'\""; } else { $func .= "onmouseover=\"this.className='{$this->m_cssFocusClass}'\" onmouseout=\"this.className='{$this->m_cssClass}'\""; } $sHTML = "<input type=\"hidden\" NAME=\"" . $this->m_Name . "\" ID=\"" . $this->m_Name . "\" value=\"" . $value . "\" {$disabledStr} {$this->m_HTMLAttr} />"; $sHTML .= "<ul id=\"image_list_" . $this->m_Name . "\" {$style} {$func} >"; if ($this->m_BlankOption) { $entry = explode(",", $this->m_BlankOption); $text = $entry[0]; $value = $entry[1] != "" ? $entry[1] : null; $entryList = array(array("val" => $value, "txt" => $text)); $fromList = array_merge($entryList, $fromList); } foreach ($fromList as $option) { $test = array_search($option['val'], $valueArray); if ($test === false) { $selectedStr = 'normal'; } else { $selectedStr = "current"; } if ($this->m_Width) { $width_str = " width=\"" . $this->m_Width . "\" "; } if ($this->m_Height) { $height_str = " height=\"" . $this->m_Height . "\" "; } $image_url = $option['pic']; if (preg_match("/\\{.*\\}/si", $image_url)) { $formobj = $this->getFormObj(); $image_url = Expression::evaluateExpression($image_url, $formobj); } else { $image_url = Resource::getImageUrl() . "/" . $image_url; } $sHTML .= "<a title=\"" . $option['txt'] . "\" \n \t\t\t\thref=\"javascript:;\"\n \t\t\t\tclass=\"{$selectedStr}\"\n \t\t\t\tonclick =\"\$('" . $this->m_Name . "').value='" . $option['val'] . "'; \t\t\t\t\t\t\t\n \t\t\t\t\t\t\tOpenbiz.ImageSelector.reset('image_list_" . $this->m_Name . "');\n \t\t\t\t\t\t\tthis.className='current';\n \t\t\t\t\t\t\t\"\t\n \t\t\t>\n \t\t\t<img\n \t\t\t {$width_str} {$height_str}\n \t\t\t src=\"" . $image_url . "\" \n \t\t\t\ttitle=\"" . $option['txt'] . "\" \n \t\t\t\t /></a>"; } $sHTML .= "</ul>"; return $sHTML; }
protected function getSelectFrom() { $formobj = $this->getFormObj(); if (!BizSystem::allowUserAccess("data_assign.assign_to_other")) { $groups = BizSystem::getUserProfile("groups"); if ($groups) { $ids = implode(",", $groups); $selectFrom = $this->m_SelectFrom . ",[Id] IN ({$ids})"; } else { $selectFrom = $this->m_SelectFrom; } } else { $selectFrom = $this->m_SelectFrom; } return Expression::evaluateExpression($selectFrom, $formobj); }
public function render() { $value = $this->m_Value ? $this->m_Value : $this->m_Text; $disabledStr = $this->getEnabled() == "N" ? "READONLY=\"true\"" : ""; $style = $this->getStyle(); $func = $this->getFunction(); $formobj = $this->GetFormObj(); if ($formobj->m_Errors[$this->m_Name]) { $func .= "onchange=\"this.className='{$this->m_cssClass}'\""; } else { $func .= "onfocus=\"this.className='{$this->m_cssFocusClass}'\" onblur=\"this.className='{$this->m_cssClass}'\""; } $formObj = $this->getFormObj(); $this->m_AntiSpamImage = Expression::evaluateExpression($this->m_AntiSpamImage, $formObj); $sHTML = "<INPUT maxlength='" . $this->m_Lenght . "' NAME=\"" . $this->m_Name . "\" ID=\"" . $this->m_Name . "\" VALUE=\"" . $value . "\" {$disabledStr} {$this->m_HTMLAttr} {$style} {$func}>"; $sHTML .= "<IMG style='margin-left:10px;' BRODER='0' SRC=\"" . $this->m_AntiSpamImage . "?form=" . $formobj->m_Name . "&name=" . $this->m_Name . "&length=" . $this->m_Length . "&level=" . $this->m_SpamLevel . "&rand=" . rand() . "\" />"; return $sHTML; }
/** * Render, draw the element according to the mode * * @return string HTML text */ public function render() { $value = $this->m_Value; $name = $this->m_Name . '[]'; $style = $this->getStyle(); if ($this->m_CheckStatus) { $formObj = $this->getFormObj(); $testResult = Expression::evaluateExpression($this->m_CheckStatus, $formObj); if ($testResult) { $checkStatus = " checked=\"checked\" "; } else { $checkStatus = ""; } } else { $checkStatus = ""; } $sHTML = "<INPUT TYPE=\"CHECKBOX\" {$checkStatus} NAME=\"{$name}\" VALUE='{$value}' onclick=\"event.cancelBubble=true;\" {$this->m_HTMLAttr} {$style}/>"; return $sHTML; }
public function render() { $formobj = $this->getFormObj(); $this->m_TotalPage = Expression::evaluateExpression($this->m_TotalPage, $formobj); $this->m_CurrentPage = Expression::evaluateExpression($this->m_CurrentPage, $formobj); $style = $this->getStyle(); $id = $this->m_Name; $func = $this->getFunction(); $sHTML = ""; $link = $this->getLink(); $target = $this->getTarget(); for ($i = 1; $i < $this->m_TotalPage + 1; $i++) { if ($i == $this->m_CurrentPage) { $sHTML .= "<a id=\"{$id}\" href=\"" . $link . $i . "\" {$target} {$func} class=\"" . $this->m_CurrentCss . "\">" . $i . "</a>"; } else { $sHTML .= "<a id=\"{$id}\" href=\"" . $link . $i . "\" {$target} {$func} {$style}>" . $i . "</a>"; } } return $sHTML; }
/** * Render, draw the control according to the mode * * @return string HTML text */ public function render() { $this->m_Prefix = Expression::evaluateExpression($this->m_Prefix, $formobj); $func = $this->getFunction(); if ($this->m_Width) { $width_str = " width=\"" . $this->m_Width . "\" "; } if ($this->m_Height) { $height_str = " height=\"" . $this->m_Height . "\" "; } $value = $this->getText() ? $this->getText() : $this->getValue(); if ($value) { if ($this->m_Link) { $link = $this->getLink(); $target = $this->getTarget(); $sHTML = "<a href=\"{$link}\" {$target} {$func} {$style}>" . "<img src=\"" . $this->m_Prefix . $value . "\" border=\"0\" {$width_str} {$height_str} />" . "</a>"; } else { $sHTML = "<img border=\"0\" src=\"" . $this->m_Prefix . $value . "\" {$func} {$width_str} {$height_str} />"; } } return $sHTML; }
public function render() { $value = $this->m_Text ? $this->getText() : $this->m_Value; if ($this->m_Color) { $formObj = $this->getFormObj(); $color = Expression::evaluateExpression($this->m_Color, $formObj); if (!$color) { $color = '33b5fb'; } $bgcolor_str = "background-color: #" . $color . ";"; } else { $bgcolor_str = "background-color: #33b5fb;"; } if ($this->m_DisplayFormat) { $value = sprintf($this->m_DisplayFormat, $value); } if ($this->m_Percent == 'Y') { $value = sprintf("%.2f", $value * 100) . '%'; } $style = $this->getStyle(); $id = $this->m_Name; $func = $this->getFunction(); $height = $this->m_Height; $width = $this->m_Width - 80; $max_value = Expression::evaluateExpression($this->m_MaxValue, $this->getFormObj()); $width_rate = $value / $max_value; if ($width_rate > 1) { $width_rate = 1; } $width_bar = (int) ($width * $width_rate); if (!preg_match("/MSIE 6/si", $_SERVER['HTTP_USER_AGENT'])) { $bar_overlay = "<span class=\"bar_data_bg\" style=\"" . $bgcolor_str . "height:" . $height . "px;width:" . $width_bar . "px;\"></span>"; $bar = "<span class=\"bar_data\" style=\"" . $bgcolor_str . "height:" . $height . "px;width:" . $width_bar . "px;\"></span>"; } else { $bar = "<span class=\"bar_data\" style=\"" . $bgcolor_str . "height:" . $height . "px;width:" . $width_bar . "px;opacity: 0.4;filter: alpha(opacity=40);\"></span>"; } $sHTML = "\n \t<span id=\"{$id}\" {$func} {$style} >\n \t\t\n \t\t<span class=\"bar_bg\" style=\"height:" . $height . "px;width:" . $width . "px;\"> \t\t\t\n \t\t{$bar_overlay}\n \t\t{$bar}\t \n \t\t</span>\n \t\t\n \t\t<span class=\"value\" style=\"text-align:left;text-indent:10px;\">{$value}" . $this->m_DisplayUnit . "</span>\n \t</span>\n \t"; return $sHTML; }
function readMetadata($xmlArr) { $this->m_Id = $xmlArr["ATTRIBUTES"]["ID"]; $this->m_Name = $xmlArr["ATTRIBUTES"]["NAME"]; $this->m_Description = $xmlArr["ATTRIBUTES"]["DESCRIPTION"]; $this->m_URL = $xmlArr["ATTRIBUTES"]["URL"]; $this->m_URL = Expression::evaluateExpression($this->m_URL, $this); $this->m_URL_Match = $xmlArr["ATTRIBUTES"]["URLMATCH"]; $this->m_Target = $xmlArr["ATTRIBUTES"]["TARGET"]; $this->m_CssClass = $xmlArr["ATTRIBUTES"]["CSSCLASS"]; $this->m_IconImage = $xmlArr["ATTRIBUTES"]["ICONIMAGE"]; $this->m_IconCSSClass = $xmlArr["ATTRIBUTES"]["ICONCSSCLASS"]; if (is_array($xmlArr["MENUITEM"])) { $this->m_ChildNodes = array(); if (isset($xmlArr["MENUITEM"]["ATTRIBUTES"])) { $this->m_ChildNodes[$xmlArr["MENUITEM"]["ATTRIBUTES"]["ID"]] = new MenuItemObj($xmlArr["MENUITEM"], $this->m_Id); } else { foreach ($xmlArr["MENUITEM"] as $menuItem) { $this->m_ChildNodes[$menuItem["ATTRIBUTES"]["ID"]] = new MenuItemObj($menuItem, $this->m_Id); } } } }
protected function getRequired() { $formObj = $this->getFormObj(); return Expression::evaluateExpression($this->m_Required, $formObj); }
/** * Render element, according to the mode * * @return string HTML text */ public function render() { $style = $this->getStyle(); $text = $this->getText(); $id = $this->m_Name; $func = $this->getFunction(); switch ($this->getValue()) { case "0": $image_url = $this->m_MyPrivateImg; break; case "1": $image_url = $this->m_MySharedImg; break; case "2": $image_url = $this->m_GroupSharedImg; break; case "3": $image_url = $this->m_OtherSharedImg; break; case "4": $image_url = $this->m_MyAssignedImg; break; case "5": $image_url = $this->m_MyDistributedImg; break; default: if ($this->m_DefaultImg == '{RESOURCE_URL}/common/images/icon_data_shared_other.gif') { $this->m_DefaultImg = $this->m_OtherSharedImg; } $image_url = $this->m_DefaultImg; break; } if (preg_match("/\\{.*\\}/si", $image_url)) { $formobj = $this->getFormObj(); $image_url = Expression::evaluateExpression($image_url, $formobj); } else { $image_url = Resource::getImageUrl() . "/" . $image_url; } if ($this->m_Width) { $width = "width=\"{$this->m_Width}\""; } if ($this->m_Link) { $link = $this->getLink(); $target = $this->getTarget(); $sHTML = "<a id=\"{$id}\" href=\"{$link}\" {$target} {$func} {$style}><img {$width} src='{$image_url}' /></a>"; } else { $sHTML = "<img id=\"{$id}\" alt=\"" . $text . "\" title=\"" . $text . "\" {$width} src='{$image_url}' />"; } return $sHTML; }
/** * Check if the field has valid value * * @return boolean true if validation is good */ public function validate() { $ret = true; if ($this->m_Validator) { $ret = Expression::evaluateExpression($this->m_Validator, $this->getDataObj()); } return $ret; }
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; }
/** * Render this view. This function is called by Render() or ReRender() * * @return mixed either print html content or return html content if called by Render(), or void if called by ReRender() */ protected function _render($bReRender = false, $smarty = false) { if ($smarty == false) { $smarty = BizSystem::getSmartyTemplate(); } global $g_BizSystem; if ($bReRender == false) { $this->setClientScripts(); } // todo: should enforce rendering parent form before rendering subforms, // because subform's dataobj is a objreference of the parent dataobj. foreach ($this->m_ChildFormList as $form => $formobj) { if ($bReRender) { if (BizSystem::clientProxy()->hasFormRerendered($form) == false) { $formobj->rerender(); } $sHTML = BizSystem::clientProxy()->GetFormOutput($form); } $sHTML = $formobj->render(); $htmlStyle = $this->_getHTMLStyle($formobj); //Modification: html attribute added to set the initial style for a form //Add: Next 5 lines was added for get the initial style from a form and after set it in bizview --jmmz $style = $formobj->m_Style ? Expression::evaluateExpression($formobj->m_Style, $formobj) : ''; $htmlStyle = ""; //jmmz if (!empty($style) && !is_null($style)) { //jmmz $htmlStyle = "style='{$style}'"; //jmmz } //jmmz //Modification: html attribute added to set the initial style for a form --jmmz $controls[] = "\n<div id='" . $formobj->m_Name . "_container' {$htmlStyle}>\n" . $sHTML . "\n</div>\n"; $forms[str_replace(".", "_", $formobj->m_Name)] = "\n<div id='" . $formobj->m_Name . "_container'>\n" . $sHTML . "\n</div>\n"; if (isset($formobj->m_jsClass)) { $newClntObjs .= "NewObject('" . $formobj->m_Name . "','" . $formobj->m_jsClass . "'); \n"; } //$newClntObjs .= "var fobj=GetObject('".$formobj->m_Name."');\n"; } // add clientProxy scripts if ($bReRender == false) { $includedScripts = BizSystem::clientProxy()->getAppendedScripts(); $styles = BizSystem::clientProxy()->getAppendedStyles(); } if ($this->m_IsPopup && $bReRender == false) { $moveToCenter = "moveToCenter(self, " . $this->m_Width . ", " . $this->m_Height . ");"; $scripts = $includedScripts . "\n<script>\n" . $newClntObjs . $moveToCenter . "</script>\n"; } else { $scripts = $includedScripts . "\n<script>\n" . $newClntObjs . "</script>\n"; } $smarty->assign("scripts", $scripts); $smarty->assign("style_sheets", $styles); $smarty->assign_by_ref("view_description", $this->m_Description); $smarty->assign_by_ref("controls", $controls); $smarty->assign_by_ref("forms", $forms); if ($this->m_ConsoleOutput) { $smarty->display(BizSystem::getTplFileWithPath($this->m_Template, $this->m_Package)); } else { return $smarty->fetch(BizSystem::getTplFileWithPath($this->m_Template, $this->m_Package)); } }
/** * Get output attributs as array * * @return array array of attributs * @todo rename to getOutputAttribute or getAttribute (2.5?) */ public function outputAttrs() { $output['name'] = $this->m_Name; $output['dataService'] = $this->m_DataService; $output['queryString'] = $this->m_QueryString; $output['title'] = Expression::evaluateExpression($this->m_Title, $this); $output['icon'] = $this->m_Icon; $output['hasSubform'] = $this->m_SubForms ? 1 : 0; $output['currentPage'] = $this->m_CurrentPage; $output['currentRecordId'] = $this->m_RecordId; $output['totalPages'] = $this->m_TotalPages; $output['totalRecords'] = $this->m_TotalRecords; $output['description'] = str_replace('\\n', "<br />", Expression::evaluateExpression($this->m_Description, $this)); $output['elementSets'] = $this->getElementSet(); $output['tabSets'] = $this->getTabSet(); $output['ActionElementSets'] = $this->getElementSet($this->m_ActionPanel); if ($output['icon']) { if (preg_match("/{.*}/si", $output['icon'])) { $output['icon'] = Expression::evaluateExpression($output['icon'], null); } else { $output['icon'] = THEME_URL . "/" . Resource::getCurrentTheme() . "/images/" . $output['icon']; } } return $output; }
/** * Get enable status * * @return string */ protected function getEnabled() { $formObj = $this->getFormObj(); //echo 'getenabled='.$this->m_Enabled; return Expression::evaluateExpression($this->m_Enabled, $formObj); }
protected function getSelectFromSQL($selectFrom) { return Expression::evaluateExpression($selectFrom, null); }
/** * Execute action * * @param TriggerAction $triggerAction * @param BizDataObj $dataObj * @return void */ protected function executeAction($triggerAction, $dataObj) { // action method $methodName = $triggerAction->m_Action; // action method arguments if (method_exists($this, $methodName)) { // evaluate arguments as expression support foreach ($triggerAction->m_ArgList as $argName => $argValue) { $argList[$argName] = Expression::evaluateExpression($argValue, $dataObj); } // check the immediate flag if ($triggerAction->m_Immediate == "Y") { // call the method if Immediate is "Y" $this->{$methodName}($argList); } else { // put it to a passive queue /* $passiveQueueSvc->Push($methodName, $argList, $triggerAction->m_DelayMinutes, $triggerAction->m_RepeatMinutes); */ } } }
protected function getSelectFromSQL() { $formobj = $this->getFormObj(); return Expression::evaluateExpression($this->m_SelectFromSQL, $formobj); }
/** * Get output attributs * * @return array * @todo need to raname to getOutputAttributs() or getAttributes */ public function outputAttrs() { $out['name'] = $this->m_Name; $out['description'] = $this->m_Description; $out["keywords"] = $this->m_Keywords; if ($this->m_Title) { $title = Expression::evaluateExpression($this->m_Title, $this); } else { $title = $this->m_Description; } $out['title'] = $title; return $out; }
/** * FieldControl::render() - Draw the control according to the mode * * @returns stirng HTML text */ public function render() { $val = $this->m_Value; $temp = $this->m_FunctionType == null ? "" : ",'" . $this->m_FunctionType . "'"; if ($this->m_Image) { $val = "<img src=\"" . Resource::getImageUrl() . "/" . $this->m_Image . "\" border=0> {$val}"; } // todo: don't use deperated m_Function and m_FunctionType if ($val !== null && $this->m_Function) { $funcExpr = Expression::evaluateExpression($this->m_Function, $this->getFormObj()); $val = "<a href=\"javascript:CallFunction('" . $funcExpr . "'{$temp})\">{$val}</a>"; } //if ($this->m_Mode != MODE_E && $this->m_Mode != MODE_N && $this->m_Mode != MODE_Q) // $tmpMode = 'READ'; if ($this->m_Mode == null) { $tmpMode = 'READ'; } else { $tmpMode = $this->m_Mode; } if (($val === null || $val === "") && $tmpMode == MODE_R) { //$val = " "; $val = ""; } if ($tmpMode == MODE_R && $this->m_Link) { $link = $this->getLink(); $val = "<a href=\"{$link}\">" . $val . "</a>"; } if ($tmpMode == MODE_R && $this->m_DrillDownLink) { $otherCtrl = $this->getFormObj()->GetControl($this->m_DrillDownLink["my_ctrl"]); $this->m_DrillDownLink["my_ctrl_val"] = $otherCtrl->getValue(); $rule = $this->m_DrillDownLink["link_form"] . "." . $this->m_DrillDownLink["link_ctrl"] . "=\\'" . $this->m_DrillDownLink["my_ctrl_val"] . "\\'"; $val = "<a href=javascript:DrillDownToView('" . $this->m_DrillDownLink["link_view"] . "','{$rule}')>" . $val . "</a>"; } if ($tmpMode == MODE_R) { $val = nl2br($val); } if ($tmpMode != MODE_R) { $ctrlName = $this->m_Name; $cType = strtoupper($this->m_Type); if ($cType == "DATE") { $val = $this->renderDate(); } else { if ($cType == "DATETIME") { $val = $this->renderDatetime(); } else { $val = parent::render(); if ($this->m_ValuePicker != null) { $function = $this->m_BizFormName . ".ShowPopup(" . $this->m_ValuePicker . "," . $ctrlName . ")"; $val .= " <input type=button onClick=\"CallFunction('{$function}','Popup');\" value=\"...\" style='width:20px;'>"; } } } } return $val; }
/** * Convert search/sort rule to sql clause, replace [fieldName] with table.column * openbiz SQL expression as : * "[fieldName] opr 'Value' AND/OR [fieldName] opr 'Value'...". "()" is valid syntax * * @param BizDataObj $dataObj * @param string $rule "[fieldName] ..." * @return string sql statement **/ private function _ruleToSql($dataObj, $rule) { $cacheKey = $dataObj->m_Name . "-" . $rule; if (isset($this->_doRuleCache[$cacheKey])) { return $this->_doRuleCache[$cacheKey]; } //echo " _ruleToSql ".$dataObj->m_Name." ". $rule."\n"; $dataSqlObj = $this->getDataSqlObj(); $rule = Expression::evaluateExpression($rule, $dataObj); // replace all [field] with table.column // use regexp to find [] parts and replace with fields if (!preg_match_all("/\\[([0-9a-zA-Z_]+)\\]/", $rule, $m)) { $this->_doRuleCache[$cacheKey] = $rule; return $rule; } foreach ($m[1] as $fld) { $bizFld = $dataObj->getField($fld); if (!$bizFld) { continue; } $fld_pattern = "[" . $bizFld->m_Name . "]"; if ($bizFld->m_Column && strpos($bizFld->m_Column, ',') != 0) { // handle composite key. if (!preg_match('/\\[' . $bizFld->m_Name . '\\].*=.*\'(.+)\'/', $rule, $matches)) { continue; } //print_r($matches); $keyval = $matches[1]; // replace the matching part [compkey field]='value' $compkey_value = $this->_compKeyRuleToSql($bizFld->m_Column, $keyval); $rule = $str_replace($matches[0], $compkey_value, $rule); } else { if ($bizFld->m_Alias) { $rule = str_replace($fld_pattern, $bizFld->m_Alias, $rule); } elseif ($bizFld->m_SqlExpression) { $rule = str_replace($fld_pattern, $bizFld->m_SqlExpression, $rule); } else { $tableColumn = $dataSqlObj->getTableColumn($bizFld->m_Join, $bizFld->m_Column); $rule = str_replace($fld_pattern, $tableColumn, $rule); } } } $this->_doRuleCache[$cacheKey] = $rule; return $rule; }
/** * Get output attributs * * @return array * @todo need to raname to getOutputAttributs() or getAttributes */ public function outputAttrs() { $out['name'] = $this->m_Name; $out['module'] = $this->getModuleName($this->m_Name); $out['description'] = $this->m_Description; $out["keywords"] = $this->m_Keywords; if ($this->m_Title) { $title = Expression::evaluateExpression($this->m_Title, $this); } else { $title = $this->m_Description; } $out['title'] = $title; $out['partial_render'] = $_REQUEST['partial']; return $out; }
/** * Gather all template variables needed. Should play well with Smarty or Zend templates * * @param EasyView $viewObj * @return array associative array holding all needed VIEW based template variables */ public static function buildTemplateAttributes($viewObj) { // Assocative Array to hold all Template Values // Fill with default viewobj attributes //$tplAttributes = $viewObj->outputAttrs(); //Not sure what this is doing... $newClntObjs = ''; //Fill other direct view variables $tplAttributes["module"] = $viewObj->getModuleName($viewObj->m_Name); $tplAttributes["description"] = $viewObj->m_Description; $tplAttributes["keywords"] = $viewObj->m_Keywords; if ($viewObj->m_Tiles) { foreach ($viewObj->m_Tiles as $tname => $tile) { foreach ($tile as $formRef) { if ($formRef->m_Display == false) { continue; } $tiles[$tname][$formRef->m_Name] = BizSystem::getObject($formRef->m_Name)->render(); $tiletabs[$tname][$formRef->m_Name] = $formRef->m_Description; } } } else { foreach ($viewObj->m_FormRefs as $formRef) { if ($formRef->m_Display == false) { continue; } $forms[$formRef->m_Name] = BizSystem::getObject($formRef->m_Name)->render(); $formtabs[$formRef->m_Name] = $formRef->m_Description; } } if (count($viewObj->m_Widgets)) { foreach ($viewObj->m_Widgets as $formRef) { if ($formRef->m_Display == false) { continue; } $widgets[$formRef->m_Name] = BizSystem::getObject($formRef->m_Name)->render(); } } //Fill Loop related data $tplAttributes["forms"] = $forms; $tplAttributes["widgets"] = $widgets; $tplAttributes["formtabs"] = $formtabs; $tplAttributes["tiles"] = $tiles; $tplAttributes["tiletabs"] = $tiletabs; // add clientProxy scripts $includedScripts = BizSystem::clientProxy()->getAppendedScripts(); $tplAttributes["style_sheets"] = BizSystem::clientProxy()->getAppendedStyles(); if ($viewObj->m_IsPopup && $bReRender == false) { $moveToCenter = "moveToCenter(self, " . $viewObj->m_Width . ", " . $viewObj->m_Height . ");"; $tplAttributes["scripts"] = $includedScripts . "\n<script>\n" . $newClntObjs . $moveToCenter . "</script>\n"; } else { $tplAttributes["scripts"] = $includedScripts . "\n<script>\n" . $newClntObjs . "</script>\n"; } if ($viewObj->m_Title) { $tplAttributes["title"] = Expression::evaluateExpression($viewObj->m_Title, $viewObj); } else { $tplAttributes["title"] = $viewObj->m_Description; } if (DEFAULT_SYSTEM_NAME) { $tplAttributes["title"] = $tplAttributes["title"] . ' - ' . DEFAULT_SYSTEM_NAME; } return $tplAttributes; }