public function build($name, $value = null, $attribs = null, $disable = false) { //$info = $this->_getInfo($name, $value, $attribs); //extract($info); // name, value, attribs, options, listsep, disable // build the element if ($disable) { // disabled $xhtml = $this->_hidden($name, $value) . htmlspecialchars($value); } else { // enabled if (!isset($attribs["id"])) { $id = "person_selector_" . $name; $attribs["id"] = $id; } if (!isset($attribs["onclick"])) { $attribs["onclick"] = 'userSelTool.show( null, \'' . $attribs["id"] . '\', this, \'' . @$attribs["param"] . '\' );return false;'; if (!isset($attribs["style"])) { $attribs["style"] = 'cursor:pointer;'; } } $sitePath = Pft_Config::getSiteRoot(); $xhtml = $this->_getCommonHtml(); $xhtml .= Pft_View_Helper::buildElmentByVartype("C", $name, $value, $attribs); /* $xhtml = '<input type="text"' . ' name="' . htmlspecialchars($name) . '"' . ' value="' . htmlspecialchars($value) . '"' . $this->_htmlAttribs($attribs) . ' />';*/ $xhtml .= '<a href="#" class="btn" type="button" id="btnSelectCr" onclick="userSelTool.show( null, \'' . $attribs["id"] . '\', this, \'' . @$attribs["param"] . '\' );return false;">' . i18ntrans('#选') . '</a>'; } return $xhtml; }
public function build($name, $value = null, $attribs = null, $disable = false) { //$info = $this->_getInfo($name, $value, $attribs); //extract($info); // name, value, attribs, options, listsep, disable // build the element if ($disable) { // disabled $xhtml = $this->_hidden($name, $value) . htmlspecialchars($value); } else { // enabled $id = "dingdan_selector_" . $name; $attribs["id"] = $id; $sitePath = Pft_Config::getSiteRoot(); $xhtml = $this->_getCommonHtml(); $xhtml .= Pft_View_Helper::buildElmentByVartype("C", $name, $value, $attribs); //echo "<script>alert('aa');</script>"; /* $xhtml = '<input type="text"' . ' name="' . htmlspecialchars($name) . '"' . ' value="' . htmlspecialchars($value) . '"' . $this->_htmlAttribs($attribs) . ' />';*/ $xhtml .= '<a href="#" class="btn" type="button" id="btnSelectCr" onclick="ddSelTool.show( \'' . $attribs["id"] . '\', this,\'\',\'s0=\'+document.all.' . $name . '.value+\'\' );return false;">' . i18ntrans('#选') . '</a>'; } return $xhtml; }
public function build($name, $value = null, $attribs = null, $disable = false) { //$info = $this->_getInfo($name, $value, $attribs); //extract($info); // name, value, attribs, options, listsep, disable // build the element if ($disable) { // disabled $xhtml = $this->_hidden($name, $value) . htmlspecialchars($value); } else { // enabled if (!isset($attribs['id'])) { $id = "date" . mt_rand(1000, 9999); $attribs["id"] = $id; } else { $id = $attribs["id"]; } $sitePath = Pft_Config::getSiteRoot(); $xhtml = Pft_View_Helper::buildElmentByVartype("C", $name, $value, $attribs); $xhtml .= $this->_getCommonHtml(); /* $xhtml = '<input type="text"' . ' name="' . htmlspecialchars($name) . '"' . ' value="' . htmlspecialchars($value) . '"' . $this->_htmlAttribs($attribs) . ' />';*/ $xhtml .= <<<EOT <img id="dateButton_{$id}" src="{$sitePath}js/john/jscalendar/calendar.gif" border="0" align="absmiddle" style="cursor:pointer" /> <!--<input name="start_date[{\$i}]" type="text" class="Input1" id="start_date[{\$i}]" value="{\$start_mren}" size="14" readonly/>--> <script type="text/javascript"> Calendar.setup({ inputField : "{$id}", EOT; if ($this->_showTimes) { $xhtml .= ' ifFormat : "%Y-%m-%d %H:%M", showsTime : true,'; } else { if ($this->_showTimeSecs) { $xhtml .= ' ifFormat : "%Y-%m-%d %H:%M:%S", showsTime : true,'; } else { $xhtml .= ' ifFormat : "%Y-%m-%d",'; } } $xhtml .= <<<EOT button : "dateButton_{$id}", singleClick : true, step : 1 }); </script> EOT; /* $xhtml .= <<<EOT <img id="dateButton_{$id}" src="{$sitePath}js/john/jscalendar/calendar.gif" border="0" align="absmiddle" style="cursor:pointer" onClick="Calendar.setDayHM(document.getElementById({$id}),0,'');"/> EOT;*/ } return $xhtml; }
/** * 使用array建立form * * @param mix $data * @param string $action = "" * @param string $method = "post" * @param boolean $enable = true * @param boolean $show = true * @return string HTML */ public static function buildFormWithDbData($data, $action = "", $method = "post", $enable = true, $show = true, $dataDesc = array(), $cols = 2) { //忽略列表应可动态增加 $formId = mt_rand(100, 999); $out = "<div><form id='form" . $formId . "' action=\"{$action}\" method=\"" . $method . "\" onsubmit=\"\$('{$formId}_submit_area').hide();\$('{$formId}_submit_area_mask').show();if(Tpm.Validator.checkForm(this)){return true;}else{ \$('{$formId}_submit_area_mask').hide();\$('{$formId}_submit_area').show();return false; }\">\n"; $out .= '<table class="formtable">'; if (is_array($data)) { $i = 0; foreach ($data as $key => $val) { if (self::_isIgnoreField($key)) { continue; } if ($i == 0) { $out .= "<tr>"; } elseif ($i % $cols == 0) { $out .= "</tr>\n<tr>"; } $i++; $out .= "<th class=GridTH>" . Pft_I18n::trans($key) . "</th>"; $out .= "<td>"; if ($enable) { if (strlen($val) > self::$_bigTextLen) { $out .= "<textarea cols=" . self::$_bigTextLen . " id=\"{$key}\" name=\"{$key}\" rule=\"\" ruletip=\"\">" . htmlspecialchars($val) . "</textarea>"; } else { $out .= Pft_View_Helper::buildElmentByVartype("", $key, $val, array('rule' => '', 'ruletip' => '')); //$out .= "<input type=\"text\" name=\"$key\" value=\"" // . htmlspecialchars($val) ."\" />"; } } else { $out .= htmlspecialchars($val); } $out .= "</td>"; if (key_exists($key, $dataDesc)) { $out .= "<td class=\"formdesc\">"; $out .= htmlspecialchars($dataDesc[$key]); $out .= "</td>"; } //$out .= "</tr>\n" ; } if ($i > 0) { $out .= "</tr>\n"; } if ($enable) { //$out .= "<tr><td colspan=99 align=center><input type='submit' class='btn'/> <input type='reset' class='btn'/></td></tr>\n"; $out .= "\n<tr><td colspan=99 align=center class='bottom'>\n\t<div align=\"center\" id=\"{$formId}_submit_area\">\n\t\t<input type='submit' name='Submit' value=\"" . Pft_I18n::trans('SUBMIT') . "\" class='btn'/> \n\t\t<input type='reset' value=\"" . Pft_I18n::trans('RESET') . "\" class='btn'/>\n\t\t<input type='button' class='btn' onclick=\"history.back()\" value=\"" . Pft_I18n::trans('GOBACK') . "\"/>\n\t</div>\n\t<div align='center' id='{$formId}_submit_area_mask' style='display:none' ondblclick=\"\$('{$formId}_submit_area_mask').hide();\$('{$formId}_submit_area').show();\">\n\t\t" . Pft_I18n::trans('数据提交中,请稍候...') . "\n\t</div>\n</td></tr>"; } } else { } $out .= "</table><input type='hidden' id='{$formId}_op' name='op' value='1'></form></div>\n"; if ($show) { echo $out; } return $out; }
public function build($name, $value = null, $attribs = null, $disable = false, $extend = null) { //$info = $this->_getInfo($name, $value, $attribs); //extract($info); // name, value, attribs, options, listsep, disable $xhtml = ''; // build the element if ($disable) { // disabled $xhtml = $this->_hidden($name, $value) . htmlspecialchars($value); } else { // enabled if (!self::$_isBuildedCommonJs) { $xhtml .= $this->_getCommonHtml(); //$xhtml .= "<div id='chaxun_zhushou_xMsg' style='padding:1px;background-color:white;display:none;left:360px;top:160px;position:absolute;'></div>"; self::$_isBuildedCommonJs = true; } $id = "dingdan_selector_" . $name; $attribs["id"] = $id; //$attribs[ "onkeyup" ] = "div_chaxun_zhushou('" . $extend['SearchType'] . "')"; //$attribs[ "onblur" ] = "div_chaxun_zhushou_yincang()"; $xhtml .= Pft_View_Helper::buildElmentByVartype("C", $name, $value, $attribs); $xhtml .= <<<EOT \t\t\t<script type="text/javascript"> \t\t\tTpm.SearchTip.setup( '{$id}', '{$extend['SearchType']}' ); \t\t\t</script> EOT; //echo "<script>alert('aa');</script>"; /* $xhtml = '<input type="text"' . ' name="' . htmlspecialchars($name) . '"' . ' value="' . htmlspecialchars($value) . '"' . $this->_htmlAttribs($attribs) . ' />';*/ } return $xhtml; }