Skip to content
New issue

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

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

Already on GitHub? # to your account

fix/transferencia de matricula #300

Merged
merged 11 commits into from
May 23, 2023
Merged
1 change: 1 addition & 0 deletions app/config/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
'sagres',
'professional',
'sedsp',
'food',
),
// application components
'components' => array(
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/StudentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ public function actionTransfer($id)
$currentEnrollment = StudentEnrollment::model()->findByPk($modelStudentIdentification->studentEnrollment->id);
if ($currentEnrollment->validate()) {
$currentEnrollment->status = 2;
$currentEnrollment->transfer_date = date_create_from_format('d/m/Y', $_POST['StudentEnrollment']['transfer_date'])->format('Y-m-d');
if ($currentEnrollment->save()) {
Log::model()->saveAction("enrollment", $currentEnrollment->id, "U", $currentEnrollment->studentFk->name . "|" . $currentEnrollment->classroomFk->name);
}
Expand All @@ -479,6 +480,7 @@ public function actionTransfer($id)
$modelEnrollment->student_fk = $modelStudentIdentification->id;
$modelEnrollment->student_inep_id = $modelStudentIdentification->inep_id;
$modelEnrollment->status = 1;
$modelEnrollment->observation = $_POST['StudentEnrollment']['observation'];
$modelEnrollment->create_date = date('Y-m-d');
$modelEnrollment->daily_order = $modelEnrollment->getDailyOrder();

Expand Down
7 changes: 7 additions & 0 deletions app/messages/pt_br/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@
'Aee Optical Nonoptical' => 'Ensino de uso de recursos ópticos e não ópticos',
'Observation' => 'Observação',
'daily_order' => 'Ordem no Diário',
'Transfer Date' => 'Data da Transferência',

//Student Declaration
'Student Declaration' => 'Declaração do Aluno',
Expand Down Expand Up @@ -932,5 +933,11 @@
"End of the School Year" => "Fim do Ano Escolar",
// setflas
'dayli order' => 'Ordem do diario alterado com sucesso!',
//food
'create_menu' => 'Criar Cardápio',
'food_menu_description' => 'Nome',
'food_menu_observation' => 'Observação',
'food_menu_start_date' => 'Data inicial',
'food_menu_final_date' => 'Data final',
)
?>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE student_enrollment ADD COLUMN transfer_date DATE NULL;
2 changes: 2 additions & 0 deletions app/models/StudentEnrollment.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
* @property string $observation
* @property integer $daily_order
* @property integer $status
* @property string $transfer_date
*
* The followings are the available model relations:
* @property StudentIdentification $studentFk
Expand Down Expand Up @@ -217,6 +218,7 @@ public function attributeLabels()
'observation' => Yii::t('default', 'Observation'),
'daily_order' => Yii::t('default', 'daily_order'),
'school-identifications' => Yii::t('default', 'School Identifications'),
'transfer_date' => Yii::t('default', 'Transfer Date'),

);
}
Expand Down
30 changes: 30 additions & 0 deletions app/modules/food/FoodModule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

class FoodModule extends CWebModule
{
public function init()
{
// this method is called when the module is being created
// you may place code here to customize the module or the application

// import the module-level models and components
$this->setImport(array(
'food.models.*',
'food.components.*',
));
}

public function beforeControllerAction($controller, $action)
{
$controller->layout = 'webroot.themes.default.views.layouts.fullmenu';

if(parent::beforeControllerAction($controller, $action))
{
// this method is called before any module controller action is performed
// you may place customized code here
return true;
}
else
return false;
}
}
174 changes: 174 additions & 0 deletions app/modules/food/controllers/DefaultController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
<?php

class DefaultController extends Controller
{

/**
* @var string the default layout for the views. Defaults to '//layouts/column2', meaning
* using two-column layout. See 'protected/views/layouts/column2.php'.
*/
public $layout='//layouts/column2';

/**
* @return array action filters
*/
public function filters()
{
return array(
'accessControl', // perform access control for CRUD operations
'postOnly + delete', // we only allow deletion via POST request
);
}

/**
* Specifies the access control rules.
* This method is used by the 'accessControl' filter.
* @return array access control rules
*/
public function accessRules()
{
return array(
array('allow', // allow all users to perform 'index' and 'view' actions
'actions'=>array('index','view'),
'users'=>array('*'),
),
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions'=>array('create','update'),
'users'=>array('@'),
),
array('allow', // allow admin user to perform 'admin' and 'delete' actions
'actions'=>array('admin','delete'),
'users'=>array('admin'),
),
array('deny', // deny all users
'users'=>array('*'),
),
);
}

/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionView($id)
{
$this->render('view',array(
'model'=>$this->loadModel($id),
));
}

/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model=new FoodMenu;

// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);

if(isset($_POST['FoodMenu']))
{
$model->attributes=$_POST['FoodMenu'];
if($model->save())
$this->redirect(array('view','id'=>$model->id));
}

$this->render('create',array(
'model'=>$model,
));
}

/**
* Updates a particular model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id the ID of the model to be updated
*/
public function actionUpdate($id)
{
$model=$this->loadModel($id);

// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);

if(isset($_POST['FoodMenu']))
{
$model->attributes=$_POST['FoodMenu'];
if($model->save())
$this->redirect(array('view','id'=>$model->id));
}

$this->render('update',array(
'model'=>$model,
));
}

/**
* Deletes a particular model.
* If deletion is successful, the browser will be redirected to the 'admin' page.
* @param integer $id the ID of the model to be deleted
*/
public function actionDelete($id)
{
$this->loadModel($id)->delete();

// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
if(!isset($_GET['ajax']))
$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
Fixed Show fixed Hide fixed
}

/**
* Lists all models.
*/
public function actionIndex()
{
$dataProvider=new CActiveDataProvider('FoodMenu');
$this->render('index',array(
'dataProvider'=>$dataProvider,
));
}

/**
* Manages all models.
*/
public function actionAdmin()
{
$model=new FoodMenu('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['FoodMenu']))
$model->attributes=$_GET['FoodMenu'];

$this->render('admin',array(
'model'=>$model,
));
}

/**
* Returns the data model based on the primary key given in the GET variable.
* If the data model is not found, an HTTP exception will be raised.
* @param integer $id the ID of the model to be loaded
* @return FoodMenu the loaded model
* @throws CHttpException
*/
public function loadModel($id)
{
$model=FoodMenu::model()->findByPk($id);
if($model===null)
throw new CHttpException(404,'The requested page does not exist.');
return $model;
}

/**
* Performs the AJAX validation.
* @param FoodMenu $model the model to be validated
*/
protected function performAjaxValidation($model)
{
if(isset($_POST['ajax']) && $_POST['ajax']==='food-menu-form')
{
echo CActiveForm::validate($model);
Yii::app()->end();
}
}
}
Loading