<?php
/**
* Controller for user realted actions
*
* @uses UserController
* @copyright
* @license
* @version 1.0
* @author Rathinasamy
* @created Sep 7, 2011
*/
class UserController extends Zaah_Controller_Action
{
/**
* Index controller for user home / dashboard page
*
* Created: Sep 8, 2011
*/
public function indexAction()
{
$this->_helper->viewRenderer->setNoRender(true);
echo "User Home Page";
}
/**
* Action to authendicate an user
*
* Created: Sep 8, 2011
*/
public function loginAction(){
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$loginForm = $this->getLoginForm();
$errors = array();
$return = array();
$request = $this->getRequest();
if(!$request->isPost()){
$errors[] = "Invalid request";
}else if(!$loginForm->isValid($request->getPost())){
$errors = array_merge($errors,$this->getFormMessages($loginForm->getMessages()));
}else{
# get the username and password from the form
$username = $loginForm->getValue('username');
$password = $loginForm->getValue('password');
$testuser_id = $request->getPost('testuser_id');
$tm_id = $request->getPost('testteam_id');
$hidTypeID = $request->getPost('hidTypeID');
if(!$this->authendicate($username,$password)){
$errors[] = "Wrong username or password provided. Please try again.";
} else {
if($testuser_id > 0 && $tm_id > 0) {
$otestteamPlayer = new testteamPlayer();
$otestteamPlayer->insertPlayerDet( array("testteam_id" => $tm_id,
"testteam_player_id" => $testuser_id,
"player_role" =>3 ) );
}
//Added By arulKumaran To update the friends and fans request...
if($hidTypeID == 1 || $hidTypeID == 2 || $hidTypeID == 4 || $hidTypeID == 3 ) {
$this->updateFriendsFans();
}
//End of changes...
}
}
//-- return response as JSON
if(count($errors) > 0){
$return['status'] = false;
$return['errors'] = $errors;
}else{
$return['status'] = true;
$return['url'] = $this->view->url(array('controller'=>'mygrid','action'=>'index'));
}
$this->_helper->json($return);
}
/**
* Action to clear alll session instances
*
* Created: Sep 8, 2011
*/
public function logoutAction(){
# clear everything - session is cleared also!
Zend_Auth::getInstance()->clearIdentity();
Zend_Session::destroy();
$this->_redirect('/');
}
/**
* Gets the adapter for authentication against a database table
*
* @return object
*/
protected function getAuthAdapter()
{
$dbAdapter = Zend_Db_Table::getDefaultAdapter();
$authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
$authAdapter->setTableName('test_users')
->setIdentityColumn('testuser_email')
->setCredentialColumn('testuser_password')
->setCredentialTreatment('MD5(?)');
return $authAdapter;
}
/**
* Authendicates a user and stores the session values
*
* Created: Sep 9, 2011
* @param string $userName
* @param string $password
*/
protected function authendicate($userName,$password){
$authAdapter = $this->getAuthAdapter();
# pass to the adapter the submitted username and password
$authAdapter->setIdentity($userName)
->setCredential($password);
$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($authAdapter);
# is the user a valid one?
if($result->isValid()){
# all info about this user from the login table
# ommit only the password, we don't need that
$userInfo = $authAdapter->getResultRowObject(null, 'testuser_password');
//-- select theme name and update the theme name in session
$themeID = 1;
if($userInfo->testuser_them_id > 0){
$themeID = $userInfo->testuser_them_id;
}
$oTheme = new Theme();
$aTheme = $oTheme->getByID($themeID);
$userInfo->theme_name = $aTheme->them_folder_name;
# the default storage is a session with namespace Zend_Auth
$authStorage = $auth->getStorage();
$authStorage->write($userInfo);
//# hide / show welcome panel
$panelFlag=$userInfo->testuser_panel_flag;
$this->setSession('panelFlag',$panelFlag);
return true;
}else{
return false;
}
}
/**
* Create and return the login form
*
* @return object
*/
protected function getLoginForm(){
return new Storefront_Form_LoginForm();
}
/**
* Action to show the login form
*
* Created: Sep 7, 2011
*/
public function loginFormAction(){
//-- disable layout and view renderer
$this->_helper->layout()->disableLayout();
$request = $this->getRequest();
$testuser_id = $request->getPost('testuser_id') > 0 ? $request->getPost('testuser_id') :0;
$tm_id = $request->getParam('testteam_id') > 0 ? $request->getParam('testteam_id') :0;
$loginForm = $this->getLoginForm();
$this->view->form = $loginForm;
$this->view->testuser_id = $testuser_id ;
$this->view->testteam_id = $tm_id;
}
/**
* Shows the registration form page
*
* Created: Sep 8, 2011
*/
public function registerFormAction()
{
//-- set registration form ttile
$this->view->title = "Signup";
$request = $this->getRequest();
$testuser_id = $request->getParam('uid')>0 ? $request->getParam('uid') :0;
$tm_id = $request->getParam('tid')>0 ? $request->getParam('tid') :0;
//Added by ArulKumaran...
$this->view->friendId = (int)$request->getParam('friendId');
$this->view->testteamId = (int)$request->getParam('testteamId');
$this->view->hidTypeID = (int)$request->getParam('hidTypeID');
//End of changes...
$aUserDet = array();
//-- redirerct to index page if user already
//-- signed in
if(Zend_Auth::getInstance()->hasIdentity())
{
$this->_redirect('/');
}else{
if($testuser_id>0)
{
$oAccount = new Account();
$aRecordSet = $oAccount->userDet(array('testuser_id'=>$testuser_id));
$vCount = count($aRecordSet);
if($vCount>0)
{
$aUserDet = $aRecordSet[0];
}
}
$form = new Storefront_Form_RegistrationForm($testuser_id,$aUserDet);
$this->view->form = $form;
$this->view->testuser_id = $testuser_id;
$this->view->testteam_id = $tm_id;
}
}
public function forgotFormAction(){
//-- disable layout and view renderer
$this->_helper->layout()->disableLayout();
$this->view->form = new Storefront_Form_ForgotForm();
}
/**
* Action to authendication an email and send the new password
*
* Created: Sep 8, 2011
*/
public function forgotAction(){
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$form = new Storefront_Form_ForgotForm();
$errors = array();
$return = array();
$request = $this->getRequest();
if(!$request->isPost()){
$errors[] = "Invalid request";
}else if(!$form->isValid($request->getPost())){
$errors = array_merge($errors,$this->getFormMessages($form->getMessages()));
}else{
//-- check the email is valid
$oUser = new User();
$user = $oUser->getRowByEmail($form->getValue('email'));
if($user->testuser_id <= 0){
$errors[] = "Please check the email address";
}else{
//-- genertae new password and update the
//-- existing forgot password
$udateStatus = $oUser->updateRandomPassword($user->testuser_id);
if($udateStatus !== false){
//-- call sending the email operations
$oEmail = new Email();
$oEmail->setMail(
array(
'action'=>'Forgot_Password',
'to'=>$user->testuser_email,
'toname'=>$user->testuser_fname." ".$user->testuser_lname,
'new_password'=>$oUser->getGeneratedRandomPassword()
));
}else{
$errors[] = "Problem on updating password, please try again later";
}
}
}
//-- return response as JSON
if(count($errors) > 0){
$return['status'] = false;
$return['errors'] = $errors;
}else{
$return['status'] = true;
$return['message'] = "Your password has been mailed to you";
}
$this->_helper->json($return);
}
/**
* Action to check an email email availability
*
* Created: Sep 9, 2011
*/
public function availAction(){
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$return = array();
$request = $this->getRequest();
//-- first validate the request
if(!$request->isPost()){
$errors[] = "Invalid request";
}else if($request->getPost('email') == ""){
$errors[] = "Email cannot be empty";
}
//-- send error message
if(count($errors) > 0){
$return['status'] = false;
$return['errors'] = $errors;
}else{
$oUser = new User();
$user = $oUser->checkRowByEmail($request->getPost('email'));
if($user->testuser_id <= 0){
$return['status'] = true;
}else{
$return['status'] = false;
}
}
//-- send respobnse as json
$this->_helper->json($return);
}
/**
* Action to register an user
*
* Created: Sep 8, 2011
*/
public function registerAction() {
/*** Disable layout and view renderer ***/
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
//-- initialize required variables
$form = new Storefront_Form_RegistrationForm();
$errors = array();
$return = array();
$request = $this->getRequest();
$retURL = "";
//-- calculate user age
$row = $request->getPost('user');
$testuser_id = $request->getPost('testuser_id');
$tm_id = $request->getPost('testteam_id');
$birthDate = split('-',$row['testuser_dob']);
$begin = array ('year' => $birthDate[0], 'month' =>$birthDate[1], 'day' =>$birthDate[2]);
$end = array ('year' => date("Y"), 'month' => date("m"), 'day' => date("d"));
$foo = Zaah_Date::date_difference($begin,$end);
//-- validate the request
if(!$request->isPost()){
$errors[] = "Invalid request";
}else if(!is_array($foo) || $foo === false ){
$errors[] = "Invalid date of birth provided";
}else if($foo['years'] < 13){ //-- validate the age
$errors[] = "Sorry, you are ineligible to sign up for PlayerGrid.com account.";
$retURL = $this->view->url(array('controller'=>'user','action'=>'register-child'));
}else if(!$form->isValid($request->getPost())){
$errors = array_merge($errors,$this->getFormMessages($form->getMessages()));
}else{
//-- store the user information
$oUser = new User();
$formValues = $form->getValues();
$status = $oUser->registerUser($formValues['user'],$testuser_id,$tm_id);
if($status){
//-- save new session and redirect the user
//-- to the user home page
# clear everything - session is cleared also!
Zend_Auth::getInstance()->clearIdentity();
//-- set new session values
$this->authendicate($form->getElement('testuser_email')->getValue(),$form->getElement('testuser_password')->getValue());
//Added By arulKumaran To update the friends and fans request...
$hidTypeID = $request->getPost('hidTypeID');
if($hidTypeID == 1 || $hidTypeID == 2 || $hidTypeID == 4 || $hidTypeID == 3 ) {
$this->updateFriendsFans();
}
//End of changes...
$retURL = $this->view->url(array('controller'=>'mygrid','action'=>'index'));
}else{
$errors[] = $oUser->getError();
}
}
//-- return response as JSON
if(count($errors) > 0){
$return['status'] = false;
$return['errors'] = $errors;
$return['retURL'] = $retURL;
}else{
$return['status'] = true;
$return['retURL'] = $retURL;
$return['message'] = "Your are registered with this site successfully";
}
$this->_helper->json($return);
}
function welcomePanelAction(){
/*** Disable layout and view renderer ***/
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$panelFlag = $this->_request->getPost('panelFlag');
$oUser = new User();
$this->setSession('panelFlag',$panelFlag);
echo $this->getSession('panelFlag');
if($panelFlag != 2){
echo $this->getSession('panelFlag');
$oUser->hideWelcomePanel($this->getUser()->testuser_id,$panelFlag);
}
else{
$oUser->hideWelcomePanel($this->getUser()->testuser_id,$panelFlag);
$this->setSession('panelFlag',$panelFlag);
}
}
function formLoginAction() {
if(Zend_Auth::getInstance()->hasIdentity())
{
$this->_redirect('/');
}
$vPostVar = $this->_request->getPost();
$this->view->friendId = $vPostVar['friendId'];
$this->view->testteamId = $vPostVar['testteamId'];
$this->view->hidTypeID = $vPostVar['hidTypeID'];
$this->view->hidURL = $vPostVar['hidURL'];
//-- registration form section
$testuser_id = $this->getRequest()->getParam('uid')>0 ? $request->getParam('uid') :0;
$tm_id = $this->getRequest()->getParam('tid')>0 ? $request->getParam('tid') :0;
if($testuser_id>0)
{
$oAccount = new Account();
$aRecordSet = $oAccount->userDet(array('testuser_id'=>$testuser_id));
$vCount = count($aRecordSet);
if($vCount>0)
{
$aUserDet = $aRecordSet[0];
}
}
$form = new Storefront_Form_RegistrationForm($testuser_id,$aUserDet);
$this->view->form = $form;
$this->view->testuser_id = $testuser_id;
$this->view->testteam_id = $tm_id;
}
function updateFriendsFans() {
$errors = array();
$return = array();
$request = $this->getRequest();
$friendId = $request->getPost('friendId');
$testteamId = $request->getPost('testteamId');
$hidTypeID = $request->getPost('hidTypeID');
$hidUrl = $request->getPost('hidURL');
if($hidTypeID == 1 || $hidTypeID == 2 || $hidTypeID == 4 || $hidTypeID == 3 ) {
$vSessionUser = $this->getUser();
$ses_testuser_id = $vSessionUser->testuser_id;
$ses_testuser_name = $vSessionUser->testuser_fname.' '.$vSessionUser->testuser_lname;
$oMyGrid = new Mygrid();
$oMyGrid->updatefriensFanDet( array(
'childId' => $friendId,
'typeId' => $hidTypeID,
'testteam_id' => $testteamId,
'testuser_id' => $ses_testuser_id,
'ses_testuser_name' => $ses_testuser_name
) );
$return['status'] = true;
if ($hidTypeID == 3 )
$return['url'] = $this->view->urls()->httpWebPath().$hidUrl;
else
$return['url'] = $this->view->url(array('controller'=>'mygrid','action'=>'child-grid'));
$return['childId'] = $friendId;
$return['typeId'] = $hidTypeID;
$return['message'] = "Your are registered with this site successfully";
$return['msglogin'] = "Successfully login please waite...";
$this->_helper->json($return);
exit;
}
}
}
?>
/**
* Controller for user realted actions
*
* @uses UserController
* @copyright
* @license
* @version 1.0
* @author Rathinasamy
* @created Sep 7, 2011
*/
class UserController extends Zaah_Controller_Action
{
/**
* Index controller for user home / dashboard page
*
* Created: Sep 8, 2011
*/
public function indexAction()
{
$this->_helper->viewRenderer->setNoRender(true);
echo "User Home Page";
}
/**
* Action to authendicate an user
*
* Created: Sep 8, 2011
*/
public function loginAction(){
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$loginForm = $this->getLoginForm();
$errors = array();
$return = array();
$request = $this->getRequest();
if(!$request->isPost()){
$errors[] = "Invalid request";
}else if(!$loginForm->isValid($request->getPost())){
$errors = array_merge($errors,$this->getFormMessages($loginForm->getMessages()));
}else{
# get the username and password from the form
$username = $loginForm->getValue('username');
$password = $loginForm->getValue('password');
$testuser_id = $request->getPost('testuser_id');
$tm_id = $request->getPost('testteam_id');
$hidTypeID = $request->getPost('hidTypeID');
if(!$this->authendicate($username,$password)){
$errors[] = "Wrong username or password provided. Please try again.";
} else {
if($testuser_id > 0 && $tm_id > 0) {
$otestteamPlayer = new testteamPlayer();
$otestteamPlayer->insertPlayerDet( array("testteam_id" => $tm_id,
"testteam_player_id" => $testuser_id,
"player_role" =>3 ) );
}
//Added By arulKumaran To update the friends and fans request...
if($hidTypeID == 1 || $hidTypeID == 2 || $hidTypeID == 4 || $hidTypeID == 3 ) {
$this->updateFriendsFans();
}
//End of changes...
}
}
//-- return response as JSON
if(count($errors) > 0){
$return['status'] = false;
$return['errors'] = $errors;
}else{
$return['status'] = true;
$return['url'] = $this->view->url(array('controller'=>'mygrid','action'=>'index'));
}
$this->_helper->json($return);
}
/**
* Action to clear alll session instances
*
* Created: Sep 8, 2011
*/
public function logoutAction(){
# clear everything - session is cleared also!
Zend_Auth::getInstance()->clearIdentity();
Zend_Session::destroy();
$this->_redirect('/');
}
/**
* Gets the adapter for authentication against a database table
*
* @return object
*/
protected function getAuthAdapter()
{
$dbAdapter = Zend_Db_Table::getDefaultAdapter();
$authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
$authAdapter->setTableName('test_users')
->setIdentityColumn('testuser_email')
->setCredentialColumn('testuser_password')
->setCredentialTreatment('MD5(?)');
return $authAdapter;
}
/**
* Authendicates a user and stores the session values
*
* Created: Sep 9, 2011
* @param string $userName
* @param string $password
*/
protected function authendicate($userName,$password){
$authAdapter = $this->getAuthAdapter();
# pass to the adapter the submitted username and password
$authAdapter->setIdentity($userName)
->setCredential($password);
$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($authAdapter);
# is the user a valid one?
if($result->isValid()){
# all info about this user from the login table
# ommit only the password, we don't need that
$userInfo = $authAdapter->getResultRowObject(null, 'testuser_password');
//-- select theme name and update the theme name in session
$themeID = 1;
if($userInfo->testuser_them_id > 0){
$themeID = $userInfo->testuser_them_id;
}
$oTheme = new Theme();
$aTheme = $oTheme->getByID($themeID);
$userInfo->theme_name = $aTheme->them_folder_name;
# the default storage is a session with namespace Zend_Auth
$authStorage = $auth->getStorage();
$authStorage->write($userInfo);
//# hide / show welcome panel
$panelFlag=$userInfo->testuser_panel_flag;
$this->setSession('panelFlag',$panelFlag);
return true;
}else{
return false;
}
}
/**
* Create and return the login form
*
* @return object
*/
protected function getLoginForm(){
return new Storefront_Form_LoginForm();
}
/**
* Action to show the login form
*
* Created: Sep 7, 2011
*/
public function loginFormAction(){
//-- disable layout and view renderer
$this->_helper->layout()->disableLayout();
$request = $this->getRequest();
$testuser_id = $request->getPost('testuser_id') > 0 ? $request->getPost('testuser_id') :0;
$tm_id = $request->getParam('testteam_id') > 0 ? $request->getParam('testteam_id') :0;
$loginForm = $this->getLoginForm();
$this->view->form = $loginForm;
$this->view->testuser_id = $testuser_id ;
$this->view->testteam_id = $tm_id;
}
/**
* Shows the registration form page
*
* Created: Sep 8, 2011
*/
public function registerFormAction()
{
//-- set registration form ttile
$this->view->title = "Signup";
$request = $this->getRequest();
$testuser_id = $request->getParam('uid')>0 ? $request->getParam('uid') :0;
$tm_id = $request->getParam('tid')>0 ? $request->getParam('tid') :0;
//Added by ArulKumaran...
$this->view->friendId = (int)$request->getParam('friendId');
$this->view->testteamId = (int)$request->getParam('testteamId');
$this->view->hidTypeID = (int)$request->getParam('hidTypeID');
//End of changes...
$aUserDet = array();
//-- redirerct to index page if user already
//-- signed in
if(Zend_Auth::getInstance()->hasIdentity())
{
$this->_redirect('/');
}else{
if($testuser_id>0)
{
$oAccount = new Account();
$aRecordSet = $oAccount->userDet(array('testuser_id'=>$testuser_id));
$vCount = count($aRecordSet);
if($vCount>0)
{
$aUserDet = $aRecordSet[0];
}
}
$form = new Storefront_Form_RegistrationForm($testuser_id,$aUserDet);
$this->view->form = $form;
$this->view->testuser_id = $testuser_id;
$this->view->testteam_id = $tm_id;
}
}
public function forgotFormAction(){
//-- disable layout and view renderer
$this->_helper->layout()->disableLayout();
$this->view->form = new Storefront_Form_ForgotForm();
}
/**
* Action to authendication an email and send the new password
*
* Created: Sep 8, 2011
*/
public function forgotAction(){
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$form = new Storefront_Form_ForgotForm();
$errors = array();
$return = array();
$request = $this->getRequest();
if(!$request->isPost()){
$errors[] = "Invalid request";
}else if(!$form->isValid($request->getPost())){
$errors = array_merge($errors,$this->getFormMessages($form->getMessages()));
}else{
//-- check the email is valid
$oUser = new User();
$user = $oUser->getRowByEmail($form->getValue('email'));
if($user->testuser_id <= 0){
$errors[] = "Please check the email address";
}else{
//-- genertae new password and update the
//-- existing forgot password
$udateStatus = $oUser->updateRandomPassword($user->testuser_id);
if($udateStatus !== false){
//-- call sending the email operations
$oEmail = new Email();
$oEmail->setMail(
array(
'action'=>'Forgot_Password',
'to'=>$user->testuser_email,
'toname'=>$user->testuser_fname." ".$user->testuser_lname,
'new_password'=>$oUser->getGeneratedRandomPassword()
));
}else{
$errors[] = "Problem on updating password, please try again later";
}
}
}
//-- return response as JSON
if(count($errors) > 0){
$return['status'] = false;
$return['errors'] = $errors;
}else{
$return['status'] = true;
$return['message'] = "Your password has been mailed to you";
}
$this->_helper->json($return);
}
/**
* Action to check an email email availability
*
* Created: Sep 9, 2011
*/
public function availAction(){
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$return = array();
$request = $this->getRequest();
//-- first validate the request
if(!$request->isPost()){
$errors[] = "Invalid request";
}else if($request->getPost('email') == ""){
$errors[] = "Email cannot be empty";
}
//-- send error message
if(count($errors) > 0){
$return['status'] = false;
$return['errors'] = $errors;
}else{
$oUser = new User();
$user = $oUser->checkRowByEmail($request->getPost('email'));
if($user->testuser_id <= 0){
$return['status'] = true;
}else{
$return['status'] = false;
}
}
//-- send respobnse as json
$this->_helper->json($return);
}
/**
* Action to register an user
*
* Created: Sep 8, 2011
*/
public function registerAction() {
/*** Disable layout and view renderer ***/
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
//-- initialize required variables
$form = new Storefront_Form_RegistrationForm();
$errors = array();
$return = array();
$request = $this->getRequest();
$retURL = "";
//-- calculate user age
$row = $request->getPost('user');
$testuser_id = $request->getPost('testuser_id');
$tm_id = $request->getPost('testteam_id');
$birthDate = split('-',$row['testuser_dob']);
$begin = array ('year' => $birthDate[0], 'month' =>$birthDate[1], 'day' =>$birthDate[2]);
$end = array ('year' => date("Y"), 'month' => date("m"), 'day' => date("d"));
$foo = Zaah_Date::date_difference($begin,$end);
//-- validate the request
if(!$request->isPost()){
$errors[] = "Invalid request";
}else if(!is_array($foo) || $foo === false ){
$errors[] = "Invalid date of birth provided";
}else if($foo['years'] < 13){ //-- validate the age
$errors[] = "Sorry, you are ineligible to sign up for PlayerGrid.com account.";
$retURL = $this->view->url(array('controller'=>'user','action'=>'register-child'));
}else if(!$form->isValid($request->getPost())){
$errors = array_merge($errors,$this->getFormMessages($form->getMessages()));
}else{
//-- store the user information
$oUser = new User();
$formValues = $form->getValues();
$status = $oUser->registerUser($formValues['user'],$testuser_id,$tm_id);
if($status){
//-- save new session and redirect the user
//-- to the user home page
# clear everything - session is cleared also!
Zend_Auth::getInstance()->clearIdentity();
//-- set new session values
$this->authendicate($form->getElement('testuser_email')->getValue(),$form->getElement('testuser_password')->getValue());
//Added By arulKumaran To update the friends and fans request...
$hidTypeID = $request->getPost('hidTypeID');
if($hidTypeID == 1 || $hidTypeID == 2 || $hidTypeID == 4 || $hidTypeID == 3 ) {
$this->updateFriendsFans();
}
//End of changes...
$retURL = $this->view->url(array('controller'=>'mygrid','action'=>'index'));
}else{
$errors[] = $oUser->getError();
}
}
//-- return response as JSON
if(count($errors) > 0){
$return['status'] = false;
$return['errors'] = $errors;
$return['retURL'] = $retURL;
}else{
$return['status'] = true;
$return['retURL'] = $retURL;
$return['message'] = "Your are registered with this site successfully";
}
$this->_helper->json($return);
}
function welcomePanelAction(){
/*** Disable layout and view renderer ***/
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$panelFlag = $this->_request->getPost('panelFlag');
$oUser = new User();
$this->setSession('panelFlag',$panelFlag);
echo $this->getSession('panelFlag');
if($panelFlag != 2){
echo $this->getSession('panelFlag');
$oUser->hideWelcomePanel($this->getUser()->testuser_id,$panelFlag);
}
else{
$oUser->hideWelcomePanel($this->getUser()->testuser_id,$panelFlag);
$this->setSession('panelFlag',$panelFlag);
}
}
function formLoginAction() {
if(Zend_Auth::getInstance()->hasIdentity())
{
$this->_redirect('/');
}
$vPostVar = $this->_request->getPost();
$this->view->friendId = $vPostVar['friendId'];
$this->view->testteamId = $vPostVar['testteamId'];
$this->view->hidTypeID = $vPostVar['hidTypeID'];
$this->view->hidURL = $vPostVar['hidURL'];
//-- registration form section
$testuser_id = $this->getRequest()->getParam('uid')>0 ? $request->getParam('uid') :0;
$tm_id = $this->getRequest()->getParam('tid')>0 ? $request->getParam('tid') :0;
if($testuser_id>0)
{
$oAccount = new Account();
$aRecordSet = $oAccount->userDet(array('testuser_id'=>$testuser_id));
$vCount = count($aRecordSet);
if($vCount>0)
{
$aUserDet = $aRecordSet[0];
}
}
$form = new Storefront_Form_RegistrationForm($testuser_id,$aUserDet);
$this->view->form = $form;
$this->view->testuser_id = $testuser_id;
$this->view->testteam_id = $tm_id;
}
function updateFriendsFans() {
$errors = array();
$return = array();
$request = $this->getRequest();
$friendId = $request->getPost('friendId');
$testteamId = $request->getPost('testteamId');
$hidTypeID = $request->getPost('hidTypeID');
$hidUrl = $request->getPost('hidURL');
if($hidTypeID == 1 || $hidTypeID == 2 || $hidTypeID == 4 || $hidTypeID == 3 ) {
$vSessionUser = $this->getUser();
$ses_testuser_id = $vSessionUser->testuser_id;
$ses_testuser_name = $vSessionUser->testuser_fname.' '.$vSessionUser->testuser_lname;
$oMyGrid = new Mygrid();
$oMyGrid->updatefriensFanDet( array(
'childId' => $friendId,
'typeId' => $hidTypeID,
'testteam_id' => $testteamId,
'testuser_id' => $ses_testuser_id,
'ses_testuser_name' => $ses_testuser_name
) );
$return['status'] = true;
if ($hidTypeID == 3 )
$return['url'] = $this->view->urls()->httpWebPath().$hidUrl;
else
$return['url'] = $this->view->url(array('controller'=>'mygrid','action'=>'child-grid'));
$return['childId'] = $friendId;
$return['typeId'] = $hidTypeID;
$return['message'] = "Your are registered with this site successfully";
$return['msglogin'] = "Successfully login please waite...";
$this->_helper->json($return);
exit;
}
}
}
?>
No comments:
Post a Comment