Exemple #1
0
 /**
  * Render element, according to the mode
  *
  * @return string HTML text
  */
 public function render()
 {
     $val = $this->getText() ? $this->getText() : $this->getValue();
     $style = $this->getStyle();
     $text = $this->getText();
     $id = $this->objectName;
     $func = $this->getFunction();
     if ($val === '1' || $val === 'true' || strtoupper($val) == 'Y' || $val > 0 || $val == $this->trueValue) {
         $image_url = $this->trueImg;
     } else {
         $image_url = $this->falseImg;
     }
     if (preg_match("/\\{.*\\}/si", $image_url)) {
         $formobj = $this->getFormObj();
         $image_url = Expression::evaluateExpression($image_url, $formobj);
     } else {
         $image_url = Openbizx::$app->getImageUrl() . "/" . $image_url;
     }
     if ($this->link) {
         $link = $this->getLink();
         $target = $this->getTarget();
         $sHTML = "<a  id=\"{$id}\" href=\"{$link}\" {$target} {$func} {$style}><img src='{$image_url}' /></a>";
     } else {
         $sHTML = "<img id=\"{$id}\"  alt=\"" . $text . "\" title=\"" . $text . "\"  src='{$image_url}' />";
     }
     return $sHTML;
 }
Exemple #2
0
 public function getStyle()
 {
     $formobj = $this->getFormObj();
     $htmlClass = Expression::evaluateExpression($this->cssClass, $formobj);
     $htmlClass = "CLASS='{$htmlClass}'";
     if (!$htmlClass) {
         $htmlClass = null;
     }
     $style = '';
     if ($this->height && $this->height >= 0) {
         $style .= "height:" . $this->height . "px;";
     }
     if ($this->style) {
         $style .= $this->style;
     }
     if (!isset($style) && !$htmlClass) {
         return null;
     }
     if (isset($style)) {
         $style = Expression::evaluateExpression($style, $formobj);
         $style = "STYLE='{$style}'";
     }
     if ($formobj->errors[$this->objectName]) {
         $htmlClass = "CLASS='" . $this->cssErrorClass . "'";
     }
     if ($htmlClass) {
         $style = $htmlClass . " " . $style;
     }
     return $style;
 }
Exemple #3
0
 /**
  * Get style of element
  *
  * @return string style of Element
  */
 protected function getStyle()
 {
     $htmlClass = $this->cssClass ? "class='" . $this->cssClass . "' " : "class='editcombobox'";
     /*
      $width = $this->width ? $this->width : 146;
      $this->widthInput = ($width-18).'px';
      $this->width = $width.'px';
      $style = "position: absolute; width: $this->width; z-index: 1; clip: rect(auto, auto, auto, $this->widthInput);";
     */
     if ($this->style) {
         $style .= $this->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;
 }
Exemple #4
0
 /**
  * Get link that evaluated by Expression::evaluateExpression
  *
  * @return string link
  */
 protected function getLink()
 {
     if ($this->link == null) {
         return null;
     }
     $formobj = $this->getFormObj();
     return Expression::evaluateExpression($this->link, $formobj);
 }
Exemple #5
0
 /**
  * Get image title
  *
  * @return string
  */
 protected function getTitle()
 {
     if ($this->title == null) {
         return null;
     }
     $formobj = $this->getFormObj();
     return Expression::evaluateExpression($this->title, $formobj);
 }
Exemple #6
0
 protected function getHeight()
 {
     if ($this->height == null) {
         return null;
     }
     $formobj = $this->getFormObj();
     return Expression::evaluateExpression($this->height, $formobj);
 }
Exemple #7
0
 /**
  * Get text of element
  *
  * @return string
  */
 protected function getText()
 {
     if ($this->text == null) {
         return null;
     }
     $formObj = $this->getFormObj();
     return Expression::evaluateExpression($this->text, $formObj);
 }
Exemple #8
0
 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->errors[$this->objectName]) {
         $func .= "onclick=\"this.className='{$this->cssClass}'\"";
     } else {
         $func .= "onmouseover=\"this.className='{$this->cssFocusClass}'\" onmouseout=\"this.className='{$this->cssClass}'\"";
     }
     $sHTML = "<input type=\"hidden\" NAME=\"" . $this->objectName . "\" ID=\"" . $this->objectName . "\" value=\"" . $value . "\" {$disabledStr} {$this->htmlAttr} />";
     $sHTML .= "<ul id=\"image_list_" . $this->objectName . "\" {$style} {$func} >";
     if ($this->blankOption) {
         $entry = explode(",", $this->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->width) {
             $width_str = " width=\"" . $this->width . "\" ";
         }
         if ($this->height) {
             $height_str = " height=\"" . $this->height . "\" ";
         }
         $image_url = $option['pic'];
         if (preg_match("/\\{.*\\}/si", $image_url)) {
             $formobj = $this->getFormObj();
             $image_url = Expression::evaluateExpression($image_url, $formobj);
         } else {
             $image_url = Openbizx::$app->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->objectName . "').value='" . $option['val'] . "';            \t\t\t\t\t\t\t\n            \t\t\t\t\t\t\tOpenbizx.ImageSelector.reset('image_list_" . $this->objectName . "');\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;
 }
Exemple #9
0
 /**
  * Render, draw the element according to the mode
  *
  * @return string HTML text
  */
 public function render()
 {
     $value = $this->value;
     $name = $this->objectName . '[]';
     $style = $this->getStyle();
     if ($this->checkStatus) {
         $formObj = $this->getFormObj();
         $testResult = Expression::evaluateExpression($this->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->htmlAttr} {$style}/>";
     return $sHTML;
 }
Exemple #10
0
 public function render()
 {
     $formobj = $this->getFormObj();
     $this->totalPage = Expression::evaluateExpression($this->totalPage, $formobj);
     $this->currentPage = Expression::evaluateExpression($this->currentPage, $formobj);
     $style = $this->getStyle();
     $id = $this->objectName;
     $func = $this->getFunction();
     $sHTML = "";
     $link = $this->getLink();
     $target = $this->getTarget();
     for ($i = 1; $i < $this->totalPage + 1; $i++) {
         if ($i == $this->currentPage) {
             $sHTML .= "<a id=\"{$id}\" href=\"" . $link . $i . "\" {$target} {$func} class=\"" . $this->currentCss . "\">" . $i . "</a>";
         } else {
             $sHTML .= "<a id=\"{$id}\" href=\"" . $link . $i . "\" {$target} {$func} {$style}>" . $i . "</a>";
         }
     }
     return $sHTML;
 }
Exemple #11
0
 /**
  * Render, draw the control according to the mode
  *
  * @return string HTML text
  */
 public function render()
 {
     $this->prefix = Expression::evaluateExpression($this->prefix, $formobj);
     $func = $this->getFunction();
     if ($this->width) {
         $width_str = " width=\"" . $this->width . "\" ";
     }
     if ($this->height) {
         $height_str = " height=\"" . $this->height . "\" ";
     }
     $value = $this->getText() ? $this->getText() : $this->getValue();
     if ($value) {
         if ($this->link) {
             $link = $this->getLink();
             $target = $this->getTarget();
             $sHTML = "<a href=\"{$link}\" {$target} {$func} {$style}>" . "<img src=\"" . $this->prefix . $value . "\"  border=\"0\" {$width_str} {$height_str} />" . "</a>";
         } else {
             $sHTML = "<img border=\"0\" src=\"" . $this->prefix . $value . "\" {$func} {$width_str} {$height_str} />";
         }
     }
     return $sHTML;
 }
Exemple #12
0
 public function render()
 {
     $value = $this->text ? $this->getText() : $this->value;
     if ($this->color) {
         $formObj = $this->getFormObj();
         $color = Expression::evaluateExpression($this->color, $formObj);
         if (!$color) {
             $color = '33b5fb';
         }
         $bgcolor_str = "background-color: #" . $color . ";";
     } else {
         $bgcolor_str = "background-color: #33b5fb;";
     }
     if ($this->displayFormat) {
         $value = sprintf($this->displayFormat, $value);
     }
     if ($this->percent == 'Y') {
         $value = sprintf("%.2f", $value * 100) . '%';
     }
     $style = $this->getStyle();
     $id = $this->objectName;
     $func = $this->getFunction();
     $height = $this->height;
     $width = $this->width - 80;
     $max_value = Expression::evaluateExpression($this->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->displayUnit . "</span>\n    \t</span>\n    \t";
     return $sHTML;
 }
 /**
  * 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->objectName . "-" . $rule;
     if (isset($this->_doRuleCache[$cacheKey])) {
         return $this->_doRuleCache[$cacheKey];
     }
     //echo " _ruleToSql ".$dataObj->objectName." ". $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) {
         $bizField = $dataObj->getField($fld);
         if (!$bizField) {
             continue;
         }
         $fld_pattern = "[" . $bizField->objectName . "]";
         if ($bizField->column && strpos($bizField->column, ',') != 0) {
             // handle composite key.
             if (!preg_match('/\\[' . $bizField->objectName . '\\].*=.*\'(.+)\'/', $rule, $matches)) {
                 continue;
             }
             //print_r($matches);
             $keyval = $matches[1];
             // replace the matching part [compkey field]='value'
             $compkey_value = $this->_compKeyRuleToSql($bizField->column, $keyval);
             $rule = $str_replace($matches[0], $compkey_value, $rule);
         } else {
             if ($bizField->aliasName) {
                 $rule = str_replace($fld_pattern, $bizField->aliasName, $rule);
             } elseif ($bizField->sqlExpression) {
                 $rule = str_replace($fld_pattern, $bizField->sqlExpression, $rule);
             } else {
                 $tableColumn = $dataSqlObj->getTableColumn($bizField->join, $bizField->column);
                 $rule = str_replace($fld_pattern, $tableColumn, $rule);
             }
         }
     }
     $this->_doRuleCache[$cacheKey] = $rule;
     return $rule;
 }
Exemple #14
0
 public function getInvokeAction()
 {
     if ($this->formedFunction) {
         return $this->formedFunction;
     }
     $name = $this->_elemName;
     $ehName = $this->objectName;
     $formobj = Openbizx::getObject($this->_formName);
     if (!$this->formedFunction) {
         // add direct URL support
         if ($this->url) {
             $_func = "loadPage('" . $this->url . "');";
         } else {
             if (strpos($this->function, "js:") === 0) {
                 $_func = substr($this->function, 3) . ";";
             } else {
                 $temp = $this->functionType == null ? "" : ",'" . $this->functionType . "'";
                 //$_func = "SetOnElement('$name:$ehName'); Openbizx.CallFunction('" . $this->function . "'$temp);";
                 list($funcName, $funcParams) = $this->parseFunction($this->function);
                 $funcParams = Expression::evaluateExpression($funcParams, $formobj);
                 $action = "{$name}:{$ehName}";
                 // TODO: encrypt paramString to add more security
                 $_func = "Openbizx.invoke('{$this->_formName}','{$action}','{$funcParams}'{$temp});";
             }
         }
         //$_func = Expression::evaluateExpression($_func, $formobj);
         $this->formedFunction = $_func;
     }
     return $this->formedFunction;
 }
Exemple #15
0
 /**
  * Render element, according to the mode
  *
  * @return string HTML text
  */
 public function render()
 {
     $style = $this->getStyle();
     $text = $this->getText();
     $id = $this->objectName;
     $func = $this->getFunction();
     switch ($this->getValue()) {
         case "0":
             $image_url = $this->myPrivateImg;
             break;
         case "1":
             $image_url = $this->mySharedImg;
             break;
         case "2":
             $image_url = $this->groupSharedImg;
             break;
         case "3":
             $image_url = $this->otherSharedImg;
             break;
         case "4":
             $image_url = $this->myAssignedImg;
             break;
         case "5":
             $image_url = $this->myDistributedImg;
             break;
         default:
             if ($this->defaultImg == '{OPENBIZ_RESOURCE_URL}/common/images/icon_data_shared_other.gif') {
                 $this->defaultImg = $this->otherSharedImg;
             }
             $image_url = $this->defaultImg;
             break;
     }
     if (preg_match("/\\{.*\\}/si", $image_url)) {
         $formobj = $this->getFormObj();
         $image_url = Expression::evaluateExpression($image_url, $formobj);
     } else {
         $image_url = Openbizx::$app->getImageUrl() . "/" . $image_url;
     }
     if ($this->width) {
         $width = "width=\"{$this->width}\"";
     }
     if ($this->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;
 }
Exemple #16
0
 /**
  * Get output attributs as array
  *
  * @return array array of attributs
  * @todo rename to getOutputAttribute or getAttribute (2.5?)
  */
 public function outputAttrs()
 {
     $output['name'] = $this->objectName;
     $output['title'] = Expression::evaluateExpression($this->title, $this);
     $output['icon'] = $this->icon;
     return $output;
 }
Exemple #17
0
 public function getDefaultChecked()
 {
     $formObj = $this->getFormObj();
     return Expression::evaluateExpression($this->defaultChecked, $formObj);
 }
Exemple #18
0
 protected function getSelectFromSQL()
 {
     $formobj = $this->getFormObj();
     return Expression::evaluateExpression($this->selectFromSQL, $formobj);
 }
Exemple #19
0
 /**
  * Check if the field has valid value
  *
  * @return boolean true if validation is good
  */
 public function validate()
 {
     $ret = true;
     if ($this->validator) {
         $ret = Expression::evaluateExpression($this->validator, $this->getDataObj());
     }
     return $ret;
 }
 /**
  * Execute action
  *
  * @param TriggerAction $triggerAction
  * @param BizDataObj $dataObj
  * @return void
  */
 protected function executeAction($triggerAction, $dataObj)
 {
     // action method
     $methodName = $triggerAction->action;
     // action method arguments
     if (method_exists($this, $methodName)) {
         // evaluate arguments as expression support
         foreach ($triggerAction->argList as $argName => $argValue) {
             $argList[$argName] = Expression::evaluateExpression($argValue, $dataObj);
         }
         // check the immediate flag
         if ($triggerAction->immediate == "Y") {
             // call the method if Immediate is "Y"
             $this->{$methodName}($argList);
         } else {
             // put it to a passive queue
             /* $passiveQueueSvc->Push($methodName,
                $argList,
                $triggerAction->delayMinutes,
                $triggerAction->repeatMinutes); */
         }
     }
 }
Exemple #21
0
 protected function getDOFromList(&$list, $selectFrom)
 {
     // from Database
     $pos0 = strpos($selectFrom, "[");
     $pos1 = strpos($selectFrom, "]");
     if ($pos0 > 0 && $pos1 > $pos0) {
         // select from bizObj
         // support BizObjName[BizFieldName] or BizObjName[BizFieldName4Text:BizFieldName4Value]
         $bizObjName = substr($selectFrom, 0, $pos0);
         $pos3 = strpos($selectFrom, ":");
         if ($pos3 > $pos0 && $pos3 < $pos1) {
             $fieldName = substr($selectFrom, $pos0 + 1, $pos3 - $pos0 - 1);
             $fieldName_v = substr($selectFrom, $pos3 + 1, $pos1 - $pos3 - 1);
         } else {
             $fieldName = substr($selectFrom, $pos0 + 1, $pos1 - $pos0 - 1);
             $fieldName_v = $fieldName;
         }
         $this->selectFieldName = $fieldName;
         $commaPos = strpos($selectFrom, ",", $pos1);
         $commaPos2 = strpos($selectFrom, ",", $commaPos + 1);
         if ($commaPos > $pos1) {
             if ($commaPos2) {
                 $searchRule = trim(substr($selectFrom, $commaPos + 1, $commaPos2 - $commaPos - 1));
             } else {
                 $searchRule = trim(substr($selectFrom, $commaPos + 1));
             }
         }
         if ($commaPos2 > $commaPos) {
             $rootSearchRule = trim(substr($selectFrom, $commaPos2 + 1));
         }
         $bizObj = Openbizx::getObject($bizObjName);
         if (!$bizObj) {
             return;
         }
         $recList = array();
         $oldAssoc = $bizObj->association;
         $bizObj->association = null;
         if ($searchRule) {
             $searchRule = Expression::evaluateExpression($searchRule, $this->getFormObj());
         }
         if ($rootSearchRule) {
             $rootSearchRule = Expression::evaluateExpression($rootSearchRule, $this->getFormObj());
         } else {
             $rootSearchRule = "[PId]=0 OR [PId]='' OR [PId] is NULL";
         }
         $recListTree = $bizObj->fetchTree($rootSearchRule, 100, $searchRule);
         $bizObj->association = $oldAssoc;
         if (!$recListTree) {
             return;
         }
         // bugfix : error if data blank
         foreach ($recListTree as $recListTreeNode) {
             $this->tree2array($recListTreeNode, $recList);
         }
         foreach ($recList as $rec) {
             $list[$i]['val'] = $rec[$fieldName_v];
             $list[$i]['txt'] = $rec[$fieldName];
             $i++;
         }
         return;
     }
 }
Exemple #22
0
 /**
  * Evaluate simple expression
  * expression is combination of text, simple expressiones and field variables
  * simple expression - {...}
  * field variable - [field name]
  * expression samples: text1{[field1]*10}text2{function1([field2],'a')}text3
  *
  * @objname:property, @objname:field[fldname].property, @objname:control[ctrlname].property
  * @:prop = @thisobjname:prop
  * [fldname] = @thisobjname:field[fldname].value
  * @demo.BOEvent:Name, @:Name
  * @demo.BOEvent:Field[EventName].Column, @demo.BOEvent:Field[EventName].Value
  * @demo.FMEvent:Control[evt_name].FieldName, @demo.FMEvent:Control[evt_name].Value
  * [EventName] is @demo.BOEvent:Field[EventName].Value in BOEvent.xml
  *
  * @param string $expression - simple expression supported by the openbiz
  * @param object $object
  * @return mixed
  **/
 public static function evaluateExpression($expression, $object)
 {
     // TODO: check if it's "\[", "\]", "\{" or "\}"
     $script = "";
     $start = 0;
     if (!self::isExpression($expression)) {
         return $expression;
     }
     if (self::isCurrentObject($expression)) {
         return $object;
     }
     // evaluate the expression between {}
     while (true) {
         list($tag, $openTagPos, $closeTagPos) = self::getNextContainerPos($expression, $start);
         if ($openTagPos === false) {
             if (substr($expression, $start)) {
                 $script .= substr($expression, $start);
             }
             break;
         }
         if ($openTagPos >= 0 && $closeTagPos > $openTagPos) {
             $script .= substr($expression, $start, $openTagPos - $start);
             $start = $closeTagPos + strlen(self::$expContainers[$tag]);
             $section = substr($expression, $openTagPos + strlen($tag), $closeTagPos - $openTagPos - strlen($tag));
             $_section = $section;
             if ($object) {
                 //Openbizx::$app->getLog()->log(LOG_DEBUG, "EXPRESSION", "###expression 1: ".$section."");
                 $section = Expression::replaceVarExpr($section, $object);
                 // replace variable expr;
                 //Openbizx::$app->getLog()->log(LOG_DEBUG, "EXPRESSION", "###expression 2: ".$section."");
                 if ($_section == $section) {
                     if (is_subclass_of($object, "Openbizx\\Data\\BizDataObj") || get_class($object) == "Openbizx\\Data\\BizDataObj" and strstr($section, '[')) {
                         $section = Expression::replaceFieldsExpr($section, $object);
                     }
                     // replace [field] with its value
                     if (is_subclass_of($object, "Openbizx\\Easy\\EasyForm") || get_class($object) == "Openbizx\\Easy\\EasyForm" and strstr($section, '[')) {
                         $section = Expression::replaceElementsExpr($section, $object);
                     }
                     // replace [field] with its value
                 }
             }
             if ($section === false) {
                 $script = $script == '' ? $section : $script . $section;
             }
             if ($section != null and trim($section) != "" and $section != false) {
                 $ret = null;
                 //$section = str_replace($section, '\', '\\');
                 //echo $section . '<br />';
                 //if (Expression::eval_syntax("\$ret = $section;"))
                 if (($tag == '{fx}' || $tag == '{') && Expression::eval_syntax("\$ret = {$section};")) {
                     eval("\$ret = {$section};");
                 }
                 if ($ret === null) {
                     $ret = $section;
                 }
                 $script = $script == '' ? $ret : $script . $ret;
                 unset($ret);
             }
         } elseif ($openTagPos >= 0 && $closeTagPos <= $openTagPos) {
             break;
         }
     }
     return $script;
 }
Exemple #23
0
 /**
  * Gather all template variables needed. Should play well with Smarty or \Zend templates
  *
  * @param WebPage $webPage
  * @return array associative array holding all needed VIEW based template variables
  */
 public static function buildTemplateAttributes($webPage)
 {
     // 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"] = $webPage->getModuleName($webPage->objectName);
     $tplAttributes["description"] = $webPage->objectDescription;
     $tplAttributes["keywords"] = $webPage->keywords;
     if (isset($webPage->tiles)) {
         foreach ($webPage->tiles as $tname => $tile) {
             // renderForms() : BEGIN
             foreach ($tile as $formRef) {
                 if ($formRef->display == false) {
                     continue;
                 }
                 $tiles[$tname][$formRef->objectName] = Openbizx::getObject($formRef->objectName)->render();
                 $tiletabs[$tname][$formRef->objectName] = $formRef->objectDescription;
             }
             // renderForms() : END
         }
     } else {
         // renderForms() : BEGIN
         foreach ($webPage->formRefs as $formRef) {
             if ($formRef->display == false) {
                 continue;
             }
             $forms[$formRef->objectName] = Openbizx::getObject($formRef->objectName)->render();
             $formtabs[$formRef->objectName] = $formRef->objectDescription;
         }
         // renderForms() : END
     }
     if (count($webPage->widgets)) {
         // renderForms() : BEGIN
         foreach ($webPage->widgets as $formRef) {
             if ($formRef->display == false) {
                 continue;
             }
             $widgets[$formRef->objectName] = Openbizx::getObject($formRef->objectName)->render();
         }
     }
     //Fill Loop related data
     $tplAttributes["forms"] = $forms;
     $tplAttributes["widgets"] = $widgets;
     $tplAttributes["formtabs"] = $formtabs;
     $tplAttributes["tiles"] = $tiles;
     $tplAttributes["tiletabs"] = $tiletabs;
     // add clientProxy scripts
     $includedScripts = Openbizx::$app->getClientProxy()->getAppendedScripts();
     $tplAttributes["style_sheets"] = Openbizx::$app->getClientProxy()->getAppendedStyles();
     if ($webPage->isPopup && $bReRender == false) {
         $moveToCenter = "moveToCenter(self, " . $webPage->width . ", " . $webPage->height . ");";
         $tplAttributes["scripts"] = $includedScripts . "\n<script>\n" . $newClntObjs . $moveToCenter . "</script>\n";
     } else {
         $tplAttributes["scripts"] = $includedScripts . "\n<script>\n" . $newClntObjs . "</script>\n";
     }
     if ($webPage->title) {
         $tplAttributes["title"] = Expression::evaluateExpression($webPage->title, $webPage);
     } else {
         $tplAttributes["title"] = $webPage->objectDescription;
     }
     if (OPENBIZ_DEFAULT_SYSTEM_NAME) {
         $tplAttributes["title"] = $tplAttributes["title"] . ' - ' . OPENBIZ_DEFAULT_SYSTEM_NAME;
     }
     return $tplAttributes;
 }
Exemple #24
0
 /**
  * Get output attributs as array
  *
  * @return array array of attributs
  * @todo rename to getOutputAttribute or getAttribute (2.5?)
  */
 public function outputAttrs()
 {
     $output['name'] = $this->objectName;
     $output['title'] = Expression::evaluateExpression($this->title, $this);
     $output['icon'] = $this->icon;
     $output['hasSubform'] = $this->subForms ? 1 : 0;
     $output['currentPage'] = $this->currentPage;
     $output['currentRecordId'] = $this->recordId;
     $output['totalPages'] = $this->totalPages;
     $output['totalRecords'] = $this->totalRecords;
     $output['description'] = str_replace('\\n', "<br />", Expression::evaluateExpression($this->objectDescription, $this));
     $output['elementSets'] = $this->getElementSet();
     $output['tabSets'] = $this->getTabSet();
     $output['ActionElementSets'] = $this->getElementSet($this->actionPanel);
     if ($output['icon']) {
         if (preg_match("/{.*}/si", $output['icon'])) {
             $output['icon'] = Expression::evaluateExpression($output['icon'], null);
         } else {
             $output['icon'] = OPENBIZ_THEME_URL . "/" . Openbizx::$app->getCurrentTheme() . "/images/" . $output['icon'];
         }
     }
     return $output;
 }
Exemple #25
0
 /**
  * Get output attributs
  * 
  * @return array
  * @todo need to raname to getOutputAttributs() or getAttributes
  */
 public function outputAttrs()
 {
     $out['name'] = $this->objectName;
     $out['module'] = $this->getModuleName($this->objectName);
     $out['description'] = $this->objectDescription;
     $out["keywords"] = $this->keywords;
     if ($this->title) {
         $title = Expression::evaluateExpression($this->title, $this);
     } else {
         $title = $this->objectDescription;
     }
     $out['title'] = $title;
     return $out;
 }
Exemple #26
0
 protected function getRequired()
 {
     $formObj = $this->getFormObj();
     return Expression::evaluateExpression($this->required, $formObj);
 }