コード例 #1
0
ファイル: SipTraceSearchForm.php プロジェクト: que273/siremis
 public function searchSipTrace($id = null)
 {
     include_once OPENBIZ_BIN . "/easy/SearchHelper.php";
     $searchRule = "";
     foreach ($this->m_DataPanel as $element) {
         if (!$element->m_FieldName) {
             continue;
         }
         $value = BizSystem::clientProxy()->getFormInputs($element->m_Name);
         if ($element->m_FuzzySearch == "Y") {
             $value = "*{$value}*";
         }
         if ($value) {
             $searchStr = inputValToRule($element->m_FieldName, $value, $this);
             if ($searchRule == "") {
                 $searchRule .= $searchStr;
             } else {
                 $searchRule .= " AND " . $searchStr;
             }
         }
     }
     $searchRuleBindValues = QueryStringParam::getBindValues();
     $listFormObj = BizSystem::getObject($this->localListForm);
     $listFormObj->setSearchRule($searchRule, $searchRuleBindValues);
     $listFormObj->rerender();
 }
コード例 #2
0
ファイル: ColorPicker.php プロジェクト: Why-Not-Sky/cubi-ng
 public function render()
 {
     BizSystem::clientProxy()->includeColorPickerScripts();
     if ($this->m_Value != null) {
         $value = $this->m_Value;
     } else {
         $value = $this->getText();
     }
     $disabledStr = $this->getEnabled() == "N" ? "READONLY=\"true\"" : "";
     $style = $this->getStyle();
     $func = $this->getFunction();
     $func_org = $func;
     $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}'\"";
     }
     $elementName = $this->m_Name;
     $elementTrigger = array();
     if ($value) {
         $default_color = "color: '#{$value}',";
     } else {
         $default_color = "";
         $value = $this->getDefaultValue() ? $this->getDefaultValue() : "";
     }
     switch (strtolower($this->m_Mode)) {
         case "viewonly":
             $sHTML .= "<span id=\"colorpreview_{$elementName}\" {$func_org} class=\"colorpicker_preview\" style=\"background-color:#{$value};width:98px;\" ></span>";
             $elementTrigger = array();
             break;
         case "widget":
             $config = " \n\t\t\t\t\t\t\tonShow: function (colpkr) {\n\t\t\t\t\t\t\t\tif(\$j(colpkr).css('display')=='none'){\n\t\t\t\t\t\t\t\t\t\$j(colpkr).fadeIn(300);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonHide: function (colpkr) {\n\t\t\t\t\t\t\t\t\$j(colpkr).fadeOut(300);\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t},\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tonSubmit: function(hsb, hex, rgb, el) {\n\t\t\t\t\t\t\t\t\$('{$this->m_Name}').value=hex;\n\t\t\t\t\t\t\t\t\$j('#colorpreview_{$this->m_Name}').css('backgroundColor', '#' + hex);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonChange: function (hsb, hex, rgb) {\n\t\t\t\t\t\t\t\t\$('{$this->m_Name}').value=hex;\n\t\t\t\t\t\t\t\t\$j('#colorpreview_{$this->m_Name}').css('backgroundColor', '#' + hex);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t";
             $sHTML .= "<span id=\"colorpreview_{$elementName}\" class=\"colorpicker_preview\" style=\"background-color:#{$value};\" {$func} ></span>";
             $sHTML .= "<INPUT NAME=\"" . $this->m_Name . "\" ID=\"" . $this->m_Name . "\" VALUE=\"" . $value . "\" type=\"hidden\" />";
             $elementTrigger = array("colorpreview_{$elementName}");
             break;
         case "flat":
             $config = "flat: true,\n\t\t\t\t\t\t\tonSubmit: function(hsb, hex, rgb, el) {\n\t\t\t\t\t\t\t\t\$('{$this->m_Name}').value=hex;\n\t\t\t\t\t\t\t\t\$j('#colorpreview_{$this->m_Name}').css('backgroundColor', '#' + hex);\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonChange: function (hsb, hex, rgb) {\n\t\t\t\t\t\t\t\t\$('{$this->m_Name}').value=hex;\n\t\t\t\t\t\t\t\t\$j('#colorpreview_{$this->m_Name}').css('backgroundColor', '#' + hex);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t";
             $sHTML .= "<span id=\"colorpreview_{$elementName}\" class=\"colorpicker_preview\" style=\"background-color:#{$value};\" ></span>";
             $sHTML .= "<INPUT NAME=\"" . $this->m_Name . "\" ID=\"" . $this->m_Name . "\" VALUE=\"" . $value . "\" {$disabledStr} {$this->m_HTMLAttr} {$style} {$func} />";
             $sHTML .= "<div id=\"colorpicker_{$elementName}\" style=\"float:left\"></div>";
             $elementTrigger = array("colorpicker_" . $elementName);
             break;
         default:
             $config = " \n\t\t\t\t\t\t\tonShow: function (colpkr) {\n\t\t\t\t\t\t\t\tif(\$j(colpkr).css('display')=='none'){\n\t\t\t\t\t\t\t\t\t\$j(colpkr).fadeIn(300);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonHide: function (colpkr) {\n\t\t\t\t\t\t\t\t\$j(colpkr).fadeOut(300);\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t},\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tonSubmit: function(hsb, hex, rgb, el) {\n\t\t\t\t\t\t\t\t\$('{$this->m_Name}').value=hex;\n\t\t\t\t\t\t\t\t\$j('#colorpreview_{$this->m_Name}').css('backgroundColor', '#' + hex);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonChange: function (hsb, hex, rgb) {\n\t\t\t\t\t\t\t\t\$('{$this->m_Name}').value=hex;\n\t\t\t\t\t\t\t\t\$j('#colorpreview_{$this->m_Name}').css('backgroundColor', '#' + hex);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t";
             $sHTML .= "<span id=\"colorpreview_{$elementName}\" class=\"colorpicker_preview\" style=\"background-color:#{$value};\" ></span>";
             $sHTML .= "<INPUT NAME=\"" . $this->m_Name . "\" ID=\"" . $this->m_Name . "\" VALUE=\"" . $value . "\" {$disabledStr} {$this->m_HTMLAttr} {$style} {$func} />";
             $elementTrigger = array($elementName, "colorpreview_{$elementName}");
             break;
     }
     if ($this->m_Config) {
         $config .= "," . $this->m_Config;
     }
     $config = "{" . $default_color . $config . "}";
     foreach ($elementTrigger as $trigger) {
         $sHTML .= "<script>\$j('#{$trigger}').ColorPicker({$config});</script>\n";
     }
     return $sHTML;
 }
コード例 #3
0
ファイル: chartService.php プロジェクト: que273/siremis
 /**
  * Render the chart output
  *
  * @param string $objName object name which is the bizform name
  * @return void
  */
 public function render($objName)
 {
     // get the value of the control that issues the call
     $chartName = BizSystem::clientProxy()->getFormInputs("__this");
     // get the current UI bizobj
     $formObj = BizSystem::getObject($objName);
     // get the existing bizform object
     $bizDataObj = $formObj->getDataObj();
     // get chart config xml file
     $chartXmlFile = BizSystem::GetXmlFileWithPath($objName . "_chart");
     $xmlArr = BizSystem::getXmlArray($chartXmlFile);
     ob_clean();
     // get the chart section from config xml file
     foreach ($xmlArr["BIZFORM_CHART"]["CHARTLIST"]["CHART"] as $chart) {
         if (count($xmlArr["BIZFORM_CHART"]["CHARTLIST"]["CHART"]) == 1) {
             $chart = $xmlArr["BIZFORM_CHART"]["CHARTLIST"]["CHART"];
         }
         // try to match the chartName, if no chartName given, always draw the first chart defined in xml file
         if ($chartName && $chart["ATTRIBUTES"]["NAME"] == $chartName || !$chartName) {
             if ($chart["ATTRIBUTES"]["GRAPHTYPE"] == 'XY') {
                 $this->xyGraphRender($bizDataObj, $chart);
                 break;
             }
             if ($chart["ATTRIBUTES"]["GRAPHTYPE"] == 'Pie') {
                 $this->pieGraphRender($bizDataObj, $chart);
                 break;
             }
         }
     }
 }
コード例 #4
0
 public function GoActive()
 {
     $rec = $this->readInputRecord();
     $this->setActiveRecord($rec);
     if ($rec['eula'] == "0") {
         $this->m_Errors = array("fld_eula" => 'You must agree with the license');
         $this->m_hasError = true;
         BizSystem::clientProxy()->setRPCFlag(true);
         return parent::rerender();
     }
     $appInfo = $this->getAppInfo();
     if (!$appInfo) {
         $rec['howto_active'] = 'ENTER';
     }
     switch (strtoupper($rec['howto_active'])) {
         case "ENTER":
             $this->switchForm("common.form.LicenseActiveForm");
             break;
         case "FREETRIAL":
             if ($this->getTrailLicense()) {
                 $scriptStr = 'location.reload();';
                 BizSystem::clientProxy()->runClientFunction($scriptStr);
             }
             break;
         case "PURCHASE":
             $url = $appInfo['APP_PURCHASE'];
             BizSystem::clientProxy()->redirectPage($url);
             break;
         case "WEBSITE":
             $url = $appInfo['APP_WEBSITE'];
             BizSystem::clientProxy()->redirectPage($url);
             break;
     }
 }
コード例 #5
0
ファイル: FormRenderer.php プロジェクト: que273/siremis
 /**
  * Render smarty template for form object
  *
  * @param EasyForm $formObj
  * @param string $tplFile
  * @return string result of rendering process
  */
 protected static function renderSmarty($formObj, $tplFile)
 {
     $smarty = BizSystem::getSmartyTemplate();
     $smarty->assign("formname", $formObj->m_Name);
     $smarty->assign("module", $formObj->getModuleName($formObj->m_Name));
     $smarty->assign("title", $formObj->m_Title);
     $smarty->assign("errors", $formObj->m_Errors);
     $smarty->assign("notices", $formObj->m_Notices);
     // if the $formobj form type is list render table, otherwise render record
     if ($formObj->m_FormType == 'LIST') {
         $recordSet = $formObj->fetchDataSet();
         $smarty->assign("dataPanel", $formObj->m_DataPanel->renderTable($recordSet));
     } else {
         $record = $formObj->fetchData();
         $smarty->assign("dataPanel", $formObj->m_DataPanel->renderRecord($record));
     }
     // render the formobj attributes
     $smarty->assign("form", $formObj->outputAttrs());
     $smarty->assign("actionPanel", $formObj->m_ActionPanel->render());
     $smarty->assign("navPanel", $formObj->m_NavPanel->render());
     if (isset($formObj->m_SearchPanel)) {
         foreach ($formObj->m_SearchPanel as $elem) {
             if (!$elem->m_FieldName) {
                 continue;
             }
             $search_record[$elem->m_FieldName] = BizSystem::clientProxy()->getFormInputs($elem->m_Name);
         }
         $smarty->assign("searchPanel", $formObj->m_SearchPanel->renderRecord($search_record));
     }
     return $smarty->fetch($tplFile);
 }
コード例 #6
0
ファイル: LanguageListbox.php プロジェクト: que273/siremis
 public function getFromList(&$list)
 {
     $current_locale = I18n::getInstance()->getCurrentLanguage();
     $country = BizSystem::clientProxy()->getFormInputs("fld_region");
     $country = strtoupper($country);
     if (!$country) {
         $locale = explode('_', $current_locale);
         $country = strtoupper($locale[0]);
     }
     require_once 'Zend/Locale.php';
     $locale = new Zend_Locale($current_locale);
     $code2name = $locale->getTranslationList('territorytolanguage', $locale);
     $list = array();
     $i = 0;
     foreach ($code2name as $key => $value) {
         if (preg_match('/' . $country . '/', $value) || strtoupper($key) == $country) {
             $lang_list = explode(" ", $value);
             foreach ($lang_list as $lang) {
                 $list[$i]['txt'] = strtolower($key) . "_" . strtoupper($lang);
                 $list[$i]['val'] = strtolower($key) . "_" . strtoupper($lang);
                 $i++;
             }
         }
     }
     return $list;
 }
コード例 #7
0
ファイル: NewForm.php プロジェクト: Why-Not-Sky/cubi-ng
 /**
  * Do insert record
  *
  * @param array $inputRecord
  * @return void
  */
 protected function _doInsert($inputRecord)
 {
     $dataRec = new DataRecord(null, $this->getDataObj());
     // $inputRecord['Id'] = null; // comment it out for name PK case
     foreach ($inputRecord as $k => $v) {
         $dataRec[$k] = $v;
     }
     // or $dataRec->$k = $v;
     try {
         $dataRec->save();
     } catch (ValidationException $e) {
         $errElements = $this->getErrorElements($e->m_Errors);
         if (count($e->m_Errors) == count($errElements)) {
             $this->formHelper->processFormObjError($errElements);
         } else {
             $errmsg = implode("<br />", $e->m_Errors);
             BizSystem::clientProxy()->showErrorMessage($errmsg);
         }
         return;
     } catch (BDOException $e) {
         $this->processBDOException($e);
         return;
     }
     $this->m_ActiveRecord = null;
     $this->getActiveRecord($dataRec["Id"]);
     //$this->runEventLog();
     return $dataRec["Id"];
 }
コード例 #8
0
ファイル: CKEditor.php プロジェクト: Why-Not-Sky/cubi-ng
 /**
  * Render element, according to the mode
  *
  * @return string HTML text
  */
 public function render()
 {
     BizSystem::clientProxy()->includeCKEditorScripts();
     $elementName = $this->m_Name;
     $value = $this->getValue();
     $value = htmlentities($value, ENT_QUOTES, "UTF-8");
     $style = $this->getStyle();
     $width = $this->m_Width ? $this->m_Width : 600;
     $height = $this->m_Height ? $this->m_Height : 300;
     //$func = "onclick=\"editRichText('$elementName', $width, $height);\"";
     if (!strlen($value) > 0) {
         // fix suggested by smarques
         $value = "&nbsp;";
     }
     $type = strtolower($this->m_Mode);
     $fileBrowserPage = APP_URL . "/bin/filebrowser/browser.html";
     $languageCode = I18n::getCurrentLangCode();
     $languageCode = str_replace("_", "-", $languageCode);
     $config = $this->m_Config;
     $sHTML .= "<textarea id=\"{$elementName}\" name=\"{$elementName}\" >{$value}</textarea>\n";
     $sHTML .= "<script type=\"text/javascript\">\n";
     if ($config) {
         //remove the last commas
         $config = trim($config);
         if (substr($config, strlen($config) - 1, 1) == ',') {
             $config = substr($config, strlen($config) - 1);
         }
         $sHTML .= "Openbiz.CKEditor.init('{$elementName}',{'type':'{$type}','filebrowserBrowseUrl':'{$fileBrowserPage}','language':'{$languageCode}','height':'{$height}','width':'{$width}',{$config}});\n";
     } else {
         $sHTML .= "Openbiz.CKEditor.init('{$elementName}',{'type':'{$type}','filebrowserBrowseUrl':'{$fileBrowserPage}','language':'{$languageCode}','height':'{$height}','width':'{$width}'});\n";
     }
     $sHTML .= "</script>\n";
     return $sHTML;
 }
コード例 #9
0
ファイル: FileUploader.php プロジェクト: que273/siremis
 /**
  * Set value of element
  *
  * @param mixed $value
  * @return string
  */
 function setValue($value)
 {
     if ($this->m_Deleteable == 'N') {
     } else {
         $delete_user_opt = BizSystem::clientProxy()->getFormInputs($this->m_Name . "_DELETE");
         if ($delete_user_opt) {
             $this->m_Value = "";
             return;
         } else {
             if (count($_FILES) > 0) {
             } else {
                 $this->m_Value = $value;
             }
         }
     }
     if (count($_FILES) > 0) {
         if (!$this->m_Uploaded) {
             $file = $_FILES[$this->m_Name];
             if (!is_dir($this->m_UploadRoot . $this->m_UploadFolder)) {
                 mkdir($this->m_UploadRoot . $this->m_UploadFolder, 0777, true);
             }
             $uploadFile = $this->m_UploadFolder . "/" . date("YmdHis") . "-" . urlencode($file['name']);
             if (move_uploaded_file($file['tmp_name'], $this->m_UploadRoot . $uploadFile)) {
                 $this->m_Value = $this->m_UploadRootURL . $uploadFile;
                 $this->m_Uploaded = true;
             }
             return $uploadFile;
         }
     }
 }
コード例 #10
0
ファイル: HTMLMenus.php プロジェクト: que273/siremis
    /**
     * Initialize HTMLMenus with xml array
     *
     * @param array $xmlArr
     * @return void
     */
    function __construct(&$xmlArr)
    {
        $this->readMetadata($xmlArr);
        BizSystem::clientProxy()->appendStyles("menu", "menu.css");
        BizSystem::clientProxy()->appendScripts("menu-ie-js", '<!--[if gte IE 5.5]>
		<script language="JavaScript" src="".Resource::getJsUrl()."/ie_menu.js" type="text/JavaScript"></script>
		<![endif]-->', false);
    }
コード例 #11
0
ファイル: GroupView.php プロジェクト: Why-Not-Sky/cubi-ng
 public function allowAccess($access = null)
 {
     if ($this->isNeedInitialize()) {
         BizSystem::sessionContext()->setVar("_GROUP_INITIALIZE_LASTVIEW", $_SERVER['REQUEST_URI']);
         BizSystem::clientProxy()->redirectPage(APP_INDEX . '/system/initialize_group');
     }
     return parent::allowAccess($access);
 }
コード例 #12
0
ファイル: CopyForm.php プロジェクト: Why-Not-Sky/cubi-ng
 public function render()
 {
     $this->getUrlParameters();
     if (empty($this->m_RecordId)) {
         BizSystem::clientProxy()->showClientAlert($this->getMessage("PLEASE_EDIT_A_RECORD"));
         return;
     }
     return parent::render();
 }
コード例 #13
0
ファイル: InputDate.php プロジェクト: que273/siremis
 /**
  * Render / draw the element according to the mode
  *
  * @return string HTML text
  */
 public function render()
 {
     BizSystem::clientProxy()->includeCalendarScripts();
     $format = $this->m_DateFormat ? $this->m_DateFormat : "%Y-%m-%d";
     $sHTML = parent::render();
     $showTime = 'false';
     //$image = "<img src=\"".Resource::getImageUrl()."/calendar.gif\" border=0 title=\"Select date...\" align='top' hspace='2'>";
     $sHTML .= "<a class=\"date_picker\" href=\"javascript: void(0);\" onclick=\"return showCalendar('{$this->m_Name}','{$format}',{$showTime},true);\"></a>";
     return $sHTML;
 }
コード例 #14
0
ファイル: InputDatetime.php プロジェクト: Why-Not-Sky/cubi-ng
 /**
  * Render / draw the element according to the mode
  *
  * @return string HTML text
  */
 public function render()
 {
     BizSystem::clientProxy()->includeCalendarScripts();
     $format = $this->m_DateFormat ? $this->m_DateFormat : "%Y-%m-%d %H:%M:%S";
     $sHTML = parent::render();
     $showTime = "'24'";
     //$image = "<img src=\"".Resource::getImageUrl()."/calendar.gif\" border=0 title=\"Select date...\" align='top' hspace='2'>";
     $sHTML .= "<a title=\"Select date...\"  class=\"date_picker\" href=\"javascript: void(0);\" onclick=\"return showCalendar('" . $this->m_Name . "', '" . $format . "', " . $showTime . ", true); return false;\"  onmousemove='window.status=\"Select a datetime\"' onmouseout='window.status=\"\"'></a>";
     return $sHTML;
 }
コード例 #15
0
ファイル: ViewRenderer.php プロジェクト: que273/siremis
 /**
  * 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));
     }
 }
コード例 #16
0
ファイル: AccountEditForm.php プロジェクト: que273/siremis
 public function rerender()
 {
     // clean active record to force query again
     $this->m_ActiveRecord = null;
     // set fix search rule
     if (!$this->_userId) {
         return BizSystem::clientProxy()->redirectView(ACCESS_DENIED_VIEW);
     }
     $this->m_FixSearchRule = "[Id]=" . $this->_userId;
     return parent::rerender();
 }
コード例 #17
0
ファイル: DisplayNameBox.php プロジェクト: que273/siremis
 public function getValue()
 {
     $value = parent::getValue();
     $firstname = BizSystem::clientProxy()->getFormInputs("fld_first_name");
     $lastname = BizSystem::clientProxy()->getFormInputs("fld_last_name");
     $company = BizSystem::clientProxy()->getFormInputs("fld_company");
     $value = str_replace("@@Firstname@@", $firstname, $value);
     $value = str_replace("@@Lastname@@", $lastname, $value);
     $value = str_replace("@@Company@@", $company, $value);
     return $value;
 }
コード例 #18
0
 public function reorderWidgets()
 {
     $sortorder = BizSystem::clientProxy()->getFormInputs('_widgets');
     // get the widgets ordering of columns
     parse_str($sortorder, $output);
     $columns = array();
     $columnCounts = array();
     $n = 0;
     foreach ($output as $k => $val) {
         if (strpos($k, 'column') === 0) {
             $columns[$n] = explode(",", $val);
             $columnCounts[$n] = count($columns[$n]);
             $n++;
         }
     }
     //print_r($columns);
     // update ordering of all user_widget records
     $userWidgetDo = BizSystem::getObject($this->userWidgetDOName);
     $userWidgetTable = $userWidgetDo->m_MainTable;
     $db = $userWidgetDo->getDbConnection();
     $myProfile = BizSystem::getUserProfile();
     $myUserId = $myProfile['Id'];
     $currentView = BizSystem::instance()->getCurrentViewName();
     $m = 1;
     foreach ($columns as $column) {
         $n = 1;
         foreach ($column as $widgetName) {
             if (empty($widgetName)) {
                 continue;
             }
             // remove "_widget" from the widget name
             $widgetName = str_replace("_widget", "", $widgetName);
             // find the widget by name in the current view, set the new order
             $searchRule = "[user_id]={$myUserId} and [widget]='{$widgetName}' and [view]='{$currentView}'";
             $record = $userWidgetDo->fetchOne($searchRule);
             $ordering = $n * 10;
             if ($record) {
                 // update the order
                 $data = array('column' => $m, 'ordering' => $ordering);
                 $db->update($userWidgetTable, $data, "id=" . $record['Id']);
             } else {
                 // insert a record with the order
                 $data = array('user_id' => $myUserId, 'widget' => $widgetName, 'view' => $currentView, 'column' => $m, 'ordering' => $ordering);
                 $db->insert($userWidgetTable, $data);
             }
             $n++;
         }
         $m++;
     }
 }
コード例 #19
0
 public function getSearchRule()
 {
     $value = BizSystem::clientProxy()->getFormInputs($this->m_Name);
     $field = $this->m_FieldName;
     $dates = explode("-", $value);
     $date_start = str_replace("/", "-", trim($dates[0])) . " 00:00:00";
     if (count($dates) == 2) {
         $date_end = str_replace("/", "-", trim($dates[1])) . " 23:59:59";
     } else {
         $date_end = str_replace("/", "-", trim($dates[0])) . " 23:59:59";
     }
     $searchRule = "([{$field}] >'{$date_start}' AND [{$field}]<'{$date_end}')";
     return $searchRule;
 }
コード例 #20
0
ファイル: InputForm.php プロジェクト: Why-Not-Sky/cubi-ng
 /**
  * Read inputs
  *
  * @return array array of input
  */
 protected function readInputs()
 {
     $inputArr = array();
     foreach ($this->m_DataPanel as $element) {
         $value = BizSystem::clientProxy()->getFormInputs($element->m_Name);
         $element->setValue($value);
         $inputArr[$element->m_Name] = $value;
     }
     foreach ($this->m_SearchPanel as $element) {
         $value = BizSystem::clientProxy()->getFormInputs($element->m_Name);
         $element->setValue($value);
         $inputArr[$element->m_Name] = $value;
     }
     return $inputArr;
 }
コード例 #21
0
ファイル: AutoSuggest.php プロジェクト: que273/siremis
 /**
  * Render element, according to the mode
  *
  * @return string HTML text
  */
 public function render()
 {
     BizSystem::clientProxy()->appendScripts("scriptaculous", "scriptaculous.js");
     $inputName = $this->m_Name;
     $inputChoice = $this->m_Name . '_choices';
     $style = $this->getStyle();
     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}'\"";
     }
     $sHTML = "<input type=\"text\" id=\"{$inputName}\" name=\"{$inputName}\" value=\"{$this->m_Value}\" {$style} {$func}/>\n";
     $sHTML .= "<div id=\"{$inputChoice}\" class=\"autocomplete\" style=\"display:none\"></div>\n";
     $sHTML .= "<script>Openbiz.AutoSuggest.init('{$this->m_FormName}','AutoSuggest','{$inputName}','{$inputChoice}');</script>";
     return $sHTML;
 }
コード例 #22
0
ファイル: ErrorHandler.php プロジェクト: que273/siremis
 /**
  * User exception handler
  *
  * @param  object $exc hold error data
  * @return void
  **/
 public static function exceptionHandler($exc)
 {
     $errno = $exc->getCode();
     $errmsg = $exc->getMessage();
     $filename = $exc->getFile();
     $linenum = $exc->getLine();
     $debug_array = $exc->getTrace();
     $back_trace = self::_errorBacktrace($debug_array);
     $err = self::_getOutputErrorMsg($errno, $errmsg, $filename, $linenum, $back_trace);
     BizSystem::logError($errno, "ExceptionHandler", $errmsg, null, $back_trace);
     if (defined('CLI') && CLI) {
         echo $err;
     } else {
         BizSystem::clientProxy()->showErrorMessage($err, true);
     }
     exit;
 }
コード例 #23
0
ファイル: ImageUploader.php プロジェクト: Why-Not-Sky/cubi-ng
 /**
  * Set value of element
  *
  * @param mixed $value
  * @return mixed
  */
 function setValue($value)
 {
     if ($this->m_Deleteable == 'N') {
     } else {
         $delete_user_opt = BizSystem::clientProxy()->getFormInputs($this->m_Name . "_DELETE");
         if ($delete_user_opt) {
             $this->m_Value = "";
             return;
         } else {
             if (count($_FILES) > 0) {
             } else {
                 $this->m_Value = $value;
             }
         }
     }
     if (count($_FILES) > 0) {
         if (!$this->m_Uploaded && $_FILES[$this->m_Name]["size"] > 0) {
             $picFileName = parent::setValue($value);
             if ((int) $this->m_PicWidth > 0 || (int) $this->m_PicHeight > 0) {
                 //resize picture size
                 $fileName = $this->m_UploadRoot . $picFileName;
                 $width = $this->m_PicWidth;
                 $height = $this->m_PicHeight;
                 $quality = $this->m_PicQuality;
                 $this->resizeImage($fileName, $fileName, $width, $height, $quality);
             }
             if (((int) $this->m_ThumbWidth > 0 || (int) $this->m_ThumbHeight > 0) && $this->m_ThumbFolder != "") {
                 //generate thumbs picture
                 if (!is_dir($this->m_UploadRoot . $this->m_ThumbFolder)) {
                     mkdir($this->m_UploadRoot . $this->m_ThumbFolder, 0777, true);
                 }
                 $file = $_FILES[$this->m_Name];
                 $thumbPath = $this->m_ThumbFolder . "/thumbs-" . date("YmdHis") . "-" . urlencode($file['name']);
                 $thumbFileName = $this->m_UploadRoot . $thumbPath;
                 $width = $this->m_ThumbWidth;
                 $height = $this->m_ThumbHeight;
                 $quality = $this->m_ThumbQuality;
                 $this->resizeImage($fileName, $thumbFileName, $width, $height, $quality);
                 $result = array('picture' => $this->m_UploadRootURL . $picFileName, 'thumbpic' => $this->m_UploadRootURL . $thumbPath);
                 $this->m_Value = serialize($result);
             }
         }
     } else {
         $this->m_Value = $value;
     }
 }
コード例 #24
0
ファイル: EventLogForm.php プロジェクト: que273/siremis
 public function ClearLog()
 {
     if ($this->m_Resource != "" && !$this->allowAccess($this->m_Resource . ".delete")) {
         return BizSystem::clientProxy()->redirectView(ACCESS_DENIED_VIEW);
     }
     try {
         $this->getDataObj()->deleteRecords();
     } catch (BDOException $e) {
         $this->processBDOException($e);
         return;
     }
     if ($this->m_FormType == "LIST") {
         $this->rerender();
     }
     $this->runEventLog();
     $this->processPostAction();
     return true;
 }
コード例 #25
0
 public function SwitchSession()
 {
     if (!BizSystem::allowUserAccess('Session.Switch_Session')) {
         if (!BizSystem::sessionContext()->getVar("_PREV_USER_PROFILE")) {
             return;
         }
     }
     $data = $this->readInputRecord();
     $username = $data['username'];
     if (!$username) {
         return;
     }
     $serviceObj = BizSystem::getService(PROFILE_SERVICE);
     if (method_exists($serviceObj, 'SwitchUserProfile')) {
         $serviceObj->SwitchUserProfile($username);
     }
     BizSystem::clientProxy()->runClientScript("<script>window.location.reload();</script>");
 }
コード例 #26
0
 protected function addWidget($widgetName)
 {
     // add widget to user_widget table
     $userWidgetDo = BizSystem::getObject($this->userWidgetDOName);
     $userWidgetTable = $userWidgetDo->m_MainTable;
     $db = $userWidgetDo->getDbConnection();
     $myProfile = BizSystem::getUserProfile();
     $myUserId = $myProfile['Id'];
     $currentView = BizSystem::instance()->getCurrentViewName();
     $searchRule = "[user_id]={$myUserId} and [widget]='{$widgetName}' and [view]='{$currentView}'";
     $record = $userWidgetDo->fetchOne($searchRule);
     if ($record) {
         BizSystem::clientProxy()->showClientAlert("The widget {$widgetName} is already on the page.");
     } else {
         $data = array('user_id' => $myUserId, 'widget' => $widgetName, 'view' => $currentView, 'ordering' => 0);
         $db->insert($userWidgetTable, $data);
     }
 }
コード例 #27
0
 public function switchViewMode()
 {
     if (!$this->lastViewMode) {
         $this->lastViewMode = $this->getViewMode();
     }
     $viewObj = $this->getViewObject();
     //$viewObj = $this->getView();
     if ($viewObj->m_LastRenderedForm && $viewObj->m_LastRenderedForm != 'help.form.HelpWidgetListForm' && $viewObj->m_LastRenderedForm != 'notification.widget.NotificationWidgetForm') {
         $this->lastViewMode = $viewObj->m_LastRenderedForm;
     }
     $recArr = $this->readInputRecord();
     $this->viewMode = $recArr['viewmode'];
     $targetForm = $recArr['viewmode'];
     $formObj = BizSystem::GetObject($targetForm);
     $formHTML = $formObj->render();
     BizSystem::clientProxy()->redrawForm($this->lastViewMode, $formHTML);
     $this->lastViewMode = $this->viewMode;
 }
コード例 #28
0
ファイル: FormRenderer.php プロジェクト: Why-Not-Sky/cubi-ng
 /**
  * Gather all template variables needed. Should play well with Smarty or Zend templates
  *
  * @param EasyView $formObj
  * @return array associative array holding all needed VIEW based template variables
  */
 public static function buildTemplateAttributes($formObj)
 {
     // Assocative Array to hold all Template Values
     // Fill with default viewobj attributes
     $tplAttributes = array();
     $tplAttributes['title'] = $formObj->m_Title;
     $tplAttributes['errors'] = $formObj->m_Errors;
     $tplAttributes['notices'] = $formObj->m_Notices;
     $tplAttributes['formname'] = $formObj->m_Name;
     $tplAttributes['module'] = $formObj->getModuleName($formObj->m_Name);
     // if the $formobj form type is list render table, otherwise render record
     if (strtoupper($formObj->m_FormType) == 'LIST') {
         $tplAttributes['dataPanel'] = $formObj->m_DataPanel->render();
     } else {
         $tplAttributes['dataPanel'] = $formObj->m_DataPanel->render();
     }
     if (isset($formObj->m_SearchPanel)) {
         $search_record = $formObj->m_SearchPanelValues;
         foreach ($formObj->m_SearchPanel as $elem) {
             if (!$elem->m_FieldName) {
                 continue;
             }
             $post_value = BizSystem::clientProxy()->getFormInputs($elem->m_Name);
             if ($post_value) {
                 $search_record[$elem->m_FieldName] = $post_value;
             }
         }
         $tplAttributes['searchPanel'] = $formObj->m_SearchPanel->renderRecord($search_record);
     } else {
         $tplAttributes['searchPanel'] = $formObj->m_SearchPanel->render();
     }
     $tplAttributes['actionPanel'] = $formObj->m_ActionPanel->render();
     $tplAttributes['navPanel'] = $formObj->m_NavPanel->render();
     if ($formObj->m_WizardPanel) {
         $tplAttributes['wizardPanel'] = $formObj->m_WizardPanel->render();
     }
     $tplAttributes['form'] = $formObj->outputAttrs();
     $outputAttrs = $formObj->outputAttrs();
     foreach ($outputAttrs as $k => $v) {
         $tplAttributes[$k] = $v;
     }
     return $tplAttributes;
 }
コード例 #29
0
ファイル: CacheForm.php プロジェクト: que273/siremis
 public function Clear()
 {
     if ($id == null || $id == '') {
         $id = BizSystem::clientProxy()->getFormInputs('_selectedId');
     }
     $selIds = BizSystem::clientProxy()->getFormInputs('row_selections', false);
     if ($selIds == null) {
         $selIds[] = $id;
     }
     foreach ($selIds as $id) {
         $data = $this->getRecoredDetail($id);
         if (substr($item['Id'], 0, 7) == 'APPDATA') {
             $this->DeleteDirectory($data['path'], true);
         } else {
             $this->DeleteDirectory($data['path'], false);
         }
     }
     $this->updateForm();
 }
コード例 #30
0
ファイル: InputPassword.php プロジェクト: que273/siremis
 /**
  * Render / draw the element according to the mode
  *
  * @return string HTML text
  */
 public function render()
 {
     $value = BizSystem::clientProxy()->getFormInputs($this->m_Name);
     if ($value == '') {
         $value = $this->m_PasswordMask;
         $this->m_Value_Real = $this->m_Value;
     }
     $disabledStr = $this->getEnabled() == "N" ? "DISABLED=\"true\"" : "";
     $style = $this->getStyle();
     $func = $this->getEnabled() == 'N' ? "" : $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}'\"";
     }
     $sHTML = "<INPUT TYPE=\"PASSWORD\" NAME='{$this->m_Name}' ID=\"" . $this->m_Name . "\" VALUE='{$value}' {$disabledStr} {$this->m_HTMLAttr} {$style} {$func} />";
     return $sHTML;
 }