本文整理汇总了PHP中FormBuilder::adminIcon方法的典型用法代码示例。如果您正苦于以下问题:PHP FormBuilder::adminIcon方法的具体用法?PHP FormBuilder::adminIcon怎么用?PHP FormBuilder::adminIcon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormBuilder
的用法示例。
在下文中一共展示了FormBuilder::adminIcon方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: simplePaginator
public static function simplePaginator($totalrows, $param_obj = "")
{
if (is_array($totalrows)) {
$totalrows = 1;
}
$accelJS = AccelJS::findThis();
$curpage = isset($_REQUEST["page"]) ? $_REQUEST["page"] : 1;
$default_limit = isset($param_obj['default_limit']) ? $param_obj['default_limit'] : 50;
$numrows = isset($_REQUEST["limit"]) ? $_REQUEST["limit"] : $default_limit;
$accelJS->js("\n function select_new_pagination(reset_page,searchStr){\n\n var default_limit = {$default_limit};\n var search = unescape(window.location.search);\n var path = unescape(window.location.pathname);\n\n page_num = reset_page == 1 ? 1 : \$('#curpage_select').val();\n\n search = search.replace(\"?\",\"\");\n queryArr = search.split(\"&\");\n\n for (var i = 0;i < queryArr.length;i++) {\n\n if (queryArr[i].indexOf(\"limit\") >= 0){\n queryArr.splice(i,1);\n\n }\n\n if ( queryArr[i] != undefined ){\n if (queryArr[i].indexOf(\"page\") >= 0){\n queryArr.splice(i,1);\n\n }\n }\n\n if ( queryArr[i] != undefined ){\n if (queryArr[i].indexOf(\"search_string\") >= 0){\n queryArr.splice(i,1);\n }\n }\n\n }\n\n if (page_num == undefined) page_num = 1;\n\n if (\$('#numrows_select').length > 0){\n page_limit = \$('#numrows_select').val();\n }else {\n page_limit = default_limit;\n }\n\n\n if (queryArr.length > 0){\n newSearch = \"?\" + queryArr.join(\"&\") + \"&limit=\" + page_limit + \"&page=\" + page_num;\n }else {\n\n newSearch = \"?limit=\" + page_limit + \"&page=\" + page_num;\n\n }\n\n\n searchStr = encodeURI( searchStr );\n\n if (searchStr.length > 0) newSearch += \"&search_string=\" + searchStr;\n\n window.location = path + newSearch;\n }\n ");
$accelJS->ready("\n \$(\"#numrows_select\").change( function(){\n select_new_pagination(1,'');\n });\n\n \$(\"#curpage_select\").change( function(){\n select_new_pagination(0,'');\n });\n ");
if ($numrows == "All") {
$numrows = $totalrows;
}
$numrows_sel_text = isset($param_obj['numrows_key']) ? $param_obj['numrows_key'] : "Rows per page: ";
$curpage_sel_text = "<b>Jump to page:</b>";
$start = $curpage * $numrows + 1;
$end = $start + $numrows;
if ($end > $totalrows) {
$end = $totalrows;
}
if ($numrows > 0) {
$total_pages = ceil($totalrows / $numrows);
} else {
$total_pages = 1;
}
for ($i = 1; $i <= $total_pages; $i++) {
$page_list[] = $i;
}
if ($numrows == $totalrows && $totalrows > 100) {
$_numrows = "All";
} else {
$_numrows = $numrows;
}
// if they've passed in a default_limit we need it in the rows selector
$nr_selectorArray = array(2, 5, 10, 25, 50, 100);
if ($totalrows < 1000) {
$nr_selectorArray[] = 'All';
}
if ($param_obj['default_limit'] && !in_array($param_obj['default_limit'], $nr_selectorArray)) {
array_unshift($nr_selectorArray, $param_obj['default_limit']);
}
$nr_selector = self::dropDownFromArray($nr_selectorArray, "numrows", $_numrows);
$cp_selector = self::dropDownFromArray($page_list, "curpage", $curpage);
$strip_link = $_SERVER["REQUEST_URI"];
if (strpos($_SERVER["REQUEST_URI"], '?page') !== false) {
$thisSeparator = '?';
} elseif (strpos($_SERVER["REQUEST_URI"], '?') === false) {
$thisSeparator = '?';
} else {
$thisSeparator = '&';
}
$strip_link = str_replace("&page=" . $_GET["page"], "", $strip_link);
$strip_link = str_replace("?page=" . $_GET["page"], "", $strip_link);
$prev_count = $curpage - 1 > 0 ? $curpage - 1 : 1;
$next_count = $curpage + 1 <= $total_pages ? $curpage + 1 : $total_pages;
$prevLink = "<a href='{$strip_link}{$thisSeparator}page={$prev_count}'>« Prev</a>";
$nextLink = "<a href='{$strip_link}{$thisSeparator}page={$next_count}'>Next »</a>";
$searchTitle = isset($param_obj["searchTitle"]) ? $param_obj["searchTitle"] : "Search:";
$searchBox = "";
if (isset($param_obj['searchBox'])) {
$jscr = "\n \$('#search_now').click ( function(){\n search = \$('#searchBox').val();\n select_new_pagination(0,search);\n });\n\n \$('#searchBox').keyup(function(e) {\n if(e.keyCode == 13) {\n search = \$('#searchBox').val();\n select_new_pagination(0,search);\n }\n })\n";
AccelJS::findThis()->ready($jscr);
$param_obj["searchBox"]["post"] = array('searchBox' => $_REQUEST["search_string"]);
$searchBox = FormBuilder::quickTextField("searchBox", $param_obj['searchBox']);
$searchBtn = "<img id='search_now' style='cursor:pointer; margin:0px; padding:0px;' src='" . self::adminIconSrc('find') . "' />";
$searchBox = "<div style='float:left;'><table cellpadding='2px' cellspacing='2px' border='0'>\n <tr><td style='font-weight:bold;'>{$searchTitle}</td><td>{$searchBox}</td><td>{$searchBtn}</td></tr>\n </table></div>";
} elseif (isset($param_obj['autoCompleter'])) {
$jscr = "\n\n \$('#search_now').click ( function(){\n search = \$('#searchBox_ac').val();\n select_new_pagination(0,search);\n });";
AccelJS::findThis()->ready($jscr);
$searchBtn = " <span style='cursor:pointer;' id='search_now'>" . FormBuilder::adminIcon('find', 'Query Results') . '</span>';
$searchBox = FormBuilder::autoCompleter(null, "searchBox", $param_obj['autoCompleter']);
$searchBox = "<div style='float:left; padding-left:10px'><b>{$searchTitle}</b> {$searchBox} {$searchBtn}</div>";
} elseif (isset($param_obj['dropdown'])) {
$jscr = "\n\n \$('#search_now').click ( function(){\n search = \$('#searchBox_select').val();\n select_new_pagination(0,search);\n });";
AccelJS::findThis()->ready($jscr);
$search_str = $param_obj['dropdown'];
$arr = $param_obj["dropdownArr"];
$searchBtn = " <span style='cursor:pointer;' id='search_now'>" . FormBuilder::adminIcon('find', 'Query Results') . '</span>';
$searchBox = self::dropDownFromAssocArray($arr, "searchBox");
$searchBox = "<div style='float:left; padding-left:10px'><b>{$search_str}</b> {$searchBox} {$searchBtn}</div>";
}
$out = "<div style='position:relative;padding:8px; border-bottom:1px solid #000'>\n\n <div style='float:left; margin-right:10px;'>{$numrows_sel_text} {$nr_selector}</div>\n\n {$searchBox}\n\n <div style='right:0px; position:absolute'>{$prevLink} {$curpage_sel_text} {$cp_selector} {$nextLink}</div>\n <br style='clear:both'/>\n </div>";
$row_start = ($curpage - 1) * $numrows + 1;
//$this->row_end = $this->row_start + $this->num_results_displayed;
$result["display"] = $out;
$result["displayParts"]["rowSelector"] = $nr_selector;
$result["displayParts"]["searchBox"] = $searchBox;
$result["displayParts"]["prevLink"] = $prevLink;
$result["displayParts"]["nextLink"] = $nextLink;
$result["displayParts"]["pageSelector"] = $cp_selector;
$result["curpage"] = $curpage - 1;
$result["numrows"] = $numrows;
$result["rowstart"] = $row_start;
return $result;
}
示例2: ajaxIcon
/**
* Ajax spinner
*/
public function ajaxIcon()
{
$this->ready("\n \$('#spinner')\n .ajaxStart(function() {\n \$(this).show();\n })\n .ajaxStop(function() {\n \$(this).hide();\n });\n ");
return "<div id='spinner' style='display:none;width:20px;height:20px'>" . FormBuilder::adminIcon('spinner') . "</div>";
}