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) { // Nazwa statusu $sql[$key]['active_name'] = ClassUser::getNameStatus($val['active']); } } return $sql; }
public function load() { parent::load(); if ($this->load_class) { // $this->mission_type_name = self::sqlGetTypeNameId($this->id_mission_type); $this->mission_type_name = ClassMissionType::sqlGetItemNameByIdParent($this->id_mission_type); $this->date_end_name = self::getDateEndNameByDateEnd($this->date_end); // $this->status = self::getStatusName($this->date_end, $this->active); $this->status = self::getStatusMission($this->date_start, $this->date_end); $this->date_end_name_pl = self::getDateEndNameByDateEnd($this->date_end, true); $this->date_start_pl = date('d.m.Y H:i', strtotime($this->date_start)); $this->active_name = ClassUser::getNameStatus($this->active); } }
public function load() { parent::load(); if ($this->load_class) { $item = new ClassTrainingCenter($this->id_training_centre); if (!$item->load_class) { $this->training_center_name = 'Centrum szkolenia nie istnieje'; } else { $this->training_center_name = $item->name . ', ' . $item->location; } // data rozpoczecia misji $this->date_start_name = self::getPlDate($this->date_start); // nazwa lub data zakonczenia misji $this->date_end_name = self::getDateEndNameByDateEnd($this->date_end, true); // nazwa statusu // $this->status = self::getStatusName($this->date_end, $this->active); $this->status = self::getStatusTraining($this->date_start, $this->date_end); $this->active_name = ClassUser::getNameStatus($this->active); } }
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) { // Rodzaj jednostki nazwa $sql[$key]['equipment_type_name'] = ClassEquipmentType::sqlGetItemNameByIdParent($val['id_equipment_type']); // Nazwa statusu $sql[$key]['active_name'] = ClassUser::getNameStatus($val['active']); } } return $sql; }
public static function sqlGetAllItemsById($id_page, $without_id = false, $active = false, $using_pages = false, $current_page = '1', $items_on_page = '5', $controller_search = '') { global $DB; $table_name = (static::$use_prefix ? static::$prefix : '') . static::$definition['table']; $id = static::$definition['primary']; $where = ''; $limit = ''; if ($id_page === NULL) { $id_page = 'IS NULL'; } else { $id_page = "= '{$id_page}'"; } if (static::$has_deleted_column) { $where = " AND `deleted` = '0'"; } if ($active) { $where .= " AND `active` = '1'"; } if ($without_id) { $where .= " AND `{$id}` != '{$without_id}'"; } if (static::$is_search && $controller_search != '' && ($where_search = self::generateWhereList($controller_search))) { $where .= " AND " . $where_search; } if ($using_pages) { $limit_start = ($current_page - 1) * $items_on_page; $limit = " LIMIT {$limit_start}, {$items_on_page}"; } $zapytanie = "SELECT *\n FROM `{$table_name}`\n WHERE `id_parent` {$id_page}\n {$where}\n ORDER BY `{$id}`\n {$limit}\n ;"; $sql = $DB->pdo_fetch_all($zapytanie, true); if (($sql === false || !is_array($sql)) && (static::$is_search && $controller_search != '' && isset($_SESSION['search'][$controller_search]))) { if (static::$is_search && isset($_SESSION['search'][$controller_search])) { $_SESSION['search'][$controller_search] = array(); } } if (!$sql || !is_array($sql) || count($sql) < 1) { return false; } if (!$active) { foreach ($sql as $key => $val) { // Nazwa statusu $sql[$key]['active_name'] = ClassUser::getNameStatus($val['active']); } } return $sql; }