/** * Render element, according to the mode * * @return string HTML text */ public function render() { // create ng-src="$image_path/{{dataobj.fieldname==1 && $this->m_TrueImg | $this->m_FalseImg}}" $imagePath = Resource::getImageUrl(); $imgsrcText = "ng-src=\"{$imagePath}/{{dataobj." . $this->m_FieldName . "==1 && '{$this->m_TrueImg}' || '{$this->m_FalseImg}'}}\""; //$imgsrcText = "ng-src='".$imagePath."/$this->m_TrueImg'"; $id = $this->m_Name; $sHTML = "<img id=\"{$id}\" {$imgsrcText}/>"; return $sHTML; }
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; }
/** * Render, draw the element according to the mode * * @return string HTML text */ public function render() { $value = $this->m_Text ? $this->getText() : $this->m_Value; if ($value == null || $value == "") { return ""; } $style = $this->getStyle(); $id = $this->m_Name; $func = $this->getFunction(); if ($this->m_Translatable == 'Y') { $value = $this->translateString($value); } if ((int) $this->m_MaxLength > 0) { if (function_exists('mb_strlen') && function_exists('mb_substr')) { if (mb_strlen($value, 'UTF8') > (int) $this->m_MaxLength) { $value = mb_substr($value, 0, (int) $this->m_MaxLength, 'UTF8') . '...'; } } else { if (strlen($value) > (int) $this->m_MaxLength) { $value = substr($value, 0, (int) $this->m_MaxLength) . '...'; } } } /* * it is important converting not just nl2br * */ //$value = htmlentities($value); $value = htmlentities($value, ENT_QUOTES, "UTF-8"); $value = str_replace("\n\n", "\n<img src=\"" . Resource::getImageUrl() . "/spacer.gif\" style=\"display:block;height:10px;\">", $value); $value = nl2br($value); if ($value != null) { if ($this->m_DisplayFormat) { $value = sprintf($this->m_DisplayFormat, $value); } if ($this->m_Percent == 'Y') { $value = sprintf("%.2f", $value * 100) . '%'; } if ($this->m_Link) { $link = $this->getLink(); $target = $this->getTarget(); //$sHTML = "<a href=\"$link\" onclick=\"SetOnLoadNewView();\" $style>" . $val . "</a>"; $sHTML = "<a id=\"{$id}\" href=\"{$link}\" {$target} {$func} {$style}>" . $value . "</a>"; } else { $sHTML = "<span {$style} {$func}>" . $value . "</span>"; } } return $sHTML; }
/** * When render table, it return the table header; when render array, it return the display name * * @return string HTML text */ public function renderLabel() { if ($this->m_Sortable == "Y") { //$rule = "[" . $this->m_BizFieldName . "]"; $rule = $this->m_Name; $function = $this->m_FormName . ".SortRecord(" . $rule . ")"; $sHTML = "<a href=javascript:CallFunction('" . $function . "')>" . $this->m_Label . "</a>"; if ($this->m_SortFlag == "ASC") { $sHTML .= "<img src=\"" . Resource::getImageUrl() . "/up_arrow.gif\" />"; } elseif ($this->m_SortFlag == "DESC") { $sHTML .= "<img src=\"" . Resource::getImageUrl() . "/down_arrow.gif\" />"; } } else { $sHTML = $this->m_Label; } return $sHTML; }
public function render() { $func_up = $this->getBtnFunction('fld_sortorder_up'); $func_down = $this->getBtnFunction('fld_sortorder_down'); $formobj = $this->getFormObj(); //$this->m_EventHandlers = null; $value = $this->m_Text ? $this->getText() : $this->m_Value; if ($value === null || $value === "") { return ""; } $style = $this->getStyle(); $id = $this->m_Name; if ($this->m_Translatable == 'Y') { $value = $this->translateString($value); } if ((int) $this->m_MaxLength > 0) { if (function_exists('mb_strlen') && function_exists('mb_substr')) { if (mb_strlen($value, 'UTF8') > (int) $this->m_MaxLength) { $value = mb_substr($value, 0, (int) $this->m_MaxLength, 'UTF8') . '...'; } } else { if (strlen($value) > (int) $this->m_MaxLength) { $value = substr($value, 0, (int) $this->m_MaxLength) . '...'; } } } if ($value !== null) { if ($this->m_DisplayFormat) { $value = sprintf($this->m_DisplayFormat, $value); } if ($this->m_Percent == 'Y') { $value = sprintf("%.2f", $value * 100) . '%'; } if ($this->m_Link) { $link = $this->getLink(); $target = $this->getTarget(); //$sHTML = "<a href=\"$link\" onclick=\"SetOnLoadNewView();\" $style>" . $val . "</a>"; $sHTML = "<a id=\"{$id}\" href=\"{$link}\" {$target} {$func} {$style}>" . $value . "</a>"; } else { $sHTML = "<span style=\"width:auto;height:auto;line-height:16px;\" {$func}>" . $value . "</span>"; } } $sHTML = "<a {$func_up} class=\"arrow_up\" href=\"javascript:;\"><img src=\"" . Resource::getImageUrl() . "/spacer.gif" . "\" style=\"width:12px;height:12px;\" /></a> " . $sHTML . " <a {$func_down} class=\"arrow_down\" href=\"javascript:;\"><img src=\"" . Resource::getImageUrl() . "/spacer.gif" . "\" style=\"width:12px;height:12px;\" /></a>"; return $sHTML; }
/** * Render element, according to the mode * * @return string HTML text */ public function render() { $style = $this->getStyle(); $func = $this->getEnabled() == 'N' ? "" : $this->getFunction(); $id = $this->m_Name; if ($this->m_Image) { $imagesPath = Resource::getImageUrl(); $out = "<img src=\"{$imagesPath}/" . $this->m_Image . "\" border=0 title=\"" . $this->m_Text . "\" />"; if ($func != "") { $out = "<a href='javascript:void(0);' {$this->m_HTMLAttr} {$style} {$func}>" . $out . "</a>"; } } else { $out = $this->getText(); //$out = "<input id=\"$id\" type='button' value='$out' $this->m_HTMLAttr $style $func>"; $out = "<a href='javascript:void(0);' {$this->m_HTMLAttr} {$style} {$func}>" . $out . "</a>"; } return $out . "\n" . $this->addSCKeyScript(); }
/** * Render element, according to the mode * * @return string HTML text */ public function render() { $val = $this->m_Value; $style = $this->getStyle(); $id = $this->m_Name; $func = $this->getFunction(); if ($val === '1' || $val == 'true' || strtoupper($val) == 'Y' || $val > 0 || $val == $this->m_TrueValue) { $image_url = $this->m_TrueImg; } else { $image_url = $this->m_FalseImg; } if ($this->m_Link) { $link = $this->getLink(); $target = $this->getTarget(); $sHTML = "<a id=\"{$id}\" href=\"{$link}\" {$target} {$func} {$style}><img src='" . Resource::getImageUrl() . "/{$image_url}' /></a>"; } else { $sHTML = "<span id=\"{$id}\" ><img src='" . Resource::getImageUrl() . "/{$image_url}' /></span>"; } return $sHTML; }
/** * Render datetime type field * @return string html content of this control */ protected function renderDatetime() { // get the raw date value by unformatting it or geting the raw data from dataobj $format = $this->getFormObj()->getDataObj()->getField($this->m_BizFieldName)->m_Format; $val = parent::render(); $showTime = "'24'"; $img = "<img src=\"" . Resource::getImageUrl() . "/calendar.gif\" border=0 title=\"Select date...\" align='absoultemiddle' hspace='2'>"; $val .= "<a href=\"javascript: void(0);\" onclick=\"return showCalendar('" . $this->m_Name . "', '" . $format . "', " . $showTime . ", true); return false;\" onmousemove='window.status=\"Select a datetime\"' onmouseout='window.status=\"\"'>" . $img . "</a>"; return $val; }
/** * 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; }
/** * Render single node item * * @param array $nodeItem * @return <type> */ protected function renderSingleNodeItem(&$nodeItem) { $url = $nodeItem["ATTRIBUTES"]["URL"]; $caption = I18n::getInstance()->translate($nodeItem["ATTRIBUTES"]["CAPTION"]); $target = $nodeItem["ATTRIBUTES"]["TARGET"]; //$img = $nodeItem["ATTRIBUTES"]["IMAGE"]; if ($nodeItem["NODE"]) { $image = "<img src='" . Resource::getImageUrl() . "/plus.gif' class='collapsed' onclick='mouseClickHandler(this)'>"; } else { $image = "<img src='" . Resource::getImageUrl() . "/topic.gif'>"; } if ($target) { if ($url) { $sHTML .= "<li class='tree'>{$image} <a href=\"" . $url . "\" target='{$target}'>" . $caption . "</a>"; } else { $sHTML .= "<li class='tree'>{$image} {$caption}"; } } else { if ($url) { $sHTML .= "<li class='tree'>{$image} <a href=\"" . $url . "\">" . $caption . "</a>"; } else { $sHTML .= "<li class='tree'>{$image} {$caption}"; } } if ($nodeItem["NODE"]) { $sHTML .= "\n<ul class='collapsed'>\n"; $sHTML .= $this->renderNodeItems($nodeItem["NODE"]); $sHTML .= "</ul>"; } $sHTML .= "</li>\n"; return $sHTML; }
/** * Render single menu item * @param array $menuItem menu item metadata xml array * @return string html content of each menu item */ protected function renderSingleMenuItem(&$menuItem) { global $g_BizSystem; $profile = $g_BizSystem->getUserProfile(); $svcobj = BizSystem::getService("accessService"); $role = isset($profile["ROLE"]) ? $profile["ROLE"] : null; if (array_key_exists('URL', $menuItem["ATTRIBUTES"])) { $url = $menuItem["ATTRIBUTES"]["URL"]; } elseif (array_key_exists('VIEW', $menuItem["ATTRIBUTES"])) { $view = $menuItem["ATTRIBUTES"]["VIEW"]; // menuitem's containing VIEW attribute is renderd if access is granted in accessservice.xml // menuitem's are rendered if no definition is found in accessservice.xml (default) if ($svcobj->allowViewAccess($view, $role)) { $url = "javascript:GoToView('" . $view . "')"; } else { return ''; } } $caption = I18n::getInstance()->translate($menuItem["ATTRIBUTES"]["CAPTION"]); $target = $menuItem["ATTRIBUTES"]["TARGET"]; $icon = $menuItem["ATTRIBUTES"]["ICON"]; $img = $icon ? "<img src='" . Resource::getImageUrl() . "/{$icon}' class=menu_img> " : ""; if ($view) { $url = "javascript:GoToView('" . $view . "')"; } if ($target) { $sHTML .= "<li><a href=\"" . $url . "\" target='{$target}'>{$img}" . $caption . "</a>"; } else { $sHTML .= "<li><a href=\"" . $url . "\">{$img}" . $caption . "</a>"; } if ($menuItem["MENUITEM"]) { $sHTML .= "\n<ul>\n"; $sHTML .= $this->renderMenuItems($menuItem["MENUITEM"]); $sHTML .= "</ul>"; } $sHTML .= "</li>\n"; return $sHTML; }
/** * Include RTE scripts * * @return void */ public function includeRTEScripts() { if (isset($this->_extraScripts['rte'])) { return; } $script = "<script type='text/javascript' src='" . Resource::getJsUrl() . "/richtext.js'></script>"; $script .= "<script language=\"JavaScript\">initRTE('" . Resource::getImageUrl() . "/rte/', '../pages/rte/', '', false);</script>"; $this->appendScripts("rte", $script, false); }
protected function renderList() { if ($this->m_FormPrefix) { $formNameStr = str_replace(".", "_", $this->getFormObj()->m_Name) . "_"; } $onchange_func = $this->getOnChangeFunction(); $list = $this->getList(); 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)); $list = array_merge($entryList, $list); } $value = $this->m_Value !== null ? $this->m_Value : $this->getText(); $elem_id = $formNameStr . $this->m_Name; $elem_scroll_id = $formNameStr . $this->m_Name . "_scroll"; $elem_list_id = $formNameStr . $this->m_Name . "_list"; $elem_hidden_id = $formNameStr . $this->m_Name . "_hidden"; $sHTML = "\n<div class=\"dropdownlist\" id=\"{$elem_scroll_id}\" style=\"display:none;\">" . ($sHTML .= "\n<ul style=\"display:none;z-index:50\" id=\"{$elem_list_id}\">\n"); if (!$list) { $list = array(); } foreach ($list as $item) { $val = $item['val']; $txt = $item['txt']; $pic = $item['pic']; if ($pic) { if (preg_match('/\\{.*\\}/si', $pic)) { $pic = Expression::evaluateExpression($pic, null); } elseif (!preg_match('/\\//si', $pic)) { $pic = Resource::getImageUrl() . "/" . $pic; } $str_pic = "<img src=\"{$pic}\" />"; } else { $str_pic = ""; } if (!preg_match("/</si", $txt)) { $display_value = $txt; } else { $display_value = $val; } if ($str_pic) { $li_option_value = $str_pic . "<span>" . $txt . "</span>"; } else { $li_option_value = "<span>" . $txt . "</span>"; //$txt ; } if ($val == $value) { $option_item_style = " class='selected' "; } else { $option_item_style = " onmouseover=\"this.className='hover'\" onmouseout=\"this.className=''\" "; } // jquery $j('a.maxmin').click( function () {...} ); if (defined('JSLIB_BASE') && JSLIB_BASE == 'JQUERY') { $sHTML .= "<li {$option_item_style} disp_value='{$display_value}' real_value='{$val}'>{$li_option_value}</li>\n"; } else { $sHTML .= "<li {$option_item_style}\t\t\t\n\t\t\t\t\t\t\tonclick=\"\$('{$elem_list_id}').hide();\n\t\t\t\t\t\t\t\t\t\$('{$elem_scroll_id}').hide();\n\t\t\t\t\t\t\t\t\t\$('{$elem_id}').setValue('" . addslashes($display_value) . "');\n\t\t\t\t\t\t\t\t\t\$('{$elem_hidden_id}').setValue('" . addslashes($val) . "');\n\t\t\t\t\t\t\t\t\t\$('span_{$elem_id}').innerHTML = this.innerHTML;\n\t\t\t\t\t\t\t\t\t{$onchange_func} ;\n\t\t\t\t\t\t\t\t\t\$('{$elem_id}').className='" . $this->m_cssClass . "'\n\t\t\t\t\t\t\t\t\t\"\t\n\t\t\t\t\t>{$li_option_value}</li>"; } if ($val == $value) { $this->m_DefaultDisplayValue = "" . $str_pic . "<span>" . $txt . "</span>"; } } $sHTML .= "</ul>"; $sHTML .= "</div>"; return $sHTML; }
/** * Render element, according to the mode * * @return string HTML text */ public function render() { if (!$this->getText()) { $val = $this->m_ImgUrl ? $this->m_ImgUrl . $this->m_Value : $this->m_Value; } else { if (preg_match("/\\{RESOURCE_URL\\}/si", $this->m_Text)) { $val = $this->getText(); } else { $val = Resource::getImageUrl() . "/" . $this->getText(); } } if ($val == null || $val == "") { return ""; } $style = $this->getStyle(); $func = $this->getFunction(); $alt = $this->getAlt(); $title = $this->getTitle(); if ($val) { if ($height = $this->m_Height) { $height = 'height="' . $height . '"'; } if ($width = $this->m_Width) { $width = 'width="' . $width . '"'; } $alt = 'alt="' . $alt . '"'; $title = 'title="' . $title . '"'; if ($this->m_Link) { $link = $this->getLink(); $target = $this->getTarget(); $sHTML = "<a href=\"{$link}\" {$target} {$func} {$style}>" . "<img src=\"{$val}\" border=\"0\" {$height} {$width} {$alt} {$title} />" . "</a>"; } else { $sHTML = "<img {$style} {$func} border=\"0\" src=\"{$val}\" {$height} {$width} {$alt} {$title} />"; } } return $sHTML; }
/** * Render image button control * @return string HTML content of a control */ protected function renderButton() { $style = $this->getStyle(); $func = $this->m_State == "ENABLED" ? $this->getFunction() : ""; $mouseover = "onmouseover=\"window.status='" . $this->m_Caption . "'; return true;\""; $cls = !$this->m_cssClass ? $this->m_Type : $this->m_cssClass; $disabledStr = $this->getEnabled() == "N" ? "disabled=\"true\"" : ""; if ($this->m_Image) { $out = "<img src=\"" . Resource::getImageUrl() . "/" . $this->m_Image . "\" align='middle' border='0'' {$mouseover} class={$cls} title=\"" . $this->m_Caption . "\">"; if ($func != "") { $out = "<a href='javascript:void(0);' {$this->m_HTMLAttr} {$func}>" . $out . "</a>"; } } else { $out = $this->m_Caption; $out = "<input type='button' value='{$out}' class='{$cls}' {$this->m_HTMLAttr} {$disabledStr} {$style} {$func} {$mouseover}>"; //$out = "<span class='$cls'>$out</span>"; } return $out; }
/** * Render element, according to the mode * * @return string HTML text */ public function render() { $val = $this->m_Value ? $this->m_Value : Resource::getImageUrl() . "/" . $this->getText(); if ($val == null || $val == "") { return ""; } $style = $this->getStyle(); $func = $this->getFunction(); $alt = $this->getAlt(); $title = $this->getTitle(); if ($val) { if ($height = $this->m_Height) { $height = 'height="' . $height . '"'; } if ($width = $this->m_Width) { $width = 'width="' . $width . '"'; } $alt = 'alt="' . $alt . '"'; $title = 'title="' . $title . '"'; if ($this->m_Link) { $link = $this->getLink(); $target = $this->getTarget(); $sHTML = "<a href=\"{$link}\" {$target} {$func} {$style}>" . "<img src=\"{$val}\" border=\"0\" {$height} {$width} {$alt} {$title} />" . "</a>"; } else { $sHTML = "<span {$style} {$func}>" . "<img border=\"0\" src=\"{$val}\" {$height} {$width} {$alt} {$title} />" . "</span>"; } } return $sHTML; }