function order($pReload = FALSE) { if ($pReload || is_null($this->_order)) { $value = Ultimatum_Model_Ultplayergrouporders::getInstance()->get($this->order_id); // process $this->_order = $value; } return $this->_order; }
/** * @return Ultimatum_Model_Ultplayergrouporders[] */ public function pending_orders() { $orders = Ultimatum_Model_Ultplayergrouporders::getInstance(); try { $sql = sprintf('SELECT po.id FROM %s po ', $orders->table()->tableName()); $sql .= sprintf(' LEFT JOIN %s pg ON pg.id = po.player_group ', Ultimatum_Model_Ultgamegroups::getInstance()->table()->tableName()); $sql .= sprintf(' WHERE po.target = %s ', $this->get_group()->identity()); $sql .= sprintf(' AND pg.player = %s', $this->player); $sql .= ' AND po.active > 0;'; error_log(__METHOD__ . ': finding orders; sql = ' . $sql); $out = $orders->find_from_sql($sql, FALSE); } catch (Exception $e) { error_log(__METHOD__ . ': error on sql ' . $sql); $out = array(); } return $out; }
public function cancelorderAction() { if (!$this->_prep()) { $this->_forward('index', 'index', NULL, array('error' => 'problem loading game')); } $order = $this->_getParam("order", NULL); $po = Ultimatum_Model_Ultplayergrouporders::getInstance()->get($order); if (!$po->player_group()->player()->identity() == $this->view->player->identity()) { $params = array('error' => 'cannot cancel order ' . $order . ': doesn\'t refer to one of your groups'); } else { $po->cancel(); $params = array('message' => 'Cancelled order ' . $po); } $this->_forward('run', NULL, NULL, $params); }
/** * * @param <type> $pType * @param <type> $pTarget * @return */ public function pending_orders($pType = NULL, $pTarget = NULL) { $params = array('commander' => $this->identity(), 'active' => 1); $out = Ultimatum_Model_Ultplayergrouporders::getInstance()->find($params, 'given_at'); return $out; }
/** * * @return array */ public function pending_orders() { $po = Ultimatum_Model_Ultplayergrouporders::getInstance(); $select = $po->table()->select()->where('active = ?', 1)->where('player_group = ?', $this->identity())->where('status = ?', Ultimatum_Model_Ultplayergrouporders::STATUS_PENDIONG)->orWhere('status = ?', Ultimatum_Model_Ultplayergrouporders::STATUS_EXECUTING); return $po->find($select, 'series'); }