/** * create form for editing / creating a house * * @return string HTML code * @author Elias Müller **/ private function getForm($id = '') { $path = 'poker_table-' . $this->s->action . ($this->s->element != '' ? '/' . $this->s->element : ''); if ($id != '') { $table = PokerTable::getInstance($id); } else { $table = new PokerTable(); } $spots = PokerSpot::getAll(); $tpl = new Template('poker'); $tpl->assign('path', $path); $tpl->assign('spots', $spots); $tpl->assign('table', $table); return $tpl->fetch('form_table.html'); }
/** * Create houses list * * @return string HTML code for houses list */ private function listSpots() { $db = DB::getInstance(); $tpl = new Template('poker'); $spots = PokerSpot::getAll(); foreach ($spots as $spot) { foreach ($spot->ranges as $key => $value) { if (is_array($value)) { $spot->ranges[$key] = implode(', ', $value); } else { $spot->ranges[$key] = ''; } } foreach ($spot->actions as $key => $value) { $value->player = $value->player + 1; } $spot->button = $spot->button + 1; } $tpl->assign('spots', $spots); $tpl->assign('user', $this->s->user); $tpl->assign('call', $this->s->post['call']); $tpl->assign('permissions', array('create' => $this->s->user->hasRights("poker:poker_spot-create"), 'delete' => $this->s->user->hasRights("poker:poker_spot-delete"), 'update' => $this->s->user->hasRights("poker:poker_spot-update"), 'update_own' => $this->s->user->hasRights("poker:poker_spot-own"))); return $tpl->fetch('spots_table.html'); }