public function render($id) { $template = $this->template; $template->setFile(dirname(__FILE__) . '/TeamList.latte'); $teams = $this->results->where('groupID', $id)->order('points DESC, goal_diff DESC'); //dump($teams); $template->names = $this->teams; $template->teams = $teams; $template->render(); }
/** * Performs an authentication * @param array * @return NIdentity * @throws NAuthenticationException */ public function authenticate(array $credentials) { list($username, $password) = $credentials; $row = $this->users->where('username', $username)->fetch(); if (!$row) { throw new NAuthenticationException("User '{$username}' not found.", self::IDENTITY_NOT_FOUND); } if ($row->password !== $this->calculateHash($password)) { throw new NAuthenticationException("Invalid password.", self::INVALID_CREDENTIAL); } unset($row->password); return new NIdentity($row->id, $row->role, $row->toArray()); }
/** * Returns referenced row. * @param string * @param string * @param bool checks if rows contains the same primary value relations * @return NTableRow or NULL if the row does not exist */ public function getReferencedTable($table, $column, $checkReferenceNewKeys = FALSE) { $referenced = & $this->referenced[$table][$column]; if ($referenced === NULL || $checkReferenceNewKeys || $this->checkReferenceNewKeys) { $keys = array(); foreach ($this->rows as $row) { if ($row[$column] === NULL) continue; $key = $row[$column] instanceof NTableRow ? $row[$column]->getPrimary() : $row[$column]; $keys[$key] = TRUE; } if ($referenced !== NULL && $keys === array_keys($this->rows)) { $this->checkReferenceNewKeys = FALSE; return $referenced; } if ($keys) { $referenced = new NTableSelection($table, $this->connection); $referenced->where($table . '.' . $this->getPrimary($table), array_keys($keys)); } else { $referenced = array(); } } return $referenced; }