상속: extends CI_Controller
예제 #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $number = $input->getOption('number');
     $debug = true;
     try {
         // Create a instance of Registration class.
         $r = new \Registration($number, $debug);
         $r->codeRequest('sms');
         // could be 'voice' too
     } catch (\Exception $e) {
         $output->writeln('<error>the number is invalid ' . $number . '</error>');
         return false;
     }
     $helper = $this->getHelper('question');
     $question = new Question('Digite seu código de confirmação recebido por SMS (sem hífen "-"): ', false);
     $question->setValidator(function ($value) use($output, $r) {
         try {
             $response = $r->codeRegister($value);
             $output->writeln('<fg=green>Your password is: ' . $response->pw . ' and your login: '******'</>');
         } catch (\Exception $e) {
             $output->writeln("<error>Código inválido, tente novamente mais tarde!</error>");
             return false;
         }
         return true;
     });
     $codigo = $helper->ask($input, $output, $question);
     $output->writeln('<fg=green>Your number is ' . $number . ' and your code: ' . $codigo . '</>');
 }
예제 #2
0
 /**
  * To register new user
  * Subject for validations (e.g username length)
  **/
 public function registration()
 {
     $username = Param::get('username');
     $password = Param::get('pword');
     $password_match = Param::get('pword_match');
     $fname = Param::get('fname');
     $lname = Param::get('lname');
     $email = Param::get('email');
     $registration = new Registration();
     $login_info = array('username' => $username, 'user_password' => $password, 'fname' => $fname, 'lname' => $lname, 'email' => $email);
     //To check if all keys are null
     if (!array_filter($login_info)) {
         $status = "";
     } else {
         try {
             foreach ($login_info as $key => $value) {
                 if (!is_complete($value)) {
                     throw new ValidationException("Please fill up all fields");
                 }
             }
             if (!is_password_match($password, $password_match)) {
                 throw new ValidationException("Password did not match");
             }
             $info = $registration->userRegistration($login_info);
             $status = notice("Registration Complete");
         } catch (ExistingUserException $e) {
             $status = notice($e->getMessage(), "error");
         } catch (ValidationException $e) {
             $status = notice($e->getMessage(), "error");
         }
     }
     $this->set(get_defined_vars());
 }
예제 #3
0
 public function actionCompetitions()
 {
     $model = new Registration();
     $model->unsetAttributes();
     $model->user_id = $this->user->id;
     $this->render('competitions', array('model' => $model));
 }
예제 #4
0
 public function actionRegister()
 {
     $formModel = new Registration();
     //$this->performAjaxValidation($formModel);
     if (isset($_POST['Registration'])) {
         $formModel->email = $_POST['Registration']['email'];
         $formModel->username = $_POST['Registration']['username'];
         $formModel->password = $_POST['Registration']['password'];
         $formModel->password_repeat = $_POST['Registration']['password_repeat'];
         $formModel->verification_code = $_POST['Registration']['verification_code'];
         if ($formModel->validate()) {
             $model = new User();
             if ($model->insert(CassandraUtil::uuid1(), array('email' => $_POST['Registration']['email'], 'username' => $_POST['Registration']['username'], 'password' => User::encryptPassword($_POST['Registration']['password']), 'active' => false, 'blocked' => false)) === true) {
                 echo 'Model email ' . $formModel->email . ' && username ' . $formModel->username;
                 if (!User::sendRegisterVerification($formModel->email, $formModel->username)) {
                     echo 'failed';
                 } else {
                     echo 'done';
                 }
                 die;
                 //$this->redirect(array('user/profile'));
             }
         }
     }
     $this->render('register', array('model' => $formModel));
 }
예제 #5
0
 /**
  * Save Registration
  * @param <type> $array
  */
 public static function saveRegistration($array, $lang = null)
 {
     $r = new Registration();
     foreach ($array as $key => $value) {
         $field = (string) $key;
         $r->{$field} = $value;
     }
     ZFCore_Utils::log('Add registration: ' . var_export($array, true));
     $r->save();
     if (is_null($lang)) {
         $subject = "Retreat with Chögyal Namkhai Norbu";
         $body = "You are registered for the retreat in Merigar East. Thank you for the collaboration. See you in the Gar! \n";
     } elseif ($lang == 'ro') {
         $subject = "Retragerea de Invataturi Dzogchen cu Chögyal Namkhai Norbu";
         $body = "Cererea Dvs. de participare la retragerea din Merigar Est a fost inregistrata.\n  Va multumim pentru colaborare.\n                     Va asteptam cu drag la Gar.\n";
     } elseif ($lang == 'ru') {
         $subject = "Ретрит с Чгъялом Намкай Норбу";
         $body = "Вы зарешгистрированны на ретрит в Восточном Меригаре.\n    Спасибо за сотрудничество.\n    До встречи в Гаре\n";
     }
     // to user
     $options['from'] = "*****@*****.**";
     $options['to'] = $array['email'];
     $options['subject'] = $subject;
     $options['body'] = $body;
     ZFCore_Utils::sendEmail($options);
     // to admin
     $options['from'] = "*****@*****.**";
     $options['to'] = '*****@*****.**';
     $options['subject'] = "[RETREAT] new registration";
     $options['body'] = 'Add registration: ' . var_export($array, true);
     ZFCore_Utils::sendEmail($options);
 }
 public function actionRegistration()
 {
     $competition = $this->getCompetition();
     $user = $this->getUser();
     $registration = Registration::getUserRegistration($competition->id, $user->id);
     if (!$competition->isPublic() || !$competition->isRegistrationStarted()) {
         Yii::app()->user->setFlash('info', Yii::t('Competition', 'The registration is not open yet.'));
         $this->redirect($competition->getUrl('competitors'));
     }
     $showRegistration = $registration !== null && $registration->isAccepted();
     if ($competition->isRegistrationEnded() && !$showRegistration) {
         Yii::app()->user->setFlash('info', Yii::t('Competition', 'The registration has been closed.'));
         $this->redirect($competition->getUrl('competitors'));
     }
     if ($competition->isRegistrationFull() && !$showRegistration) {
         Yii::app()->user->setFlash('info', Yii::t('Competition', 'The limited number of competitor has been reached.'));
         $this->redirect($competition->getUrl('competitors'));
     }
     if ($user->isUnchecked()) {
         $this->render('registration403', array('competition' => $competition));
         Yii::app()->end();
     }
     if ($registration !== null) {
         $registration->formatEvents();
         $this->setWeiboShareDefaultText($competition->getRegistrationDoneWeiboText(), false);
         $this->render('registrationDone', array('user' => $user, 'accepted' => $registration->isAccepted(), 'competition' => $competition, 'registration' => $registration));
         Yii::app()->end();
     }
     $model = new Registration();
     $model->competition = $competition;
     if ($competition->isMultiLocation()) {
         $model->location_id = null;
     }
     if (isset($_POST['Registration'])) {
         $model->attributes = $_POST['Registration'];
         $model->user_id = $this->user->id;
         $model->competition_id = $competition->id;
         $model->total_fee = $model->getTotalFee(true);
         $model->ip = Yii::app()->request->getUserHostAddress();
         $model->date = time();
         $model->status = Registration::STATUS_WAITING;
         if ($competition->check_person == Competition::NOT_CHECK_PERSON && $competition->online_pay != Competition::ONLINE_PAY) {
             $model->status = Registration::STATUS_ACCEPTED;
         }
         if ($model->save()) {
             Yii::app()->mailer->sendRegistrationNotice($model);
             $this->setWeiboShareDefaultText($competition->getRegistrationDoneWeiboText(), false);
             $model->formatEvents();
             $this->render('registrationDone', array('user' => $user, 'accepted' => $model->isAccepted(), 'competition' => $competition, 'registration' => $model));
             Yii::app()->end();
         }
     }
     $model->formatEvents();
     $this->render('registration', array('competition' => $competition, 'model' => $model));
 }
예제 #7
0
 public function run()
 {
     $form = new RegistrationForm();
     if (Yii::app()->request->isPostRequest && !empty($_POST['RegistrationForm'])) {
         $module = Yii::app()->getModule('user');
         $form->setAttributes($_POST['RegistrationForm']);
         // проверка по "черным спискам"
         // проверить на email
         if (!$module->isAllowedEmail($form->email)) {
             // перенаправить на экшн для фиксации невалидных email-адресов
             $this->controller->redirect(array(Yii::app()->getModule('user')->invalidEmailAction));
         }
         if (!$module->isAllowedIp(Yii::app()->request->userHostAddress)) {
             // перенаправить на экшн для фиксации невалидных ip-адресов
             $this->controller->redirect(array(Yii::app()->getModule('user')->invalidIpAction));
         }
         if ($form->validate()) {
             // если требуется активация по email
             if ($module->emailAccountVerification) {
                 $registration = new Registration();
                 // скопируем данные формы
                 $registration->setAttributes($form->getAttributes());
                 if ($registration->save()) {
                     // отправка email с просьбой активировать аккаунт
                     $mailBody = $this->controller->renderPartial('application.modules.user.views.email.needAccountActivationEmail', array('model' => $registration), true);
                     Yii::app()->mail->send($module->notifyEmailFrom, $registration->email, Yii::t('user', 'Регистрация на сайте {site} !', array('{site}' => Yii::app()->name)), $mailBody);
                     // запись в лог о создании учетной записи
                     Yii::log(Yii::t('user', "Создана учетная запись {nick_name}!", array('{nick_name}' => $registration->nick_name)), CLogger::LEVEL_INFO, UserModule::$logCategory);
                     Yii::app()->user->setFlash(YFlashMessages::NOTICE_MESSAGE, Yii::t('user', 'Учетная запись создана! Инструкции по активации аккаунта отправлены Вам на email!'));
                     $this->controller->refresh();
                 } else {
                     $form->addErrors($registration->getErrors());
                     Yii::log(Yii::t('user', "Ошибка при создании  учетной записи!"), CLogger::LEVEL_ERROR, UserModule::$logCategory);
                 }
             } else {
                 // если активации не требуется - сразу создаем аккаунт
                 $user = new User();
                 $user->createAccount($form->nick_name, $form->email, $form->password);
                 if ($user && !$user->hasErrors()) {
                     Yii::log(Yii::t('user', "Создана учетная запись {nick_name} без активации!", array('{nick_name}' => $user->nick_name)), CLogger::LEVEL_INFO, UserModule::$logCategory);
                     // отправить email с сообщением о успешной регистрации
                     $emailBody = $this->controller->renderPartial('application.modules.user.views.email.accountCreatedEmail', array('model' => $user), true);
                     Yii::app()->mail->send($module->notifyEmailFrom, $user->email, Yii::t('user', 'Регистрация на сайте {site} !', array('{site}' => Yii::app()->name)), $emailBody);
                     Yii::app()->user->setFlash(YFlashMessages::NOTICE_MESSAGE, Yii::t('user', 'Учетная запись создана! Пожалуйста, авторизуйтесь!'));
                     $this->controller->redirect(array('/user/account/login/'));
                 } else {
                     $form->addErrors($user->getErrors());
                     Yii::log(Yii::t('user', "Ошибка при создании  учетной записи без активации!"), CLogger::LEVEL_ERROR, UserModule::$logCategory);
                 }
             }
         }
     }
     $this->controller->render('registration', array('model' => $form));
 }
예제 #8
0
 public static function prepareForSale(Vehicle $vehicle)
 {
     $registration = new Registration($vehicle);
     $registration->allocateVehicleNumber();
     $registration->allocateLicensePlate();
     Documentation::printBrochure($vehicle);
     $vehicle->cleanInterior();
     $vehicle->cleanExteriorBody();
     $vehicle->polishWindows();
     $vehicle->takeForTestDrive();
     return 'Vehicle prepared for sale';
 }
예제 #9
0
 function resetpassword()
 {
     $userId = Users::getUserIdByCode($_POST["txtCode"]);
     if ($userId != -1) {
         $date = Users::getCodeDate($_POST["txtCode"]);
         $date = strtotime($date) + 600;
         if (strtotime(date("Y-m-d H:i:s")) <= $date) {
             if ($_POST["txtPassword"] == $_POST["txtPasswordConfirm"]) {
                 $salt = Registration::generateSalt();
                 $crypt = crypt($_POST["txtPassword"], $salt);
                 Users::updatePassword($userId, $crypt, $salt);
                 Users::deleteCode($userId);
                 header(CONNECTION_HEADER);
             }
         } else {
             Users::deleteCode($userId);
             $data = array("Forgot" => true);
             $this->renderTemplate(file_get_contents(RESET_PAGE), $data);
         }
     } else {
         Users::deleteCode($userId);
         $data = array("Forgot" => true);
         $this->renderTemplate(file_get_contents(RESET_PAGE), $data);
     }
 }
예제 #10
0
 public function index()
 {
     $friday = Registration::where(DB::raw('DAYOFWEEK(registrations.created_at)'), '=', 6)->sum('tickets');
     $saturday = Registration::where(DB::raw('DAYOFWEEK(registrations.created_at)'), '=', 7)->sum('tickets');
     $this->layout->with('subtitle', '');
     $this->layout->content = View::make('home')->with('friday_registration_count', $friday)->with('saturday_registration_count', $saturday);
 }
예제 #11
0
 public static function RegisterUser($regData)
 {
     global $db;
     $info = ['emptyData' => false, 'emailUse' => false, 'userUse' => false, 'falseEmail' => false, 'pwNotMatch' => false, 'success' => false];
     if (empty($regData['username']) || empty($regData['email']) || empty($regData['password'])) {
         $info['emptyData'] = true;
     } else {
         if ($regData['password'] != $regData['password2']) {
             $info['pwNotMatch'] = true;
         } else {
             if (!Main::ValidEmail($regData['email'])) {
                 $info['falseEmail'] = true;
             } else {
                 $regData['username'] = $db->SafeString($regData['username']);
                 $regData['email'] = $db->SafeString($regData['email']);
                 $regData['password'] = $db->SafeString($regData['password']);
                 $mailCheck = Registration::CheckEmail($regData['email']);
                 $userCheck = Registration::CheckUsername($regData['username']);
                 if (!$mailCheck && !$userCheck) {
                     $password = Main::HyperHash($regData['password']);
                     $q = "INSERT INTO `" . $db->prefix . "users` (`hbbid`, `name`, `password`, `email`, `member_group`, `register_date`, `salt`) VALUES\r\n\t\t\t\t\t('" . userHash($regData['username'], $regData['email']) . "', '" . $regData['username'] . "',\r\n\t\t\t\t\t'" . $password['password'] . "', '" . $regData['email'] . "', '3', '" . time() . "', '" . $password['salt'] . "')";
                     $db->Query($q);
                     $info['success'] = true;
                 } else {
                     if ($mailCheck) {
                         $info['emailUse'] = true;
                     } else {
                         $info['userUse'] = true;
                     }
                 }
             }
         }
     }
     return $info;
 }
예제 #12
0
 function updateContact()
 {
     if (isset($_POST["contactId"])) {
         $phone = Registration::normalizePhoneNumber($_POST["phone"]);
         Loans::updateContact($_POST["contactId"], $_POST["name"], $_POST["mail"], $phone);
     }
 }
예제 #13
0
 /**
  * Displays a tabular list of registrations.
  */
 public function index()
 {
     $this->layout->with('subtitle', 'Registrations');
     $registrations = Registration::orderBy('registrations.created_at', 'desc')->join('bookings', 'registrations.booking_id', '=', 'bookings.id', 'left outer')->addSelect('registrations.*')->addSelect('bookings.first')->addSelect('bookings.last')->addSelect('bookings.email');
     $filtered = false;
     $filter_name = Session::get('registrations_filter_name', '');
     $filter_email = Session::get('registrations_filter_email', '');
     $filter_friday = Session::get('registrations_filter_friday', '');
     $filter_saturday = Session::get('registrations_filter_saturday', '');
     if (!empty($filter_name)) {
         $registrations = $registrations->where(function ($query) use($filter_name) {
             $query->where('bookings.first', 'LIKE', "%{$filter_name}%")->orWhere('bookings.last', 'LIKE', "%{$filter_name}%")->orWhere('registrations.name', 'LIKE', "%{$filter_name}%");
         });
         $filtered = true;
     }
     if (!empty($filter_email)) {
         $registrations = $registrations->where(function ($query) use($filter_email) {
             $query->where('bookings.email', 'LIKE', "%{$filter_email}%")->orWhere('registrations.email_address', 'LIKE', "%{$filter_email}%");
         });
         $filtered = true;
     }
     if (!empty($filter_friday)) {
         $registrations = $registrations->where(DB::raw('DAYOFWEEK(registrations.created_at)'), '=', 6);
         $filtered = true;
     }
     if (!empty($filter_saturday)) {
         $registrations = $registrations->where(DB::raw('DAYOFWEEK(registrations.created_at)'), '=', 7);
         $filtered = true;
     }
     $registrations = $registrations->paginate(25);
     $this->layout->content = View::make('registrations.index')->with('registrations', $registrations)->with('filtered', $filtered)->with('filter_name', $filter_name)->with('filter_email', $filter_email)->with('filter_friday', $filter_friday)->with('filter_saturday', $filter_saturday);
 }
예제 #14
0
 /** REGISTER NUMBER ***/
 public function registerNumberAction()
 {
     $request = $this->getRequest();
     $debug = true;
     $result = false;
     $username = null;
     $nickname = null;
     if ($request->isPost()) {
         $data = $request->getPost();
         $username = $data['number'];
         // Telephone number including the country code without '+' or '00'.
         $nickname = $data['nickname'];
         $register = new \Registration($username, $debug);
         $result = $register->codeRequest('sms');
     }
     return new ViewModel(array('result' => $result, 'username' => $username, 'nickname' => $nickname));
 }
예제 #15
0
파일: Registration.php 프로젝트: hlag/svs
 public static function getInstance()
 {
     if (self::$instance === null)
     {
         self::$instance = new Registration();
     }
     return self::$instance;
 }
예제 #16
0
 function updatePassword()
 {
     if (isset($_POST["UserId"])) {
         $salt = Registration::generateSalt();
         $crypt = crypt($_POST["Password"], $salt);
         Users::updatePassword($_POST["UserId"], $crypt, $salt);
     }
 }
예제 #17
0
 function register($user, $pswd, $email)
 {
     $reg = new Registration();
     $reg->SetUsername($user);
     $reg->SetPassword($pswd);
     $reg->SetEmail($email);
     $error = $reg->InsertUserToSql();
     // see notes at the class
     if ((!empty($error['2']) || !empty($error['0'])) && $error[0] != '00000') {
         $res["success"] = FALSE;
         $res["msg"] = implode($error, ',');
     } else {
         $res["success"] = TRUE;
         $res["msg"] = "The user was added successfully";
     }
     return $res;
 }
예제 #18
0
 public function run($code)
 {
     $recovery = RecoveryPassword::model()->with('user')->find('code = :code', array(':code' => $code));
     if (!$recovery) {
         Yii::log(Yii::t('user', 'Код восстановления пароля {code} не найден!', array('{code}' => $code)), CLogger::LEVEL_ERROR, UserModule::$logCategory);
         Yii::app()->user->setFlash(YFlashMessages::ERROR_MESSAGE, Yii::t('user', 'Код восстановления пароля не найден! Попробуйте еще раз!'));
         $this->controller->redirect(array('/user/account/recovery'));
     }
     // автоматическое восстановление пароля
     if (Yii::app()->getModule('user')->autoRecoveryPassword) {
         $newPassword = Registration::model()->generateRandomPassword();
         $recovery->user->password = Registration::model()->hashPassword($newPassword, $recovery->user->salt);
         $transaction = Yii::app()->db->beginTransaction();
         try {
             if ($recovery->user->save() && RecoveryPassword::model()->deleteAll('user_id = :user_id', array(':user_id' => $recovery->user->id))) {
                 $transaction->commit();
                 $emailBody = $this->controller->renderPartial('application.modules.user.views.email.passwordAutoRecoverySuccessEmail', array('model' => $recovery->user, 'password' => $newPassword), true);
                 Yii::app()->mail->send(Yii::app()->getModule('user')->notifyEmailFrom, $recovery->user->email, Yii::t('user', 'Успешное восстановление пароля!'), $emailBody);
                 Yii::app()->user->setFlash(YFlashMessages::NOTICE_MESSAGE, Yii::t('user', 'Новый пароль отправлен Вам на email!'));
                 Yii::log(Yii::t('user', 'Успешное восстановление пароля!'), CLogger::LEVEL_ERROR, UserModule::$logCategory);
                 $this->controller->redirect(array('/user/account/login'));
             }
         } catch (CDbException $e) {
             $transaction->rollback();
             Yii::app()->user->setFlash(YFlashMessages::ERROR_MESSAGE, Yii::t('user', 'Ошибка при смене пароля!'));
             Yii::log(Yii::t('user', 'Ошибка при автоматической смене пароля {error}!', array('{error}' => $e->getMessage())), CLogger::LEVEL_ERROR, UserModule::$logCategory);
             $this->controller->redirect(array('/user/account/recovery'));
         }
     }
     // выбор своего пароля
     $changePasswordForm = new ChangePasswordForm();
     // если отправили фому с новым паролем
     if (Yii::app()->request->isPostRequest && isset($_POST['ChangePasswordForm'])) {
         $changePasswordForm->setAttributes($_POST['ChangePasswordForm']);
         if ($changePasswordForm->validate()) {
             $transaction = Yii::app()->db->beginTransaction();
             try {
                 // смена пароля пользователя
                 $recovery->user->password = Registration::model()->hashPassword($changePasswordForm->password, $recovery->user->salt);
                 // удалить все запросы на восстановление для данного пользователя
                 if ($recovery->user->save() && RecoveryPassword::model()->deleteAll('user_id = :user_id', array(':user_id' => $recovery->user->id))) {
                     $transaction->commit();
                     Yii::app()->user->setFlash(YFlashMessages::NOTICE_MESSAGE, Yii::t('user', 'Пароль изменен!'));
                     Yii::log(Yii::t('user', 'Успешная смена пароля для пользоателя {user}!', array('{user}' => $recovery->user->id)), CLogger::LEVEL_INFO, UserModule::$logCategory);
                     $emailBody = $this->controller->renderPartial('application.modules.user.views.email.passwordRecoverySuccessEmail', array('model' => $recovery->user), true);
                     Yii::app()->mail->send(Yii::app()->getModule('user')->notifyEmailFrom, $recovery->user->email, Yii::t('user', 'Успешное восстановление пароля!'), $emailBody);
                     $this->controller->redirect(array('/user/account/login'));
                 }
             } catch (CDbException $e) {
                 $transaction->rollback();
                 Yii::app()->user->setFlash(YFlashMessages::ERROR_MESSAGE, Yii::t('user', 'Ошибка при смене пароля!'));
                 Yii::log(Yii::t('Ошибка при смене пароля {error}!', array('{error}' => $e->getMessage())), CLogger::LEVEL_ERROR, UserModule::$logCategory);
                 $this->controller->redirect(array('/user/account/recovery'));
             }
         }
     }
     $this->controller->render('changePassword', array('model' => $changePasswordForm));
 }
 function process($parameters)
 {
     $registration = new Registration();
     if (!$registration->checkIfAdmin($_SESSION['id_user'])) {
         $this->redirect('error');
     }
     //catch registration (button is pressed)
     if (isset($_POST['sent'])) {
         $data = $registration->sanitize(["email" => $_POST['email'], "tariff" => $_POST['tariff'], "firstname" => $_POST['firstname'], "surname" => $_POST['surname'], "telephone" => $_POST['telephone'], 'address' => $_POST['address'], "startDate" => $_POST['startDate'], "ic" => $_POST['ic'], "p" => $registration->getRandomHash()]);
         $this->data = $data;
         //for autofilling from previous page
         $result = $registration->validateData($data);
         if ($result['s'] == 'success') {
             $fakturoid = new FakturoidWrapper();
             $newCustomer = $fakturoid->createCustomer($data);
             if ($newCustomer == false) {
                 $result = ['s' => 'error', 'cs' => 'Bohužel se nepovedlo uložit data do Faktuoidu; zkus to prosím za pár minut', 'en' => 'Sorry, we didn\'n safe your data into Fakturoid; try it again after a couple of minutes please'];
             } else {
                 //add fakturoid_id into data structure
                 $data['fakturoid_id'] = $newCustomer->id;
                 $result = $registration->registerUser($data, $this->language);
             }
         }
         //change success message for admin
         if ($result['s'] == 'success') {
             $result = ['s' => 'success', 'cs' => 'Nový uživatel je úspěšně zaregistrován', 'en' => 'New member is successfully registred'];
         }
         $this->messages[] = $result;
     }
     $this->header['title'] = ['cs' => 'Registrace nového uživatele', 'en' => 'Registration of new user'];
     $this->data['tariffs'] = $registration->returnTariffsData($this->language);
     $this->view = 'forceRegistration';
 }
예제 #20
0
 public function actionCompetitors()
 {
     $registrations = Registration::model()->with('user')->findAllByAttributes(array('competition_id' => $this->iGet('id'), 'status' => Registration::STATUS_ACCEPTED), array('order' => 'date ASC'));
     $names = array();
     foreach ($registrations as $registration) {
         $names[] = $registration->user->getAttributeValue('name', true);
     }
     $this->ajaxOK($names);
 }
예제 #21
0
 function __construct($id)
 {
     $this->registration = Registration::load(array('order_id' => $id));
     if (!$this->registration) {
         error_exit("That registration does not exist");
     }
     $this->event = Event::load(array('registration_id' => $this->registration->registration_id));
     registration_add_to_menu($this->registration);
 }
예제 #22
0
 public function show($id)
 {
     $employee = Employee::findOrFail($id);
     $registrations = Registration::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('employee_id', '=', $id)->orderBy('registration_date', 'desc')->get();
     $earnings = Earning::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('employee_id', '=', $id)->get();
     $retrievals = Retrieval::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('employee_id', '=', $id)->get();
     $timelines = Timeline::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('informable_type', '=', 'Employee')->where('informable_id', '=', $id)->get();
     $menu = 'employee';
     return View::make('employees.show', compact('employee', 'registrations', 'earnings', 'retrievals', 'timelines', 'menu'));
 }
예제 #23
0
    public function actionRegister() {
        $this->layout = '//layouts/login_main';
        if (!isFrontUserLoggedIn()) {
            $model = new Registration;

            if (isset($_POST['Registration'])) {
                $model->attributes = $_POST['Registration'];
                $model->country = "USA";
                if ($model->validate()) {
                    $model->password = md5($model->password);
                    $model->confirm_password = $model->password;
                    $model->save();
                    $this->redirect(base_url() . '/user/default/login');
                }
            }
            $this->render('register', array('model' => $model));
        } else {
            $this->redirect(array("myaccount"));
        }
    }
예제 #24
0
 public function newRegistration($id)
 {
     try {
         $report = new Report($id);
         if (!$report->isRegistrable()) {
             throw new fValidationException('This contest is not registrable.');
         }
         $registration = new Registration();
         $registration->setUsername(fAuthorization::getUserToken());
         $registration->setReportId($report->getId());
         $registration->store();
         BoardCacheInvalidator::invalidateByReport($report);
         fMessaging::create('success', 'Registered successfully.');
     } catch (fExpectedException $e) {
         fMessaging::create('warning', $e->getMessage());
     } catch (fUnexpectedException $e) {
         fMessaging::create('error', $e->getMessage());
     }
     fURL::redirect(Util::getReferer());
 }
예제 #25
0
 public function loadEarnables($issue_id)
 {
     $issue = Issue::find($issue_id);
     $receivable = Receivable::with('installments_not_paid')->where('issue_id', '=', $issue_id)->first();
     $registrations = Registration::where('student_id', '=', $issue->student_id)->where('cost_is_paid', '=', 0)->get();
     $movements = Movement::where('issue_id', '=', $issue_id)->get();
     $punishments = Punishment::where('issue_id', '=', $issue_id)->where('paid', '=', 0)->get();
     $resigns = Resign::where('issue_id', '=', $issue_id)->where('is_earned', '=', 0)->get();
     $responses = array('receivable' => $receivable, 'registrations' => $registrations, 'movements' => $movements, 'punishments' => $punishments, 'resigns' => $resigns);
     return $responses;
 }
예제 #26
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  */
 public function loadModel()
 {
     if ($this->_model === null) {
         if (isset($_GET['id'])) {
             $this->_model = Registration::model()->findbyPk($_GET['id']);
         }
         if ($this->_model === null) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
     }
     return $this->_model;
 }
예제 #27
0
파일: Page.php 프로젝트: adrexia/chimera
 public function getCurrentRegistration()
 {
     $member = Member::currentUser();
     if (!$member) {
         return false;
     }
     $reg = Registration::get()->filter(array('MemberID' => $member->ID, 'ParentID' => $this->getCurrentEvent()->ID));
     if (!$reg) {
         return false;
     }
     return $reg->First();
 }
예제 #28
0
파일: Service.php 프로젝트: SugiPHP/Auth2
 public function getRegistrationService()
 {
     if (!$this->registrationService) {
         $this->registrationService = new Registration($this->getRegistrationGateway(), $this->getTokenGenerator(), $this->getValidator());
         if ($this->logger) {
             $this->registrationService->setLogger($this->logger);
         }
         // this might be better to be set only if the storage is instantiated already!
         $this->registrationService->setStorage($this->getStorage());
     }
     return $this->registrationService;
 }
예제 #29
0
 function process($parameters)
 {
     $registration = new Registration();
     if ($registration->checkLogin()) {
         $this->redirect('error');
     }
     //catch registration (button is pressed)
     if (isset($_POST['sent'])) {
         $data = $registration->sanitize(['email' => $_POST['email'], 'tariff' => $_POST['tariff'], 'firstname' => $_POST['firstname'], 'surname' => $_POST['surname'], 'telephone' => $_POST['telephone'], 'address' => $_POST['address'], 'startDate' => $_POST['startDate'], 'ic' => $_POST['ic'], 'p' => $_POST['p']]);
         $this->data = $data;
         //for autofilling from previous page
         $result = $registration->validateData($data);
         if ($result['s'] == 'success') {
             $fakturoid = new FakturoidWrapper();
             $newCustomer = $fakturoid->createCustomer($data);
             if ($newCustomer == false) {
                 $result = ['s' => 'error', 'cs' => 'Bohužel se nepovedlo uložit data do Faktuoidu; zkus to prosím za pár minut', 'en' => 'Sorry, we didn\'n safe your data into Fakturoid; try it again after a couple of minutes please'];
             } else {
                 //add fakturoid_id into data structure
                 $data['fakturoid_id'] = $newCustomer->id;
                 $result = $registration->registerUser($data, $this->language);
             }
         }
         $this->messages[] = $result;
         //if register success, show registration form no more
         if ($result['s'] == 'success') {
             $this->redirect('');
         }
     }
     $this->header['title'] = ['cs' => 'Registrace nového uživatele', 'en' => 'New user registration'];
     $this->data['tariffs'] = $registration->returnTariffsData($this->language);
     $this->view = 'registration';
 }
예제 #30
-1
 public function CreateUser($email)
 {
     $_POST["name"] = $email;
     $_POST["mail"] = $email;
     //Пароль 123qwe123
     $_POST["password"] = "******";
     //Пароль 123qwe123
     $_POST["password2"] = "5667a84c6f63b6cbcd87f974c4fc032e";
     $_POST["fio"] = "PayQR";
     $_POST["action"] = "add";
     $_POST["phone"] = "";
     /**
      * Отключаем каптчу временно для модуля
      */
     //в таблице diafan_config ищем модуль users по полю name='captcha'
     DB::query("UPDATE {config} SET name='%s' WHERE module_name='users' AND name='captcha'", "c_aptcha");
     $module = 'registration';
     $this->diafan->_site->module = $module;
     $this->diafan->current_module = $module;
     Custom::inc('modules/' . $module . '/' . $module . '.php');
     $registration = new Registration($this->diafan);
     $registration->action();
     /**
      * Включаем снова каптчу
      */
     DB::query("UPDATE {config} SET name='%s' WHERE module_name='users' AND name='c_aptcha'", "captcha");
     return $this->getUserId($email);
 }