예제 #1
0
 /**
  * Init pointer to DB/Error-object
  */
 protected function initInternalObjects()
 {
     parent::initInternalObjects();
     if (!\Runalyze\Configuration::Privacy()->showPrivateActivitiesInList()) {
         $this->DatasetQuery->showOnlyPublicActivities();
     }
 }
예제 #2
0
 /**
  * Get link to shared list for current user
  * @param string $text [optional]
  * @return string 
  */
 public static function getListLinkForCurrentUser($text = null)
 {
     if (!Configuration::Privacy()->listIsPublic()) {
         return '';
     }
     if (is_null($text)) {
         $text = Icon::$ATTACH;
     }
     return '<a href="shared/' . SessionAccountHandler::getUsername() . '/" target="_blank" ' . Ajax::tooltip('', __('Public list'), false, true) . '>' . $text . '</a>';
 }
예제 #3
0
 /**
  * Hides map?
  * @return boolean
  */
 public function hidesMap()
 {
     $RoutePrivacy = Configuration::Privacy()->RoutePrivacy();
     if ($RoutePrivacy->showRace()) {
         return !$this->Type()->isCompetition();
     } elseif ($RoutePrivacy->showAlways()) {
         return false;
     }
     return true;
 }
예제 #4
0
 /**
  * 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());
 }
예제 #5
0
    /**
     * Init all days for beeing displayed
     */
    protected function initDays()
    {
        $this->initShortModes();
        $this->initEmptyDays();
        $WhereNotPrivate = FrontendShared::$IS_SHOWN && !Configuration::Privacy()->showPrivateActivitiesInList() ? 'AND is_public=1' : '';
        $AllTrainings = $this->DB->query('
			SELECT
				id,
				time,
				`s` as `s_sum_with_distance`,
				DATE(FROM_UNIXTIME(time)) as `date`
				' . $this->Dataset->getQuerySelectForAllDatasets() . '
			FROM `' . PREFIX . 'training`
			WHERE `time` BETWEEN ' . ($this->timestamp_start - 10) . ' AND ' . ($this->timestamp_end - 10) . '
                        AND accountid = ' . SessionAccountHandler::getId() . '
				' . $WhereNotPrivate . '
			ORDER BY `time` ASC
		')->fetchAll();
        foreach ($AllTrainings as $Training) {
            $w = Time::diffInDays($Training['time'], $this->timestamp_start);
            if (in_array($Training['sportid'], $this->sports_short) || in_array($Training['typeid'], $this->types_short)) {
                $this->days[$w]['shorts'][] = $Training;
            } else {
                $this->days[$w]['trainings'][] = $Training;
            }
        }
    }
예제 #6
0
 /**
  * Get string for query to not select private trainings
  * @return string
  */
 private function getQueryWhereNotPrivate()
 {
     return FrontendShared::$IS_SHOWN && !Configuration::Privacy()->showPrivateActivitiesInList() ? 'AND is_public=1' : '';
 }
 /**
  * Does this user allow a shared list?
  * @return boolean 
  */
 protected function userAllowsList()
 {
     return Configuration::Privacy()->listIsPublic();
 }
예제 #8
0
 /**
  * @return boolean
  */
 public function hideMap()
 {
     if (!Request::isOnSharedPage()) {
         return false;
     }
     $RoutePrivacy = Configuration::Privacy()->RoutePrivacy();
     if ($RoutePrivacy->showAlways()) {
         return false;
     }
     $type = $this->activity()->type();
     if ($RoutePrivacy->showRace()) {
         return !$type->isCompetition();
     }
     return true;
 }
예제 #9
0
			<tr class="r' . $trClass . '">
				<td class="l" style="width:24px;">';
        foreach ($day['shorts'] as $short) {
            $this->Dataset->setActivityData($short);
            $this->Dataset->displayShortLink();
        }
        echo '</td>
				<td class="l as-small-as-possible">' . Dataset::getDateString($day['date']) . '</td>
				<td colspan="' . ($this->Dataset->cols() + $this->showPublicLink) . '"></td>
			</tr>';
    }
}
echo '</tbody>';
echo '<tbody>';
// Z U S A M M E N F A S S U N G
$WhereNotPrivate = FrontendShared::$IS_SHOWN && !\Runalyze\Configuration::Privacy()->showPrivateActivitiesInList() ? 'AND is_public=1' : '';
$sports = DB::getInstance()->query('SELECT `id`, `time`, `sportid`, SUM(1) as `num` FROM `' . PREFIX . 'training` WHERE `time` BETWEEN ' . ($this->timestamp_start - 10) . ' AND ' . ($this->timestamp_end - 10) . ' AND accountid = ' . SessionAccountHandler::getId() . ' ' . $WhereNotPrivate . ' GROUP BY `sportid` ORDER BY `num` DESC')->fetchAll();
foreach ($sports as $i => $sportdata) {
    $Sport = new Sport($sportdata['sportid']);
    echo '<tr class="r no-zebra">
			<td colspan="' . $this->additionalColumns . '">
				<small>' . $sportdata['num'] . 'x</small>
				' . $Sport->name() . '
			</td>';
    $this->Dataset->loadGroupOfTrainings($sportdata['sportid'], $this->timestamp_start, $this->timestamp_end);
    $this->Dataset->displayTableColumns();
    echo '
		</tr>';
}
?>
			</tbody>