public function signupAction() { $this->view->title = "User Registration."; $this->view->headTitle($this->view->title, 'PREPEND'); $form = new Form_Signup(); if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getPost())) { $formvalues = $form->getValues(); $user = new Model_User(); $db = $user->getAdapter(); $db->beginTransaction(); try { $user->fill($formvalues); $user->eStatus = 1; $user->eAlerts = 1; $user->eRights = 1; $user->dRegDate = time(); // $user->sendActivationEmail(); $user->save(); $group = new Model_SubGroup(); $group->find('vGroupCodeId', $formvalues['iSGroupCode']); $assign = new Model_SubGroupUserAssign(); $assign->iSGroupId = $group->iSGroupId; $assign->iUserId = $user->iUserId; $assign->save(); $db->commit(); } catch (Exception $e) { $db->rollBack(); echo $e->getMessage(); } $this->_helper->redirector('login'); } } $this->view->form = $form; }
public function getAssignedGroupsIds($userid) { $rows = $this->_dbTable->fetchAll("iUserId = '" . $userid . "'"); foreach ($rows as $row) { $result[] = $row->iSGroupId; } $sgid = new Model_SubGroup($rows[0]->iSGroupId); $id = $sgid->iCompanyId; $sgid->findExact(array('iCompanyId', 'iIsDefault'), array($id, 1)); $result[] = $sgid->iSGroupId; return $result; }