示例#1
0
 /**
  *
  * @return array
  */
 public function getDataClassIndmo()
 {
     $dbStudentClassSent = App_Model_DbTable_Factory::get('StudentClass_Sent');
     $rows = $dbStudentClassSent->fetchAll(array('sent = ?' => 0));
     $mapperStudentClass = new StudentClass_Model_Mapper_StudentClass();
     $mapperScholarity = new Register_Model_Mapper_PerScholarity();
     $classes = array();
     foreach ($rows as $row) {
         $class = $mapperStudentClass->detailStudentClass($row->fk_id_fefpstudentclass);
         $course = $mapperScholarity->fetchRow($class->fk_id_perscholarity);
         $dataClass = array('id' => $class->id_fefpstudentclass, 'title' => $class->class_name, 'start_date' => $class->start_date, 'finish_date' => $class->schedule_finish_date, 'qualification' => $course->remote_id, 'training_provider' => $class->num_register, 'id_training_provider' => $class->fk_id_fefpeduinstitution);
         $students = $mapperStudentClass->listClientClass($row->fk_id_fefpstudentclass);
         $studentsClass = array();
         foreach ($students as $student) {
             $dataStudent = array('id' => $student->id_perdata, 'first_name' => $student->first_name, 'second_name' => $student->medium_name, 'evidence' => Client_Model_Mapper_Client::buildNumRow($student), 'last_name' => $student->last_name, 'district' => $student->num_district, 'sub_district' => $student->num_subdistrict, 'birth_date' => $student->birth_date, 'gender' => $student->gender, 'email' => $student->email, 'tel' => $student->client_fone, 'result' => $student->status_class, 'competencies' => array());
             $competencies = $mapperStudentClass->listCompetencyClass($row->fk_id_fefpstudentclass, $student->id_perdata);
             foreach ($competencies as $competency) {
                 $dataStudent['competencies'][] = array('id' => $competency->id_external, 'code' => $competency->external_code, 'result' => $competency->status);
             }
             $studentsClass[] = $dataStudent;
         }
         $dataClass['students'] = $studentsClass;
         $classes[] = $dataClass;
     }
     return $classes;
 }
示例#2
0
 /**
  * 
  */
 public function calcUnitCostAction()
 {
     $cost = App_General_String::toFloat($this->_getParam('cost'));
     $idClass = $this->_getParam('id_class');
     $mapperStudentClass = new StudentClass_Model_Mapper_StudentClass();
     $clients = $mapperStudentClass->listClientClass($idClass);
     $data = array('total' => 0, 'costs' => array(), 'man' => 0, 'woman' => 0);
     if ($clients->count()) {
         foreach ($clients as $client) {
             $value = $cost;
             if (!empty($client->id_handicapped)) {
                 $value = $value * 1.25;
             }
             $data['costs'][$client->id_perdata] = number_format($value, 2, '.', ',');
             $data['total'] += $value;
             if ('MANE' == $client->gender) {
                 $data['man']++;
             } else {
                 $data['woman']++;
             }
         }
         $womanPercentage = floor($data['woman'] * 100 / $clients->count());
         if ($womanPercentage >= 40 && $womanPercentage <= 70) {
             $data['total'] = $data['total'] * 1.1;
         }
     }
     $data['total'] = number_format($data['total'], 2, '.', ',');
     $this->_helper->json($data);
 }