Abstract.php

00001 <?php
00012 abstract class Dsao_Model_Abstract
00013 {
00017   private $_log = null;
00018 
00022   private $_tableNameDefault = '';
00023 
00027   private $_translate = null;
00028 
00034   public function __construct()
00035   {
00036     // Falls Controller bereits initialisiert
00037     if (Dsao_Registry::isRegistered('user'))
00038     {
00039       $this->_log = Dsao_Registry::get('log');
00040       $this->_translate = Dsao_Registry::get('translate');
00041     }
00042 
00043     $this->_init();
00044   }
00045 
00054   protected function _getObject($class)
00055   {
00056     return Dsao_Registry::get($class);
00057   }
00058 
00067   protected function _getTable($tableName = null)
00068   {
00069     return Dsao_Registry::getTable
00070       ((null === $tableName ? $this->_tableNameDefault : $tableName));
00071   }
00072 
00081   protected function _init()
00082   {}
00083 
00093   protected function _setDefaultTable($tableName)
00094   {
00095     $this->_tableNameDefault = $tableName;
00096 
00097     return $this;
00098   }
00099 
00109   public final static function camelize($word, $lcfirst = false)
00110   {
00111     $filter = new Zend_Filter_Word_UnderscoreToCamelCase();
00112 
00113     $word = $filter->filter($word);
00114 
00115     return ($lcfirst ? lcfirst($word) : $word);
00116   }
00117 
00123   public final function getLog()
00124   {
00125     return $this->_log;
00126   }
00127 
00133   public final function getTranslate()
00134   {
00135     return $this->_translate;
00136   }
00137 
00147   public function getModuleNavigation()
00148   {
00149     return array();
00150   }
00151 
00158   public final function getUnreadScrolls($idUser)
00159   {
00160     // Query bauen
00161     $scrollsUnread = $this->_getTable('scroll_header')->select(true)
00162       ->reset(Zend_Db_Select::COLUMNS)
00163       ->columns(new Zend_Db_Expr('COUNT(id) as scrollsUnread'))
00164       ->where('idRecipient = ? && deleted != 2', $idUser)
00165       ->where('`read` = 0')->fetchRow();
00166 
00167     return $scrollsUnread->scrollsUnread;
00168   }
00169 
00181   public final static function underscore($word, $lowercase = true)
00182   {
00183     // Filter
00184     $filter = new Zend_Filter_Word_CamelCaseToUnderscore();
00185 
00186     $result = $filter->filter($word);
00187 
00188     return ($lowercase ? strtolower($result) : $result);
00189   }
00190 }

Erzeugt am Fri Sep 18 19:04:11 2009 für DSA online - Morgendaemmerung von  doxygen 1.5.7.1