public function getResults($sstr = '')
 {
     $db = new DbDatabase();
     $this->setNoImages();
     $this->searchString = $sstr;
     $this->doSearch($sstr, $this->searchFields, $this->all, $this->questionTypes);
     if (!$this->success) {
         return array();
     }
     if ($this->random) {
         $this->mysqlRes = $db->getSphinxSearchRes($this->ids);
         $this->makeRandomResults();
     } elseif ($this->index == $this->index_questions) {
         $this->mysqlRes = $db->getSphinxSearchRes($this->ids);
         $this->makeResults();
     } elseif ($this->index == $this->index_unsorted) {
         $this->makeUnsortedResults();
     } else {
         $this->mysqlRes = $db->getTournamentsByIdsRes($this->ids);
         $this->makeTournamentsResults();
     }
     if (!$this->random && !$this->noPager) {
         $this->setPager();
     }
     return $this->results;
 }
Esempio n. 2
0
 private function getPublishedPackage()
 {
     if (NULL === $this->publishedPackage) {
         $db = new DbDatabase();
         $t = $db->getTournamentByTextId($this->getPublishedTextId());
         if ($t) {
             $this->publishedPackage = DbPackage::newFromRow($t);
         } else {
             $this->publishedPackage = FALSE;
         }
     }
     return $this->publishedPackage;
 }
Esempio n. 3
0
 function getDayNumbers()
 {
     if (!isset($this->dayNumbers)) {
         $instance = new DbDatabase();
         $res = $instance->getLastTournamentsRes(50000);
         for ($date = $this->getFirstDate(); $date <= $this->getLastDate(); $date = date('Y-m-d', strtotime($date . ' +1 days'))) {
             $this->dayNumbers[$date] = 0;
         }
         while ($row = $instance->fetch_row($res)) {
             $package = DbPackage::newFromRow($row);
             $this->dayNumbers[$package->getCreatedAt()] += $package->getQuestionsNumber();
         }
     }
     return $this->dayNumbers;
 }
Esempio n. 4
0
 public function getEditors()
 {
     if ($this->editors === null) {
         $db = new DbDatabase();
         $this->editors = array();
         $res = $db->getPersonsByTournamentIdRes($this->getDbId());
         if ($res) {
             while ($row = $res->fetch_object()) {
                 $this->editors[] = new DbPerson($row);
             }
         }
     }
     return $this->editors;
 }
Esempio n. 5
0
 public function getAuthors()
 {
     if ($this->authors === null) {
         $db = new DbDatabase();
         $this->authors = array();
         $res = $db->getPersonsByQuestionIdRes($this->getId());
         while ($row = $res->fetch_object()) {
             $this->authors[] = new DbPerson($row);
         }
     }
     return $this->authors;
 }