protected function createTutor($category)
 {
     $t = new Tutor();
     $t->setOccupationCategoryId($category->getId());
     $t->save();
     return $t;
 }
 public function createUsedOccupation($name)
 {
     $occ = $this->createOccupation($name);
     $t = new Tutor();
     $t->setOccupationId($occ->getId());
     $t->save();
     return $occ;
 }
Example #3
0
 public static function createUser($first_name, $last_name, $email, $user_type, $majorId, $coursesIds, $termId)
 {
     self::validateName($first_name);
     self::validateName($last_name);
     self::validateNewEmail($email, self::DB_TABLE);
     self::validateUserType($user_type);
     //$this->validate_teaching_course($teaching_courses);
     try {
         $queryInsertUser = "******" . App::getDbName() . "`.`" . User::DB_TABLE . "` (`" . User::DB_COLUMN_EMAIL . "`,\n\t\t\t`" . User::DB_COLUMN_FIRST_NAME . "`, `" . User::DB_COLUMN_LAST_NAME . "`, `" . User::DB_COLUMN_USER_TYPES_ID . "`)\n\t\t\t\tVALUES(\n\t\t\t\t\t:email,\n\t\t\t\t\t:first_name,\n\t\t\t\t\t:last_name,\n\t\t\t\t\t(SELECT `" . UserTypesFetcher::DB_COLUMN_ID . "` FROM `" . UserTypesFetcher::DB_TABLE . "` WHERE `" . UserTypesFetcher::DB_COLUMN_TYPE . "`=:user_type )\n\t\t\t\t)";
         $dbConnection = DatabaseManager::getConnection();
         $dbConnection->beginTransaction();
         $queryInsertUser = $dbConnection->prepare($queryInsertUser);
         $queryInsertUser->bindParam(':email', $email, PDO::PARAM_STR);
         $queryInsertUser->bindParam(':first_name', $first_name, PDO::PARAM_STR);
         $queryInsertUser->bindParam(':last_name', $last_name, PDO::PARAM_STR);
         $queryInsertUser->bindParam(':user_type', $user_type, PDO::PARAM_STR);
         $queryInsertUser->execute();
         // last inserted if of THIS connection
         $userId = $dbConnection->lastInsertId();
         if (strcmp($user_type, User::TUTOR) === 0) {
             Major::validateId($majorId);
             Tutor::insertMajor($userId, $majorId);
             if ($coursesIds !== NULL) {
                 Tutor_has_course_has_schedule::addCourses($userId, $coursesIds, $termId);
             }
         }
         $dbConnection->commit();
         return $userId;
     } catch (Exception $e) {
         $dbConnection->rollback();
         throw new Exception("Could not insert user into database.");
     }
 }
 function update()
 {
     $disciplina = new Disciplina();
     $disciplina->setNome($_POST['nome']);
     //$disciplina->setTutor($tutor->getById());
     $curso = new Curso();
     $curso->setId($_POST['curso']);
     $disciplina->setCurso($curso->getById());
     $disciplina->setId($_POST['id']);
     $disciplina->update();
     if (isset($_POST['tutor']) && $_POST['tutor']) {
         $tutor = new Tutor();
         $tutor->setId($_POST['tutor']);
         $tutor->addTutorDisciplina($tutor->getId(), $disciplina->getId());
     }
     header("location: ../view/index.php");
 }
Example #5
0
 /**
  * @param int $filledOutDate The date the timesheet was filled out as a int UNIX timestamp, if no value is passed in
  * today's date is set as the date
  * @param Tutor $tutor The tutor that is associated with this timesheet
  * @param PayPeriod $payPeriod The payperiod that relates to this timesheet.
  * @param array $timesWorked The hours the tutor worked for this time period
  */
 public function __construct(Tutor $tutor, PayPeriod $payPeriod, array $timesWorked, $filledOutDate = null)
 {
     // Auto set to today's date. Can be changed manually by method call
     $this->dateFilledOut = $filledOutDate == null ? date("Y-m-d", time()) : date("Y-m-d", $filledOutDate);
     $this->tutorName = $tutor->getName();
     $this->tutorID = $tutor->getID();
     $this->tutorPhone = $tutor->getPhone();
     $timesheetHours = new TimesheetHours($payPeriod, $timesWorked);
     //
     $this->timeWorkedInPeriod = $timesheetHours->getPayPeriodSchedule();
     $this->totalHoursWorked = $timesheetHours->getTotalHoursWorked();
     $this->periodStart = date("l n/j/y", $this->timeWorkedInPeriod[0]->getDate());
     $this->periodEnd = date("l n/j/y", $this->timeWorkedInPeriod[count($timesWorked) - 1]->getDate());
     $this->filename = "Timesheet_" . $this->tutorID . "_" . date("mdy") . "_" . date("Gis");
     $this->HTML = self::setTimesheetHTML();
     $this->PDFgenerator = new DOMPDF();
 }
Example #6
0
 /**
  * Modify a session by deleting it, creating a new session, and transferring over tutors and attenders.
  */
 public function modifySession($sessionID, $date, $time, $subject, $gradeLevel)
 {
     $oldSession = new Session($sessionID);
     $attenders = $oldSession->getSessionAttenders();
     $tutors = $oldSession->getSessionTutors();
     $this->cancelSession($sessionID);
     $newID = $this->createSession($date, $time, $subject, $gradeLevel);
     /* Add attenders to new session: */
     while ($row = $attenders->fetch_assoc()) {
         $attender = new Attender($row['userID'], $this->connection);
         $attender->willAttend($newID);
     }
     /* Add tutors to new session: */
     while ($row = $tutors->fetch_assoc()) {
         $tutor = new Tutor($row['tutorID'], $this->connection);
         $tutor->signUpToTutor($newID);
     }
 }
Example #7
0
 private function tutor()
 {
     $email = Request::getUser();
     $password = Request::getPassword();
     $userAuth = Input::get('userAuth', false);
     if (isset($email) && isset($password) && !$userAuth) {
         $tutor = Tutor::where('email', $email)->first();
         return $tutor && Hash::check($password, $tutor->password) ? $tutor : null;
     } else {
         return false;
     }
 }
 public function updateScript()
 {
     $tutors = Tutor::all();
     foreach ($tutors as $tutor) {
         if ($tutor->districts != null) {
             $districts = explode(',', $tutor->districts);
             foreach ($districts as $district) {
                 TutorDistrict::firstOrCreate(['tutor_id' => $tutor->id, 'district_id' => $district]);
             }
         }
     }
     return "Done";
 }
function findTutor($clave_prof)
{
    $result = obtenerTutor($clave_prof);
    if ($result and $result->num_rows > 0) {
        $temp = mysqli_fetch_array($result, MYSQLI_ASSOC);
        $tutor = new Tutor();
        $tutor->setClaveprof($temp["clave_prof"]);
        $tutor->setApellidoP($temp["apellido_p"]);
        $tutor->setApellidoM($temp["apellido_m"]);
        $tutor->setGenero($temp["genero"]);
        $tutor->setArea($temp["area"]);
        $tutor->setCorreo($temp["email"]);
        return $tutor;
    } else {
        echo "<br/> No hay tutor cuya clave sea: " . $clave_prof;
    }
}
Example #10
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     if (isset($_POST['idStudent']) && isset($_POST['idProfile'])) {
         if (!empty($_POST['idStudent']) && !empty($_POST['idProfile'])) {
             $model = Students::model()->find('id=' . $_POST['idStudent']);
             $model->tutor_id = Tutor::model()->find('profile_id=' . $_POST['idProfile'])->id_tutor;
             if ($model->save()) {
                 Yii::app()->user->setFlash('save', 'El Tutor se ha asignado correctamente.');
                 $this->redirect(array('view', 'id' => $model->id));
             }
         }
         Yii::app()->user->setFlash('error', 'Debe seleccionar un Tutor.');
         $this->redirect(array('view', 'id' => $_POST['idStudent']));
     }
     $this->render('view', array('model' => $this->loadModel($id)));
 }
Example #11
0
 public function index($offset = 0)
 {
     $this->load->library('pagination');
     $config['base_url'] = site_url('tutores/index');
     $config['total_rows'] = Tutor::count();
     $config['per_page'] = '10';
     $config['num_links'] = '1';
     $config['first_link'] = '&larr; primero';
     $config['last_link'] = 'último &rarr;';
     $this->pagination->initialize($config);
     $a = Tutor::find('all', array('limit' => $config['per_page'], 'offset' => $offset));
     $this->table->set_heading('Nombre', 'Apellido', 'Telefono', 'Celular', 'Acciones');
     foreach ($a as $al) {
         $this->table->add_row($al->nombre, $al->apellido, $al->telefono, $al->celular, anchor('tutores/editar/' . $al->id, img('static/img/icon/notepad_2.png'), 'class="tipwe" title="Editar tutor"') . ' ' . anchor('tutores/eliminar/' . $al->id, img('static/img/icon/trash.png'), 'class="tipwe eliminar" title="Eliminar tutor"'));
     }
     $data['tutores'] = $this->table->generate();
     $data['pagination'] = $this->pagination->create_links();
     $this->template->write_view('content', 'tutores/index', $data);
     $this->template->render();
 }
Example #12
0
<?php

require __DIR__ . '/../app/init.php';
$general->loggedOutProtect();
$section = "appointments";
/**
 * @param $studentsAppointmentData
 *
 * @return bool
 */
function reportsHaveBeenCrtd($studentsAppointmentData)
{
    return $studentsAppointmentData[0][AppointmentHasStudentFetcher::DB_COLUMN_REPORT_ID] !== null;
}
try {
    if (!isUrlValid() || $user->isTutor() && !Tutor::hasAppointmentWithId($user->getId(), $_GET['appointmentId'])) {
        header('Location: ' . BASE_URL . "error-403");
        exit;
    }
    date_default_timezone_set('Europe/Athens');
    $pageTitle = "Single Appointment";
    $appointmentId = $_GET['appointmentId'];
    $studentsAppointmentData = Appointment::getAllStudentsWithAppointment($appointmentId);
    $terms = TermFetcher::retrieveCurrTerm();
    $students = StudentFetcher::retrieveAll();
    $courses = CourseFetcher::retrieveForTerm($studentsAppointmentData[0][AppointmentFetcher::DB_COLUMN_TERM_ID]);
    $instructors = InstructorFetcher::retrieveAll();
    $tutors = TutorFetcher::retrieveAll();
    $startDateTime = new DateTime($studentsAppointmentData[0][AppointmentFetcher::DB_COLUMN_START_TIME]);
    $endDateTime = new DateTime($studentsAppointmentData[0][AppointmentFetcher::DB_COLUMN_END_TIME]);
    $nowDateTime = new DateTime();
Example #13
0
<?php

require_once 'classes/Tutor.php';
$tutor = new Tutor();
$email = $_POST['email'];
$list = $tutor->is_email_exists($email);
echo $list;
Example #14
0
<?php

session_start();
define("CONST_FILE_PATH", "includes/constants.php");
define("CURRENT_PAGE", "members");
require 'classes/WebPage.php';
//Set up page as a web page
$thisPage = new WebPage();
//Create new instance of webPage class
$dbObj = new Database();
//Instantiate database
$thisPage->dbObj = $dbObj;
$courseObj = new Course($dbObj);
$categoryObj = new CourseCategory($dbObj);
$quoteObj = new Quote($dbObj);
$memberObj = new Tutor($dbObj);
include 'includes/other-settings.php';
require 'includes/page-properties.php';
?>
<!DOCTYPE html>
<html lang="en-US">
<head>
    <?php 
include 'includes/meta-tags.php';
?>
    <style type="text/css">img.wp-smiley,img.emoji {display: inline !important;border: none !important;box-shadow: none !important;height: 1em !important;width: 1em !important;margin: 0 .07em !important;vertical-align: -0.1em !important;background: none !important;padding: 0 !important; }</style>
    <link rel='stylesheet' id='rs-plugin-settings-css'  href='<?php 
echo SITE_URL;
?>
plugins/revslider/rs-plugin/css/settings1dc6.css?ver=4.6.5' type='text/css' media='all' />
    <style id='rs-plugin-settings-inline-css' type='text/css'>.tp-caption a{color:#e05100;text-shadow:none; text-decoration:none;-webkit-transition:all 0.2s ease-out;-moz-transition:all 0.2s ease-out;-o-transition:all 0.2s ease-out;-ms-transition:all 0.2s ease-out}.tp-caption a:hover{color:#ffa902}</style>
Example #15
0
<?php

require_once './classes/Tutor.php';
$t = new Tutor();
$email = $_POST['email'];
$url = $_POST['url'];
$list = $t->test_page($email, $url);
echo $list;
Example #16
0
<?php

require_once 'classes/Tutor.php';
$tutor = new Tutor();
$user = $_POST['user'];
$list = $tutor->tutor_signup($user);
echo $list;
<?php

session_start();
define("CONST_FILE_PATH", "../includes/constants.php");
include '../classes/WebPage.php';
//Set up page as a web page
$thisPage = new WebPage();
//Create new instance of webPage class
$dbObj = new Database();
//Instantiate database
$tutorObj = new Tutor($dbObj);
// Create an object of Tutor class
$errorArr = array();
//Array of errors
$oldPicture = "";
$newPicture = "";
$tutorPictureFil = "";
if (!isset($_SESSION['ITCLoggedInAdmin']) || !isset($_SESSION["ITCadminEmail"])) {
    $json = array("status" => 0, "msg" => "You are not logged in.");
    header('Content-type: application/json');
    echo json_encode($json);
} else {
    if (filter_input(INPUT_POST, "fetchTutors") != NULL) {
        $requestData = $_REQUEST;
        $columns = array(0 => 'id', 1 => 'id', 2 => 'visible', 3 => 'picture', 4 => 'name', 5 => 'qualification', 6 => 'field', 7 => 'bio', 8 => 'email', 9 => 'website');
        // getting total number records without any search
        $query = $dbObj->query("SELECT * FROM tutor ");
        $totalData = mysqli_num_rows($query);
        $totalFiltered = $totalData;
        // when there is no search parameter then total number rows = total number filtered rows.
        $sql = "SELECT * FROM tutor WHERE 1=1 ";
Example #18
0
 public static function getSingleTutorOnTerm($tutorId, $termId)
 {
     Tutor::validateId($tutorId);
     Term::validateId($termId);
     return ScheduleFetcher::retrieveSingleTutorOnTerm($tutorId, $termId);
 }
Example #19
0
 public function getNombre($id)
 {
     if (!empty($id)) {
         $tutor = Tutor::model()->findByPk($id);
         return Profile::model()->nombreApellido($tutor->profile->firstname, $tutor->profile->secondname, $tutor->profile->lastname1, $tutor->profile->lastname2);
     }
     return TbHtml::labelTb("Sin asignar", array('color' => TbHtml::LABEL_COLOR_IMPORTANT));
 }
Example #20
0
require __DIR__ . '/../app/init.php';
$general->loggedOutProtect();
$pageTitle = "Personnel";
$section = "staff";
try {
    // protect again any sql injections on url
    if (isset($_GET['id']) && preg_match("/^[0-9]+\$/", $_GET['id'])) {
        $userId = $_GET['id'];
        $pageTitle = "Profile";
        if (($data = User::getSingle($userId)) === false) {
            header('Location: ' . BASE_URL . 'error-404');
            exit;
        }
        if (strcmp($data['type'], 'tutor') === 0) {
            $tutor = TutorFetcher::retrieveSingle($userId);
            $curUser = new Tutor($data['id'], $data['f_name'], $data['l_name'], $data['email'], $data['mobile'], $data['img_loc'], $data['profile_description'], $data['date'], $data['type'], $data['active'], $tutor[MajorFetcher::DB_COLUMN_NAME]);
            $schedules = ScheduleFetcher::retrieveCurrWorkingHours($curUser->getId());
            $teachingCourses = TutorFetcher::retrieveCurrTermTeachingCourses($curUser->getId());
        } else {
            if (strcmp($data['type'], 'secretary') === 0) {
                $curUser = new Secretary($data['id'], $data['f_name'], $data['l_name'], $data['email'], $data['mobile'], $data['img_loc'], $data['profile_description'], $data['date'], $data['type'], $data['active']);
            } else {
                if (strcmp($data['type'], 'admin') === 0) {
                    $curUser = new Admin($data['id'], $data['f_name'], $data['l_name'], $data['email'], $data['mobile'], $data['img_loc'], $data['profile_description'], $data['date'], $data['type'], $data['active']);
                } else {
                    throw new Exception("Something terrible has happened with the database. <br/>The software developers will tremble with fear.");
                }
            }
        }
    } else {
        if (isBtnInactivePrsd()) {
Example #21
0
 public static function replaceMajorId($id, $newMajorId, $oldMajorId)
 {
     // no changes made. no need to do any work.
     if (strcmp($newMajorId, $oldMajorId) === 0) {
         return false;
     }
     Tutor::validateId($id);
     Major::validateId($newMajorId);
     Major::validateId($oldMajorId);
     TutorFetcher::replaceMajorId($id, $newMajorId);
     return true;
 }
<?php

session_start();
define("CONST_FILE_PATH", "../includes/constants.php");
include '../classes/WebPage.php';
//Set up page as a web page
$thisPage = new WebPage();
//Create new instance of webPage class
$dbObj = new Database();
//Instantiate database
$tutorObj = new Tutor($dbObj);
// Create an object of Tutor class
$errorArr = array();
//Array of errors
$tutorImgFil = "";
if (!isset($_SESSION['TSILoggedInAdmin']) || !isset($_SESSION["TSIadminEmail"])) {
    $json = array("status" => 0, "msg" => "You are not logged in.");
    header('Content-type: application/json');
    echo json_encode($json);
} else {
    if (filter_input(INPUT_POST, "addNewTutor") != NULL) {
        $postVars = array('name', 'qualification', 'field', 'bio', 'email', 'website', 'picture');
        // Form fields names
        //Validate the POST variables and add up to error message if empty
        foreach ($postVars as $postVar) {
            switch ($postVar) {
                case 'picture':
                    $tutorObj->{$postVar} = basename($_FILES["picture"]["name"]) ? rand(100000, 1000000) . "_" . strtolower(str_replace(" ", "_", filter_input(INPUT_POST, 'name'))) . "." . pathinfo(basename($_FILES["picture"]["name"]), PATHINFO_EXTENSION) : "";
                    $tutorImgFil = $tutorObj->{$postVar};
                    if ($tutorObj->{$postVar} == "") {
                        array_push($errorArr, "Please enter {$postVar} ");
Example #23
0
 private static function makeTutor($linha)
 {
     $nome = $linha['nome'];
     $pessoaId = $linha['id_pessoa'];
     $sobrenome = $linha['sobrenome'];
     $cpf = $linha['cpf'];
     $email = $linha['email'];
     $formacaoId = $linha['id_formacao'];
     $formacaoDescricao = $linha['d_formacao'];
     $formacao = array("descricao" => $formacaoDescricao, "id" => $formacaoId);
     $titulacaoId = $linha['id_titulacao'];
     $titulacaoDescricao = $linha['d_titulacao'];
     $titulacao = array("descricao" => $titulacaoDescricao, "id" => $titulacaoId);
     $tutorId = $linha['id_tutor'];
     $tutor = new Tutor();
     $tutor->setCpf($cpf);
     $tutor->setEmail($email);
     $tutor->setFormacao($formacao);
     $tutor->setId($pessoaId);
     $tutor->setSobrenome($sobrenome);
     $tutor->setNome($nome);
     $tutor->setTitulacao($titulacao);
     $tutor->setTutorId($tutorId);
     $tutor->setId($pessoaId);
     return $tutor;
 }
Example #24
0
 public function createRelatedObject($obj)
 {
     $r = new Tutor();
     $r->setStudyId($obj->getId());
     $r->save();
 }
Example #25
0
<?php 
$this->widget('yiiwheels.widgets.grid.WhGridView', array('fixedHeader' => true, 'headerOffset' => 40, 'type' => 'striped', 'dataProvider' => $dataStudents, 'responsiveTable' => true, 'template' => "{items}", 'columns' => array(array('header' => 'ID', 'value' => '$data->id'), array('header' => 'Nombre', 'type' => 'raw', 'value' => function ($data, $row) {
    return Profile::model()->nombreApellido($data->profile->firstname, $data->profile->secondname, $data->profile->lastname1, $data->profile->lastname2);
}), array('header' => 'Sexo', 'value' => function ($data, $row) {
    return Profile::model()->validarSexo($data->profile->sex);
}, 'type' => 'raw'), array('header' => 'Correo', 'value' => '$data->profile->email'), array('header' => 'Tutor', 'value' => function ($data, $row) {
    return Tutor::model()->getNombre($data->tutor_id);
}, 'type' => 'raw'), array('header' => 'Registrado', 'value' => function ($data, $row) {
    return Yii::app()->dateFormatter->formatDateTime($data->profile->user->regdate, 'medium', false);
}, 'type' => 'raw'), array('header' => 'Status', 'type' => 'raw', 'value' => function ($data, $row) {
    return Profile::model()->validarStatus($data->profile->cruge_user_iduser);
}), array('header' => '', 'type' => 'raw', 'value' => function ($data, $row) {
    return Profile::model()->botonStatus($data->profile->cruge_user_iduser);
}), array('name' => '', 'type' => 'raw', 'value' => function ($data, $row) {
    return Tutor::model()->botonAsignar($data->tutor_id, $data->id);
}))));
$this->endWidget();
?>
<!-- End Box de Estudiantes VC -->

<!-- Box de Tutors VC -->
<?php 
$this->beginWidget('yiiwheels.widgets.box.WhBox', array('title' => 'Tutores VC', 'headerIcon' => 'icon-th-list', 'headerButtons' => array(TbHtml::buttonGroup(array(array('label' => 'Gestionar Tutor', 'submit' => array('tutor/admin')))))));
?>

<?php 
$this->widget('yiiwheels.widgets.grid.WhGridView', array('fixedHeader' => true, 'headerOffset' => 40, 'type' => 'striped', 'dataProvider' => $dataTutor, 'responsiveTable' => true, 'template' => "{items}", 'columns' => array(array('header' => 'ID', 'value' => '$data->id_tutor'), array('header' => 'Nombre', 'type' => 'raw', 'value' => function ($data, $row) {
    return Profile::model()->nombreApellido($data->profile->firstname, $data->profile->secondname, $data->profile->lastname1, $data->profile->lastname2);
}), array('header' => 'Sexo', 'value' => function ($data, $row) {
    return Profile::model()->validarSexo($data->profile->sex);
Example #26
0
 public function executeConfirmStudent(sfWebRequest $request)
 {
     sfContext::getInstance()->set("user", new FakeUser());
     //tomo las intancias de las librerias.
     $i_identification_type = BaseCustomOptionsHolder::getInstance('IdentificationType');
     $i_sex_type = BaseCustomOptionsHolder::getInstance('SexType');
     $i_nationality = BaseCustomOptionsHolder::getInstance('Nationality');
     $s_lastname = $this->getRequestParameter('apellido');
     // Es obligatorio
     $s_firstname = $this->getRequestParameter('nombres');
     // Es obligatorio
     $s_identification_type = $i_identification_type->getIdentificationType($this->getRequestParameter('tipo_documento_id'));
     $s_identification_number = $this->getRequestParameter('nro_documento');
     $s_sex = $i_sex_type->getSexType($this->getRequestParameter('sexo'));
     //Es obligatorio
     $s_phone = $this->getRequestParameter('telefono_fijo');
     $s_birthdate = $this->getRequestParameter('fecha_nacimiento');
     $s_birth_city = $this->getRequestParameter('ciudad_nacimiento_id');
     $s_health_coverage_id = $this->getRequestParameter('obra_social_id');
     $s_origin_school_id = $request->getParameter('escuela_procedencia_numero');
     //domicilio
     $s_city = $this->getRequestParameter('domicilio_ciudad_id');
     $s_street = $this->getRequestParameter('domicilio_calle');
     $s_number = $this->getRequestParameter('domicilio_numero');
     $s_floor = $this->getRequestParameter('domicilio_piso');
     $s_flat = $this->getRequestParameter('domicilio_departamento');
     //Chequeo tutor (madre)
     $m_identification_type = $i_identification_type->getIdentificationType($this->getRequestParameter('madre_tipo_documento_id'));
     $m_identification_number = $this->getRequestParameter('madre_nro_documento');
     $m_firstname = $this->getRequestParameter('madre_nombres');
     $m_lastname = $this->getRequestParameter('madre_apellido');
     $m_occupation = $this->getRequestParameter('madre_actividad_id');
     $m_occupation_category = $this->getRequestParameter('madre_ocupacion_id');
     $m_study = $this->getRequestParameter('madre_estudios_id');
     $m_email = $this->getRequestParameter('madre_email');
     $m_phone = $this->getRequestParameter('madre_telefono_celular');
     $m_birthdate = $this->getRequestParameter('madre_fecha_nacimiento');
     $m_birth_city = $this->getRequestParameter('madre_ciudad_nacimiento_id');
     $m_nationality = $i_nationality->getNationality($this->getRequestParameter('madre_nacionalidad_id'));
     $m_is_alive = $this->getRequestParameter('madre_vive');
     //chequeo is_alive
     if ($m_is_alive == 'S') {
         $m_is_alive = true;
     } elseif ($m_is_alive == 'N') {
         $m_is_alive = false;
     }
     //domicilio
     $m_city = $this->getRequestParameter('madre_domicilio_ciudad_id');
     $m_street = $this->getRequestParameter('madre_domicilio_calle');
     $m_number = $this->getRequestParameter('madre_domicilio_numero');
     $m_floor = $this->getRequestParameter('madre_domicilio_piso');
     $m_flat = $this->getRequestParameter('madre_domicilio_departamento');
     //Chequeo tutor (padre)
     $p_identification_type = $i_identification_type->getIdentificationType($this->getRequestParameter('padre_tipo_documento_id'));
     $p_identification_number = $this->getRequestParameter('padre_nro_documento');
     $p_firstname = $this->getRequestParameter('padre_nombres');
     $p_lastname = $this->getRequestParameter('padre_apellido');
     $p_occupation = $this->getRequestParameter('padre_actividad_id');
     $p_occupation_category = $this->getRequestParameter('padre_ocupacion_id');
     $p_study = $this->getRequestParameter('padre_estudios_id');
     $p_email = $this->getRequestParameter('padre_email');
     $p_phone = $this->getRequestParameter('padre_telefono_celular');
     $p_birthdate = $this->getRequestParameter('padre_fecha_nacimiento');
     $p_birth_city = $this->getRequestParameter('padre_ciudad_nacimiento_id');
     $p_nationality = $i_nationality->getNationality($this->getRequestParameter('padre_nacionalidad_id'));
     $p_is_alive = $this->getRequestParameter('padre_vive');
     //chequeo is_alive
     if ($p_is_alive == 'S') {
         $p_is_alive = true;
     } elseif ($p_is_alive == 'N') {
         $p_is_alive = false;
     }
     //domicilio
     $p_city = $this->getRequestParameter('padre_domicilio_ciudad_id');
     $p_street = $this->getRequestParameter('padre_domicilio_calle');
     $p_number = $this->getRequestParameter('padre_domicilio_numero');
     $p_floor = $this->getRequestParameter('padre_domicilio_piso');
     $p_flat = $this->getRequestParameter('padre_domicilio_departamento');
     $data = array();
     //chequeo campos obligatorios
     if (is_null($s_identification_type) || is_null($s_identification_number) || is_null($s_lastname) || trim($s_lastname) == "" || is_null($s_firstname) || trim($s_firstname) == "" || is_null($s_sex)) {
         throw new Exception('Missing data');
     } else {
         $con = Propel::getConnection();
         try {
             //chequeo que el alumno no haya sido ingresado en un año anterior (por lista de espera)
             $student = StudentPeer::retrieveByDocumentTypeAndNumber($s_identification_type, $s_identification_number);
             $con->beginTransaction();
             if (is_null($student)) {
                 //el alumno no existe. Creo la persona y el alumno
                 $s_person = new Person();
                 $s_person->setLastname($s_lastname);
                 $s_person->setFirstname($s_firstname);
                 $s_person->setSex($s_sex);
                 $s_person->setIdentificationType($s_identification_type);
                 $s_person->setIdentificationNumber($s_identification_number);
                 $s_person->setPhone($s_phone);
                 $s_person->setBirthdate($s_birthdate);
                 $s_person->setIsActive(true);
                 $s_person->setBirthCity($s_birth_city);
                 $s_person->save(Propel::getConnection());
                 $student = new Student();
                 $student->setPerson($s_person);
                 $student->setGlobalFileNumber('888888');
                 //Nro de legajo??
                 $student->setOriginSchoolId($s_origin_school_id);
                 $student->setHealthCoverageId($s_health_coverage_id);
                 $student->save(Propel::getConnection());
                 /* Recupero department, state ,country*/
                 if (!is_null($s_birth_city)) {
                     $city = CityPeer::retrieveByPk($s_birth_city);
                     $student->getPerson()->setBirthCountry($city->getDepartment()->getState()->getCountry()->getId());
                     $student->getPerson()->setBirthState($city->getDepartment()->getState()->getId());
                     $student->getPerson()->setBirthDepartment($city->getDepartment()->getId());
                 }
                 //chequeo domicilio
                 if (!is_null($s_city) || !is_null($s_street) || !is_null($s_number) || !is_null($s_floor) || is_null($s_flat)) {
                     $a = new Address();
                     $a->setCityId($s_city);
                     $a->setStreet($s_street);
                     $a->setNumber($s_number);
                     $a->setFloor($s_floor);
                     $a->setFlat($s_flat);
                     $student->getPerson()->setAddress($a);
                     $student->getPerson()->save(Propel::getConnection());
                     $data['message'] = "El alumno ha sido confirmado.";
                 }
             } else {
                 //seteo isActive
                 $student->getPerson()->setIsActive(true);
                 $student->save(Propel::getConnection());
                 $data['message'] = "El alumno fue actualizado correctamente.";
             }
             //chequeo campos obligatorios
             if (!is_null($m_identification_type) && !is_null($m_identification_number) && !is_null($m_lastname) && trim($m_lastname) != "" && !is_null($m_firstname) && trim($m_firstname) != "") {
                 //busco si ya existe.
                 $m_tutor = TutorPeer::findByDocumentTypeAndNumber($m_identification_type, $m_identification_number);
                 if (is_null($m_tutor)) {
                     //el tutor no existe. Lo creo
                     $m_person = new Person();
                     $m_person->setLastname($m_lastname);
                     $m_person->setFirstname($m_firstname);
                     $m_person->setIdentificationType($m_identification_type);
                     $m_person->setIdentificationNumber($m_identification_number);
                     $m_person->setSex(SexType::FEMALE);
                     $m_person->setPhone($m_phone);
                     $m_person->setEmail($m_email);
                     $m_person->setBirthdate($m_birthdate);
                     $m_person->setIsActive(true);
                     $m_person->setBirthCity($m_birth_city);
                     $m_person->save(Propel::getConnection());
                     $m_tutor = new Tutor();
                     $m_tutor->setPerson($m_person);
                     $m_tutor->setOccupationId($m_occupation);
                     $m_tutor->setOccupationCategoryId($m_occupation_category);
                     $m_tutor->setStudyId($m_study);
                     //coincide con la tabla sga_tipos_est_cur
                     $m_tutor->setNationality($m_nationality);
                     $m_tutor->setIsAlive($m_is_alive);
                     $m_tutor->save(Propel::getConnection());
                     /* Recupero department, state ,country*/
                     if (!is_null($m_birth_city)) {
                         $m_city = CityPeer::retrieveByPk($m_birth_city);
                         $m_tutor->getPerson()->setBirthCountry($m_city->getDepartment()->getState()->getCountry()->getId());
                         $m_tutor->getPerson()->setBirthState($m_city->getDepartment()->getState()->getId());
                         $m_tutor->getPerson()->setBirthDepartment($m_city->getDepartment()->getId());
                     }
                     //chequeo domicilio
                     if (!is_null($m_city) || !is_null($m_street) || !is_null($m_number) || !is_null($m_floor) || is_null($m_flat)) {
                         $a = new Address();
                         $a->setCityId($m_birth_city);
                         $a->setStreet($m_street);
                         $a->setNumber($m_number);
                         $a->setFloor($m_floor);
                         $a->setFlat($m_flat);
                         $m_tutor->getPerson()->setAddress($a);
                         $m_tutor->getPerson()->save(Propel::getConnection());
                     }
                 } else {
                     $data['info'] = "El tutor con " . $i_identification_type->getStringFor($m_identification_type) . " " . $m_identification_number;
                 }
                 $st = StudentTutorPeer::retrieveByStudentAndTutor($student, $m_tutor);
                 if (is_null($st)) {
                     //datos de tutor(madre)
                     $student_tutor = new StudentTutor();
                     $student_tutor->setStudent($student);
                     $student_tutor->setTutor($m_tutor);
                     $student_tutor->save(Propel::getConnection());
                     $m_tutor->addStudentTutor($student_tutor);
                     $m_tutor->save(Propel::getConnection());
                 }
             }
             //chequeo campos obligatorios
             if (!is_null($p_identification_type) && !is_null($p_identification_number) && !is_null($p_lastname) && trim($p_lastname) != "" && !is_null($p_firstname) && trim($p_firstname) != "") {
                 //busco si ya existe.
                 $tutor = TutorPeer::findByDocumentTypeAndNumber($p_identification_type, $p_identification_number);
                 if (is_null($tutor)) {
                     //el tutor no existe. Lo creo
                     $p_person = new Person();
                     $p_person->setLastname($p_lastname);
                     $p_person->setFirstname($p_firstname);
                     $p_person->setIdentificationType($p_identification_type);
                     $p_person->setIdentificationNumber($p_identification_number);
                     $p_person->setSex(SexType::MALE);
                     $p_person->setPhone($p_phone);
                     $p_person->setEmail($p_email);
                     $p_person->setBirthdate($p_birthdate);
                     $p_person->setIsActive(true);
                     $p_person->setBirthCity($p_birth_city);
                     $p_person->save(Propel::getConnection());
                     $tutor = new Tutor();
                     $tutor->setPerson($p_person);
                     $tutor->setOccupationId($p_occupation);
                     $tutor->setOccupationCategoryId($p_occupation_category);
                     $tutor->setStudyId($p_study);
                     //coincide con la tabla sga_tipos_est_cur
                     $tutor->setNationality($p_nationality);
                     $tutor->save(Propel::getConnection());
                     /* Recupero department, state ,country*/
                     if (!is_null($p_birth_city)) {
                         $p_city = CityPeer::retrieveByPk($p_birth_city);
                         $tutor->getPerson()->setBirthCountry($p_city->getDepartment()->getState()->getCountry()->getId());
                         $tutor->getPerson()->setBirthState($p_city->getDepartment()->getState()->getId());
                         $tutor->getPerson()->setBirthDepartment($p_city->getDepartment()->getId());
                     }
                     //chequeo domicilio
                     if (!is_null($p_city) || !is_null($p_street) || !is_null($p_number) || !is_null($p_floor) || is_null($p_flat)) {
                         $a = new Address();
                         $a->setCityId($p_birth_city);
                         $a->setStreet($p_street);
                         $a->setNumber($p_number);
                         $a->setFloor($p_floor);
                         $a->setFlat($p_flat);
                         $tutor->getPerson()->setAddress($a);
                         $tutor->getPerson()->save(Propel::getConnection());
                     }
                     if (!is_null($data['info'])) {
                         $data['info'] = $data['info'] . " ya existe en el sistema. Por favor actualice los datos.";
                     }
                 } else {
                     if (!is_null($data['info'])) {
                         $data['info'] = "Los tutores con " . $i_identification_type->getStringFor($m_identification_type) . " " . $m_identification_number . " y " . $i_identification_type->getStringFor($p_identification_type) . " " . $p_identification_number . " ya existen en el sistema. Por favor actualice los datos.";
                     } else {
                         $data['info'] = "El tutor con " . $i_identification_type->getStringFor($p_identification_type) . " " . $p_identification_number . " ya existe en el sistema. Por favor actualice los datos.";
                     }
                 }
                 //datos de tutor(padre)
                 $st = StudentTutorPeer::retrieveByStudentAndTutor($student, $tutor);
                 if (is_null($st)) {
                     $student_tutor = new StudentTutor();
                     $student_tutor->setStudent($student);
                     $student_tutor->setTutor($tutor);
                     $student_tutor->save(Propel::getConnection());
                     $tutor->addStudentTutor($student_tutor);
                     $tutor->save(Propel::getConnection());
                 }
             }
             $con->commit();
         } catch (PropelException $e) {
             $con->rollBack();
             throw $e;
         }
     }
     $this->data = $data;
     $this->getResponse()->setHttpHeader('Content-type', 'application/json');
     $this->getResponse()->setContent(json_encode($data));
     $this->setLayout(false);
 }
<?php

// Inicio la sesión
@session_start();
// Load user
require_once __DIR__ . '/../oop/manager/UserManager.php';
$userManager = new UserManager();
$USER = $userManager->loadSession();
// Check the login
if ($USER != null && $USER instanceof Supervisor) {
    $ID = $_POST['ID'];
    if ($userManager->userExists($ID)) {
        echo 'userAlreadyExists';
    } else {
        $PIN = $_POST['PIN'];
        $name = $_POST['name'];
        $email = $_POST['email'];
        $phone = $_POST['phone'];
        $tutor = new Tutor($ID, null, $name, $email, $phone);
        $tutor->setPIN($PIN);
        $userManager->register($tutor);
        echo 'true';
    }
} else {
    echo 'false';
}
Example #28
0
 function getFormacoes()
 {
     $tutor = new Tutor();
     return $tutor->getFormacoes();
 }
Example #29
0
 function register(Tutor $tutor)
 {
     if (!$this->userExists($tutor->getID())) {
         $this->saveDatabase($tutor);
     }
 }
Example #30
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 Tutor the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Tutor::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }