public function test_resetPassword($email, $secretAns, $newpassword, $ans, $note)
 {
     require_once '../Controller/StudentController.php';
     $studentController = new StudentController();
     $result = $studentController->resetPassword($email, $secretAns, $newpassword);
     $result = trim($result);
     //$result = str_replace(PHP_EOL,null,$result);
     $ans = trim($ans);
     //$ans = str_replace(PHP_EOL,null,$ans);
     /*	print_r($ans);
     			echo "\n";
     			print_r($result);
     			exit();*/
     if (strcmp($result, $ans) == 0) {
         $ans = "PASSED";
     } else {
         $ans = "FAILED";
     }
     /*
     if($ans == $result)
     	$ans = "PASSED";
     else
     	$ans = "FAILED";
     */
     return $test = "<br />\n\t\t\t\t\tTesting resetPassword()<br /><b>note:</b> {$note}\n\t\t\t\t\t<br />\n\t\t\t\t\tWith: " . $email . ", " . $secretAns . ", " . $newpassword . "\n\t\t\t\t\t<br />\n\t\t\t\t\tTest: " . $ans . "<br />";
 }
 /**
  * @covers a
  */
 function test__StudentControllerresetPasswordInvalidEamil()
 {
     $result = "FAILURE TO LOOK UP ENTRY IN THE DATABASE";
     $email = 'adfgadfg';
     $secretAnswer = '';
     $newpassword = '';
     $s = new StudentController();
     return $this->assertEquals($s->resetPassword($email, $secretAns, $newpassword), $result);
 }
 public static function apply(array $restOfRoute)
 {
     global $params;
     StudentController::requireLogin();
     $jobId = self::getIdFromRoute($restOfRoute);
     if (is_null($jobId)) {
         return;
     }
     $studentId = $_SESSION['_id'];
     $application = ApplicationJob::get($jobId);
     // Make sure job exists.
     if (!self::checkJobExists($jobId)) {
         return;
     }
     // Saving of application.
     if (isset($params['questions'])) {
         ApplicationStudent::save($jobId, $studentId, $params['questions']);
         return;
     }
     $submitted = false;
     // Submitting of application.
     if ($params) {
         self::submit($jobId, $studentId, $params);
     }
     $entry = JobModel::getById($jobId);
     $companyId = $entry['company'];
     $company = CompanyModel::getById($companyId);
     $questions = array();
     if (ApplicationModel::applicationExists($jobId, $studentId)) {
         $applicationData = ApplicationModel::getApplication($jobId, $studentId);
         $application = new ApplicationStudent($applicationData);
         $applicationId = $application->getId();
         $submitted = ApplicationModel::checkSubmitted($application->getId());
         if ($submitted) {
             //student succesfully submitted application
             self::redirect("../application/{$applicationId}");
         }
         foreach ($application->getQuestions() as $question) {
             $_id = $question['_id'];
             $questions[] = ['_id' => $_id, 'text' => Question::getTextById($_id), 'answer' => $question['answer']];
         }
     } else {
         JobModel::incrementApply($jobId);
         foreach ($application->getQuestions() as $questionId) {
             $answer = '';
             $answers = StudentModel::getAnswers($studentId);
             $answers = arrayToHashByKey($answers, '_id');
             if (isset($answers[$questionId . ''])) {
                 $answer = $answers[$questionId . '']['answer'];
             } else {
                 $answer = '';
             }
             $questions[] = ['_id' => $questionId, 'text' => Question::getTextById($questionId), 'answer' => $answer];
         }
     }
     self::render('jobs/applications/apply', ['questions' => $questions, 'jobtitle' => $entry['title'], 'companytitle' => $company['name'], 'jobId' => $jobId, 'submitted' => $submitted]);
 }
예제 #4
0
                            $field = $request[1];
                            $value = $request[2];
                            StudentController::checkAccount($field, $value);
                        } else {
                            if ($request[0] == 'signcheckName') {
                                $lastname = $request[1];
                                $firstname = $request[2];
                                StudentController::sign_checkName($lastname, $firstname);
                            } else {
                                $id = $request[0];
                                StudentController::detail($id);
                            }
                        }
                    }
                }
            }
        } else {
            StudentController::read();
        }
        break;
    case 'DELETE':
        if (isset($request) && !empty($request) && $request[0] !== '') {
            $id = $request[0];
            StudentController::delete($id);
        }
        break;
    default:
        print json_encode('ENTRANCE EXAM API v.0.1 developed by: Philip Cesar B. Garay');
        break;
}
exit;
예제 #5
0
            $student->set_id($_POST['id']);
            $student = $this->studentrepository->update($student);
            header("location:index.php?page=student&action=success");
        }
    }
    public function delete()
    {
        $id = $_GET['id'];
        $this->studentrepository->delete($id);
        header("Location: index.php?page=student&action=delete");
    }
}
if (isset($_GET['m'])) {
    $method = $_GET['m'];
} else {
    $method = "index";
}
$studentcontroller = new StudentController();
switch ($method) {
    case 'add':
        $studentcontroller->add();
        break;
    case 'edit':
        $studentcontroller->edit();
        break;
    case 'delete':
        $studentcontroller->delete();
        break;
    default:
        $studentcontroller->index();
}
예제 #6
0
파일: routes.php 프로젝트: tjbindseil/DB
    return password_verify($password, $hashedPassword);
}, array('before' => 'statsStart', 'after' => 'statsComplete'));
$router->post($routePrefix . 'student/add', function () {
    $con = new StudentController();
    return json_encode($con->addStudent());
}, array('before' => 'statsStart', 'after' => 'statsComplete'));
$router->post($routePrefix . 'student/delete', function () {
    $con = new StudentController();
    return $con->deleteStudent();
}, array('before' => 'statsStart', 'after' => 'statsComplete'));
$router->post($routePrefix . 'student/update', function () {
    $con = new StudentController();
    return json_encode($con->updateStudent());
}, array('before' => 'statsStart', 'after' => 'statsComplete'));
$router->post($routePrefix . 'student/getAllStudents', function () {
    $con = new StudentController();
    return $con->getAllStudents();
}, array('before' => 'statsStart', 'after' => 'statsComplete'));
//INSERT/UPDATE and INSERT/UPDATE-like API calls
/*
Simple insert/update
	inserts or updates row in table with attributes objectArr
	if identifier in objectArr exists in table, update existing row with values in objectArr
	if not, insert new row with values in objectArr and auto-generated identifier
*/
$router->post($routePrefix . 'post/{table}/{objectArr}', function ($table, $objectArr) {
    return Test::getIndex();
}, array('before' => 'statsStart', 'after' => 'statsComplete'));
//DELETE and DELETE-like API calls
/*
Simple Delete
<?php

/*created by Javier Andrial*/
ini_set('display_errors', 1);
error_reporting(~0);
require 'Controller/StudentController.php';
$studentController = new StudentController();
session_start();
if (isset($_POST['textbox_newPass']) || isset($_POST['textbox_secretAns'])) {
    if (isset($_POST['textbox_newPass']) && isset($_POST['textbox_secretAns'])) {
        $email = $_SESSION['forgotPassword'];
        $found = $studentController->resetPassword($email, $_POST['textbox_secretAns'], $_POST['textbox_newPass']);
    } else {
        $found = "You must fill both Secret Answer and New Password feilds before proceeding";
    }
    if (isset($_SESSION['forgotPassword'])) {
        unset($_SESSION['forgotPassword']);
    }
} else {
    if (isset($_POST['textbox_txt'])) {
        $found = $studentController->findStudentAccount($_POST['textbox_txt']);
    } else {
        $found = $studentController->CreateForgotPage();
    }
}
$title = "Forgot Password";
$content = $found;
//include 'Styles/ManageTemplate.php';
include 'template.php';
?>
예제 #8
0
<?php

require_once 'app/controller/PlanController.php';
require_once 'app/controller/PlanItemController.php';
require_once 'app/controller/StudentController.php';
$planController = new PlanController();
$planController->handleRequest();
$planItemController = new PlanItemController();
$planItemController->handleRequest();
$studentController = new StudentController();
$studentController->handleRequest();
예제 #9
0
<?php

if (!$_POST['isAjax']) {
}
require_once './.env.php';
require_once './Model/StudentModel.php';
require_once './Controller/StudentController.php';
$controller = new StudentController();
if (isset($_POST['action']) && !empty($_POST['action'])) {
    switch ($_POST['action']) {
        case 'newStudent':
            echo $controller->create();
            break;
        case 'removeStudent':
            echo $controller->removeStudent($_POST['studentId']);
            break;
        case 'storeStudent':
            echo $controller->storeStudent($_POST['form']);
            break;
        default:
            die;
            //TODO return error for ajax
    }
} else {
    echo $controller->index();
}
예제 #10
0
    GLOBALvarGet('CStudent')->editStudentProfile();
});
Router::register('jobs/viewprofile', function () {
    GLOBALvarGet('CStudent')->viewStudentProfile();
});
Router::register('jobs/application', function (array $restOfRoute) {
    ApplicationController::view($restOfRoute);
});
Router::register('jobs/application/report', function () {
    ApplicationControllerAJAX::report();
});
Router::register('jobs/apply', function (array $restOfRoute) {
    ApplicationController::apply($restOfRoute);
});
Router::register('jobs/home', function () {
    StudentController::manage();
});
Router::register('jobs/job', function () {
    GLOBALvarGet('CJob')->view();
});
Router::register('jobs/recruiter', function () {
    GLOBALvarGet('CRecruiter')->view();
});
Router::register('jobs/search', function () {
    Controller::displayMetatags('searchjobs');
    GLOBALvarGet('CJob')->search();
});
Router::register('jobs/company', function () {
    GLOBALvarGet('CCompany')->view();
});
Router::register('login', function () {