Ejemplo n.º 1
0
 public static function sqlGetAllItems($using_pages = false, $current_page = '1', $items_on_page = '5', $controller_search = '')
 {
     if ($sql = parent::sqlGetAllItems($using_pages, $current_page, $items_on_page, $controller_search)) {
         // ladowanie centrow szkolen
         $training_centers = ClassTrainingCenter::sqlGetAllActiveItems(false);
         foreach ($sql as $key => $val) {
             // nazwa centrum szkolenia
             $sql[$key]['training_center_name'] = $training_centers[$val['id_training_centre']]['name'] . ', ' . $training_centers[$val['id_training_centre']]['location'];
             // nazwa lub data zakonczenia misji
             $sql[$key]['date_end_name'] = self::getDateEndNameByDateEnd($val['date_end'], true);
             // data rozpoczecia misji
             $sql[$key]['date_start_name'] = self::getPlDate($val['date_start']);
             // nazwa statusu
             // $sql[$key]['status'] = self::getStatusName($val['date_end'], $val['active']);
             $sql[$key]['status'] = self::getStatusTraining($val['date_start'], $val['date_end']);
         }
     }
     return $sql;
 }
Ejemplo n.º 2
0
 protected function edit()
 {
     // ladowanie klasy
     $item = new ClassTrainingCenter(ClassTools::getValue('id_training_centre'));
     // sprawdza czy klasa zostala poprawnie zaladowana
     if (!$item->load_class) {
         $this->alerts['danger'] = "Centrum szkolenia nie istnieje.";
         return;
     }
     $active = ClassTools::getValue('form_active');
     $item->name = ClassTools::getValue('form_name');
     $item->location = ClassTools::getValue('form_location');
     $item->id_user = ClassAuth::getCurrentUserId();
     $item->active = $active && $active == '1' ? '1' : '0';
     // komunikaty bledu
     if (!$item->update()) {
         $this->alerts['danger'] = $item->errors;
         return;
     }
     // komunikat
     $this->alerts['success'] = "Poprawnie zaktualizowano centrum szkolenia: <b>{$item->name}</b>";
     // czyszczeie zmiennych wyswietlania
     $this->tpl_values = '';
     $_POST = array();
     return;
 }
Ejemplo n.º 3
0
 protected function getSearchDefinition()
 {
     $training_centers = ClassTrainingCenter::sqlGetAllActiveItems();
     $form_training_centers = array();
     foreach ($training_centers as $key => $training_center) {
         $form_training_centers[$key] = $training_center['name'] . ', ' . $training_center['location'];
     }
     $form_values = array('class' => 'ClassTraining', 'controller' => $this->search_controller, 'form' => array('id_training' => array('class' => 'table_id', 'type' => 'text'), 'code' => array('class' => 'table_code', 'type' => 'text'), 'name' => array('class' => 'table_name', 'type' => 'text'), 'id_training_centre' => array('class' => 'table_traning_center', 'type' => 'select', 'search' => true, 'options' => $form_training_centers), 'date_start' => array('class' => 'table_date_start'), 'date_end' => array('class' => 'table_date_end'), 'status' => array('class' => 'table_status'), 'actions' => array('class' => 'table_akcje')));
     return $form_values;
 }