public function setOptions(array $options) { $this->_userDetails = array(); foreach ($options as $key => $value) { $detail = new Default_Model_UserDetail(); $detail->setKey($key); $detail->setValue($value); $detail->setId(Zend_Auth::getInstance()->getIdentity()->id); $this->_userDetails[] = $detail; } }
/** * Finds all the user details associated with a user * @param int $id The user_id of the user who's details should be retrieved * @return Default_Model_UserDetail[] Array of user details */ public function findAllById($id) { $resultSet = $this->getDbTable()->fetchAll($this->getDbTable()->select()->where('user_id = ?', $id)); $entries = array(); foreach ($resultSet as $row) { $entry = new Default_Model_UserDetail(); $entry->setId($row->user_id); $entry->setKey($row->key); $entry->setValue($row->value); $entry->setMapper($this); $entries[] = $entry; } return $entries; }
public function registerAction() { $this->view->title = "Register"; $this->view->headTitle($this->view->title, 'PREPEND'); $request = $this->getRequest(); $form = new Default_Form_UserRegister(); if ($this->getRequest()->isPost()) { if ($form->isValid($request->getPost())) { $model = new Default_Model_User($form->getValues()); $model->setUserType("member"); $model->save(); // TODO: Change this so that all user details can be saved in one go $detailModel = new Default_Model_UserDetail(); $detailModel->setKey("nickname"); $detailModel->setValue($form->getValue("nickname")); $detailModel->setId($model->getId()); $detailModel->save(); $detailModel = new Default_Model_UserDetail(); $detailModel->setKey("fullname"); $detailModel->setValue($form->getValue("fullname")); $detailModel->setId($model->getId()); $detailModel->save(); $detailModel = new Default_Model_UserDetail(); $detailModel->setKey("email"); $detailModel->setValue($form->getValue("email")); $detailModel->setId($model->getId()); $detailModel->save(); return $this->_helper->redirector('login'); } } $this->view->form = $form; }