Skip to content

Commit

Permalink
- Reestruturação do TAG
Browse files Browse the repository at this point in the history
  • Loading branch information
ruancelisantos committed Dec 27, 2016
1 parent 16ff392 commit a9c607d
Show file tree
Hide file tree
Showing 19 changed files with 154 additions and 162 deletions.
1 change: 1 addition & 0 deletions app/components/UserIdentity.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
13 changes: 6 additions & 7 deletions app/controllers/ClassesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];

Expand Down Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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']
Expand Down
33 changes: 11 additions & 22 deletions app/controllers/ClassroomController.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

/*
*
*/
//-----------------------------------------CLASSE VALIDADA ATÉ A SEQUENCIA 35!!------------------------
class ClassroomController extends Controller {

Expand Down Expand Up @@ -448,10 +450,6 @@ public function actionUpdate($id) {
//@done S1 - Criar Trigger ou solução similar para colocar o auto increment do professor no instructor_fk da turma
//@done s1 - Atualizar o teachingdata ao atualizar o classroom
$modelClassroom = $this->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'];
Expand Down Expand Up @@ -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'));
}
}

Expand Down Expand Up @@ -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);
Expand Down
22 changes: 11 additions & 11 deletions app/controllers/EnrollmentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
2 changes: 2 additions & 0 deletions app/controllers/ReportsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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');
}
}
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/SiteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)]);
}

/**
Expand Down
49 changes: 49 additions & 0 deletions app/messages/pt_br/errors.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php
/*
* The BSD-3-Clause
Copyright (c) 2011, Instituto de Pesquisas em Tecnologia e Inovação(IPTI).
* Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
(1) Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
(2) Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
(3)The name of the author may not be used to
endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
return array(
//Meses
'Can not delete' => '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',

)
?>
1 change: 1 addition & 0 deletions app/modules/lunch/controllers/LunchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 9 additions & 1 deletion app/modules/resultsmanagement/controllers/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
2 changes: 1 addition & 1 deletion themes/default/views/classes/classContents.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<div>
<?php echo CHtml::label(yii::t('default', 'Classroom'), 'classroom', array('class' => 'control-label')); ?>
<?php
echo CHtml::dropDownList('classroom', '', CHtml::listData(Classroom::model()->findAll('school_inep_fk=' . Yii::app()->user->school . ' && school_year = ' . Yii::app()->user->year, array('order' => 'name')), 'id', 'name'), array(
echo CHtml::dropDownList('classroom', '', CHtml::listData(Classroom::model()->findAll(array('condition'=>'school_inep_fk=' . Yii::app()->user->school . ' && school_year = ' . Yii::app()->user->year,'order' => 'name')), 'id', 'name'), array(
'key' => 'id',
'class' => 'select-search-on',
'prompt' => 'Selecione a turma',
Expand Down
2 changes: 1 addition & 1 deletion themes/default/views/classes/frequency.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<div>
<?php echo CHtml::label(yii::t('default', 'Classroom'), 'classroom', array('class' => 'control-label')); ?>
<?php
echo CHtml::dropDownList('classroom', '', CHtml::listData(Classroom::model()->findAll('school_inep_fk=' . Yii::app()->user->school . ' && school_year = ' . Yii::app()->user->year, array('order' => 'name')), 'id', 'name'), array(
echo CHtml::dropDownList('classroom', '', CHtml::listData(Classroom::model()->findAll(array('condition'=>'school_inep_fk=' . Yii::app()->user->school . ' && school_year = ' . Yii::app()->user->year,'order' => 'name')), 'id', 'name'), array(
'key' => 'id',
'class' => 'select-search-on',
'prompt' => 'Selecione a turma',
Expand Down
16 changes: 7 additions & 9 deletions themes/default/views/layouts/fullmenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ function isActive($pages){
<div id="menu" class="hidden-print">
<div class="slim-scroll" data-scroll-height="800px">
<ul>
<!--<li id="menu-dashboard" class="<?= isActive( "site" )?>">
<a class="glyphicons home" href="/"><i></i><span>Página Inicial</span></a>
</li>-->
<li id="menu-logout">
<a class="glyphicons unshare" href="<?php echo yii::app()->createUrl('site/logout') ?>"><i></i><span>Sair</span></a>
</li>
<li id="menu-dashboard" class="<?= isActive( "site" )?>">
<a class="glyphicons home" href="/"><i></i><span>Página Inicial</span></a>
</li>
<li id="menu-school" class="<?= isActive("school") ?>">
<?php
$schoolurl = yii::app()->createUrl('school');
Expand All @@ -111,9 +111,7 @@ function isActive($pages){
<li id="menu-student" class="<?= isActive("reports") ?>">
<a class="glyphicons signal" href="<?php echo yii::app()->createUrl('reports') ?>"><i></i><span>Relatórios</span></a>
</li>
<li id="menu-student" class="<?= isActive("reports") ?>">
<a class="glyphicons signal" href="<?php echo yii::app()->createUrl('forms') ?>"><i></i><span>Formulários</span></a>
</li>

<!--<li id="menu-student" class="hasSubmenu <?=isActive("classroom") ?>">
<a data-toggle="collapse" class="glyphicons adress_book" href="#menu-classroom2"><i></i><span>Turma</span></a>
<ul class="collapse" id="menu-classroom2">
Expand Down Expand Up @@ -164,9 +162,9 @@ function isActive($pages){
</ul>
</div>
<!-- // Scrollable Menu wrapper with Maximum Height END -->
<!--<div class="copy" style="width: 170px !IMPORTANT;">
<div style="float: left" id="apoio">Apoio:</div>
</div>-->
<div class="copy" style="width: 170px !IMPORTANT;">
<div style="float: left" id="apoio">Versão TAG: <?php echo Yii::app()->user->version?></div>
</div>
</div>

<!-- // Sidebar Menu END -->
Expand Down
3 changes: 2 additions & 1 deletion themes/default/views/layouts/resultsmanagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@
<div class="col-md-8">
<?= $content ?>
</div>

<div class="col-md-4">
<?php $this->widget('resultsmanagement.components.sideInfoWidget')?>
<?php if(!Yii::app()->user->hardfoot){$this->widget('resultsmanagement.components.sideInfoWidget');}?>
</div>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion themes/default/views/lunch/lunch/_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
<div class="span12">
<?= CHTML::activeLabel($menuModel, 'date', ['class' => "control-label"]) ?>
<div class="form-group ">
<?php $date = 'date'; ?>
<?php $date = 'date';
?>
<?= CHTML::textField("none", date("d/m/Y", strtotime($menuModel->date)), ['class' => "span8 form-control", "readonly" => "readonly"]) ?>
<?= CHTML::hiddenField(chtml::resolveName($menuModel, $date), $menuModel->date, ['class' => "span10 form-control", "readonly" => "readonly"]) ?>
</div>
Expand Down
2 changes: 1 addition & 1 deletion themes/default/views/reports/BFReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
$html = "";
foreach ($report as $name => $r) {
$html .= "<tr>"
. "<td rowspan='4' colspan='3'>"
. "<td rowspan='4' colspan='1'>"
. $name
. "<br> Nascimento: " . $r['Info']['birthday']
. "<br> NIS: " . $r['Info']['NIS']
Expand Down
Loading

0 comments on commit a9c607d

Please sign in to comment.