Ejemplo n.º 1
0
 private function loadTours()
 {
     $res = $this->db->editorToursRes($this->id);
     $this->tours = array();
     while ($tourRow = db_fetch_object($res)) {
         $this->tours[] = DbPackage::newFromRow($tourRow);
     }
 }
Ejemplo 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;
 }
Ejemplo 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;
 }
Ejemplo n.º 4
0
 public function loadChildren()
 {
     $this->children = array();
     $res = $this->db->getChildrenRes($this->getDbId());
     while ($row = $this->db->fetch_row($res)) {
         $this->children[] = DbPackage::newFromRow($row, $this);
     }
 }
Ejemplo n.º 5
0
 public function getTour()
 {
     if (!$this->tour) {
         $row = $this->db->getTournament($this->question->ParentId);
         $this->tour = DbPackage::newFromRow($row);
     }
     return $this->tour;
 }
Ejemplo n.º 6
0
 protected function makeTournamentsResults()
 {
     $factory = new DbQuestionFactory();
     $this->results = array();
     $words = $this->words;
     #      $s = "~([^a-zA-Zа-яА-Я_0-9])(".implode('|', $words).")~iu";
     while ($row = db_fetch_object($this->mysqlRes)) {
         $t = DbPackage::newFromRow($row);
         #        $title = preg_replace($s, '$1<strong class="highlight">$2</strong>', $t->getTitle());
         $title = $t->getTitle();
         $date = $t->getPlayedAtDate();
         $snippet = '';
         $snippetArray = array();
         if ($date) {
             $snippetArray[] = '<strong>Дата:</strong> ' . $date;
         }
         $editor = $t->getEditorHtml();
         if ($editor) {
             $snippetArray[] = "<p>{$editor}</p>";
         }
         $snippet = implode('<br/>', $snippetArray);
         $this->results[] = array('link' => url($t->getLink()), 'title' => $title, 'snippet' => "<br/>{$snippet}");
     }
 }