本文整理汇总了PHP中Error::addMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP Error::addMessage方法的具体用法?PHP Error::addMessage怎么用?PHP Error::addMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Error
的用法示例。
在下文中一共展示了Error::addMessage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formAction
/**
* Handle form action
*/
protected function formAction()
{
switch ($this->s->action) {
case 'create':
$spot = $this->vars['idspot'] != 0 ? PokerSpot::getInstance($this->vars['idspot']) : FALSE;
$table = new PokerTable($this->vars['title'], $this->vars['seats'], $this->vars['blind'], $spot);
if ($table->save()) {
Error::addMessage('Der Pokertisch wurde erfolgreich angelegt!');
$this->form['reload'] = array('poker' => array('poker_table' => 'tables'));
return true;
}
//*/
break;
case 'update':
$table = PokerTable::getInstance($this->s->element);
$table->title = $this->vars['title'];
$table->seats = $this->vars['seats'];
if ($this->vars['idspot'] != 0) {
$table->spot = PokerSpot::getInstance($this->vars['idspot']);
}
$table->blinds = array('big' => 2 * $this->vars['blind'], 'small' => $this->vars['blind']);
if ($table->save()) {
Error::addMessage('Die Änderungen wurden erfolgreich gespeichert!');
$this->form['reload'] = array('poker' => array('poker_table' => 'tables'));
return true;
}
break;
case 'delete':
$table = PokerTable::getInstance($this->s->element);
if (is_object($table->game)) {
Error::addError('Der Tisch kann nicht gelöscht werden (Spiel ist noch aktiv)!');
return false;
}
if ($table->delete()) {
Error::addMessage('Der Pokertisch wurde erfolgreich gelöscht!');
$this->form['reload'] = array('poker' => array('poker_table' => 'tables'));
return true;
}
break;
case 'reload':
echo $this->listTables();
break;
}
return false;
}
示例2: formAction
/**
* Handle form action
*/
protected function formAction()
{
$this->escapeFormVars();
switch ($this->s->action) {
case 'send':
$message = new Message();
$message->text = $this->vars['text'];
$message->subject = $this->vars['subject'];
if ($this->s->params[0] != '') {
$message->type = $this->s->params[0];
switch ($message->type) {
case 'poker':
$message->receiver = PokerTable::getInstance($this->s->params[1]);
break;
}
} else {
if (!is_array($this->vars['user']) || count($this->vars['user']) == 0) {
return false;
}
$message->type = 'user';
$rec = array();
foreach ($this->vars['user'] as $r) {
$rec[] = User::getInstance($r);
}
$message->receiver = $rec;
}
$message->sender = $this->s->user;
if ($message->save()) {
Error::addMessage('Die Nachricht wurde verschickt!');
$this->form['reload'] = array('message' => array('sidebar'));
return true;
}
break;
case 'update':
$message = Message::getInstance($this->s->element);
$message->text = $this->vars['text'];
$message->subject = $this->vars['subject'];
if ($message->save()) {
Error::addMessage('Die Nachricht wurde geändert!');
$this->form['reload'] = array('message' => array('u_message'));
return true;
}
break;
case 'reply':
$r = Message::getInstance($this->s->element);
$message = new Message();
$message->text = $this->vars['text'];
$message->subject = $this->vars['subject'];
$message->receiver = $r->sender;
$message->sender = $this->s->user;
$message->replyto = $this->s->element;
if ($message->save()) {
Error::addMessage('Die Nachricht wurde verschickt!');
$this->form['reload'] = array('message' => array('u_message'));
return true;
}
break;
case 'mark':
if ($this->s->element != '') {
$m = Message::getInstance($this->s->element);
// mark all messages in thread as (un-)read
if ($this->vars['messages'] == 'all') {
if (is_array($m->replies)) {
foreach ($m->replies as $r) {
if ($r->receiver == $this->s->user) {
$r->read = $this->vars['option'] == 'read' ? true : false;
if (!$r->save()) {
Error::addError('Interner Fehler: Nachricht konnte nicht gespeichert werden!');
return false;
}
}
}
}
$this->form['reload'] = array('message' => array('u_message'));
} else {
$this->form['reload'] = array('message' => array('sidebar', 'bb_messages'));
}
// mark current message as (un-)read
$m->read = $this->vars['option'] == 'read' ? true : false;
if ($m->save()) {
return true;
} else {
Error::addError('Interner Fehler: Nachricht konnte nicht gespeichert werden!');
return false;
}
}
Error::addError('Es konnte keine Nachricht gefunden werden!');
break;
case 'delete':
$m = Message::getInstance($this->s->element);
if ($m->delete()) {
Error::addMessage('Die Nachricht wurde gelöscht!');
$this->form['reload'] = array('message' => array('sidebar', 'u_message'));
return true;
}
break;
case 'reload':
//.........这里部分代码省略.........
示例3: formAction
/**
* Handle form action
*/
protected function formAction()
{
switch ($this->s->action) {
case 'create':
$actions = array('players' => $this->vars['player'], 'actions' => $this->vars['action'], 'values' => $this->vars['value']);
$spot = new PokerSpot($this->vars['title'], $this->vars['button'], $this->vars['stack_p1'], $this->vars['stack_p2'], explode(',', preg_replace('/\\s+/', '', $this->vars['range_p1'])), explode(',', preg_replace('/\\s+/', '', $this->vars['range_p2'])));
if ($spot->save()) {
$raise = 1;
if (is_array($this->vars['player']) && count($this->vars['player']) > 0) {
//$players = array_reverse($this->vars['player'], true);
foreach ($this->vars['player'] as $key => $value) {
if (!isset($own[$value])) {
$own[$value] = $value == $this->vars['button'] ? 0.5 : 1;
}
if ($this->vars['action'][$key] == 'raise') {
$params = array('value' => $this->vars['value'][$key], 'rel_value' => $this->vars['value'][$key] - $raise, 'own_value' => $this->vars['value'][$key] - $own[$value]);
$own[$value] = $this->vars['value'][$key];
$raise = $this->vars['value'][$key];
} elseif ($this->vars['action'][$key] == 'call') {
$params = array('value' => $this->vars['value'][$key]);
} else {
$params = array();
}
$action = new SpotAction($spot, $this->vars['action'][$key], $params, $value);
$action->save();
}
}
Error::addMessage('Der Spot wurde erfolgreich angelegt!');
$this->form['reload'] = array('poker' => array('poker_spot' => 'spots'));
return true;
}
//*/
break;
case 'update':
$spot = PokerSpot::getInstance($this->s->element);
$spot->title = $this->vars['title'];
$spot->button = $this->vars['button'];
$spot->stacks = array($this->vars['stack_p1'], $this->vars['stack_p2']);
$spot->ranges = array(explode(',', preg_replace('/\\s+/', '', $this->vars['range_p1'])), explode(',', preg_replace('/\\s+/', '', $this->vars['range_p2'])));
if ($spot->save()) {
if (is_array($spot->actions)) {
foreach ($spot->actions as $action) {
$action->delete();
}
}
$raise = 1;
if (is_array($this->vars['player']) && count($this->vars['player']) > 0) {
foreach ($this->vars['player'] as $key => $value) {
if (!isset($own[$value])) {
$own[$value] = $value == $this->vars['button'] ? 0.5 : 1;
}
if ($this->vars['action'][$key] == 'raise') {
$params = array('value' => $this->vars['value'][$key], 'rel_value' => $this->vars['value'][$key] - $raise, 'own_value' => $this->vars['value'][$key] - $own[$value]);
$own[$value] = $this->vars['value'][$key];
$raise = $this->vars['value'][$key];
} elseif ($this->vars['action'][$key] == 'call') {
$params = array('value' => $this->vars['value'][$key]);
} else {
$params = array();
}
$action = new SpotAction($spot, $this->vars['action'][$key], $params, $value);
$action->save();
}
}
Error::addMessage('Die Änderungen wurden erfolgreich gespeichert!');
$this->form['reload'] = array('poker' => array('poker_spot' => 'spots'));
return true;
}
break;
case 'delete':
$spot = PokerSpot::getInstance($this->s->element);
/* if (is_object($spot->game)) {
Error::addError('Der Spot kann nicht gelöscht werden (Spiel ist noch aktiv)!');
return false;
}//*/
if ($spot->delete()) {
Error::addMessage('Der Spot wurde erfolgreich gelöscht!');
$this->form['reload'] = array('poker' => array('poker_spot' => 'spots'));
return true;
}
break;
case 'reload':
echo $this->listSpots();
break;
}
return false;
}