public function viewAction() { if ($this->view->identity === null) { throw new Www_Exception_Auth(); } $id = $this->_getParam('id'); $userDb = new Shared_Db_Table_User(); $user = $userDb->fetchRow(array('id = ?' => $id)); if ($user === null) { throw new Www_Exception_NotFound(); } if ($user->id != $this->view->identity->id) { throw new Www_Exception_Access(); } $this->view->user = $user; // get this user's applications $applicationDb = new Shared_Db_Table_Application(); $select = $applicationDb->select()->setIntegrityCheck(false)->from('application')->joinLeft('template', 'application.id = template.application_id', array('template_count' => 'COUNT(*)'))->where('application.user_id = ?', $user->id)->group('application.id')->order('application.created DESC'); $this->view->applications = $applicationDb->fetchAll($select); }
public function indexAction() { $applicationDb = new Shared_Db_Table_Application(); $select = $applicationDb->select()->from('application')->joinLeft('template', 'application.id = template.application_id', array())->where('template.privacy = ?', 'public')->group('application.id')->order('application.name'); $this->view->applications = $applicationDb->fetchAll($select); }