Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
Emiliemorais committed May 13, 2016
2 parents e410814 + 009bec9 commit caef790
Show file tree
Hide file tree
Showing 329 changed files with 5,099 additions and 113,182 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ application/config/*.php
siga.sublime-workspace

/application/upload_files
/vendor-dependencies
/application/constants/EmailSenderData.php
2 changes: 1 addition & 1 deletion application/config/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
| $autoload['libraries'] = array('database', 'session', 'xmlrpc');
*/

$autoload['libraries'] = array('database', 'session');
$autoload['libraries'] = array('ComposerAutoLoad', 'database', 'session', 'navBarNotification');


/*
Expand Down
15 changes: 13 additions & 2 deletions application/config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,14 @@
$route['default_controller'] = "login";
$route['404_override'] = '';
$route['conta'] = 'usuario/conta';
$route['profile'] = 'usuario/profile';
$route['logout'] = 'login/logout';

$route['cadastro'] = 'usuario/formulario';
$route['register'] = 'usuario/register';
$route['register_user'] = 'usuario/newUser';
$route['confirm_register'] = 'useractivation/confirm';
$route['reconfirm_register/(:num)'] = 'useractivation/reconfirmRegister/$1/';
$route['cancel_register/(:num)'] = 'useractivation/cancelRegister/$1/';
$route['configuracoes'] = 'settings';
$route['cursos'] = 'course/index';
$route['departamentos'] = 'departamento/formulario';
Expand Down Expand Up @@ -99,7 +104,7 @@
* Student functionalities routes
*/
$route['student'] = 'student/index';
$route['student_information'] = 'usuario/studentInformationsForm';
$route['student_information'] = 'student/studentInformation';
$route['documents_request'] = "documentrequest/index";

/*
Expand All @@ -125,6 +130,12 @@
$route['selection_process_test'] = 'tests/SelectionProcess_Test';
$route['process_settings_test'] = 'tests/ProcessSettings_Test';
$route['process_phase_test'] = 'tests/ProcessPhase_Test';
$route['email_notification_test'] = 'tests/EmailNotification_Test';
$route['restore_password_email_test'] = 'tests/RestorePasswordEmail_Test';
$route['enrolled_student_email_test'] = 'tests/EnrolledStudentEmail_Test';
$route['secretary_email_notification_test'] = 'tests/SecretaryEmailNotification_Test';
$route['phone_test'] = 'tests/Phone_Test';
$route['bar_notification_test'] = 'tests/BarNotification_Test';
// $route['test'] = 'test_report';

/* End of file routes.php */
Expand Down
8 changes: 8 additions & 0 deletions application/constants/EmailConstants.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
require_once('Constants.php');

class EmailConstants extends Constants{

const SENDER_NAME = "SiGA";
const SENDER_EMAIL = "[email protected]";
}
8 changes: 0 additions & 8 deletions application/controllers/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@
class Admin extends CI_Controller {

public function index() {
$usuario = array(
'nome' => 'admin',
'email' => '[email protected]',
'login' => 'admin',
'senha' => 'random'
);

$this->session->set_userdata("current_user", $usuario);
redirect('/');
}

}
82 changes: 82 additions & 0 deletions application/controllers/ajax/enrollmentajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

require_once(APPPATH."/controllers/usuario.php");
require_once(APPPATH."/constants/GroupConstants.php");
require_once(APPPATH."/controllers/offer.php");
require_once(APPPATH."/controllers/discipline.php");
require_once(APPPATH."/controllers/semester.php");

class EnrollmentAjax extends CI_Controller {

Expand Down Expand Up @@ -46,4 +49,83 @@ public function searchGuestUsersToEnroll(){
}
}

public function searchDisciplinesToRequest(){

$disciplineName = $this->input->post('disciplineName');
$courseId = $this->input->post('courseId');
$userId = $this->input->post('userId');

// Semester data
$semester = new Semester();
$currentSemester = $semester->getCurrentSemester();
$semesterId = $currentSemester['id_semester'];

// Offer data
$offer = new Offer();
$courseOffer = $offer->getOfferBySemesterAndCourse($semesterId, $courseId);

$disciplinesClasses = FALSE;
if($courseOffer !== FALSE){

$offerId = $courseOffer['id_offer'];

$discipline = new Discipline();
$disciplinesClasses = $discipline->getClassesByDisciplineName($disciplineName, $offerId);

}else{
$disciplineClasses = FALSE;
}

if($disciplinesClasses !== FALSE){

echo "<div class=\"box-body table-responsive no-padding\">";
echo "<table class=\"table table-bordered table-hover\">";
echo "<tbody>";

echo "<tr>";
echo "<th class=\"text-center\">Código</th>";
echo "<th class=\"text-center\">Disciplina</th>";
echo "<th class=\"text-center\">Turma</th>";
echo "<th class=\"text-center\">Vagas restantes</th>";
echo "<th class=\"text-center\">Ações</th>";
echo "</tr>";

foreach($disciplinesClasses as $class){
echo "<tr>";
echo "<td>";
echo $class['id_offer_discipline'];
echo "</td>";

echo "<td>";
echo $class['discipline_name']."-".$class["name_abbreviation"];
echo "</td>";

echo "<td>";
echo $class['class'];
echo "</td>";

echo "<td>";
echo $class['current_vacancies'];
echo "</td>";

echo "<td>";
echo anchor("temporaryrequest/addTempDisciplineToRequest/{$class['id_offer_discipline']}/{$courseId}/{$userId}","Adicionar à matrícula", "class='btn btn-primary'");
echo "</td>";
echo "</tr>";
}

echo "</tbody>";
echo "</table>";
echo "</div>";

}else{

echo "<div class='callout callout-info'>";
echo "<h4>Não foram encontradas disciplinas com o nome '".$disciplineName."' para a oferta do semestre atual.</h4>";
echo "<p>Confira se a lista de oferta do semestre atual já foi aprovada.</p>";
echo "</div>";
}
}


}
14 changes: 14 additions & 0 deletions application/controllers/ajax/notificationajax.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

require_once(APPPATH."/libraries/NotificationModel.php");

class NotificationAjax extends CI_Controller {

public function setNotificationSeen(){

$notificationId = $this->input->post("notification");

$this->db->where(NotificationModel::ID_COLUMN, $notificationId);
$this->db->update(NotificationModel::NOTIFICATION_TABLE, array(NotificationModel::SEEN_COLUMN => TRUE));
}
}
167 changes: 167 additions & 0 deletions application/controllers/ajax/paymentajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

class PaymentAjax extends CI_Controller {

const MAX_INSTALLMENTS = 5;
const MAX_TOTAL_VALUE = 8000;

public function newStaffPaymentForm(){

$employeeName = $this->input->post("employeeName");
Expand Down Expand Up @@ -63,4 +66,168 @@ public function newStaffPaymentForm(){
}
}

// Used in an ajax post
public function checkInstallmentQuantity(){

$totalValue = (float) $this->input->post("totalValue");
$installments = (float) $this->input->post("installments");

if($totalValue <= self::MAX_TOTAL_VALUE){

if($installments != 0){

// Max of installments is 5
if($installments > self::MAX_INSTALLMENTS){
$installments = self::MAX_INSTALLMENTS;
}

$installmentsValue = $totalValue / $installments;
$installmentsValue = round($installmentsValue, 2);
}else{
$installmentsValue = $totalValue;
$installmentsValue = round($installmentsValue, 2);
}

echo "<div class='box-body table-responsive no-padding'>";
echo "<table class='table table-bordered table-hover'>";
echo "<tbody>";
echo "<tr>";
echo "<th class='text-center'>Nº da parcela</th>";
echo "<th class='text-center'>Data</th>";
echo "<th class='text-center'>Valor</th>";
echo "<th class='text-center'>Horas trabalhadas</th>";
echo "</tr>";

for($installment = 1; $installment <= $installments; $installment++){

echo "<tr>";

echo "<td>";
echo $installment;
echo "</td>";

$installmentDate = array(
"name" => "installment_date_".$installment,
"id" => "installment_date_".$installment,
"type" => "text",
"class" => "form-campo",
"class" => "form-control"
);

echo "<td>";
echo form_input($installmentDate);
echo "</td>";

$installmentValue = array(
"name" => "installment_value_".$installment,
"id" => "installment_value_".$installment,
"type" => "number",
"class" => "form-campo",
"class" => "form-control",
"value" => $installmentsValue,
"min" => 0,
"step" => 0.01
);

echo "<td>";
echo form_input($installmentValue);
echo "</td>";

$installmentHours = array(
"name" => "installment_hour_".$installment,
"id" => "installment_hour_".$installment,
"type" => "number",
"class" => "form-campo",
"class" => "form-control",
"min" => 0,
"step" => 1
);

echo "<td>";
echo form_input($installmentHours);
echo "</td>";

echo "</tr>";
}

echo "</tbody>";
echo "</table>";
echo "</div>";
}else{

}
}

// Used in an ajax post
public function checkInstallmentValues(){

$totalValue = (float) $this->input->post("totalValue");
$totalValue = round($totalValue, 2);

$installment1 = (float) $this->input->post("installment1");
$installment2 = (float) $this->input->post("installment2");
$installment3 = (float) $this->input->post("installment3");
$installment4 = (float) $this->input->post("installment4");
$installment5 = (float) $this->input->post("installment5");

$installmentTotal = $installment1 + $installment2 + $installment3 + $installment4 + $installment5;

$installmentTotal = round($installmentTotal, 2);

if($totalValue <= self::MAX_TOTAL_VALUE){

if($installmentTotal > $totalValue){

$result = "<div class='callout callout-danger'>";
$result .= "<h4>";
$result .= "O total das parcelas <b>está excendo</b> o valor total do serviço.";
$result .= "</h4>";
$result .= "<p>Valor total das parcelas atual: <b> R$ ".$installmentTotal."</b></p>";
$result .= "<p>Valor total atual do serviço: <b> R$ ".$totalValue."</b></p>";
$result .= "</div>";
}elseif($installmentTotal < $totalValue){

$result = "<div class='callout callout-danger'>";
$result .= "<h4>";
$result .= "O total das parcelas <b>está menor</b> que o valor total do serviço.";
$result .= "</h4>";
$result .= "<p>Valor total das parcelas atual: <b> R$ ".$installmentTotal."</b></p>";
$result .= "<p>Valor total atual do serviço: <b> R$ ".$totalValue."</b></p>";
$result .= "</div>";
}else{

$submitBtn = array(
"id" => "new_payment",
"class" => "btn bg-olive btn-block",
"content" => "Cadastrar pagamento",
"type" => "submit"
);

$result = "<div class='callout callout-info'>";
$result .= "<h4>";
$result .= "O valor das parcelas estão OK!";
$result .= "</h4>";
$result .= "</div>";

$result .= "<div class='row'>";
$result .= "<div class='col-lg-9'>";
$result .= "</div>";
$result .= "<div class='col-lg-3'>";
$result .= form_button($submitBtn);
$result .= "</div>";
$result .= "</div>";
}
}else{

$result = "<div class='callout callout-danger'>";
$result .= "<h4>";
$result .= "O valor total não pode exceder R$ 8000,00.";
$result .= "</h4>";
$result .= "<p>Valor total atual: <b>R$ ".$totalValue."</b></p>";
$result .= "</div>";
}

echo $result;
}

}
Loading

0 comments on commit caef790

Please sign in to comment.