/** * Init all clothes */ private static function initAllClothes() { self::$AllClothes = array(); $clothes = self::cacheAllClothes(); foreach ($clothes as $data) { self::$AllClothes[$data['id']] = $data; } }
/** * Get clothes as string * @return string */ public function asString() { $usedClothes = array(); $clothes = ClothesFactory::AllClothes(); foreach ($this->ids as $id) { $id = (int) trim($id); if (isset($clothes[$id])) { $usedClothes[] = $clothes[$id]['name']; } else { Error::getInstance()->addWarning('Asked for unknown clothes-ID: "' . $id . '"'); } } return implode(', ', $usedClothes); }
/** * Parse all post values */ public function parsePostData() { $Clothes = ClothesFactory::AllClothes(); $Clothes[] = array('id' => -1); foreach ($Clothes as $Data) { $id = $Data['id']; $columns = array('name', 'short', 'order'); $values = array($_POST['clothes']['name'][$id], $_POST['clothes']['short'][$id], $_POST['clothes']['order'][$id]); if (isset($_POST['clothes']['delete'][$id])) { DB::getInstance()->deleteByID('clothes', (int) $Data['id']); } elseif ($Data['id'] != -1) { DB::getInstance()->update('clothes', $Data['id'], $columns, $values); } elseif (strlen($_POST['clothes']['name'][$id]) > 2) { DB::getInstance()->insert('clothes', $columns, $values); } } ClothesFactory::reInitAllClothes(); }
/** * Initialize internal data */ private function initData() { $this->sportid = Configuration::General()->mainSport(); if ($this->showsAllYears()) { $this->i = 0; $this->jahr = "Gesamt"; $this->jstart = mktime(0, 0, 0, 1, 1, START_YEAR); $this->jende = time(); } else { $this->i = $this->year; $this->jahr = $this->year; $this->jstart = mktime(0, 0, 0, 1, 1, $this->i); $this->jende = mktime(23, 59, 59, 1, 0, $this->i + 1); } $this->Clothes = ClothesFactory::AllClothes(); }