/**
  * Construct new input field for: weather
  * @param string $name
  * @param string $label
  * @param string $value optional, default: loading from $_POST
  */
 public function __construct($name, $label, $value = '')
 {
     parent::__construct($name, $label, $value);
     foreach (ClothesFactory::OrderedClothes() as $data) {
         $this->addCheckbox($data['id'], $data['short']);
     }
     $this->setParser(FormularValueParser::$PARSER_ARRAY_CHECKBOXES);
 }
Exemplo n.º 2
0
 /**
  * Get search links for all given clothes
  * @return string
  */
 public function asLinks()
 {
     $links = array();
     foreach ($this->ids as $id) {
         $links[] = ClothesFactory::getSearchLinkForSingleClothes($id);
     }
     return implode(', ', $links);
 }
Exemplo n.º 3
0
 /**
  * Init all clothes
  */
 private static function initAllClothes()
 {
     self::$AllClothes = array();
     $clothes = self::cacheAllClothes();
     foreach ($clothes as $data) {
         self::$AllClothes[$data['id']] = $data;
     }
 }
 /**
  * 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();
 }
Exemplo n.º 5
0
 /**
  * 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();
 }