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 getList($userId) { try { $ass = new Model_SubGroupUserAssign(); $table = $this->_dbTable; $select = $table->select()->from($table, array('DISTINCT(iAudioCategoryId),vCategoryName'))->where('iSGroupId in ( ' . $ass->getAssignedGroupsIdsString($userId) . ' ) and eStatus = ?', 1)->order('vCategoryName ASC'); return $table->fetchAll($select); } catch (Exception $e) { return false; } }
public function getList($userId) { try { $ass = new Model_SubGroupUserAssign(); $table = $this->_dbTable; $select = $table->select()->from($table, array('DISTINCT(iDirectoryId),vFirstname,vLastname,vEmail,vJobTitle,vPhone'))->where('iSGroupId in(' . $ass->getAssignedGroupsIdsString($userId) . ') and eStatus = 1 ')->order('vFirstname ASC'); return $table->fetchAll($select); } catch (Exception $e) { return false; } }
public function authorize($vUsername, $vPassword) { $auth = Zend_Auth::getInstance(); $authAdapter = new Zend_Auth_Adapter_DbTable(Zend_Db_Table::getDefaultAdapter(), 'User', 'vUserName', 'vPassword', 'eStatus=1'); $authAdapter->setIdentity($vUsername)->setCredential($vPassword); $result = $auth->authenticate($authAdapter); if ($result->isValid()) { $storage = $auth->getStorage(); $storage->write($authAdapter->getResultRowObject(null, array('vPassword'))); $auth = $storage->read(); $detector = new Danil_MobileDetect(); $auth->isMobile = $detector->isMobile() == 1 ? true : false; $auth->showShotcut = true; $subgroupid = new Model_SubGroupUserAssign(); $groupid = $subgroupid->getGroupId($auth->iUserId); $company = new Model_Company($groupid); $auth->vGoogleAPI = $company->vGoogleAPI; $auth->vGoogleAPIvalue = $company->vGoogleAPIvalue; $storage->write($auth); return true; } else { return false; } }
public function getList($userId) { $ass = new Model_SubGroupUserAssign(); return $this->_dbTable->fetchAll('iSGroupId in(' . $ass->getAssignedGroupsIdsString($userId) . ') and eStatus = 1 ', 'vCoursename ASC'); }