Advertisement
Guest User

Untitled

a guest
Sep 14th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.19 KB | None | 0 0
  1. <?php
  2.  
  3. class MOgloszenia extends Zend_Db_Table_Abstract
  4. {
  5.     protected $_name = 'ogloszenia';
  6.  
  7.     public function pobierzOgloszenia($id_kategorii)
  8.     {
  9.         $select = $this->select();
  10.         $select->from($this->_name)
  11.                 ->where('id_kategorii = ?', $id_kategorii);
  12.  
  13.         $query = $this->getAdapter()->query($select);
  14.         $query->setFetchMode(Zend_Db::FETCH_OBJ);
  15.  
  16.         return $query->fetchAll();
  17.     }
  18.  
  19.     public function pobierzOgloszenie($id_ogloszenia)
  20.     {
  21.         return $ogloszenie = $this->find($id_ogloszenia)->current();
  22.     }
  23.  
  24.     public function pobierzPromowaneOgloszenia()
  25.     {
  26.         $select = $this->select();
  27.         $select->from(array('o' => 'ogloszenia'),
  28.                     array('id_ogloszenia', 'tytul', 'data_dodania'))
  29.                 ->join(array('u' => 'uzytkownicy'),
  30.                         'o.id_uzytkownika = u.id_uzytkownika',
  31.                         array())
  32.                 ->where('u.id_typ_konta = ?', 3)
  33.                 ->order('data_dodania DESC');
  34.  
  35.         $query = $this->getAdapter()->query($select);
  36.         $query->setFetchMode(Zend_Db::FETCH_OBJ);
  37.  
  38.         return $query->fetchAll();
  39.     }
  40. }
  41.  
  42.  
  43. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement