Esempio 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)) {
         foreach ($sql as $key => $val) {
             // $sql[$key]['mission_type_name'] = self::sqlGetTypeNameId($val['id_mission_type']);
             $sql[$key]['mission_type_name'] = ClassMissionType::sqlGetItemNameByIdParent($val['id_mission_type']);
             $sql[$key]['date_end_name'] = self::getDateEndNameByDateEnd($val['date_end']);
             // $sql[$key]['status'] = self::getStatusName($val['date_end'], $val['active']);
             $sql[$key]['status'] = self::getStatusMission($val['date_start'], $val['date_end']);
         }
     }
     return $sql;
 }
Esempio n. 2
0
 protected function edit()
 {
     // ladowanie klasy
     $item = new ClassMissionType(ClassTools::getValue('id_mission_type'));
     // sprawdza czy klasa zostala poprawnie zaladowana
     if (!$item->load_class) {
         $this->alerts['danger'] = "Rodzaj misji nie istnieje.";
         return;
     }
     $active = ClassTools::getValue('form_active');
     $form_parent = ClassTools::getValue('form_parent');
     $item->name = ClassTools::getValue('form_name');
     $item->id_parent = $form_parent != '' && is_numeric($form_parent) ? $form_parent : NULL;
     $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 rodzaj misji: <b>{$item->name}</b>";
     // czyszczeie zmiennych wyswietlania
     $this->tpl_values = '';
     $_POST = array();
     return;
 }
Esempio n. 3
0
 protected function getSearchDefinition()
 {
     // ladowanie rodzajow misjii
     // $types = ClassMission::getTypes();
     $types = ClassMissionType::getMissionTypes();
     $form_values = array('class' => 'ClassMission', 'controller' => $this->search_controller, 'form' => array('id_mission' => array('class' => 'table_id', 'type' => 'text'), 'name' => array('class' => 'table_name', 'type' => 'text'), 'id_mission_type' => array('class' => 'table_rodzaj', 'type' => 'select', 'optgroup' => $types), 'location' => array('class' => 'table_lokalizacja', 'type' => 'text'), '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;
 }