本文整理汇总了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;
}
示例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;
}
示例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');
}
}
示例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>';
}
示例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));
}
示例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);
}
示例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>
示例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>';
}
}
示例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);
}
示例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>';
}
示例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);
}
示例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);
}
示例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();
}
}