getUserId(); $columns['attemptSuccess'] = new Zend_Db_Expr('(' . TrainingModel::getLastAttemptSelect('t.id', $userId, ['success']) . ')'); $columns['attemptCount'] = new Zend_Db_Expr('(' . TrainingModel::getAttemptCountSelect('t.id', $userId) . ')'); return $columns; } protected function _filter(Zend_Db_Select $select) { $this->_filterEnabled($select); $select->where(Model::getTestSlideExists('t.id')); if (($langFilter = TrainingModel::getLangFilter('t'))) { $select->where(Qs_Db::getWhereSql($langFilter)); } return parent::_filter($select); } protected function _prepareRow(array &$row) { if (array_key_exists('attemptSuccess', $row) && array_key_exists('attemptCount', $row)) { $row['hasAttempt'] = TrainingModel::checkHasAttempt($row['attemptSuccess'] === 'y', (int) $row['attemptCount']); } return parent::_prepareRow($row); } public function getUserId() { if (empty($this->_userId)) { throw new Qs_Exception_EmptyPropertyException($this, '_userId'); } return $this->_userId; } public function setUserId($userId) { $this->_userId = $userId; return $this; } }