當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Configuration::General方法代碼示例

本文整理匯總了PHP中Runalyze\Configuration::General方法的典型用法代碼示例。如果您正苦於以下問題:PHP Configuration::General方法的具體用法?PHP Configuration::General怎麽用?PHP Configuration::General使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Runalyze\Configuration的用法示例。


在下文中一共展示了Configuration::General方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testStaticMethod

 public function testStaticMethod()
 {
     Configuration::General()->temperatureUnit()->set(TemperatureUnit::CELSIUS);
     $unit = ' ' . Configuration::General()->TemperatureUnit()->unit();
     $this->assertEquals('10.0' . $unit, Temperature::format(10, true, 1));
     $this->assertEquals('12.35' . $unit, Temperature::format(12.3456, true, 2));
 }
開發者ID:Nugman,項目名稱:Runalyze,代碼行數:7,代碼來源:TemperatureTest.php

示例2: addTo

 /**
  * Add to plot
  * @param \Plot $Plot
  * @param int $yAxis
  * @param boolean $addAnnotations [optional]
  */
 public function addTo(Plot &$Plot, $yAxis, $addAnnotations = true)
 {
     if (empty($this->Data)) {
         return;
     }
     parent::addTo($Plot, $yAxis, $addAnnotations);
     switch ($this->XAxis) {
         case DataCollector::X_AXIS_DISTANCE:
             $Plot->setXUnitFactor(Configuration::General()->distanceUnitSystem()->distanceToPreferredUnitFactor(), Configuration::General()->distanceUnitSystem()->distanceUnit());
             $stepSize = Configuration::General()->distanceUnitSystem()->distanceToKmFactor();
             if ($stepSize != round($stepSize)) {
                 end($this->Data);
                 $totalDistanceInKm = key($this->Data);
                 while ($totalDistanceInKm / $stepSize > 15) {
                     $stepSize *= 2;
                 }
                 while ($totalDistanceInKm / $stepSize < 4) {
                     $stepSize /= 2;
                 }
                 $Plot->Options['xaxis']['tickSize'] = $stepSize;
             }
             break;
         case DataCollector::X_AXIS_TIME:
             $Plot->setXAxisAsTime();
             $Plot->setXAxisTimeFormat("%h:%M:%S");
             $Plot->Options['xaxis']['ticks'] = 5;
             break;
         case DataCollector::X_AXIS_INDEX:
             $Plot->hideXLabels();
     }
 }
開發者ID:rob-st,項目名稱:Runalyze,代碼行數:37,代碼來源:ActivitySeries.php

示例3: parseGeneralValues

 /**
  * Parse general values
  */
 protected function parseGeneralValues()
 {
     $this->TrainingObject->setTimestamp(strtotime((string) $this->XML['StartTime']));
     if (!empty($this->XML['categoryName'])) {
         $this->guessSportID((string) $this->XML['categoryName']);
     } else {
         $this->TrainingObject->setSportid(Configuration::General()->mainSport());
     }
     if (!empty($this->XML->Duration['TotalSeconds'])) {
         $this->TrainingObject->setTimeInSeconds(round((double) $this->XML->Duration['TotalSeconds']));
     }
     if (!empty($this->XML->Distance['TotalMeters'])) {
         $this->TrainingObject->setDistance(round((double) $this->XML->Distance['TotalMeters']) / 1000);
     }
     if (!empty($this->XML->Calories['TotalCal'])) {
         $this->TrainingObject->setCalories((int) $this->XML->Calories['TotalCal']);
     }
     if (!empty($this->XML->Location['Name'])) {
         $this->TrainingObject->setRoute((string) $this->XML->Location['Name']);
     }
     if (!empty($this->XML->Weather['Temp'])) {
         $this->TrainingObject->setTemperature((int) $this->XML->Weather['Temp']);
     }
     if (!empty($this->XML->HeartRateMaximumBPM)) {
         $this->TrainingObject->setPulseMax((int) $this->XML->HeartRateMaximumBPM);
     }
     if (!empty($this->XML->HeartRateAverageBPM)) {
         $this->TrainingObject->setPulseAvg((int) $this->XML->HeartRateAverageBPM);
     }
 }
開發者ID:guancio,項目名稱:Runalyze,代碼行數:33,代碼來源:class.ParserFITLOGSingle.php

示例4: nextDistance

 /**
  * Move Distance
  * @return bool
  */
 public function nextDistance()
 {
     if (Configuration::General()->distanceUnitSystem()->isImperial()) {
         return $this->nextMile();
     }
     return $this->nextKilometer();
 }
開發者ID:rob-st,項目名稱:Runalyze,代碼行數:11,代碼來源:Loop.php

示例5: Athlete

 /**
  * Athlete
  * @return \Runalyze\Athlete
  */
 public static function Athlete()
 {
     if (!isset(self::$Objects['athlete'])) {
         self::$Objects['athlete'] = new Athlete(Configuration::General()->gender(), Configuration::Data()->HRmax(), Configuration::Data()->HRrest(), null, null, Configuration::Data()->vdot());
     }
     return self::$Objects['athlete'];
 }
開發者ID:guancio,項目名稱:Runalyze,代碼行數:11,代碼來源:Context.php

示例6: parseGeneralValues

 /**
  * Parse general values
  */
 protected function parseGeneralValues()
 {
     $this->TrainingObject->setTimestamp(strtotime((string) $this->XML->GeneralInformation->startDate));
     $this->TrainingObject->setCalories((int) $this->XML->GeneralInformation->calories);
     $this->TrainingObject->setSportid(Configuration::General()->mainSport());
     $this->TrainingObject->setCreatorDetails($this->findCreator());
     $this->TrainingObject->setComment((string) $this->XML->GeneralInformation->name);
 }
開發者ID:guancio,項目名稱:Runalyze,代碼行數:11,代碼來源:class.ParserSLF4Single.php

示例7: prepare

 /**
  * Prepare summary
  */
 protected function prepare()
 {
     $this->Title = __('All years');
     $this->Timerange = 366 * DAY_IN_S;
     $this->TimeEnd = mktime(23, 59, 59, 12, 31, date('Y'));
     $this->TimeStart = mktime(0, 0, 1, 1, 1, date('Y', START_TIME));
     $this->AdditionalColumns = 1 * ($this->Sportid == Configuration::General()->runningSport());
 }
開發者ID:guancio,項目名稱:Runalyze,代碼行數:11,代碼來源:class.SummaryTableAllYears.php

示例8: testStaticMethod

 public function testStaticMethod()
 {
     Configuration::General()->weightUnit()->set(WeightUnit::KG);
     $unit = '&nbsp;' . Configuration::General()->weightUnit()->unit();
     $this->assertEquals('10.0' . $unit, Weight::format(10, true, 1));
     $this->assertEquals('12.346' . $unit, Weight::format(12.3456, true, 3));
     $this->assertEquals('12.3', Weight::format(12.3456, false, 1));
 }
開發者ID:9x,項目名稱:Runalyze,代碼行數:8,代碼來源:WeightTest.php

示例9: parseGeneralValues

 /**
  * Parse general values
  */
 protected function parseGeneralValues()
 {
     $this->TrainingObject->setTimestamp(strtotime((string) $this->XML->DeviceLog->Header->DateTime));
     if (!empty($this->XML->DeviceLog->Header->Activity)) {
         $this->guessSportID((string) $this->XML->DeviceLog->Header->Activity);
     } else {
         $this->TrainingObject->setSportid(Configuration::General()->runningSport());
     }
 }
開發者ID:guancio,項目名稱:Runalyze,代碼行數:12,代碼來源:class.ParserSMLsuuntoSingle.php

示例10: __construct

 /**
  * Create series
  * @var \Runalyze\View\Activity\Context $context
  */
 public function __construct(Activity\Context $context)
 {
     $this->isRunning = $context->activity()->sportid() == Configuration::General()->runningSport();
     $cadence = $this->isRunning ? new CadenceUnitRunning(0) : new CadenceUnit(0);
     $this->initOptions();
     $this->initData($context->trackdata(), Trackdata::CADENCE);
     $this->initStrings($cadence);
     $this->manipulateData($cadence);
 }
開發者ID:n0rthface,項目名稱:Runalyze,代碼行數:13,代碼來源:Cadence.php

示例11: manipulateData

 /**
  * Manipulate data
  */
 protected function manipulateData()
 {
     $UnitSystem = Configuration::General()->distanceUnitSystem();
     if ($UnitSystem->isImperial()) {
         $this->Data = array_map(function ($value) {
             return $value * DistanceUnitSystem::FEET_MULTIPLIER / 1000 / 100;
         }, $this->Data);
     }
 }
開發者ID:9x,項目名稱:Runalyze,代碼行數:12,代碼來源:StrideLength.php

示例12: __construct

 /**
  * Constructor
  * @param \Runalyze\View\Activity\Context $Context
  */
 public function __construct(\Runalyze\View\Activity\Context $Context)
 {
     if ($Context->hasRoute()) {
         $upDown = '+' . ElevationBase::format($Context->route()->elevationUp(), false) . '/-' . ElevationBase::format($Context->route()->elevationDown(), false);
     } else {
         $upDown = '+' . ElevationBase::format($Context->activity()->elevation(), false) . '/-' . ElevationBase::format($Context->activity()->elevation(), false);
     }
     parent::__construct($upDown, Configuration::General()->distanceUnitSystem()->elevationUnit(), __('Elevation up/down'));
 }
開發者ID:guancio,項目名稱:Runalyze,代碼行數:13,代碼來源:ElevationUpDown.php

示例13: __construct

 /**
  * Create series
  * @var \Runalyze\View\Activity\Context $context
  */
 public function __construct(Activity\Context $context)
 {
     $this->paceUnit = $context->sport()->paceUnit();
     $this->paceInTime = $this->paceUnit == \Runalyze\Activity\Pace::MIN_PER_KM || $this->paceUnit == \Runalyze\Activity\Pace::MIN_PER_100M || $this->paceUnit == \Runalyze\Activity\Pace::MIN_PER_500M;
     $this->isRunning = $context->sport()->id() == Configuration::General()->runningSport();
     $this->initOptions();
     $this->initData($context->trackdata(), Trackdata::PACE);
     $this->manipulateData();
 }
開發者ID:n0rthface,項目名稱:Runalyze,代碼行數:13,代碼來源:Pace.php

示例14: __construct

 /**
  * Create series
  * @var \Runalyze\View\Activity\Context $context
  */
 public function __construct(Activity\Context $context)
 {
     $this->paceUnit = $context->sport()->paceUnit();
     $this->paceUnitEnum = $context->sport()->paceUnitEnum();
     $this->isRunning = $context->sport()->id() == Configuration::General()->runningSport();
     $this->initOptions();
     $this->initData($context->trackdata(), Trackdata::PACE);
     $this->manipulateData();
 }
開發者ID:guancio,項目名稱:Runalyze,代碼行數:13,代碼來源:Pace.php

示例15: testWeekstartAndWeekendForSundayBug

 public function testWeekstartAndWeekendForSundayBug()
 {
     Configuration::General()->weekStart()->set(WeekStart::SUNDAY);
     $today = mktime(0, 0, 0, 10, 25, 2015);
     $end = mktime(23, 59, 50, 10, 31, 2015);
     $this->assertEquals($today, Time::weekstart($today));
     $this->assertEquals($today, Time::weekstart($end));
     $this->assertEquals($end, Time::weekend($today));
     $this->assertEquals($end, Time::weekend($end));
 }
開發者ID:Nugman,項目名稱:Runalyze,代碼行數:10,代碼來源:TimeTest.php


注:本文中的Runalyze\Configuration::General方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。