/**
  * Get input fields for splits
  * @return string
  */
 protected function getInputs()
 {
     $Splits = new Splits(Splits::$FROM_POST);
     $Inputs = '<ol class="splits">';
     foreach ($Splits->asArray() as $split) {
         $Inputs .= $this->getInnerDivForSplit($split);
     }
     $Inputs .= '</ol>';
     $Inputs .= '<p id="addSplitsLink"><span class="link add-split">' . __('add new lap') . '</span></p>';
     $Inputs .= '<p><span class="link round-splits">' . __('round for 100m') . '</span></p>';
     $Inputs .= '<p><span class="link sum-splits">' . __('apply as total distance') . '</span></p>';
     $Inputs .= '<p><span class="link active-splits">' . __('all active') . '</span> - <span class="link rest-splits">' . __('all resting') . '</span></p>';
     $Inputs .= '<p>' . __('alternating:') . ' <span class="link alternate-splits-rest">' . __('first resting') . '</span>';
     $Inputs .= ' - <span class="link alternate-splits-active">' . __('first active') . '</span></p>';
     $Inputs .= '<textarea id="defaultInputSplit" class="hide">' . HTML::textareaTransform($this->getInnerDivForSplit()) . '</textarea>';
     return $Inputs;
 }
 /**
  * Parse: splits string => splits array
  * @param string $value
  */
 protected static function parseSplits(&$value)
 {
     $Splits = new Splits($value);
     $value = $Splits->asArray();
 }
 /**
  * Parse: splits string => splits array
  * @param string $value
  * @param array $options
  */
 private static function parseSplits(&$value, $options)
 {
     $Splits = new Splits($value, $options);
     $value = $Splits->asArray();
 }
예제 #4
0
 public function testCompletingSplits()
 {
     $Splits = new Splits();
     $Splits->addSplit(1, 300);
     $Splits->addSplit(1, 300);
     $Splits->addSplit(1, 300);
     $Splits->addLastSplitToComplete(4.5, 1350);
     $asArray1 = $Splits->asArray();
     $this->assertEquals(4, count($asArray1));
     $this->assertEquals(1.5, $asArray1[3]['km']);
     $this->assertEquals('7:30', $asArray1[3]['time']);
     $Splits->addLastSplitToComplete(5, 1500);
     $asArray2 = $Splits->asArray();
     $this->assertEquals(5, count($asArray2));
     $this->assertEquals(0.5, $asArray2[4]['km']);
     $this->assertEquals('2:30', $asArray2[4]['time']);
     $Splits->addLastSplitToComplete(4, 1200);
     $asArray3 = $Splits->asArray();
     $this->assertEquals(5, count($asArray3));
 }