Esempio n. 1
0
 /**
  * Get comments select by commentAlias row
  *
  * @param Comments_Model_CommentAlias $commentAlias
  * @param                             $userId
  * @param int                         $key
  * @return Zend_Db_Select
  */
 public function getSelect(Comments_Model_CommentAlias $commentAlias, $userId, $key = 0)
 {
     $users = new Users_Model_User_Table();
     $select = $this->getDbTable()->select(true);
     $select->setIntegrityCheck(false)->joinLeft(array('u' => $users->info('name')), 'userId = u.id', array('login', 'avatar', 'email', 'firstname', 'lastname'))->where('aliasId = ?', $commentAlias->id)->where('comments.status = "' . Comments_Model_Comment::STATUS_ACTIVE . '"' . ' OR (comments.status != "' . Comments_Model_Comment::STATUS_ACTIVE . '"' . ' AND comments.userId = ?)', $userId);
     if ($commentAlias->isKeyRequired()) {
         $select->where('comments.key = ?', $key);
     }
     $select->order('created ASC');
     return $select;
 }
 /**
  * Prepare grid - remove not needed columns
  * 
  * @return void
  */
 protected function _prepareGrid()
 {
     $this->_addCheckBoxColumn();
     $this->_grid->setColumn('login', array('name' => 'Author', 'type' => Core_Grid::TYPE_DATA, 'index' => 'login', 'attribs' => array('width' => '120px')));
     $this->_grid->setColumn('body', array('name' => 'Text', 'type' => Core_Grid::TYPE_DATA, 'index' => 'body', 'formatter' => array($this, 'trimFormatter')));
     $this->_addCreatedColumn();
     $this->_addEditColumn();
     $this->_addDeleteColumn();
     if ($this->_alias && !$this->_alias->isTitleDisplayed()) {
         $this->_grid->removeColumn('title');
     }
 }