本文整理汇总了PHP中add_to_jquery函数的典型用法代码示例。如果您正苦于以下问题:PHP add_to_jquery函数的具体用法?PHP add_to_jquery怎么用?PHP add_to_jquery使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_to_jquery函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_html
function display_html($formname, $textarea, $html = TRUE, $colors = FALSE, $images = FALSE, $folder = "")
{
global $locale;
$res = "";
if ($html) {
$res .= "<div class='btn-group m-b-10'>\n";
$res .= "<button type='button' value='b' class='btn btn-sm btn-default button' style='font-weight:bold;' onclick=\"addText('" . $textarea . "', '<strong>', '</strong>', '" . $formname . "');\">b</button>\n";
$res .= "<button type='button' value='i' class='btn btn-sm btn-default button' style='font-style:italic;' onclick=\"addText('" . $textarea . "', '<i>', '</i>', '" . $formname . "');\">i</button>\n";
$res .= "<button type='button' value='u' class='btn btn-sm btn-default button' style='text-decoration:underline;' onclick=\"addText('" . $textarea . "', '<u>', '</u>', '" . $formname . "');\">u</button>\n";
$res .= "<button type='button' value='link' class='btn btn-sm btn-default button' onclick=\"addText('" . $textarea . "', '<a href=\\'', '\\' target=\\'_blank\\'>Link</a>', '" . $formname . "');\">link</button>\n";
$res .= "<button type='button' value='img' class='btn btn-sm btn-default button' onclick=\"addText('" . $textarea . "', '<img src=\\'" . str_replace("../", "", $folder) . "', '\\' style=\\'margin:5px\\' alt=\\'\\' align=\\'left\\' />', '" . $formname . "');\">img</button>\n";
$res .= "<button type='button' value='center' class='btn btn-sm btn-default button' onclick=\"addText('" . $textarea . "', '<center>', '</center>', '" . $formname . "');\">center</button>\n";
$res .= "<button type='button' value='small' class='btn btn-sm btn-default button' onclick=\"addText('" . $textarea . "', '<span class=\\'small\\'>', '</span>', '" . $formname . "');\">small</button>\n";
$res .= "<button type='button' value='small2' class='btn btn-sm btn-default button' onclick=\"addText('" . $textarea . "', '<span class=\\'small2\\'>', '</span>', '" . $formname . "');\">small2</button>\n";
$res .= "<button type='button' value='alt' class='btn btn-sm btn-default button' onclick=\"addText('" . $textarea . "', '<span class=\\'alt\\'>', '</span>', '" . $formname . "');\">alt</button>\n";
$res .= "</div>\n";
}
if ($colors) {
$color_array = array('maroon' => $locale['html402'], 'red' => $locale['html403'], 'orange' => $locale['html404'], 'brown' => $locale['html405'], 'yellow' => $locale['html406'], 'green' => $locale['html407'], 'lime' => $locale['html408'], 'olive' => $locale['html409'], 'cyan' => $locale['html410'], 'blue' => $locale['html411'], 'navy' => $locale['html412'], 'purple' => $locale['html413'], 'violet' => $locale['html414'], 'black' => $locale['html415'], 'gray' => $locale['html416'], 'silver' => $locale['html417'], 'white' => $locale['html418']);
$placeholder = $locale['html400'];
$res .= form_select('', "setcolor-{$formname}", "setcolor-{$formname}", $color_array, '', array('placeholder' => $placeholder, 'class' => 'pull-left m-r-10', 'allowclear' => 1));
add_to_jquery("\r\n function color(item) {\r\n if(!item.id) {return item.text;}\r\n var color = item.text;\r\n return '<table><tr><td><label style=\\'display: inline-block; width: 18px; height:18px; margin:3px; margin-right:5px; padding: 0px 8px; background:'+item.text+'\\'></label>'+item.text+'</td></tr></table>';\r\n }\r\n \$('#setcolor-{$formname}').select2({\r\n formatSelection: color,\r\n escapeMarkup: function(m) { return m; },\r\n formatResult: color,\r\n placeholder:'{$placeholder}',\r\n allowClear:true,\r\n });\r\n \$('#setcolor-{$formname}').on('change', function(e){\r\n addText('" . $textarea . "', '<span style=\\'color:' + this.options[this.selectedIndex].value + '\\'>', '</span>', '" . $formname . "');this.selectedIndex=0;\r\n \$(this).select2({\r\n formatSelection: color,\r\n escapeMarkup: function(m) { return m; },\r\n formatResult: color,\r\n placeholder:'{$placeholder}',\r\n allowClear:true}).val('');\r\n });\r\n ");
}
if ($images && $folder) {
$image_files = makefilelist($folder, ".|..|index.php", TRUE);
$image_list = makefileopts($image_files);
$res .= "<select name='insertimage' class='form-control textbox' style='margin-top:5px' onchange=\"insertText('" . $textarea . "', '<img src=\\'" . str_replace("../", "", $folder) . "' + this.options[this.selectedIndex].value + '\\' alt=\\'\\' style=\\'margin:5px\\' align=\\'left\\' />', '" . $formname . "');this.selectedIndex=0;\">\n";
$res .= "<option value=''>" . $locale['html401'] . "</option>\n" . $image_list . "</select>\n";
}
return $res;
}
示例2: load_tablesorter
function load_tablesorter($id)
{
// implementation: use in table();
// to add: sortlist:[[0,0],[1,0]]
add_to_head("<script type='text/javascript' src='" . DYNAMICS . "assets/tablesorter/jquery.tablesorter.min.js'></script>");
add_to_jquery("\n \$('#" . $id . "').tablesorter();\n ");
add_to_head("\n <style>\n /* tables */\n table.tablesorter {}\n table.tablesorter thead tr th, table.tablesorter tfoot tr th {}\n table.tablesorter thead tr .header {\n background-image: url(" . DYNAMICS . "assets/tablesorter/bg.gif);\n background-repeat: no-repeat;\n background-position: center right;\n cursor: pointer;\n }\n table.tablesorter tbody td {}\n table.tablesorter tbody tr.odd td {}\n table.tablesorter thead tr .headerSortUp { background-image: url(" . DYNAMICS . "assets/tablesorter/asc.gif); }\n table.tablesorter thead tr .headerSortDown {\tbackground-image: url(" . DYNAMICS . "assets/tablesorter/desc.gif); }\n table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp { }\n </style>\n ");
return "tablesorter";
}
示例3: form_datepicker
function form_datepicker($title, $input_name, $input_id, $input_value, $array = FALSE)
{
if (!defined('DATEPICKER')) {
define('DATEPICKER', TRUE);
add_to_head("<link href='" . DYNAMICS . "assets/datepicker/css/datepicker3.css' rel='stylesheet' />");
add_to_head("<script src='" . DYNAMICS . "assets/datepicker/js/bootstrap-datepicker.js'></script>");
}
$title2 = isset($title) && !empty($title) ? stripinput($title) : ucfirst(strtolower(str_replace("_", " ", $input_name)));
$input_name = isset($input_name) && !empty($input_name) ? stripinput($input_name) : "";
$input_id = isset($input_id) && !empty($input_id) ? stripinput($input_id) : "";
if ($input_value && strstr($input_value, "-")) {
// then this is date.
$input_value = $input_value;
} else {
$input_value = $input_value ? date("d-m-Y", $input_value) : '';
}
if (!is_array($array)) {
$placeholder = "";
$date_format = "dd-mm-yyyy";
$width = "250px";
$required = 0;
$safemode = 0;
$deactivate = 0;
$icon = '';
$inline = 0;
$error_text = '';
$class = '';
} else {
$icon = array_key_exists('icon', $array) ? $array['icon'] : "";
$placeholder = array_key_exists("placeholder", $array) ? $array['placeholder'] : "";
$width = array_key_exists("width", $array) ? $array['width'] : "250px";
$date_format = array_key_exists("date_format", $array) ? $array['date_format'] : "dd-mm-yyyy";
$class = array_key_exists('class', $array) ? $array['class'] : "";
$error_text = array_key_exists("error_text", $array) ? $array['error_text'] : "";
$required = array_key_exists('required', $array) && $array['required'] == 1 ? 1 : 0;
$safemode = array_key_exists('safemode', $array) && $array['safemode'] == 1 ? 1 : 0;
$deactivate = array_key_exists('deactivate', $array) && $array['deactivate'] == 1 ? 1 : 0;
$inline = array_key_exists("inline", $array) ? 1 : 0;
}
$html = "<div id='{$input_id}-field' class='form-group m-b-0 {$class} " . ($icon ? 'has-feedback' : '') . "'>\n";
$html .= $title ? "<label class='control-label " . ($inline ? "col-sm-3 col-md-3 col-lg-3" : '') . "' for='{$input_id}'>{$title} " . ($required == 1 ? "<span class='required'>*</span>" : '') . "</label>\n" : '';
$html .= $inline ? "<div class='col-sm-9 col-md-9 col-lg-9'>\n" : "";
$html .= "<div class='input-group date' " . ($width ? "style='width:{$width};'" : '') . ">\n";
$html .= "<input type='text' name='" . $input_name . "' id='" . $input_id . "' value='" . $input_value . "' class='form-control textbox' placeholder='{$placeholder}' />\n";
$html .= $icon ? "<div class='form-control-feedback'><i class='glyphicon {$icon}'></i></div>\n" : '';
$html .= "<span class='input-group-addon'><i class='entypo calendar'></i></span>\n";
$html .= "</div>\n";
$html .= "<div id='{$input_id}-help' style='display:inline-block !important;'></div>";
$html .= $inline ? "</div>\n" : "";
$html .= "</div>\n";
// Generate Defender Strings
$html .= "<input type='hidden' name='def[{$input_name}]' value='[type=date],[title={$title2}],[id={$input_id}],[required={$required}],[safemode={$safemode}]" . ($error_text ? ",[error_text={$error_text}]" : '') . "' readonly />";
if ($deactivate !== 1) {
add_to_jquery("\n \$('#{$input_id}-field .input-group.date').datepicker({\n format: '" . $date_format . "',\n todayBtn: 'linked',\n autoclose: true,\n todayHighlight: true\n });\n ");
}
return $html;
}
示例4: addHelper
function addHelper($id, $title, $content, $opts = false)
{
/* Jquery Popover Helper Injector */
$title = $title && !empty($title) ? "title: '{$title}'," : "";
$content = $content && !empty($content) ? "content: '{$content}'," : "";
if (!is_array($opts)) {
$placement = "";
} else {
$placement = array_key_exists("placement", $opts) && !empty($opts['placement']) ? "placement: '" . $opts['placement'] . "'" : "";
}
add_to_jquery("\n \$('#{$id}').popover({ {$title} {$content} {$placement} }).blur(function () { \$(this).popover('hide'); });\n ");
}
示例5: form_toggle
function form_toggle($title, $input_name, $input_id, $opts, $input_value, $array = false)
{
$html = '';
$title2 = ucfirst(strtolower(str_replace("_", " ", $input_name)));
if (!is_array($array)) {
$class = 'small';
$justified = "";
$well = "";
$wellclass = "";
$helper_text = "";
$slider = 0;
$required = 0;
$safemode = 0;
$type_config = 'toggle';
} else {
$class = array_key_exists("class", $array) ? $array['class'] : "small";
$justified = array_key_exists("justified", $array) ? "btn-group-justified" : "";
$well = array_key_exists('well', $array) ? "style='margin-top:-10px;'" : "";
$helper_text = array_key_exists("helper", $array) ? $array['helper'] : "";
$required = array_key_exists('required', $array) && $array['required'] == 1 ? 1 : 0;
$safemode = array_key_exists('safemode', $array) && $array['safemode'] == 1 ? 1 : 0;
if (array_key_exists("checkbox", $array) && $array['checkbox'] == 1) {
$type_config = "checkbox";
} elseif (array_key_exists("slider", $array) && $array['slider'] == 1) {
$type_config = "slider";
} else {
$type_config = "toggle";
}
}
$html .= "<div id='" . $input_id . "-field' class='field'/>\n";
if ($type_config !== 'checkbox') {
$text = $input_value ? $opts[1] : $opts[0];
$html .= "<label><h3>{$title} " . ($required == 1 ? "<span class='required'>*</span>" : '') . "</h3></label>\n";
$html .= "<div class='ui {$type_config} checkbox'>\n";
$html .= "<input id='{$input_id}' name='{$input_name}' value='1' type='checkbox' " . ($input_value == 1 ? 'checked' : '') . "/>\n";
$html .= "<label style='font-weight:bold;' id='{$input_id}-label' for='{$input_id}'/>{$text}</label>\n";
$html .= "</div>\n";
$html .= "<input type='hidden' name='def[{$input_name}]' value='[type=text],[title={$title2}],[id={$input_id}],[required={$required}],[safemode={$safemode}]' readonly>";
add_to_jquery("\n \$('#" . $input_id . "-label').bind('click', function(e){\n var text = \$(this).text();\n if (text == '" . $opts[0] . "') {\n \$(this).text('" . $opts[1] . "');\n } else {\n \$(this).text('" . $opts[0] . "');\n }\n });\n ");
} else {
$html .= "<div class='ui {$type_config}'/>\n";
$html .= "<input id='{$input_id}' name='{$input_name}' value='1' type='checkbox' " . ($input_value == 1 ? 'checked' : '') . "/>\n";
$html .= "<label style='font-weight:bold;' id='{$input_id}-label' for='{$input_id}'/>{$title} " . ($required == 1 ? "<span class='required'>*</span>" : '') . "</label>\n";
$html .= "</div>\n";
$html .= "<input type='hidden' name='def[{$input_name}]' value='[type=text],[title={$title2}],[id={$input_id}],[required={$required}],[safemode={$safemode}]' readonly>";
}
$html .= "</div>\n";
// $html .= "</div></div>\n";
return $html;
}
示例6: form_btngroup
/**
* Button Groups
* @param $input_name
* @param string $label
* @param $input_value
* @param array $options
* @return string
*/
function form_btngroup($input_name, $label = "", $input_value, array $options = array())
{
global $defender, $locale;
$title = $label ? stripinput($label) : ucfirst(strtolower(str_replace("_", " ", $input_name)));
$input_value = isset($input_value) && !empty($input_value) ? stripinput($input_value) : "";
$default_options = array('options' => array($locale['disable'], $locale['enable']), 'input_id' => $input_name, 'class' => "btn-default", 'icon' => "", "multiple" => FALSE, "delimiter" => ",", 'deactivate' => FALSE, 'error_text' => "", 'inline' => FALSE, 'safemode' => FALSE, 'required' => FALSE, 'callback_check' => '');
$options += $default_options;
$error_class = "";
if ($defender->inputHasError($input_name)) {
$error_class = "has-error ";
if (!empty($options['error_text'])) {
$new_error_text = $defender->getErrorText($input_name);
if (!empty($new_error_text)) {
$options['error_text'] = $new_error_text;
}
addNotice("danger", "<strong>{$title}</strong> - " . $options['error_text']);
}
}
$html = "<div id='" . $options['input_id'] . "-field' class='form-group " . $error_class . "clearfix'>\n";
$html .= $label ? "<label class='control-label " . ($options['inline'] ? "col-xs-12 col-sm-3 col-md-3 col-lg-3 p-l-0" : 'col-xs-12 col-sm-12 col-md-12 col-lg-12 p-l-0') . "' for='" . $options['input_id'] . "'>{$label} " . ($options['required'] == 1 ? "<span class='required'>*</span>" : '') . "</label>\n" : '';
$html .= $options['inline'] ? "<div class='col-xs-12 col-sm-9 col-md-9 col-lg-9'>\n" : '';
$html .= "<div class='btn-group' id='" . $options['input_id'] . "'>";
$i = 1;
if (!empty($options['options']) && is_array($options['options'])) {
foreach ($options['options'] as $arr => $v) {
$active = '';
if ($input_value == $arr) {
$active = "active";
}
$html .= "<button type='button' data-value='{$arr}' class='btn " . $options['class'] . " " . (count($options['options']) == $i ? 'last-child' : '') . " {$active}'>" . $v . "</button>\n";
$i++;
}
}
$html .= "</div>\n";
$html .= "<input name='{$input_name}' type='hidden' id='" . $options['input_id'] . "-text' value='{$input_value}' />\n";
$html .= $defender->inputHasError($input_name) ? "<div id='" . $options['input_id'] . "-help' class='label label-danger p-5 display-inline-block'>" . $options['error_text'] . "</div>" : "";
$html .= $options['inline'] ? "</div>\n" : '';
$html .= "</div>\n";
$input_name = $options['multiple'] ? str_replace("[]", "", $input_name) : $input_name;
$defender->add_field_session(array('input_name' => $input_name, 'title' => trim($title, '[]'), 'id' => $options['input_id'], 'type' => 'dropdown', 'required' => $options['required'], 'callback_check' => $options['callback_check'], 'safemode' => $options['safemode'], 'error_text' => $options['error_text'], 'delimiter' => $options['delimiter']));
add_to_jquery("\n\t\$('#" . $options['input_id'] . " button').bind('click', function(e){\n\t\t\$('#" . $options['input_id'] . " button').removeClass('active');\n\t\t\$(this).toggleClass('active');\n\t\tvalue = \$(this).data('value');\n\t\t\$('#" . $options['input_id'] . "-text').val(value);\n\t});\n\t");
return $html;
}
示例7: form_colorpicker
function form_colorpicker($input_name, $label = '', $input_value = '', array $options = array())
{
global $defender, $locale;
if (!defined("COLORPICKER")) {
define("COLORPICKER", TRUE);
add_to_head("<link href='" . DYNAMICS . "assets/colorpick/css/bootstrap-colorpicker.css' rel='stylesheet' media='screen' />");
add_to_head("<script src='" . DYNAMICS . "assets/colorpick/js/bootstrap-colorpicker.js'></script>");
}
$title = $label ? stripinput($label) : ucfirst(strtolower(str_replace("_", " ", $input_name)));
$input_name = stripinput($input_name);
$input_value = stripinput($input_value);
$default_options = array('input_id' => $input_name, 'required' => FALSE, 'placeholder' => '', 'deactivate' => FALSE, 'width' => '250px', 'class' => '', 'inline' => FALSE, 'error_text' => $locale['error_input_default'], 'safemode' => FALSE, 'icon' => "", "tip" => "", 'format' => 'hex');
$options += $default_options;
if (!$options['width']) {
$options['width'] = $default_options['width'];
}
$input_id = $options['input_id'] ?: $default_options['input_id'];
$error_class = "";
if ($defender->inputHasError($input_name)) {
$error_class = "has-error ";
if (!empty($options['error_text'])) {
$new_error_text = $defender->getErrorText($input_name);
if (!empty($new_error_text)) {
$options['error_text'] = $new_error_text;
}
addNotice("danger", "<strong>{$title}</strong> - " . $options['error_text']);
}
}
$html = "<div id='{$input_id}-field' class='form-group clearfix m-b-10 " . $error_class . $options['class'] . " '>\n";
$html .= $label ? "<label class='control-label " . ($options['inline'] ? "col-xs-12 col-sm-3 col-md-3 col-lg-3" : '') . "' for='{$input_id}'>{$label} " . ($options['required'] ? "<span class='required'>*</span>" : '') . "\n\t" . ($options['tip'] ? "<i class='pointer fa fa-question-circle' title='" . $options['tip'] . "'></i>" : '') . "\n\t</label>\n" : '';
$html .= $options['inline'] ? "<div class='col-xs-12 col-sm-9 col-md-9 col-lg-9'>\n" : "<br/>\n";
$html .= "<div id='{$input_id}' style='width: " . $options['width'] . "' class='input-group colorpicker-component bscp colorpicker-element m-b-10' data-color='{$input_value}' data-color-format='" . $options['format'] . "'>";
$html .= "<input type='text' name='{$input_name}' class='form-control " . $options['class'] . "' id='" . $input_id . "' value='{$input_value}' data-color-format='" . $options['format'] . "' placeholder='" . $options['placeholder'] . "' " . ($options['deactivate'] ? "readonly" : "") . ">";
$html .= "<span id='{$input_id}-cp' class='input-group-addon'>";
$html .= "<i style='background: rgba(255,255,255,1);'></i>";
$html .= "</span></div>";
$html .= $options['inline'] ? "</div>\n" : "";
$html .= "</div>\n";
$defender->add_field_session(array('input_name' => $input_name, 'type' => 'color', 'title' => $title, 'id' => $input_id, 'required' => $options['required'], 'safemode' => $options['safemode'], 'error_text' => $options['error_text']));
add_to_jquery("\$('#{$input_id}').colorpicker({ format : '" . $options['format'] . "' });");
return $html;
}
示例8: notify
/**
* Pop up notification
* @param $title
* @param $text
* @param array $options
*/
function notify($title, $text, array $options = array())
{
// init library
$default_options = array("sticky" => TRUE, "animation" => 1, "icon" => "notify_icon n-attention");
$options += $default_options;
$sticky = $options['sticky'] == TRUE ? "hide:false," : "";
switch ($options['animation']) {
case 1:
$animation = "animation: 'show',";
break;
case 2:
$animation = "animation: 'fade',";
break;
case 3:
$animation = "animation: 'slide',";
break;
default:
$animation = "";
}
add_to_jquery("\n\t\t\$(function(){\n\t\t\tnew PNotify({\n\t\t\t\ttitle: '{$title}',\n\t\t\t\ttext: '{$text}',\n\t\t\t\ticon: '" . $options['icon'] . "',\n\t\t\t\t{$animation}\n\t\t\t\twidth: 'auto',\n\t\t\t\t{$sticky}\n\t\t\t\tdelay: '4500'\n\t\t\t});\n\t\t});\n\t");
}
示例9: show_blacklist
function show_blacklist($data)
{
global $locale;
echo "<div class='alert alert-info display-none' id='ignore-message'></div>\n";
if (is_array($data) && count($data) > 0) {
foreach ($data as $id) {
$result = dbquery("SELECT user_id, user_name, user_status, user_avatar FROM " . DB_USERS . " WHERE user_id='{$id}' ORDER BY user_id ASC");
if (dbrows($result) > 0) {
while ($data = dbarray($result)) {
echo "<div id='" . $data['user_id'] . "-user-list' class='panel panel-default'>\n<div class='panel-body'>\n";
echo "<button type='button' value='" . $data['user_id'] . "' class='unblock pull-right m-t-5 btn btn-sm btn-primary'>" . $locale['uf_blacklist_001'] . "</button>\n";
echo "<div class='pull-left m-r-10'>" . display_avatar($data, '50px') . "</div>\n";
echo "<div class='clearfix'>" . profile_link($data['user_id'], $data['user_name'], $data['user_status']) . "<br/>\n";
echo "<span class='text-lighter'>" . $locale['uf_blacklist_002'] . "</span>\n";
echo "</div>\n";
echo "</div>\n</div>\n";
}
}
}
}
add_to_jquery("\n\t\$('.unblock').bind('click', function(e) {\n\tvar user_id = \$(this).val();\n\t\$.ajax({\n\t\ttype: 'POST',\n\t\turl: '" . INCLUDES . "user_fields/user_blacklist.ajax.php',\n\t\tdata: { user_id : user_id },\n\t\tdataType: 'html',\n\t\tsuccess: function(data) {\n\t\t\talert(data);\n\t\t\t\$('#'+user_id+'-user-list').addClass('display-none');\n\t\t\t\$('#ignore-message').html(data).removeClass('display-none');\n\t\t},\n\t\terror: function() {\n\t\t\talert('" . $locale['uf_blacklist_desc'] . "');\n\t\t}\n\t\t});\n\t});\n\t");
}
示例10: openmodal
function openmodal($id, $title, $opts = FALSE)
{
if (!empty($opts)) {
// trigger via button or via load.
if (array_key_exists('button_id', $opts) && $opts['button_id']) {
add_to_jquery("\r\n \$('#" . $opts['button_id'] . "').bind('click', function(e){\r\n \$('#" . $id . "-Modal').modal('show');\r\n });\r\n ");
} else {
add_to_jquery("\r\n \$('#" . $id . "-Modal').modal('show');\r\n ");
}
} else {
add_to_footer("\r\n <script type='text/javascript'>\r\n \$('#" . $id . "-Modal').modal('show');\r\n </script>\r\n ");
}
$html = '';
$html .= "<div class='modal fade' id='{$id}-Modal' tabindex='-1' role='dialog' aria-labelledby='{$id}-ModalLabel' aria-hidden='true'>\n";
$html .= "<div class='modal-dialog modal-lg'>\n";
$html .= "<div class='modal-content'>\n";
$html .= "<div class='modal-header'>";
$html .= "<button type='button' class='btn btn-sm pull-right btn-default' data-dismiss='modal'><i class='entypo cross'></i> Close</button>\n";
$html .= "<h4 class='modal-title text-dark' id='myModalLabel'>{$title}</h4>\n";
$html .= "</div>\n";
$html .= "<div class='modal-body'>\n";
return $html;
}
示例11: form_alert
function form_alert($title, $text, $array = false)
{
// <a href="#" class="alert-link">...</a>
if (isset($title) && $title !== "") {
$title = stripinput($title);
} else {
$title = "";
}
//if (isset($text) && ($text !=="")) { $text = stripinput($text); } else { $text = ""; }
if (!is_array($array)) {
$class = '';
$dismiss = '';
} else {
$class = array_key_exists('class', $array) ? $array['class'] : "";
$dismiss = array_key_exists('dismiss', $array) ? $array['dismiss'] : "";
}
if ($dismiss == "1") {
$html = "<div class='alert alert-dismissable {$class}'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button><strong>{$title}</strong> {$text}</div>";
} else {
$html = "<div class='alert {$class}'><strong>{$title}</strong> {$text}</div>";
}
add_to_jquery("\n \$('div.alert a').addClass('alert-link');\n ");
return $html;
}
示例12: notify
function notify($title, $text, $opts = FALSE)
{
// init library
if (!is_array($opts)) {
$sticky = "";
$anime = "";
$icon = "notify_icon n-attention";
} else {
$sticky = array_key_exists("sticky", $opts) ? "hide:false," : "";
$icon = array_key_exists("icon", $opts) ? $opts['icon'] : "notify_icon n-attention";
$animation = array_key_exists("animate", $opts) ? $opts['animate'] : "";
if ($animation == "1") {
$anime = "animation: 'show',";
} elseif ($animation == "2") {
$anime = "animation: 'fade',";
} elseif ($animation == "3") {
$anime = "animation: 'slide',";
} else {
// reset
$anime = "";
}
}
add_to_jquery("\n\t\t\$(function(){\n\t\t\tnew PNotify({\n\t\t\t\ttitle: '{$title}',\n\t\t\t\ttext: '{$text}',\n\t\t\t\ticon: '{$icon}',\n\t\t\t\t{$anime}\n\t\t\t\twidth: 'auto',\n\t\t\t\t{$sticky}\n\t\t\t\tdelay: '4500'\n\t\t\t});\n\t\t});\n\t");
}
示例13: dbquery
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>" . $locale['423'] . "</td>\n";
echo "<td class='tbl'><select id='field_cat_select' name='field_cat' class='form-control textbox input-sm'>\n";
$result = dbquery("SELECT field_cat_id, field_cat_name, field_cat_db FROM " . DB_USER_FIELD_CATS . " ORDER BY field_cat_order");
$sel = "";
if (dbrows($result)) {
echo "<option>" . $locale['choose'] . "</option>\n";
while ($data = dbarray($result)) {
if ($field_cat) {
$sel = $field_cat == $data['field_cat_id'] ? " selected='selected'" : "";
}
echo "<option data-register='" . ($data['field_cat_db'] ? 0 : 1) . "' value='" . $data['field_cat_id'] . "'" . $sel . ">" . $data['field_cat_name'] . "</option>\n";
}
}
echo "</select>\n</td>\n";
add_to_jquery("\r\n \$('#register-item').hide();\r\n var e = \$('#field_cat_select').find(':selected').data('register');\r\n if (e) { \$('#register-item').show(); }\r\n \$('#field_cat_select').bind('change', function(e) {\r\n var e = \$(this).find(':selected').data('register');\r\n if (e) { \$('#register-item').show(); } else { \$('#register-item').hide(); }\r\n });\r\n ");
echo "</tr>\n<tr>\n";
if ($user_field_dbinfo != "") {
echo "<td class='tbl'>" . $locale['427'] . ":</td>\n<td class='tbl'>";
if (version_compare($user_field_api_version, "1.01.00", ">=")) {
echo "<label><input type='checkbox' name='field_required' value='1'" . ($field_required == 1 ? " checked='checked'" : "") . " />\n";
echo $locale['427'] . "</label>";
} else {
echo $locale['428'];
}
echo "</td>\n";
echo "</tr>\n<tr>\n";
}
if ($user_field_dbinfo != "") {
echo "<td class='tbl'>" . $locale['429'] . ":</td>\n<td class='tbl'>";
if (version_compare($user_field_api_version, "1.01.00", ">=")) {
示例14: set_ThreadJs
private function set_ThreadJs()
{
$viewthread_js = '';
//javascript to footer
$highlight_js = "";
$colorbox_js = "";
$edit_reason_js = '';
/** javascript **/
// highlight jQuery plugin
if (isset($_GET['highlight'])) {
$words = explode(" ", urldecode($_GET['highlight']));
$higlight = "";
$i = 1;
$c_words = count($words);
foreach ($words as $hlight) {
$hlight = htmlentities($hlight, ENT_QUOTES);
$higlight .= "'" . $hlight . "'";
$higlight .= $i < $c_words ? "," : "";
$i++;
}
add_to_head("<script type='text/javascript' src='" . INCLUDES . "jquery/jquery.highlight.js'></script>");
$highlight_js .= "\$('.search_result').highlight([" . $higlight . "],{wordsOnly:true});";
$highlight_js .= "\$('.highlight').css({backgroundColor:'#FFFF88'});";
//better via theme or settings
}
$edit_reason_js .= "\n\t\t\t\$('.reason_div').hide();\n\t\t\t\$('div').find('.reason_button').css({cursor: 'pointer' });\n\t\t\t\$('.reason_button').bind('click', function(e) {\n\t\t\t\tvar target = \$(this).data('target');\n\t\t\t\t\$('#'+target).stop().slideToggle('fast');\n\t\t\t});\n\t\t\t";
// viewthread javascript, moved to footer
if (!empty($highlight_js) || !empty($colorbox_js) || !empty($edit_reason_js)) {
$viewthread_js .= $highlight_js . $colorbox_js . $edit_reason_js;
}
$viewthread_js .= "\$('a[href=#top]').click(function(){";
$viewthread_js .= "\$('html, body').animate({scrollTop:0}, 'slow');";
$viewthread_js .= "return false;";
$viewthread_js .= "});";
$viewthread_js .= "});";
// below functions could be made more unobtrusive thanks to jQuery, giving a more accessible cms
$viewthread_js .= "function jumpforum(forum_id){";
$viewthread_js .= "document.location.href='" . INFUSIONS . "forum/viewforum.php?forum_id='+forum_id;";
$viewthread_js .= "}";
if (iMOD) {
// only moderators need this javascript
$viewthread_js .= "function setChecked(frmName,chkName,val){";
$viewthread_js .= "dml=document.forms[frmName];";
$viewthread_js .= "len=dml.elements.length;";
$viewthread_js .= "for(i=0;i<len;i++){";
$viewthread_js .= "if(dml.elements[i].name==chkName){";
$viewthread_js .= "dml.elements[i].checked=val;";
$viewthread_js .= "}";
$viewthread_js .= "}";
$viewthread_js .= "}";
}
//$viewthread_js .= "/*]]>*/";
//$viewthread_js .= "</script>";
add_to_jquery($viewthread_js);
}
示例15: render_dashboard
//.........这里部分代码省略.........
openside("<span class='text-smaller text-uppercase'><strong>" . $locale['277'] . "</strong></span><span class='pull-right badge'>" . number_format($global_comments['rows']) . "</span>");
if (count($global_comments['data']) > 0) {
foreach ($global_comments['data'] as $i => $comment_data) {
echo "<!--Start Comment Item-->\n";
echo "<div data-id='{$i}' class='comment_content clearfix p-t-10 p-b-10' " . ($i > 0 ? "style='border-top:1px solid #ddd;'" : '') . " >\n";
echo "<div class='pull-left display-inline-block' style='margin-top:0px; margin-bottom:10px;'>" . display_avatar($comment_data, "25px", "", FALSE, "", "") . "</div>\n";
echo "<div id='comment_action-{$i}' class='btn-group pull-right display-none' style='position:absolute; right: 30px; margin-top:25px;'>\n\n\t\t\t\t<a class='btn btn-xs btn-default' title='" . $locale['274'] . "' href='" . ADMIN . "comments.php" . $aidlink . "&ctype=" . $comment_data['comment_type'] . "&comment_item_id=" . $comment_data['comment_item_id'] . "'><i class='entypo eye'></i></a>\n\t\t\t\t<a class='btn btn-xs btn-default' title='" . $locale['275'] . "' href='" . ADMIN . "comments.php" . $aidlink . "&action=edit&comment_id=" . $comment_data['comment_id'] . "&ctype=" . $comment_data['comment_type'] . "&comment_item_id=" . $comment_data['comment_item_id'] . "'><i class='entypo pencil'></i></a>\n\t\t\t\t<a class='btn btn-xs btn-default' title='" . $locale['276'] . "' href='" . ADMIN . "comments.php" . $aidlink . "&action=delete&comment_id=" . $comment_data['comment_id'] . "&ctype=" . $comment_data['comment_type'] . "&comment_item_id=" . $comment_data['comment_item_id'] . "'><i class='entypo trash'></i></a></div>\n";
echo "<strong>" . profile_link($comment_data['user_id'], $comment_data['user_name'], $comment_data['user_status']) . "</strong>\n";
echo "<span class='text-lighter'>" . $locale['273'] . "</span> <a href='" . sprintf($link_type[$comment_data['comment_type']], $comment_data['comment_item_id']) . "'><strong>" . $comments_type[$comment_data['comment_type']] . "</strong></a>";
echo "<br/>\n" . timer($comment_data['comment_datestamp']) . "<br/>\n";
echo "<span class='text-smaller text-lighter'>" . trimlink(parseubb($comment_data['comment_message']), 70) . "</span>\n";
echo "</div>\n";
echo "<!--End Comment Item-->\n";
}
if (isset($global_comments['comments_nav'])) {
echo "<div class='clearfix'>\n";
echo "<span class='pull-right text-smaller'>" . $global_comments['comments_nav'] . "</span>";
echo "</div>\n";
}
} else {
echo "<div class='text-center'>" . $global_comments['nodata'] . "</div>\n";
}
closeside();
echo "</div>\n<div class='col-xs-12 co-sm-6 col-md-6 col-lg-3'>\n";
// Ratings
openside("<span class='text-smaller text-uppercase'><strong>" . $locale['278'] . "</strong></span>");
if (count($global_ratings['data']) > 0) {
foreach ($global_ratings['data'] as $i => $ratings_data) {
echo "<!--Start Rating Item-->\n";
echo "<div class='comment_content clearfix p-t-10 p-b-10' " . ($i > 0 ? "style='border-top:1px solid #ddd;'" : '') . " >\n";
echo "<div class='pull-left display-inline-block' style='margin-top:0px; margin-bottom:10px;'>" . display_avatar($ratings_data, "25px", "", FALSE, "", "") . "</div>\n";
echo "<strong>" . profile_link($ratings_data['user_id'], $ratings_data['user_name'], $ratings_data['user_status']) . "</strong>\n";
echo "<span class='text-lighter'>" . $locale['273a'] . "</span>\n";
echo "<a href='" . sprintf($link_type[$ratings_data['rating_type']], $ratings_data['rating_item_id']) . "'><strong>" . $comments_type[$ratings_data['rating_type']] . "</strong></a>";
echo "<span class='text-lighter m-l-10'>" . str_repeat("<i class='fa fa-star fa-fw'></i>", $ratings_data['rating_vote']) . "</span>\n<br/>";
echo timer($ratings_data['rating_datestamp']) . "<br/>\n";
echo "</div>\n";
echo "<!--End Rating Item-->\n";
}
if (isset($global_ratings['ratings_nav'])) {
echo "<div class='clearfix'>\n";
echo "<span class='pull-right text-smaller'>" . $global_ratings['ratings_nav'] . "</span>";
echo "</div>\n";
}
} else {
echo "<div class='text-center'>" . $global_ratings['nodata'] . "</div>\n";
}
closeside();
echo "</div>\n<div class='col-xs-12 co-sm-6 col-md-6 col-lg-3'>\n";
openside("<span class='text-smaller text-uppercase'><strong>" . $locale['279'] . "</strong></span><span class='pull-right badge'>" . number_format($global_submissions['rows']) . "</span>");
if (count($global_submissions['data']) > 0) {
foreach ($global_submissions['data'] as $i => $submit_data) {
switch ($submit_data['submit_type']) {
case "n":
$review_link = INFUSIONS . "news/news_admin.php" . $aidlink . "&section=submissions&submit_id=" . $submit_data['submit_id'];
break;
case "a":
$review_link = INFUSIONS . "articles/articles_admin.php" . $aidlink . "&section=submissions&submit_id=" . $submit_data['submit_id'];
break;
case "p":
$review_link = INFUSIONS . "gallery/gallery_admin.php" . $aidlink . "&section=submissions&submit_id=" . $submit_data['submit_id'];
break;
case "b":
$review_link = INFUSIONS . "blog/blog_admin.php" . $aidlink . "&section=submissions&submit_id=" . $submit_data['submit_id'];
break;
case "d":
$review_link = INFUSIONS . "downloads/downloads_admin.php" . $aidlink . "&section=submissions&submit_id=" . $submit_data['submit_id'];
break;
case "l":
$review_link = INFUSIONS . "weblinks/weblinks_admin.php" . $aidlink . "&section=submissions&submit_id=" . $submit_data['submit_id'];
break;
default:
// @todo: add admin class API to use infusion_db.php to register submission link
$review_link = "";
}
echo "<!--Start Submissions Item-->\n";
echo "<div data-id='{$i}' class='submission_content clearfix p-t-10 p-b-10' " . ($i > 0 ? "style='border-top:1px solid #ddd;'" : '') . " >\n";
echo "<div class='pull-left display-inline-block' style='margin-top:0px; margin-bottom:10px;'>" . display_avatar($submit_data, "25px", "", FALSE, "", "") . "</div>\n";
echo "<strong>" . profile_link($submit_data['user_id'], $submit_data['user_name'], $submit_data['user_status']) . "</strong>\n";
echo "<span class='text-lighter'>" . $locale['273b'] . " <strong>" . $submit_type[$submit_data['submit_type']] . "</strong></span><br/>\n";
echo timer($submit_data['submit_datestamp']) . "<br/>\n";
if (!empty($review_link)) {
echo "<a class='btn btn-xs btn-default m-t-5' title='" . $locale['286'] . "' href='" . $review_link . "'>" . $locale['286'] . "</a>\n";
}
echo "</div>\n";
echo "<!--End Submissions Item-->\n";
}
if (isset($global_submissions['submissions_nav'])) {
echo "<div class='clearfix'>\n";
echo "<span class='pull-right text-smaller'>" . $global_submissions['submissions_nav'] . "</span>";
echo "</div>\n";
}
} else {
echo "<div class='text-center'>" . $global_submissions['nodata'] . "</div>\n";
}
closeside();
echo "</div>\n";
closetable();
add_to_jquery("\n\t\$('.comment_content').hover(function() {\n\t\$('#comment_action-'+\$(this).data('id')).removeClass('display-none');\n\t},function(){\n\t\$('#comment_action-'+\$(this).data('id')).addClass('display-none');\n\t});\n\t\$('.submission_content').hover(function() {\n\t\$('#submission_action-'+\$(this).data('id')).removeClass('display-none');\n\t},function(){\n\t\$('#submission_action-'+\$(this).data('id')).addClass('display-none');\n\t});\n\t");
}