本文整理汇总了PHP中buttons函数的典型用法代码示例。如果您正苦于以下问题:PHP buttons函数的具体用法?PHP buttons怎么用?PHP buttons使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了buttons函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ShiftTypes_list_view
function ShiftTypes_list_view($shifttypes)
{
foreach ($shifttypes as &$shifttype) {
$shifttype['name'] = '<a href="' . page_link_to('shifttypes') . '&action=view&shifttype_id=' . $shifttype['id'] . '">' . $shifttype['name'] . '</a>';
$shifttype['actions'] = table_buttons([button(page_link_to('shifttypes') . '&action=edit&shifttype_id=' . $shifttype['id'], _('edit'), 'btn-xs'), button(page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'], _('delete'), 'btn-xs')]);
}
return page_with_title(shifttypes_title(), [msg(), buttons([button(page_link_to('shifttypes') . '&action=edit', _('New shifttype'), 'add')]), table(['name' => _('Name'), 'actions' => ''], $shifttypes)]);
}
示例2: Shift_view
function Shift_view($shift, $shifttype, $room, $shift_admin, $angeltypes_source, $user_shift_admin, $admin_rooms, $admin_shifttypes, $user_shifts, $signed_up)
{
$parsedown = new Parsedown();
$angeltypes = [];
foreach ($angeltypes_source as $angeltype) {
$angeltypes[$angeltype['id']] = $angeltype;
}
$needed_angels = '';
foreach ($shift['NeedAngels'] as $needed_angeltype) {
$class = 'progress-bar-warning';
if ($needed_angeltype['taken'] == 0) {
$class = 'progress-bar-danger';
}
if ($needed_angeltype['taken'] >= $needed_angeltype['count']) {
$class = 'progress-bar-success';
}
$needed_angels .= '<div class="list-group-item">';
$needed_angels .= '<div class="pull-right">' . Shift_signup_button_render($shift, $angeltypes[$needed_angeltype['TID']]) . '</div>';
$needed_angels .= '<h3>' . AngelType_name_render($angeltypes[$needed_angeltype['TID']]) . '</h3>';
$needed_angels .= progress_bar(0, $needed_angeltype['count'], min($needed_angeltype['taken'], $needed_angeltype['count']), $class, $needed_angeltype['taken'] . ' / ' . $needed_angeltype['count']);
$angels = [];
foreach ($shift['ShiftEntry'] as $shift_entry) {
if ($shift_entry['TID'] == $needed_angeltype['TID']) {
$entry = User_Nick_render(User($shift_entry['UID']));
if ($shift_entry['freeloaded']) {
$entry = '<strike>' . $entry . '</strike>';
}
if ($user_shift_admin) {
$entry .= ' <div class="btn-group">';
$entry .= button_glyph(page_link_to('user_myshifts') . '&edit=' . $shift_entry['id'] . '&id=' . $shift_entry['UID'], 'pencil', 'btn-xs');
$entry .= button_glyph(page_link_to('user_shifts') . '&entry_id=' . $shift_entry['id'], 'trash', 'btn-xs');
$entry .= '</div>';
}
$angels[] = $entry;
}
}
$needed_angels .= join(', ', $angels);
$needed_angels .= '</div>';
}
$shiftManagers = getShiftManagers($shift['SID']);
return page_with_title($shift['name'] . ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>', [msg(), Shift_collides($shift, $user_shifts) ? info(_('This shift collides with one of your shifts.'), true) : '', $signed_up ? info(_('You are signed up for this shift.'), true) : '', $shift_admin || $admin_shifttypes || $admin_rooms ? buttons([$shift_admin ? button(shift_edit_link($shift), glyph('pencil') . _('edit')) : '', $shift_admin ? button(shift_delete_link($shift), glyph('trash') . _('delete')) : '', $admin_shifttypes ? button(shifttype_link($shifttype), $shifttype['name']) : '', $admin_rooms ? button(room_link($room), glyph('map-marker') . $room['Name']) : '']) : '', div('row', [div('col-sm-3 col-xs-6', ['<h4>' . _('Title') . '</h4>', '<p class="lead">' . ($shift['URL'] != '' ? '<a href="' . $shift['URL'] . '">' . $shift['title'] . '</a>' : $shift['title']) . '</p>']), div('col-sm-3 col-xs-6', ['<h4>' . _('Start') . '</h4>', '<p class="lead' . (time() >= $shift['start'] ? ' text-success' : '') . '">', glyph('calendar') . date('Y-m-d', $shift['start']), '<br />', glyph('time') . date('H:i', $shift['start']), '</p>']), div('col-sm-3 col-xs-6', ['<h4>' . _('End') . '</h4>', '<p class="lead' . (time() >= $shift['end'] ? ' text-success' : '') . '">', glyph('calendar') . date('Y-m-d', $shift['end']), '<br />', glyph('time') . date('H:i', $shift['end']), '</p>']), div('col-sm-3 col-xs-6', ['<h4>' . _('Location') . '</h4>', '<p class="lead">' . glyph('map-marker') . $room['Name'] . '</p>'])]), div('row', [div('col-sm-6', ['<h2>' . _('Needed angels') . '</h2>', '<div class="list-group">' . $needed_angels . '</div>']), div('col-sm-6', [!empty($shiftManagers) ? '<h2>' . _('Shift Manager') . '</h2>' : '', !empty($shiftManagers) ? implode('<br>', array_map(function ($manager) {
return $manager['Vorname'] . ' ' . $manager['Name'];
}, $shiftManagers)) : '', '<h2>' . _('Description') . '</h2>', $parsedown->parse($shifttype['description'])])]), $shift_admin ? Shift_editor_info_render($shift) : '']);
}
示例3: UserDriverLicense_edit_view
/**
* Edit a user's driving license information.
* @param User $user_source
* @param bool $wants_to_drive
* @param bool $has_car
* @param bool $has_license_car
* @param bool $has_license_3_5t_transporter
* @param bool $has_license_7_5t_truck
* @param bool $has_license_12_5t_truck
* @param bool $has_license_forklift
*/
function UserDriverLicense_edit_view($user_source, $wants_to_drive, $has_car, $has_license_car, $has_license_3_5t_transporter, $has_license_7_5t_truck, $has_license_12_5t_truck, $has_license_forklift)
{
return page_with_title(sprintf(_("Edit %s driving license information"), User_Nick_render($user_source)), [buttons([button(user_link($user_source), _("Back to profile"), 'back')]), msg(), form([form_info(_("Privacy"), _("Your driving license information is only visible for coordinators and admins.")), form_checkbox('wants_to_drive', _("I am willing to operate cars for the PL"), $wants_to_drive), div('panel panel-default', [div('panel-body', [form_checkbox('has_car', _("I have my own car with me and am willing to use it for the PL (You'll get reimbursed for fuel)"), $has_car), heading(_("Driver license"), 3), form_checkbox('has_license_car', _("Car"), $has_license_car), form_checkbox('has_license_3_5t_transporter', _("Transporter 3,5t"), $has_license_3_5t_transporter), form_checkbox('has_license_7_5t_truck', _("Truck 7,5t"), $has_license_7_5t_truck), form_checkbox('has_license_12_5t_truck', _("Truck 12,5t"), $has_license_12_5t_truck), form_checkbox('has_license_forklift', _("Forklift"), $has_license_forklift)])], 'driving_license'), form_submit('submit', _("Save"))]), '<script type="text/javascript">
$(function() {
if($("#wants_to_drive").is(":checked"))
$("#driving_license").show();
else
$("#driving_license").hide();
$("#wants_to_drive").click(
function(e) {
if($("#wants_to_drive").is(":checked"))
$("#driving_license").show();
else
$("#driving_license").hide();
}
);
});
</script>']);
}
示例4: admin_rooms
function admin_rooms()
{
global $user;
$rooms_source = sql_select("SELECT * FROM `Room` ORDER BY `Name`");
$rooms = array();
foreach ($rooms_source as $room) {
$rooms[] = array('name' => $room['Name'], 'from_pentabarf' => $room['FromPentabarf'] == 'Y' ? '✓' : '', 'public' => $room['show'] == 'Y' ? '✓' : '', 'actions' => buttons(array(button(page_link_to('admin_rooms') . '&show=edit&id=' . $room['RID'], _("edit"), 'btn-xs'), button(page_link_to('admin_rooms') . '&show=delete&id=' . $room['RID'], _("delete"), 'btn-xs'))));
}
$room = null;
if (isset($_REQUEST['show'])) {
$msg = "";
$name = "";
$from_pentabarf = "";
$public = 'Y';
$number = "";
$angeltypes_source = sql_select("SELECT * FROM `AngelTypes` ORDER BY `name`");
$angeltypes = array();
$angeltypes_count = array();
foreach ($angeltypes_source as $angeltype) {
$angeltypes[$angeltype['id']] = $angeltype['name'];
$angeltypes_count[$angeltype['id']] = 0;
}
if (test_request_int('id')) {
$room = sql_select("SELECT * FROM `Room` WHERE `RID`='" . sql_escape($_REQUEST['id']) . "'");
if (count($room) > 0) {
$id = $_REQUEST['id'];
$name = $room[0]['Name'];
$from_pentabarf = $room[0]['FromPentabarf'];
$public = $room[0]['show'];
$number = $room[0]['Number'];
$needed_angeltypes = sql_select("SELECT * FROM `NeededAngelTypes` WHERE `room_id`='" . sql_escape($id) . "'");
foreach ($needed_angeltypes as $needed_angeltype) {
$angeltypes_count[$needed_angeltype['angel_type_id']] = $needed_angeltype['count'];
}
} else {
redirect(page_link_to('admin_rooms'));
}
}
if ($_REQUEST['show'] == 'edit') {
if (isset($_REQUEST['submit'])) {
$ok = true;
if (isset($_REQUEST['name']) && strlen(strip_request_item('name')) > 0) {
$name = strip_request_item('name');
if (isset($room) && sql_num_query("SELECT * FROM `Room` WHERE `Name`='" . sql_escape($name) . "' AND NOT `RID`=" . sql_escape($id)) > 0) {
$ok = false;
$msg .= error(_("This name is already in use."), true);
}
} else {
$ok = false;
$msg .= error(_("Please enter a name."), true);
}
if (isset($_REQUEST['from_pentabarf'])) {
$from_pentabarf = 'Y';
} else {
$from_pentabarf = '';
}
if (isset($_REQUEST['public'])) {
$public = 'Y';
} else {
$public = '';
}
if (isset($_REQUEST['number'])) {
$number = strip_request_item('number');
} else {
$ok = false;
}
foreach ($angeltypes as $angeltype_id => $angeltype) {
if (isset($_REQUEST['angeltype_count_' . $angeltype_id]) && preg_match("/^[0-9]{1,4}\$/", $_REQUEST['angeltype_count_' . $angeltype_id])) {
$angeltypes_count[$angeltype_id] = $_REQUEST['angeltype_count_' . $angeltype_id];
} else {
$ok = false;
$msg .= error(sprintf(_("Please enter needed angels for type %s.", $angeltype)), true);
}
}
if ($ok) {
if (isset($id)) {
sql_query("UPDATE `Room` SET `Name`='" . sql_escape($name) . "', `FromPentabarf`='" . sql_escape($from_pentabarf) . "', `show`='" . sql_escape($public) . "', `Number`='" . sql_escape($number) . "' WHERE `RID`='" . sql_escape($id) . "' LIMIT 1");
engelsystem_log("Room updated: " . $name . ", pentabarf import: " . $from_pentabarf . ", public: " . $public . ", number: " . $number);
} else {
$id = Room_create($name, $from_pentabarf, $public, $number);
if ($id === false) {
engelsystem_error("Unable to create room.");
}
engelsystem_log("Room created: " . $name . ", pentabarf import: " . $from_pentabarf . ", public: " . $public . ", number: " . $number);
}
sql_query("DELETE FROM `NeededAngelTypes` WHERE `room_id`='" . sql_escape($id) . "'");
$needed_angeltype_info = array();
foreach ($angeltypes_count as $angeltype_id => $angeltype_count) {
$angeltype = AngelType($angeltype_id);
if ($angeltype === false) {
engelsystem_error("Unable to load angeltype.");
}
if ($angeltype != null) {
sql_query("INSERT INTO `NeededAngelTypes` SET `room_id`='" . sql_escape($id) . "', `angel_type_id`='" . sql_escape($angeltype_id) . "', `count`='" . sql_escape($angeltype_count) . "'");
$needed_angeltype_info[] = $angeltype['name'] . ": " . $angeltype_count;
}
}
engelsystem_log("Set needed angeltypes of room " . $name . " to: " . join(", ", $needed_angeltype_info));
success(_("Room saved."));
redirect(page_link_to("admin_rooms"));
//.........这里部分代码省略.........
示例5: and
} else {
if (profile_screening()) {
$query = "select * from profile, user where profile.userid=user.id " . " and has_picture>0 " . " and verification=0 " . " limit 20";
} else {
$query = "select * from profile, user where profile.userid=user.id " . " and has_picture>0 " . " and verification=0 " . " and uotd_time is null " . " and expavg_credit>1 " . " and (response1 <> '' or response2 <> '') " . " order by recommend desc limit 20";
}
}
$result = _mysql_query($query);
$n = 0;
echo "<form action=profile_screen_action.php>\n";
start_table();
$found = false;
while ($profile = _mysql_fetch_object($result)) {
$found = true;
echo "<tr><td valign=top>";
buttons($n);
echo "\n <br>Name: {$profile->name}\n <br>recommends: {$profile->recommend}\n <br>rejects: {$profile->reject}\n <br>RAC: {$profile->expavg_credit}\n <br>\n ";
echo "</td><td><table border=2> ";
show_profile($profile, $g_logged_in_user, true);
echo "</table></td></tr>\n";
echo "<input type=\"hidden\" name=\"userid{$n}\" value=\"{$profile->userid}\">\n";
$n++;
}
end_table();
if ($found) {
echo "\n <input type=\"hidden\" name=\"n\" value=\"{$n}\">\n <input type=\"submit\" value=\"OK\">\n ";
} else {
echo "No more profiles to screen.";
}
echo "\n </form>\n";
admin_page_tail();
示例6: make_select
function make_select($items, $selected, $name, $title = null)
{
$html_items = array();
if (isset($title)) {
$html_items[] = '<h4>' . $title . '</h4>' . "\n";
}
foreach ($items as $i) {
$html_items[] = '<div class="checkbox"><label><input type="checkbox" name="' . $name . '[]" value="' . $i['id'] . '"' . (in_array($i['id'], $selected) ? ' checked="checked"' : '') . '> ' . $i['name'] . '</label>' . (!isset($i['enabled']) || $i['enabled'] ? '' : glyph("lock")) . '</div><br />';
}
$html = '<div id="selection_' . $name . '" class="selection ' . $name . '">' . "\n";
$html .= implode("\n", $html_items);
$html .= buttons(array(button("javascript: check_all('selection_" . $name . "')", _("All"), ""), button("javascript: uncheck_all('selection_" . $name . "')", _("None"), "")));
$html .= '</div>' . "\n";
return $html;
}
示例7: htmlentities
if ($flds[$i] != "") {
echo $tdnowrap . htmlentities($flds[$i]) . "</td>";
} else {
echo $tdnowrap . " </td>";
}
} else {
echo $tdnowrap . " </td>";
}
}
if ($c > 4) {
echo $tdnowrap;
for ($i = 4; $i < $c; ++$i) {
if ($flds[$i] != "") {
echo htmlentities($flds[$i]) . " ";
} else {
echo " ";
}
}
echo "</td>";
} else {
echo $tdnowrap . " </td>";
}
echo "</tr>";
$rows++;
}
echo "</table>\n";
}
buttons($pattern);
echo "</center>\n</body>\n</html>\n";
mysql_close($mylink);
exit;
示例8: guest_login
function guest_login()
{
global $user, $privileges;
$nick = "";
unset($_SESSION['uid']);
if (isset($_REQUEST['submit'])) {
$ok = true;
if (isset($_REQUEST['nick']) && strlen(User_validate_Nick($_REQUEST['nick'])) > 0) {
$nick = User_validate_Nick($_REQUEST['nick']);
$login_user = sql_select("SELECT * FROM `User` WHERE `Nick`='" . sql_escape($nick) . "'");
if (count($login_user) > 0) {
$login_user = $login_user[0];
if (isset($_REQUEST['password'])) {
if (!verify_password($_REQUEST['password'], $login_user['Passwort'], $login_user['UID'])) {
$ok = false;
error(_("Your password is incorrect. Please try it again."));
}
} else {
$ok = false;
error(_("Please enter a password."));
}
} else {
$ok = false;
error(_("No user was found with that Nickname. Please try again. If you are still having problems, ask an Dispatcher."));
}
} else {
$ok = false;
error(_("Please enter a nickname."));
}
if ($ok) {
$_SESSION['uid'] = $login_user['UID'];
$_SESSION['locale'] = $login_user['Sprache'];
redirect(page_link_to('news'));
}
}
if (in_array('register', $privileges)) {
$register_hint = join('', array('<p>' . _("Please sign up, if you want to help us!") . '</p>', buttons(array(button(page_link_to('register'), register_title() . ' »')))));
} else {
$register_hint = join('', array(error(_('Registration is disabled.'), true)));
}
return page_with_title(login_title(), array(msg(), '<div class="row"><div class="col-md-6">', form(array(form_text('nick', _("Nick"), $nick), form_password('password', _("Password")), form_submit('submit', _("Login")), buttons(array(button(page_link_to('user_password_recovery'), _("I forgot my password")))), info(_("Please note: You have to activate cookies!"), true))), '</div>', '<div class="col-md-6">', '<h2>' . register_title() . '</h2>', $register_hint, '<h2>' . _("What can I do?") . '</h2>', '<p>' . _("Please read about the jobs you can do to help us.") . '</p>', buttons(array(button(page_link_to('angeltypes') . '&action=about', _("Teams/Job description") . ' »'))), '</div></div>'));
}
示例9: guest_login
function guest_login()
{
global $user, $privileges;
$nick = "";
unset($_SESSION['uid']);
if (isset($_REQUEST['submit'])) {
$ok = true;
if (isset($_REQUEST['nick']) && strlen(User_validate_Nick($_REQUEST['nick'])) > 0) {
$nick = User_validate_Nick($_REQUEST['nick']);
$login_user = sql_select("SELECT * FROM `User` WHERE `Nick`='" . sql_escape($nick) . "'");
if (count($login_user) > 0) {
$login_user = $login_user[0];
if (isset($_REQUEST['password'])) {
if (!verify_password($_REQUEST['password'], $login_user['Passwort'], $login_user['UID'])) {
$ok = false;
error(_("Your password is incorrect. Please try it again."));
} else {
//password is okay, check confirmaiton
if ($login_user['user_account_approved'] !== '1') {
$ok = false;
error(_("Your account is not confirmed yet. Please click the link in the mail we sent you. If you didn't get an eMail, ask a dispatcher."));
}
}
} else {
$ok = false;
error(_("Please enter a password."));
}
} else {
$ok = false;
error(_("No user was found with that Nickname. Please try again. If you are still having problems, ask an Dispatcher."));
}
} else {
$ok = false;
error(_("Please enter a nickname."));
}
if ($ok) {
$_SESSION['uid'] = $login_user['UID'];
$_SESSION['locale'] = $login_user['Sprache'];
redirect(page_link_to('shifts'));
}
}
if (in_array('register', $privileges)) {
$register_hint = join('', array('<p>' . _("Please sign up, if you want to help us!") . '</p>', buttons(array(button(page_link_to('register'), register_title() . ' »')))));
} else {
$register_hint = join('', array(error(_('Registration is disabled.'), true)));
}
return page_with_title(login_title(), array(msg(), '<div class="row"><div class="col-md-6">', form(array(form_text('nick', _("Nick"), $nick), form_password('password', _("Password")), form_submit('submit', _("Login")), buttons(array(button(page_link_to('user_password_recovery'), _("I forgot my password")))), info(_("Please note: You have to activate cookies!"), true))), '</div></div>'));
}
示例10: admin_rooms
function admin_rooms()
{
global $user;
global $user, $enable_frab_import;
$rooms_source = sql_select("SELECT * FROM `Room` ORDER BY `Name`");
$rooms = array();
foreach ($rooms_source as $room) {
$rooms[] = array('name' => $room['Name'], 'from_pentabarf' => $room['FromPentabarf'] == 'Y' ? '✓' : '', 'public' => $room['show'] == 'Y' ? '✓' : '', 'actions' => buttons(array(button(page_link_to('admin_rooms') . '&show=edit&id=' . $room['RID'], _("edit"), 'btn-xs'), button(page_link_to('admin_rooms') . '&show=delete&id=' . $room['RID'], _("delete"), 'btn-xs'))));
}
if (isset($_REQUEST['show'])) {
$msg = "";
$name = "";
$location = "";
$lat = "";
$long = "";
$from_pentabarf = "";
$public = 'Y';
$number = "";
$angeltypes_source = sql_select("SELECT * FROM `AngelTypes` ORDER BY `name`");
$angeltypes = array();
$angeltypes_count = array();
foreach ($angeltypes_source as $angeltype) {
$angeltypes[$angeltype['id']] = $angeltype['name'];
$angeltypes_count[$angeltype['id']] = 0;
}
if (test_request_int('id')) {
$room = sql_select("SELECT * FROM `Room` WHERE `RID`='" . sql_escape($_REQUEST['id']) . "'");
if (count($room) > 0) {
$id = $_REQUEST['id'];
$name = $room[0]['Name'];
$location = $room[0]['Location'];
$lat = $room[0]['Lat'];
$long = $room[0]['Long'];
$from_pentabarf = $room[0]['FromPentabarf'];
$public = $room[0]['show'];
$needed_angeltypes = sql_select("SELECT * FROM `NeededAngelTypes` WHERE `room_id`='" . sql_escape($id) . "'");
foreach ($needed_angeltypes as $needed_angeltype) {
$angeltypes_count[$needed_angeltype['angel_type_id']] = $needed_angeltype['count'];
}
} else {
redirect(page_link_to('admin_rooms'));
}
}
if ($_REQUEST['show'] == 'edit') {
if (isset($_REQUEST['submit'])) {
$ok = true;
if (isset($_REQUEST['name']) && strlen(strip_request_item('name')) > 0) {
$name = strip_request_item('name');
} else {
$ok = false;
$msg .= error(_("Please enter a name."), true);
}
if (isset($_REQUEST['location']) && strlen(strip_request_item('location')) > 0) {
$location = strip_request_item('location');
} else {
$ok = false;
$msg .= error(_("Please enter a location."));
}
if (isset($_REQUEST['Lat']) && isset($_REQUEST['Long'])) {
$lat = $_REQUEST['Lat'];
$long = $_REQUEST['Long'];
} else {
$ok = false;
$msg .= error(_("Please enter a location - no lat long values found."));
}
$from_pentabarf = isset($_REQUEST['from_pentabarf']) ? 'Y' : '';
$public = isset($_REQUEST['public']) ? 'Y' : '';
if (isset($_REQUEST['number'])) {
$number = strip_request_item('number');
} else {
$ok = false;
}
foreach ($angeltypes as $angeltype_id => $angeltype) {
if (isset($_REQUEST['angeltype_count_' . $angeltype_id]) && preg_match("/^[0-9]{1,4}\$/", $_REQUEST['angeltype_count_' . $angeltype_id])) {
$angeltypes_count[$angeltype_id] = $_REQUEST['angeltype_count_' . $angeltype_id];
} else {
$ok = false;
$msg .= error(sprintf(_("Please enter needed angels for type %s.", $angeltype)), true);
}
}
if ($ok) {
if (isset($id)) {
sql_query(sprintf("UPDATE `Room` SET `Name`='%s', `FromPentabarf`='%s', `show`='%s', `Number`='%s', `location` = '%s', `lat` = '%s', `long` = '%s' WHERE `RID`='%s' LIMIT 1", sql_escape($name), sql_escape($from_pentabarf), sql_escape($public), sql_escape($number), sql_escape($location), sql_escape($lat), sql_escape($long), sql_escape($id)));
engelsystem_log("Location updated: " . $name . ", pentabarf import: " . $from_pentabarf . ", public: " . $public . ", number: " . $number);
} else {
$id = Room_create($name, $from_pentabarf, $public, $location, $lat, $long);
if ($id === false) {
engelsystem_error("Unable to create location.");
}
engelsystem_log("Location created: " . $name . ", pentabarf import: " . $from_pentabarf . ", public: " . $public . ", number: " . $number);
}
sql_query("DELETE FROM `NeededAngelTypes` WHERE `room_id`='" . sql_escape($id) . "'");
$needed_angeltype_info = array();
foreach ($angeltypes_count as $angeltype_id => $angeltype_count) {
$angeltype = AngelType($angeltype_id);
if ($angeltype === false) {
engelsystem_error("Unable to load angeltype.");
}
if ($angeltype != null) {
sql_query(sprintf("INSERT INTO `NeededAngelTypes` SET `room_id`='%s', `angel_type_id`='%s', `count`='%s'", sql_escape($id), sql_escape($angeltype_id), sql_escape($angeltype_count)));
//.........这里部分代码省略.........
示例11: form_articles
//.........这里部分代码省略.........
$frm_text = $_SESSION[_SITE . 'temp']['text'];
$frm_meta_desc = cleanSEF($_SESSION[_SITE . 'temp']['description_meta']);
$frm_meta_key = cleanSEF($_SESSION[_SITE . 'temp']['keywords_meta']);
$frm_display_title = 'ok';
$frm_display_info = $contents == 'extra_new' ? '' : 'ok';
$frm_publish = 'ok';
$show_in_subcats = 'ok';
$frm_showonhome = s('display_new_on_home') == 'on' ? 'ok' : '';
$frm_commentable = $contents == 'extra_new' || $contents == 'page_new' || s('enable_comments') != 'YES' ? '' : 'ok';
$frm_task = 'add_article';
$frm_submit = l('submit');
}
$catnum = mysql_fetch_assoc(mysql_query("SELECT COUNT(id) as catnum FROM " . _PRE . 'categories' . ""));
if ($contents == 'article_new' && $catnum['catnum'] < 1) {
echo l('create_cat');
} else {
echo html_input('form', '', 'post', '', '', '', '', '', '', '', '', '', 'post', $frm_action, '');
echo '<div class="adminpanel">';
if ($toggle_div == 'show') {
echo html_input('fieldset', '', '', '', '', '', '', '', '', '', '', '', '', '', '<a title="' . $frm_fieldset . '" onclick="toggle(\'edit_article\')" style="cursor: pointer;">' . $frm_fieldset . '</a>');
echo '<div id="edit_article" style="display: none;">';
} else {
echo html_input('fieldset', '', '', '', '', '', '', '', '', '', '', '', '', '', $frm_fieldset);
}
echo html_input('text', 'title', 'at', $frm_title, l('title'), '', 'onchange="genSEF(this,document.forms[\'post\'].seftitle)"', 'onkeyup="genSEF(this,document.forms[\'post\'].seftitle)"', '', '', '', '', '', '', '');
if ($contents == 'extra_new' || $edit_option == 2) {
echo '<div style="display: none;">';
echo html_input('text', 'seftitle', 'as', $frm_sef_title, l('sef_title'), '', '', '', '', '', '', '', '', '', '');
echo '</div>';
} else {
echo html_input('text', 'seftitle', 'as', $frm_sef_title, l('sef_title'), '', '', '', '', '', '', '', '', '', '');
}
echo html_input('textarea', 'text', 'txt', $frm_text, l('text'), '', '', '', '', '', '2', '100', '', '', '');
buttons();
if ($contents != 'page_new' && $edit_option != 3) {
echo '<p><label for="cat">';
echo $contents == 'extra_new' || $edit_option == 2 ? l('appear_category') : l('category');
if ($contents == 'extra_new' || $edit_option == 2) {
echo ':</label><br /><select name="define_category" id="cat" onchange="dependancy(\'extra\');">';
echo '<option value="-1"' . ($article_category == -1 ? ' selected="selected"' : '') . '>' . l('all') . '</option>';
echo '<option value="-3"' . ($article_category == -3 ? ' selected="selected"' : '') . '>' . l('page_only') . '</option>';
} else {
echo ':</label><br /><select name="define_category" id="cat" onchange="dependancy(\'snews_articles\');">';
}
$category_query = 'SELECT id,name,subcat FROM ' . _PRE . 'categories' . '
WHERE published = \'YES\' AND subcat = 0 ORDER BY catorder,id ASC';
$category_result = mysql_query($category_query);
while ($cat = mysql_fetch_array($category_result)) {
echo '<option value="' . $cat['id'] . '"';
if ($article_category == $cat['id']) {
echo ' selected="selected"';
}
echo '>' . $cat['name'] . '</option>';
$subquery = 'SELECT id,name,subcat FROM ' . _PRE . 'categories' . '
WHERE subcat = ' . $cat['id'] . ' ORDER BY catorder,id ASC';
$subresult = mysql_query($subquery);
while ($s = mysql_fetch_array($subresult)) {
echo '<option value="' . $s['id'] . '"';
if ($article_category == $s['id']) {
echo ' selected="selected"';
}
echo '>--' . $s['name'] . '</option>';
}
}
echo '</select></p>';
if ($contents == 'extra_new' || $edit_option == 2) {
示例12: trim
} else {
echo "<tr bgcolor=#D3D3D3>";
}
for ($c = 0; $c < $len; ++$c) {
echo $tdnowrap;
$e[$c] = trim($e[$c], "\r\n \"");
if ($c == 4) {
$e[$c] = str_replace("\"", "", $e[$c]);
}
if ($e[$c] == "") {
echo " ";
} else {
echo htmlspecialchars($e[$c]);
}
echo "</td>";
}
while ($c < 17) {
echo "<td> </td>";
++$c;
}
echo "</tr>\n";
flush();
++$d;
}
echo "</table>";
echo "<br><br>";
echo "Total Record Count: {$recs}";
echo "<br>";
buttons("");
fclose($fd);
echo "</center></body></html>";
示例13: admin_user
function admin_user()
{
global $user, $privileges, $tshirt_sizes, $privileges;
$html = '';
if (!isset($_REQUEST['id'])) {
redirect(users_link());
}
$id = $_REQUEST['id'];
if (!isset($_REQUEST['action'])) {
$user_source = User($id);
if ($user_source === false) {
engelsystem_error('Unable to load user.');
}
if ($user_source == null) {
error(_('This user does not exist.'));
redirect(users_link());
}
$html .= "Hallo,<br />" . "hier kannst du den Eintrag ändern. Unter dem Punkt 'Gekommen' " . "wird der Engel als anwesend markiert, ein Ja bei Aktiv bedeutet, " . "dass der Engel aktiv war und damit ein Anspruch auf ein T-Shirt hat. " . "Wenn T-Shirt ein 'Ja' enthält, bedeutet dies, dass der Engel " . "bereits sein T-Shirt erhalten hat.<br /><br />\n";
$html .= "<form action=\"" . page_link_to("admin_user") . "&action=save&id={$id}\" method=\"post\">\n";
$html .= "<table border=\"0\">\n";
$html .= "<input type=\"hidden\" name=\"Type\" value=\"Normal\">\n";
$html .= "<tr><td>\n";
$html .= "<table>\n";
$html .= " <tr><td>Nick</td><td>" . "<input type=\"text\" size=\"40\" name=\"eNick\" value=\"" . $user_source['Nick'] . "\"></td></tr>\n";
$html .= " <tr><td>lastLogIn</td><td>" . date("Y-m-d H:i", $user_source['lastLogIn']) . "</td></tr>\n";
$html .= " <tr><td>Name</td><td>" . "<input type=\"text\" size=\"40\" name=\"eName\" value=\"" . $user_source['Name'] . "\"></td></tr>\n";
$html .= " <tr><td>Vorname</td><td>" . "<input type=\"text\" size=\"40\" name=\"eVorname\" value=\"" . $user_source['Vorname'] . "\"></td></tr>\n";
$html .= " <tr><td>Alter</td><td>" . "<input type=\"text\" size=\"5\" name=\"eAlter\" value=\"" . $user_source['Alter'] . "\"></td></tr>\n";
$html .= " <tr><td>Telefon</td><td>" . "<input type=\"text\" size=\"40\" name=\"eTelefon\" value=\"" . $user_source['Telefon'] . "\"></td></tr>\n";
$html .= " <tr><td>Handy</td><td>" . "<input type=\"text\" size=\"40\" name=\"eHandy\" value=\"" . $user_source['Handy'] . "\"></td></tr>\n";
$html .= " <tr><td>DECT</td><td>" . "<input type=\"text\" size=\"4\" name=\"eDECT\" value=\"" . $user_source['DECT'] . "\"></td></tr>\n";
$html .= " <tr><td>email</td><td>" . "<input type=\"text\" size=\"40\" name=\"eemail\" value=\"" . $user_source['email'] . "\"></td></tr>\n";
$html .= "<tr><td>" . form_checkbox('email_shiftinfo', _("Please send me an email if my shifts change"), $user_source['email_shiftinfo']) . "</td></tr>\n";
$html .= " <tr><td>jabber</td><td>" . "<input type=\"text\" size=\"40\" name=\"ejabber\" value=\"" . $user_source['jabber'] . "\"></td></tr>\n";
$html .= " <tr><td>Size</td><td>" . html_select_key('size', 'eSize', $tshirt_sizes, $user_source['Size']) . "</td></tr>\n";
$options = array('1' => "Yes", '0' => "No");
// Gekommen?
$html .= " <tr><td>Gekommen</td><td>\n";
$html .= html_options('eGekommen', $options, $user_source['Gekommen']) . "</td></tr>\n";
// Aktiv?
$html .= " <tr><td>Aktiv</td><td>\n";
$html .= html_options('eAktiv', $options, $user_source['Aktiv']) . "</td></tr>\n";
// Aktiv erzwingen
if (in_array('admin_active', $privileges)) {
$html .= " <tr><td>" . _("Force active") . "</td><td>\n";
$html .= html_options('force_active', $options, $user_source['force_active']) . "</td></tr>\n";
}
// T-Shirt bekommen?
$html .= " <tr><td>T-Shirt</td><td>\n";
$html .= html_options('eTshirt', $options, $user_source['Tshirt']) . "</td></tr>\n";
$html .= " <tr><td>Hometown</td><td>" . "<input type=\"text\" size=\"40\" name=\"Hometown\" value=\"" . $user_source['Hometown'] . "\"></td></tr>\n";
$html .= "</table>\n</td><td valign=\"top\"></td></tr>";
$html .= "</td></tr>\n";
$html .= "</table>\n<br />\n";
$html .= "<input type=\"submit\" value=\"Speichern\">\n";
$html .= "</form>";
$html .= "<hr />";
$html .= form_info('', _('Please visit the angeltypes page or the users profile to manage users angeltypes.'));
$html .= "Hier kannst Du das Passwort dieses Engels neu setzen:<form action=\"" . page_link_to("admin_user") . "&action=change_pw&id={$id}\" method=\"post\">\n";
$html .= "<table>\n";
$html .= " <tr><td>Passwort</td><td>" . "<input type=\"password\" size=\"40\" name=\"new_pw\" value=\"\"></td></tr>\n";
$html .= " <tr><td>Wiederholung</td><td>" . "<input type=\"password\" size=\"40\" name=\"new_pw2\" value=\"\"></td></tr>\n";
$html .= "</table>";
$html .= "<input type=\"submit\" value=\"Speichern\">\n";
$html .= "</form>";
$html .= "<hr />";
$my_highest_group = sql_select("SELECT * FROM `UserGroups` WHERE `uid`='" . sql_escape($user['UID']) . "' ORDER BY `group_id` LIMIT 1");
if (count($my_highest_group) > 0) {
$my_highest_group = $my_highest_group[0]['group_id'];
}
$his_highest_group = sql_select("SELECT * FROM `UserGroups` WHERE `uid`='" . sql_escape($id) . "' ORDER BY `group_id` LIMIT 1");
if (count($his_highest_group) > 0) {
$his_highest_group = $his_highest_group[0]['group_id'];
}
if ($id != $user['UID'] && $my_highest_group <= $his_highest_group) {
$html .= "Hier kannst Du die Benutzergruppen des Engels festlegen:<form action=\"" . page_link_to("admin_user") . "&action=save_groups&id=" . $id . "\" method=\"post\">\n";
$html .= '<table>';
$groups = sql_select("SELECT * FROM `Groups` LEFT OUTER JOIN `UserGroups` ON (`UserGroups`.`group_id` = `Groups`.`UID` AND `UserGroups`.`uid` = '" . sql_escape($id) . "') WHERE `Groups`.`UID` >= '" . sql_escape($my_highest_group) . "' ORDER BY `Groups`.`Name`");
foreach ($groups as $group) {
$html .= '<tr><td><input type="checkbox" name="groups[]" value="' . $group['UID'] . '"' . ($group['group_id'] != "" ? ' checked="checked"' : '') . ' /></td><td>' . $group['Name'] . '</td></tr>';
}
$html .= '</table>';
$html .= "<input type=\"submit\" value=\"Speichern\">\n";
$html .= "</form>";
$html .= "<hr />";
}
$html .= buttons([button(user_delete_link($user_source), glyph('lock') . _("delete"), 'btn-danger')]);
$html .= "<hr />";
} else {
switch ($_REQUEST['action']) {
case 'save_groups':
if ($id != $user['UID']) {
$my_highest_group = sql_select("SELECT * FROM `UserGroups` WHERE `uid`='" . sql_escape($user['UID']) . "' ORDER BY `group_id`");
$his_highest_group = sql_select("SELECT * FROM `UserGroups` WHERE `uid`='" . sql_escape($id) . "' ORDER BY `group_id`");
if (count($my_highest_group) > 0 && (count($his_highest_group) == 0 || $my_highest_group[0]['group_id'] <= $his_highest_group[0]['group_id'])) {
$groups_source = sql_select("SELECT * FROM `Groups` LEFT OUTER JOIN `UserGroups` ON (`UserGroups`.`group_id` = `Groups`.`UID` AND `UserGroups`.`uid` = '" . sql_escape($id) . "') WHERE `Groups`.`UID` >= '" . sql_escape($my_highest_group[0]['group_id']) . "' ORDER BY `Groups`.`Name`");
$groups = array();
$grouplist = array();
foreach ($groups_source as $group) {
$groups[$group['UID']] = $group;
//.........这里部分代码省略.........
示例14: UserAngelType_join_view
function UserAngelType_join_view($user, $angeltype)
{
return page_with_title(sprintf(_("Become a %s"), $angeltype['name']), array(msg(), info(sprintf(_("Do you really want to add %s to %s?"), User_Nick_render($user), $angeltype['name']), true), buttons(array(button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("cancel"), 'cancel'), button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'] . '&user_id=' . $user['UID'] . '&confirmed', _("save"), 'ok')))));
}
示例15: sounds
* String, path to directory
*
* @return: array
*/
function sounds($path)
{
return preg_grep('/^([^.])/', scandir($path));
}
/*
* Function takes in a list of file names and creates an html string of buttons.
*
* @params: $list
* array of filesnames
*
* @return: html string
*/
function buttons($list)
{
$colors = array('default', 'primary', 'success', 'info', 'warning', 'danger');
$buttons = '';
foreach ($list as $key => $value) {
$soundname = substr($value, 0, strpos($value, '.'));
$buttons .= '<button id="' . $soundname . '" type="button" class="staley btn btn-' . $colors[$key % sizeof($colors)] . '">' . $soundname . '</button>';
}
return $buttons;
}
if (isset($_POST['type']) && $_POST['type'] == 'sounds') {
$dir = $_POST['path'];
$filenames = sounds($dir);
echo buttons($filenames);
}