示例#1
0
    /**
     * Set data to compare training and competition
     */
    private function setDataForTypes()
    {
        $emptyData = array_fill(0, $this->timerEnd - $this->timerStart + 1, 0);
        $Types = array(array('name' => 'ohne', 'data' => $emptyData));
        $TypesData = DB::getInstance()->query('
			SELECT
				id, name
			FROM
				`' . PREFIX . 'type`
			WHERE
				`sportid`="' . $this->Sport->id() . '"
		')->fetchAll();
        foreach ($TypesData as $Type) {
            $Types[$Type['id']] = array('name' => $Type['name'], 'data' => $emptyData);
        }
        foreach ($this->RawData as $dat) {
            if ($dat['timer'] >= $this->timerStart && $dat['timer'] <= $this->timerEnd) {
                $Types[$dat['typeid']]['data'][$dat['timer'] - $this->timerStart] = $dat['sum'];
            }
        }
        foreach ($Types as $Type) {
            $this->Data[] = array('label' => $Type['name'], 'data' => $Type['data']);
        }
    }