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


PHP Configuration::ActivityForm方法代码示例

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


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

示例1: before

 /**
  * Tasks before insertion
  */
 protected function before()
 {
     parent::before();
     $Calculator = new Calculator($this->Object);
     if (Configuration::ActivityForm()->correctElevation() && !$this->Object->hasCorrectedElevations()) {
         $Calculator->tryToCorrectElevation();
     }
     $Calculator->calculateElevation();
 }
开发者ID:guancio,项目名称:Runalyze,代码行数:12,代码来源:Inserter.php

示例2: initAllSports

 /**
  * Initialize internal sports-array from database
  */
 private static function initAllSports()
 {
     self::$AllSports = array();
     $sports = self::cacheAllSports();
     foreach ($sports as $sport) {
         self::$AllSports[(string) $sport['id']] = $sport;
     }
     Configuration::ActivityForm()->orderSports()->sort(self::$AllSports);
 }
开发者ID:guancio,项目名称:Runalyze,代码行数:12,代码来源:class.SportFactory.php

示例3: initAllShoes

 /**
  * Initialize internal shoes-array from database
  */
 private static function initAllShoes()
 {
     self::$AllShoes = array();
     $shoes = Cache::get(self::CACHE_KEY);
     if (is_null($shoes)) {
         $shoes = DB::getInstance()->query('SELECT * FROM `' . PREFIX . 'shoe` WHERE accountid = ' . SessionAccountHandler::getId())->fetchAll();
         Cache::set(self::CACHE_KEY, $shoes, '3600');
     }
     foreach ($shoes as $shoe) {
         self::$AllShoes[(string) $shoe['id']] = $shoe;
     }
     Configuration::ActivityForm()->orderShoes()->sort(self::$AllShoes);
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:16,代码来源:class.ShoeFactory.php

示例4: initAllTypes

 /**
  * Init all types
  * 
  * IDs will be set as string as indices for correct order
  */
 private static function initAllTypes()
 {
     self::$AllTypes = array();
     $types = Cache::get('types');
     if (is_null($types)) {
         $types = DB::getInstance()->query('SELECT * FROM `' . PREFIX . 'type` WHERE `accountid` = ' . SessionAccountHandler::getId())->fetchAll();
         Cache::set('types', $types, '3600');
     }
     foreach ($types as $data) {
         self::$AllTypes[(string) $data['id']] = $data;
     }
     Configuration::ActivityForm()->orderTypes()->sort(self::$AllTypes);
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:18,代码来源:class.TypeFactory.php

示例5: before

 /**
  * Tasks before insertion
  */
 protected function before()
 {
     parent::before();
     $Calculator = new Calculator($this->Object);
     if (Configuration::ActivityForm()->correctElevation() && !$this->Object->hasCorrectedElevations()) {
         try {
             $Calculator->tryToCorrectElevation();
         } catch (NoValidStrategyException $e) {
             // Well, obviously that did not work. Probably all API limits have been reached.
         }
     }
     $Calculator->calculateElevation();
 }
开发者ID:aschix,项目名称:Runalyze,代码行数:16,代码来源:Inserter.php

示例6: initTabs

 /**
  * Init tabs
  */
 private function initTabs()
 {
     $this->Tabs['upload'] = new ImporterWindowTabUpload();
     $this->Tabs['garmin'] = new ImporterWindowTabCommunicator();
     $this->Tabs['formular'] = new ImporterWindowTabFormular($this->TrainingObjects);
     if (isset($_GET['date'])) {
         $this->Tabs['formular']->setVisible();
     } elseif (empty($this->TrainingObjects) && Configuration::ActivityForm()->creationMode()->usesUpload()) {
         $this->Tabs['upload']->setVisible();
     } elseif (empty($this->TrainingObjects) && Configuration::ActivityForm()->creationMode()->usesGarminCommunicator()) {
         $this->Tabs['garmin']->setVisible();
     } else {
         $this->Tabs['formular']->setVisible();
     }
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:18,代码来源:class.ImporterWindow.php

示例7: addInfoLink

 /**
  * Add info link
  */
 protected function addInfoLink()
 {
     if (!Request::isOnSharedPage()) {
         $Linker = new Linker($this->Context->activity());
         $InfoLink = Ajax::window('<a href="' . $Linker->urlToElevationInfo() . '">' . __('More about elevation') . '</a>', 'normal');
         $this->Footer = HTML::info($InfoLink);
     } else {
         $this->Footer = '';
     }
     if ($this->Context->route()->hasCorrectedElevations()) {
         $this->Footer .= HTML::info(__('Elevation data were corrected.'));
     } elseif ($this->Context->route()->hasOriginalElevations() && Configuration::ActivityForm()->correctElevation()) {
         $this->Footer .= HTML::warning(__('Elevation data are not corrected.'));
     }
     // TODO: Add link to correct them now!
 }
开发者ID:guancio,项目名称:Runalyze,代码行数:19,代码来源:class.SectionRouteRowElevation.php

示例8: setWeatherForecast

 /**
  * Set weather forecast
  */
 public function setWeatherForecast()
 {
     if ($this->trainingIsTooOldToFetchWeatherData() || !Configuration::ActivityForm()->loadWeather()) {
         return;
     }
     $Strategy = new \Runalyze\Data\Weather\Openweathermap();
     $Location = new \Runalyze\Data\Weather\Location();
     $Location->setTimestamp($this->getTimestamp());
     $Location->setLocationName(Configuration::ActivityForm()->weatherLocation());
     if ($this->hasPositionData()) {
         $Location->setPosition($this->getFirstArrayPoint('arr_lat'), $this->getFirstArrayPoint('arr_lon'));
     }
     $Forecast = new \Runalyze\Data\Weather\Forecast($Strategy, $Location);
     $Weather = $Forecast->object();
     $Weather->temperature()->toCelsius();
     $this->set('weatherid', $Weather->condition()->id());
     $this->set('temperature', $Weather->temperature()->value());
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:21,代码来源:class.TrainingObject.php

示例9: allCategories

 /**
  * All categories
  * @return ConfigurationCategory[]
  */
 private function allCategories()
 {
     return array(Configuration::General(), Configuration::Privacy(), Configuration::ActivityView(), Configuration::ActivityForm(), Configuration::Design(), Configuration::DataBrowser(), Configuration::Vdot(), Configuration::Trimp(), Configuration::BasicEndurance(), Configuration::Misc());
 }
开发者ID:guancio,项目名称:Runalyze,代码行数:8,代码来源:class.ConfigTabGeneral.php

示例10: setTemperatureFromArray

 /**
  * Set average temperature from array
  */
 private function setTemperatureFromArray()
 {
     if (!Configuration::ActivityForm()->loadWeather()) {
         $array = $this->TrainingObject->getArrayTemperature();
         if (!empty($array) && (min($array) != max($array) || min($array) != 0)) {
             $this->TrainingObject->setTemperature(round(array_sum($array) / count($array)));
         }
     }
 }
开发者ID:rob-st,项目名称:Runalyze,代码行数:12,代码来源:class.ParserAbstractSingle.php

示例11: parseTrackpoint

 /**
  * Parse one trackpoint
  * @param SimpleXMLElement $TP
  */
 protected function parseTrackpoint(&$TP)
 {
     if ($this->distancesAreEmpty) {
         $TP->addChild('DistanceMeters', 1000 * $this->distanceToTrackpoint($TP));
     }
     //else if ((float)$TP->DistanceMeters < $this->gps['km'])
     //	$TP->DistanceMeters = 1000*$this->distanceToTrackpoint($TP);
     $ThisBreakInMeter = (double) $TP->DistanceMeters - $this->lastDistance;
     $ThisBreakInSeconds = strtotime((string) $TP->Time) - $this->TrainingObject->getTimestamp() - end($this->gps['time_in_s']) - $this->PauseInSeconds;
     if (Configuration::ActivityForm()->detectPauses()) {
         $NoMove = $this->lastDistance == (double) $TP->DistanceMeters && !$this->isWithoutDistance;
         $TooSlow = !$this->lastPointWasEmpty && $ThisBreakInMeter > 0 && $ThisBreakInSeconds / $ThisBreakInMeter > 6;
     } else {
         $NoMove = $TooSlow = false;
     }
     if (empty($TP->DistanceMeters) && !$this->isWithoutDistance || $NoMove || $TooSlow) {
         $Ignored = false;
         if (count($TP->children()) == 1 || $NoMove || $TooSlow) {
             if ($NoMove && $ThisBreakInSeconds <= self::$IGNORE_NO_MOVE_UNTIL) {
                 $Ignored = true;
             } else {
                 $this->PauseInSeconds += $ThisBreakInSeconds;
                 $this->wasPause = true;
                 $this->pauseDuration += $ThisBreakInSeconds;
             }
             if (self::$DEBUG_SPLITS) {
                 Error::getInstance()->addDebug('PAUSE at ' . (string) $TP->Time . ' of ' . $ThisBreakInSeconds . ', empty point: ' . ($NoMove ? 'no move' . ($Ignored ? ' ignored' : '') : 'empty trackpoint') . ($TooSlow ? ' (too slow, ' . $ThisBreakInMeter . 'm in ' . $ThisBreakInSeconds . 's)' : ''));
             }
         }
         if (!$Ignored) {
             return;
         }
     }
     if (empty($TP->DistanceMeters) && !empty($this->gps['km'])) {
         $TP->DistanceMeters = end($this->gps['km']) * 1000;
     }
     if ($this->TrainingObject->getTimestamp() == 0) {
         $this->TrainingObject->setTimestamp(strtotime((string) $TP->Time));
     }
     if ($this->lastPointWasEmpty) {
         $OldPauseInSeconds = $this->PauseInSeconds;
         $this->PauseInSeconds = strtotime((string) $TP->Time) - $this->TrainingObject->getTimestamp() - end($this->gps['time_in_s']);
         $this->pauseDuration += $this->PauseInSeconds - $OldPauseInSeconds;
         $this->wasPause = true;
         if (self::$DEBUG_SPLITS) {
             Error::getInstance()->addDebug('PAUSE at ' . (string) $TP->Time . ' of ' . ($this->PauseInSeconds - $OldPauseInSeconds) . ', last point was empty');
         }
     }
     if ($this->wasPause) {
         $this->TrainingObject->Pauses()->add(new \Runalyze\Model\Trackdata\Pause(end($this->gps['time_in_s']), $this->pauseDuration, end($this->gps['heartrate']), !empty($TP->HeartRateBpm) ? round($TP->HeartRateBpm->Value) : 0));
         $this->wasPause = false;
         $this->pauseDuration = 0;
     }
     $this->lastPointWasEmpty = false;
     $this->lastPoint = (int) $TP->DistanceMeters;
     $this->lastDistance = (double) $TP->DistanceMeters;
     $this->gps['time_in_s'][] = strtotime((string) $TP->Time) - $this->TrainingObject->getTimestamp() - $this->PauseInSeconds;
     $this->gps['km'][] = round((double) $TP->DistanceMeters / 1000, ParserAbstract::DISTANCE_PRECISION);
     $this->gps['altitude'][] = (int) $TP->AltitudeMeters;
     $this->gps['heartrate'][] = !empty($TP->HeartRateBpm) ? round($TP->HeartRateBpm->Value) : 0;
     if (!empty($TP->Position)) {
         $this->gps['latitude'][] = (double) $TP->Position->LatitudeDegrees;
         $this->gps['longitude'][] = (double) $TP->Position->LongitudeDegrees;
     } elseif (!empty($this->gps['latitude'])) {
         $this->gps['latitude'][] = end($this->gps['latitude']);
         $this->gps['longitude'][] = end($this->gps['longitude']);
     } else {
         $this->gps['latitude'][] = 0;
         $this->gps['longitude'][] = 0;
     }
     $this->parseExtensionValues($TP);
 }
开发者ID:rob-st,项目名称:Runalyze,代码行数:76,代码来源:class.ParserTCXSingle.php

示例12: displayAfterSubmit

 /**
  * Display after submit
  */
 protected function displayAfterSubmit()
 {
     if ($this->submitMode == StandardFormular::$SUBMIT_MODE_CREATE) {
         $this->displayHeader();
         echo HTML::okay(__('The activity has been successfully created.'));
         echo Ajax::closeOverlay();
         if (Configuration::ActivityForm()->showActivity()) {
             echo Ajax::wrapJS('Runalyze.Training.load(' . $this->dataObject->id() . ');');
         }
     } else {
         if (Request::param('mode') == 'multi') {
             echo Ajax::wrapJS('Runalyze.goToNextMultiEditor();');
         } else {
             parent::displayAfterSubmit();
         }
     }
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:20,代码来源:class.TrainingFormular.php

示例13: setConfValueToSaveStatus

 /**
  * Set conf value to save current status
  * @param string $confValue
  */
 public final function setConfValueToSaveStatus($confValue)
 {
     $this->confValueToSaveStatus = $confValue;
     if (!Configuration::ActivityForm()->show($confValue)) {
         $this->setCollapsed();
     }
 }
开发者ID:guancio,项目名称:Runalyze,代码行数:11,代码来源:class.FormularFieldset.php

示例14: testUpdatePowerCalculation

 public function testUpdatePowerCalculation()
 {
     // TODO: Needs configuration setting
     if (Configuration::ActivityForm()->computePower()) {
         $OldObject = $this->fetch($this->insert(array(Object::DISTANCE => 10, Object::TIME_IN_SECONDS => 3000, Object::SPORTID => $this->IndoorID)));
         $NewObject = clone $OldObject;
         $NewObject->set(Object::SPORTID, $this->OutdoorID);
         $Result = $this->update($NewObject, $OldObject, new Model\Trackdata\Object(array(Model\Trackdata\Object::TIME => array(1500, 3000), Model\Trackdata\Object::DISTANCE => array(5, 10))));
         $this->assertEquals(0, $OldObject->power());
         $this->assertNotEquals(0, $NewObject->power());
         $this->assertNotEquals(0, $Result->power());
     }
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:13,代码来源:UpdaterTest.php

示例15: testPowerCalculation

 public function testPowerCalculation()
 {
     // TODO: Needs configuration setting
     if (Configuration::ActivityForm()->computePower()) {
         $ActivityIndoor = new Object(array(Object::DISTANCE => 10, Object::TIME_IN_SECONDS => 3000, Object::SPORTID => $this->IndoorID));
         $Trackdata = new Model\Trackdata\Object(array(Model\Trackdata\Object::TIME => array(1500, 3000), Model\Trackdata\Object::DISTANCE => array(5, 10)));
         $Inserter = new Inserter($this->PDO);
         $Inserter->setAccountID(0);
         $Inserter->setTrackdata($Trackdata);
         $Inserter->insert($ActivityIndoor);
         $this->assertEquals(0, $this->fetch($Inserter->insertedID())->power());
         $ActivityOutdoor = clone $ActivityIndoor;
         $ActivityOutdoor->set(Object::SPORTID, $this->OutdoorID);
         $Inserter->insert($ActivityOutdoor);
         $this->assertNotEquals(0, $this->fetch($Inserter->insertedID())->power());
         $this->assertNotEmpty($Trackdata->power());
     }
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:18,代码来源:InserterTest.php


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