public function indexAction() { if (!$this->checkAccess()) { return; } $eDb = new eDb(); if (isset($_GET['all'])) { $rows = q::select('account')->filter('admin = ', 0)->order('username')->fetch(); $this->displayAll($rows); } if (isset($_GET['par'])) { $rows = $eDb->getAllPairsFromPairs(); $this->displayPairs($rows); } if (isset($_GET['par_loose'])) { $rows = $eDb->getAllPairsNotInHalve(); $this->displayPairs($rows); } if (isset($_GET['halv'])) { $q = "SELECT * FROM halv WHERE confirmed = 1"; $rows = q::query($q)->fetch(); $this->displayHalve($rows); } if (isset($_GET['halv_loose'])) { $rows = $eDb->getAllHalveNotInHele(session::getUserId()); // $rows = q::query($q)->fetch(); $this->displayHalve($rows); } if (isset($_GET['hel'])) { $q = "SELECT * FROM hel WHERE confirmed = 1"; $rows = q::query($q)->fetch(); $this->displayHele($rows); } if (isset($_GET['reg_minus'])) { echo $this->message("Brugere som er importeret, men som endnu ikke har foretaget en opdatering på sitet."); $q = "SELECT * from account WHERE id NOT IN (select user_id from dancer) AND admin = 0 ORDER by username"; $rows = q::query($q)->fetch(); $this->displayAll($rows); } if (isset($_GET['uden'])) { echo $this->message("Brugere som er importeret og har foretaget en opdatering på sitet, men som endnu ikke har en verificeret partner."); $q = "SELECT * from account WHERE `admin` = 0 AND id NOT IN (SELECT user_a from pair UNION SELECT user_b from pair) AND id IN (SELECT user_id FROM dancer)"; $rows = q::query($q)->fetch(); $this->displayAll($rows); } }
/** * Get all pairs as an array excluding pair with user * @return array $ary array of pairs */ public function getFormPairsAry() { $eDb = new eDb(); $pairs = $eDb->getAllPairsNotInHalve(); $ary = []; $ary[0] = 'Intet par valgt'; foreach ($pairs as $pair) { $a = session::getAccount($pair['user_a']); $b = session::getAccount($pair['user_b']); if ($a['id'] == session::getUserId()) { continue; } if ($b['id'] == session::getUserId()) { continue; } $pair_str = $a['username'] . ' - ' . $b['username']; $ary[$pair['id']] = $pair_str; } return $ary; }