diff --git a/app/components/UserIdentity.php b/app/components/UserIdentity.php index 648b33801..d4048a0c6 100755 --- a/app/components/UserIdentity.php +++ b/app/components/UserIdentity.php @@ -51,6 +51,7 @@ public function authenticate() { $userSchools = $record->usersSchools; $school = isset($record->usersSchools[0]->school_fk) ? $record->usersSchools[0]->school_fk : null; } + $this->setState('version','2.10.1'); $this->setState('loginInfos', $record); $this->setState('usersSchools',$userSchools); $this->setState('school',$school); diff --git a/app/controllers/ClassesController.php b/app/controllers/ClassesController.php index 987716e7b..4f8b10a14 100755 --- a/app/controllers/ClassesController.php +++ b/app/controllers/ClassesController.php @@ -143,7 +143,7 @@ public function actionSaveFrequency($classroom = null, $discipline = null, $mont $discipline = $discipline == null ? $_POST['disciplines'] : $discipline; $discipline = ($discipline == "Todas as disciplinas") ? null : $discipline; $month = $month == null ? $_POST['month'] : $month; - $instructor_faults = $_POST['instructor_faults']; + @$instructor_faults = $_POST['instructor_faults']; $instructor_days = $_POST['instructor_days']; $student_faults = $_POST['student_faults']; @@ -249,15 +249,14 @@ public function actionFrequency() { public function actionGetDisciplines() { echo CHtml::tag('option', array('value' => null), CHtml::encode('Todas as disciplinas'), true); - if (!isset($_POST['classroom']) || empty($_POST['classroom'])) + if (empty($_POST['classroom'])) return true; $crid = $_POST['classroom']; $classr = Yii::app()->db->createCommand("select distinct discipline_fk from schedule where classroom_fk = $crid;")->queryAll(); - $disciplinesLabels = ClassroomController::classroomDisciplineLabelArray(); foreach ($classr as $i => $discipline) { - if ($discipline[discipline_fk] != 0) { - echo CHtml::tag('option', array('value' => $discipline[discipline_fk]), CHtml::encode($disciplinesLabels[$discipline[discipline_fk]]), true); + if (isset($discipline['discipline_fk'])) { + echo CHtml::tag('option', array('value' => $discipline['discipline_fk']), CHtml::encode($disciplinesLabels[$discipline['discipline_fk']]), true); } } } @@ -327,12 +326,12 @@ public function actionGetClassesForFrequency($classroom = null, $discipline = nu if ($allDisciplines) { $schedules = Schedule::model()->findAllByAttributes(array( 'classroom_fk' => $classroom)); - } else { + } + else { $schedules = Schedule::model()->findAllByAttributes(array( 'classroom_fk' => $classroom, 'discipline_fk' => $discipline)); } - /* $calendars = Calendar::model()->findAllByAttributes( array( 'school_year' => $_POST['year'] diff --git a/app/controllers/ClassroomController.php b/app/controllers/ClassroomController.php index 7b7788308..52d9d98b9 100755 --- a/app/controllers/ClassroomController.php +++ b/app/controllers/ClassroomController.php @@ -1,5 +1,7 @@ loadModel($id, $this->MODEL_CLASSROOM); - preg_match("/dbname=([^;]*)/", Yii::app()->db->connectionString, $dbname); - if($dbname[1] != "br.org.ipti.tagmaster"){ - $modelTeachingData = $this->loadModel($id, $this->MODEL_TEACHING_DATA); - } $modelTeachingData = $this->loadModel($id, $this->MODEL_TEACHING_DATA); if(isset($_POST['enrollments'])&&isset($_POST['toclassroom'])){ $enrollments = $_POST['enrollments']; @@ -573,21 +571,15 @@ public function actionUpdate($id) { */ //@done s1 - excluir Matriculas, TeachingData e Turma public function actionDelete($id) { - $students = $this->loadModel($id, $this->MODEL_STUDENT_ENROLLMENT); - $instructors = $this->loadModel($id, $this->MODEL_TEACHING_DATA); - foreach ($students as $key => $value) { - $value->delete(); - } - foreach ($instructors as $key => $value) { - $value->delete(); - } $classroom = $this->loadModel($id, $this->MODEL_CLASSROOM); - if ($classroom->delete()) { - Log::model()->saveAction("classroom", $id, "D", $classroom->name); - Yii::app()->user->setFlash('success', Yii::t('default', 'Turma excluída com sucesso!')); - $this->redirect(array('index')); - } else { - throw new CHttpException(404, 'A página requisitada não existe.'); + try { + if ($classroom->delete()) { + Log::model()->saveAction("classroom", $id, "D", $classroom->name); + Yii::app()->user->setFlash('success', Yii::t('default', 'Turma excluída com sucesso!')); + $this->redirect(array('index')); + } + } catch(Exception $e) { + throw new CHttpException(901, Yii::t('errors','Can not delete')); } } @@ -635,11 +627,8 @@ public function loadModel($id, $model) { $return = Classroom::model()->findByPk($id); } else if ($model == $this->MODEL_TEACHING_DATA) { $classroom = $id; - $instructors = InstructorTeachingData::model()->findAll('classroom_id_fk = ' . $classroom); $return = $instructors; - - } else if ($model == $this->MODEL_STUDENT_ENROLLMENT) { $classroom = $id; $student = StudentEnrollment::model()->findAll('classroom_fk = ' . $classroom); diff --git a/app/controllers/EnrollmentController.php b/app/controllers/EnrollmentController.php index 5350d7f9c..573148833 100755 --- a/app/controllers/EnrollmentController.php +++ b/app/controllers/EnrollmentController.php @@ -350,19 +350,19 @@ public function actionSaveGrades() { ]); if(!isset($frequency_and_mean)){ - $frequency_and_mean = new FrequencyAndMeanByDiscipline(); - $frequency_and_mean->enrollment_fk = $enrollment_id; - $frequency_and_mean->discipline_fk = $id; - $frequency_and_mean->annual_average = $values[0]; - $frequency_and_mean->final_average = $values[1]; - $frequency_and_mean->absences = $values[3]; - $frequency_and_mean->frequency = $values[4]; + @$frequency_and_mean = new FrequencyAndMeanByDiscipline(); + @$frequency_and_mean->enrollment_fk = $enrollment_id; + @$frequency_and_mean->discipline_fk = $id; + @$frequency_and_mean->annual_average = $values[0]; + @$frequency_and_mean->final_average = $values[1]; + @$frequency_and_mean->absences = $values[3]; + @$frequency_and_mean->frequency = $values[4]; $saved = $saved && $frequency_and_mean->save(); }else{ - $frequency_and_mean->annual_average = $values[0]; - $frequency_and_mean->final_average = $values[1]; - $frequency_and_mean->absences = $values[3]; - $frequency_and_mean->frequency = $values[4]; + @$frequency_and_mean->annual_average = $values[0]; + @$frequency_and_mean->final_average = $values[1]; + @$frequency_and_mean->absences = $values[3]; + @$frequency_and_mean->frequency = $values[4]; $saved = $saved && $frequency_and_mean->update(); } diff --git a/app/controllers/ReportsController.php b/app/controllers/ReportsController.php index 74790ab8e..d839bab42 100755 --- a/app/controllers/ReportsController.php +++ b/app/controllers/ReportsController.php @@ -495,6 +495,7 @@ public function actionBFReport() { $command->order = "student, month"; $query = $command->queryAll(); + //@done S3 - Organizar o resultado da query que estava ilegível. $report = array(); foreach ($query as $v) { @@ -526,6 +527,7 @@ public function actionBFReport() { //Se não houver aulas no mês, coloca 0 no lugar. foreach ($report as $name => $c){ for ($i = $monthI; $i <= $monthF; $i++) { + $report[$name]['Classes'][$i] = isset($c['Classes'][$i]) ? $c['Classes'][$i] : ('N/A'); } } diff --git a/app/controllers/SiteController.php b/app/controllers/SiteController.php index 62b44f078..2b3c60e70 100755 --- a/app/controllers/SiteController.php +++ b/app/controllers/SiteController.php @@ -44,9 +44,9 @@ public function actionIndex() { $this->redirect(yii::app()->createUrl('site/login')); } - $this->redirect(yii::app()->createUrl('student')); - //$this->loadLogsHtml(5); - //$this->render('index', ["html" => $this->loadLogsHtml(8)]); + //$this->redirect(yii::app()->createUrl('student')); + $this->loadLogsHtml(5); + $this->render('index', ["html" => $this->loadLogsHtml(8)]); } /** diff --git a/app/messages/pt_br/errors.php b/app/messages/pt_br/errors.php new file mode 100644 index 000000000..e5452726f --- /dev/null +++ b/app/messages/pt_br/errors.php @@ -0,0 +1,49 @@ + 'Não é possível excluir, é provavel que existam registros associados a este item', + 'February' => 'Fevereiro', + 'March' => 'Março', + 'April' => 'Abril', + 'May' => 'Maio', + 'June' => 'Junho', + 'July' => 'Julho', + 'August' => 'Agosto', + 'September' => 'Setembro', + 'October' => 'Outubro', + 'November' => 'Novembro', + 'December' => 'Dezembro', + + ) +?> diff --git a/app/modules/lunch/controllers/LunchController.php b/app/modules/lunch/controllers/LunchController.php index 81cb1c7db..82f245430 100644 --- a/app/modules/lunch/controllers/LunchController.php +++ b/app/modules/lunch/controllers/LunchController.php @@ -22,6 +22,7 @@ public function actionCreate(){ $menuPost = $request->getPost("Menu", false); $menu = new Menu(); + $menu->date = date("Y-m-d h:i:s"); if($menuPost){ $menu->attributes = $menuPost; diff --git a/app/modules/resultsmanagement/controllers/DefaultController.php b/app/modules/resultsmanagement/controllers/DefaultController.php index 3cf1102bd..6c89a142a 100644 --- a/app/modules/resultsmanagement/controllers/DefaultController.php +++ b/app/modules/resultsmanagement/controllers/DefaultController.php @@ -5,7 +5,15 @@ class DefaultController extends CController public $headerDescription = ""; public function actionIndex(){ - $this->render('index'); + if(Yii::app()->user->hardfoot){ + //$this->redirect(''); + //echo 'hardfoot';exit; + $this->redirect(array('ManagementSchool/index','sid'=>Yii::app()->user->school)); + + }else{ + $this->render('index'); + } + } public function actionGetGMapInfo($lat, $lng){ $year = Yii::app()->user->year; diff --git a/index.php b/index.php index c7764f6a3..07d0d4738 100755 --- a/index.php +++ b/index.php @@ -6,13 +6,13 @@ $config=dirname(__FILE__).'/app/config/main.php'; // remove the following lines when in production mode -defined('YII_DEBUG') or define('YII_DEBUG',true); +defined('YII_DEBUG') or define('YII_DEBUG',false); // specify how many levels of call stack should be shown in each log message defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3); require_once($yii); Yii::createWebApplication($config)->run(); -error_reporting(E_ALL ^ E_DEPRECATED); -ini_set('display_errors','1'); +error_reporting(0); +ini_set('display_errors','0'); ini_set('always_populate_raw_post_data','-1'); diff --git a/themes/default/views/classes/classContents.php b/themes/default/views/classes/classContents.php index 51779a46b..b551cb33d 100644 --- a/themes/default/views/classes/classContents.php +++ b/themes/default/views/classes/classContents.php @@ -68,7 +68,7 @@