예제 #1
0
 function panel()
 {
     $this->load->model('marker');
     $this->load->model('assessment');
     $this->load->library('validation');
     $this->load->model('mark');
     $this->load->model('markerPref');
     // form submit names
     $updatePref = 'updatePref';
     $markerEmail = $this->session->userdata($this->_sessionAuthVar);
     $marker = new Marker();
     $marker->retrieve($markerEmail);
     $markerPref = new MarkerPref();
     $markerPref->retrieve($markerEmail);
     // do this first due to the hacky implementation - it will result in doubled validation
     // messages for every other form
     if ($this->_updatePref($marker, $markerPref)) {
         $viewData['checkpoints'][] = 'You have successfully updated your job update preferences';
     }
     // assessment fix required?
     $requireFix = array("*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**");
     $viewData['assessmentFix'] = false;
     if (in_array($this->_getUser(), $requireFix)) {
         $viewData['assessmentFix'] = true;
     }
     $this->load->model('assessmentFix');
     if ($viewData['assessmentFix']) {
         $assessmentFix = new AssessmentFix();
         $assessmentFix->setKey($this->_getUser());
         if ($assessmentFix->retrieve()) {
             $viewData['assessmentFix'] = false;
         }
     }
     if ($this->input->post('assessmentFix')) {
         if ($this->_checkToken()) {
             $this->load->library('validation');
             $rules['requireFix'] = 'required';
             $fields['requireFix'] = 'yes or no';
             $this->validation->set_rules($rules);
             $this->validation->set_fields($fields);
             if ($this->validation->run() === true) {
                 $assessmentFix = new AssessmentFix();
                 $assessmentFix->requireFix($this->input->post('requireFix'));
                 $assessmentFix->setKey($this->_getUser());
                 $assessmentFix->create();
                 $viewData['checkpoints'][] = 'You have registered for the assessment fix. You will paid a re-assessment bounty when you submit your assessment.';
                 $viewData['assessmentFix'] = false;
             }
         }
     }
     if ($this->input->post('changePassword')) {
         if ($this->_checkToken()) {
             $this->load->library('validation');
             $rules['currentPassword'] = '******';
             $rules['newPassword'] = '******';
             $rules['newPasswordRepeat'] = 'required|matches[newPassword]';
             $fields['currentPassword'] = '******';
             $fields['newPassword'] = '******';
             $fields['newPasswordRepeat'] = 'new password repeated';
             $this->validation->set_rules($rules);
             $this->validation->set_fields($fields);
             if ($this->validation->run() === true) {
                 $marker = new Marker();
                 $marker->setKey($this->_getUser());
                 $marker->retrieve();
                 if ($marker->get('password') === $marker->makePass($this->input->post('currentPassword'))) {
                     $marker->set('password', $marker->makePass($this->input->post('newPassword')));
                     $viewData['checkpoints'][] = 'You have successfully changed your password.';
                     $marker->update();
                 } else {
                     $viewData['errors'][] = 'You did not enter your current password correctly.';
                 }
             }
         }
     }
     $viewData['token'] = $this->_token();
     $viewData['markerPref'] = $markerPref;
     if ($this->session->flashdata('action')) {
         $viewData['checkpoints'][] = $this->session->flashdata('action');
     }
     $viewData['marker'] = $marker;
     $headData['js'][] = 'eb_ui';
     $viewData['assessment'] = false;
     $viewData[$updatePref] = $updatePref;
     if ($this->assessment->retrieve($marker->getKey())) {
         $viewData['assessment'] = true;
     }
     $this->load->view('html_head.php', $headData);
     $this->load->view('page_head.php', array('bodyId' => 'my account', 'userAuth' => @$this->session->userdata('email'), 'markerAuth' => @$this->session->userdata('markerEmail'), 'site_pages' => $this->config->item('site_pages')));
     $this->load->view('marker/panel', $viewData);
     $this->load->view('footer.php', array('site_base' => $this->config->item('base_url')));
 }
예제 #2
0
    exit;
}
?>
            <!-- MAIN SECTION -->
            <section class="main-section">
                <div class="small-12 columns">
                    <div class="row">
                        <h4>marqueur - <?php 
$marker = new Marker();
if (isset($_POST["id"])) {
    $marker->initProperty($_POST["id"], $_POST["firstName"], $_POST["lastName"], strtotime($_POST["birth"]));
    $marker->PageMode = $_POST["pageMode"];
    $marker->validate($mySql);
    if (!$marker->getHasError()) {
        if ($marker->PageMode == Constants::PAGE_MODE_EDIT) {
            $marker->update($mySql);
        } else {
            $marker->addNew($mySql);
        }
        header('Location: marker.php');
        exit;
    }
    echo $marker->getFullName();
} else {
    if (isset($_GET["id"])) {
        $marker->initDB($_GET["id"], $mySql);
        echo $marker->getFullName();
        $marker->PageMode = Constants::PAGE_MODE_EDIT;
    } else {
        echo "[Nouveau]";
        $marker->PageMode = Constants::PAGE_MODE_ADD;
예제 #3
0
 function test_update()
 {
     $test_marker = new Marker("Pok Pok", "123 abcd street", 34.343534, 41.89089, "Restaurant");
     $new_name = "Whiskey Soda Lounge";
     $new_address = "678 DEF street";
     $new_lat = 41.89089;
     $new_lng = 34.343534;
     $new_type = "Bar";
     $new_marker = new Marker($new_name, $new_address, $new_lat, $new_lng, $new_type);
     $test_marker->update($new_name, $new_address, $new_lat, $new_lng, $new_type);
     $this->assertEquals($new_marker, $test_marker);
 }