当前位置: 首页>>代码示例>>PHP>>正文


PHP Duration::string方法代码示例

本文整理汇总了PHP中Runalyze\Activity\Duration::string方法的典型用法代码示例。如果您正苦于以下问题:PHP Duration::string方法的具体用法?PHP Duration::string怎么用?PHP Duration::string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Runalyze\Activity\Duration的用法示例。


在下文中一共展示了Duration::string方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: tableFooter

 /**
  * @return string
  */
 protected function tableFooter()
 {
     $Code = '<tbody>';
     $Code .= '<tr class="no-zebra"><td colspan="4" class="r">' . __('Average') . ':</td>';
     $Code .= '<td class="c">' . ($this->AverageTime != null ? $this->AverageTime->string() : '') . '</td>';
     $Code .= '<td></td>';
     $Code .= '<td class="c">' . ($this->AveragePace != null ? $this->AveragePace->valueWithAppendix() : '') . '</td>';
     $Code .= '<td colspan="4"></td>';
     $Code .= '</tr>';
     $Code .= '</tbody>';
     $Code .= '</table>';
     return $Code;
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:16,代码来源:Table.php

示例2: tableFooter

 /**
  * @return string
  */
 protected function tableFooter()
 {
     $Code = '<tbody>';
     $Code .= '<tr class="no-zebra"><td colspan="4" class="r">' . __('Average') . ':</td>';
     $Code .= '<td class="c">' . ($this->AverageTime != null ? $this->AverageTime->string() : '') . '</td>';
     $Code .= $this->DemandedTime->isZero() ? '' : '<td></td>';
     $Code .= '<td class="c">' . ($this->AveragePace != null ? $this->AveragePace->valueWithAppendix() : '') . '</td>';
     $Code .= $this->DemandedPace->isEmpty() ? '' : '<td></td>';
     $Code .= '<td colspan="' . (3 + count($this->AdditionalKeys)) . '"></td>';
     $Code .= '</tr>';
     $Code .= '</tbody>';
     $Code .= '</table>';
     $Code .= $this->checkboxToToggleInactiveSplits();
     return $Code;
 }
开发者ID:guancio,项目名称:Runalyze,代码行数:18,代码来源:Table.php

示例3: parseTimeMinutes

 /**
  * Parse: time in seconds => time-string
  * @param mixed $value 
  */
 protected static function parseTimeMinutes(&$value)
 {
     if ($value == 0) {
         $value = '0:00';
     } else {
         $duration = new Duration($value * 60);
         $value = $duration->string('G:i');
     }
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:13,代码来源:class.FormularValueParser.php

示例4: showPrognosis

    /**
     * Show prognosis for a given distance
     * @param double $distance
     */
    protected function showPrognosis($distance)
    {
        $PB = new PersonalBest($distance);
        $PBTime = $PB->exists() ? Duration::format($PB->seconds()) : '-';
        $Prognosis = new Duration($this->Prognosis->inSeconds($distance));
        $Distance = new Distance($distance);
        $Pace = new Pace($Prognosis->seconds(), $distance, Pace::MIN_PER_KM);
        echo '<p>
				<span class="right">
					' . sprintf(__('<small>from</small> %s <small>to</small> <strong>%s</strong>'), $PBTime, $Prognosis->string(Duration::FORMAT_AUTO, 0)) . '
					<small>(' . $Pace->valueWithAppendix() . ')</small>
				</span>
				<strong>' . $Distance->string(Distance::FORMAT_AUTO, 1) . '</strong>
			</p>';
    }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:19,代码来源:class.RunalyzePluginPanel_Prognose.php

示例5: linkWithSportIcon

 /**
  * Get link with icon as text
  * @return string HTML-link to this training
  */
 public function linkWithSportIcon()
 {
     $Sport = new Sport($this->Activity->sportid());
     $Time = new Duration($this->Activity->duration());
     $tooltip = $Sport->name() . ': ' . $Time->string();
     return $this->link($Sport->Icon($tooltip));
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:11,代码来源:Linker.php

示例6: compareTo

 /**
  * Compare
  * @param \Runalyze\Activity\Duration $other
  * @param boolean $invert [optional] by default, larger is 'better'; set to true to invert that
  * @param boolean $raw [optional]
  * @throws \InvalidArgumentException
  * @return string
  */
 public function compareTo(Duration $other, $invert = false, $raw = false)
 {
     if ($this->seconds() == 0 || $other->seconds() == 0) {
         return '';
     }
     $CompareTime = new Duration(round(abs($this->seconds() - $other->seconds())));
     $isPositive = !$invert ? $this->seconds() > $other->seconds() : $this->seconds() <= $other->seconds();
     return $this->formatComparison($CompareTime->string(), $isPositive, $raw);
 }
开发者ID:guancio,项目名称:Runalyze,代码行数:17,代码来源:Duration.php

示例7: foreach

    ?>
</th>
			<?php 
}
?>
		</tr>
	</thead>
	<tbody>
		<?php 
foreach ($this->Range as $sPer400m) {
    ?>
		<tr>
			<?php 
    foreach ($this->Configuration()->value('pace_distances') as $km) {
        ?>
			<?php 
        $Duration->fromSeconds($km * $sPer400m / 0.4);
        ?>
			<td><?php 
        echo $Duration->string('auto', $km >= 0.4 ? 0 : 1);
        ?>
</td>
			<?php 
    }
    ?>
		</tr>
		<?php 
}
?>
	</tbody>
</table>
开发者ID:n0rthface,项目名称:Runalyze,代码行数:31,代码来源:tpl.PaceTable.php

示例8: showListFor

    /**
     * @param \Runalyze\Model\EquipmentType\Object $EquipmentType
     * @param boolean $inuse
     */
    protected function showListFor(Model\EquipmentType\Object $EquipmentType, &$inuse)
    {
        $max = 0;
        $showDistance = $EquipmentType->hasMaxDistance();
        $hasMaxDuration = $showDistance || $EquipmentType->hasMaxDuration();
        $allEquipment = DB::getInstance()->query('SELECT * FROM `' . PREFIX . 'equipment` WHERE `typeid`="' . $EquipmentType->id() . '" AND `accountid`="' . SessionAccountHandler::getId() . '" ORDER BY ISNULL(`date_end`) DESC, `distance` DESC')->fetchAll();
        foreach ($allEquipment as $data) {
            $Object = new Model\Equipment\Object($data);
            $Distance = new Distance($Object->totalDistance());
            $Duration = new Duration($Object->duration());
            if ($inuse && !$Object->isInUse()) {
                echo '<div id="hiddenequipment" style="display:none;">';
                $inuse = false;
            }
            if ($max == 0) {
                $max = $Object->duration();
            }
            echo '<p style="position:relative;">
				<span class="right">' . ($showDistance ? $Distance->string() : $Duration->string()) . '</span>
				<strong>' . SearchLink::to('equipmentid', $Object->id(), $Object->name()) . '</strong>
				' . $this->getUsageImage($showDistance ? $Object->totalDistance() / $EquipmentType->maxDistance() : $Object->duration() / ($hasMaxDuration ? $EquipmentType->maxDuration() : $max)) . '
			</p>';
        }
        if (empty($allEquipment)) {
            echo HTML::em(__('You don\'t have any equipment'));
        }
        if (!$inuse) {
            echo '</div>';
        }
    }
开发者ID:Nugman,项目名称:Runalyze,代码行数:34,代码来源:class.RunalyzePluginPanel_Equipment.php

示例9: initStundenData

 /**
  * Initialize line-data-array for 'Stunden'
  * @param array $dat
  */
 private function initStundenData($dat)
 {
     if ($dat['s'] > 0) {
         $duration = new Duration($dat['s']);
         $text = $duration->string(Duration::FORMAT_WITH_HOURS);
     } else {
         $text = NBSP;
     }
     $this->StundenData[] = array('i' => $dat['i'], 'text' => $text);
 }
开发者ID:schoch,项目名称:Runalyze,代码行数:14,代码来源:class.RunalyzePluginStat_Statistiken.php

示例10: showPrognosis

    /**
     * Show prognosis for a given distance
     * @param double $distance
     */
    protected function showPrognosis($distance)
    {
        $PB = new PersonalBest($distance);
        $PB->lookupWithDetails();
        $PBTime = $PB->exists() ? Duration::format($PB->seconds()) : '-';
        $PBString = $PB->exists() ? Ajax::trainingLink($PB->activityId(), $PBTime, true) : $PBTime;
        $Prognosis = new Duration($this->Prognosis->inSeconds($distance));
        $Distance = new Distance($distance);
        $Pace = new Pace($Prognosis->seconds(), $distance, SportFactory::getSpeedUnitFor(Configuration::General()->runningSport()));
        echo '<p>
				<span class="right">
					' . sprintf(__('<small>from</small> %s <small>to</small> <strong>%s</strong>'), $PBString, $Prognosis->string(Duration::FORMAT_AUTO, 0)) . '
					<small>(' . $Pace->valueWithAppendix() . ')</small>
				</span>
				<strong>' . $Distance->stringAuto(true, 1) . '</strong>
			</p>';
    }
开发者ID:9x,项目名称:Runalyze,代码行数:21,代码来源:class.RunalyzePluginPanel_Prognose.php

示例11: formatTime

 /**
  * Format time for output
  * @param int $seconds
  * @return string
  */
 protected function formatTime($seconds)
 {
     $Duration = new Duration($seconds);
     return $Duration->string(Duration::FORMAT_WITH_HOURS);
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:10,代码来源:TableRow.php

示例12: linkWithSportIcon

 /**
  * Get link with icon as text
  * @param string $tooltipCssClass optional, e.g. 'atRight'
  * @return string HTML-link to this training
  */
 public function linkWithSportIcon($tooltipCssClass = '')
 {
     $Time = new Duration($this->Activity->duration());
     $Factory = new \Runalyze\Model\Factory(\SessionAccountHandler::getId());
     $Sport = $Factory->sport($this->Activity->sportid());
     $code = $Sport->icon()->code();
     $Tooltip = new \Runalyze\View\Tooltip($Sport->name() . ': ' . $Time->string());
     $Tooltip->setPosition($tooltipCssClass);
     $Tooltip->wrapAround($code);
     return $this->link($code);
 }
开发者ID:guancio,项目名称:Runalyze,代码行数:16,代码来源:Linker.php

示例13: showDataAsBoxedValues

 /**
  * Show boxed values
  * @param array $data
  */
 private function showDataAsBoxedValues($data)
 {
     $Factory = new Factory(SessionAccountHandler::getId());
     foreach ($data as $dat) {
         // TODO: Define the decision (distance or time) somehow in the configuration
         $Sport = $Factory->sport($dat['sportid']);
         $Value = new BoxedValue();
         $Value->setIcon($Sport->icon()->code());
         $Value->setInfo($Sport->name());
         $Value->defineAsFloatingBlock('w50');
         if ($dat['count_distance'] >= $dat['count'] / 2) {
             $Distance = new Distance($dat['distance']);
             $Value->setValue($Distance->string(false, false, false));
             $Value->setUnit($Distance->unit());
         } else {
             $Duration = new Duration($dat['time_in_s']);
             $Value->setValue($Duration->string(Duration::FORMAT_WITH_HOURS));
         }
         $Value->display();
     }
 }
开发者ID:9x,项目名称:Runalyze,代码行数:25,代码来源:class.RunalyzePluginPanel_Sports.php


注:本文中的Runalyze\Activity\Duration::string方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。