File:  [Local Repository] / db / prgsrc / drupal / modules / chgk_db / classes / DbEditor.class.php
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Sat Apr 24 21:45:50 2010 UTC (14 years ago) by roma7
Branches: MAIN
CVS tags: HEAD
Version 2 big update

<?php

class DbEditor {
  private $db;
  private $person;
  private $id;
  public function __construct($row) {
    $this->db = new DbDatabase();
    if (is_object($row)) {
      $this->person = $row;
      $this->setId();
    } else {
      $this->id = $row;
      $this->loadFromDatabase();
    }
  }
  public function getHtmlPage() {
    $res = $this->db->editorToursRes($this->id);
    $this->tours = array();
    while ( $tourRow = db_fetch_object($res) ) {
      $this->tours[] =DbPackage::newFromRow($tourRow);
    }
    $output = '';
    $output .= '<ul>';
    foreach ($this->tours as $t) {
      $output.="<li>".l($t->getFullTitle(),$t->getLink())."</li>\n";
    }
    $output .= '</ul>';

    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;
  }
}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>