本文整理汇总了PHP中event::update方法的典型用法代码示例。如果您正苦于以下问题:PHP event::update方法的具体用法?PHP event::update怎么用?PHP event::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类event
的用法示例。
在下文中一共展示了event::update方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action
function action()
{
$event = new event();
$identifier = $this->response->html->request()->get($this->identifier_name);
$msg = '';
if ($identifier !== '') {
foreach ($identifier as $id) {
$event->get_instance_by_id($id);
if ($event->priority == 9 && $event->source === 'License') {
continue;
}
$fields = array();
$fields["event_status"] = 1;
$event->update($id, $fields);
$msg .= sprintf($this->lang['msg'], $id) . '<br>';
}
}
$this->response->redirect($this->response->get_url($this->actions_name, 'select', $this->message_param, $msg));
}
示例2: action
function action()
{
global $OPENQRM_SERVER_BASE_DIR;
$RootDir = $_SERVER["DOCUMENT_ROOT"] . '/openqrm/base/';
$token = $this->response->html->request()->get('token');
$event_id = $this->response->html->request()->get('event_id');
$msg = '';
if ($token !== '' && $event_id !== '') {
$event = new event();
$event->get_instance_by_id($event_id);
$event->log("event-action", $_SERVER['REQUEST_TIME'], 5, "event-overview.php", "Re-Running command {$token}", "", "", 0, 0, 0);
$command = "mv -f " . $OPENQRM_SERVER_BASE_DIR . "/openqrm/web/base/server/event/errors/" . $token . ".cmd " . $OPENQRM_SERVER_BASE_DIR . "/openqrm/var/spool/openqrm-queue." . $token . " && rm -f " . $OPENQRM_SERVER_BASE_DIR . "/openqrm/web/base/server/event/errors/" . $token . ".out";
shell_exec($command);
$fields = array();
$fields["event_priority"] = 4;
$event->update($event_id, $fields);
$msg .= "Re-running token " . $token . " / Event ID " . $event_id . "<br>";
}
$this->response->redirect($this->response->get_url($this->actions_name, 'select', $this->message_param, $msg));
}
示例3: printf
$fn = $game_i[6];
$ln = $game_i[7];
$tn = $game_i[2];
$passToPlayer = $conn->query("select player_id from Player where first_name = '{$fn}' && last_name = '{$ln}' && team_name = '{$tn}' ");
if ($passToPlayer->num_rows == 0) {
printf("Error: No passingTO player found!");
exit;
}
$cnt["passTo"] = $passToPlayer->fetch_row()[0];
}
$exist = $conn->query("select * from Event where p_id = '{$player_id}' AND g_id = '{$game_id}'");
if ($exist->num_rows == 0) {
// this is a new Event, insert to the Event table.
// rushing touch down should be initialized.
$result = event::insert($player_id, $game_id, $cnt["rushing"], $cnt["passing"], $cnt["fieldgoal"], $cnt["passTo"]);
} else {
// the event is already inserted.
// update the table.
$result = event::update($player_id, $game_id, $cnt["rushing"], $cnt["passing"], $cnt["fieldgoal"], $cnt["passTo"]);
}
$event_id = $result->event_id;
$player_id = $result->player_id;
$game_id = $result->game_id;
printf("insert Event " . "{$event_id}: " . "{$player_id}" . " and " . "{$game_id}" . " succeeded!");
?>
<br>
<?php
}
?>
示例4: select
//.........这里部分代码省略.........
// error event
case 4:
case 5:
case 6:
case 7:
case 8:
$icon = '<span class="pill green">notice</span>';
break;
// undefined event
// undefined event
case 9:
$icon = '<span class="pill yellow">running</span>';
break;
// active event
// active event
case 10:
$icon = '<span class="pill green">ok</span>';
break;
// notice event
}
if ($value['event_status'] === '1') {
$icon = '<span class="pill green">ack</span>';
// acknowledged event
}
$description = '';
if (strstr($value['event_description'], "ERROR running token")) {
$error_token = str_replace("ERROR running token ", "", $value['event_description']);
$cmd_file = $this->rootdir . "/server/event/errors/" . $error_token . ".cmd";
$error_file = $this->rootdir . "/server/event/errors/" . $error_token . ".out";
// get command and error strings
if ($this->file->exists($cmd_file) && $this->file->exists($error_file)) {
$oq_cmd = $this->file->get_contents($cmd_file);
$oq_cmd = str_replace('"', '', $oq_cmd);
$oq_cmd_error = $this->file->get_contents($error_file);
$oq_cmd_error = str_replace('"', '', $oq_cmd_error);
// set the event to error in any way
$event_fields = array();
$event_fields["event_priority"] = 1;
$event->update($value['event_id'], $event_fields);
$event->get_instance_by_id($value['event_id']);
$icon = '<span class="pill red">error</span>';
// set the description
$description = "<a href=\"/openqrm/base/server/event/errors/" . $error_token . ".out\" title=\"" . $oq_cmd_error . "\" target=\"_BLANK\">Error</a> running openQRM <a href=\"/openqrm/base/server/event/errors/" . $error_token . ".cmd\" title=\"" . $oq_cmd . "\"target=\"_BLANK\">command</a>";
$a = $this->response->html->a();
$a->title = $this->lang['action_rerun'];
$a->label = $this->lang['action_rerun'];
$a->handler = 'onclick="wait();"';
$a->css = 'start pull-right';
$a->href = $this->response->get_url($this->actions_name, 'rerun') . '&token=' . $error_token . '&event_id=' . $event->id;
$rerun = $a->get_string();
$description .= $rerun;
} else {
// we are currently re-running the token, do not show the links
$description = "Error running openQRM command<br><strong>Currently re-running token {$error_token}</strong>";
}
} else {
$description = $value['event_description'];
}
$b[$i]['event_id'] = $value['event_id'];
$b[$i]['event_priority'] = $icon;
$b[$i]['event_time'] = date('Y/m/d H:i:s', $value['event_time']);
$b[$i]['event_source'] = $value['event_source'];
$b[$i]['event_description'] = $description;
$i++;
}
$filter = array();
$filter[] = array('', 'all');
$filter[] = array($this->lang['filter_active'], 'active');
$filter[] = array($this->lang['filter_warning'], 'warning');
$filter[] = array($this->lang['filter_error'], 'error');
$filter[] = array($this->lang['filter_acknowledge'], 'acknowledge');
asort($filter);
$select = $this->response->html->select();
$select->add($filter, array(1, 0));
$select->name = 'event_filter';
$select->handler = 'onchange="wait();this.form.submit();return false;"';
$select->selected = array($this->response->html->request()->get('event_filter'));
$box = $this->response->html->box();
$box->add($select);
$box->id = 'events_filter';
$box->css = 'htmlobject_box';
$box->label = $this->lang['lang_filter'];
$table->add_headrow($box->get_string());
$table->id = 'Tabelle';
$table->css = 'htmlobject_table';
$table->border = 1;
$table->cellspacing = 0;
$table->form_action = $this->response->html->thisfile;
$table->cellpadding = 3;
$table->autosort = false;
$table->sort_link = false;
$table->head = $h;
$table->body = $b;
$table->actions_name = $this->actions_name;
$table->actions = array(array('remove' => $this->lang['action_remove']), array('acknowledge' => $this->lang['action_acknowledge']));
$table->identifier = 'event_id';
$table->identifier_name = $this->identifier_name;
$table->limit_select = array(array("value" => 100, "text" => 100), array("value" => 200, "text" => 200), array("value" => 400, "text" => 400), array("value" => 500, "text" => 500));
return $table;
}
示例5: addEventToGame
public static function addEventToGame($game_id, $type, $first, $last, $score, $team)
{
$mysqli = new mysqli("classroom.cs.unc.edu", "hongkun", "CH@ngemenow99Please!hongkun", "hongkundb");
/*check the connection*/
if (mysqli_connect_errno()) {
printf("Connection failed: %s\n", mysqli_connect_errno);
exit;
}
// First: add the score to specific team, if team is found
$teamSelected = $mysqli->query("select * from Game where (Team1 = '{$team}' || Team2 = '{$team}') && game_id = '{$game_id}'");
if ($teamSelected->num_rows == 0) {
header("HTTP/1.0 400 Bad Request");
printMessageJSON("Bad Request, Team Not Match");
exit;
}
$teamSelected = $teamSelected->fetch_row();
$allAcore = [$teamSelected[1] => $teamSelected[3], $teamSelected[2] => $teamSelected[4]];
if ($type == "fieldgoal") {
$allAcore[$team] += 3;
} else {
if ($type == "passing") {
$allAcore[$team] += 7;
} else {
if ($type == "rushing") {
$allAcore[$team] += 7;
}
}
}
// if the score is not match, exit();
if ($allAcore[$team] != $score) {
header("HTTP/1.0 400 Bad Request");
printMessageJSON("Bad Request, Score Not Match");
exit;
}
if ($allAcore[$teamSelected[1]] >= $allAcore[$teamSelected[2]]) {
$winner = [$teamSelected[1] => $allAcore[$teamSelected[1]]];
$loser = [$teamSelected[2] => $allAcore[$teamSelected[2]]];
} else {
$winner = [$teamSelected[2] => $allAcore[$teamSelected[2]]];
$loser = [$teamSelected[1] => $allAcore[$teamSelected[1]]];
}
// Update the team score in Game Table.
$gameUpdated = game::update($game_id, key($winner), key($loser), current($winner), current($loser));
// Second: find the player in the team specified.
// if it exists, return p_id, if not, insert it and return the p_id.
$player_id = $mysqli->query("select player_id from Player where first_name = '{$first}' && last_name = '{$last}' && team_name = '{$team}'");
if ($player_id->num_rows == 0) {
$newPlayer = player::insert($first, $last, $team);
$newPlayer = (array) $newPlayer;
$player_id = intval($newPlayer["player_id"]);
} else {
$player_id = $player_id->fetch_row()[0];
}
// Use the p_id and game_id to find the event of the type,
// if it exists, increase the number of the type
// if not, insert the event.
$eventSelected = $mysqli->query("select event_id from Event where p_id = '{$player_id}' && g_id = '{$game_id}'");
$cnt = ["rushing" => 0, "passing" => 0, "fieldgoal" => 0, "passTo" => NULL];
$cnt[$type]++;
if ($eventSelected->num_rows == 0) {
$event_id = event::insert($player_id, $game_id, $cnt["rushing"], $cnt["passing"], $cnt["fieldgoal"], $cnt["passTo"]);
} else {
$event_id = event::update($player_id, $game_id, $cnt["rushing"], $cnt["passing"], $cnt["fieldgoal"], $cnt["passTo"]);
}
// var_dump($event_id);
$ids = [$game_id, $player_id];
return $ids;
}