public function registerJobSeeker($data) { $uDao = new UsersDao(); $user = new stdClass(); $user->email = $data->email; $user->password = md5($data->password); $user->firstname = $data->firstname; $user->lastname = $data->lastname; $user->fb_user_id = $data->fb_user_id; $user->birthday = $data->birthday; $user->gender = $data->gender; $user->location_name = $data->location_name; $user->location_id = $data->location_id; $user->country = $data->country; $user->locale = $data->locale; $user->date_created = Calendar::getSQLDateTime(); $response = new stdClass(); $response->success = false; $response->message = "Failed to register"; if ($uDao->insert($user)) { $response->success = true; $response->message = "Registration Complete"; } return $response; }
public static function getInstance() { if (!self::$instance instanceof self) { self::$instance = new self(); } return self::$instance; }
public function actionDetailitem($type, $id) { if (UsersDao::getInstance()->validToken()) { $this->getDataAndRenderDetail($type, $id); } else { Yii::app()->runController('Site/login'); } }
/** * Get {@link Foc} by the identifier 'id' found in the URL. * @return Foc {@link Foc} instance * @throws NotFoundException if the param or {@link Foc} instance is not found */ public static function getUsersByGetId() { $id = null; try { $id = self::getUrlParam('id'); } catch (Exception $ex) { throw new NotFoundException('No Foc identifier provided.'); } if (!is_numeric($id)) { throw new NotFoundException('Invalid Users identifier provided.'); } $dao = new UsersDao(); $Users = $dao->findById($id); if ($Users === null) { throw new NotFoundException('Unknown Users identifier provided.'); } return $Users; }
/** * Valida la url para activar la cuenta. * @param string $activationCode */ public function actionConfirmation($activationCode) { //* try { UsersDao::getInstance()->validActivationCodeInDataBase($activationCode); UsersDao::getInstance()->activateAccount($activationCode); $message = Constants::ACCOUNT_ACTIVE; } catch (Exception $e) { $message = $e->getMessage(); } $this->render('confirmation', array('message' => $message)); }
public static function destroySession() { $id = Yii::app()->session['id']; unset(Yii::app()->session['userid']); # Remove the session unset(Yii::app()->session['token']); # Remove the session Yii::app()->session->clear(); Yii::app()->session->destroy(); UsersDao::cleanAuthTokenForUserWithId($id); Yii::app()->runController('site/login'); //$this->redirect('index.php?r=site/login'); }
public function actionEditUser($iduser) { if (UsersDao::getInstance()->validToken() && Yii::app()->session['isadmin']) { $this->layout = "tplLogin"; $message = ''; $model = new EditUserForm(); try { $userData = UsersDao::getInstance()->getUserDataById($iduser); $model->email = $userData['email']; $model->idusers = $userData['idusers']; $model->codes_idcodes = $userData['codes_idcodes']; $model->name = $userData['name']; $model->lastname = $userData['lastname']; $model->password = $userData['password']; $model->activation_code = $userData['activation_code']; $model->account_active = $userData['account_active']; $model->activation_date = $userData['activation_date']; $model->authToken = $userData['authToken']; $model->change_password_code = $userData['change_password_code']; $model->lastlogin = $userData['lastlogin']; $model->createdon = $userData['createdon']; $model->isadmin = $userData['isadmin']; $model->duration = $userData['duration']; if (isset($_POST['EditUserForm'])) { $model->attributes = $_POST['EditUserForm']; if ($model->validate()) { UsersDao::getInstance()->updateUserData($model); Yii::app()->user->setFlash('enterCodes', Constants::SUCCESS_USER_DATA_UPDATE); $this->refresh(); } } } catch (Exception $e) { Yii::app()->user->setFlash('enterCodes', $e->getMessage()); $this->refresh(); } $this->render('editUser', array('model' => $model, "errorSummary" => $message)); } else { //Yii::log("Entro a login y fue false","warning"); //Yii::app()->runController('Site/login'); UtilsFunctions::destroySession(); } }
/** * Finaliza la sesion de los usuarios al hacer click en Cerrar sesion */ public function actionClose() { $sleep = Yii::app()->session['email']; $id = Yii::app()->session['id']; //Yii::log("actionProcess estoy en close: ".$sleep,"warning","oscarrrin"); unset(Yii::app()->session['userid']); # Remove the session unset(Yii::app()->session['token']); # Remove the session Yii::app()->session->clear(); Yii::app()->session->destroy(); UsersDao::cleanAuthTokenForUserWithId($id); $this->redirect('index.php?r=site/login'); }
<?php $Users = Utils::getUsersByGetId(); $Users->setStatus(Utils::getUrlParam('status')); if (array_key_exists('comment', $_POST)) { $Users->setComment($_POST['comment']); } $dao = new UsersDao(); $dao->save($Users); Flash::addFlash('status changed successfully.'); Utils::redirect('detail', array('id' => $Users->getId()));
<?php $Users = Utils::getUsersByGetId(); $dao = new UsersDao(); $dao->delete($Users->getId()); Flash::addFlash('User deleted successfully.'); Utils::redirect('list', array('status' => $Users->getStatus()));
<?php $status = Utils::getUrlParam('status'); UsersValidator::validateStatus($status); $dao = new UsersDao(); $search = new FocSearchCriteria(); $search->setStatus($status); // data for template $title = Utils::capitalize($status) . 'Users'; $Users = $dao->find($search);