Commit 85de1e32bd9da71051be4fa005abc40fc53c7337

Authored by Eder Soares
Committed by GitHub
2 parents 8af6a3a2 98cab6e2
Exists in 2.8 and in 6 other branches 2.2, 2.3, 2.4, 2.5, 2.6, 2.7

Merge pull request #649 from portabilis/portabilis-patch-2019-08-30

[2.2] Portabilis patch 30/08/2019
Showing 36 changed files with 1674 additions and 1607 deletions   Show diff stats
app/Http/Controllers/EnrollmentController.php
... ... @@ -10,6 +10,7 @@ use Carbon\Carbon;
10 10 use Illuminate\Http\RedirectResponse;
11 11 use Illuminate\View\View;
12 12 use Throwable;
  13 +use Illuminate\Support\Facades\DB;
13 14  
14 15 class EnrollmentController extends Controller
15 16 {
... ... @@ -59,6 +60,7 @@ class EnrollmentController extends Controller
59 60 LegacyRegistration $registration,
60 61 LegacySchoolClass $schoolClass
61 62 ) {
  63 + DB::beginTransaction();
62 64 $date = Carbon::createFromFormat('d/m/Y', $request->input('enrollment_date'));
63 65  
64 66 if ($request->input('is_relocation') || $request->input('is_cancellation')) {
... ... @@ -68,20 +70,31 @@ class EnrollmentController extends Controller
68 70 try {
69 71 $enrollmentService->cancelEnrollment($enrollment, $date);
70 72 } catch (Throwable $throwable) {
  73 + DB::rollback();
71 74 return redirect()->back()->with('error', $throwable->getMessage());
72 75 }
73 76 }
74 77  
75 78 if ($request->input('is_cancellation')) {
  79 + DB::commit();
76 80 return redirect('/intranet/educar_matricula_det.php?cod_matricula=' . $registration->id)->with('success', 'Enturmação feita com sucesso.');
77 81 }
78 82  
  83 + $previousEnrollment = $enrollmentService->getPreviousEnrollmentAccordingToRelocationDate($registration);
  84 +
  85 + if ($request->input('is_relocation') && $previousEnrollment) {
  86 + $enrollmentService->markAsRelocated($previousEnrollment);
  87 + }
  88 +
79 89 try {
80 90 $enrollmentService->enroll($registration, $schoolClass, $date);
81 91 } catch (Throwable $throwable) {
  92 + DB::rollback();
82 93 return redirect()->back()->with('error', $throwable->getMessage());
83 94 }
84 95  
  96 + DB::commit();
  97 +
85 98 return redirect('/intranet/educar_matricula_det.php?cod_matricula=' . $registration->id)->with('success', 'Enturmação feita com sucesso.');
86 99 }
87 100 }
... ...
app/Menu.php
... ... @@ -276,4 +276,27 @@ class Menu extends Model
276 276 ->orderBy('order')
277 277 ->get();
278 278 }
  279 +
  280 + /**
  281 + * Retorna os menus disponíveis para o usuário baseado em seu nível de
  282 + * permissão.
  283 + *
  284 + * @param User $user
  285 + * @param string $search
  286 + *
  287 + * @return LaravelCollection
  288 + */
  289 + public static function findByUser(User $user, $search)
  290 + {
  291 + $query = $user->isAdmin() ? static::query() : $user->menu();
  292 +
  293 + return $query->whereNotNull('link')
  294 + ->where(function ($query) use ($search) {
  295 + $query->orWhere('title', 'ilike', "%{$search}%");
  296 + $query->orWhere('description', 'ilike', "%{$search}%");
  297 + })
  298 + ->orderBy('title')
  299 + ->limit(15)
  300 + ->get();
  301 + }
279 302 }
... ...
app/Services/EnrollmentService.php
... ... @@ -210,12 +210,6 @@ class EnrollmentService
210 210 throw new ExistsActiveEnrollmentSameTimeException($registration);
211 211 }
212 212  
213   - $previousEnrollment = $this->getPreviousEnrollment($registration);
214   -
215   - if ($previousEnrollment) {
216   - $this->markAsRelocated($previousEnrollment);
217   - }
218   -
219 213 $sequenceInSchoolClass = $this->getSequenceSchoolClass($registration, $schoolClass, $date);
220 214  
221 215 /** @var LegacyEnrollment $enrollment */
... ... @@ -237,7 +231,7 @@ class EnrollmentService
237 231 * @param LegacyEnrollment $enrollment
238 232 * @throws Throwable
239 233 */
240   - private function markAsRelocated(LegacyEnrollment $enrollment)
  234 + public function markAsRelocated(LegacyEnrollment $enrollment)
241 235 {
242 236 $enrollment->remanejado = true;
243 237 $enrollment->saveOrFail();
... ... @@ -250,7 +244,7 @@ class EnrollmentService
250 244 * @param LegacyRegistration $registration
251 245 * @return LegacyEnrollment|void
252 246 */
253   - private function getPreviousEnrollment(LegacyRegistration $registration)
  247 + public function getPreviousEnrollmentAccordingToRelocationDate(LegacyRegistration $registration)
254 248 {
255 249 $previousEnrollment = $registration->lastEnrollment;
256 250  
... ...
app/Services/PromotionService.php 0 → 100644
... ... @@ -0,0 +1,51 @@
  1 +<?php
  2 +
  3 +namespace App\Services;
  4 +
  5 +use App\Models\LegacyEnrollment;
  6 +use CoreExt_Controller_Request;
  7 +use CoreExt_Exception;
  8 +use PromocaoApiController;
  9 +
  10 +class PromotionService
  11 +{
  12 + /**
  13 + * @var LegacyEnrollment
  14 + */
  15 + private $enrollment;
  16 +
  17 + public function __construct(LegacyEnrollment $enrollment)
  18 + {
  19 + $this->enrollment = $enrollment;
  20 + }
  21 +
  22 + public function fakeRequest()
  23 + {
  24 + $fakeRequest = new CoreExt_Controller_Request(
  25 + [
  26 + 'data' => [
  27 + 'oper' => 'post',
  28 + 'resource' => 'promocao',
  29 + 'matricula_id' => $this->enrollment->ref_cod_matricula,
  30 + 'instituicao_id' => $this->enrollment->schoolClass->school->ref_cod_instituicao,
  31 + 'ano' => $this->enrollment->registration->ano,
  32 + 'escola' => $this->enrollment->schoolClass->school_id,
  33 + 'curso' => $this->enrollment->schoolClass->ref_cod_curso,
  34 + 'serie' => $this->enrollment->schoolClass->ref_ref_cod_serie,
  35 + 'turma' => $this->enrollment->ref_cod_turma
  36 + ]
  37 + ]);
  38 +
  39 + $promocaoApi = new PromocaoApiController();
  40 + $promocaoApi->setRequest($fakeRequest);
  41 +
  42 + try {
  43 + $promocaoApi->Gerar();
  44 + } catch (CoreExt_Exception $exception) {
  45 + // Quando o aluno não possuir enturmação na escola que está
  46 + // cancelando a matrícula, uma Exception era lançada ao
  47 + // instanciar o ServiceBoletim, este catch garante que não irá
  48 + // quebrar o processo.
  49 + }
  50 + }
  51 +}
... ...
app/User.php
... ... @@ -118,6 +118,14 @@ class User extends Authenticatable
118 118 }
119 119  
120 120 /**
  121 + * @return int
  122 + */
  123 + public function getLevel()
  124 + {
  125 + return $this->type->level;
  126 + }
  127 +
  128 + /**
121 129 * @return BelongsTo
122 130 */
123 131 public function type()
... ...
composer.json
... ... @@ -3,7 +3,7 @@
3 3 "description": "Software livre de gestão escolar",
4 4 "type": "project",
5 5 "license": "GPL-2.0-or-later",
6   - "version": "2.2.2",
  6 + "version": "2.2.3",
7 7 "keywords": [
8 8 "Portabilis",
9 9 "i-Educar"
... ...
composer.lock
... ... @@ -4,20 +4,20 @@
4 4 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5 5 "This file is @generated automatically"
6 6 ],
7   - "content-hash": "119eaf4c569490bff8215509cadd8948",
  7 + "content-hash": "747e370c8b2d6a62bcd14312c437c072",
8 8 "packages": [
9 9 {
10 10 "name": "aws/aws-sdk-php",
11   - "version": "3.110.2",
  11 + "version": "3.110.7",
12 12 "source": {
13 13 "type": "git",
14 14 "url": "https://github.com/aws/aws-sdk-php.git",
15   - "reference": "b39e6c8c3082f0f1f6672a6bd2aba92cfc38da9a"
  15 + "reference": "57d9dd171a5afe0b48ce44f05be2d8875c2f7b34"
16 16 },
17 17 "dist": {
18 18 "type": "zip",
19   - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/b39e6c8c3082f0f1f6672a6bd2aba92cfc38da9a",
20   - "reference": "b39e6c8c3082f0f1f6672a6bd2aba92cfc38da9a",
  19 + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/57d9dd171a5afe0b48ce44f05be2d8875c2f7b34",
  20 + "reference": "57d9dd171a5afe0b48ce44f05be2d8875c2f7b34",
21 21 "shasum": ""
22 22 },
23 23 "require": {
... ... @@ -87,7 +87,7 @@
87 87 "s3",
88 88 "sdk"
89 89 ],
90   - "time": "2019-08-23T18:12:25+00:00"
  90 + "time": "2019-08-30T18:07:59+00:00"
91 91 },
92 92 {
93 93 "name": "cocur/slugify",
... ... @@ -1310,16 +1310,16 @@
1310 1310 },
1311 1311 {
1312 1312 "name": "laravel/framework",
1313   - "version": "v5.8.33",
  1313 + "version": "v5.8.34",
1314 1314 "source": {
1315 1315 "type": "git",
1316 1316 "url": "https://github.com/laravel/framework.git",
1317   - "reference": "58b81842cbdcfbbd8302790ac0f98119ea1c56e5"
  1317 + "reference": "c3a870b96c7afe5174f486af74768ccfddeec77b"
1318 1318 },
1319 1319 "dist": {
1320 1320 "type": "zip",
1321   - "url": "https://api.github.com/repos/laravel/framework/zipball/58b81842cbdcfbbd8302790ac0f98119ea1c56e5",
1322   - "reference": "58b81842cbdcfbbd8302790ac0f98119ea1c56e5",
  1321 + "url": "https://api.github.com/repos/laravel/framework/zipball/c3a870b96c7afe5174f486af74768ccfddeec77b",
  1322 + "reference": "c3a870b96c7afe5174f486af74768ccfddeec77b",
1323 1323 "shasum": ""
1324 1324 },
1325 1325 "require": {
... ... @@ -1453,7 +1453,7 @@
1453 1453 "framework",
1454 1454 "laravel"
1455 1455 ],
1456   - "time": "2019-08-20T15:45:17+00:00"
  1456 + "time": "2019-08-27T14:35:59+00:00"
1457 1457 },
1458 1458 {
1459 1459 "name": "laravel/tinker",
... ... @@ -3132,16 +3132,16 @@
3132 3132 },
3133 3133 {
3134 3134 "name": "symfony/console",
3135   - "version": "v4.3.3",
  3135 + "version": "v4.3.4",
3136 3136 "source": {
3137 3137 "type": "git",
3138 3138 "url": "https://github.com/symfony/console.git",
3139   - "reference": "8b0ae5742ce9aaa8b0075665862c1ca397d1c1d9"
  3139 + "reference": "de63799239b3881b8a08f8481b22348f77ed7b36"
3140 3140 },
3141 3141 "dist": {
3142 3142 "type": "zip",
3143   - "url": "https://api.github.com/repos/symfony/console/zipball/8b0ae5742ce9aaa8b0075665862c1ca397d1c1d9",
3144   - "reference": "8b0ae5742ce9aaa8b0075665862c1ca397d1c1d9",
  3143 + "url": "https://api.github.com/repos/symfony/console/zipball/de63799239b3881b8a08f8481b22348f77ed7b36",
  3144 + "reference": "de63799239b3881b8a08f8481b22348f77ed7b36",
3145 3145 "shasum": ""
3146 3146 },
3147 3147 "require": {
... ... @@ -3203,20 +3203,20 @@
3203 3203 ],
3204 3204 "description": "Symfony Console Component",
3205 3205 "homepage": "https://symfony.com",
3206   - "time": "2019-07-24T17:13:59+00:00"
  3206 + "time": "2019-08-26T08:26:39+00:00"
3207 3207 },
3208 3208 {
3209 3209 "name": "symfony/css-selector",
3210   - "version": "v4.3.3",
  3210 + "version": "v4.3.4",
3211 3211 "source": {
3212 3212 "type": "git",
3213 3213 "url": "https://github.com/symfony/css-selector.git",
3214   - "reference": "105c98bb0c5d8635bea056135304bd8edcc42b4d"
  3214 + "reference": "c6e5e2a00db768c92c3ae131532af4e1acc7bd03"
3215 3215 },
3216 3216 "dist": {
3217 3217 "type": "zip",
3218   - "url": "https://api.github.com/repos/symfony/css-selector/zipball/105c98bb0c5d8635bea056135304bd8edcc42b4d",
3219   - "reference": "105c98bb0c5d8635bea056135304bd8edcc42b4d",
  3218 + "url": "https://api.github.com/repos/symfony/css-selector/zipball/c6e5e2a00db768c92c3ae131532af4e1acc7bd03",
  3219 + "reference": "c6e5e2a00db768c92c3ae131532af4e1acc7bd03",
3220 3220 "shasum": ""
3221 3221 },
3222 3222 "require": {
... ... @@ -3256,20 +3256,20 @@
3256 3256 ],
3257 3257 "description": "Symfony CssSelector Component",
3258 3258 "homepage": "https://symfony.com",
3259   - "time": "2019-01-16T21:53:39+00:00"
  3259 + "time": "2019-08-20T14:07:54+00:00"
3260 3260 },
3261 3261 {
3262 3262 "name": "symfony/debug",
3263   - "version": "v4.3.3",
  3263 + "version": "v4.3.4",
3264 3264 "source": {
3265 3265 "type": "git",
3266 3266 "url": "https://github.com/symfony/debug.git",
3267   - "reference": "527887c3858a2462b0137662c74837288b998ee3"
  3267 + "reference": "afcdea44a2e399c1e4b52246ec8d54c715393ced"
3268 3268 },
3269 3269 "dist": {
3270 3270 "type": "zip",
3271   - "url": "https://api.github.com/repos/symfony/debug/zipball/527887c3858a2462b0137662c74837288b998ee3",
3272   - "reference": "527887c3858a2462b0137662c74837288b998ee3",
  3271 + "url": "https://api.github.com/repos/symfony/debug/zipball/afcdea44a2e399c1e4b52246ec8d54c715393ced",
  3272 + "reference": "afcdea44a2e399c1e4b52246ec8d54c715393ced",
3273 3273 "shasum": ""
3274 3274 },
3275 3275 "require": {
... ... @@ -3312,20 +3312,20 @@
3312 3312 ],
3313 3313 "description": "Symfony Debug Component",
3314 3314 "homepage": "https://symfony.com",
3315   - "time": "2019-07-23T11:21:36+00:00"
  3315 + "time": "2019-08-20T14:27:59+00:00"
3316 3316 },
3317 3317 {
3318 3318 "name": "symfony/event-dispatcher",
3319   - "version": "v4.3.3",
  3319 + "version": "v4.3.4",
3320 3320 "source": {
3321 3321 "type": "git",
3322 3322 "url": "https://github.com/symfony/event-dispatcher.git",
3323   - "reference": "212b020949331b6531250584531363844b34a94e"
  3323 + "reference": "429d0a1451d4c9c4abe1959b2986b88794b9b7d2"
3324 3324 },
3325 3325 "dist": {
3326 3326 "type": "zip",
3327   - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/212b020949331b6531250584531363844b34a94e",
3328   - "reference": "212b020949331b6531250584531363844b34a94e",
  3327 + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/429d0a1451d4c9c4abe1959b2986b88794b9b7d2",
  3328 + "reference": "429d0a1451d4c9c4abe1959b2986b88794b9b7d2",
3329 3329 "shasum": ""
3330 3330 },
3331 3331 "require": {
... ... @@ -3382,7 +3382,7 @@
3382 3382 ],
3383 3383 "description": "Symfony EventDispatcher Component",
3384 3384 "homepage": "https://symfony.com",
3385   - "time": "2019-06-27T06:42:14+00:00"
  3385 + "time": "2019-08-26T08:55:16+00:00"
3386 3386 },
3387 3387 {
3388 3388 "name": "symfony/event-dispatcher-contracts",
... ... @@ -3444,16 +3444,16 @@
3444 3444 },
3445 3445 {
3446 3446 "name": "symfony/finder",
3447   - "version": "v4.3.3",
  3447 + "version": "v4.3.4",
3448 3448 "source": {
3449 3449 "type": "git",
3450 3450 "url": "https://github.com/symfony/finder.git",
3451   - "reference": "9638d41e3729459860bb96f6247ccb61faaa45f2"
  3451 + "reference": "86c1c929f0a4b24812e1eb109262fc3372c8e9f2"
3452 3452 },
3453 3453 "dist": {
3454 3454 "type": "zip",
3455   - "url": "https://api.github.com/repos/symfony/finder/zipball/9638d41e3729459860bb96f6247ccb61faaa45f2",
3456   - "reference": "9638d41e3729459860bb96f6247ccb61faaa45f2",
  3455 + "url": "https://api.github.com/repos/symfony/finder/zipball/86c1c929f0a4b24812e1eb109262fc3372c8e9f2",
  3456 + "reference": "86c1c929f0a4b24812e1eb109262fc3372c8e9f2",
3457 3457 "shasum": ""
3458 3458 },
3459 3459 "require": {
... ... @@ -3489,20 +3489,20 @@
3489 3489 ],
3490 3490 "description": "Symfony Finder Component",
3491 3491 "homepage": "https://symfony.com",
3492   - "time": "2019-06-28T13:16:30+00:00"
  3492 + "time": "2019-08-14T12:26:46+00:00"
3493 3493 },
3494 3494 {
3495 3495 "name": "symfony/http-foundation",
3496   - "version": "v4.3.3",
  3496 + "version": "v4.3.4",
3497 3497 "source": {
3498 3498 "type": "git",
3499 3499 "url": "https://github.com/symfony/http-foundation.git",
3500   - "reference": "8b778ee0c27731105fbf1535f51793ad1ae0ba2b"
  3500 + "reference": "d804bea118ff340a12e22a79f9c7e7eb56b35adc"
3501 3501 },
3502 3502 "dist": {
3503 3503 "type": "zip",
3504   - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/8b778ee0c27731105fbf1535f51793ad1ae0ba2b",
3505   - "reference": "8b778ee0c27731105fbf1535f51793ad1ae0ba2b",
  3504 + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/d804bea118ff340a12e22a79f9c7e7eb56b35adc",
  3505 + "reference": "d804bea118ff340a12e22a79f9c7e7eb56b35adc",
3506 3506 "shasum": ""
3507 3507 },
3508 3508 "require": {
... ... @@ -3544,20 +3544,20 @@
3544 3544 ],
3545 3545 "description": "Symfony HttpFoundation Component",
3546 3546 "homepage": "https://symfony.com",
3547   - "time": "2019-07-23T11:21:36+00:00"
  3547 + "time": "2019-08-26T08:55:16+00:00"
3548 3548 },
3549 3549 {
3550 3550 "name": "symfony/http-kernel",
3551   - "version": "v4.3.3",
  3551 + "version": "v4.3.4",
3552 3552 "source": {
3553 3553 "type": "git",
3554 3554 "url": "https://github.com/symfony/http-kernel.git",
3555   - "reference": "a414548d236ddd8fa3df52367d583e82339c5e95"
  3555 + "reference": "5e0fc71be03d52cd00c423061cfd300bd6f92a52"
3556 3556 },
3557 3557 "dist": {
3558 3558 "type": "zip",
3559   - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/a414548d236ddd8fa3df52367d583e82339c5e95",
3560   - "reference": "a414548d236ddd8fa3df52367d583e82339c5e95",
  3559 + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/5e0fc71be03d52cd00c423061cfd300bd6f92a52",
  3560 + "reference": "5e0fc71be03d52cd00c423061cfd300bd6f92a52",
3561 3561 "shasum": ""
3562 3562 },
3563 3563 "require": {
... ... @@ -3636,20 +3636,20 @@
3636 3636 ],
3637 3637 "description": "Symfony HttpKernel Component",
3638 3638 "homepage": "https://symfony.com",
3639   - "time": "2019-07-28T07:10:23+00:00"
  3639 + "time": "2019-08-26T16:47:42+00:00"
3640 3640 },
3641 3641 {
3642 3642 "name": "symfony/mime",
3643   - "version": "v4.3.3",
  3643 + "version": "v4.3.4",
3644 3644 "source": {
3645 3645 "type": "git",
3646 3646 "url": "https://github.com/symfony/mime.git",
3647   - "reference": "6b7148029b1dd5eda1502064f06d01357b7b2d8b"
  3647 + "reference": "987a05df1c6ac259b34008b932551353f4f408df"
3648 3648 },
3649 3649 "dist": {
3650 3650 "type": "zip",
3651   - "url": "https://api.github.com/repos/symfony/mime/zipball/6b7148029b1dd5eda1502064f06d01357b7b2d8b",
3652   - "reference": "6b7148029b1dd5eda1502064f06d01357b7b2d8b",
  3651 + "url": "https://api.github.com/repos/symfony/mime/zipball/987a05df1c6ac259b34008b932551353f4f408df",
  3652 + "reference": "987a05df1c6ac259b34008b932551353f4f408df",
3653 3653 "shasum": ""
3654 3654 },
3655 3655 "require": {
... ... @@ -3658,7 +3658,7 @@
3658 3658 "symfony/polyfill-mbstring": "^1.0"
3659 3659 },
3660 3660 "require-dev": {
3661   - "egulias/email-validator": "^2.0",
  3661 + "egulias/email-validator": "^2.1.10",
3662 3662 "symfony/dependency-injection": "~3.4|^4.1"
3663 3663 },
3664 3664 "type": "library",
... ... @@ -3695,7 +3695,7 @@
3695 3695 "mime",
3696 3696 "mime-type"
3697 3697 ],
3698   - "time": "2019-07-19T16:21:19+00:00"
  3698 + "time": "2019-08-22T08:16:11+00:00"
3699 3699 },
3700 3700 {
3701 3701 "name": "symfony/polyfill-ctype",
... ... @@ -4050,16 +4050,16 @@
4050 4050 },
4051 4051 {
4052 4052 "name": "symfony/process",
4053   - "version": "v4.3.3",
  4053 + "version": "v4.3.4",
4054 4054 "source": {
4055 4055 "type": "git",
4056 4056 "url": "https://github.com/symfony/process.git",
4057   - "reference": "856d35814cf287480465bb7a6c413bb7f5f5e69c"
  4057 + "reference": "e89969c00d762349f078db1128506f7f3dcc0d4a"
4058 4058 },
4059 4059 "dist": {
4060 4060 "type": "zip",
4061   - "url": "https://api.github.com/repos/symfony/process/zipball/856d35814cf287480465bb7a6c413bb7f5f5e69c",
4062   - "reference": "856d35814cf287480465bb7a6c413bb7f5f5e69c",
  4061 + "url": "https://api.github.com/repos/symfony/process/zipball/e89969c00d762349f078db1128506f7f3dcc0d4a",
  4062 + "reference": "e89969c00d762349f078db1128506f7f3dcc0d4a",
4063 4063 "shasum": ""
4064 4064 },
4065 4065 "require": {
... ... @@ -4095,20 +4095,20 @@
4095 4095 ],
4096 4096 "description": "Symfony Process Component",
4097 4097 "homepage": "https://symfony.com",
4098   - "time": "2019-05-30T16:10:05+00:00"
  4098 + "time": "2019-08-26T08:26:39+00:00"
4099 4099 },
4100 4100 {
4101 4101 "name": "symfony/routing",
4102   - "version": "v4.3.3",
  4102 + "version": "v4.3.4",
4103 4103 "source": {
4104 4104 "type": "git",
4105 4105 "url": "https://github.com/symfony/routing.git",
4106   - "reference": "a88c47a5861549f5dc1197660818084c3b67d773"
  4106 + "reference": "ff1049f6232dc5b6023b1ff1c6de56f82bcd264f"
4107 4107 },
4108 4108 "dist": {
4109 4109 "type": "zip",
4110   - "url": "https://api.github.com/repos/symfony/routing/zipball/a88c47a5861549f5dc1197660818084c3b67d773",
4111   - "reference": "a88c47a5861549f5dc1197660818084c3b67d773",
  4110 + "url": "https://api.github.com/repos/symfony/routing/zipball/ff1049f6232dc5b6023b1ff1c6de56f82bcd264f",
  4111 + "reference": "ff1049f6232dc5b6023b1ff1c6de56f82bcd264f",
4112 4112 "shasum": ""
4113 4113 },
4114 4114 "require": {
... ... @@ -4171,20 +4171,20 @@
4171 4171 "uri",
4172 4172 "url"
4173 4173 ],
4174   - "time": "2019-07-23T14:43:56+00:00"
  4174 + "time": "2019-08-26T08:26:39+00:00"
4175 4175 },
4176 4176 {
4177 4177 "name": "symfony/service-contracts",
4178   - "version": "v1.1.5",
  4178 + "version": "v1.1.6",
4179 4179 "source": {
4180 4180 "type": "git",
4181 4181 "url": "https://github.com/symfony/service-contracts.git",
4182   - "reference": "f391a00de78ec7ec8cf5cdcdae59ec7b883edb8d"
  4182 + "reference": "ea7263d6b6d5f798b56a45a5b8d686725f2719a3"
4183 4183 },
4184 4184 "dist": {
4185 4185 "type": "zip",
4186   - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f391a00de78ec7ec8cf5cdcdae59ec7b883edb8d",
4187   - "reference": "f391a00de78ec7ec8cf5cdcdae59ec7b883edb8d",
  4186 + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/ea7263d6b6d5f798b56a45a5b8d686725f2719a3",
  4187 + "reference": "ea7263d6b6d5f798b56a45a5b8d686725f2719a3",
4188 4188 "shasum": ""
4189 4189 },
4190 4190 "require": {
... ... @@ -4229,26 +4229,26 @@
4229 4229 "interoperability",
4230 4230 "standards"
4231 4231 ],
4232   - "time": "2019-06-13T11:15:36+00:00"
  4232 + "time": "2019-08-20T14:44:19+00:00"
4233 4233 },
4234 4234 {
4235 4235 "name": "symfony/translation",
4236   - "version": "v4.3.3",
  4236 + "version": "v4.3.4",
4237 4237 "source": {
4238 4238 "type": "git",
4239 4239 "url": "https://github.com/symfony/translation.git",
4240   - "reference": "4e3e39cc485304f807622bdc64938e4633396406"
  4240 + "reference": "28498169dd334095fa981827992f3a24d50fed0f"
4241 4241 },
4242 4242 "dist": {
4243 4243 "type": "zip",
4244   - "url": "https://api.github.com/repos/symfony/translation/zipball/4e3e39cc485304f807622bdc64938e4633396406",
4245   - "reference": "4e3e39cc485304f807622bdc64938e4633396406",
  4244 + "url": "https://api.github.com/repos/symfony/translation/zipball/28498169dd334095fa981827992f3a24d50fed0f",
  4245 + "reference": "28498169dd334095fa981827992f3a24d50fed0f",
4246 4246 "shasum": ""
4247 4247 },
4248 4248 "require": {
4249 4249 "php": "^7.1.3",
4250 4250 "symfony/polyfill-mbstring": "~1.0",
4251   - "symfony/translation-contracts": "^1.1.2"
  4251 + "symfony/translation-contracts": "^1.1.6"
4252 4252 },
4253 4253 "conflict": {
4254 4254 "symfony/config": "<3.4",
... ... @@ -4305,20 +4305,20 @@
4305 4305 ],
4306 4306 "description": "Symfony Translation Component",
4307 4307 "homepage": "https://symfony.com",
4308   - "time": "2019-07-18T10:34:59+00:00"
  4308 + "time": "2019-08-26T08:55:16+00:00"
4309 4309 },
4310 4310 {
4311 4311 "name": "symfony/translation-contracts",
4312   - "version": "v1.1.5",
  4312 + "version": "v1.1.6",
4313 4313 "source": {
4314 4314 "type": "git",
4315 4315 "url": "https://github.com/symfony/translation-contracts.git",
4316   - "reference": "cb4b18ad7b92a26e83b65dde940fab78339e6f3c"
  4316 + "reference": "325b17c24f3ee23cbecfa63ba809c6d89b5fa04a"
4317 4317 },
4318 4318 "dist": {
4319 4319 "type": "zip",
4320   - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/cb4b18ad7b92a26e83b65dde940fab78339e6f3c",
4321   - "reference": "cb4b18ad7b92a26e83b65dde940fab78339e6f3c",
  4320 + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/325b17c24f3ee23cbecfa63ba809c6d89b5fa04a",
  4321 + "reference": "325b17c24f3ee23cbecfa63ba809c6d89b5fa04a",
4322 4322 "shasum": ""
4323 4323 },
4324 4324 "require": {
... ... @@ -4362,20 +4362,20 @@
4362 4362 "interoperability",
4363 4363 "standards"
4364 4364 ],
4365   - "time": "2019-06-13T11:15:36+00:00"
  4365 + "time": "2019-08-02T12:15:04+00:00"
4366 4366 },
4367 4367 {
4368 4368 "name": "symfony/var-dumper",
4369   - "version": "v4.3.3",
  4369 + "version": "v4.3.4",
4370 4370 "source": {
4371 4371 "type": "git",
4372 4372 "url": "https://github.com/symfony/var-dumper.git",
4373   - "reference": "e4110b992d2cbe198d7d3b244d079c1c58761d07"
  4373 + "reference": "641043e0f3e615990a0f29479f9c117e8a6698c6"
4374 4374 },
4375 4375 "dist": {
4376 4376 "type": "zip",
4377   - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/e4110b992d2cbe198d7d3b244d079c1c58761d07",
4378   - "reference": "e4110b992d2cbe198d7d3b244d079c1c58761d07",
  4377 + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/641043e0f3e615990a0f29479f9c117e8a6698c6",
  4378 + "reference": "641043e0f3e615990a0f29479f9c117e8a6698c6",
4379 4379 "shasum": ""
4380 4380 },
4381 4381 "require": {
... ... @@ -4438,7 +4438,7 @@
4438 4438 "debug",
4439 4439 "dump"
4440 4440 ],
4441   - "time": "2019-07-27T06:42:46+00:00"
  4441 + "time": "2019-08-26T08:26:39+00:00"
4442 4442 },
4443 4443 {
4444 4444 "name": "tijsverkoyen/css-to-inline-styles",
... ... @@ -4540,16 +4540,16 @@
4540 4540 },
4541 4541 {
4542 4542 "name": "vlucas/phpdotenv",
4543   - "version": "v3.4.0",
  4543 + "version": "v3.5.0",
4544 4544 "source": {
4545 4545 "type": "git",
4546 4546 "url": "https://github.com/vlucas/phpdotenv.git",
4547   - "reference": "5084b23845c24dbff8ac6c204290c341e4776c92"
  4547 + "reference": "95cb0fa6c025f7f0db7fc60f81e9fb231eb2d222"
4548 4548 },
4549 4549 "dist": {
4550 4550 "type": "zip",
4551   - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/5084b23845c24dbff8ac6c204290c341e4776c92",
4552   - "reference": "5084b23845c24dbff8ac6c204290c341e4776c92",
  4551 + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/95cb0fa6c025f7f0db7fc60f81e9fb231eb2d222",
  4552 + "reference": "95cb0fa6c025f7f0db7fc60f81e9fb231eb2d222",
4553 4553 "shasum": ""
4554 4554 },
4555 4555 "require": {
... ... @@ -4563,7 +4563,7 @@
4563 4563 "type": "library",
4564 4564 "extra": {
4565 4565 "branch-alias": {
4566   - "dev-master": "3.4-dev"
  4566 + "dev-master": "3.5-dev"
4567 4567 }
4568 4568 },
4569 4569 "autoload": {
... ... @@ -4577,9 +4577,14 @@
4577 4577 ],
4578 4578 "authors": [
4579 4579 {
  4580 + "name": "Graham Campbell",
  4581 + "email": "graham@alt-three.com",
  4582 + "homepage": "https://gjcampbell.co.uk/"
  4583 + },
  4584 + {
4580 4585 "name": "Vance Lucas",
4581 4586 "email": "vance@vancelucas.com",
4582   - "homepage": "http://www.vancelucas.com"
  4587 + "homepage": "https://vancelucas.com/"
4583 4588 }
4584 4589 ],
4585 4590 "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.",
... ... @@ -4588,7 +4593,7 @@
4588 4593 "env",
4589 4594 "environment"
4590 4595 ],
4591   - "time": "2019-06-15T22:40:20+00:00"
  4596 + "time": "2019-08-27T17:00:38+00:00"
4592 4597 }
4593 4598 ],
4594 4599 "packages-dev": [
... ... @@ -5012,16 +5017,16 @@
5012 5017 },
5013 5018 {
5014 5019 "name": "friendsofphp/php-cs-fixer",
5015   - "version": "v2.15.1",
  5020 + "version": "v2.15.2",
5016 5021 "source": {
5017 5022 "type": "git",
5018 5023 "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git",
5019   - "reference": "20064511ab796593a3990669eff5f5b535001f7c"
  5024 + "reference": "c9d30fddfa3feb8b82663104864224f2ce7a3675"
5020 5025 },
5021 5026 "dist": {
5022 5027 "type": "zip",
5023   - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/20064511ab796593a3990669eff5f5b535001f7c",
5024   - "reference": "20064511ab796593a3990669eff5f5b535001f7c",
  5028 + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/c9d30fddfa3feb8b82663104864224f2ce7a3675",
  5029 + "reference": "c9d30fddfa3feb8b82663104864224f2ce7a3675",
5025 5030 "shasum": ""
5026 5031 },
5027 5032 "require": {
... ... @@ -5087,16 +5092,16 @@
5087 5092 ],
5088 5093 "authors": [
5089 5094 {
5090   - "name": "Dariusz Rumiński",
5091   - "email": "dariusz.ruminski@gmail.com"
5092   - },
5093   - {
5094 5095 "name": "Fabien Potencier",
5095 5096 "email": "fabien@symfony.com"
  5097 + },
  5098 + {
  5099 + "name": "Dariusz Rumiński",
  5100 + "email": "dariusz.ruminski@gmail.com"
5096 5101 }
5097 5102 ],
5098 5103 "description": "A tool to automatically fix PHP code style",
5099   - "time": "2019-06-01T10:32:12+00:00"
  5104 + "time": "2019-08-27T16:03:01+00:00"
5100 5105 },
5101 5106 {
5102 5107 "name": "fzaninotto/faker",
... ... @@ -6882,16 +6887,16 @@
6882 6887 },
6883 6888 {
6884 6889 "name": "symfony/filesystem",
6885   - "version": "v4.3.3",
  6890 + "version": "v4.3.4",
6886 6891 "source": {
6887 6892 "type": "git",
6888 6893 "url": "https://github.com/symfony/filesystem.git",
6889   - "reference": "b9896d034463ad6fd2bf17e2bf9418caecd6313d"
  6894 + "reference": "9abbb7ef96a51f4d7e69627bc6f63307994e4263"
6890 6895 },
6891 6896 "dist": {
6892 6897 "type": "zip",
6893   - "url": "https://api.github.com/repos/symfony/filesystem/zipball/b9896d034463ad6fd2bf17e2bf9418caecd6313d",
6894   - "reference": "b9896d034463ad6fd2bf17e2bf9418caecd6313d",
  6898 + "url": "https://api.github.com/repos/symfony/filesystem/zipball/9abbb7ef96a51f4d7e69627bc6f63307994e4263",
  6899 + "reference": "9abbb7ef96a51f4d7e69627bc6f63307994e4263",
6895 6900 "shasum": ""
6896 6901 },
6897 6902 "require": {
... ... @@ -6928,20 +6933,20 @@
6928 6933 ],
6929 6934 "description": "Symfony Filesystem Component",
6930 6935 "homepage": "https://symfony.com",
6931   - "time": "2019-06-23T08:51:25+00:00"
  6936 + "time": "2019-08-20T14:07:54+00:00"
6932 6937 },
6933 6938 {
6934 6939 "name": "symfony/options-resolver",
6935   - "version": "v4.3.3",
  6940 + "version": "v4.3.4",
6936 6941 "source": {
6937 6942 "type": "git",
6938 6943 "url": "https://github.com/symfony/options-resolver.git",
6939   - "reference": "40762ead607c8f792ee4516881369ffa553fee6f"
  6944 + "reference": "81c2e120522a42f623233968244baebd6b36cb6a"
6940 6945 },
6941 6946 "dist": {
6942 6947 "type": "zip",
6943   - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/40762ead607c8f792ee4516881369ffa553fee6f",
6944   - "reference": "40762ead607c8f792ee4516881369ffa553fee6f",
  6948 + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/81c2e120522a42f623233968244baebd6b36cb6a",
  6949 + "reference": "81c2e120522a42f623233968244baebd6b36cb6a",
6945 6950 "shasum": ""
6946 6951 },
6947 6952 "require": {
... ... @@ -6982,7 +6987,7 @@
6982 6987 "configuration",
6983 6988 "options"
6984 6989 ],
6985   - "time": "2019-06-13T11:01:17+00:00"
  6990 + "time": "2019-08-08T09:29:19+00:00"
6986 6991 },
6987 6992 {
6988 6993 "name": "symfony/polyfill-php70",
... ... @@ -7045,16 +7050,16 @@
7045 7050 },
7046 7051 {
7047 7052 "name": "symfony/stopwatch",
7048   - "version": "v4.3.3",
  7053 + "version": "v4.3.4",
7049 7054 "source": {
7050 7055 "type": "git",
7051 7056 "url": "https://github.com/symfony/stopwatch.git",
7052   - "reference": "6b100e9309e8979cf1978ac1778eb155c1f7d93b"
  7057 + "reference": "1e4ff456bd625be5032fac9be4294e60442e9b71"
7053 7058 },
7054 7059 "dist": {
7055 7060 "type": "zip",
7056   - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/6b100e9309e8979cf1978ac1778eb155c1f7d93b",
7057   - "reference": "6b100e9309e8979cf1978ac1778eb155c1f7d93b",
  7061 + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/1e4ff456bd625be5032fac9be4294e60442e9b71",
  7062 + "reference": "1e4ff456bd625be5032fac9be4294e60442e9b71",
7058 7063 "shasum": ""
7059 7064 },
7060 7065 "require": {
... ... @@ -7091,7 +7096,7 @@
7091 7096 ],
7092 7097 "description": "Symfony Stopwatch Component",
7093 7098 "homepage": "https://symfony.com",
7094   - "time": "2019-05-27T08:16:38+00:00"
  7099 + "time": "2019-08-07T11:52:19+00:00"
7095 7100 },
7096 7101 {
7097 7102 "name": "theseer/tokenizer",
... ...
config/assets.php
... ... @@ -14,7 +14,7 @@ return [
14 14 |
15 15 */
16 16  
17   - 'version' => '0.0.29',
  17 + 'version' => '0.0.30',
18 18  
19 19 /*
20 20 |--------------------------------------------------------------------------
... ...
config/legacy.php
... ... @@ -137,7 +137,7 @@ return [
137 137 ],
138 138 'alunos' => [
139 139 'laudo_medico_obrigatorio' => '1',
140   - 'nao_apresentar_campo_alfabetizado' => '1',
  140 + 'nao_apresentar_campo_alfabetizado' => '0',
141 141 'codigo_sistema' => 'Código sistema',
142 142 'mostrar_codigo_sistema' => '1',
143 143 ],
... ...
database/migrations/2019_08_15_095104_adiciona_coluna_em_custom_labels.php 0 → 100644
... ... @@ -0,0 +1,50 @@
  1 +<?php
  2 +
  3 +use Illuminate\Support\Facades\DB;
  4 +use Illuminate\Database\Migrations\Migration;
  5 +
  6 +class AdicionaColunaEmCustomLabels extends Migration
  7 +{
  8 +
  9 + private function getDefaultCustomLabels()
  10 + {
  11 + $customLabel = new CustomLabel();
  12 + $defaults = $customLabel->getDefaults();
  13 + $defaults['report.boletim_professor.modelo_padrao'] = 'Modelo padrão';
  14 + $defaults['report.boletim_professor.modelo_recuperacao_por_etapa'] = 'Modelo recuperação por etapa';
  15 + $defaults['report.boletim_professor.modelo_recuperacao_paralela'] = 'Modelo recuperação paralela';
  16 +
  17 + return $defaults;
  18 + }
  19 +
  20 + /**
  21 + * Run the migrations.
  22 + *
  23 + * @return void
  24 + */
  25 + public function up()
  26 + {
  27 + $setting = DB::table('pmieducar.configuracoes_gerais')
  28 + ->select('ref_cod_instituicao', 'custom_labels')
  29 + ->where('active_on_ieducar', 1)
  30 + ->first();
  31 +
  32 + if (empty($setting)) {
  33 + return;
  34 + }
  35 +
  36 + $customLabels = json_decode($setting->custom_labels, true);
  37 + $customLabels = is_array($customLabels) ? array_filter($customLabels) : [];
  38 +
  39 + $newCustomLabels = array_merge($this->getDefaultCustomLabels(), $customLabels);
  40 + $newCustomLabels = json_encode($newCustomLabels);
  41 +
  42 + DB::unprepared(
  43 + "
  44 + UPDATE pmieducar.configuracoes_gerais
  45 + SET custom_labels = '{$newCustomLabels}'
  46 + WHERE ref_cod_instituicao = {$setting->ref_cod_instituicao}
  47 + "
  48 + );
  49 + }
  50 +}
... ...
database/migrations/2019_08_27_100000_recreate_view_dados_escola.php 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +<?php
  2 +
  3 +use App\Support\Database\AsView;
  4 +use Illuminate\Database\Migrations\Migration;
  5 +
  6 +class RecreateViewDadosEscola extends Migration
  7 +{
  8 + use AsView;
  9 +
  10 + /**
  11 + * Run the migrations.
  12 + *
  13 + * @return void
  14 + */
  15 + public function up()
  16 + {
  17 + $this->dropView('relatorio.view_dados_escola');
  18 + $this->createView('relatorio.view_dados_escola');
  19 + }
  20 +}
... ...
database/sqls/views/relatorio.view_dados_escola.sql
1   -CREATE OR REPLACE VIEW relatorio.view_dados_escola AS
  1 +CREATE OR REPLACE VIEW relatorio.view_dados_escola AS
2 2 SELECT escola.cod_escola,
3 3 relatorio.get_nome_escola(escola.cod_escola) AS nome,
4 4 pessoa.email,
... ... @@ -11,8 +11,8 @@ SELECT escola.cod_escola,
11 11 COALESCE(municipio.nome, endereco_externo.cidade) AS municipio,
12 12 COALESCE(municipio.sigla_uf, endereco_externo.sigla_uf::character varying) AS uf_municipio,
13 13 educacenso_cod_escola.cod_escola_inep AS inep,
14   - fone_pessoa.ddd AS telefone_ddd,
15   - to_char(fone_pessoa.fone, '99999-9999'::text) AS telefone,
  14 + telefone.ddd AS telefone_ddd,
  15 + to_char(telefone.fone, '99999-9999'::text) AS telefone,
16 16 fone_pessoa.ddd AS celular_ddd,
17 17 to_char(fone_pessoa.fone, '99999-9999'::text) AS celular
18 18 FROM pmieducar.escola
... ... @@ -24,5 +24,6 @@ LEFT JOIN public.logradouro ON logradouro.idlog = endereco_pessoa.idlog
24 24 LEFT JOIN urbano.tipo_logradouro ON tipo_logradouro.idtlog::text = COALESCE(logradouro.idtlog, endereco_externo.idtlog)::text
25 25 LEFT JOIN public.bairro ON bairro.idbai = endereco_pessoa.idbai
26 26 LEFT JOIN public.municipio ON municipio.idmun = bairro.idmun
27   -LEFT JOIN cadastro.fone_pessoa ON pessoa.idpes = fone_pessoa.idpes AND fone_pessoa.tipo = 3::numeric
  27 +LEFT JOIN cadastro.fone_pessoa as telefone ON pessoa.idpes = telefone.idpes AND telefone.tipo = 1
  28 +LEFT JOIN cadastro.fone_pessoa ON pessoa.idpes = fone_pessoa.idpes AND fone_pessoa.tipo = 3
28 29 LEFT JOIN cadastro.juridica ON juridica.idpes = fone_pessoa.idpes AND juridica.idpes = escola.ref_idpes::numeric;
... ...
ieducar/intranet/educar_configuracoes_gerais.php
... ... @@ -5,6 +5,7 @@ use Illuminate\Support\Facades\Cache;
5 5 require_once 'include/clsBase.inc.php';
6 6 require_once 'include/clsCadastro.inc.php';
7 7 require_once 'include/modules/clsModulesAuditoriaGeral.inc.php';
  8 +require_once 'Portabilis/Utils/CustomLabel.php';
8 9  
9 10 class clsIndexBase extends clsBase
10 11 {
... ... @@ -168,10 +169,10 @@ class indice extends clsCadastro
168 169 $options = [
169 170 'label' => 'Modelo do boletim do professor',
170 171 'resources' => [
171   - 1 => 'Modelo padrão',
172   - 2 => 'Modelo recuperação por etapa',
173   - 3 => 'Modelo recuperação paralela',
174   - ],
  172 + 1 => _cl('report.boletim_professor.modelo_padrao'),
  173 + 2 => _cl('report.boletim_professor.modelo_recuperacao_por_etapa'),
  174 + 3 => _cl('report.boletim_professor.modelo_recuperacao_paralela'),
  175 + ],
175 176 'value' => $this->modelo_boletim_professor
176 177 ];
177 178 $this->inputsHelper()->select('modelo_boletim_professor', $options);
... ...
ieducar/intranet/educar_escola_det.php
1 1 <?php
2   -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3   - * *
4   - * @author Prefeitura Municipal de Itajaí *
5   - * @updated 29/03/2007 *
6   - * Pacote: i-PLB Software Público Livre e Brasileiro *
7   - * *
8   - * Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí *
9   - * ctima@itajai.sc.gov.br *
10   - * *
11   - * Este programa é software livre, você pode redistribuí-lo e/ou *
12   - * modificá-lo sob os termos da Licença Pública Geral GNU, conforme *
13   - * publicada pela Free Software Foundation, tanto a versão 2 da *
14   - * Licença como (a seu critério) qualquer versão mais nova. *
15   - * *
16   - * Este programa é distribuído na expectativa de ser útil, mas SEM *
17   - * QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- *
18   - * ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- *
19   - * sulte a Licença Pública Geral GNU para obter mais detalhes. *
20   - * *
21   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU *
22   - * junto com este programa. Se não, escreva para a Free Software *
23   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *
24   - * 02111-1307, USA. *
25   - * *
26   - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27   -require_once ("include/clsBase.inc.php");
28   -require_once ("include/clsDetalhe.inc.php");
29   -require_once ("include/clsBanco.inc.php");
30   -require_once ("include/pmieducar/geral.inc.php");
31   -require_once ("Portabilis/View/Helper/Application.php");
  2 +
  3 +require_once 'include/clsBase.inc.php';
  4 +require_once 'include/clsDetalhe.inc.php';
  5 +require_once 'include/clsBanco.inc.php';
  6 +require_once 'include/pmieducar/geral.inc.php';
  7 +require_once 'Portabilis/View/Helper/Application.php';
32 8 require_once 'App/Model/ZonaLocalizacao.php';
33 9  
34 10 class clsIndexBase extends clsBase
35 11 {
36   - function Formular()
  12 + public function Formular()
37 13 {
38   - $this->SetTitulo( "{$this->_instituicao} i-Educar - Escola" );
39   - $this->processoAp = "561";
40   - $this->addEstilo("localizacaoSistema");
  14 + $this->SetTitulo("{$this->_instituicao} i-Educar - Escola");
  15 + $this->processoAp = '561';
41 16 }
42 17 }
43 18  
44 19 class indice extends clsDetalhe
45 20 {
46   - /**
47   - * Titulo no topo da pagina
48   - *
49   - * @var int
50   - */
51   - var $titulo;
52   -
53   - var $cod_escola;
54   - var $ref_usuario_cad;
55   - var $ref_usuario_exc;
56   - var $ref_cod_instituicao;
57   - var $ref_cod_escola_rede_ensino;
58   - var $ref_idpes;
59   - var $sigla;
60   - var $data_cadastro;
61   - var $data_exclusao;
62   - var $ativo;
63   - var $nm_escola;
  21 + public $cod_escola;
  22 + public $ref_usuario_cad;
  23 + public $ref_usuario_exc;
  24 + public $ref_cod_instituicao;
  25 + public $ref_cod_escola_rede_ensino;
  26 + public $ref_idpes;
  27 + public $sigla;
  28 + public $data_cadastro;
  29 + public $data_exclusao;
  30 + public $ativo;
  31 + public $nm_escola;
64 32  
65 33 const POLI_INSTITUCIONAL = 1;
66 34 const INSTITUCIONAL = 2;
67 35  
68   - function Gerar()
  36 + public function Gerar()
69 37 {
70 38 // Verificação de permissão para cadastro.
71 39 $this->obj_permissao = new clsPermissoes();
72 40  
73   - $this->nivel_usuario = $this->obj_permissao->nivel_acesso($this->pessoa_logada);
  41 + $this->nivel_usuario = $this->user()->getLevel();
74 42  
75   - $this->titulo = "Escola - Detalhe";
  43 + $this->titulo = 'Escola - Detalhe';
76 44  
77   - $this->cod_escola = $_GET["cod_escola"];
  45 + $this->cod_escola = $_GET['cod_escola'];
78 46  
79   - $tmp_obj = new clsPmieducarEscola( $this->cod_escola );
  47 + $tmp_obj = new clsPmieducarEscola($this->cod_escola);
80 48 $registro = $tmp_obj->detalhe();
81 49  
82   - if( ! $registro )
83   - {
  50 + if (!$registro) {
84 51 $this->simpleRedirect('educar_aluno_lst.php');
85 52 }
86 53  
87   - if( class_exists( "clsPmieducarInstituicao" ) )
88   - {
89   - $obj_ref_cod_instituicao = new clsPmieducarInstituicao( $registro["ref_cod_instituicao"] );
90   - $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe();
91   - $registro["ref_cod_instituicao"] = $det_ref_cod_instituicao["nm_instituicao"];
92   - }
93   - else
94   - {
95   - $registro["ref_cod_instituicao"] = "Erro na geracao";
96   - echo "<!--\nErro\nClasse nao existente: clsPmieducarInstituicao\n-->";
97   - }
98   - if ($registro["ref_idpes"])
99   - {
100   - $obj_escola = new clsPessoa_($registro["ref_idpes"]);
  54 + $obj_ref_cod_instituicao = new clsPmieducarInstituicao($registro['ref_cod_instituicao']);
  55 + $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe();
  56 + $registro['ref_cod_instituicao'] = $det_ref_cod_instituicao['nm_instituicao'];
  57 +
  58 + if ($registro['ref_idpes']) {
  59 + $obj_escola = new clsPessoa_($registro['ref_idpes']);
101 60 $obj_escola_det = $obj_escola->detalhe();
102   - $url = $obj_escola_det["url"];
103   - $email = $obj_escola_det["email"];
104   - $obj_escola1 = new clsPessoaJuridica($registro["ref_idpes"]);
  61 + $url = $obj_escola_det['url'];
  62 + $email = $obj_escola_det['email'];
  63 + $obj_escola1 = new clsPessoaJuridica($registro['ref_idpes']);
105 64 $obj_escola_det1 = $obj_escola1->detalhe();
106   - $nm_escola = $obj_escola_det1["fantasia"];
107   -
108   - $obj_endereco = new clsPessoaEndereco($registro["ref_idpes"]);
109   - if ( class_exists( "clsPessoaEndereco" ) )
110   - {
111   - $tipo = 1;
112   - $endereco_lst = $obj_endereco->lista($registro["ref_idpes"]);
113   - if ( $endereco_lst )
114   - {
115   - foreach ($endereco_lst as $endereco)
116   - {
117   - $cep = $endereco["cep"]->cep;
118   - $idlog = $endereco["idlog"]->idlog;
119   - $obj = new clsLogradouro($idlog);
120   - $obj_det = $obj->detalhe();
121   - $logradouro = $obj_det["nome"];
122   - $idtlog = $obj_det["idtlog"]->detalhe();
123   - $tipo_logradouro = $idtlog["descricao"];
124   - $idbai = $endereco["idbai"]->detalhe();
125   - $idbai = $idbai['nome'];
126   - $numero = $endereco["numero"];
127   - $complemento = $endereco["complemento"];
128   - $andar = $endereco["andar"];
129   - }
  65 + $nm_escola = $obj_escola_det1['fantasia'];
  66 +
  67 + $obj_endereco = new clsPessoaEndereco($registro['ref_idpes']);
  68 +
  69 + $tipo = 1;
  70 + $endereco_lst = $obj_endereco->lista($registro['ref_idpes']);
  71 +
  72 + if ($endereco_lst) {
  73 + foreach ($endereco_lst as $endereco) {
  74 + $cep = $endereco['cep']->cep;
  75 + $idlog = $endereco['idlog']->idlog;
  76 + $obj = new clsLogradouro($idlog);
  77 + $obj_det = $obj->detalhe();
  78 + $logradouro = $obj_det['nome'];
  79 + $idtlog = $obj_det['idtlog']->detalhe();
  80 + $tipo_logradouro = $idtlog['descricao'];
  81 + $idbai = $endereco['idbai']->detalhe();
  82 + $idbai = $idbai['nome'];
  83 + $numero = $endereco['numero'];
  84 + $complemento = $endereco['complemento'];
  85 + $andar = $endereco['andar'];
130 86 }
131   - else if ( class_exists( "clsEnderecoExterno" ) )
132   - {
133   - $tipo = 2;
134   - $obj_endereco = new clsEnderecoExterno();
135   - $endereco_lst = $obj_endereco->lista( null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, $registro["ref_idpes"] );
136   - if ( $endereco_lst )
137   - {
138   - foreach ($endereco_lst as $endereco)
139   - {
140   - $cep = $endereco["cep"];
141   - $sigla_uf = $endereco["sigla_uf"]->detalhe();
142   - $sigla_uf = $sigla_uf["nome"];
143   - $cidade = $endereco["cidade"];
144   - $idtlog = $endereco["idtlog"]->detalhe();
145   - $tipo_logradouro = $idtlog["descricao"];
146   - $logradouro = $endereco["logradouro"];
147   - $bairro = $endereco["bairro"];
148   - $numero = $endereco["numero"];
149   - $complemento = $endereco["complemento"];
150   - $andar = $endereco["andar"];
151   - }
  87 + }
  88 +
  89 + if (empty($endereco_lst)) {
  90 + $tipo = 2;
  91 + $obj_endereco = new clsEnderecoExterno();
  92 + $endereco_lst = $obj_endereco->lista(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, $registro['ref_idpes']);
  93 +
  94 + if ($endereco_lst) {
  95 + foreach ($endereco_lst as $endereco) {
  96 + $cep = $endereco['cep'];
  97 + $sigla_uf = $endereco['sigla_uf']->detalhe();
  98 + $sigla_uf = $sigla_uf['nome'];
  99 + $cidade = $endereco['cidade'];
  100 + $idtlog = $endereco['idtlog']->detalhe();
  101 + $tipo_logradouro = $idtlog['descricao'];
  102 + $logradouro = $endereco['logradouro'];
  103 + $bairro = $endereco['bairro'];
  104 + $numero = $endereco['numero'];
  105 + $complemento = $endereco['complemento'];
  106 + $andar = $endereco['andar'];
152 107 }
153 108 }
154 109 }
155   - if ( class_exists( "clsPessoaTelefone" ) )
156   - {
157   - $obj_telefone = new clsPessoaTelefone();
158   - $telefone_lst = $obj_telefone->lista($registro["ref_idpes"], "tipo");
159   - if ($telefone_lst)
160   - {
161   - foreach ($telefone_lst as $telefone)
162   - {
163   - if ($telefone["tipo"] == 1 )
164   - {
165   - $telefone_1 = "(".$telefone["ddd"].") ".$telefone["fone"];
166   - }
167   - else if ($telefone["tipo"] == 2 )
168   - {
169   - $telefone_2 = "(".$telefone["ddd"].") ".$telefone["fone"];
170   - }
171   - else if ($telefone["tipo"] == 3 )
172   - {
173   - $telefone_mov = "(".$telefone["ddd"].") ".$telefone["fone"];
174   - }
175   - else if ($telefone["tipo"] == 4 )
176   - {
177   - $telefone_fax = "(".$telefone["ddd"].") ".$telefone["fone"];
178   - }
  110 +
  111 + $obj_telefone = new clsPessoaTelefone();
  112 + $telefone_lst = $obj_telefone->lista($registro['ref_idpes'], 'tipo');
  113 + if ($telefone_lst) {
  114 + foreach ($telefone_lst as $telefone) {
  115 + if ($telefone['tipo'] == 1) {
  116 + $telefone_1 = '(' . $telefone['ddd'] . ') ' . $telefone['fone'];
  117 + } elseif ($telefone['tipo'] == 2) {
  118 + $telefone_2 = '(' . $telefone['ddd'] . ') ' . $telefone['fone'];
  119 + } elseif ($telefone['tipo'] == 3) {
  120 + $telefone_mov = '(' . $telefone['ddd'] . ') ' . $telefone['fone'];
  121 + } elseif ($telefone['tipo'] == 4) {
  122 + $telefone_fax = '(' . $telefone['ddd'] . ') ' . $telefone['fone'];
179 123 }
180 124 }
181 125 }
182   - }
183   - else
184   - {
185   - if ( class_exists( "clsPmieducarEscolaComplemento" ) )
186   - {
187   - $tipo= 3;
188   - $obj_escola = new clsPmieducarEscolaComplemento($this->cod_escola);
189   - $obj_escola_det = $obj_escola->detalhe();
190   - $nm_escola = $obj_escola_det["nm_escola"];
191   - $cep = $obj_escola_det["cep"];
192   - $numero = $obj_escola_det["numero"];
193   - $complemento = $obj_escola_det["complemento"];
194   - $email = $obj_escola_det["email"];
195   - $cidade = $obj_escola_det["municipio"];
196   - $bairro = $obj_escola_det["bairro"];
197   - $logradouro = $obj_escola_det["logradouro"];
198   - $ddd_telefone = $obj_escola_det["ddd_telefone"];
199   - $telefone = $obj_escola_det["telefone"];
200   - $ddd_telefone_fax = $obj_escola_det["ddd_fax"];
201   - $telefone_fax = $obj_escola_det["fax"];
202   - }
203   - }
204 126  
205   - if( class_exists( "clsPmieducarEscolaRedeEnsino" ) )
206   - {
207   - $obj_ref_cod_escola_rede_ensino = new clsPmieducarEscolaRedeEnsino( $registro["ref_cod_escola_rede_ensino"] );
208   - $det_ref_cod_escola_rede_ensino = $obj_ref_cod_escola_rede_ensino->detalhe();
209   - $registro["ref_cod_escola_rede_ensino"] = $det_ref_cod_escola_rede_ensino["nm_rede"];
210   - }
211   - else
212   - {
213   - $registro["ref_cod_escola_rede_ensino"] = "Erro na geracao";
214   - echo "<!--\nErro\nClasse nao existente: clsPmieducarEscolaRedeEnsino\n-->";
  127 + } else {
  128 + $tipo = 3;
  129 + $obj_escola = new clsPmieducarEscolaComplemento($this->cod_escola);
  130 + $obj_escola_det = $obj_escola->detalhe();
  131 + $nm_escola = $obj_escola_det['nm_escola'];
  132 + $cep = $obj_escola_det['cep'];
  133 + $numero = $obj_escola_det['numero'];
  134 + $complemento = $obj_escola_det['complemento'];
  135 + $email = $obj_escola_det['email'];
  136 + $cidade = $obj_escola_det['municipio'];
  137 + $bairro = $obj_escola_det['bairro'];
  138 + $logradouro = $obj_escola_det['logradouro'];
  139 + $ddd_telefone = $obj_escola_det['ddd_telefone'];
  140 + $telefone = $obj_escola_det['telefone'];
  141 + $ddd_telefone_fax = $obj_escola_det['ddd_fax'];
  142 + $telefone_fax = $obj_escola_det['fax'];
215 143 }
216 144  
217   - if( class_exists( "clsPessoaJuridica" ) )
218   - {
219   - $obj_ref_idpes = new clsPessoaJuridica( $registro["ref_idpes"] );
220   - $det_ref_idpes = $obj_ref_idpes->detalhe();
221   - $registro["ref_idpes"] = $det_ref_idpes["nome"];
222   - }
223   - else
224   - {
225   - $registro["ref_idpes"] = "Erro na geracao";
226   - echo "<!--\nErro\nClasse nao existente: clsCadastroJuridica\n-->";
227   - }
  145 + $obj_ref_cod_escola_rede_ensino = new clsPmieducarEscolaRedeEnsino($registro['ref_cod_escola_rede_ensino']);
  146 + $det_ref_cod_escola_rede_ensino = $obj_ref_cod_escola_rede_ensino->detalhe();
  147 + $registro['ref_cod_escola_rede_ensino'] = $det_ref_cod_escola_rede_ensino['nm_rede'];
228 148  
229   - if( $registro["ref_cod_instituicao"] )
230   - {
231   - $this->addDetalhe( array( "Institui&ccedil;&atilde;o", "{$registro["ref_cod_instituicao"]}") );
  149 + $obj_ref_idpes = new clsPessoaJuridica($registro['ref_idpes']);
  150 + $det_ref_idpes = $obj_ref_idpes->detalhe();
  151 + $registro['ref_idpes'] = $det_ref_idpes['nome'];
  152 +
  153 + if ($registro['ref_cod_instituicao']) {
  154 + $this->addDetalhe(['Instituição', "{$registro['ref_cod_instituicao']}"]);
232 155 }
233   - if( $nm_escola )
234   - {
235   - $this->addDetalhe( array( "Escola", "{$nm_escola}") );
  156 +
  157 + if ($nm_escola) {
  158 + $this->addDetalhe(['Escola', "{$nm_escola}"]);
236 159 }
237   - if( $registro["sigla"] )
238   - {
239   - $this->addDetalhe( array( "Sigla", "{$registro["sigla"]}") );
  160 +
  161 + if ($registro['sigla']) {
  162 + $this->addDetalhe(['Sigla', "{$registro['sigla']}"]);
240 163 }
241   - if( $registro["zona_localizacao"] )
242   - {
  164 +
  165 + if ($registro['zona_localizacao']) {
243 166 $zona = App_Model_ZonaLocalizacao::getInstance();
244   - $this->addDetalhe(array(
  167 + $this->addDetalhe([
245 168 'Zona Localização', $zona->getValue($registro['zona_localizacao'])
246   - ));
  169 + ]);
247 170 }
248   - if( $registro["ref_cod_escola_rede_ensino"] )
249   - {
250   - $this->addDetalhe( array( "Rede Ensino", "{$registro["ref_cod_escola_rede_ensino"]}") );
  171 +
  172 + if ($registro['ref_cod_escola_rede_ensino']) {
  173 + $this->addDetalhe(['Rede Ensino', "{$registro['ref_cod_escola_rede_ensino']}"]);
251 174 }
252   - if( $registro["ref_idpes"] )
253   - {
254   - $this->addDetalhe( array( "Raz&atilde;o Social", "{$registro["ref_idpes"]}") );
  175 +
  176 + if ($registro['ref_idpes']) {
  177 + $this->addDetalhe(['Raz&atilde;o Social', "{$registro['ref_idpes']}"]);
255 178 }
256   - if ($tipo == 1)
257   - {
258   - if( $cep )
259   - {
  179 + if ($tipo == 1) {
  180 + if ($cep) {
260 181 $cep = int2CEP($cep);
261   - $this->addDetalhe( array( "CEP", "{$cep}") );
  182 + $this->addDetalhe(['CEP', "{$cep}"]);
262 183 }
263   - if( $idbai )
264   - {
265   - $this->addDetalhe( array( "Bairro", "{$idbai}") );
  184 + if ($idbai) {
  185 + $this->addDetalhe(['Bairro', "{$idbai}"]);
266 186 }
267   - if( $tipo_logradouro )
268   - {
269   - $this->addDetalhe( array( "Tipo Logradouro", "{$tipo_logradouro}") );
  187 + if ($tipo_logradouro) {
  188 + $this->addDetalhe(['Tipo Logradouro', "{$tipo_logradouro}"]);
270 189 }
271   - if( $logradouro )
272   - {
273   - $this->addDetalhe( array( "Logradouro", "{$logradouro}") );
  190 + if ($logradouro) {
  191 + $this->addDetalhe(['Logradouro', "{$logradouro}"]);
274 192 }
275   - if( $complemento )
276   - {
277   - $this->addDetalhe( array( "Complemento", "{$complemento}") );
  193 + if ($complemento) {
  194 + $this->addDetalhe(['Complemento', "{$complemento}"]);
278 195 }
279   - if( $numero )
280   - {
281   - $this->addDetalhe( array( "N&uacute;mero", "{$numero}") );
  196 + if ($numero) {
  197 + $this->addDetalhe(['N&uacute;mero', "{$numero}"]);
282 198 }
283   - if( $andar )
284   - {
285   - $this->addDetalhe( array( "Andar", "{$andar}") );
  199 + if ($andar) {
  200 + $this->addDetalhe(['Andar', "{$andar}"]);
286 201 }
287   - if( $url )
288   - {
289   - $this->addDetalhe( array( "Site", "{$url}") );
  202 + if ($url) {
  203 + $this->addDetalhe(['Site', "{$url}"]);
290 204 }
291   - if( $email )
292   - {
293   - $this->addDetalhe( array( "E-mail", "{$email}") );
  205 + if ($email) {
  206 + $this->addDetalhe(['E-mail', "{$email}"]);
294 207 }
295   - if( $telefone_1 )
296   - {
297   - $this->addDetalhe( array( "Telefone 1", "{$telefone_1}") );
  208 + if ($telefone_1) {
  209 + $this->addDetalhe(['Telefone 1', "{$telefone_1}"]);
298 210 }
299   - if( $telefone_2 )
300   - {
301   - $this->addDetalhe( array( "Telefone 2", "{$telefone_2}") );
  211 + if ($telefone_2) {
  212 + $this->addDetalhe(['Telefone 2', "{$telefone_2}"]);
302 213 }
303   - if( $telefone_mov )
304   - {
305   - $this->addDetalhe( array( "Celular", "{$telefone_mov}") );
  214 + if ($telefone_mov) {
  215 + $this->addDetalhe(['Celular', "{$telefone_mov}"]);
306 216 }
307   - if( $telefone_fax )
308   - {
309   - $this->addDetalhe( array( "Fax", "{$telefone_fax}") );
  217 + if ($telefone_fax) {
  218 + $this->addDetalhe(['Fax', "{$telefone_fax}"]);
310 219 }
311   - }
312   - else if ($tipo == 2)
313   - {
314   - if( $cep )
315   - {
  220 + } elseif ($tipo == 2) {
  221 + if ($cep) {
316 222 $cep = int2CEP($cep);
317   - $this->addDetalhe( array( "CEP", "{$cep}") );
  223 + $this->addDetalhe(['CEP', "{$cep}"]);
318 224 }
319   - if( $sigla_uf )
320   - {
321   - $this->addDetalhe( array( "Estado", "{$sigla_uf}") );
  225 + if ($sigla_uf) {
  226 + $this->addDetalhe(['Estado', "{$sigla_uf}"]);
322 227 }
323   - if( $cidade )
324   - {
325   - $this->addDetalhe( array( "Cidade", "{$cidade}") );
  228 + if ($cidade) {
  229 + $this->addDetalhe(['Cidade', "{$cidade}"]);
326 230 }
327   - if( $bairro )
328   - {
329   - $this->addDetalhe( array( "Bairro", "{$bairro}") );
  231 + if ($bairro) {
  232 + $this->addDetalhe(['Bairro', "{$bairro}"]);
330 233 }
331   - if( $tipo_logradouro )
332   - {
333   - $this->addDetalhe( array( "Tipo Logradouro", "{$tipo_logradouro}") );
  234 + if ($tipo_logradouro) {
  235 + $this->addDetalhe(['Tipo Logradouro', "{$tipo_logradouro}"]);
334 236 }
335   - if( $logradouro )
336   - {
337   - $this->addDetalhe( array( "Logradouro", "{$logradouro}") );
  237 + if ($logradouro) {
  238 + $this->addDetalhe(['Logradouro', "{$logradouro}"]);
338 239 }
339   - if( $complemento )
340   - {
341   - $this->addDetalhe( array( "Complemento", "{$complemento}") );
  240 + if ($complemento) {
  241 + $this->addDetalhe(['Complemento', "{$complemento}"]);
342 242 }
343   - if( $numero )
344   - {
345   - $this->addDetalhe( array( "N&uacute;mero", "{$numero}") );
  243 + if ($numero) {
  244 + $this->addDetalhe(['N&uacute;mero', "{$numero}"]);
346 245 }
347   - if( $andar )
348   - {
349   - $this->addDetalhe( array( "Andar", "{$andar}") );
  246 + if ($andar) {
  247 + $this->addDetalhe(['Andar', "{$andar}"]);
350 248 }
351   - if( $url )
352   - {
353   - $this->addDetalhe( array( "Site", "{$url}") );
  249 + if ($url) {
  250 + $this->addDetalhe(['Site', "{$url}"]);
354 251 }
355   - if( $email )
356   - {
357   - $this->addDetalhe( array( "E-mail", "{$email}") );
  252 + if ($email) {
  253 + $this->addDetalhe(['E-mail', "{$email}"]);
358 254 }
359   - if( $telefone_1 )
360   - {
361   - $this->addDetalhe( array( "Telefone 1", "{$telefone_1}") );
  255 + if ($telefone_1) {
  256 + $this->addDetalhe(['Telefone 1', "{$telefone_1}"]);
362 257 }
363   - if( $telefone_2 )
364   - {
365   - $this->addDetalhe( array( "Telefone 2", "{$telefone_2}") );
  258 + if ($telefone_2) {
  259 + $this->addDetalhe(['Telefone 2', "{$telefone_2}"]);
366 260 }
367   - if( $telefone_mov )
368   - {
369   - $this->addDetalhe( array( "Celular", "{$telefone_mov}") );
  261 + if ($telefone_mov) {
  262 + $this->addDetalhe(['Celular', "{$telefone_mov}"]);
370 263 }
371   - if( $telefone_fax )
372   - {
373   - $this->addDetalhe( array( "Fax", "{$telefone_fax}") );
  264 + if ($telefone_fax) {
  265 + $this->addDetalhe(['Fax', "{$telefone_fax}"]);
374 266 }
375   -
376   - }
377   - else if ($tipo == 3)
378   - {
379   - if( $cep )
380   - {
  267 + } elseif ($tipo == 3) {
  268 + if ($cep) {
381 269 $cep = int2CEP($cep);
382   - $this->addDetalhe( array( "CEP", "{$cep}") );
  270 + $this->addDetalhe(['CEP', "{$cep}"]);
383 271 }
384   - if( $cidade )
385   - {
386   - $this->addDetalhe( array( "Cidade", "{$cidade}") );
  272 + if ($cidade) {
  273 + $this->addDetalhe(['Cidade', "{$cidade}"]);
387 274 }
388   - if( $bairro )
389   - {
390   - $this->addDetalhe( array( "Bairro", "{$bairro}") );
  275 + if ($bairro) {
  276 + $this->addDetalhe(['Bairro', "{$bairro}"]);
391 277 }
392   - if( $logradouro )
393   - {
394   - $this->addDetalhe( array( "Logradouro", "{$logradouro}") );
  278 + if ($logradouro) {
  279 + $this->addDetalhe(['Logradouro', "{$logradouro}"]);
395 280 }
396   - if( $complemento )
397   - {
398   - $this->addDetalhe( array( "Complemento", "{$complemento}") );
  281 + if ($complemento) {
  282 + $this->addDetalhe(['Complemento', "{$complemento}"]);
399 283 }
400   - if( $numero )
401   - {
402   - $this->addDetalhe( array( "N&uacute;mero", "{$numero}") );
  284 + if ($numero) {
  285 + $this->addDetalhe(['N&uacute;mero', "{$numero}"]);
403 286 }
404   - if( $email )
405   - {
406   - $this->addDetalhe( array( "E-mail", "{$email}") );
  287 + if ($email) {
  288 + $this->addDetalhe(['E-mail', "{$email}"]);
407 289 }
408   - if( $telefone )
409   - {
410   - $this->addDetalhe( array( "Telefone", "{$telefone}") );
  290 + if ($telefone) {
  291 + $this->addDetalhe(['Telefone', "{$telefone}"]);
411 292 }
412   - if( $telefone_fax )
413   - {
414   - $this->addDetalhe( array( "Fax", "{$telefone_fax}") );
  293 + if ($telefone_fax) {
  294 + $this->addDetalhe(['Fax', "{$telefone_fax}"]);
415 295 }
416 296 }
417 297  
418   - $obj = new clspmieducarescolacurso();
419   - $lst = $obj->lista( $this->cod_escola );
420   - if ($lst) {
  298 + $obj = new clsPmieducarEscolaCurso();
  299 + $lst = $obj->lista($this->cod_escola);
421 300  
422   - $tabela = "<table>
423   - <tr align='center'>
424   - <td bgcolor='#ccdce6'><b>nome</b></td>
425   - </tr>";
  301 + if ($lst) {
  302 + $tabela = '<table>
  303 + <tr align=\'center\'>
  304 + <td bgcolor=\'#ccdce6\'><b>nome</b></td>
  305 + </tr>';
426 306 $cont = 0;
427 307  
428   - foreach ( $lst as $valor ) {
429   - if ( ($cont % 2) == 0 ) {
430   - $color = " bgcolor='#f5f9fd' ";
  308 + foreach ($lst as $valor) {
  309 + if (($cont % 2) == 0) {
  310 + $color = ' bgcolor=\'#f5f9fd\' ';
  311 + } else {
  312 + $color = ' bgcolor=\'#ffffff\' ';
431 313 }
432   - else {
433   - $color = " bgcolor='#ffffff' ";
434   - }
435   - $obj_curso = new clspmieducarcurso( $valor["ref_cod_curso"] );
436   - $obj_curso->setorderby("nm_curso asc");
  314 + $obj_curso = new clspmieducarcurso($valor['ref_cod_curso']);
  315 + $obj_curso->setorderby('nm_curso asc');
437 316 $obj_curso_det = $obj_curso->detalhe();
438   - $nm_curso = $obj_curso_det["nm_curso"];
  317 + $nm_curso = $obj_curso_det['nm_curso'];
439 318  
440 319 $tabela .= "<tr>
441 320 <td {$color} align=left>{$nm_curso}</td>
442 321 </tr>";
443 322 $cont++;
444 323 }
445   - $tabela .= "</table>";
  324 + $tabela .= '</table>';
446 325 }
447   - if( $nm_curso )
448   - {
449   - $this->addDetalhe( array( "Curso", "{$tabela}") );
  326 +
  327 + if ($nm_curso) {
  328 + $this->addDetalhe(['Curso', "{$tabela}"]);
450 329 }
451 330  
452   - if( $tabela = $this->listaAnos() ) {
453   - $this->addDetalhe( array( "-", "{$tabela}") );
  331 + if ($tabela = $this->listaAnos()) {
  332 + $this->addDetalhe(['-', "{$tabela}"]);
454 333 }
455 334  
456 335 $obj_permissoes = new clsPermissoes();
457 336  
458   - $canCreate = $obj_permissoes->permissao_cadastra( 561, $this->pessoa_logada, 3 );
459   - $canEdit = $obj_permissoes->permissao_cadastra( 561, $this->pessoa_logada, 7 );
  337 + $canCreate = $obj_permissoes->permissao_cadastra(561, $this->pessoa_logada, 3);
  338 + $canEdit = $obj_permissoes->permissao_cadastra(561, $this->pessoa_logada, 7);
460 339  
461   - if($canCreate)
462   - $this->url_novo = "educar_escola_cad.php";
  340 + if ($canCreate) {
  341 + $this->url_novo = 'educar_escola_cad.php';
  342 + }
463 343  
464   - if($canEdit) {
465   - $this->url_editar = "educar_escola_cad.php?cod_escola={$registro["cod_escola"]}";
466   - $this->array_botao = array ("Definir Ano Letivo");
467   - $this->array_botao_url = array ("educar_escola_ano_letivo_cad.php?cod_escola={$registro["cod_escola"]}");
  344 + if ($canEdit) {
  345 + $this->url_editar = "educar_escola_cad.php?cod_escola={$registro['cod_escola']}";
  346 + $this->array_botao = ['Definir Ano Letivo'];
  347 + $this->array_botao_url = ["educar_escola_ano_letivo_cad.php?cod_escola={$registro['cod_escola']}"];
468 348 }
469 349  
470   - $styles = array ('/modules/Cadastro/Assets/Stylesheets/EscolaAnosLetivos.css');
  350 + $styles = ['/modules/Cadastro/Assets/Stylesheets/EscolaAnosLetivos.css'];
471 351  
472 352 Portabilis_View_Helper_Application::loadStylesheet($this, $styles);
473 353  
474   - $this->url_cancelar = "educar_escola_lst.php";
475   - $this->largura = "100%";
  354 + $this->url_cancelar = 'educar_escola_lst.php';
  355 + $this->largura = '100%';
476 356  
477 357 $this->breadcrumb('Detalhe da escola', [
478 358 url('intranet/educar_index.php') => 'Escola',
479 359 ]);
480 360 }
481 361  
482   - //***
483   - // Inicio listagem anos letivos
484   - //***
485   - function listaAnos()
  362 + public function listaAnos()
486 363 {
487   -
488   - if(!$this->cod_escola)
  364 + if (!$this->cod_escola) {
489 365 return false;
  366 + }
490 367  
491   - $existe = false;
  368 + $existe = false;
492 369  
493 370 $obj_ano_letivo = new clsPmieducarEscolaAnoLetivo();
494   - $obj_ano_letivo->setOrderby("ano");
495   - $lista_ano_letivo = $obj_ano_letivo->lista($this->cod_escola,null,null,null,null,null,null,null,null,1);
  371 + $obj_ano_letivo->setOrderby('ano');
  372 + $lista_ano_letivo = $obj_ano_letivo->lista($this->cod_escola, null, null, null, null, null, null, null, null, 1);
496 373  
497   - $tabela = "<table class='anosLetivos'>";
  374 + $tabela = '<table class=\'anosLetivos\'>';
498 375  
499 376 $obj_permissoes = new clsPermissoes();
500   - $canEdit = $obj_permissoes->permissao_cadastra( 561, $this->pessoa_logada, 7 );
501   -
502   - if($lista_ano_letivo)
503   - {
504   - //echo'<pre>';
505   - //print_r($lista_ano_letivo);
  377 + $canEdit = $obj_permissoes->permissao_cadastra(561, $this->pessoa_logada, 7);
  378 + $cor = null;
506 379  
507   - $existe = true;
  380 + if ($lista_ano_letivo) {
  381 + $existe = true;
508 382 $tabela .= "<tr bgcolor=$cor><td colspan='2'><b>Anos letivos</b></td></tr><tr><td>";
509   - $tabela .= "<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\" align=\"left\" width='60%'>";
510   - $tabela .= "<tr bgcolor='#ccdce6'><th width='90'>Ano<a name='ano_letivo'/></th><th width='70'>Iniciar</th><th width='70'>Finalizar</th><th width='150'>Editar</th></tr>";
511   - $cor = $cor == "#FFFFFF" ? "#f5f9fd" : "#FFFFFF";
  383 + $tabela .= '<table cellpadding="2" cellspacing="2" border="0" align="left" width=\'60%\'>';
  384 + $tabela .= '<tr bgcolor=\'#ccdce6\'><th width=\'90\'>Ano<a name=\'ano_letivo\'/></th><th width=\'70\'>Iniciar</th><th width=\'70\'>Finalizar</th><th width=\'150\'>Editar</th></tr>';
  385 + $cor = $cor == '#FFFFFF' ? '#f5f9fd' : '#FFFFFF';
512 386  
513 387 $obj_ano_letivo = new clsPmieducarEscolaAnoLetivo();
514   - $existe_ano_andamento = $obj_ano_letivo->lista($this->cod_escola,null,null,null,1,null,null,null,null,1);
  388 + $existe_ano_andamento = $obj_ano_letivo->lista($this->cod_escola, null, null, null, 1, null, null, null, null, 1);
515 389  
516   - foreach ($lista_ano_letivo as $ano)
517   - {
518   -
519   - $incluir = $excluir = "";
520   - if(!$existe_ano_andamento && $ano['andamento'] != 2 && $canEdit)
  390 + foreach ($lista_ano_letivo as $ano) {
  391 + $incluir = $excluir = '';
  392 + if (!$existe_ano_andamento && $ano['andamento'] != 2 && $canEdit) {
521 393 $incluir = "<td class='evento'><a href='#' onclick=\"preencheForm('{$ano['ano']}','{$ano['ref_cod_escola']}','iniciar');\"><img src=\"imagens/i-educar/start.gif\"> Iniciar ano letivo</a></td>";
522   - elseif ($ano['andamento'] == 0)
  394 + } elseif ($ano['andamento'] == 0) {
523 395 $incluir = "<td class='evento'><a href='#' onclick=\"preencheForm('{$ano['ano']}','{$ano['ref_cod_escola']}','iniciar');\"><img src=\"imagens/i-educar/start.gif\"> Iniciar ano letivo</a></td>";
524   - else
525   - $incluir = "<td width='130'>&nbsp;</td>";
  396 + } else {
  397 + $incluir = '<td width=\'130\'>&nbsp;</td>';
  398 + }
526 399  
527 400 //verifica se o ano nao possui matricula em andamento para permitir finalizar o ano
528 401 $obj_matricula_ano = new clsPmieducarMatricula();
529   - $matricula_em_andamento = $obj_matricula_ano->lista(null,null,$this->cod_escola,null,null,null,null,3,null,null,null,null,1,$ano['ano'],null,null,1,null,null,null,null,null,null,null,null,false);
530   - if(!$matricula_em_andamento && $existe_ano_andamento && $ano['andamento'] == 1 && $canEdit)
  402 + $matricula_em_andamento = $obj_matricula_ano->lista(null, null, $this->cod_escola, null, null, null, null, 3, null, null, null, null, 1, $ano['ano'], null, null, 1, null, null, null, null, null, null, null, null, false);
  403 + if (!$matricula_em_andamento && $existe_ano_andamento && $ano['andamento'] == 1 && $canEdit) {
531 404 $excluir = "<td class='evento'><a href='#' onclick=\"preencheForm('{$ano['ano']}','{$ano['ref_cod_escola']}','finalizar');\" ><img src=\"imagens/i-educar/stop.png\"> Finalizar ano letivo</a></td>";
532   - else
533   - {
534   -
535   - $excluir = "<td width='130'>&nbsp;</td>";
  405 + } else {
  406 + $excluir = '<td width=\'130\'>&nbsp;</td>';
536 407 }
537 408  
538   - $editar = "";//"<td align='center'> - </td>";
  409 + $editar = '';
539 410  
540   - if($ano['andamento'] == 2) {
  411 + if ($ano['andamento'] == 2) {
541 412 if ($this->nivel_usuario == self::POLI_INSTITUCIONAL || $this->nivel_usuario == self::INSTITUCIONAL) {
542 413 $incluir = "<td class='evento'><a href='#' onclick=\"preencheForm('{$ano['ano']}','{$ano['ref_cod_escola']}','reabrir');\"><img src=\"imagens/banco_imagens/reload.jpg\"> Reabrir ano letivo</a></td>";
543 414 }
544   - $incluir .= "<td colspan='1' align='center'><span class='formlttd'><b>--- Ano Finalizado ---</b></span></td>";
545   - } elseif($canEdit)
  415 + $incluir .= '<td colspan=\'1\' align=\'center\'><span class=\'formlttd\'><b>--- Ano Finalizado ---</b></span></td>';
  416 + } elseif ($canEdit) {
546 417 $editar = "<td class='evento'><a href='#' onclick=\"preencheForm('{$ano['ano']}','{$ano['ref_cod_escola']}','editar');\" ><img src=\"imagens/banco_imagens/e.gif\" > Editar ano letivo</a></td>";
  418 + }
547 419  
548 420 $tabela .= "<tr bgcolor='$cor'><td style='padding-left:20px'><img src=\"imagens/noticia.jpg\" border='0'> {$ano['ano']}</td>{$incluir}{$excluir}{$editar}</tr>";
549 421 }
550 422  
551   - $tabela .= "</table></td></tr>";
552   - $tabela .= "<tr>
  423 + $tabela .= '</table></td></tr>';
  424 + $tabela .= '<tr>
553 425 <td>
554   - <span class='formlttd'><b>*Somente &eacute; poss&iacute;vel finalizar um ano letivo ap&oacute;s n&atilde;o existir mais nenhuma matr&iacute;cula em andamento.</b></span>
  426 + <span class=\'formlttd\'><b>*Somente &eacute; poss&iacute;vel finalizar um ano letivo ap&oacute;s n&atilde;o existir mais nenhuma matr&iacute;cula em andamento.</b></span>
555 427 </td>
556   - </tr>";
557   - if(!$canEdit)
558   - $tabela .= "<tr>
  428 + </tr>';
  429 + if (!$canEdit) {
  430 + $tabela .= '<tr>
559 431 <td>
560   - <span class='formlttd'><b>**Somente usu&aacute;rios com permiss&atilde;o de edi&ccedil;&atilde;o de escola podem alterar anos letivos.</b></span>
  432 + <span class=\'formlttd\'><b>**Somente usu&aacute;rios com permiss&atilde;o de edição de escola podem alterar anos letivos.</b></span>
561 433 </td>
562   - </tr>";
563   - $tabela .= "<tr>
  434 + </tr>';
  435 + }
  436 + $tabela .= '<tr>
564 437 <td>
565   - <form name='acao_ano_letivo' action='educar_iniciar_ano_letivo.php' method='post'>
566   - <input type='hidden' name='ano' id='ano'>
567   - <input type='hidden' name='ref_cod_escola' id='ref_cod_escola'>
568   - <input type='hidden' name='tipo_acao' id='tipo_acao'>
  438 + <form name=\'acao_ano_letivo\' action=\'educar_iniciar_ano_letivo.php\' method=\'post\'>
  439 + <input type=\'hidden\' name=\'ano\' id=\'ano\'>
  440 + <input type=\'hidden\' name=\'ref_cod_escola\' id=\'ref_cod_escola\'>
  441 + <input type=\'hidden\' name=\'tipo_acao\' id=\'tipo_acao\'>
569 442 </form>
570 443 </td>
571   - </tr>";
  444 + </tr>';
572 445 }
573 446  
574   - $tabela .="</table>";
  447 + $tabela .= '</table>';
575 448  
576   - return $existe == true ? $tabela : false;
  449 + return $existe == true ? $tabela : false;
577 450 }
578   - //***
579   - // Fim listagem anos letivos
580   - //***
581 451 }
582 452  
583   -// cria uma extensao da classe base
584 453 $pagina = new clsIndexBase();
585   -// cria o conteudo
586 454 $miolo = new indice();
587   -// adiciona o conteudo na clsBase
588   -$pagina->addForm( $miolo );
589   -// gera o html
  455 +
  456 +$pagina->addForm($miolo);
590 457 $pagina->MakeAll();
  458 +
591 459 ?>
592 460 <script>
593   -function preencheForm(ano, escola,acao){
594   -
  461 + function preencheForm (ano, escola, acao) {
  462 + if (!confirm('Deseja realmente \'' + acao.substr(0, 1).toUpperCase() + acao.substr(1) + '\' o ano letivo?')) {
  463 + return false;
  464 + }
595 465  
596   - if(!confirm('Deseja realmente \'' + acao.substr(0, 1).toUpperCase() + acao.substr(1) + '\' o ano letivo?'))
597   - return false;
598   - document.acao_ano_letivo.ano.value = ano;
  466 + document.acao_ano_letivo.ano.value = ano;
599 467 document.acao_ano_letivo.ref_cod_escola.value = escola;
600   - document.acao_ano_letivo.tipo_acao.value = acao;
  468 + document.acao_ano_letivo.tipo_acao.value = acao;
601 469 document.acao_ano_letivo.submit();
602   -
603   -}
604   -
  470 + }
605 471 </script>
... ...
ieducar/intranet/educar_escola_lst.php
1 1 <?php
2   -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3   - * *
4   - * @author Prefeitura Municipal de Itajaí *
5   - * @updated 29/03/2007 *
6   - * Pacote: i-PLB Software Público Livre e Brasileiro *
7   - * *
8   - * Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí *
9   - * ctima@itajai.sc.gov.br *
10   - * *
11   - * Este programa é software livre, você pode redistribuí-lo e/ou *
12   - * modificá-lo sob os termos da Licença Pública Geral GNU, conforme *
13   - * publicada pela Free Software Foundation, tanto a versão 2 da *
14   - * Licença como (a seu critério) qualquer versão mais nova. *
15   - * *
16   - * Este programa é distribuído na expectativa de ser útil, mas SEM *
17   - * QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- *
18   - * ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- *
19   - * sulte a Licença Pública Geral GNU para obter mais detalhes. *
20   - * *
21   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU *
22   - * junto com este programa. Se não, escreva para a Free Software *
23   - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *
24   - * 02111-1307, USA. *
25   - * *
26   - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27   -require_once ("include/clsBase.inc.php");
28   -require_once ("include/clsListagem.inc.php");
29   -require_once ("include/clsBanco.inc.php");
30   -require_once( "include/pmieducar/geral.inc.php" );
  2 +
  3 +require_once 'include/clsBase.inc.php';
  4 +require_once 'include/clsListagem.inc.php';
  5 +require_once 'include/clsBanco.inc.php';
  6 +require_once 'include/pmieducar/geral.inc.php';
31 7  
32 8 class clsIndexBase extends clsBase
33 9 {
34   -
35   - function Formular()
  10 + public function Formular()
36 11 {
37   - $this->SetTitulo( "{$this->_instituicao} i-Educar - Escola" );
38   - $this->processoAp = "561";
39   - $this->addEstilo("localizacaoSistema");
  12 + $this->SetTitulo("{$this->_instituicao} i-Educar - Escola");
  13 + $this->processoAp = 561;
  14 + $this->addEstilo('localizacaoSistema');
40 15 }
41 16 }
42 17  
43 18 class indice extends clsListagem
44 19 {
45 20 /**
46   - * Referencia pega da session para o idpes do usuario atual
47   - *
48   - * @var int
49   - */
50   - var $pessoa_logada;
51   -
52   - /**
53   - * Titulo no topo da pagina
54   - *
55   - * @var int
56   - */
57   - var $titulo;
58   -
59   - /**
60 21 * Quantidade de registros a ser apresentada em cada pagina
61 22 *
62 23 * @var int
63 24 */
64   - var $limite;
  25 + public $limite;
65 26  
66 27 /**
67 28 * Inicio dos registros a serem exibidos (limit)
68 29 *
69 30 * @var int
70 31 */
71   - var $offset;
72   -
73   - var $cod_escola;
74   - var $ref_usuario_cad;
75   - var $ref_usuario_exc;
76   - var $ref_cod_instituicao;
77   - var $ref_cod_escola_rede_ensino;
78   - var $ref_idpes;
79   - var $sigla;
80   - var $data_cadastro;
81   - var $data_exclusao;
82   - var $ativo;
83   - var $nm_escola;
84   -
85   - function Gerar()
  32 + public $offset;
  33 +
  34 + public $cod_escola;
  35 + public $ref_usuario_cad;
  36 + public $ref_usuario_exc;
  37 + public $ref_cod_instituicao;
  38 + public $ref_cod_escola_rede_ensino;
  39 + public $ref_idpes;
  40 + public $sigla;
  41 + public $data_cadastro;
  42 + public $data_exclusao;
  43 + public $ativo;
  44 + public $nm_escola;
  45 +
  46 + public function Gerar()
86 47 {
87   - $this->titulo = "Escola - Listagem";
  48 + $this->titulo = 'Escola - Listagem';
88 49  
89 50 $obj_permissoes = new clsPermissoes();
90 51  
91   - foreach( $_GET AS $var => $val ) // passa todos os valores obtidos no GET para atributos do objeto
92   - $this->$var = ( $val === "" ) ? null: $val;
93   -
  52 + foreach ($_GET as $var => $val) { // passa todos os valores obtidos no GET para atributos do objeto
  53 + $this->$var = ($val === '') ? null : $val;
  54 + }
94 55  
  56 + $cabecalhos = ['Escola'];
  57 + $nivel = $this->user()->getLevel();
95 58  
96   - $cabecalhos = array("Escola");
97   - $nivel = $obj_permissoes->nivel_acesso($this->pessoa_logada);
98   - if( $nivel == 1 )
99   - {
100   - $cabecalhos[] = "Institui&ccedil;&atilde;o";
  59 + if ($nivel == 1) {
  60 + $cabecalhos[] = 'Instituição';
101 61 $objInstituicao = new clsPmieducarInstituicao();
102   - $opcoes = array( "" => "Selecione" );
103   - $objInstituicao->setOrderby( "nm_instituicao ASC" );
  62 + $opcoes = ['' => 'Selecione'];
  63 + $objInstituicao->setOrderby('nm_instituicao ASC');
104 64 $lista = $objInstituicao->lista();
105   - if( is_array( $lista ) )
106   - {
107   - foreach ( $lista AS $linha )
108   - {
109   - $opcoes[$linha["cod_instituicao"]] = $linha["nm_instituicao"];
  65 + if (is_array($lista)) {
  66 + foreach ($lista as $linha) {
  67 + $opcoes[$linha['cod_instituicao']] = $linha['nm_instituicao'];
110 68 }
111 69 }
112   - $this->campoLista( "ref_cod_instituicao", "Institui&ccedil;&atilde;o", $opcoes, $this->ref_cod_instituicao, false, false, false, false, false, false );
113   - }
114   - else
115   - {
116   - $this->ref_cod_instituicao = $obj_permissoes->getInstituicao($this->pessoa_logada );
117   - if( $this->ref_cod_instituicao )
118   - {
119   - $this->campoOculto( "ref_cod_instituicao", $this->ref_cod_instituicao );
120   - }
121   - else
122   - {
123   - die( "Erro: Usuário não é do nivel poli-institucional e não possui uma instituição" );
  70 + $this->campoLista('ref_cod_instituicao', 'Instituição', $opcoes, $this->ref_cod_instituicao, false, false, false, false, false, false);
  71 + } else {
  72 + $this->ref_cod_instituicao = $obj_permissoes->getInstituicao($this->pessoa_logada);
  73 + if ($this->ref_cod_instituicao) {
  74 + $this->campoOculto('ref_cod_instituicao', $this->ref_cod_instituicao);
  75 + } else {
  76 + die('Erro: Usuário não é do nivel poli-institucional e não possui uma instituição');
124 77 }
125 78 }
126   - $this->addCabecalhos( $cabecalhos );
127 79  
128   - $this->campoTexto( "nm_escola", "Escola", $this->nm_escola, 30, 255, false );
  80 + $this->addCabecalhos($cabecalhos);
  81 +
  82 + $this->campoTexto('nm_escola', 'Escola', $this->nm_escola, 30, 255, false);
129 83  
130 84 // Filtros de Foreign Keys
131 85 $this->limite = 10;
... ... @@ -135,11 +89,12 @@ class indice extends clsListagem
135 89 $obj_escola->codUsuario = $this->pessoa_logada;
136 90 }
137 91  
138   - if ($this->pagina_formulario){
139   - $obj_escola->setLimite( $this->limite, ( $this->pagina_formulario - 1 ) * $this->limite );
  92 + if ($this->pagina_formulario) {
  93 + $obj_escola->setLimite($this->limite, ($this->pagina_formulario - 1) * $this->limite);
140 94 } else {
141   - $obj_escola->setLimite( $this->limite );
  95 + $obj_escola->setLimite($this->limite);
142 96 }
  97 +
143 98 $obj_escola->setOrderby('nome');
144 99 $lista = $obj_escola->lista(
145 100 null,
... ... @@ -159,44 +114,39 @@ class indice extends clsListagem
159 114 );
160 115  
161 116 $total = $obj_escola->_total;
162   - // monta a lista
163   - if( is_array( $lista ) && count( $lista ) )
164   - {
165   - foreach ( $lista AS $registro )
166   - {
167   -
168   - $linha = array();
169   -
170   - $linha[] = "<a href=\"educar_escola_det.php?cod_escola={$registro["cod_escola"]}\">{$registro["nome"]}</a>";
171   - if( $nivel == 1 )
172   - {
173   - $objInstituicao = new clsPmieducarInstituicao( $registro["ref_cod_instituicao"] );
  117 +
  118 + if (is_array($lista) && count($lista)) {
  119 + foreach ($lista as $registro) {
  120 + $linha = [];
  121 +
  122 + $linha[] = "<a href=\"educar_escola_det.php?cod_escola={$registro['cod_escola']}\">{$registro['nome']}</a>";
  123 + if ($nivel == 1) {
  124 + $objInstituicao = new clsPmieducarInstituicao($registro['ref_cod_instituicao']);
174 125 $detInstituicao = $objInstituicao->detalhe();
175 126  
176   - $linha[] = "<a href=\"educar_escola_det.php?cod_escola={$registro["cod_escola"]}\">{$detInstituicao["nm_instituicao"]}</a>";
  127 + $linha[] = "<a href=\"educar_escola_det.php?cod_escola={$registro['cod_escola']}\">{$detInstituicao['nm_instituicao']}</a>";
177 128 }
178   - $this->addLinhas( $linha );
  129 + $this->addLinhas($linha);
179 130 }
180 131 }
181   - $this->addPaginador2( "educar_escola_lst.php", $total, $_GET, $this->nome, $this->limite );
182   - if( $obj_permissoes->permissao_cadastra( 561, $this->pessoa_logada, 3 ) )
183   - {
184   - $this->acao = "go(\"educar_escola_cad.php\")";
185   - $this->nome_acao = "Novo";
  132 +
  133 + $this->addPaginador2('educar_escola_lst.php', $total, $_GET, $this->nome, $this->limite);
  134 +
  135 + if ($obj_permissoes->permissao_cadastra(561, $this->pessoa_logada, 3)) {
  136 + $this->acao = 'go("educar_escola_cad.php")';
  137 + $this->nome_acao = 'Novo';
186 138 }
187   - $this->largura = "100%";
  139 +
  140 + $this->largura = '100%';
188 141  
189 142 $this->breadcrumb('Listagem de escolas', [
190 143 url('intranet/educar_index.php') => 'Escola',
191 144 ]);
192 145 }
193 146 }
194   -// cria uma extensao da classe base
  147 +
195 148 $pagina = new clsIndexBase();
196   -// cria o conteudo
197 149 $miolo = new indice();
198   -// adiciona o conteudo na clsBase
199   -$pagina->addForm( $miolo );
200   -// gera o html
  150 +
  151 +$pagina->addForm($miolo);
201 152 $pagina->MakeAll();
202   -?>
... ...
ieducar/intranet/educar_matricula_cad.php
1 1 <?php
2 2  
  3 +use App\Models\LegacyRegistration;
  4 +use App\Services\PromotionService;
3 5 use App\Services\SchoolClass\AvailableTimeService;
4 6 use Illuminate\Http\Exceptions\HttpResponseException;
5 7 use Illuminate\Http\RedirectResponse;
... ... @@ -354,6 +356,7 @@ class indice extends clsCadastro
354 356  
355 357 public function Novo()
356 358 {
  359 +
357 360 $dependencia = $this->dependencia == 'on';
358 361  
359 362 if ($dependencia && !$this->verificaQtdeDependenciasPermitida()) {
... ... @@ -960,6 +963,13 @@ class indice extends clsCadastro
960 963 $this->enturmacaoMatricula($this->cod_matricula, $this->ref_cod_turma);
961 964 $this->verificaSolicitacaoTransferencia();
962 965  
  966 + /** @var LegacyRegistration $registration */
  967 +
  968 + $registration = LegacyRegistration::find($this->cod_matricula);
  969 +
  970 + $promocao = new PromotionService($registration->enrollments()->first());
  971 + $promocao->fakeRequest();
  972 +
963 973 $this->mensagem = 'Cadastro efetuado com sucesso.<br />';
964 974  
965 975 DB::commit();
... ...
ieducar/intranet/educar_sequencia_serie_xml.php
... ... @@ -39,7 +39,8 @@
39 39 $consulta = "SELECT cod_serie, nm_serie
40 40 FROM pmieducar.serie
41 41 WHERE ref_cod_curso = ". $_GET["cur"] .
42   - " AND cod_serie <>" .
  42 + " AND ativo = 1
  43 + AND cod_serie <>" .
43 44 $_GET['ser_dif'] .
44 45 " ORDER BY nm_serie" ;
45 46 $db->Consulta( $consulta );
... ...
ieducar/intranet/educar_servidor_cad.php
1 1 <?php
2   -// error_reporting(E_ALL);
3   -// ini_set("display_errors", 1);
4   -/**
5   - * i-Educar - Sistema de gestão escolar
6   - *
7   - * Copyright (C) 2006 Prefeitura Municipal de Itajaí
8   - * <ctima@itajai.sc.gov.br>
9   - *
10   - * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo
11   - * sob os termos da Licença Pública Geral GNU conforme publicada pela Free
12   - * Software Foundation; tanto a versão 2 da Licença, como (a seu critério)
13   - * qualquer versão posterior.
14   - *
15   - * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM
16   - * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU
17   - * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
18   - * do GNU para mais detalhes.
19   - *
20   - * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
21   - * com este programa; se não, escreva para a Free Software Foundation, Inc., no
22   - * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
23   - *
24   - * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br>
25   - * @category i-Educar
26   - * @license @@license@@
27   - * @package iEd_Pmieducar
28   - * @since Arquivo disponível desde a versão 1.0.0
29   - * @version $Id$
30   - */
31 2  
32 3 use App\Models\EmployeeGraduation;
33 4 use App\Models\LegacySchoolingDegree;
34 5 use App\Services\EmployeeGraduationService;
35 6 use iEducar\Modules\Educacenso\Model\Escolaridade;
36   -use iEducar\Modules\Educacenso\Validator\DeficiencyValidator;
37 7 use iEducar\Modules\ValueObjects\EmployeeGraduationValueObject;
38 8 use iEducar\Support\View\SelectOptions;
39 9 use Illuminate\Support\Facades\DB;
... ... @@ -49,465 +19,463 @@ require_once &#39;lib/Portabilis/String/Utils.php&#39;;
49 19  
50 20 require_once 'Educacenso/Model/DocenteDataMapper.php';
51 21  
52   -/**
53   - * clsIndexBase class.
54   - *
55   - * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br>
56   - * @category i-Educar
57   - * @license @@license@@
58   - * @package iEd_Pmieducar
59   - * @since Classe disponível desde a versão 1.0.0
60   - * @version @@package_version@@
61   - */
62 22 class clsIndexBase extends clsBase
63 23 {
64   - function Formular()
65   - {
66   - $this->SetTitulo($this->_instituicao . ' Servidores - Servidor');
67   - $this->processoAp = 635;
68   - $this->addEstilo("localizacaoSistema");
69   - }
  24 + public function Formular()
  25 + {
  26 + $this->SetTitulo($this->_instituicao . ' Servidores - Servidor');
  27 + $this->processoAp = 635;
  28 + $this->addEstilo('localizacaoSistema');
  29 + }
70 30 }
71 31  
72   -/**
73   - * indice class.
74   - *
75   - * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br>
76   - * @category i-Educar
77   - * @license @@license@@
78   - * @package iEd_Pmieducar
79   - * @since Classe disponível desde a versão 1.0.0
80   - * @version @@package_version@@
81   - */
82 32 class indice extends clsCadastro
83 33 {
84   - var $pessoa_logada;
85   - var $cod_servidor;
86   - var $ref_cod_instituicao;
87   - var $ref_idesco;
88   - var $ref_cod_funcao = array();
89   - var $carga_horaria;
90   - var $data_cadastro;
91   - var $data_exclusao;
92   - var $ativo;
93   - var $ref_cod_instituicao_original;
94   - var $curso_formacao_continuada;
95   - var $multi_seriado;
96   - var $tipo_ensino_medio_cursado;
97   - var $matricula = array();
98   - var $cod_servidor_funcao = [];
99   -
100   - var $total_horas_alocadas;
101   -
102   - var $cod_docente_inep;
103   -
104   - // Determina se o servidor é um docente para buscar código Educacenso/Inep.
105   - var $docente = false;
106   -
107   - var $employee_course_id;
108   - var $employee_completion_year;
109   - var $employee_college_id;
110   - var $employee_discipline_id;
111   -
112   - function Inicializar()
113   - {
114   - $retorno = 'Novo';
115   -
116   -
117   - $this->cod_servidor = $_GET['cod_servidor'];
118   - $this->ref_cod_instituicao = $_GET['ref_cod_instituicao'];
119   - $this->ref_cod_instituicao_original = $_GET['ref_cod_instituicao'];
120   -
121   - if ($_POST['ref_cod_instituicao_original']) {
122   - $this->ref_cod_instituicao_original = $_POST['ref_cod_instituicao_original'];
123   - }
  34 + public $pessoa_logada;
  35 + public $cod_servidor;
  36 + public $ref_cod_instituicao;
  37 + public $ref_idesco;
  38 + public $ref_cod_funcao = [];
  39 + public $carga_horaria;
  40 + public $data_cadastro;
  41 + public $data_exclusao;
  42 + public $ativo;
  43 + public $ref_cod_instituicao_original;
  44 + public $curso_formacao_continuada;
  45 + public $multi_seriado;
  46 + public $tipo_ensino_medio_cursado;
  47 + public $matricula = [];
  48 + public $cod_servidor_funcao = [];
  49 +
  50 + public $total_horas_alocadas;
  51 +
  52 + public $cod_docente_inep;
  53 +
  54 + // Determina se o servidor é um docente para buscar código Educacenso/Inep.
  55 + public $docente = false;
  56 +
  57 + public $employee_course_id;
  58 + public $employee_completion_year;
  59 + public $employee_college_id;
  60 + public $employee_discipline_id;
  61 +
  62 + public function Inicializar()
  63 + {
  64 + $retorno = 'Novo';
124 65  
125   - $obj_permissoes = new clsPermissoes();
126   - $obj_permissoes->permissao_cadastra(
127   - 635,
128   - $this->pessoa_logada,
129   - 7,
130   - 'educar_servidor_lst.php'
131   - );
132   - if (is_numeric($this->cod_servidor) && is_numeric($this->ref_cod_instituicao)) {
133   - $obj = new clsPmieducarServidor(
134   - $this->cod_servidor,
135   - null,
136   - null,
137   - null,
138   - null,
139   - null,
140   - null,
141   - $this->ref_cod_instituicao
142   - );
143   -
144   - $registro = $obj->detalhe();
145   -
146   - if ($registro) {
147   - // passa todos os valores obtidos no registro para atributos do objeto
148   - foreach ($registro as $campo => $val) {
149   - $this->$campo = $val;
150   - }
  66 + $this->cod_servidor = $this->getQueryString('cod_servidor');
  67 + $this->ref_cod_instituicao = $this->getQueryString('ref_cod_instituicao');
  68 + $this->ref_cod_instituicao_original = $this->getQueryString('ref_cod_instituicao');
151 69  
152   - $this->multi_seriado = dbBool($this->multi_seriado);
  70 + if ($_POST['ref_cod_instituicao_original']) {
  71 + $this->ref_cod_instituicao_original = $_POST['ref_cod_instituicao_original'];
  72 + }
153 73  
154 74 $obj_permissoes = new clsPermissoes();
155   - if ($obj_permissoes->permissao_excluir(635, $this->pessoa_logada, 7)) {
156   - $this->fexcluir = TRUE;
  75 + $obj_permissoes->permissao_cadastra(
  76 + 635,
  77 + $this->pessoa_logada,
  78 + 7,
  79 + 'educar_servidor_lst.php'
  80 + );
  81 + if (is_numeric($this->cod_servidor) && is_numeric($this->ref_cod_instituicao)) {
  82 + $obj = new clsPmieducarServidor(
  83 + $this->cod_servidor,
  84 + null,
  85 + null,
  86 + null,
  87 + null,
  88 + null,
  89 + null,
  90 + $this->ref_cod_instituicao
  91 + );
  92 +
  93 + $registro = $obj->detalhe();
  94 +
  95 + if ($registro) {
  96 + // passa todos os valores obtidos no registro para atributos do objeto
  97 + foreach ($registro as $campo => $val) {
  98 + $this->$campo = $val;
  99 + }
  100 +
  101 + $this->multi_seriado = dbBool($this->multi_seriado);
  102 +
  103 + $obj_permissoes = new clsPermissoes();
  104 + if ($obj_permissoes->permissao_excluir(635, $this->pessoa_logada, 7)) {
  105 + $this->fexcluir = true;
  106 + }
  107 +
  108 + $db = new clsBanco();
  109 +
  110 + // Carga horária alocada no ultimo ano de alocação
  111 + $sql = sprintf("
  112 + SELECT
  113 + carga_horaria
  114 + FROM
  115 + pmieducar.servidor_alocacao
  116 + WHERE
  117 + ref_cod_servidor = '%d' AND
  118 + ativo = 1
  119 + AND ano = (
  120 + SELECT max(ano)
  121 + FROM pmieducar.servidor_alocacao
  122 + WHERE ref_cod_servidor = $this->cod_servidor
  123 + )",
  124 + $this->cod_servidor
  125 + );
  126 +
  127 + $db->Consulta($sql);
  128 +
  129 + $carga = 0;
  130 + while ($db->ProximoRegistro()) {
  131 + $cargaHoraria = $db->Tupla();
  132 + $cargaHoraria = explode(':', $cargaHoraria['carga_horaria']);
  133 + $carga += $cargaHoraria[0] * 60 + $cargaHoraria[1];
  134 + }
  135 +
  136 + $this->total_horas_alocadas = sprintf('%02d:%02d', $carga / 60, $carga % 60);
  137 + // Funções
  138 + $obj_funcoes = new clsPmieducarServidorFuncao();
  139 + $lst_funcoes = $obj_funcoes->lista($this->ref_cod_instituicao, $this->cod_servidor);
  140 +
  141 + if ($lst_funcoes) {
  142 + foreach ($lst_funcoes as $funcao) {
  143 + $obj_funcao = new clsPmieducarFuncao($funcao['ref_cod_funcao']);
  144 + $det_funcao = $obj_funcao->detalhe();
  145 +
  146 + $this->ref_cod_funcao[] = [$funcao['ref_cod_funcao'] . '-' . $det_funcao['professor'], null, null, $funcao['matricula'], $funcao['cod_servidor_funcao']];
  147 +
  148 + if (false == $this->docente && (bool) $det_funcao['professor']) {
  149 + $this->docente = true;
  150 + }
  151 + }
  152 + }
  153 +
  154 + $obj_servidor_disciplina = new clsPmieducarServidorDisciplina();
  155 + $lst_servidor_disciplina = $obj_servidor_disciplina->lista(null, $this->ref_cod_instituicao, $this->cod_servidor);
  156 +
  157 + if ($lst_servidor_disciplina) {
  158 + foreach ($lst_servidor_disciplina as $disciplina) {
  159 + $obj_disciplina = new clsPmieducarDisciplina($disciplina['ref_cod_disciplina']);
  160 + $det_disciplina = $obj_disciplina->detalhe();
  161 + $this->cursos_disciplina[$det_disciplina['ref_cod_curso']][$disciplina['ref_cod_disciplina']] = $disciplina['ref_cod_disciplina'];
  162 + }
  163 + }
  164 +
  165 + if (is_string($this->pos_graduacao)) {
  166 + $this->pos_graduacao = explode(',', str_replace(['{', '}'], '', $this->pos_graduacao));
  167 + }
  168 +
  169 + if (is_string($this->curso_formacao_continuada)) {
  170 + $this->curso_formacao_continuada = explode(',', str_replace(['{', '}'], '', $this->curso_formacao_continuada));
  171 + }
  172 +
  173 + if (Session::get('cod_servidor') == $this->cod_servidor) {
  174 + Session::put('cursos_disciplina', $this->cursos_disciplina);
  175 + } else {
  176 + Session::forget('cursos_disciplina');
  177 + }
  178 +
  179 + $retorno = 'Editar';
  180 + }
157 181 }
158 182  
159   - $db = new clsBanco();
160   -
161   - // Carga horária alocada no ultimo ano de alocação
162   - $sql = sprintf("SELECT
163   - carga_horaria
164   - FROM
165   - pmieducar.servidor_alocacao
166   - WHERE
167   - ref_cod_servidor = '%d' AND
168   - ativo = 1
169   - AND ano = (SELECT max(ano)
170   - FROM pmieducar.servidor_alocacao
171   - WHERE ref_cod_servidor = $this->cod_servidor)", $this->cod_servidor);
172   -
173   - $db->Consulta($sql);
174   -
175   - $carga = 0;
176   - while ($db->ProximoRegistro()) {
177   - $cargaHoraria = $db->Tupla();
178   - $cargaHoraria = explode(':', $cargaHoraria['carga_horaria']);
179   - $carga += $cargaHoraria[0] * 60 + $cargaHoraria[1];
180   - }
  183 + $this->url_cancelar = ($retorno == 'Editar') ?
  184 + "educar_servidor_det.php?cod_servidor={$this->cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}" :
  185 + 'educar_servidor_lst.php';
181 186  
182   - $this->total_horas_alocadas = sprintf('%02d:%02d', $carga / 60, $carga % 60);
183   - // Funções
184   - $obj_funcoes = new clsPmieducarServidorFuncao();
185   - $lst_funcoes = $obj_funcoes->lista($this->ref_cod_instituicao, $this->cod_servidor);
  187 + $this->nome_url_cancelar = 'Cancelar';
186 188  
187   - if ($lst_funcoes) {
188   - foreach ($lst_funcoes as $funcao) {
189   - $obj_funcao = new clsPmieducarFuncao($funcao['ref_cod_funcao']);
190   - $det_funcao = $obj_funcao->detalhe();
  189 + $nomeMenu = $retorno == 'Editar' ? $retorno : 'Cadastrar';
191 190  
192   - $this->ref_cod_funcao[] = array($funcao['ref_cod_funcao'] . '-' . $det_funcao['professor'], null, null, $funcao['matricula'], $funcao['cod_servidor_funcao']);
  191 + $this->breadcrumb($nomeMenu . ' servidor', [
  192 + url('intranet/educar_servidores_index.php') => 'Servidores',
  193 + ]);
193 194  
194   - if (false == $this->docente && (bool) $det_funcao['professor']) {
195   - $this->docente = true;
196   - }
  195 + return $retorno;
  196 + }
197 197  
198   - }
  198 + /**
  199 + * Gerar formulário
  200 + */
  201 + public function Gerar()
  202 + {
  203 + // Foreign keys
  204 + $obrigatorio = true;
  205 + $get_instituicao = true;
  206 + include 'include/pmieducar/educar_campo_lista.php';
  207 +
  208 + $obrigarCamposCenso = $this->validarCamposObrigatoriosCenso();
  209 + $this->campoOculto('obrigar_campos_censo', (int) $obrigarCamposCenso);
  210 +
  211 + /**
  212 + * Selecionar funcionário,
  213 + * Escolher a pessoa (não o usuário)
  214 + */
  215 + $opcoes = ['' => 'Para procurar, clique na lupa ao lado.'];
  216 + if ($this->cod_servidor) {
  217 + $servidor = new clsFuncionario($this->cod_servidor);
  218 + $detalhe = $servidor->detalhe();
  219 + //$detalhe = $detalhe['idpes']->detalhe();
  220 +
  221 + $this->campoRotulo('nm_servidor', 'Pessoa', $servidor->nome);
  222 + $this->campoOculto('cod_servidor', $this->cod_servidor);
  223 + $this->campoOculto(
  224 + 'ref_cod_instituicao_original',
  225 + $this->ref_cod_instituicao_original
  226 + );
  227 + } else {
  228 + $parametros = new clsParametrosPesquisas();
  229 + $parametros->setSubmit(0);
  230 + $parametros->adicionaCampoSelect(
  231 + 'cod_servidor',
  232 + 'idpes',
  233 + 'nome'
  234 + );
  235 +
  236 + // Configurações do campo de pesquisa
  237 + $this->campoListaPesq(
  238 + 'cod_servidor',
  239 + 'Pessoa',
  240 + $opcoes,
  241 + $this->cod_servidor,
  242 + 'pesquisa_pessoa_lst.php',
  243 + '',
  244 + false,
  245 + '',
  246 + '',
  247 + null,
  248 + null,
  249 + '',
  250 + false,
  251 + $parametros->serializaCampos(),
  252 + true
  253 + );
199 254 }
200 255  
201   - $obj_servidor_disciplina = new clsPmieducarServidorDisciplina();
202   - $lst_servidor_disciplina = $obj_servidor_disciplina->lista(NULL, $this->ref_cod_instituicao,$this->cod_servidor);
  256 + // ----
  257 + $this->inputsHelper()->integer(
  258 + 'cod_docente_inep',
  259 + [
  260 + 'label' => 'Código INEP',
  261 + 'required' => false,
  262 + 'label_hint' => 'Somente números',
  263 + 'max_length' => 12,
  264 + 'placeholder' => 'INEP'
  265 + ]
  266 + );
  267 +
  268 + $helperOptions = ['objectName' => 'deficiencias'];
  269 + $options = [
  270 + 'label' => 'Deficiências',
  271 + 'size' => 50,
  272 + 'required' => false,
  273 + 'options' => ['value' => null]
  274 + ];
203 275  
204   - if ($lst_servidor_disciplina) {
205   - foreach ($lst_servidor_disciplina as $disciplina) {
206   - $obj_disciplina = new clsPmieducarDisciplina($disciplina['ref_cod_disciplina']);
207   - $det_disciplina = $obj_disciplina->detalhe();
208   - $this->cursos_disciplina[$det_disciplina['ref_cod_curso']][$disciplina['ref_cod_disciplina']] = $disciplina['ref_cod_disciplina'];
209   - }
  276 + $this->inputsHelper()->multipleSearchDeficiencias(
  277 + '',
  278 + $options,
  279 + $helperOptions
  280 + );
  281 +
  282 + $opcoes = ['' => 'Selecione'];
  283 +
  284 + if (class_exists('clsPmieducarFuncao')) {
  285 + if (is_numeric($this->ref_cod_instituicao)) {
  286 + $objTemp = new clsPmieducarFuncao();
  287 + $objTemp->setOrderby('nm_funcao ASC');
  288 + $lista = $objTemp->lista(null, null, null, null, null, null, null, null, null, null, 1, $this->ref_cod_instituicao);
  289 +
  290 + if (is_array($lista) && count($lista)) {
  291 + foreach ($lista as $registro) {
  292 + $opcoes[$registro['cod_funcao'] . '-' . $registro['professor']] = $registro['nm_funcao'];
  293 + }
  294 + }
  295 + }
  296 + } else {
  297 + echo "<!--\nErro\nClasse clsPmieducarFuncao nao encontrada\n-->";
  298 + $opcoes = ['' => 'Erro na geracao'];
210 299 }
211 300  
212   - if (is_string($this->pos_graduacao)) {
213   - $this->pos_graduacao = explode(',',str_replace(array('{', "}"), '', $this->pos_graduacao));
  301 + $this->campoTabelaInicio(
  302 + 'funcao',
  303 + 'Funções Servidor',
  304 + [
  305 + 'Função',
  306 + 'Componentes Curriculares',
  307 + 'Cursos',
  308 + 'Matrícula'],
  309 + ($this->ref_cod_funcao)
  310 + );
  311 +
  312 + $funcao = 'popless()';
  313 +
  314 + $this->campoLista('ref_cod_funcao', 'Função', $opcoes, $this->ref_cod_funcao, 'funcaoChange(this)', '', '', '');
  315 +
  316 + $this->campoRotulo(
  317 + 'disciplina',
  318 + 'Componentes Curriculares',
  319 + "<img src='imagens/lupa_antiga.png' border='0' style='cursor:pointer;' alt='Buscar Componente Curricular' title='Buscar Componente Curricular' onclick=\"$funcao\">"
  320 + );
  321 +
  322 + $funcao = 'popCurso()';
  323 +
  324 + $this->campoRotulo(
  325 + 'curso',
  326 + 'Curso',
  327 + "<img src='imagens/lupa_antiga.png' border='0' style='cursor:pointer;' alt='Buscar Cursos' title='Buscar Cursos' onclick=\"$funcao\">"
  328 + );
  329 +
  330 + $this->campoTexto('matricula', 'Matricula', $this->matricula);
  331 +
  332 + $this->campoOculto('cod_servidor_funcao', null);
  333 +
  334 + $this->campoTabelaFim();
  335 +
  336 + if (strtoupper($this->tipoacao) == 'EDITAR') {
  337 + $this->campoTextoInv(
  338 + 'total_horas_alocadas_',
  339 + 'Total de Horas Alocadadas',
  340 + $this->total_horas_alocadas,
  341 + 9,
  342 + 20
  343 + );
  344 +
  345 + $hora = explode(':', $this->total_horas_alocadas);
  346 + $this->total_horas_alocadas = $hora[0] + ($hora[1] / 60);
  347 + $this->campoOculto('total_horas_alocadas', $this->total_horas_alocadas);
  348 + $this->acao_enviar = 'acao2()';
214 349 }
215 350  
216   - if (is_string($this->curso_formacao_continuada)) {
217   - $this->curso_formacao_continuada = explode(',',str_replace(array('{', "}"), '', $this->curso_formacao_continuada));
  351 + if ($this->carga_horaria) {
  352 + $horas = (int) $this->carga_horaria;
  353 + $minutos = round(($this->carga_horaria - (int) $this->carga_horaria) * 60);
  354 + $hora_formatada = sprintf('%02d:%02d', $horas, $minutos);
218 355 }
219 356  
220   - if (Session::get('cod_servidor') == $this->cod_servidor) {
221   - Session::put('cursos_disciplina', $this->cursos_disciplina);
222   - } else {
223   - Session::forget('cursos_disciplina');
  357 + $this->campoHora(
  358 + 'carga_horaria',
  359 + 'Carga Horária',
  360 + $hora_formatada,
  361 + true,
  362 + 'Número de horas deve ser maior que horas alocadas',
  363 + '',
  364 + false
  365 + );
  366 +
  367 + $this->inputsHelper()->checkbox('multi_seriado', [ 'label' => 'Multisseriado', 'value' => $this->multi_seriado]);
  368 +
  369 + // Dados do docente no Inep/Educacenso.
  370 + if ($this->docente) {
  371 + $docenteMapper = new Educacenso_Model_DocenteDataMapper();
  372 +
  373 + $docenteInep = null;
  374 + try {
  375 + $docenteInep = $docenteMapper->find(['docente' => $this->cod_servidor]);
  376 + } catch (Exception $e) {
  377 + }
224 378 }
225 379  
226   - $retorno = 'Editar';
227   - }
228   - }
229   -
230   - $this->url_cancelar = ($retorno == 'Editar') ?
231   - "educar_servidor_det.php?cod_servidor={$this->cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}" :
232   - "educar_servidor_lst.php";
233   -
234   - $this->nome_url_cancelar = 'Cancelar';
235   -
236   - $nomeMenu = $retorno == "Editar" ? $retorno : "Cadastrar";
237   -
238   - $this->breadcrumb($nomeMenu . ' servidor', [
239   - url('intranet/educar_servidores_index.php') => 'Servidores',
240   - ]);
241   -
242   - return $retorno;
243   - }
244   -
245   - /**
246   - * Gerar formulário
247   - */
248   - function Gerar()
249   - {
250   - // Foreign keys
251   - $obrigatorio = true;
252   - $get_instituicao = true;
253   - include 'include/pmieducar/educar_campo_lista.php';
254   -
255   - $obrigarCamposCenso = $this->validarCamposObrigatoriosCenso();
256   - $this->campoOculto('obrigar_campos_censo', (int) $obrigarCamposCenso);
257   -
258   - /**
259   - * Selecionar funcionário,
260   - * Escolher a pessoa (não o usuário)
261   - */
262   - $opcoes = array('' => 'Para procurar, clique na lupa ao lado.');
263   - if ($this->cod_servidor) {
264   - $servidor = new clsFuncionario($this->cod_servidor);
265   - $detalhe = $servidor->detalhe();
266   - //$detalhe = $detalhe['idpes']->detalhe();
267   -
268   - $this->campoRotulo('nm_servidor', 'Pessoa', $servidor->nome);
269   - $this->campoOculto('cod_servidor', $this->cod_servidor);
270   - $this->campoOculto(
271   - 'ref_cod_instituicao_original',
272   - $this->ref_cod_instituicao_original
273   - );
274   -
275   - } else {
276   -
277   - $parametros = new clsParametrosPesquisas();
278   - $parametros->setSubmit(0);
279   - $parametros->adicionaCampoSelect(
280   - 'cod_servidor',
281   - 'idpes',
282   - 'nome'
283   - );
284   -
285   - // Configurações do campo de pesquisa
286   - $this->campoListaPesq(
287   - 'cod_servidor',
288   - 'Pessoa',
289   - $opcoes,
290   - $this->cod_servidor,
291   - 'pesquisa_pessoa_lst.php',
292   - '',
293   - false,
294   - '',
295   - '',
296   - null,
297   - null,
298   - '',
299   - false,
300   - $parametros->serializaCampos(),
301   - true
302   - );
303   - }
  380 + $opcoes = ['' => 'Selecione'];
  381 + if (class_exists('clsCadastroEscolaridade')) {
  382 + $objTemp = new clsCadastroEscolaridade();
  383 + $lista = $objTemp->lista();
304 384  
305   - // ----
306   - $this->inputsHelper()->integer(
307   - 'cod_docente_inep',
308   - array(
309   - 'label' => 'Código INEP',
310   - 'required' => false,
311   - 'label_hint' => 'Somente números',
312   - 'max_length' => 12,
313   - 'placeholder' => 'INEP'
314   - )
315   - );
316   -
317   - $helperOptions = array('objectName' => 'deficiencias');
318   - $options = array(
319   - 'label' => 'Deficiências',
320   - 'size' => 50,
321   - 'required' => false,
322   - 'options' => array('value' => null)
323   - );
324   -
325   - $this->inputsHelper()->multipleSearchDeficiencias(
326   - '',
327   - $options,
328   - $helperOptions
329   - );
330   -
331   - $opcoes = array('' => 'Selecione');
332   -
333   - if (class_exists('clsPmieducarFuncao')) {
334   - if (is_numeric($this->ref_cod_instituicao)) {
335   - $objTemp = new clsPmieducarFuncao();
336   - $objTemp->setOrderby("nm_funcao ASC");
337   - $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_instituicao);
338   -
339   - if (is_array($lista) && count($lista)) {
340   - foreach ($lista as $registro) {
341   - $opcoes[$registro['cod_funcao'] . '-' . $registro['professor']] = $registro['nm_funcao'];
342   - }
  385 + if (is_array($lista) && count($lista)) {
  386 + foreach ($lista as $registro) {
  387 + $opcoes[$registro['idesco']] = $registro['descricao'];
  388 + }
  389 + }
  390 + } else {
  391 + echo "<!--\nErro\nClasse clsCadastroEscolaridade nao encontrada\n-->";
  392 + $opcoes = ['' => 'Erro na geracao'];
343 393 }
344   - }
345   - } else {
346   - echo "<!--\nErro\nClasse clsPmieducarFuncao nao encontrada\n-->";
347   - $opcoes = array('' => 'Erro na geracao');
348   - }
349   -
350   - $this->campoTabelaInicio(
351   - 'funcao',
352   - 'Funções Servidor',
353   - array(
354   - "Função",
355   - "Componentes Curriculares",
356   - "Cursos",
357   - "Matrícula"),
358   - ($this->ref_cod_funcao)
359   - );
360   -
361   - $funcao = 'popless()';
362   -
363   - $this->campoLista('ref_cod_funcao', 'Função', $opcoes, $this->ref_cod_funcao, 'funcaoChange(this)', '', '', '');
364   -
365   - $this->campoRotulo('disciplina', 'Componentes Curriculares',
366   - "<img src='imagens/lupa_antiga.png' border='0' style='cursor:pointer;' alt='Buscar Componente Curricular' title='Buscar Componente Curricular' onclick=\"$funcao\">");
367 394  
368   - $funcao = 'popCurso()';
369   -
370   - $this->campoRotulo('curso', 'Curso',
371   - "<img src='imagens/lupa_antiga.png' border='0' style='cursor:pointer;' alt='Buscar Cursos' title='Buscar Cursos' onclick=\"$funcao\">");
372   -
373   - $this->campoTexto('matricula', 'Matricula', $this->matricula);
374   -
375   - $this->campoOculto('cod_servidor_funcao', null);
376   -
377   - $this->campoTabelaFim();
378   -
379   - if (strtoupper($this->tipoacao) == 'EDITAR') {
380   - $this->campoTextoInv(
381   - 'total_horas_alocadas_',
382   - 'Total de Horas Alocadadas',
383   - $this->total_horas_alocadas,
384   - 9,
385   - 20
386   - );
  395 + $obj_permissoes = new clsPermissoes();
  396 + if ($obj_permissoes->permissao_cadastra(632, $this->pessoa_logada, 4)) {
  397 + $script = 'javascript:showExpansivelIframe(350, 135, \'educar_escolaridade_cad_pop.php\');';
  398 + $script = "<img id='img_deficiencia' style='display: \'\'' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">";
  399 + } else {
  400 + $script = null;
  401 + }
387 402  
388   - $hora = explode(':', $this->total_horas_alocadas);
389   - $this->total_horas_alocadas = $hora[0] + ($hora[1] / 60);
390   - $this->campoOculto('total_horas_alocadas', $this->total_horas_alocadas);
391   - $this->acao_enviar = 'acao2()';
392   - }
  403 + $this->campoLista('ref_idesco', 'Escolaridade', $opcoes, $this->ref_idesco, '', false, '', $script, false, $obrigarCamposCenso);
393 404  
394   - if ($this->carga_horaria) {
395   - $horas = (int) $this->carga_horaria;
396   - $minutos = round(($this->carga_horaria - (int) $this->carga_horaria) * 60);
397   - $hora_formatada = sprintf('%02d:%02d', $horas, $minutos);
398   - }
  405 + $options = [
  406 + 'label' => 'Tipo de ensino médio cursado',
  407 + 'resources' => SelectOptions::tiposEnsinoMedioCursados(),
  408 + 'value' => $this->tipo_ensino_medio_cursado,
  409 + 'required' => false
  410 + ];
399 411  
400   - $this->campoHora(
401   - 'carga_horaria',
402   - 'Carga Horária',
403   - $hora_formatada,
404   - true,
405   - 'Número de horas deve ser maior que horas alocadas',
406   - '',
407   - false
408   - );
  412 + $this->inputsHelper()->select('tipo_ensino_medio_cursado', $options);
409 413  
410   - $this->inputsHelper()->checkbox('multi_seriado', array( 'label' => 'Multisseriado', 'value' => $this->multi_seriado));
  414 + $helperOptions = ['objectName' => 'pos_graduacao'];
  415 + $options = [
  416 + 'label' => 'Pós-Graduações concluídas',
  417 + 'required' => false,
  418 + 'options' => [
  419 + 'values' => $this->pos_graduacao,
  420 + 'all_values' => [
  421 + 1 => 'Especialização',
  422 + 2 => 'Mestrado',
  423 + 3 => 'Doutorado',
  424 + 4 => 'Não tem pós-graduação concluída'
  425 + ]
  426 + ]
  427 + ];
  428 + $this->inputsHelper()->multipleSearchCustom('', $options, $helperOptions);
  429 +
  430 + $helperOptions = ['objectName' => 'curso_formacao_continuada'];
  431 + $options = [
  432 + 'label' => 'Outros cursos de formação continuada (Mínimo de 80 horas)',
  433 + 'required' => $obrigarCamposCenso,
  434 + 'options' => [
  435 + 'values' => $this->curso_formacao_continuada,
  436 + 'all_values' => [
  437 + 1 => 'Creche (0 a 3 anos)',
  438 + 2 => 'Pré-escola (4 e 5 anos)',
  439 + 3 => 'Anos iniciais do ensino fundamental',
  440 + 4 => 'Anos finais do ensino fundamental',
  441 + 5 => 'Ensino médio',
  442 + 6 => 'Educação de jovens e adultos',
  443 + 7 => 'Educação especial',
  444 + 8 => 'Educação indígena',
  445 + 9 => 'Educação do campo',
  446 + 10 => 'Educação ambiental',
  447 + 11 => 'Educação em direitos humanos',
  448 + 12 => 'Gênero e diversidade sexual',
  449 + 13 => 'Direitos de criança e adolescente',
  450 + 14 => 'Educação para as relações étnico-raciais e História e cultura Afro-Brasileira e Africana',
  451 + 17 => 'Gestão Escolar',
  452 + 15 => 'Outros',
  453 + 16 => 'Nenhum'
  454 + ]
  455 + ]
  456 + ];
  457 + $this->inputsHelper()->multipleSearchCustom('', $options, $helperOptions);
411 458  
412   - // Dados do docente no Inep/Educacenso.
413   - if ($this->docente) {
414   - $docenteMapper = new Educacenso_Model_DocenteDataMapper();
  459 + $resources = [
  460 + null => 'Selecione',
  461 + 1 => Portabilis_String_Utils::toLatin1('Concluído'),
  462 + 2 => 'Em andamento'
  463 + ];
415 464  
416   - $docenteInep = NULL;
417   - try {
418   - $docenteInep = $docenteMapper->find(array('docente' => $this->cod_servidor));
419   - } catch (Exception $e) {
  465 + $this->addGraduationsTable();
420 466  
421   - }
422   - }
  467 + $scripts = ['/modules/Cadastro/Assets/Javascripts/Servidor.js'];
423 468  
424   - $opcoes = array('' => 'Selecione');
425   - if (class_exists('clsCadastroEscolaridade')) {
426   - $objTemp = new clsCadastroEscolaridade();
427   - $lista = $objTemp->lista();
  469 + Portabilis_View_Helper_Application::loadJavascript($this, $scripts);
428 470  
429   - if (is_array($lista) && count($lista)) {
430   - foreach ($lista as $registro) {
431   - $opcoes[$registro['idesco']] = $registro['descricao'];
432   - }
433   - }
434   - } else {
435   - echo "<!--\nErro\nClasse clsCadastroEscolaridade nao encontrada\n-->";
436   - $opcoes = array('' => 'Erro na geracao');
437   - }
  471 + $styles = [
  472 + '/modules/Cadastro/Assets/Stylesheets/Servidor.css',
  473 + '/modules/Portabilis/Assets/Stylesheets/Frontend/Resource.css'
  474 + ];
438 475  
439   - $obj_permissoes = new clsPermissoes();
440   - if ($obj_permissoes->permissao_cadastra( 632, $this->pessoa_logada, 4)){
441   - $script = "javascript:showExpansivelIframe(350, 135, 'educar_escolaridade_cad_pop.php');";
442   - $script = "<img id='img_deficiencia' style='display: \'\'' src='imagens/banco_imagens/escreve.gif' style='cursor:hand; cursor:pointer;' border='0' onclick=\"{$script}\">";
443   - } else {
444   - $script = null;
445   - }
  476 + Portabilis_View_Helper_Application::loadStylesheet($this, $styles);
446 477  
447   - $this->campoLista('ref_idesco', 'Escolaridade', $opcoes, $this->ref_idesco, '', FALSE, '', $script, FALSE, $obrigarCamposCenso);
448   -
449   - $options = array(
450   - 'label' => 'Tipo de ensino médio cursado',
451   - 'resources' => SelectOptions::tiposEnsinoMedioCursados(),
452   - 'value' => $this->tipo_ensino_medio_cursado,
453   - 'required' => false
454   - );
455   -
456   - $this->inputsHelper()->select('tipo_ensino_medio_cursado', $options);
457   -
458   - $helperOptions = array('objectName' => 'pos_graduacao');
459   - $options = array('label' => 'Pós-Graduações concluídas',
460   - 'required' => false,
461   - 'options' => array('values' => $this->pos_graduacao,
462   - 'all_values' => array(
463   - 1 => 'Especialização',
464   - 2 => 'Mestrado',
465   - 3 => 'Doutorado',
466   - 4 => 'Não tem pós-graduação concluída')));
467   - $this->inputsHelper()->multipleSearchCustom('', $options, $helperOptions);
468   -
469   - $helperOptions = array('objectName' => 'curso_formacao_continuada');
470   - $options = array('label' => 'Outros cursos de formação continuada (Mínimo de 80 horas)',
471   - 'required' => $obrigarCamposCenso,
472   - 'options' => array('values' => $this->curso_formacao_continuada,
473   - 'all_values' => array(
474   - 1 => 'Creche (0 a 3 anos)',
475   - 2 => 'Pré-escola (4 e 5 anos)',
476   - 3 => 'Anos iniciais do ensino fundamental',
477   - 4 => 'Anos finais do ensino fundamental',
478   - 5 => 'Ensino médio',
479   - 6 => 'Educação de jovens e adultos',
480   - 7 => 'Educação especial',
481   - 8 => 'Educação indígena',
482   - 9 => 'Educação do campo',
483   - 10 => 'Educação ambiental',
484   - 11 => 'Educação em direitos humanos',
485   - 12 => 'Gênero e diversidade sexual',
486   - 13 => 'Direitos de criança e adolescente',
487   - 14 => 'Educação para as relações étnico-raciais e História e cultura Afro-Brasileira e Africana',
488   - 17 => 'Gestão Escolar',
489   - 15 => 'Outros',
490   - 16 => 'Nenhum')));
491   - $this->inputsHelper()->multipleSearchCustom('', $options, $helperOptions);
492   -
493   - $resources = array(
494   - null => 'Selecione',
495   - 1 => Portabilis_String_Utils::toLatin1('Concluído'),
496   - 2 => 'Em andamento'
497   - );
498   -
499   - $this->addGraduationsTable();
500   -
501   - $scripts = array('/modules/Cadastro/Assets/Javascripts/Servidor.js');
502   -
503   - Portabilis_View_Helper_Application::loadJavascript($this, $scripts);
504   -
505   - $styles = array ('/modules/Cadastro/Assets/Stylesheets/Servidor.css',
506   - '/modules/Portabilis/Assets/Stylesheets/Frontend/Resource.css');
507   -
508   - Portabilis_View_Helper_Application::loadStylesheet($this, $styles);
509   -
510   - $script = <<<'JS'
  478 + $script = <<<'JS'
511 479 (function () {
512 480 $j('.ref_cod_funcao select').each(function () {
513 481 const $this = $j(this);
... ... @@ -520,411 +488,495 @@ class indice extends clsCadastro
520 488 })();
521 489 JS;
522 490  
523   - Portabilis_View_Helper_Application::embedJavascript($this, $script);
524   - }
525   -
526   - function Novo()
527   - {
528   - $this->cod_servidor = (int) $this->cod_servidor;
529   - $this->ref_cod_instituicao = (int) $this->ref_cod_instituicao;
530   -
531   - $timesep = explode(':', $this->carga_horaria);
532   - $hour = $timesep[0] + ((int) ($timesep[1] / 60));
533   - $min = abs(((int) ($timesep[1] / 60)) - ($timesep[1] / 60)) . '<br>';
534   -
535   - $this->carga_horaria = $hour + $min;
536   - $this->carga_horaria = $hour + $min;
  491 + Portabilis_View_Helper_Application::embedJavascript($this, $script);
  492 + }
537 493  
538   - $this->pos_graduacao = '{' . implode(',', array_filter($this->pos_graduacao)) . '}';
  494 + public function Novo()
  495 + {
  496 + $this->cod_servidor = (int) $this->cod_servidor;
  497 + $this->ref_cod_instituicao = (int) $this->ref_cod_instituicao;
539 498  
540   - $this->curso_formacao_continuada = '{' . implode(',', $this->curso_formacao_continuada) . '}';
  499 + $timesep = explode(':', $this->carga_horaria);
  500 + $hour = $timesep[0] + ((int) ($timesep[1] / 60));
  501 + $min = abs(((int) ($timesep[1] / 60)) - ($timesep[1] / 60)) . '<br>';
541 502  
  503 + $this->carga_horaria = $hour + $min;
  504 + $this->carga_horaria = $hour + $min;
542 505  
  506 + $this->pos_graduacao = '{' . implode(',', array_filter($this->pos_graduacao)) . '}';
543 507  
544   - $obj_permissoes = new clsPermissoes();
545   - $obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 7, 'educar_servidor_lst.php');
  508 + $this->curso_formacao_continuada = '{' . implode(',', $this->curso_formacao_continuada) . '}';
546 509  
547   - $obj = new clsPmieducarServidor($this->cod_servidor, NULL, NULL, NULL, NULL, NULL, NULL, $this->ref_cod_instituicao);
  510 + $obj_permissoes = new clsPermissoes();
  511 + $obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 7, 'educar_servidor_lst.php');
548 512  
549   - $servidorAntes = $obj->detalhe();
  513 + $obj = new clsPmieducarServidor($this->cod_servidor, null, null, null, null, null, null, $this->ref_cod_instituicao);
550 514  
551   - if ($obj->detalhe()) {
552   - $this->carga_horaria = str_replace(',', '.', $this->carga_horaria);
553   - $obj = new clsPmieducarServidor($this->cod_servidor, NULL, $this->ref_idesco, $this->carga_horaria, NULL, NULL, 1, $this->ref_cod_instituicao);
554   - $obj = $this->addCamposCenso($obj);
555   - $obj->multi_seriado = !is_null($this->multi_seriado);
  515 + $servidorAntes = $obj->detalhe();
556 516  
557   - $editou = $obj->edita();
  517 + if ($obj->detalhe()) {
  518 + $this->carga_horaria = str_replace(',', '.', $this->carga_horaria);
  519 + $obj = new clsPmieducarServidor($this->cod_servidor, null, $this->ref_idesco, $this->carga_horaria, null, null, 1, $this->ref_cod_instituicao);
  520 + $obj = $this->addCamposCenso($obj);
  521 + $obj->multi_seriado = !is_null($this->multi_seriado);
558 522  
559   - if ($editou) {
  523 + $editou = $obj->edita();
560 524  
561   - $servidorDepois = $obj->detalhe();
  525 + if ($editou) {
  526 + $servidorDepois = $obj->detalhe();
562 527  
563   - $auditoria = new clsModulesAuditoriaGeral("servidor", $this->pessoa_logada, $this->cod_servidor);
564   - $auditoria->alteracao($servidorAntes, $servidorDepois);
  528 + $auditoria = new clsModulesAuditoriaGeral('servidor', $this->pessoa_logada, $this->cod_servidor);
  529 + $auditoria->alteracao($servidorAntes, $servidorDepois);
565 530  
566   - $this->cadastraFuncoes();
567   - $this->createOrUpdateInep();
568   - $this->createOrUpdateDeficiencias();
  531 + $this->cadastraFuncoes();
  532 + $this->createOrUpdateInep();
  533 + $this->createOrUpdateDeficiencias();
569 534  
570   - $this->storeGraduations($this->cod_servidor);
  535 + $this->storeGraduations($this->cod_servidor);
571 536  
572   - include 'educar_limpa_sessao_curso_disciplina_servidor.php';
  537 + include 'educar_limpa_sessao_curso_disciplina_servidor.php';
573 538  
574   - $this->mensagem .= 'Cadastro efetuado com sucesso.<br>';
575   - $this->simpleRedirect("educar_servidor_det.php?cod_servidor={$this->cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}");
576   - }
577   - } else {
578   - $this->ref_cod_instituicao = (int) $this->ref_cod_instituicao;
579   - $this->carga_horaria = str_replace(',', '.', $this->carga_horaria);
  539 + $this->mensagem .= 'Cadastro efetuado com sucesso.<br>';
  540 + $this->simpleRedirect("educar_servidor_det.php?cod_servidor={$this->cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}");
  541 + }
  542 + } else {
  543 + $this->ref_cod_instituicao = (int) $this->ref_cod_instituicao;
  544 + $this->carga_horaria = str_replace(',', '.', $this->carga_horaria);
580 545  
581   - $obj_2 = new clsPmieducarServidor($this->cod_servidor, NULL, $this->ref_idesco, $this->carga_horaria, NULL, NULL, 1, $this->ref_cod_instituicao);
582   - $obj_2 = $this->addCamposCenso($obj_2);
583   - $obj_2->multi_seriado = !is_null($this->multi_seriado);
584   - $obj_2->cod_servidor = $this->cod_servidor;
  546 + $obj_2 = new clsPmieducarServidor($this->cod_servidor, null, $this->ref_idesco, $this->carga_horaria, null, null, 1, $this->ref_cod_instituicao);
  547 + $obj_2 = $this->addCamposCenso($obj_2);
  548 + $obj_2->multi_seriado = !is_null($this->multi_seriado);
  549 + $obj_2->cod_servidor = $this->cod_servidor;
585 550  
586   - $cadastrou = $obj_2->cadastra();
  551 + $cadastrou = $obj_2->cadastra();
587 552  
588   - if ($cadastrou) {
  553 + if ($cadastrou) {
  554 + $servidor = new clsPmieducarServidor($cadastrou, null, null, null, null, null, null, $this->ref_cod_instituicao);
  555 + $servidor = $servidor->detalhe();
589 556  
590   - $servidor = new clsPmieducarServidor($cadastrou, NULL, NULL, NULL, NULL, NULL, NULL, $this->ref_cod_instituicao);
591   - $servidor = $servidor->detalhe();
  557 + $auditoria = new clsModulesAuditoriaGeral('servidor', $this->pessoa_logada, $cadastrou);
  558 + $auditoria->inclusao($servidor);
592 559  
593   - $auditoria = new clsModulesAuditoriaGeral("servidor", $this->pessoa_logada, $cadastrou);
594   - $auditoria->inclusao($servidor);
  560 + $this->cadastraFuncoes();
  561 + $this->createOrUpdateInep();
  562 + $this->createOrUpdateDeficiencias();
595 563  
596   - $this->cadastraFuncoes();
597   - $this->createOrUpdateInep();
598   - $this->createOrUpdateDeficiencias();
  564 + $this->storeGraduations($this->cod_servidor);
599 565  
600   - $this->storeGraduations($this->cod_servidor);
  566 + include 'educar_limpa_sessao_curso_disciplina_servidor.php';
601 567  
602   - include 'educar_limpa_sessao_curso_disciplina_servidor.php';
  568 + $this->mensagem = 'Cadastro efetuado com sucesso.<br>';
  569 + $this->simpleRedirect("educar_servidor_det.php?cod_servidor={$this->cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}");
  570 + }
  571 + }
  572 + $this->mensagem = 'Cadastro não realizado.<br>';
603 573  
604   - $this->mensagem .= 'Cadastro efetuado com sucesso.<br>';
605   - $this->simpleRedirect("educar_servidor_det.php?cod_servidor={$this->cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}");
606   - }
  574 + return false;
607 575 }
608   - $this->mensagem = 'Cadastro não realizado.<br>';
609 576  
610   - return false;
611   - }
612   -
613   - function Editar()
614   - {
615   - $timesep = explode(':', $this->carga_horaria);
616   - $hour = $timesep[0] + ((int) ($timesep[1] / 60));
617   - $min = abs(((int) ($timesep[1] / 60)) - ($timesep[1] / 60)) . '<br>';
618   - $this->carga_horaria = $hour + $min;
619   - $this->carga_horaria = $hour + $min;
620   -
621   - $this->pos_graduacao = '{' . implode(',', array_filter($this->pos_graduacao)) . '}';
622   -
623   - $this->curso_formacao_continuada = '{' . implode(',', $this->curso_formacao_continuada) . '}';
624   -
625   -
626   -
627   - $servidor = new clsPmieducarServidor($this->cod_servidor, NULL, NULL, NULL, NULL, NULL, NULL, $this->ref_cod_instituicao);
628   - $servidorAntes = $servidor->detalhe();
629   -
630   - $obj_permissoes = new clsPermissoes();
631   - $obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 7, 'educar_servidor_lst.php');
632   -
633   - if ($this->ref_cod_instituicao == $this->ref_cod_instituicao_original) {
634   - $this->carga_horaria = str_replace(',', '.', $this->carga_horaria);
635   -
636   - $obj = new clsPmieducarServidor($this->cod_servidor, NULL, $this->ref_idesco, $this->carga_horaria, NULL, NULL, 1, $this->ref_cod_instituicao);
637   - $obj = $this->addCamposCenso($obj);
638   - $obj->multi_seriado = !is_null($this->multi_seriado);
639   - $editou = $obj->edita();
640   -
641   - if ($editou) {
  577 + public function Editar()
  578 + {
  579 + $timesep = explode(':', $this->carga_horaria);
  580 + $hour = $timesep[0] + ((int) ($timesep[1] / 60));
  581 + $min = abs(((int) ($timesep[1] / 60)) - ($timesep[1] / 60)) . '<br>';
  582 + $this->carga_horaria = $hour + $min;
  583 + $this->carga_horaria = $hour + $min;
642 584  
643   - $servidorDepois = $servidor->detalhe();
  585 + $this->pos_graduacao = '{' . implode(',', array_filter($this->pos_graduacao)) . '}';
644 586  
645   - $auditoria = new clsModulesAuditoriaGeral("servidor", $this->pessoa_logada, $this->cod_servidor);
646   - $auditoria->alteracao($servidorAntes, $servidorDepois);
  587 + $this->curso_formacao_continuada = '{' . implode(',', $this->curso_formacao_continuada) . '}';
647 588  
648   - $this->cadastraFuncoes();
649   - $this->createOrUpdateInep();
650   - $this->createOrUpdateDeficiencias();
  589 + $servidor = new clsPmieducarServidor($this->cod_servidor, null, null, null, null, null, null, $this->ref_cod_instituicao);
  590 + $servidorAntes = $servidor->detalhe();
651 591  
652   - $this->storeGraduations($this->cod_servidor);
  592 + $obj_permissoes = new clsPermissoes();
  593 + $obj_permissoes->permissao_cadastra(635, $this->pessoa_logada, 7, 'educar_servidor_lst.php');
653 594  
654   - include 'educar_limpa_sessao_curso_disciplina_servidor.php';
  595 + if ($this->ref_cod_instituicao == $this->ref_cod_instituicao_original) {
  596 + $this->carga_horaria = str_replace(',', '.', $this->carga_horaria);
655 597  
656   - $this->mensagem .= 'Edição efetuada com sucesso.<br>';
657   - $this->simpleRedirect("educar_servidor_det.php?cod_servidor={$this->cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}");
658   - }
659   - } else {
660   - $this->carga_horaria = str_replace(',', '.', $this->carga_horaria);
661   - $obj_quadro_horario = new clsPmieducarQuadroHorarioHorarios(NULL, NULL,
662   - NULL, NULL, NULL, NULL, $this->cod_servidor, NULL, NULL, NULL, NULL,
663   - NULL, NULL, 1, $this->ref_cod_instituicao);
  598 + $obj = new clsPmieducarServidor($this->cod_servidor, null, $this->ref_idesco, $this->carga_horaria, null, null, 1, $this->ref_cod_instituicao);
  599 + $obj = $this->addCamposCenso($obj);
  600 + $obj->multi_seriado = !is_null($this->multi_seriado);
  601 + $editou = $obj->edita();
664 602  
665   - if ($obj_quadro_horario->detalhe()) {
666   - $this->mensagem = "Edição não realizada. O servidor está vinculado a um quadro de horários.<br>";
  603 + if ($editou) {
  604 + $servidorDepois = $servidor->detalhe();
667 605  
668   - return false;
669   - } else {
670   - $obj_quadro_horario = new clsPmieducarQuadroHorarioHorarios(NULL, NULL,
671   - NULL, NULL, NULL, NULL, NULL, $this->cod_servidor, NULL, NULL, NULL,
672   - NULL, NULL, 1, NULL, $this->ref_cod_instituicao);
  606 + $auditoria = new clsModulesAuditoriaGeral('servidor', $this->pessoa_logada, $this->cod_servidor);
  607 + $auditoria->alteracao($servidorAntes, $servidorDepois);
673 608  
674   - if ($obj_quadro_horario->detalhe()) {
675   - $this->mensagem = "Edição não realizada. O servidor está vinculado a um quadro de horários.<br>";
  609 + $this->cadastraFuncoes();
  610 + $this->createOrUpdateInep();
  611 + $this->createOrUpdateDeficiencias();
676 612  
677   - return false;
678   - }
679   - else {
  613 + $this->storeGraduations($this->cod_servidor);
680 614  
681   - $this->carga_horaria = str_replace(',', '.', $this->carga_horaria);
  615 + include 'educar_limpa_sessao_curso_disciplina_servidor.php';
682 616  
683   - $obj = new clsPmieducarServidor($this->cod_servidor,
684   - NULL, $this->ref_idesco, $this->carga_horaria,
685   - NULL, NULL, 0, $this->ref_cod_instituicao_original);
686   - $obj = $this->addCamposCenso($obj);
687   - $obj->multi_seriado = !is_null($this->multi_seriado);
688   - $editou = $obj->edita();
689   -
690   - if ($editou) {
691   - $obj = new clsPmieducarServidor($this->cod_servidor,
692   - NULL, $this->ref_idesco,
693   - $this->carga_horaria, NULL, NULL, 1, $this->ref_cod_instituicao);
694   -
695   - if ($obj->existe()) {
696   - $cadastrou = $obj->edita();
  617 + $this->mensagem = 'Edição efetuada com sucesso.<br>';
  618 + $this->simpleRedirect("educar_servidor_det.php?cod_servidor={$this->cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}");
  619 + }
  620 + } else {
  621 + $this->carga_horaria = str_replace(',', '.', $this->carga_horaria);
  622 + $obj_quadro_horario = new clsPmieducarQuadroHorarioHorarios(
  623 + null,
  624 + null,
  625 + null,
  626 + null,
  627 + null,
  628 + null,
  629 + $this->cod_servidor,
  630 + null,
  631 + null,
  632 + null,
  633 + null,
  634 + null,
  635 + null,
  636 + 1,
  637 + $this->ref_cod_instituicao
  638 + );
  639 +
  640 + if ($obj_quadro_horario->detalhe()) {
  641 + $this->mensagem = 'Edição não realizada. O servidor está vinculado a um quadro de horários.<br>';
  642 +
  643 + return false;
697 644 } else {
698   - $cadastrou = $obj->cadastra();
  645 + $obj_quadro_horario = new clsPmieducarQuadroHorarioHorarios(
  646 + null,
  647 + null,
  648 + null,
  649 + null,
  650 + null,
  651 + null,
  652 + null,
  653 + $this->cod_servidor,
  654 + null,
  655 + null,
  656 + null,
  657 + null,
  658 + null,
  659 + 1,
  660 + null,
  661 + $this->ref_cod_instituicao
  662 + );
  663 +
  664 + if ($obj_quadro_horario->detalhe()) {
  665 + $this->mensagem = 'Edição não realizada. O servidor está vinculado a um quadro de horários.<br>';
  666 +
  667 + return false;
  668 + } else {
  669 + $this->carga_horaria = str_replace(',', '.', $this->carga_horaria);
  670 +
  671 + $obj = new clsPmieducarServidor(
  672 + $this->cod_servidor,
  673 + null,
  674 + $this->ref_idesco,
  675 + $this->carga_horaria,
  676 + null,
  677 + null,
  678 + 0,
  679 + $this->ref_cod_instituicao_original
  680 + );
  681 + $obj = $this->addCamposCenso($obj);
  682 + $obj->multi_seriado = !is_null($this->multi_seriado);
  683 + $editou = $obj->edita();
  684 +
  685 + if ($editou) {
  686 + $obj = new clsPmieducarServidor(
  687 + $this->cod_servidor,
  688 + null,
  689 + $this->ref_idesco,
  690 + $this->carga_horaria,
  691 + null,
  692 + null,
  693 + 1,
  694 + $this->ref_cod_instituicao
  695 + );
  696 +
  697 + if ($obj->existe()) {
  698 + $cadastrou = $obj->edita();
  699 + } else {
  700 + $cadastrou = $obj->cadastra();
  701 + }
  702 +
  703 + if ($cadastrou) {
  704 + $this->cadastraFuncoes();
  705 + $this->createOrUpdateInep();
  706 + $this->createOrUpdateDeficiencias();
  707 +
  708 + $this->storeGraduations($this->cod_servidor);
  709 +
  710 + include 'educar_limpa_sessao_curso_disciplina_servidor.php';
  711 +
  712 + $this->mensagem = 'Edição efetuada com sucesso.<br>';
  713 + $this->simpleRedirect("educar_servidor_det.php?cod_servidor={$this->cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}");
  714 + }
  715 + }
  716 + }
699 717 }
  718 + }
  719 + $this->mensagem = 'Edição não realizada.<br>';
700 720  
701   - if ($cadastrou) {
702   - $this->cadastraFuncoes();
703   - $this->createOrUpdateInep();
704   - $this->createOrUpdateDeficiencias();
  721 + return false;
  722 + }
705 723  
706   - $this->storeGraduations($this->cod_servidor);
  724 + public function Excluir()
  725 + {
  726 + $obj_permissoes = new clsPermissoes();
  727 + $obj_permissoes->permissao_excluir(635, $this->pessoa_logada, 7, 'educar_servidor_lst.php');
  728 +
  729 + $obj_quadro_horario = new clsPmieducarQuadroHorarioHorarios(
  730 + null,
  731 + null,
  732 + null,
  733 + null,
  734 + null,
  735 + null,
  736 + $this->cod_servidor,
  737 + null,
  738 + null,
  739 + null,
  740 + null,
  741 + null,
  742 + null,
  743 + 1,
  744 + $this->ref_cod_instituicao
  745 + );
707 746  
708   - include 'educar_limpa_sessao_curso_disciplina_servidor.php';
  747 + if ($obj_quadro_horario->detalhe()) {
  748 + $this->mensagem = 'Exclusão não realizada. O servidor está vinculado a um quadro de horários.<br>';
709 749  
710   - $this->mensagem .= "Edição efetuada com sucesso.<br>";
711   - $this->simpleRedirect("educar_servidor_det.php?cod_servidor={$this->cod_servidor}&ref_cod_instituicao={$this->ref_cod_instituicao}");
  750 + return false;
  751 + } else {
  752 + $obj_quadro_horario = new clsPmieducarQuadroHorarioHorarios(
  753 + null,
  754 + null,
  755 + null,
  756 + null,
  757 + null,
  758 + null,
  759 + null,
  760 + $this->cod_servidor,
  761 + null,
  762 + null,
  763 + null,
  764 + null,
  765 + null,
  766 + 1,
  767 + null,
  768 + $this->ref_cod_instituicao
  769 + );
  770 +
  771 + if ($obj_quadro_horario->detalhe()) {
  772 + $this->mensagem = 'Exclusão não realizada. O servidor está vinculado a um quadro de horários.<br>';
  773 +
  774 + return false;
  775 + } else {
  776 + $obj = new clsPmieducarServidor(
  777 + $this->cod_servidor,
  778 + null,
  779 + $this->ref_idesco,
  780 + $this->carga_horaria,
  781 + null,
  782 + null,
  783 + 0,
  784 + $this->ref_cod_instituicao_original
  785 + );
  786 +
  787 + $servidor = $obj->detalhe();
  788 +
  789 + $excluiu = $obj->excluir();
  790 +
  791 + if ($excluiu) {
  792 + $auditoria = new clsModulesAuditoriaGeral('servidor', $this->pessoa_logada, $this->cod_servidor);
  793 + $auditoria->exclusao($servidor);
  794 +
  795 + $this->excluiFuncoes();
  796 + $this->mensagem = 'Exclusão efetuada com sucesso.<br>';
  797 + $this->simpleRedirect('educar_servidor_lst.php');
  798 + }
712 799 }
713   - }
714 800 }
715   - }
716   - }
717   - $this->mensagem = "Edição não realizada.<br>";
  801 + $this->mensagem = 'Exclusão não realizada.<br>';
718 802  
719   - return false;
720   - }
  803 + return false;
  804 + }
721 805  
722   - function Excluir()
723   - {
  806 + public function addCamposCenso($obj)
  807 + {
  808 + $obj->tipo_ensino_medio_cursado = $this->tipo_ensino_medio_cursado;
  809 + $obj->pos_graduacao = $this->pos_graduacao;
  810 + $obj->curso_formacao_continuada = $this->curso_formacao_continuada;
724 811  
  812 + return $obj;
  813 + }
725 814  
726   - $obj_permissoes = new clsPermissoes();
727   - $obj_permissoes->permissao_excluir(635, $this->pessoa_logada, 7, 'educar_servidor_lst.php');
  815 + public function cadastraFuncoes()
  816 + {
  817 + $cursos_disciplina = Session::get('cursos_disciplina');
  818 + $cursos_servidor = Session::get('cursos_servidor');
  819 + $existe_funcao_professor = false;
728 820  
729   - $obj_quadro_horario = new clsPmieducarQuadroHorarioHorarios(NULL, NULL, NULL,
730   - NULL, NULL, NULL, $this->cod_servidor, NULL, NULL, NULL, NULL, NULL,
731   - NULL, 1, $this->ref_cod_instituicao);
  821 + $listFuncoesCadastradas = [];
732 822  
733   - if ($obj_quadro_horario->detalhe()) {
734   - $this->mensagem = "Exclusão não realizada. O servidor está vinculado a um quadro de horários.<br>";
735   - return FALSE;
736   - } else {
737   - $obj_quadro_horario = new clsPmieducarQuadroHorarioHorarios(NULL, NULL,
738   - NULL, NULL, NULL, NULL, NULL, $this->cod_servidor, NULL, NULL, NULL,
739   - NULL, NULL, 1, NULL, $this->ref_cod_instituicao);
  823 + if ($this->ref_cod_funcao) {
  824 + foreach ($this->ref_cod_funcao as $k => $funcao) {
  825 + list($funcao, $professor) = explode('-', $funcao);
740 826  
741   - if ($obj_quadro_horario->detalhe()) {
742   - $this->mensagem = "Exclusão não realizada. O servidor está vinculado a um quadro de horários.<br>";
743   - return FALSE;
744   - } else {
745   - $obj = new clsPmieducarServidor($this->cod_servidor,
746   - NULL, $this->ref_idesco, $this->carga_horaria,
747   - NULL, NULL, 0, $this->ref_cod_instituicao_original);
  827 + if ((bool) $professor) {
  828 + $existe_funcao_professor = true;
  829 + }
748 830  
749   - $servidor = $obj->detalhe();
  831 + $cod_servidor_funcao = $this->cod_servidor_funcao[$k];
  832 + $obj_servidor_funcao = new clsPmieducarServidorFuncao(null, null, null, null, $cod_servidor_funcao);
750 833  
751   - $excluiu = $obj->excluir();
  834 + if ($obj_servidor_funcao->existe()) {
  835 + $this->atualizaFuncao($obj_servidor_funcao, $funcao, $this->matricula[$k]);
  836 + } else {
  837 + $this->cadastraFuncao($funcao, $this->matricula[$k]);
  838 + }
752 839  
753   - if ($excluiu) {
754   - $auditoria = new clsModulesAuditoriaGeral("servidor", $this->pessoa_logada, $this->cod_servidor);
755   - $auditoria->exclusao($servidor);
  840 + if (empty($cod_servidor_funcao)) {
  841 + $obj_servidor_funcao = new clsPmieducarServidorFuncao($this->ref_cod_instituicao, $this->cod_servidor, $funcao);
  842 + $cod_servidor_funcao = $obj_servidor_funcao->detalhe()['cod_servidor_funcao'];
  843 + }
756 844  
757   - $this->excluiFuncoes();
758   - $this->mensagem .= "Exclusão efetuada com sucesso.<br>";
759   - $this->simpleRedirect('educar_servidor_lst.php');
  845 + array_push($listFuncoesCadastradas, $cod_servidor_funcao);
  846 + }
760 847 }
761   - }
762   - }
763   - $this->mensagem = 'Exclusão não realizada.<br>';
764   -
765   - return false;
766   - }
767   -
768   - function addCamposCenso($obj){
769   - $obj->tipo_ensino_medio_cursado = $this->tipo_ensino_medio_cursado;
770   - $obj->pos_graduacao = $this->pos_graduacao;
771   - $obj->curso_formacao_continuada = $this->curso_formacao_continuada;
772   - return $obj;
773   - }
774   -
775   - function cadastraFuncoes()
776   - {
777   - $cursos_disciplina = Session::get('cursos_disciplina');
778   - $cursos_servidor = Session::get('cursos_servidor');
779   - $existe_funcao_professor = false;
780   -
781   - $listFuncoesCadastradas = array();
782   -
783   - if ($this->ref_cod_funcao) {
784   - foreach ($this->ref_cod_funcao as $k => $funcao) {
785   - list($funcao, $professor) = explode('-', $funcao);
786   -
787   - if ((bool) $professor) {
788   - $existe_funcao_professor = true;
  848 + $this->excluiFuncoesRemovidas($listFuncoesCadastradas);
  849 +
  850 + if ($existe_funcao_professor) {
  851 + if ($cursos_disciplina) {
  852 + $this->excluiDisciplinas();
  853 + foreach ($cursos_disciplina as $curso => $disciplinas) {
  854 + if ($disciplinas) {
  855 + foreach ($disciplinas as $disciplina) {
  856 + $obj_servidor_disciplina = new clsPmieducarServidorDisciplina(
  857 + $disciplina,
  858 + $this->ref_cod_instituicao,
  859 + $this->cod_servidor,
  860 + $curso
  861 + );
  862 +
  863 + if (!$obj_servidor_disciplina->existe()) {
  864 + $obj_servidor_disciplina->cadastra();
  865 + }
  866 + }
  867 + }
  868 + }
789 869 }
790 870  
791   - $cod_servidor_funcao = $this->cod_servidor_funcao[$k];
792   - $obj_servidor_funcao = new clsPmieducarServidorFuncao(null, null, null, null, $cod_servidor_funcao);
  871 + if ($cursos_servidor) {
  872 + $this->excluiCursos();
  873 + foreach ($cursos_servidor as $curso) {
  874 + $obj_curso_servidor = new clsPmieducarServidorCursoMinistra($curso, $this->ref_cod_instituicao, $this->cod_servidor);
793 875  
794   - if ($obj_servidor_funcao->existe()) {
795   - $this->atualizaFuncao($obj_servidor_funcao, $funcao, $this->matricula[$k]);
796   - } else {
797   - $this->cadastraFuncao($funcao, $this->matricula[$k]);
  876 + if (!$obj_curso_servidor->existe()) {
  877 + $det_curso_servidor = $obj_curso_servidor->cadastra();
  878 + }
  879 + }
798 880 }
799   - array_push($listFuncoesCadastradas,$funcao);
800 881 }
801   -
802 882 }
803   - $this->excluiFuncoesRemovidas($listFuncoesCadastradas);
804   -
805   - if ($existe_funcao_professor) {
806   - if ($cursos_disciplina) {
807   - $this->excluiDisciplinas();
808   - foreach ($cursos_disciplina as $curso => $disciplinas) {
809   - if ($disciplinas) {
810   - foreach ($disciplinas as $disciplina) {
811   - $obj_servidor_disciplina = new clsPmieducarServidorDisciplina(
812   - $disciplina, $this->ref_cod_instituicao, $this->cod_servidor,
813   - $curso);
814   -
815   - if (!$obj_servidor_disciplina->existe()) {
816   - $obj_servidor_disciplina->cadastra();
817   - }
818   - }
819   - }
820   - }
821   - }
822 883  
823   - if ($cursos_servidor) {
824   - $this->excluiCursos();
825   - foreach ($cursos_servidor as $curso) {
826   - $obj_curso_servidor = new clsPmieducarServidorCursoMinistra($curso, $this->ref_cod_instituicao, $this->cod_servidor);
827   -
828   - if (!$obj_curso_servidor->existe()) {
829   - $det_curso_servidor = $obj_curso_servidor->cadastra();
830   - }
831   - }
832   - }
  884 + public function excluiFuncoes()
  885 + {
  886 + $obj_servidor_funcao = new clsPmieducarServidorFuncao($this->ref_cod_instituicao, $this->cod_servidor);
  887 + $obj_servidor_funcao->excluirTodos();
833 888 }
834   - }
835 889  
836   - function excluiFuncoes()
837   - {
838   - $obj_servidor_funcao = new clsPmieducarServidorFuncao($this->ref_cod_instituicao, $this->cod_servidor);
839   - $obj_servidor_funcao->excluirTodos();
840   - }
  890 + public function excluiFuncoesRemovidas($funcoes)
  891 + {
  892 + $obj_servidor_funcao = new clsPmieducarServidorFuncao($this->ref_cod_instituicao, $this->cod_servidor);
  893 + $obj_servidor_funcao->excluirFuncoesRemovidas($funcoes);
  894 + }
841 895  
842   - function excluiFuncoesRemovidas($funcoes)
843   - {
844   - $obj_servidor_funcao = new clsPmieducarServidorFuncao($this->ref_cod_instituicao, $this->cod_servidor);
845   - $obj_servidor_funcao->excluirFuncoesRemovidas($funcoes);
846   - }
  896 + public function atualizaFuncao($obj_servidor_funcao, $funcao, $matricula)
  897 + {
  898 + $obj_servidor_funcao->ref_cod_funcao = $funcao;
  899 + $obj_servidor_funcao->matricula = $matricula;
847 900  
848   - function atualizaFuncao($obj_servidor_funcao, $funcao, $matricula)
849   - {
850   - $obj_servidor_funcao->ref_cod_funcao = $funcao;
851   - $obj_servidor_funcao->matricula = $matricula;
  901 + $obj_servidor_funcao->edita();
  902 + }
852 903  
853   - $obj_servidor_funcao->edita();
854   - }
  904 + public function cadastraFuncao($funcao, $matricula)
  905 + {
  906 + $obj_servidor_funcao = new clsPmieducarServidorFuncao($this->ref_cod_instituicao, $this->cod_servidor, $funcao, $matricula);
  907 + $obj_servidor_funcao->cadastra();
  908 + }
855 909  
856   - function cadastraFuncao($funcao,$matricula)
857   - {
858   - $obj_servidor_funcao = new clsPmieducarServidorFuncao($this->ref_cod_instituicao, $this->cod_servidor, $funcao, $matricula);
859   - $obj_servidor_funcao->cadastra();
860   - }
  910 + public function excluiDisciplinas()
  911 + {
  912 + $obj_servidor_disciplina = new clsPmieducarServidorDisciplina(null, $this->ref_cod_instituicao, $this->cod_servidor);
  913 + $obj_servidor_disciplina->excluirTodos();
  914 + }
861 915  
862   - function excluiDisciplinas()
863   - {
864   - $obj_servidor_disciplina = new clsPmieducarServidorDisciplina(NULL, $this->ref_cod_instituicao, $this->cod_servidor);
865   - $obj_servidor_disciplina->excluirTodos();
866   - }
  916 + public function excluiCursos()
  917 + {
  918 + $obj_servidor_curso = new clsPmieducarServidorCursoMinistra(null, $this->ref_cod_instituicao, $this->cod_servidor);
  919 + $obj_servidor_curso->excluirTodos();
  920 + }
867 921  
868   - function excluiCursos()
869   - {
870   - $obj_servidor_curso = new clsPmieducarServidorCursoMinistra(NULL, $this->ref_cod_instituicao, $this->cod_servidor);
871   - $obj_servidor_curso->excluirTodos();
872   - }
  922 + protected function createOrUpdateDeficiencias()
  923 + {
  924 + $servidorId = $this->cod_servidor;
873 925  
874   - protected function createOrUpdateDeficiencias(){
875   - $servidorId = $this->cod_servidor;
  926 + $sql = 'delete from cadastro.fisica_deficiencia where ref_idpes = $1';
  927 + Portabilis_Utils_Database::fetchPreparedQuery($sql, ['params' => [$servidorId]], false);
876 928  
877   - $sql = "delete from cadastro.fisica_deficiencia where ref_idpes = $1";
878   - Portabilis_Utils_Database::fetchPreparedQuery($sql, array('params' => array($servidorId)), false);
  929 + foreach ($this->getRequest()->deficiencias as $id) {
  930 + if (!empty($id)) {
  931 + $deficiencia = new clsCadastroFisicaDeficiencia($servidorId, $id);
  932 + $deficiencia->cadastra();
  933 + }
  934 + }
  935 + }
879 936  
880   - foreach ($this->getRequest()->deficiencias as $id) {
881   - if (!empty($id)) {
882   - $deficiencia = new clsCadastroFisicaDeficiencia($servidorId, $id);
883   - $deficiencia->cadastra();
884   - }
  937 + protected function createOrUpdateInep()
  938 + {
  939 + Portabilis_Utils_Database::fetchPreparedQuery('DELETE FROM modules.educacenso_cod_docente WHERE cod_servidor = $1', ['params' => [$this->cod_servidor]], false);
  940 + if ($this->cod_docente_inep) {
  941 + $sql = 'INSERT INTO modules.educacenso_cod_docente (cod_servidor,cod_docente_inep, fonte, created_at)
  942 + VALUES ($1, $2,\'U\', \'NOW()\')';
  943 + Portabilis_Utils_Database::fetchPreparedQuery($sql, ['params' => [$this->cod_servidor, $this->cod_docente_inep]]);
  944 + }
885 945 }
886 946  
887   - }
  947 + protected function addGraduationsTable()
  948 + {
  949 + $graduations = $this->fillEmployeeGraduations($this->cod_servidor);
  950 +
  951 + $rows = $this->getGraduateTableRows($graduations);
  952 +
  953 + $this->campoTabelaInicio(
  954 + 'graduations',
  955 + 'Curso(s) superior(es) concluído(s)',
  956 + [
  957 + 'Curso',
  958 + 'Ano de conclusão',
  959 + 'Instituição de Educação Superior',
  960 + 'Área de conhecimento/Disciplina de formação',
  961 + ],
  962 + $rows
  963 + );
  964 +
  965 + $this->inputsHelper()->simpleSearchCursoSuperior(null, ['required' => false], ['objectName' => 'employee_course']);
  966 + $this->campoTexto('employee_completion_year', null, null, null, 4);
  967 + $this->inputsHelper()->simpleSearchIes(null, ['required' => false], ['objectName' => 'employee_college']);
  968 + $options = [
  969 + 'resources' => SelectOptions::employeeGraduationDisciplines(),
  970 + 'required' => false
  971 + ];
  972 + $this->inputsHelper()->select('employee_discipline_id', $options);
888 973  
889   - protected function createOrUpdateInep(){
890   - Portabilis_Utils_Database::fetchPreparedQuery("DELETE FROM modules.educacenso_cod_docente WHERE cod_servidor = $1",array('params' => array($this->cod_servidor)), false );
891   - if ($this->cod_docente_inep){
892   - $sql = "INSERT INTO modules.educacenso_cod_docente (cod_servidor,cod_docente_inep, fonte, created_at)
893   - VALUES ($1, $2,'U', 'NOW()')";
894   - Portabilis_Utils_Database::fetchPreparedQuery($sql, array('params' => array($this->cod_servidor, $this->cod_docente_inep)));
  974 + $this->campoTabelaFim();
895 975 }
896   - }
897   -
898   - protected function addGraduationsTable()
899   - {
900   - $graduations = $this->fillEmployeeGraduations($this->cod_servidor);
901   -
902   - $rows = $this->getGraduateTableRows($graduations);
903   -
904   - $this->campoTabelaInicio('graduations', 'Curso(s) superior(es) concluído(s)',
905   - [
906   - 'Curso',
907   - 'Ano de conclusão',
908   - 'Instituição de Educação Superior',
909   - 'Área de conhecimento/Disciplina de formação',
910   - ],
911   - $rows
912   - );
913   -
914   - $this->inputsHelper()->simpleSearchCursoSuperior(null, ['required' => false], ['objectName' => 'employee_course']);
915   - $this->campoTexto('employee_completion_year', null, null, null, 4);
916   - $this->inputsHelper()->simpleSearchIes(null, ['required' => false], ['objectName' => 'employee_college']);
917   - $options = array(
918   - 'resources' => SelectOptions::employeeGraduationDisciplines(),
919   - 'required' => false
920   - );
921   - $this->inputsHelper()->select('employee_discipline_id', $options);
922   -
923   - $this->campoTabelaFim();
924   - }
925 976  
926 977 /**
927 978 * @param $employeeId
  979 + *
928 980 * @return array|mixed
929 981 */
930 982 protected function fillEmployeeGraduations($employeeId)
... ... @@ -940,7 +992,7 @@ JS;
940 992 $oldInputGraduation->college_id = old('employee_college_id')[$key];
941 993 $oldInputGraduation->discipline_id = old('employee_discipline_id')[$key];
942 994 $graduations[] = $oldInputGraduation;
943   - }
  995 + }
944 996  
945 997 return $graduations;
946 998 }
... ... @@ -990,7 +1042,7 @@ JS;
990 1042 return true;
991 1043 }
992 1044  
993   - foreach($this->employee_course_id as $key => $courseId) {
  1045 + foreach ($this->employee_course_id as $key => $courseId) {
994 1046 if (empty($courseId)) {
995 1047 continue;
996 1048 }
... ... @@ -1021,9 +1073,9 @@ JS;
1021 1073 protected function getCollegeName($collegeId)
1022 1074 {
1023 1075 $college = DB::table('modules.educacenso_ies')->where('id', $collegeId)->get(['nome', 'ies_id'])->first();
  1076 +
1024 1077 return $college->ies_id . ' - ' . $college->nome;
1025 1078 }
1026   -
1027 1079 }
1028 1080  
1029 1081 // Instancia objeto de página
... ...
ieducar/intranet/educar_transferencia_solicitacao_cad.php
1 1 <?php
2 2  
  3 +use App\Models\LegacyRegistration;
  4 +use App\Services\PromotionService;
  5 +
3 6 require_once 'include/clsBase.inc.php';
4 7 require_once 'include/clsCadastro.inc.php';
5 8 require_once 'include/clsBanco.inc.php';
... ... @@ -89,33 +92,11 @@ class indice extends clsCadastro
89 92 $this->reabrirMatricula($this->ref_cod_matricula);
90 93 }
91 94  
92   - $instituicaoId = (new clsBanco)->unicoCampo('select cod_instituicao from pmieducar.instituicao where ativo = 1 order by cod_instituicao asc limit 1;');
93   -
94   - $fakeRequest = new CoreExt_Controller_Request(
95   - ['data' => [
96   - 'oper' => 'post',
97   - 'resource' => 'promocao',
98   - 'matricula_id' => $this->ref_cod_matricula,
99   - 'instituicao_id' => $instituicaoId,
100   - 'ano' => $ano,
101   - 'escola' => $escolaId,
102   - 'curso' => $cursoId,
103   - 'serie' => $serieId,
104   - 'turma' => $turmaId
105   - ]
106   - ]);
107   -
108   - $promocaoApi = new PromocaoApiController();
109   - $promocaoApi->setRequest($fakeRequest);
110   -
111   - try {
112   - $promocaoApi->Gerar();
113   - } catch (CoreExt_Exception $exception) {
114   - // Quando o aluno não possuir enturmação na escola que está
115   - // cancelando a matrícula, uma Exception era lançada ao
116   - // instanciar o ServiceBoletim, este catch garante que não irá
117   - // quebrar o processo.
118   - }
  95 + /** @var LegacyRegistration $registration */
  96 + $registration = LegacyRegistration::find($this->ref_cod_matricula);
  97 +
  98 + $promocao = new PromotionService($registration->lastEnrollment()->first());
  99 + $promocao->fakeRequest();
119 100  
120 101 $this->Excluir();
121 102 }
... ... @@ -179,7 +160,7 @@ class indice extends clsCadastro
179 160  
180 161 $opcoes = ['' => 'Selecione'];
181 162 $objTemp = new clsPmieducarEscola();
182   -
  163 + $objTemp->_campo_order_by = 'nome';
183 164 $lista = $objTemp->lista(null, null, null, $det_matricula['ref_cod_instituicao']);
184 165  
185 166 foreach ($lista as $escola) {
... ...
ieducar/intranet/include/pmieducar/clsPmieducarServidor.inc.php
... ... @@ -125,6 +125,11 @@ class clsPmieducarServidor extends Model
125 125 $valores .= "{$gruda}'{$this->ref_cod_subnivel}'";
126 126 $gruda = ', ';
127 127 }
  128 + if (is_numeric($this->ref_idesco)) {
  129 + $campos .= "{$gruda}ref_idesco";
  130 + $valores .= "{$gruda}'{$this->ref_idesco}'";
  131 + $gruda = ', ';
  132 + }
128 133 $campos .= "{$gruda}data_cadastro";
129 134 $valores .= "{$gruda}NOW()";
130 135 $gruda = ', ';
... ...
ieducar/intranet/include/pmieducar/clsPmieducarServidorFuncao.inc.php
... ... @@ -124,7 +124,7 @@ class clsPmieducarServidorFuncao extends Model
124 124 if (empty($this->matricula)) {
125 125 $set[] = 'matricula = NULL';
126 126 } elseif (is_string($this->matricula)) {
127   - $set[] = 'matricula = ' . $this->matricula;
  127 + $set[] = "matricula = '". $this->matricula ."'";
128 128 }
129 129  
130 130 if (is_numeric($this->ref_cod_funcao)) {
... ... @@ -341,7 +341,7 @@ class clsPmieducarServidorFuncao extends Model
341 341 if (is_numeric($this->ref_ref_cod_instituicao) && is_numeric($this->ref_cod_servidor) && is_array($funcoes)) {
342 342 $delete = "DELETE FROM {$this->_tabela} WHERE ref_ref_cod_instituicao = '{$this->ref_ref_cod_instituicao}' AND ref_cod_servidor = '{$this->ref_cod_servidor}'";
343 343 if (!empty($funcoes)) {
344   - $delete .= ' AND ref_cod_funcao NOT IN (' . implode($funcoes, ',') . ')';
  344 + $delete .= ' AND cod_servidor_funcao NOT IN (' . implode($funcoes, ',') . ')';
345 345 }
346 346  
347 347 $db = new clsBanco();
... ...
ieducar/lib/Portabilis/View/Helper/DynamicInput/EscolaRequired.php 0 → 100644
... ... @@ -0,0 +1,21 @@
  1 +<?php
  2 +
  3 +use Illuminate\Support\Facades\Session;
  4 +
  5 +require_once 'lib/Portabilis/View/Helper/DynamicInput/CoreSelect.php';
  6 +require_once 'Portabilis/Business/Professor.php';
  7 +require_once 'App/Model/NivelTipoUsuario.php';
  8 +
  9 +class Portabilis_View_Helper_DynamicInput_EscolaRequired extends Portabilis_View_Helper_DynamicInput_Escola
  10 +{
  11 + public function escolaRequired($options = [])
  12 + {
  13 + $nivelUsuario = Session::get('nivel');
  14 +
  15 + if ($nivelUsuario == App_Model_NivelTipoUsuario::ESCOLA) {
  16 + $options['options']['required'] = true;
  17 + }
  18 +
  19 + parent::escola($options);
  20 + }
  21 +}
... ...
ieducar/modules/Api/Views/AlunoController.php
... ... @@ -2,6 +2,7 @@
2 2  
3 3 use App\Models\LegacyDeficiency;
4 4 use App\Models\Individual;
  5 +use App\Models\LogUnification;
5 6 use iEducar\Modules\Educacenso\Validator\DeficiencyValidator;
6 7 use iEducar\Modules\Educacenso\Validator\InepExamValidator;
7 8 use iEducar\Modules\Educacenso\Validator\BirthCertificateValidator;
... ... @@ -1958,6 +1959,29 @@ class AlunoController extends ApiCoreController
1958 1959 return $bairro;
1959 1960 }
1960 1961  
  1962 + protected function getUnificacoes()
  1963 + {
  1964 + if (!$this->canGetUnificacoes()) {
  1965 + return;
  1966 + }
  1967 +
  1968 + $arrayEscola = explode(',', $this->getRequest()->escola);
  1969 +
  1970 + $unificationsQuery = LogUnification::query();
  1971 + $unificationsQuery->whereHas('studentMain', function ($studentQuery) use ($arrayEscola) {
  1972 + $studentQuery->whereHas('registrations', function ($registrationsQuery) use ($arrayEscola){
  1973 + $registrationsQuery->whereIn('school_id', $arrayEscola);
  1974 + });
  1975 + });
  1976 +
  1977 + return ['unificacoes' => $unificationsQuery->get(['main_id', 'duplicates_id', 'created_at', 'active'])->all()];
  1978 + }
  1979 +
  1980 + protected function canGetUnificacoes()
  1981 + {
  1982 + return $this->validatesPresenceOf('escola');
  1983 + }
  1984 +
1961 1985 public function Gerar()
1962 1986 {
1963 1987 if ($this->isRequestFor('get', 'aluno')) {
... ... @@ -1986,6 +2010,8 @@ class AlunoController extends ApiCoreController
1986 2010 $this->appendResponse($this->delete());
1987 2011 } elseif ($this->isRequestFor('get', 'get-nome-bairro')) {
1988 2012 $this->appendResponse($this->getNomeBairro());
  2013 + } elseif ($this->isRequestFor('get', 'unificacao-alunos')) {
  2014 + $this->appendResponse($this->getUnificacoes());
1989 2015 } else {
1990 2016 $this->notImplementedOperationError();
1991 2017 }
... ...
ieducar/modules/Api/Views/DiarioController.php
... ... @@ -328,10 +328,15 @@ class DiarioController extends ApiCoreController
328 328 $nomeCampoRecuperacao = $this->defineCampoTipoRecuperacao($matriculaId);
329 329  
330 330 $valorNota = $serviceBoletim->calculateStageScore($etapa, $notaOriginal, $notaRecuperacao);
  331 + $notaMaximaPermitida = $regra->getNotaMaximaRecuperacao($etapa);
331 332  
332   - if ($notaRecuperacao > $regra->notaMaximaGeral) {
333   - $this->messenger->append("A nota {$valorNota} está acima da configurada para nota máxima para exame que é {$regra->notaMaximaGeral}.", 'error');
  333 + if (empty($notaMaximaPermitida)) {
  334 + $this->messenger->append("A nota máxima para recuperação não foi definida", 'error');
  335 + return false;
  336 + }
334 337  
  338 + if ($notaRecuperacao > $notaMaximaPermitida) {
  339 + $this->messenger->append("A nota {$valorNota} está acima da configurada para nota máxima para exame que é {$notaMaximaPermitida}.", 'error');
335 340 return false;
336 341 }
337 342  
... ...
ieducar/modules/Api/Views/MenuController.php
1 1 <?php
2 2  
3 3 use App\Menu;
4   -use App\User;
5   -use Illuminate\Support\Facades\Auth;
6   -use Illuminate\Support\Facades\Session;
7 4  
8 5 require_once 'lib/Portabilis/Controller/ApiCoreController.php';
9 6 require_once 'lib/Portabilis/Array/Utils.php';
... ... @@ -11,69 +8,30 @@ require_once &#39;lib/Portabilis/String/Utils.php&#39;;
11 8  
12 9 class MenuController extends ApiCoreController
13 10 {
14   -
15   - private function getCurrentUser()
16   - {
17   - $this->pessoa_logada = Session::get('id_pessoa');
18   -
19   - return $this->pessoa_logada;
20   - }
21   -
22   - protected function sqlsForNumericSearch()
23   - {
24   - $usuario = $this->getCurrentUser();
25   - $sqls[] = "
26   - select
27   - m.link as id,
28   - coalesce(m.title, m.description) as name
29   - from public.menus m
30   - inner join pmieducar.menu_tipo_usuario mst
31   - on mst.menu_id = m.id
32   - inner join pmieducar.usuario u
33   - on u.ref_cod_tipo_usuario = mst.ref_cod_tipo_usuario
34   - where true
35   - and u.cod_usuario = '{$usuario}'
36   - and mst.visualiza = 1
37   - and m.link is not null
38   - and m.process = $1
39   - order by m.title
40   - limit 15;
41   - ";
42   -
43   - return $sqls;
44   - }
45   -
46   - protected function sqlsForStringSearch()
  11 + protected function search()
47 12 {
48   - $usuario = $this->getCurrentUser();
49   -
50   - $sqls[] = "
51   - select
52   - m.link as id,
53   - coalesce(m.title, m.description) as name
54   - from public.menus m
55   - inner join pmieducar.menu_tipo_usuario mst
56   - on mst.menu_id = m.id
57   - inner join pmieducar.usuario u
58   - on u.ref_cod_tipo_usuario = mst.ref_cod_tipo_usuario
59   - where true
60   - and u.cod_usuario = '{$usuario}'
61   - and mst.visualiza = 1
62   - and m.link is not null
63   - and (
64   - m.title ilike '%'|| $1 ||'%'
65   - or m.description ilike '%'|| $1 ||'%'
66   - )
67   - order by m.title
68   - limit 15;
69   - ";
  13 + if ($this->canSearch()) {
  14 + $query = $this->getRequest()->query;
  15 +
  16 + $resources = Menu::findByUser($this->user(), $query)
  17 + ->map(function (Menu $menu) {
  18 + return [
  19 + 'link' => $menu->link,
  20 + 'label' => $menu->title,
  21 + ];
  22 + });
  23 + }
70 24  
71   - return $sqls;
72   - }
  25 + if (empty($resources)) {
  26 + $resources = [
  27 + [
  28 + 'link' => '',
  29 + 'label' => 'Sem resultados.',
  30 + ]
  31 + ];
  32 + }
73 33  
74   - protected function formatResourceValue($resource)
75   - {
76   - return $this->toUtf8($resource['name']);
  34 + return ['menus' => $resources];
77 35 }
78 36  
79 37 public function Gerar()
... ...
ieducar/modules/Avaliacao/Service/Boletim.php
... ... @@ -236,7 +236,7 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable
236 236 }
237 237 }
238 238  
239   - $etapaAtual = $_GET['etapa'] == 'Rc' ? $maiorEtapaUtilizada : $_GET['etapa'];
  239 + $etapaAtual = ($_GET['etapa'] ?? null) == 'Rc' ? $maiorEtapaUtilizada : ($_GET['etapa'] ?? null);
240 240  
241 241 $this->_setRegra(App_Model_IedFinder::getRegraAvaliacaoPorMatricula(
242 242 $codMatricula, $this->getRegraDataMapper(), $matricula
... ... @@ -469,7 +469,7 @@ class Avaliacao_Service_Boletim implements CoreExt_Configurable
469 469 null,
470 470 null,
471 471 $enrollment,
472   - false,
  472 + true,
473 473 $ignorarDispensasParciais
474 474 ));
475 475  
... ...
ieducar/modules/Cadastro/Assets/Javascripts/Servidor.js
... ... @@ -48,7 +48,7 @@ function submitForm() {
48 48 }
49 49 });
50 50  
51   - if (block) {
  51 + if (block && tipoacao != 'Novo') {
52 52 confirmaEnvio();
53 53 } else {
54 54 acao();
... ... @@ -90,6 +90,7 @@ function confirmaEnvio() {
90 90 }
91 91  
92 92 let obrigarCamposCenso = $j('#obrigar_campos_censo').val() == '1';
  93 +let tipoacao = $j("#tipoacao").val();
93 94 let escolaridadeSuperior = false;
94 95  
95 96 function validaServidor() {
... ...
ieducar/modules/Portabilis/Assets/Javascripts/Frontend/Inputs/MultipleSearch.js
... ... @@ -73,12 +73,15 @@ var multipleSearchHelper = {
73 73 var updateChozen = function(input, values){
74 74 var orderedList = [];
75 75  
76   - for (let prop in values) {
77   - orderedList.push({
78   - label:values[prop],
79   - value: prop
80   - });
  76 + if (!Array.isArray(values)) {
  77 + for (let prop in values) {
  78 + orderedList.push({
  79 + label:values[prop],
  80 + value: prop
  81 + });
  82 + }
81 83 }
  84 +
82 85 orderedList = orderedList.sort(function (a,b) {
83 86 return a.label > b.label ? 1 : -1
84 87 });
... ...
ieducar/modules/RegraAvaliacao/Model/Regra.php
... ... @@ -273,6 +273,23 @@ class RegraAvaliacao_Model_Regra extends CoreExt_Entity
273 273 }
274 274  
275 275 /**
  276 + * Pega a nota máxima permitida para a recuperação
  277 + *
  278 + * @param $etapa
  279 + * @return float
  280 + */
  281 + public function getNotaMaximaRecuperacao($etapa)
  282 + {
  283 + $tipoRecuperacaoParalela = $this->get('tipoRecuperacaoParalela');
  284 +
  285 + if ($tipoRecuperacaoParalela != RegraAvaliacao_Model_TipoRecuperacaoParalela::USAR_POR_ETAPAS_ESPECIFICAS) {
  286 + return $this->notaMaximaGeral;
  287 + }
  288 +
  289 + return $this->getRegraRecuperacaoByEtapa($etapa)->notaMaxima;
  290 + }
  291 +
  292 + /**
276 293 * @see CoreExt_Entity::__toString()
277 294 */
278 295 public function __toString()
... ...
resources/views/layout/vue.blade.php
... ... @@ -30,16 +30,7 @@
30 30 resource : 'menu-search'
31 31 }
32 32 }).then((res) => {
33   - let arr = [];
34   -
35   - for (let menu in res.data.result) {
36   - arr.push({
37   - link: menu,
38   - label: res.data.result[menu]
39   - });
40   - }
41   -
42   - this.options = arr;
  33 + this.options = res.data.menus;
43 34 });
44 35 },
45 36 dispatchAction (element) {
... ...
tests/Feature/Services/EnrollmentServiceTest.php
... ... @@ -282,68 +282,59 @@ class EnrollmentServiceTest extends TestCase
282 282 }
283 283  
284 284 /**
285   - * Matrícula com enturmaçao inativa, a ultima terá que ficar como remanejada
286   - *
287   - * @return void
288   - *
289   - * @throws Throwable
  285 + * Instituição sem data base, a ultima enturmação deverá ser retornada
290 286 */
291   - public function testRelocatePreviousEnrollment()
  287 + public function testGetPreviousEnrollmentWithouRelocationDate()
292 288 {
293 289 /** @var LegacyEnrollment $enrollment */
294 290 $enrollment = factory(LegacyEnrollment::class)->create([
295 291 'ref_cod_turma' => $this->schoolClass,
296   - 'ativo' => false,
297 292 ]);
298 293  
299   - $registration = $enrollment->registration;
  294 + $enrollment->schoolClass->school->institution->data_base_remanejamento = null;
  295 + $enrollment->schoolClass->school->institution->save();
300 296  
301   - $schoolClass = factory(LegacySchoolClass::class)->create();
  297 + $lastEnrollment = $this->service->getPreviousEnrollmentAccordingToRelocationDate($enrollment->registration);
302 298  
303   - factory(LegacySchoolClassStage::class)->create([
304   - 'ref_cod_turma' => $schoolClass,
  299 + $this->assertEquals($enrollment->id, $lastEnrollment->id);
  300 + }
  301 +
  302 + /**
  303 + * Instituição sem data base, a ultima enturmação deverá ser retornada
  304 + */
  305 + public function testGetPreviousEnrollmentWithRelocationDateBeforeDepartedDate()
  306 + {
  307 + /** @var LegacyEnrollment $enrollment */
  308 + $enrollment = factory(LegacyEnrollment::class)->create([
  309 + 'ref_cod_turma' => $this->schoolClass,
  310 + 'data_exclusao' => now(),
305 311 ]);
306 312  
307   - $this->service->enroll($registration, $schoolClass, now());
  313 + $enrollment->schoolClass->school->institution->data_base_remanejamento = Carbon::yesterday();
  314 + $enrollment->schoolClass->school->institution->save();
308 315  
309   - $enrollment->refresh();
  316 + $lastEnrollment = $this->service->getPreviousEnrollmentAccordingToRelocationDate($enrollment->registration);
310 317  
311   - $this->assertTrue($enrollment->remanejado);
  318 + $this->assertEquals($enrollment->id, $lastEnrollment->id);
312 319 }
313 320  
314 321 /**
315   - * Matrícula com enturmaçao inativa com saída antes da data base,
316   - * a ultima enturmação não pode ficar como remanejada
317   - *
318   - * @return void
319   - *
320   - * @throws Throwable
  322 + * Instituição sem data base, a ultima enturmação deverá ser retornada
321 323 */
322   - public function testRelocatePreviousEnrollmentBeforeRelocateData()
  324 + public function testGetPreviousEnrollmentWithRelocationDateAfterDepartedDate()
323 325 {
324 326 /** @var LegacyEnrollment $enrollment */
325 327 $enrollment = factory(LegacyEnrollment::class)->create([
326 328 'ref_cod_turma' => $this->schoolClass,
327   - 'ativo' => false,
328 329 'data_exclusao' => Carbon::yesterday(),
329 330 ]);
330 331  
331 332 $enrollment->schoolClass->school->institution->data_base_remanejamento = now();
332 333 $enrollment->schoolClass->school->institution->save();
333 334  
334   - $registration = $enrollment->registration;
335   -
336   - $schoolClass = factory(LegacySchoolClass::class)->create();
337   -
338   - factory(LegacySchoolClassStage::class)->create([
339   - 'ref_cod_turma' => $schoolClass,
340   - ]);
341   -
342   - $this->service->enroll($registration, $schoolClass, now());
343   -
344   - $enrollment->refresh();
  335 + $lastEnrollment = $this->service->getPreviousEnrollmentAccordingToRelocationDate($enrollment->registration);
345 336  
346   - $this->assertNull($enrollment->remanejado);
  337 + $this->assertNull($lastEnrollment);
347 338 }
348 339  
349 340 public function testReorder()
... ...
tests/Unit/CoreExt/Controller/Dispatcher/Strategy/FrontStrategyTest.php
... ... @@ -59,6 +59,7 @@ class CoreExt_Controller_Dispatcher_Strategy_FrontStrategyTest extends PHPUnit\F
59 59 {
60 60 parent::__construct($name, $data, $dataName);
61 61 $this->_path = realpath(dirname(__FILE__) . '/../../_stub');
  62 + $this->requestUri = $_SERVER['REQUEST_URI'] ?? null;
62 63 }
63 64  
64 65 protected function setUp(): void
... ...
tests/Unit/Modules/Service/FaltaAlunoTest.php
... ... @@ -73,4 +73,11 @@ class Avaliacao_Service_FaltaAlunoTest extends Avaliacao_Service_TestCommon
73 73 $_GET['etapa'] = 'Rc';
74 74 $service = $this->_getServiceInstance();
75 75 }
  76 +
  77 + public function tearDown(): void
  78 + {
  79 + $_GET = [];
  80 +
  81 + Portabilis_Utils_Database::$_db = null;
  82 + }
76 83 }
... ...
tests/Unit/Modules/Service/NotaAlunoTest.php
... ... @@ -72,4 +72,9 @@ class Avaliacao_Service_NotaAlunoTest extends Avaliacao_Service_TestCommon
72 72  
73 73 $service = $this->_getServiceInstance();
74 74 }
  75 +
  76 + public function tearDown(): void
  77 + {
  78 + Portabilis_Utils_Database::$_db = null;
  79 + }
75 80 }
... ...
tests/Unit/Modules/Service/ParecerDescritivoCommon.php
... ... @@ -269,4 +269,9 @@ abstract class Avaliacao_Service_ParecerDescritivoCommon extends Avaliacao_Servi
269 269 $service->addPareceres($pareceres);
270 270 $service->savePareceres();
271 271 }
  272 +
  273 + public function tearDown(): void
  274 + {
  275 + Portabilis_Utils_Database::$_db = null;
  276 + }
272 277 }
... ...
tests/Unit/Modules/Service/UtilityTest.php
... ... @@ -180,4 +180,9 @@ class Avaliacao_Service_UtilityTest extends Avaliacao_Service_TestCommon
180 180 $ret = $service->preverNotaRecuperacao(1);
181 181 $this->assertEquals(4.0, $ret);
182 182 }
  183 +
  184 + public function tearDown(): void
  185 + {
  186 + Portabilis_Utils_Database::$_db = null;
  187 + }
183 188 }
... ...