public function actionGenerate()
 {
     $model = array();
     $year = date('Y');
     $month = date('j');
     if (isset($_POST['period_month'])) {
         $model = new AttendancePresencesRecap();
         $year = $_POST['period_year'];
         $month = $_POST['period_month'];
         $month = $month + 1;
         $period = MyHelper::getPayPeriode($month, $year);
         $month = $month - 1;
         // echo $period['from'].', '.$period['to'];
         $model->unsetAttributes();
         // clear any default values
         $model = $model->searchBy(Yii::app()->user->id, $period);
         $model->pagination = false;
     }
     if (isset($_GET['AttendancePresencesRecap'])) {
         $model->attributes = $_GET['AttendancePresencesRecap'];
     }
     $this->render('generate', array('model' => $model, 'year_val' => $year, 'month' => $month));
     // $model = new GenerateAttendanceForm;
     // if(isset($_POST['GenerateAttendanceForm']))
     // {
     // 	$model->attributes=$_POST['GenerateAttendanceForm'];
     // 	$model->moveDataToRecap();
     // } else {
     // 	$model->periode_type = 'current';
     // }
     // $currentPeriode = MyHelper::getCurrentPayPeriode();
     // if($model->periode_type == 'current')
     // {
     // 	if($model->start_date == '')
     // 		$model->start_date = $currentPeriode['from'];
     // 	if($model->end_date == '')
     // 		$model->end_date = $currentPeriode['to'];
     // }
     // $this->render("generate",array(
     // 	'model' 			=> $model,
     // 	'currentPeriode' 	=> $currentPeriode,
     // ));
 }
 /**
  * Manages all models.
  */
 public function actionIndex()
 {
     $model = array();
     $year = date('Y');
     $month = date('j');
     if (isset($_POST['period_month'])) {
         $model = new AttendancePresencesRecap();
         $year = $_POST['period_year'];
         $month = $_POST['period_month'];
         $month = $month + 1;
         $period = MyHelper::getPayPeriode($month, $year);
         $month = $month - 1;
         // echo $period['from'].', '.$period['to'];
         $model->unsetAttributes();
         // clear any default values
         $model = $model->searchBy(Yii::app()->user->id, $period);
         $model->pagination = false;
     }
     if (isset($_GET['AttendancePresencesRecap'])) {
         $model->attributes = $_GET['AttendancePresencesRecap'];
     }
     $this->render('index', array('model' => $model, 'year_val' => $year, 'month' => $month));
 }