/** * @see DatabaseObjectList::readObjects() */ public function readObjects() { $sql = "SELECT\t\t" . (!empty($this->sqlSelects) ? $this->sqlSelects . ',' : '') . "\n\t\t\t\t\tavatar_table.*,\n\t\t\t\t\tcontest_jury.*,\n\t\t\t\t\tgroup_table.groupName, \n\t\t\t\t\tuser_table.username\n\t\t\tFROM\t\twcf" . WCF_N . "_contest_jury contest_jury\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_user user_table\n\t\t\tON\t\t(user_table.userID = contest_jury.userID)\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_avatar avatar_table\n\t\t\tON\t\t(avatar_table.avatarID = user_table.avatarID)\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_group group_table\n\t\t\tON\t\t(group_table.groupID = contest_jury.groupID)\n\t\t\t" . $this->sqlJoins . "\n\n\t\t\tWHERE (" . ContestJury::getStateConditions() . ")\n\t\t\t" . (!empty($this->sqlConditions) ? "AND " . $this->sqlConditions : '') . "\n\t\t\t" . (!empty($this->sqlOrderBy) ? "ORDER BY " . $this->sqlOrderBy : ''); $result = WCF::getDB()->sendQuery($sql, $this->sqlLimit, $this->sqlOffset); while ($row = WCF::getDB()->fetchArray($result)) { $this->jurys[] = new ViewableContestJury(null, $row); } }
/** * Creates a new ViewableContest object. * * @param integer $juryID * @param array<mixed> $row */ public function __construct($juryID, $row = null) { if ($juryID !== null) { $sql = "SELECT\t\tavatar_table.*, \n\t\t\t\t\t\tcontest_jury.*,\n\t\t\t\t\t\tuser_table.username, \n\t\t\t\t\t\tgroup_table.groupName\n\t\t\t\tFROM \t\twcf" . WCF_N . "_contest_jury contest_jury\n\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_user user_table\n\t\t\t\tON\t\t(user_table.userID = contest_jury.userID)\n\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_avatar avatar_table\n\t\t\t\tON\t\t(avatar_table.avatarID = user_table.avatarID)\n\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_group group_table\n\t\t\t\tON\t\t(group_table.groupID = contest_jury.groupID)\n\t\t\t\tWHERE \t\tcontest.juryID = " . intval($juryID) . "\n\t\t\t\tAND\t\t(" . ContestJury::getStateConditions() . ")"; $row = WCF::getDB()->getFirstRow($sql); } DatabaseObject::__construct($row); }
/** * @see DatabaseObjectList::countObjects() */ public function countObjects() { $sql = "SELECT\tCOUNT(*) AS count\n\t\t\tFROM\twcf" . WCF_N . "_contest_jury contest_jury\n\n\t\t\tWHERE (" . ContestJury::getStateConditions() . ")\n\t\t\t" . (!empty($this->sqlConditions) ? "AND " . $this->sqlConditions : ''); $row = WCF::getDB()->getFirstRow($sql); return $row['count']; }