Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/Class refactoring #512

Open
wants to merge 45 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
4a48003
feito correções no código para agradar o sonar lint
Tori-IPTI Oct 10, 2023
8b23c86
feito correção da tela de turma. Falta apenas modal e pequena correçã…
Tori-IPTI Oct 11, 2023
2e7e5ba
feito correção do modal. falta salvar
Tori-IPTI Oct 13, 2023
282d4b9
feito correção de dialog, falta arrumar o role
Tori-IPTI Oct 16, 2023
789d002
feito correção do modal, falta limpar o modal depos de adicionar prof…
Tori-IPTI Oct 17, 2023
71fd295
feito correção de turma
Tori-IPTI Oct 18, 2023
09f0c67
feito alteração
Tori-IPTI Oct 20, 2023
e0e7c61
Merge branch 'dev' into class_refactoring
Tori-IPTI Oct 24, 2023
38f9d99
retirado console.log
Tori-IPTI Oct 24, 2023
2828771
tentantiva falha de consertar o diario
Tori-IPTI Oct 24, 2023
ffc2689
commit
Tori-IPTI Oct 26, 2023
2abfcd9
corrigido erro em ordem de alunos
Tori-IPTI Oct 26, 2023
3f74382
feito correção de atributos
Tori-IPTI Oct 30, 2023
729ad95
retirado antigo modal
Tori-IPTI Nov 1, 2023
73b2e78
Merge branch 'dev' into class_refactoring
igorgoncalves Nov 1, 2023
6ae3e37
fix: remove localhost on verification
igorgoncalves Nov 3, 2023
c79bf05
correção do select e feito merge
Tori-IPTI Nov 3, 2023
7b074bb
feito correções baseado no sonar lint
Tori-IPTI Nov 3, 2023
860b453
feito correções de pull request, falta corrigir erro em deletar profe…
Tori-IPTI Nov 17, 2023
e66b5fd
Merge branch 'dev' into class_refactoring
Tori-IPTI Nov 21, 2023
c29d34b
Merge branch 'dev' into class_refactoring
Tori-IPTI Nov 22, 2023
e6f6fa6
rodado o cahorro
Tori-IPTI Nov 22, 2023
089fba6
feito correção na turma
Tori-IPTI Nov 24, 2023
8665a54
organizando a paginação
Tori-IPTI Nov 27, 2023
326de35
feito correção
Tori-IPTI Nov 28, 2023
c99b873
feito alterações na tab
Tori-IPTI Nov 29, 2023
0bd4453
feito correão
Tori-IPTI Nov 29, 2023
1b40734
Feito correção nas tabs
Tori-IPTI Nov 30, 2023
41b05a1
Merge branch 'dev' into class_refactoring
Tori-IPTI Dec 11, 2023
fe5081b
feito merge, falta corrigir paginação e testar SEDSP
Tori-IPTI Dec 11, 2023
cd2548d
Revert "Feito correção nas tabs"
Tori-IPTI Dec 13, 2023
22fbd4d
revertido o form
Tori-IPTI Dec 13, 2023
d3752ce
resetado alterações
Tori-IPTI Dec 13, 2023
8d1d807
Merge branch 'class_refactoring' of https://github.com/ipti/br.tag in…
Tori-IPTI Dec 13, 2023
ce03fa9
commit antes do merge
Tori-IPTI Dec 15, 2023
a34b6af
commit antes do merge
Tori-IPTI Dec 15, 2023
3155816
Merge branch 'dev' into class_refactoring
Tori-IPTI Dec 18, 2023
135b8ec
merge com a dev
Tori-IPTI Dec 18, 2023
b0c817d
feito correção
Tori-IPTI Dec 19, 2023
5a3c4a7
Merge branch 'dev' into class_refactoring
Tori-IPTI Dec 19, 2023
6a2438d
feito correções para agradar o sonar cloud
Tori-IPTI Dec 19, 2023
690bd5d
feito correções para agradar o sonar cloud
Tori-IPTI Dec 19, 2023
4a3bb05
feito correções para agradar o sonar cloud
Tori-IPTI Dec 19, 2023
44dccd9
feito correção quanto ao modal
Tori-IPTI Dec 19, 2023
61f9845
Merge branch 'dev' into class_refactoring
igorgoncalves Dec 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/components/utils/TagUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static function isInstance($instance){
return in_array(strtoupper(INSTANCE), $instances);
}

return strtoupper(INSTANCE) === strtoupper($instance) || INSTANCE === "LOCALHOST";
return strtoupper(INSTANCE) === strtoupper($instance);
}
}

Expand Down
142 changes: 112 additions & 30 deletions app/controllers/ClassesController.php

Large diffs are not rendered by default.

52 changes: 32 additions & 20 deletions app/controllers/ClassroomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,30 @@ public function filters()
public function accessRules()
{
return array(
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions' => array('index', 'view', 'create', 'update', 'getassistancetype',
array(
'allow', // allow authenticated user to perform 'create' and 'update' actions
'actions' => array(
'index', 'view', 'create', 'update', 'getassistancetype',
'updateassistancetypedependencies', 'updatecomplementaryactivity',
'batchupdatenrollment',
'getcomplementaryactivitytype', 'delete',
'updateTime', 'move', 'batchupdate', 'batchupdatetotal', 'changeenrollments', 'batchupdatetransport', 'updateDisciplines', 'syncToSedsp', 'syncUnsyncedStudents'
),
'users' => array('@'),
),
array('allow', // allow admin user to perform 'admin' and 'delete' actions
array(
'allow', // allow admin user to perform 'admin' and 'delete' actions
'actions' => array('admin'),
'users' => array('admin'),
),
array('deny', // deny all users
array(
'deny', // deny all users
'users' => array('*'),
),
);
}


private function defineAssistanceType($classroom)
{
$isAee = $classroom['aee'];
Expand All @@ -77,6 +82,7 @@ private function defineAssistanceType($classroom)
return 4;
}
if (isset($isSchooling) && $isSchooling) {

return 0;
}
}
Expand All @@ -97,7 +103,8 @@ public function actionGetAssistanceType()
2 => CHtml::encode('Unidade de Internação Socioeducativa'),
3 => CHtml::encode('Unidade Prisional'),
4 => CHtml::encode('Atividade Complementar'),
5 => CHtml::encode('Atendimento Educacional Especializado (AEE)'));
5 => CHtml::encode('Atendimento Educacional Especializado (AEE)')
);

$selected = array(
0 => $classroom->assistance_type == 0 ? "selected" : "deselected",
Expand Down Expand Up @@ -192,7 +199,7 @@ public function actionUpdateAssistanceTypeDependencies()
$result['StageEmpty'] = false;
if ($at == 0 || $at == 1) {
$data = EdcensoStageVsModality::model()->findAll($where);
} else if ($at == 2 || $at == 3) {
} elseif ($at == 2 || $at == 3) {
$data = EdcensoStageVsModality::model()->findAll('id!=1 && id!=2 && id!=3 && id!=56 ' . $where);
} else {
$data = array();
Expand Down Expand Up @@ -523,7 +530,6 @@ public function actionCreate()
$modelClassroom->sedsp_sync = 0;
$modelClassroom->assistance_type = $this->defineAssistanceType($modelClassroom);


if ($modelClassroom->week_days_sunday || $modelClassroom->week_days_monday || $modelClassroom->week_days_tuesday || $modelClassroom->week_days_wednesday || $modelClassroom->week_days_thursday || $modelClassroom->week_days_friday || $modelClassroom->week_days_saturday) {

if ($modelClassroom->validate() && $modelClassroom->save()) {
Expand All @@ -544,6 +550,7 @@ public function actionCreate()
$teachingDataValidated = $teachingDataValidated && $modelTeachingData[$key]->validate();
}


if ($teachingDataValidated) {
foreach ($modelTeachingData as $key => $td) {
if ($saved) {
Expand Down Expand Up @@ -673,8 +680,11 @@ public function actionUpdate($id)
$beforeChangeClassroom = new Classroom();
$beforeChangeClassroom->attributes = $modelClassroom->attributes;
$modelClassroom->attributes = $_POST['Classroom'];


$modelClassroom->assistance_type = $this->defineAssistanceType($modelClassroom);


if (Yii::app()->features->isEnable("FEAT_SEDSP") && !$disableFieldsWhenItsUBATUBA) {

if (
Expand All @@ -698,6 +708,7 @@ public function actionUpdate($id)
}
}


$disciplines = json_decode($_POST['disciplines'], true);
$this->setDisciplines($modelClassroom, $disciplines);
$hasWeekDaySelected = $modelClassroom->week_days_sunday ||
Expand Down Expand Up @@ -798,7 +809,6 @@ public function actionDelete($id)
{
$classroom = $this->loadModel($id, $this->MODEL_CLASSROOM);
$teachingDatas = $this->loadModel($id, $this->MODEL_TEACHING_DATA);

$ableToDelete = true;
if (Yii::app()->features->isEnable("FEAT_SEDSP")) {
if ($classroom->gov_id !== null) {
Expand Down Expand Up @@ -925,11 +935,11 @@ public function loadModel($id, $model)
array_push($complementaryActivitiesArray, $return->complementary_activity_type_6);
}
$return->complementary_activity_type_1 = $complementaryActivitiesArray;
} else if ($model == $this->MODEL_TEACHING_DATA) {
} elseif ($model == $this->MODEL_TEACHING_DATA) {
$classroom = $id;
$instructors = InstructorTeachingData::model()->findAll('classroom_id_fk = ' . $classroom);
$return = $instructors;
} else if ($model == $this->MODEL_STUDENT_ENROLLMENT) {
} elseif ($model == $this->MODEL_STUDENT_ENROLLMENT) {
$classroom = $id;
$student = StudentEnrollment::model()->findAll('classroom_fk = ' . $classroom);
$return = $student;
Expand Down Expand Up @@ -962,13 +972,13 @@ public function actionUpdateTime()
if ($turn == "M") {
$return['first'] = $config->morning_initial;
$return['last'] = $config->morning_final;
} else if ($turn == "T") {
} elseif ($turn == "T") {
$return['first'] = $config->afternoom_initial;
$return['last'] = $config->afternoom_final;
} else if ($turn == "N") {
} elseif ($turn == "N") {
$return['first'] = $config->night_initial;
$return['last'] = $config->night_final;
} else if ($turn == "I") {
} elseif ($turn == "I") {
$return['first'] = $config->allday_initial;
$return['last'] = $config->allday_final;
}
Expand All @@ -992,13 +1002,14 @@ public function actionUpdateDisciplines()

public function actionChangeEnrollments()
{

$ids = $_POST['list'];
$enrollments = StudentEnrollment::model()->findAllByPk($ids);

usort($enrollments, function ($a, $b) use ($ids) {
$pos_a = array_search($a->id, $ids);
$pos_b = array_search($b->id, $ids);
return $pos_a - $pos_b;
$posA = array_search($a->id, $ids);
$posB = array_search($b->id, $ids);
return $posA - $posB;
});

foreach ($enrollments as $i => $enrollment) {
Expand All @@ -1007,12 +1018,13 @@ public function actionChangeEnrollments()
}
;
$result = array_map(function ($enrollment) {
return ["id" => $enrollment->id, "name" => $enrollment->studentFk->name,
"daily_order" => $enrollment->daily_order];
return [
"id" => $enrollment->id, "name" => $enrollment->studentFk->name,
"daily_order" => $enrollment->daily_order
];
}, $enrollments);

echo json_encode($result);
/* Yii::app()->user->setFlash('success', Yii::t('default', 'dayli order')); */
echo json_encode($result);
}

public function actionSyncUnsyncedStudents()
Expand Down
Loading
Loading