コード例 #1
0
 /**
  * Initialize Node
  *
  * @param array $rec
  * @return void
  */
 function __construct($rec)
 {
     $this->recordId = $rec['Id'];
     $this->recordParentId = $rec['PId'];
     $this->objectName = $rec['title'];
     $this->module = $rec['module'];
     $this->objectDescription = $rec['description'];
     $this->url = $rec['link'];
     if (Expression::isExpression($this->url)) {
         $this->url = Expression::evaluateExpression($this->url, $this);
     } else {
         if (!empty($this->url)) {
             if (strpos($this->url, '/') === 0) {
                 $this->url = OPENBIZ_APP_INDEX_URL . $this->url;
             } else {
                 $this->url = OPENBIZ_APP_INDEX_URL . '/' . $this->url;
             }
         }
     }
     $this->url_Match = $rec['alias'];
     //$this->cssClass = $rec['Id'];
     $this->iconImage = $rec['icon'];
     $this->iconCSSClass = $rec['icon_css'];
     $this->access = $rec['access'];
     $this->translate();
     // translate for multi-language support
 }
コード例 #2
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;
 }
コード例 #3
0
ファイル: ColumnBar.php プロジェクト: openbizx/openbizx-cubix
 protected function getStyle()
 {
     $formobj = $this->getFormObj();
     $htmlClass = Expression::evaluateExpression($this->cssClass, $formobj);
     $htmlClass = "CLASS='{$htmlClass}'";
     if (!$htmlClass) {
         $htmlClass = null;
     }
     $style = '';
     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;
 }
コード例 #4
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 = Openbiz::$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;
 }
コード例 #5
0
 public function render()
 {
     $sHTML = "";
     if (Openbiz::getService('system.lib.ModuleService')->isModuleInstalled('oauth')) {
         $do = Openbiz::getObject('oauth.do.OauthProviderDO');
         $recArr = $do->directFetch("[status]=1", 30);
         $recArr = $recArr->toArray();
         if ($this->redirectURL) {
             $this->redirectURL = Expression::evaluateExpression($this->redirectURL, $this);
             $url_append .= "redirect_url=" . urlencode($this->redirectURL) . "&";
         }
         if ($this->assocURL) {
             $this->assocURL = Expression::evaluateExpression($this->assocURL, $this);
             $url_append .= "assoc_url=" . urlencode($this->assocURL) . "&";
         }
         if (count($recArr)) {
             $sHTML .= "<span class=\"oauth_bar\" {$style}>";
             foreach ($recArr as $oauthProvider) {
                 $url = OPENBIZ_APP_URL . "/ws.php/oauth/callback/login/type_" . $oauthProvider['type'] . '/';
                 if ($url_append) {
                     $url .= '?' . $url_append;
                 }
                 $sHTML .= "<a id=\"oauth_" . $oauthProvider['type'] . "\" title=\"" . $oauthProvider['type'] . "\"   href=\"{$url}\" style=\"\"></a>";
             }
             $sHTML .= "</span>";
         }
     }
     return $sHTML;
 }
コード例 #6
0
 /**
  * Get image title
  *
  * @return string
  */
 protected function getTitle()
 {
     if ($this->title == null) {
         return null;
     }
     $formobj = $this->getFormObj();
     return Expression::evaluateExpression($this->title, $formobj);
 }
コード例 #7
0
ファイル: RawData.php プロジェクト: openbizx/openbizx-cubix
 /**
  * Get text of element
  *
  * @return string
  */
 protected function getText()
 {
     if ($this->text == null) {
         return null;
     }
     $formObj = $this->getFormObj();
     return Expression::evaluateExpression($this->text, $formObj);
 }
コード例 #8
0
 public function getLocationInfo($id)
 {
     $locationRec = Openbiz::getObject("backup.do.BackupDeviceDO")->fetchById($id);
     if ($locationRec) {
         $this->folder = Expression::evaluateExpression($locationRec['location'], null);
         $this->folder = Expression::evaluateExpression($locationRec['location'], null);
     }
 }
コード例 #9
0
ファイル: LabelList.php プロジェクト: openbizx/openbizx-cubix
 /**
  * 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);
 }
コード例 #10
0
ファイル: IFrameBox.php プロジェクト: openbizx/openbizx-cubix
 protected function getHeight()
 {
     if ($this->height == null) {
         return null;
     }
     $formobj = $this->getFormObj();
     return Expression::evaluateExpression($this->height, $formobj);
 }
コード例 #11
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 = Openbiz::$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\tOpenbiz.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;
 }
コード例 #12
0
 protected function getSelectFrom()
 {
     $formobj = $this->getFormObj();
     if (!Openbiz::$app->allowUserAccess("data_assign.assign_to_other")) {
         $groups = Openbiz::$app->getUserProfile("groups");
         if ($groups) {
             $ids = implode(",", $groups);
             $selectFrom = $this->selectFrom . ",[Id] IN ({$ids})";
         } else {
             $selectFrom = $this->selectFrom;
         }
     } else {
         $selectFrom = $this->selectFrom;
     }
     return Expression::evaluateExpression($selectFrom, $formobj);
 }
コード例 #13
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;
 }
コード例 #14
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;
 }
コード例 #15
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;
 }
コード例 #16
0
ファイル: LabelBar.php プロジェクト: openbizx/openbizx-cubix
 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;
 }
コード例 #17
0
 function readMetadata($xmlArr)
 {
     $this->recordId = $xmlArr["ATTRIBUTES"]["ID"];
     $this->objectName = $xmlArr["ATTRIBUTES"]["NAME"];
     $this->objectDescription = $xmlArr["ATTRIBUTES"]["DESCRIPTION"];
     $this->url = $xmlArr["ATTRIBUTES"]["URL"];
     $this->url = Expression::evaluateExpression($this->url, $this);
     $this->url_Match = $xmlArr["ATTRIBUTES"]["URLMATCH"];
     $this->target = $xmlArr["ATTRIBUTES"]["TARGET"];
     $this->cssClass = $xmlArr["ATTRIBUTES"]["CSSCLASS"];
     $this->iconImage = $xmlArr["ATTRIBUTES"]["ICONIMAGE"];
     $this->iconCSSClass = $xmlArr["ATTRIBUTES"]["ICONCSSCLASS"];
     if (is_array($xmlArr["MENUITEM"])) {
         $this->childNodes = array();
         if (isset($xmlArr["MENUITEM"]["ATTRIBUTES"])) {
             $this->childNodes[$xmlArr["MENUITEM"]["ATTRIBUTES"]["ID"]] = new MenuItemObj($xmlArr["MENUITEM"], $this->recordId);
         } else {
             foreach ($xmlArr["MENUITEM"] as $menuItem) {
                 $this->childNodes[$menuItem["ATTRIBUTES"]["ID"]] = new MenuItemObj($menuItem, $this->recordId);
             }
         }
     }
 }
コード例 #18
0
 /**
  * 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); */
         }
     }
 }
コード例 #19
0
 protected function getSelectFromSQL()
 {
     $formobj = $this->getFormObj();
     return Expression::evaluateExpression($this->selectFromSQL, $formobj);
 }
コード例 #20
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) {
                 //Openbiz::$app->getLog()->log(LOG_DEBUG, "EXPRESSION", "###expression 1: ".$section."");
                 $section = Expression::replaceVarExpr($section, $object);
                 // replace variable expr;
                 //Openbiz::$app->getLog()->log(LOG_DEBUG, "EXPRESSION", "###expression 2: ".$section."");
                 if ($_section == $section) {
                     if (is_subclass_of($object, "Openbiz\\Data\\BizDataObj") || get_class($object) == "Openbiz\\Data\\BizDataObj" and strstr($section, '[')) {
                         $section = Expression::replaceFieldsExpr($section, $object);
                     }
                     // replace [field] with its value
                     if (is_subclass_of($object, "Openbiz\\Easy\\EasyForm") || get_class($object) == "Openbiz\\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;
 }
コード例 #21
0
 /**
  * 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;
 }
コード例 #22
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 = Openbiz::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;
     }
 }
コード例 #23
0
 protected function getSelectFromSQL($selectFrom)
 {
     return Expression::evaluateExpression($selectFrom, null);
 }
コード例 #24
0
 protected function getRequired()
 {
     $formObj = $this->getFormObj();
     return Expression::evaluateExpression($this->required, $formObj);
 }
コード例 #25
0
ファイル: EasyForm.php プロジェクト: openbizx/openbizx-cubix
 /**
  * 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 . "/" . Openbiz::$app->getCurrentTheme() . "/images/" . $output['icon'];
         }
     }
     return $output;
 }
コード例 #26
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;
 }
コード例 #27
0
 public function getContinent()
 {
     $formobj = $this->getFormObj();
     return Expression::evaluateExpression($this->continent, $formobj);
 }
コード例 #28
0
ファイル: WebPage.php プロジェクト: openbizx/openbizx-cubix
 /**
  * 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;
 }
コード例 #29
0
 /**
  * Gather all template variables needed. Should play well with Smarty or \Zend templates
  *
  * @param WebPage $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->objectName);
     $tplAttributes["description"] = $viewObj->objectDescription;
     $tplAttributes["keywords"] = $viewObj->keywords;
     if (isset($viewObj->tiles)) {
         foreach ($viewObj->tiles as $tname => $tile) {
             foreach ($tile as $formRef) {
                 if ($formRef->display == false) {
                     continue;
                 }
                 $tiles[$tname][$formRef->objectName] = Openbiz::getObject($formRef->objectName)->render();
                 $tiletabs[$tname][$formRef->objectName] = $formRef->objectDescription;
             }
         }
     } else {
         foreach ($viewObj->formRefs as $formRef) {
             if ($formRef->display == false) {
                 continue;
             }
             $forms[$formRef->objectName] = Openbiz::getObject($formRef->objectName)->render();
             $formtabs[$formRef->objectName] = $formRef->objectDescription;
         }
     }
     if (count($viewObj->widgets)) {
         foreach ($viewObj->widgets as $formRef) {
             if ($formRef->display == false) {
                 continue;
             }
             $widgets[$formRef->objectName] = Openbiz::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 = Openbiz::$app->getClientProxy()->getAppendedScripts();
     $tplAttributes["style_sheets"] = Openbiz::$app->getClientProxy()->getAppendedStyles();
     if ($viewObj->isPopup && $bReRender == false) {
         $moveToCenter = "moveToCenter(self, " . $viewObj->width . ", " . $viewObj->height . ");";
         $tplAttributes["scripts"] = $includedScripts . "\n<script>\n" . $newClntObjs . $moveToCenter . "</script>\n";
     } else {
         $tplAttributes["scripts"] = $includedScripts . "\n<script>\n" . $newClntObjs . "</script>\n";
     }
     if ($viewObj->title) {
         $tplAttributes["title"] = Expression::evaluateExpression($viewObj->title, $viewObj);
     } else {
         $tplAttributes["title"] = $viewObj->objectDescription;
     }
     if (OPENBIZ_DEFAULT_SYSTEM_NAME) {
         $tplAttributes["title"] = $tplAttributes["title"] . ' - ' . OPENBIZ_DEFAULT_SYSTEM_NAME;
     }
     return $tplAttributes;
 }
コード例 #30
0
ファイル: Checkbox.php プロジェクト: openbizx/openbizx-cubix
 public function getDefaultChecked()
 {
     $formObj = $this->getFormObj();
     return Expression::evaluateExpression($this->defaultChecked, $formObj);
 }