Ejemplo n.º 1
0
 /**
  * @param $data
  * @param $form
  * @throws ValidationException
  * @throws null
  * Handle submit signup
  */
 public function Submit($data, $form)
 {
     foreach ($data as $k => &$v) {
         if ($v === 'false') {
             $data[$k] = false;
         } elseif ($v === 'true') {
             $data[$k] = true;
         }
         if ($k === 'Title') {
             $v = $v + 1;
         }
     }
     Session::set('SignupData', $data);
     $Signup = new Signup();
     $Signup->update($data);
     $type = Session::get('Signup');
     if ($type['type'] === 'PowerPlan') {
         $plan = PowerPlan::get_by_id('PowerPlan', $type['id']);
     } elseif ($type['type'] === 'GasPlan') {
         $plan = GasPlan::get_by_id('GasPlan', $type['id']);
     }
     $Signup->Plan = $plan->Name;
     $Signup->Company = $plan->Company()->Name;
     $SignupID = $Signup->write();
     if ($SignupID) {
         Session::clear('SignupData');
         Session::clear('Signup');
         $this->redirect('signup/result?result=success');
     } else {
         $this->redirect('signup/result?result=fail');
     }
 }
 public function store()
 {
     $signup = new Signup(Input::all());
     if ($signup->save()) {
         Auth::login($signup->getUser());
         return Redirect::to('/')->withSuccess('Signup completed successfully');
     } else {
         $this->view('create')->withErrors($signup->getErrors());
     }
 }
Ejemplo n.º 3
0
 public function getSignups()
 {
     return Signup::model()->findAllBySql('select signup.* 
           from signup
           left join class_info
            on signup.class_id = class_info.id
           where signup.student_id = :stid
             and class_info.session_id = :ssid', array('ssid' => ClassSession::savedSessionId(), 'stid' => $this->id));
 }
Ejemplo n.º 4
0
 /**
  * Loading register form template
  *
  * @param void
  */
 public function registerForm()
 {
     // instantiate signup model
     $Signup = new Signup();
     // retrieve the callback ID
     $callbackId = $Signup->registerProcess();
     // get the saved post vars
     $vars =& PPostHandler::getVars($callbackId);
     $javascript = false;
     if (isset($vars['javascriptactive'])) {
     }
     if (isset($vars['javascriptactive']) && $vars['javascriptactive'] === 'true') {
         $javascript = true;
     }
     $selYear = 0;
     if (isset($vars['birthyear'])) {
         $selYear = $vars['birthyear'];
     }
     $birthYearOptions = $this->buildBirthYearOptions($selYear);
     require 'templates/registerform.php';
     PPostHandler::clearVars($callbackId);
 }
Ejemplo n.º 5
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['student_id']) && isset($_GET['class_id'])) {
             // XXX this is stupid and tedious. fix.
             $this->_model = Signup::model()->findbyPk(array('student_id' => $_GET['student_id'], 'class_id' => $_GET['class_id']));
         }
         if ($this->_model === null) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
     }
     return $this->_model;
 }
Ejemplo n.º 6
0
 /**
  * Sign up for an event
  *
  * Route: /events/signup/
  */
 public function signup()
 {
     if (!$this->authorized()) {
         header('Location: /login');
     }
     // Get the POST parameters
     $s = new Signup();
     $s->event_id = $this->input->post('event_id');
     $s->user_id = $this->session->userdata('id');
     $s->save();
     // Return JSON data for approved signup
     echo json_encode(array('success' => true));
 }
Ejemplo n.º 7
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.
  * @param integer $id the ID of the model to be loaded
  * @return Signup the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Signup::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Ejemplo n.º 8
0
 public function getSignup()
 {
     return Signup::model()->find(array("condition" => "(class_id = :cid and student_id = :sid)", 'params' => array('cid' => $this->class_id, 'sid' => $this->student_id)));
 }
    }
    if (!$validtor->passwordIsValid($password)) {
        $errors[] = 'Password is not valid';
    }
    if (count($errors) <= 0) {
        $user_id = $login->verify($emial, $password);
        if ($user_id > 0) {
            $_SESSION['user_id'] = $user_id;
            header('Location:add-image.php');
        } else {
            $message = 'Login failed';
        }
    }
}
$signupField = filter_input(INPUT_POST, 'signup');
$signup = new Signup();
if ($util->isPostRequest() && $signupField !== null) {
    if (!$validtor->emailIsValid($email)) {
        $errors[] = 'Email is not valid';
    }
    if (!$validtor->passwordIsValid($password)) {
        $errors[] = 'Password is not valid';
    }
    if ($signup->emailExists($email)) {
        $error[] = 'Email already exists';
    }
    if (count($errors) <= 0) {
        if ($signup->save($email, $password)) {
            $message = 'Signup complete';
        } else {
            $message = 'Signup failed';
Ejemplo n.º 10
0
 public function getSortedNoCancelled()
 {
     return Signup::model()->findAllBySql("select signup.*\n       from signup\n       left join student on student.id = signup.student_id\n      where signup.class_id = :cid\n      and signup.status != 'Cancelled'\n      order by FIND_IN_SET(status, 'Enrolled,Waitlist'), \n        signup.signup_date asc, student.last_name ASC, student.first_name ASC\n      ", array('cid' => $this->id));
 }
Ejemplo n.º 11
0
 function getSignups()
 {
     // Get all of the people who are signed up
     $signups = new Signup();
     return $signups->where('event_id', $this->id)->count();
 }
Ejemplo n.º 12
0
            }
            break;
        default:
            throw new RuntimeException("Error Bad Extention");
            break;
    }
    imagedestroy($rImg);
    imagedestroy($image_p);
    /*
          if ( !move_uploaded_file( $_FILES["upfile"]["tmp_name"], $location) ) {
            throw new RuntimeException('Failed to move uploaded file.');
          }
    */
    //add code to add to the db here
    //    addPhoto($fileName, $user_id);
    if (isset($_SESSION['user_id'])) {
        $fileName .= '.' . $ext;
        $signupAddphoto = new Signup();
        $current_user = $_SESSION['user_id'];
        $signupAddphoto->addPhoto($current_user, $fileName);
        $message = 'File is uploaded successfully. ' . $current_user . " " . $fileName;
    }
} catch (RuntimeException $e) {
    $message = $e->getMessage();
    $status = 500;
    $location = '';
}
header("HTTP/1.1 " . $status . " " . $status_codes[$status]);
$response = array("status" => $status, "status_message" => $status_codes[$status], "message" => $message, "location" => $location);
echo json_encode($response);
die;
Ejemplo n.º 13
0
    }
    public function rules()
    {
        return array("email" => array("unique", "email"), "password" => array("password"));
    }
    public function verify()
    {
        $verifier = new Verification();
        $rules = $this->rules();
        //foreach($rules as $rule) {
        //}
        if ($verifier->ruleEmail($this->attributes['email']) && $verifier->rulePassword($this->attributes['password'])) {
            return true;
        } else {
            return false;
        }
    }
    public function process()
    {
        $db = new Db();
        $perishable_token = $this->generateToken();
        $query = "insert into user (email, password, perishable_token, last_activity_timestamp, signup_timestamp) values (" . "'" . $this->attributes['email'] . "', " . "'" . $this->attributes['password'] . "', " . "'" . $perishable_token . "', " . time() . ", " . time() . ")";
        return $db->execute($query);
    }
    public function generateToken()
    {
        return md5(rand(1, 1000000) . time());
    }
}
$sign_up = new Signup();
echo $sign_up->getResult();
Ejemplo n.º 14
0
        <meta charset="UTF-8">
        <title></title>
        <!-- Latest compiled and minified CSS -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
        <!-- Optional theme -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
    </head>
    <body>
        <?php 
//Variables for Email and Password are Declared
$email = filter_input(INPUT_POST, 'email');
$password = filter_input(INPUT_POST, 'password');
//instance of class created
$util = new Util();
$validator = new Validator();
$signup = new Signup();
//Array of Error Messages
$errors = array();
if ($util->isPostRequest()) {
    if (!$validator->emailIsValid($email)) {
        $errors[] = 'Email is not valid';
    }
    if ($validator->emailIsEmpty($email)) {
        $errors[] = 'Email is required';
    }
    if ($validator->passwordIsEmpty($password)) {
        $errors[] = 'Password is required';
    }
    if ($signup->doesEmailExist($email)) {
        $errors[] = 'Email already exisits';
    }
Ejemplo n.º 15
0
 public function actionDunningReport()
 {
     $s = Signup::model()->findAllBySql("select\n     (if(signup.status != 'Enrolled', 0,\n        (class_info.cost_per_class * meeting.meetings) +\n           coalesce(fees.total,0))\n       -  coalesce(income_summary.paid, 0)) as total_owed,\n     signup.*\nfrom signup\nleft join student\n  on student.id = signup.student_id\nleft join class_info\n  on class_info.id = signup.class_id\n     and class_info.session_id = :sid\nleft join (select count(class_meeting.id) as meetings,\n     class_meeting.class_id as class_id\n     from class_meeting\n     where  class_meeting.makeup < 1\n     group by class_meeting.class_id) \n     as meeting\n  on signup.class_id = meeting.class_id\nleft join (\n    select sum(extra_fee.amount) as total,\n    extra_fee.class_id as class_id\n    from extra_fee\n    group by extra_fee.class_id\n    )\n   as fees\n     on signup.class_id = fees.class_id\nleft join (\n     select sum(income.amount) as paid ,\n     income.class_id as class_id,\n     income.student_id as student_id\n     from income\n     left join check_income\n        on check_income.id = income.check_id\n        and (check_income.returned is null\n                   or check_income.returned < '2000-01-01')\n     group by income.class_id, income.student_id)\n     as income_summary\n on signup.class_id = income_summary.class_id\n      and signup.student_id = income_summary.student_id\nwhere signup.class_id is not null\n      and signup.student_id is not null\n       and signup.scholarship < 1\n        and signup.status = 'Enrolled'\ngroup by signup.class_id, signup.student_id\nhaving total_owed != 0\norder by student.first_name, student.last_name, class_info.class_name\n", array('sid' => ClassSession::savedSessionId()));
     $this->render('dunning_report', array('results' => $s));
 }
Ejemplo n.º 16
0
require_once './autoload.php';
?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php 
$email = filter_input(INPUT_POST, 'email');
$password = filter_input(INPUT_POST, 'password');
$util = new Util();
$validtor = new Validator();
$signup = new Signup();
$errors = array();
if ($util->isPostRequest()) {
    if (!$validtor->emailIsValid($email)) {
        $errors[] = 'Email is not valid';
    }
    if (count($errors) <= 0) {
        if ($signup->save($email, $password)) {
            $message = 'Signup complete';
        } else {
            $message = 'Signup failed';
        }
    }
}
?>
        
Ejemplo n.º 17
0
} else {
    $deviceinfo = 0;
}
if (!empty($_GET['view'])) {
    $view = $_GET['view'];
} else {
    $view = 0;
}
if ($signup == 1) {
    require "signup.php";
    if (isset($_GET['username']) && isset($_GET['password']) && isset($_GET['email'])) {
        // sign user up
        $user = $_GET['username'];
        $pass = $_GET['password'];
        $mail = $_GET['email'];
        $signupUser = new Signup($user, $pass, $mail);
        $signupUser->submit();
    } else {
        // load sign up page
        $signupPage = new signupPage();
        $signupPage->loadSignupPage();
    }
} else {
    if ($forgotpassword == 1) {
        require "forgotpassword.php";
        if (isset($_GET['username'])) {
            $user = $_GET['username'];
            $fpUser = new ForgotPassword($user);
            $fpUser->submit();
        } else {
            $fpPage = new ForgotPasswordPage();
Ejemplo n.º 18
0
<?php

/*-----------------------------------------------------------------------------------
File contains signup controller's action control.
-------------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------
START signup controller
-------------------------------------------------------------------------------------*/
//Create object of Home model
$Model = new Signup();
switch (strtoupper($act)) {
    case 'ACCOUNT_TYPE':
        break;
    case 'DETAILS':
        $Model->collect_data_in_session($act);
        break;
    case 'ABOUT_YOU':
        $Model->collect_data_in_session($act);
        break;
    case 'TERMS_OF_USE':
        $Model->collect_data_in_session($act);
        break;
    case 'CREATE':
        if (isset($_POST["SECURE_TOKEN"])) {
            $Model->collect_data_in_session($act);
            $Model->create_user();
        } else {
            $SECURE->unauthorized_access();
        }
        break;
    case 'FACEBOOK':
Ejemplo n.º 19
0
<?php

/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
if (!defined('PHPWS_SOURCE_DIR')) {
    exit;
}
PHPWS_Core::initModClass('signup', 'Signup.php');
$signup = new Signup();
if (isset($_REQUEST['aop'])) {
    $signup->adminMenu();
} elseif (isset($_REQUEST['uop'])) {
    $signup->userMenu();
} elseif (isset($_REQUEST['sheet_id'])) {
    $signup->userMenu('signup_sheet');
} else {
    PHPWS_Core::home();
}