db = new DbDatabase(); if (is_object($row)) { $this->person = $row; $this->setId(); } else { $this->id = $row; $this->loadFromDatabase(); } } private function loadTours() { $res = $this->db->editorToursRes($this->id); $this->tours = array(); while ( $tourRow = db_fetch_object($res) ) { $this->tours[] =DbPackage::newFromRow($tourRow); } } private function sortByYear() { foreach ($this->tours as $tour) { $this->years[$tour->getYear()][] = $tour; } } public function getHtmlPage() { $this->loadTours(); $this->sortByYear(); $output = ''; foreach ($this->years as $year=>$tours) { $output .= "

".$year."

\n"; $output .= ''; } return $output; } private function setId() { $this->id = $this->person->CharId; } private function loadFromDatabase() { $this->person = $this->db->getPersonById($this->id); } public function newFromRow($row) { return new self($row); } public function getLink() { return l($this->getFullName(),'editors/'.$this->id); } public function getFullName() { return $this->person->Name. " ". $this->person->Surname; } public function getBreadcrumb() { $breadcrumb = array( l('Редакторы','editors') ); return $breadcrumb; } }