本文整理汇总了PHP中render_ajax函数的典型用法代码示例。如果您正苦于以下问题:PHP render_ajax函数的具体用法?PHP render_ajax怎么用?PHP render_ajax使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了render_ajax函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
$tournament = $discipline->get_tournament();
$season = $tournament->get_season();
$player = null;
$player_club = null;
$partner = null;
$partner_club = null;
if (!empty($_POST['player'])) {
$player = $season->get_player_by_input($_POST['player']);
if (!empty($_POST['player_club'])) {
$player_club = $season->get_club_by_input($_POST['player_club']);
}
}
if (!empty($_POST['partner'])) {
$partner = $season->get_player_by_input($_POST['partner']);
if (!empty($_POST['partner_club'])) {
$partner_club = $season->get_club_by_input($_POST['partner_club']);
}
}
$email = isset($_POST['email']) ? $_POST['email'] : null;
$seeding = isset($_POST['seeding']) ? $_POST['seeding'] : null;
$memo = isset($_POST['memo']) ? $_POST['memo'] : null;
try {
$discipline->check_entry($player, $partner);
} catch (utils\InvalidEntryException $iee) {
render_ajax_error('Meldung kann nicht angenommen werden: ' . $iee->getMessage());
exit;
}
$entry = Entry::create($discipline, $player, $player_club, $partner, $partner_club, $email, $seeding, $memo);
$entry->save();
render_ajax('d/' . $discipline->id . '/', ['entry' => $entry]);
示例2: dirname
<?php
namespace bmtmgr;
require_once dirname(__DIR__) . '/src/common.php';
utils\csrf_protect();
$u = user\check_current();
$u->require_perm('admin');
utils\require_post_params(['name', 'season_id']);
$season = Season::by_id($_POST['season_id']);
try {
$tournament = Tournament::create($season, $_POST['name']);
$tournament->save();
} catch (utils\DuplicateEntryException $e) {
render_ajax_error('Ein Turnier mit dem Namen "' . $_POST['name'] . '" existiert bereits');
exit;
}
render_ajax('t/' . $tournament->id . '/', ['season' => $season, 'tournament' => $tournament]);
示例3: dirname
<?php
namespace bmtmgr;
require_once dirname(__DIR__) . '/src/common.php';
require_once dirname(__DIR__) . '/src/sftp.php';
utils\csrf_protect();
$u = user\check_current();
$u->require_perm('admin');
utils\require_get_params(['publication_id']);
utils\require_post_params(['type']);
$publication_type = $_POST['type'];
$tournament = Tournament::by_id($_GET['tournament_id']);
$season = $tournament->get_season();
switch ($publication_type) {
case 'sftp':
utils\require_post_params(['server', 'port', 'user', 'path']);
$publication = sftp\SFTPPublication::sftp_create($tournament, $_POST['server'], \intval($_POST['port']), $_POST['user'], $_POST['path']);
$publication->save();
render_ajax('t/' . $tournament->id . '/publication/' . $publication->id . '/', ['publication' => $publication]);
break;
default:
throw new \Exception('Invalid publication type');
}
示例4: User
$imported_clubs = [];
$not_found_since = 0;
Model::beginTransaction();
for ($i = 1; $i < 100000; $i++) {
$url = \sprintf($url_pattern, $i);
$page = \file_get_contents($url);
$r = \preg_match('/
<label>ClubID:<\\/label><div>(?P<id>[0-9-]+)<\\/div>.*
<label>Vereinsname:<\\/label><div>(?P<name>[^<]+)<\\/div>.*
<label>Email:<\\/label><div><a.*?>(?P<email>[^<]+)<\\/a>
/xs', $page, $m);
if (!$r) {
$not_found_since++;
if ($not_found_since > 100) {
break;
}
continue;
}
$id = \html_entity_decode($m['id'], ENT_QUOTES | ENT_HTML5, 'utf-8');
$name = \html_entity_decode($m['name'], ENT_QUOTES | ENT_HTML5, 'utf-8');
$email = \html_entity_decode($m['email'], ENT_QUOTES | ENT_HTML5, 'utf-8');
$c = User::by_id_optional($id);
if (!$c) {
$c = new User($id, $name, $email, ['register']);
$c->save();
\array_push($imported_clubs, $c);
}
}
Model::commit();
render_ajax('club/', ['imported_clubs' => $imported_clubs]);
示例5: gettext
{
global $config;
if (!isset($config['hast']['enable'])) {
return gettext("HAST disabled");
}
$cmd = "/sbin/hastctl status";
if (isset($_GET['name'])) {
$cmd .= " {$_GET['name']}";
}
$cmd .= " 2>&1";
mwexec2($cmd, $rawdata);
return implode("\n", $rawdata);
}
if (is_ajax()) {
$status = hast_get_status();
render_ajax($status);
}
include "fbegin.inc";
?>
<script type="text/javascript">//<![CDATA[
$(document).ready(function(){
var gui = new GUI;
gui.recall(0, 5000, 'services_hast_info.php', null, function(data) {
$('#hast_status').text(data.data);
});
});
//]]>
</script>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="tabnavtbl">
示例6: get_conf_all_disks_list_filtered
$cfdevice = "/dev/{$cfdevice}";
// Get list of all configured disks (physical and virtual).
$a_disk = get_conf_all_disks_list_filtered();
function get_fs_type($devicespecialfile)
{
global $a_disk;
$index = array_search_ex($devicespecialfile, $a_disk, "devicespecialfile");
if (false === $index) {
return "";
}
return $a_disk[$index]['fstype'];
}
if (is_ajax()) {
$devfile = $_GET['devfile'];
$fstype = get_fs_type($devfile);
render_ajax($fstype);
}
function filter_disk($array)
{
return array_filter($array, function ($diskv) {
if (0 != strcmp($diskv['size'], "NA") && 1 != disks_exists($diskv['devicespecialfile'])) {
return $diskv;
}
});
}
// Advanced Format
$pconfig['aft4k'] = $aft4k = false;
$do_format = array();
$disks = array();
$type = 'zfs';
$minspace = '';
示例7: dirname
<?php
namespace bmtmgr;
require_once dirname(__DIR__) . '/src/common.php';
utils\csrf_protect();
$u = user\check_current();
$u->require_perm('admin');
utils\require_get_params(['id', 'action']);
$season = Season::by_id($_GET['id']);
switch ($_GET['action']) {
case 'hide':
case 'show':
$season->visible = $_GET['action'] == 'show';
$season->save();
render_ajax('season/' . $season->id . '/', ['season' => $season]);
break;
default:
header('HTTP/1.1 404 Not Found');
render('error', ['title' => 'Unbekannte Aktion', 'msg' => 'Entschuldigung, wir haben eine Adresse falsch eingetragen. Die Aktion "' . $_GET['action'] . '" ist nicht implementiert.']);
}
示例8: dirname
<?php
namespace bmtmgr;
require_once dirname(__DIR__) . '/src/common.php';
utils\csrf_protect();
$u = user\check_current();
$u->require_perm('admin');
utils\require_get_params(['player_id']);
$player = Player::by_id($_GET['player_id']);
utils\require_post_params(['email']);
$player->email = $_POST['email'];
$player->save();
render_ajax('player/' . $player->id . '/', ['player' => $player]);
示例9: dirname
<?php
namespace bmtmgr;
require_once dirname(__DIR__) . '/src/common.php';
utils\csrf_protect();
$u = user\check_current();
$u->require_perm('admin');
utils\require_get_params(['discipline_id']);
utils\require_post_params(['note', 'capacity']);
$discipline = Discipline::by_id($_GET['discipline_id']);
$discipline->capacity = $_POST['capacity'] !== '' ? \intval($_POST['capacity']) : null;
$discipline->note = $_POST['note'];
$discipline->save();
render_ajax('d/' . $discipline->id . '/', ['discipline' => $discipline]);
示例10: User
if (!$club) {
$club = new User($m['id'], $m['name'], null, ['register']);
$club->save();
}
$players_url = $base_url . 'clubplayers.aspx' . $m['club_path'] . '&cid=' . $m['club_num'];
$players_page = \file_get_contents($players_url);
$genders = ['Männer' => 'm', 'Frauen' => 'f'];
if (!\preg_match_all('#<caption>\\s*(?<gender_str>Männer|Frauen)\\s*</caption><thead>(?P<table>.*?)</tbody>#s', $players_page, $player_table_m, \PREG_SET_ORDER)) {
continue;
// Some clubs don't have any players associated with them (because of merger etc.)
}
foreach ($player_table_m as $table_m) {
$g = $genders[$table_m['gender_str']];
$table = $table_m['table'];
preg_match_all('#
<td\\s+id="playercell"><a\\s+href="[^"]+">(?P<name>[^<]+)</a></td>
<td\\s+class="flagcell">(?:<img.*?/><span[^>]*>\\[(?P<nationality>[A-Z]+)\\]\\s*</span>)?</td>
<td>(?P<textid>[^>]+)</td>
<td>(?P<birth_year>[0-9]{4})</td>#xs', $table, $matches, \PREG_SET_ORDER);
foreach ($matches as $m) {
if (Player::exists($season, $m['textid'])) {
continue;
}
$p = new Player(['id' => null, 'season_id' => $season->id, 'club_id' => $club->id, 'textid' => $m['textid'], 'name' => $m['name'], 'gender' => $g, 'birth_year' => \intval($m['birth_year']), 'nationality' => $m['nationality'], 'email' => null, 'phone' => null], true);
$p->save();
}
}
}
Model::commit();
render_ajax('season/' . urlencode($season->id) . '/', ['season' => $season]);
示例11: render_web
render_web($error, 'info');
}
} catch (\Lazyphp\Core\RestException $e) {
$class_array = explode('\\', get_class($e));
$class = t(end($class_array));
$prefix = strtoupper(rremove($class, 'Exception'));
$error = get_error($prefix);
$error['message'] = $error['message'] . '- ' . $e->getMessage();
$error['created'] = date("Y-m-d H:i:s");
if (is_json_request() || c('api_server_only')) {
send_json($error);
} elseif (is_ajax_request()) {
render_ajax($error, 'info');
} else {
render_web($error, 'info');
}
} catch (\Exception $e) {
$class_array = explode('\\', get_class($e));
$class = t(end($class_array));
$prefix = strtoupper(rremove($class, 'Exception'));
$error = get_error($prefix);
$error['message'] = $error['message'] . '- ' . $e->getMessage();
$error['created'] = date("Y-m-d H:i:s");
if (is_json_request() || c('api_server_only')) {
send_json($error);
} elseif (is_ajax_request()) {
render_ajax($error, 'info');
} else {
render_web($error, 'info');
}
}
示例12: dirname
<?php
namespace bmtmgr;
require_once dirname(__DIR__) . '/src/common.php';
utils\csrf_protect();
$u = user\check_current();
$u->require_perm('admin');
utils\require_get_params(['tournament_id']);
utils\require_post_params(['name', 'dtype']);
$tournament = Tournament::by_id($_GET['tournament_id']);
if ($_POST['dtype'] == 'all') {
$specs = [['name' => 'HE' . $_POST['name'], 'dtype' => 'MS'], ['name' => 'DE' . $_POST['name'], 'dtype' => 'WS'], ['name' => 'HD' . $_POST['name'], 'dtype' => 'MD'], ['name' => 'DD' . $_POST['name'], 'dtype' => 'WD'], ['name' => 'MX' . $_POST['name'], 'dtype' => 'MX']];
} else {
$specs = [['name' => $_POST['name'], 'dtype' => $_POST['dtype']]];
}
Model::beginTransaction();
foreach ($specs as $spec) {
try {
$discipline = Discipline::create($tournament, $spec['name'], $spec['dtype']);
$discipline->save();
} catch (utils\DuplicateEntryException $e) {
render_ajax_error(sprintf('Disziplin "%s" existiert bereits!', $spec['name']));
exit;
}
}
Model::commit();
render_ajax('d/' . $discipline->id . '/', ['tournament' => $tournament, 'disciplines' => $disciplines]);
示例13: send_error
function send_error($type, $info = null, $force_json = false)
{
if ($error = get_error($type)) {
if ($info != null) {
$error['message'] = $error['message'] . ' -' . $info;
}
} else {
$error['message'] = $info;
}
//print_r( $error );
//send_json($error);
if (is_json_request() || $force_json) {
return send_json($error);
} elseif (is_ajax_request()) {
return render_ajax($error, 'info');
} else {
return render_web($error, 'info');
}
}
示例14: dirname
<?php
namespace bmtmgr;
require_once dirname(__DIR__) . '/src/common.php';
require_once dirname(__DIR__) . '/src/sftp.php';
utils\csrf_protect();
$u = user\check_current();
$u->require_perm('admin');
utils\require_get_params(['tournament_id']);
utils\require_post_params(['type']);
$publication_type = $_POST['type'];
$tournament = Tournament::by_id($_GET['tournament_id']);
$season = $tournament->get_season();
switch ($publication_type) {
case 'sftp':
utils\require_post_params(['server', 'port', 'username', 'path']);
$publication = sftp\SFTPPublication::sftp_create($tournament, $_POST['server'], \intval($_POST['port']), $_POST['path'], $_POST['username']);
$publication->save();
render_ajax('publication/' . $publication->id . '/', ['publication' => $publication]);
break;
default:
throw new \Exception('Invalid publication type');
}
示例15: render_ajax
$age_group = '';
break;
case 'U19':
if ($line['league'] == 'Mini') {
$age_group = 'U19-';
} else {
$age_group = 'J';
}
break;
}
$l = $age_group . $line['league'];
if (!\array_key_exists($l, $games_in_league)) {
$games_in_league[$l] = 0;
$wins_in_league[$l] = 0;
}
$games_in_league[$l]++;
if (\array_key_exists('won', $line)) {
$wins_in_league[$l]++;
}
$days[$line['date']] = $l;
}
if (\count($games_in_league) > 0) {
// For now, pick the league with the most games
$league = \bmtmgr\utils\array_max_key($games_in_league);
$player->league = $league;
$player->winrate = $wins_in_league[$league] / $games_in_league[$league];
$player->save();
}
}
render_ajax('t/' . $tournament->id . '/', ['tournament' => $tournament]);