コード例 #1
0
 /**
  * Display data
  */
 protected function setDataToCode()
 {
     $this->Code .= '<table class="fullwidth zebra-style">';
     $this->Code .= '<thead><tr>';
     $this->Code .= '<th></th>';
     $this->Code .= '<th>' . __('Distance') . '</th>';
     $this->Code .= '<th>' . __('Time') . '</th>';
     $this->Code .= '<th>' . __('Swolf') . '</th>';
     $this->Code .= '<th>' . __('Strokes') . '</th>';
     $this->Code .= '<th>' . __('Type') . '</th>';
     $this->Code .= '</tr></thead>';
     $this->Code .= '<tbody>';
     $Loop = new Swimdata\Loop($this->Context->swimdata());
     $TrackLoop = new Trackdata\Loop($this->Context->trackdata());
     $Stroketype = new Stroketype(Stroketype::FREESTYLE);
     $Distance = new Distance(0);
     $max = $Loop->num();
     for ($i = 1; $i <= $max; ++$i) {
         $Stroketype->set($Loop->stroketype());
         $Distance->set($TrackLoop->distance());
         $this->Code .= '<tr class="r">';
         $this->Code .= '<td>' . $i . '.</td>';
         $this->Code .= '<td>' . $Distance->stringMeter() . '</td>';
         $this->Code .= '<td>' . Duration::format($TrackLoop->difference(Trackdata\Object::TIME)) . '</td>';
         $this->Code .= '<td>' . $Loop->swolf() . '</td>';
         $this->Code .= '<td>' . $Loop->stroke() . '</td>';
         $this->Code .= '<td>' . $Stroketype->shortstring() . '</td>';
         $this->Code .= '</tr>';
         $TrackLoop->nextStep();
         $Loop->nextStep();
     }
     $this->Code .= '</tbody>';
     $this->Code .= '</table>';
 }
コード例 #2
0
ファイル: Entity.php プロジェクト: rob-st/Runalyze
 public function fillSwolfArray(Trackdata\Entity &$trackdata)
 {
     if ($this->stroke() && $trackdata->has(Trackdata\Entity::TIME)) {
         $TrackLoop = new Trackdata\Loop($trackdata);
         $Loop = new Loop($this);
         $max = $Loop->num();
         $swolf = array();
         $swolfcycles = array();
         for ($i = 1; $i <= $max; ++$i) {
             $duration = $TrackLoop->difference(Trackdata\Entity::TIME);
             $swolf[] = $duration + $Loop->stroke();
             $swolfcycles[] = $duration + $Loop->stroke() / 2;
             $Loop->nextStep();
             $TrackLoop->nextStep();
         }
         $this->set(Entity::SWOLF, $swolf);
         $this->set(Entity::SWOLFCYCLES, $swolfcycles);
     }
 }