init
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<access component="com_sportsmanager">
|
||||
<section name="component">
|
||||
<!-- Joomla! core privileges -->
|
||||
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
|
||||
<!-- <action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" /> -->
|
||||
<!-- Custom privileges -->
|
||||
<!-- <action name="example.something" title="COM_EXAMPLE_ACL_SOMETHING_TITLE" description="COM_EXAMPLE_ACL_SOMETHING_DESC" /> -->
|
||||
</section>
|
||||
</access>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
// no direct access
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// Require the base controller
|
||||
require_once (JPATH_COMPONENT.DS.'controller.php');
|
||||
|
||||
// Require specific controller if requested
|
||||
//if($controller = JRequest::getVar('controller')) {
|
||||
// require_once (JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php');
|
||||
//}
|
||||
|
||||
// Create the controller
|
||||
//$classname = 'AutosController'.$controller;
|
||||
//$controller = new $classname( );
|
||||
|
||||
// Perform the Request task
|
||||
//$controller->execute( JRequest::getVar('task'));
|
||||
|
||||
// Redirect if set by the controller
|
||||
//$controller->redirect();
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/*
|
||||
* Sports Manager (C) 2006-2020, Sven Nickel
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla controller library
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
/**
|
||||
* General Controller of SportsManager component
|
||||
*/
|
||||
class SportsManagerController extends JControllerLegacy
|
||||
{
|
||||
/**
|
||||
* display task
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function display($cachable = false, $urlparams = false)
|
||||
{
|
||||
// set default view if not set
|
||||
$input = JFactory::getApplication()->input;
|
||||
$input->set('view', $input->getCmd('view', 'SportsManager'));
|
||||
|
||||
// call parent behavior
|
||||
parent::display($cachable);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import joomla controller library
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
// Get an instance of the controller prefixed by HelloWorld
|
||||
$controller = JControllerLegacy::getInstance('SportsManager');
|
||||
|
||||
// Get the task
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$task = $jinput->get('task', "", 'STR' );
|
||||
|
||||
// Perform the Request task
|
||||
$controller->execute($task);
|
||||
|
||||
// Redirect if set by the controller
|
||||
$controller->redirect();
|
||||
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE install SYSTEM "http://dev.joomla.org/xml/1.5/component-install.dtd">
|
||||
<extension type="component" version="3.0" method="upgrade">
|
||||
<name>Sports manager</name>
|
||||
<creationDate>2020-09-30</creationDate>
|
||||
<author>Sven Nickel</author>
|
||||
<authorEmail>sven.nickel@gmail.com</authorEmail>
|
||||
<copyright>All rights reserved</copyright>
|
||||
<license>GNU/GPL</license>
|
||||
<version>1.7.1</version>
|
||||
<description>Verwaltung von Spielern und Vereinen in Mannschafts- und Individualwettbewerben</description>
|
||||
<files folder="site">
|
||||
<filename>index.html</filename>
|
||||
<filename>admin.php</filename>
|
||||
<filename>api.php</filename>
|
||||
<filename>controller.php</filename>
|
||||
<filename>database.php</filename>
|
||||
<filename>sportsmanager.php</filename>
|
||||
<filename>mathparser.php</filename>
|
||||
<filename>tools.php</filename>
|
||||
<filename>js/jquery.min.js</filename>
|
||||
<folder>images</folder>
|
||||
<folder>models</folder>
|
||||
<folder>views</folder>
|
||||
</files>
|
||||
<languages folder="site">
|
||||
<language tag="en-GB">language/en-GB/en-GB.com_sportsmanager.ini
|
||||
</language>
|
||||
<language tag="de-DE">language/de-DE/de-DE.com_sportsmanager.ini
|
||||
</language>
|
||||
<language tag="nl-NL">language/nl-NL/nl-NL.com_sportsmanager.ini
|
||||
</language>
|
||||
</languages>
|
||||
<scriptfile>install.php</scriptfile>
|
||||
<administration>
|
||||
<files folder="admin">
|
||||
<filename>access.xml</filename>
|
||||
<filename>sportsmanager.php</filename>
|
||||
<filename>controller.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<folder>views</folder>
|
||||
</files>
|
||||
<languages folder="admin">
|
||||
<language tag="en-GB">language/en-GB/en-GB.com_sportsmanager.ini
|
||||
</language>
|
||||
<language tag="en-GB">language/en-GB/en-GB.com_sportsmanager.sys.ini
|
||||
</language>
|
||||
<language tag="de-DE">language/de-DE/de-DE.com_sportsmanager.ini
|
||||
</language>
|
||||
<language tag="de-DE">language/de-DE/de-DE.com_sportsmanager.sys.ini
|
||||
</language>
|
||||
<language tag="nl-NL">language/nl-NL/nl-NL.com_sportsmanager.ini
|
||||
</language>
|
||||
<language tag="nl-NL">language/nl-NL/nl-NL.com_sportsmanager.sys.ini
|
||||
</language>
|
||||
</languages>
|
||||
</administration>
|
||||
</extension>
|
||||
@@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=Dieser Ordner wird online freigegeben.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=Dieser Ordner wird online freigegeben.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
/*
|
||||
* Sports Manager (C) 2006-2020, Sven Nickel
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=Dieser Ordner wird online freigegeben.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/*
|
||||
* Sports Manager (C) 2006-2020, Sven Nickel
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla view library
|
||||
jimport('joomla.application.component.view');
|
||||
|
||||
/**
|
||||
* SportsManager View
|
||||
*/
|
||||
|
||||
class SportsManagerViewSportsManager extends JViewLegacy
|
||||
{
|
||||
/**
|
||||
* SportsManager view display method
|
||||
* @return void
|
||||
*/
|
||||
function display($tpl = null)
|
||||
{
|
||||
JToolbarHelper::title(JText::_('COM_SPORTSMANAGER'));
|
||||
|
||||
?>
|
||||
<h2><?php echo JText::_('COM_SPORTSMANAGER'); ?> Copyright © 2006 – 2014 Sven Nickel</h2>
|
||||
<?php
|
||||
/*
|
||||
// Get data from the model
|
||||
$items = $this->get('Items');
|
||||
$pagination = $this->get('Pagination');
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseError(500, implode('<br />', $errors));
|
||||
return false;
|
||||
}
|
||||
// Assign data to the view
|
||||
$this->items = $items;
|
||||
$this->pagination = $pagination;
|
||||
*/
|
||||
|
||||
// Display the template
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,279 @@
|
||||
<?php
|
||||
/*
|
||||
* Sports Manager API Extension
|
||||
*/
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
$secret = JFactory::$config['secret'];
|
||||
|
||||
function abortWithError($error) {
|
||||
if (isJson()) {
|
||||
header('content-type: application/json');
|
||||
die(json_encode(['error' => $error]));
|
||||
} else {
|
||||
die($error);
|
||||
}
|
||||
}
|
||||
|
||||
function isJson() {
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
|
||||
return $jinput->get('format') === 'json';
|
||||
}
|
||||
|
||||
function notifyChange($data) {
|
||||
|
||||
try {
|
||||
$db = &getDatabase();
|
||||
$query = "SELECT wert from #__sportsmanager_einstellungen WHERE name='api_push_key'";
|
||||
$db->setQuery($query);
|
||||
$push_key = $db->loadResult();
|
||||
$push_server = !empty($push_key) && isset(_payload($push_key)->aud) ? _payload($push_key)->aud : '';
|
||||
if ($push_server != '' && $push_key != '') {
|
||||
$url = $push_server . (substr($push_server, -1) == '/' ? '' : '/') . 'v1/notifications/send';
|
||||
$key = 'key=' . $push_key;
|
||||
|
||||
$ch = curl_init($url);
|
||||
curl_setopt_array($ch, array(
|
||||
CURLOPT_POST => TRUE,
|
||||
CURLOPT_RETURNTRANSFER => TRUE,
|
||||
CURLOPT_HEADER => TRUE,
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Authorization: ' . $key,
|
||||
'Content-Type: application/json',
|
||||
),
|
||||
CURLOPT_POSTFIELDS => json_encode($data),
|
||||
));
|
||||
$resp = curl_exec($ch);
|
||||
if ($resp == FALSE) {
|
||||
error_log("failed to send notification");
|
||||
}
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
error_log($ex);
|
||||
}
|
||||
}
|
||||
|
||||
function begegnungChanged($begegnung, $begegnung_vorher, $modus, $heim_team, $gast_team, $spiele) {
|
||||
notifyChange(['payload' => [
|
||||
'begegnung' => $begegnung,
|
||||
'begegnung_vorher' => $begegnung_vorher,
|
||||
'$modus' => $modus,
|
||||
'heim_team' => $heim_team,
|
||||
'gast_team' => $gast_team,
|
||||
'spiele' => $spiele,
|
||||
], 'type' => 'FIXTURE_RESULT_CHANGED']);
|
||||
}
|
||||
|
||||
function begegnungTischChanged($begegnung, $heim_team, $gast_team) {
|
||||
notifyChange(['payload' => [
|
||||
'begegnung' => $begegnung,
|
||||
'heim_team' => $heim_team,
|
||||
'gast_team' => $gast_team,
|
||||
], 'type' => 'TABLE_CHANGED']);
|
||||
}
|
||||
|
||||
function begegnungVerlegenNotify($begegnung, $users, $vorschlagendes_team_id, $heim_team, $gast_team) {
|
||||
notifyChange([
|
||||
'payload' => [
|
||||
'begegnung' => $begegnung,
|
||||
'users' => $users,
|
||||
'vorschlagendes_team_id' => $vorschlagendes_team_id,
|
||||
'heim_team' => $heim_team,
|
||||
'gast_team' => $gast_team,
|
||||
],
|
||||
'type' => 'FIXTURE_DATE_CHANGED'
|
||||
]);
|
||||
}
|
||||
|
||||
/*
|
||||
* erstellen von request tokens. diese sind 16 stunden gültig.
|
||||
* @reponse body
|
||||
* { data: { token: "reqest_token", access_for_team: ["team_id_1", "team_id_2"]}, expires: 1520013747000}
|
||||
*/
|
||||
function userToken() {
|
||||
global $secret;
|
||||
if (!isJson()) {
|
||||
abortWithError("JSON Request only");
|
||||
}
|
||||
if (isExternalDatabase()) {
|
||||
abortWithError("Local Database only");
|
||||
}
|
||||
$jinput = JFactory::getApplication()->input->json;
|
||||
$access_key = $jinput->getString('access_key');
|
||||
|
||||
$user_id = _payload($access_key)->sub;
|
||||
$user = JFactory::getUser($user_id);
|
||||
|
||||
if (!jwt_validate($access_key, $secret.$user->password)) {
|
||||
abortWithError('Access Key is invalid');
|
||||
}
|
||||
|
||||
$expires = new DateTime();
|
||||
$expires->modify('+16 hours');
|
||||
$db = &getDatabase();
|
||||
$query = "SELECT berechtigt_team_id from #__sportsmanager_berechtigt_fuer_team where berechtigt_user_id = $user_id";
|
||||
$db->setQuery($query);
|
||||
if (!$db->execute()) {
|
||||
abortWithError($db->stderr(true));
|
||||
}
|
||||
$team_id = $db->loadObjectList();
|
||||
JSON_sportsmanager::JSON([
|
||||
'token' => jwt_token([
|
||||
'sub' => $user_id,
|
||||
'exp' => $expires->getTimestamp(),
|
||||
], $secret),
|
||||
'access_for_teams' => array_map(function($item) { return $item->berechtigt_team_id; }, $team_id),
|
||||
'expires' => $expires->getTimestamp() * 1000, //
|
||||
]);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* @response body
|
||||
* { data: { token: "api_acccess_token" }}
|
||||
*/
|
||||
function userAuth() {
|
||||
global $secret;
|
||||
if (!isJson()) {
|
||||
die();
|
||||
}
|
||||
if (isExternalDatabase()) {
|
||||
abortWithError("Local Database only");
|
||||
}
|
||||
$jinput = JFactory::getApplication()->input->json;
|
||||
$username = $jinput->getString('username');
|
||||
$password = $jinput->getString('password');
|
||||
|
||||
$db = &getDatabase();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('id')->from('#__users')->where('username = "' . $username . '"')->limit(1);
|
||||
$db->setQuery($query);
|
||||
$user_id = $db->loadResult();
|
||||
$user = JFactory::getUser($user_id);
|
||||
|
||||
if (JUserHelper::verifyPassword($password, $user->password, $user->id)) {
|
||||
|
||||
JSON_sportsmanager::JSON([
|
||||
'token' => jwt_token([
|
||||
'sub' => $user_id,
|
||||
'iat' => (new DateTime())->getTimestamp(),
|
||||
], $secret.$user->password)
|
||||
]);
|
||||
return;
|
||||
}
|
||||
abortWithError('Wrong credentials');
|
||||
}
|
||||
|
||||
function getUserID() {
|
||||
global $secret;
|
||||
$token = JFactory::getApplication()->input->server->getString('HTTP_SECRET', NULL);
|
||||
|
||||
return $token != NULL && jwt_validate($token, $secret) && isset(_payload($token)->sub)
|
||||
? (int) _payload($token)->sub
|
||||
: 0;
|
||||
}
|
||||
|
||||
function getColorOfImage($image) {
|
||||
if ($image != NULL) {
|
||||
|
||||
if (strpos($image, '.png') !== false) {
|
||||
$img = imagecreatefrompng($image);
|
||||
} else {
|
||||
$img = imagecreatefromjpeg($image);
|
||||
}
|
||||
$width = imagesx($img);
|
||||
$height = imagesx($img);
|
||||
$colorMap = [];
|
||||
$colors = [];
|
||||
for ($x = 0; $x < $width; $x++) {
|
||||
for ($y = 0; $y < $height; $y++) {
|
||||
$color = imagecolorsforindex($img, imagecolorat($img, $x, $y));
|
||||
if ($color['alpha'] < 20) {
|
||||
$c = colorKey($color);
|
||||
$hex = hex($color);
|
||||
if ($hex != NULL) {
|
||||
if (!isset($colors[$c])) {
|
||||
$colors[$c] = 0;
|
||||
$colorMap[$c] = $hex;
|
||||
}
|
||||
$colors[$c] += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arsort($colors);
|
||||
$result = array_keys($colors);
|
||||
return sizeof($result) > 1 && $result[0] === '0-0-0' ? $colorMap[$result[1]] : $colorMap[$result[0]];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
function colorKey($rgb) {
|
||||
|
||||
$r = (int)($rgb['red'] / 100);
|
||||
$g = (int)($rgb['green'] / 100);
|
||||
$b = (int)($rgb['blue'] / 100);
|
||||
|
||||
return $r . '-' . $g . '-' . $b;
|
||||
}
|
||||
|
||||
function hex($rgb) {
|
||||
$r = $rgb['red'];
|
||||
$g = $rgb['green'];
|
||||
$b = $rgb['blue'];
|
||||
if (($r + $g + $b) / 3 > 125) {
|
||||
return NULL;
|
||||
}
|
||||
$r = dechex($r);
|
||||
if (strlen($r) < 2) {
|
||||
$r = '0' . $r;
|
||||
}
|
||||
$g = dechex($g);
|
||||
if (strlen($g) < 2) {
|
||||
$g = '0' . $g;
|
||||
}
|
||||
$b = dechex($b);
|
||||
if (strlen($b) < 2) {
|
||||
$b = '0' . $b;
|
||||
}
|
||||
return '#' . $r . $g . $b;
|
||||
}
|
||||
|
||||
/*
|
||||
* sign string with secret
|
||||
*/
|
||||
function _sign($data, $secret, $algo = 'sha256') {
|
||||
return base64_encode(hash_hmac('sha256', $data, $secret));
|
||||
}
|
||||
|
||||
/*
|
||||
* get payload from jwt token
|
||||
*/
|
||||
function _payload($token) {
|
||||
$jwt = explode('.', $token);
|
||||
return json_decode(base64_decode($jwt[0]));
|
||||
}
|
||||
|
||||
/*
|
||||
* headless signed jwt token
|
||||
*/
|
||||
function jwt_token($payload, $secret) {
|
||||
$data = base64_encode(json_encode($payload));
|
||||
|
||||
return $data . '.' . _sign($data, $secret);
|
||||
}
|
||||
|
||||
/*
|
||||
* validate token
|
||||
*/
|
||||
function jwt_validate($token, $secret) {
|
||||
$jwt = explode('.', $token);
|
||||
if (sizeof($jwt) == 2 && $jwt[1] == _sign($jwt[0], $secret)) {
|
||||
if (isset(_payload($token)->exp)) {
|
||||
return _payload($token)->exp > (new DateTime())->getTimestamp();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return sizeof($jwt) == 2 && $jwt[1] == _sign($jwt[0], $secret);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/*
|
||||
* Sports Manager (C) 2006-2020, Sven Nickel
|
||||
*/
|
||||
|
||||
// Check to ensure this file is included in Joomla!
|
||||
defined('_JEXEC') or die();
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
/**
|
||||
* Auto Component Controller
|
||||
*/
|
||||
class SportsManagerController extends JControllerLegacy
|
||||
{
|
||||
function display()
|
||||
{
|
||||
// Setzt einen Standard view
|
||||
if ( ! JRequest::getCmd( 'view' ) ) {
|
||||
JRequest::setVar('view', 'categories' );
|
||||
}
|
||||
parent::display();
|
||||
}
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
@@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=Dieser Ordner wird online freigegeben.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
||||
|
After Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 613 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 522 B |
|
After Width: | Height: | Size: 242 B |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 558 B |
|
After Width: | Height: | Size: 540 B |
|
After Width: | Height: | Size: 517 B |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 276 B |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 761 B |
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=Dieser Ordner wird online freigegeben.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,393 @@
|
||||
<?php
|
||||
/*
|
||||
* Sports Manager (C) 2006-2020, Sven Nickel
|
||||
*/
|
||||
|
||||
// kein direkter Zugriff
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
require_once (JPATH_COMPONENT.DIRECTORY_SEPARATOR.'mathparser.php');
|
||||
|
||||
function mathParserVerteilung($rohpunkte, $platz, $teilnehmer, $multiplikator) {
|
||||
return max(round($multiplikator * round(((($rohpunkte - 1) * (-log($platz / $teilnehmer) * (1 - ($platz / $teilnehmer)))) / (-log(1 / $teilnehmer) * (1 - (1 / $teilnehmer)))) + 1)), 1);
|
||||
}
|
||||
|
||||
function mathParserVerteilungR($rohpunkte, $platz, $teilnehmer, $multiplikator) {
|
||||
return max(round(((($multiplikator * $rohpunkte - 1) * (-log($platz / $teilnehmer) * (1 - ($platz / $teilnehmer)))) / (-log(1 / $teilnehmer) * (1 - (1 / $teilnehmer)))) + 1), 1);
|
||||
}
|
||||
|
||||
class MathParserSM extends MathParser {
|
||||
// Verteilung nach Klostermann/Wahle
|
||||
public function __construct() {
|
||||
MathParser::__construct();
|
||||
$this->createFunc("ROUND", round, 1);
|
||||
$this->createFunc("VERTEILUNG", mathParserVerteilung, 4);
|
||||
$this->createFunc("VERTEILUNGR", mathParserVerteilungR, 4);
|
||||
}
|
||||
}
|
||||
|
||||
function keinZugriff($login = FALSE) {
|
||||
if (isJson()) {
|
||||
abortWithError(401 . ' Unauthorized');
|
||||
}
|
||||
if (!$login || JFactory::getUser()->id) {
|
||||
JError::raiseError(500, JText::_('JERROR_ALERTNOAUTHOR'));
|
||||
jexit();
|
||||
}
|
||||
$version = new JVersion;
|
||||
$joomla = $version->getShortVersion();
|
||||
$u =& JFactory::getURI();
|
||||
$redirectUrl = urlencode(base64_encode($u->toString()));
|
||||
$redirectUrl = '&return='.$redirectUrl;
|
||||
$joomlaLoginUrl = 'index.php?option=' . (substr($joomla, 0, 3) != '1.5' ? 'com_users' : 'com_user') . '&view=login';
|
||||
$finalUrl = $joomlaLoginUrl . $redirectUrl;
|
||||
$app = &JFactory::getApplication();
|
||||
$app->redirect(JRoute::_($finalUrl));
|
||||
jexit();
|
||||
}
|
||||
|
||||
function bereinigterDateiname($dateiname) {
|
||||
$_convertTable = array(
|
||||
'&' => 'and', '@' => 'at', '©' => 'c', '®' => 'r', 'À' => 'a',
|
||||
'Á' => 'a', 'Â' => 'a', 'Ä' => 'a', 'Å' => 'a', 'Æ' => 'ae','Ç' => 'c',
|
||||
'È' => 'e', 'É' => 'e', 'Ë' => 'e', 'Ì' => 'i', 'Í' => 'i', 'Î' => 'i',
|
||||
'Ï' => 'i', 'Ò' => 'o', 'Ó' => 'o', 'Ô' => 'o', 'Õ' => 'o', 'Ö' => 'o',
|
||||
'Ø' => 'o', 'Ù' => 'u', 'Ú' => 'u', 'Û' => 'u', 'Ü' => 'u', 'Ý' => 'y',
|
||||
'ß' => 'ss','à' => 'a', 'á' => 'a', 'â' => 'a', 'ä' => 'a', 'å' => 'a',
|
||||
'æ' => 'ae','ç' => 'c', 'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e',
|
||||
'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', 'ò' => 'o', 'ó' => 'o',
|
||||
'ô' => 'o', 'õ' => 'o', 'ö' => 'o', 'ø' => 'o', 'ù' => 'u', 'ú' => 'u',
|
||||
'û' => 'u', 'ü' => 'u', 'ý' => 'y', 'þ' => 'p', 'ÿ' => 'y', 'Ā' => 'a',
|
||||
'ā' => 'a', 'Ă' => 'a', 'ă' => 'a', 'Ą' => 'a', 'ą' => 'a', 'Ć' => 'c',
|
||||
'ć' => 'c', 'Ĉ' => 'c', 'ĉ' => 'c', 'Ċ' => 'c', 'ċ' => 'c', 'Č' => 'c',
|
||||
'č' => 'c', 'Ď' => 'd', 'ď' => 'd', 'Đ' => 'd', 'đ' => 'd', 'Ē' => 'e',
|
||||
'ē' => 'e', 'Ĕ' => 'e', 'ĕ' => 'e', 'Ė' => 'e', 'ė' => 'e', 'Ę' => 'e',
|
||||
'ę' => 'e', 'Ě' => 'e', 'ě' => 'e', 'Ĝ' => 'g', 'ĝ' => 'g', 'Ğ' => 'g',
|
||||
'ğ' => 'g', 'Ġ' => 'g', 'ġ' => 'g', 'Ģ' => 'g', 'ģ' => 'g', 'Ĥ' => 'h',
|
||||
'ĥ' => 'h', 'Ħ' => 'h', 'ħ' => 'h', 'Ĩ' => 'i', 'ĩ' => 'i', 'Ī' => 'i',
|
||||
'ī' => 'i', 'Ĭ' => 'i', 'ĭ' => 'i', 'Į' => 'i', 'į' => 'i', 'İ' => 'i',
|
||||
'ı' => 'i', 'IJ' => 'ij','ij' => 'ij','Ĵ' => 'j', 'ĵ' => 'j', 'Ķ' => 'k',
|
||||
'ķ' => 'k', 'ĸ' => 'k', 'Ĺ' => 'l', 'ĺ' => 'l', 'Ļ' => 'l', 'ļ' => 'l',
|
||||
'Ľ' => 'l', 'ľ' => 'l', 'Ŀ' => 'l', 'ŀ' => 'l', 'Ł' => 'l', 'ł' => 'l',
|
||||
'Ń' => 'n', 'ń' => 'n', 'Ņ' => 'n', 'ņ' => 'n', 'Ň' => 'n', 'ň' => 'n',
|
||||
'ʼn' => 'n', 'Ŋ' => 'n', 'ŋ' => 'n', 'Ō' => 'o', 'ō' => 'o', 'Ŏ' => 'o',
|
||||
'ŏ' => 'o', 'Ő' => 'o', 'ő' => 'o', 'Œ' => 'oe','œ' => 'oe','Ŕ' => 'r',
|
||||
'ŕ' => 'r', 'Ŗ' => 'r', 'ŗ' => 'r', 'Ř' => 'r', 'ř' => 'r', 'Ś' => 's',
|
||||
'ś' => 's', 'Ŝ' => 's', 'ŝ' => 's', 'Ş' => 's', 'ş' => 's', 'Š' => 's',
|
||||
'š' => 's', 'Ţ' => 't', 'ţ' => 't', 'Ť' => 't', 'ť' => 't', 'Ŧ' => 't',
|
||||
'ŧ' => 't', 'Ũ' => 'u', 'ũ' => 'u', 'Ū' => 'u', 'ū' => 'u', 'Ŭ' => 'u',
|
||||
'ŭ' => 'u', 'Ů' => 'u', 'ů' => 'u', 'Ű' => 'u', 'ű' => 'u', 'Ų' => 'u',
|
||||
'ų' => 'u', 'Ŵ' => 'w', 'ŵ' => 'w', 'Ŷ' => 'y', 'ŷ' => 'y', 'Ÿ' => 'y',
|
||||
'Ź' => 'z', 'ź' => 'z', 'Ż' => 'z', 'ż' => 'z', 'Ž' => 'z', 'ž' => 'z',
|
||||
'ſ' => 'z', 'Ə' => 'e', 'ƒ' => 'f', 'Ơ' => 'o', 'ơ' => 'o', 'Ư' => 'u',
|
||||
'ư' => 'u', 'Ǎ' => 'a', 'ǎ' => 'a', 'Ǐ' => 'i', 'ǐ' => 'i', 'Ǒ' => 'o',
|
||||
'ǒ' => 'o', 'Ǔ' => 'u', 'ǔ' => 'u', 'Ǖ' => 'u', 'ǖ' => 'u', 'Ǘ' => 'u',
|
||||
'ǘ' => 'u', 'Ǚ' => 'u', 'ǚ' => 'u', 'Ǜ' => 'u', 'ǜ' => 'u', 'Ǻ' => 'a',
|
||||
'ǻ' => 'a', 'Ǽ' => 'ae','ǽ' => 'ae','Ǿ' => 'o', 'ǿ' => 'o', 'ə' => 'e',
|
||||
'Ё' => 'jo','Є' => 'e', 'І' => 'i', 'Ї' => 'i', 'А' => 'a', 'Б' => 'b',
|
||||
'В' => 'v', 'Г' => 'g', 'Д' => 'd', 'Е' => 'e', 'Ж' => 'zh','З' => 'z',
|
||||
'И' => 'i', 'Й' => 'j', 'К' => 'k', 'Л' => 'l', 'М' => 'm', 'Н' => 'n',
|
||||
'О' => 'o', 'П' => 'p', 'Р' => 'r', 'С' => 's', 'Т' => 't', 'У' => 'u',
|
||||
'Ф' => 'f', 'Х' => 'h', 'Ц' => 'c', 'Ч' => 'ch','Ш' => 'sh','Щ' => 'sch',
|
||||
'Ъ' => '-', 'Ы' => 'y', 'Ь' => '-', 'Э' => 'je','Ю' => 'ju','Я' => 'ja',
|
||||
'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e',
|
||||
'ж' => 'zh','з' => 'z', 'и' => 'i', 'й' => 'j', 'к' => 'k', 'л' => 'l',
|
||||
'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's',
|
||||
'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'h', 'ц' => 'c', 'ч' => 'ch',
|
||||
'ш' => 'sh','щ' => 'sch','ъ' => '-','ы' => 'y', 'ь' => '-', 'э' => 'je',
|
||||
'ю' => 'ju','я' => 'ja','ё' => 'jo','є' => 'e', 'і' => 'i', 'ї' => 'i',
|
||||
'Ґ' => 'g', 'ґ' => 'g', 'א' => 'a', 'ב' => 'b', 'ג' => 'g', 'ד' => 'd',
|
||||
'ה' => 'h', 'ו' => 'v', 'ז' => 'z', 'ח' => 'h', 'ט' => 't', 'י' => 'i',
|
||||
'ך' => 'k', 'כ' => 'k', 'ל' => 'l', 'ם' => 'm', 'מ' => 'm', 'ן' => 'n',
|
||||
'נ' => 'n', 'ס' => 's', 'ע' => 'e', 'ף' => 'p', 'פ' => 'p', 'ץ' => 'C',
|
||||
'צ' => 'c', 'ק' => 'q', 'ר' => 'r', 'ש' => 'w', 'ת' => 't', '™' => 'tm',
|
||||
);
|
||||
$bad = array_merge(
|
||||
array_map('chr', range(0,31)),
|
||||
array("<", ">", ":", '"', "/", "\\", "|", "?", "*"));
|
||||
|
||||
return str_replace($bad, "", strtr($dateiname, $_convertTable));
|
||||
}
|
||||
|
||||
function setMinMemoryLimit($memDestSize) {
|
||||
if (getBytes(ini_get('memory_limit')) < getBytes($memDestSize))
|
||||
ini_set('memory_limit', $memDestSize);
|
||||
}
|
||||
|
||||
function getBytes($val) {
|
||||
$val = trim($val);
|
||||
$last = strtolower($val{strlen($val)-1});
|
||||
switch($last) {
|
||||
// The 'G' modifier is available since PHP 5.1.0
|
||||
case 'g':
|
||||
$val *= 1024;
|
||||
case 'm':
|
||||
$val *= 1024;
|
||||
case 'k':
|
||||
$val *= 1024;
|
||||
}
|
||||
return $val;
|
||||
}
|
||||
|
||||
function encrypt($str, $key){
|
||||
$result="";
|
||||
for($i=0; $i<strlen($str); $i++) {
|
||||
$char = substr($str, $i, 1);
|
||||
$keychar = substr($key, ($i % strlen($key))-1, 1);
|
||||
$char = chr(ord($char)+ord($keychar));
|
||||
$result.=$char;
|
||||
}
|
||||
return base64_encode($result);
|
||||
}
|
||||
|
||||
function decrypt($str, $key){
|
||||
$str = base64_decode($str);
|
||||
$result="";
|
||||
for($i=0; $i<strlen($str); $i++) {
|
||||
$char = substr($str, $i, 1);
|
||||
$keychar = substr($key, ($i % strlen($key))-1, 1);
|
||||
$char = chr(ord($char)-ord($keychar));
|
||||
$result.=$char;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
function individualwettbewerbFilter($prefix) {
|
||||
$db =& getDatabase();
|
||||
$user_id = isExternalDatabase() ? 0 : JFactory::getUser()->id;
|
||||
return " " . $prefix . " (SELECT berechtigt_individualwettbewerb_id FROM #__sportsmanager_berechtigt_fuer_individualwettbewerb INNER JOIN #__sportsmanager_individualwettbewerb ON individualwettbewerb_id = berechtigt_individualwettbewerb_id WHERE berechtigt_user_id = $user_id) ";
|
||||
}
|
||||
|
||||
function kategorieFilter($prefix, $suffix = "") {
|
||||
global $params;
|
||||
$kategorien = explode(",", $params->get( 'kategorien' ));
|
||||
$filter = "";
|
||||
foreach ($kategorien as $s) {
|
||||
$kategorie = intval(trim($s));
|
||||
if ($kategorie == 0)
|
||||
continue;
|
||||
if (!empty($filter))
|
||||
$filter .= ", ";
|
||||
$filter .= $kategorie;
|
||||
}
|
||||
return empty($filter) ? "" : (" " . $prefix . " (" . $filter . ") " . $suffix);
|
||||
}
|
||||
|
||||
function turnierFilter($prefix) {
|
||||
$db =& getDatabase();
|
||||
$user_id = isExternalDatabase() ? 0 : JFactory::getUser()->id;
|
||||
return " " . $prefix . " (SELECT berechtigt_turnier_id FROM #__sportsmanager_berechtigt_fuer_turnier WHERE berechtigt_user_id = $user_id AND DATEDIFF(letzter_tag, NOW()) >= -14) ";
|
||||
}
|
||||
|
||||
function vereinFilter($prefix) {
|
||||
$db =& getDatabase();
|
||||
$user_id = isExternalDatabase() ? 0 : JFactory::getUser()->id;
|
||||
return " " . $prefix . " (SELECT berechtigt_verein_id FROM #__sportsmanager_berechtigt_fuer_verein INNER JOIN #__sportsmanager_verein ON berechtigt_verein_id = verein_id WHERE berechtigt_user_id = $user_id AND NOT ausgetreten) ";
|
||||
}
|
||||
|
||||
function veranstalterFilter($prefix) {
|
||||
$db =& getDatabase();
|
||||
$user_id = isExternalDatabase() ? 0 : JFactory::getUser()->id;
|
||||
return " " . $prefix . " (SELECT berechtigt_veranstalter_id FROM #__sportsmanager_berechtigt_fuer_veranstalter WHERE berechtigt_user_id = $user_id) ";
|
||||
}
|
||||
|
||||
function veranstaltungFilter($prefix) {
|
||||
$db =& getDatabase();
|
||||
$user_id = isExternalDatabase() ? 0 : JFactory::getUser()->id;
|
||||
return " " . $prefix . " (SELECT berechtigt_veranstaltung_id FROM #__sportsmanager_berechtigt_fuer_veranstaltung INNER JOIN #__sportsmanager_veranstaltung ON veranstaltung_id = berechtigt_veranstaltung_id WHERE berechtigt_user_id = $user_id AND DATEDIFF(letzter_tag, NOW()) >= -14) ";
|
||||
}
|
||||
|
||||
// Berechnet Datum zum Montag der ersten Kalenderwoche eines Jahres
|
||||
function firstkw($jahr) {
|
||||
$erster = mktime(0,0,0,1,1,$jahr);
|
||||
$wtag = date('w',$erster);
|
||||
if ($wtag <= 4) {
|
||||
/**
|
||||
* Donnerstag oder kleiner: auf den Montag zurückrechnen.
|
||||
*/
|
||||
$montag = mktime(0,0,0,1,1-($wtag-1),$jahr);
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* auf den Montag nach vorne rechnen.
|
||||
*/
|
||||
$montag = mktime(0,0,0,1,1+(7-$wtag+1),$jahr);
|
||||
}
|
||||
return $montag;
|
||||
}
|
||||
|
||||
// Berechnet Wochentag über Kalenderwoche, Jahr und Wochentag (0 = Montag, ..., 6 = Sonntag)
|
||||
function mondaykw($kw, $jahr, $weekday) {
|
||||
$firstmonday = firstkw($jahr);
|
||||
$mon_monat = date('m',$firstmonday);
|
||||
$mon_jahr = date('Y',$firstmonday);
|
||||
$mon_tage = date('d',$firstmonday);
|
||||
$tage = ($kw-1)*7;
|
||||
$daykw = mktime(0,0,0,$mon_monat,$mon_tage+$tage+$weekday,$mon_jahr);
|
||||
return $daykw;
|
||||
}
|
||||
|
||||
// Berechnet Termin am Wochentag (0 = Montag, ..., 6 = Sonntag) in Kalenderwoche zum Datum
|
||||
function geaenderterWochentag($datum, $wochentag) {
|
||||
$wtag = date('w', $datum);
|
||||
if ($wtag == 0) // Sonntag
|
||||
$wtag = 7;
|
||||
$mon_monat = date('m', $datum);
|
||||
$mon_jahr = date('Y', $datum);
|
||||
$mon_tage = date('d', $datum);
|
||||
return mktime(0,0,0, $mon_monat, $mon_tage + 1 - $wtag + $wochentag, $mon_jahr);
|
||||
}
|
||||
|
||||
function normalisiertesDatum($datum) {
|
||||
if ($datum == NULL)
|
||||
return NULL;
|
||||
|
||||
if (strpos($datum, "-") !== false)
|
||||
$trennzeichen = "-";
|
||||
else
|
||||
$trennzeichen = ".";
|
||||
|
||||
$t = explode($trennzeichen, $datum);
|
||||
$n = count($t);
|
||||
if ($n == 1) {
|
||||
$s = $t[0];
|
||||
if (strlen($s) < 8)
|
||||
return NULL;
|
||||
$jahr = intval(substr($s, 0, 4));
|
||||
$monat = intval(substr($s, 4, 2));
|
||||
$tag = intval(substr($s, 6, 2));
|
||||
}
|
||||
else if ($n == 3) {
|
||||
if ($trennzeichen != ".") {
|
||||
$jahr = intval($t[0]);
|
||||
if (strlen($t[0]) <= 2)
|
||||
$jahr += 1900;
|
||||
$monat = intval($t[1]);
|
||||
$tag = intval($t[2]);
|
||||
}
|
||||
else {
|
||||
$tag = intval($t[0]);
|
||||
$monat = intval($t[1]);
|
||||
$jahr = intval($t[2]);
|
||||
if (strlen($t[2]) <= 2)
|
||||
$jahr += 1900;
|
||||
}
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
if (!checkdate($monat, $tag, $jahr))
|
||||
return NULL;
|
||||
|
||||
return sprintf("%04d-%02d-%02d", $jahr, $monat, $tag);;
|
||||
}
|
||||
|
||||
function normalisierteUhrzeit($uhrzeit) {
|
||||
if ($uhrzeit == NULL)
|
||||
return NULL;
|
||||
|
||||
if (strpos($uhrzeit, "-") !== FALSE)
|
||||
$trennzeichen = "-";
|
||||
else
|
||||
$trennzeichen = ":";
|
||||
|
||||
$t = explode($trennzeichen, $uhrzeit);
|
||||
$n = count($t);
|
||||
if ($n == 1) {
|
||||
$s = $t[0];
|
||||
$len = strlen($s);
|
||||
if ($len != 4 && $len != 6)
|
||||
return NULL;
|
||||
$stunden = intval(substr($s, 0, 2));
|
||||
$minuten = intval(substr($s, 2, 2));
|
||||
$sekunden = $len != 6 ? 0 : intval(substr($s, 4, 2));
|
||||
}
|
||||
else if ($n == 2 || $n == 3) {
|
||||
$stunden = intval($t[0]);
|
||||
$minuten = intval($t[1]);
|
||||
$sekunden = $n != 3 ? 0 : intval($t[2]);
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
if ($stunden < 0 || $stunden > 23 || $minuten < 0 || $minuten > 59 || $sekunden < 0 || $sekunden > 59)
|
||||
return NULL;
|
||||
|
||||
return sprintf("%02d:%02d:%02d", $stunden, $minuten, $sekunden);;
|
||||
}
|
||||
|
||||
function runden_detailliert_invers($runden) {
|
||||
if ($runden == null)
|
||||
return null;
|
||||
$runden_invers = "";
|
||||
$saetze = explode(" ", $runden);
|
||||
foreach ($saetze as $satz) {
|
||||
$punkte = explode(":", $satz);
|
||||
if (!empty($runden_invers))
|
||||
$runden_invers .= " ";
|
||||
$runden_invers .= $punkte[1] . ":" . $punkte[0];
|
||||
}
|
||||
return $runden_invers;
|
||||
}
|
||||
|
||||
function runden_detailliert_auswertung($runden) {
|
||||
$ergebnis = 0;
|
||||
$heim_saetze = 0;
|
||||
$unentschieden_saetze = 0;
|
||||
$gast_saetze = 0;
|
||||
$heim_punkte = 0;
|
||||
$gast_punkte = 0;
|
||||
if ($runden != null) {
|
||||
$saetze = explode(" ", $runden);
|
||||
foreach ($saetze as $satz) {
|
||||
$punkte = explode(":", $satz);
|
||||
$heim_punkte += (int)$punkte[0];
|
||||
$gast_punkte += (int)$punkte[1];
|
||||
if ($punkte[0] > $punkte[1])
|
||||
$heim_saetze++;
|
||||
else if ($punkte[0] < $punkte[1])
|
||||
$gast_saetze++;
|
||||
else
|
||||
$unentschieden_saetze++;
|
||||
}
|
||||
if ($heim_saetze > $gast_saetze)
|
||||
$ergebnis = 1;
|
||||
else if ($heim_saetze < $gast_saetze)
|
||||
$ergebnis = 2;
|
||||
}
|
||||
return array($ergebnis, $heim_saetze, $unentschieden_saetze, $gast_saetze, $heim_punkte, $gast_punkte);
|
||||
}
|
||||
|
||||
// pass two file names
|
||||
// returns TRUE if files are the same, FALSE otherwise
|
||||
function files_identical($fn1, $fn2) {
|
||||
if(!is_file($fn1) || !is_file($fn2))
|
||||
return FALSE;
|
||||
|
||||
if(filesize($fn1) !== filesize($fn2))
|
||||
return FALSE;
|
||||
|
||||
if(!$fp1 = fopen($fn1, 'rb'))
|
||||
return FALSE;
|
||||
|
||||
if(!$fp2 = fopen($fn2, 'rb')) {
|
||||
fclose($fp1);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$same = TRUE;
|
||||
while (!feof($fp1) and !feof($fp2))
|
||||
if(fread($fp1, 4096) !== fread($fp2, 4096)) {
|
||||
$same = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if(feof($fp1) !== feof($fp2))
|
||||
$same = FALSE;
|
||||
|
||||
fclose($fp1);
|
||||
fclose($fp2);
|
||||
|
||||
return $same;
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=Dieser Ordner wird online freigegeben.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,143 @@
|
||||
--Do not remove this if you are using--
|
||||
Original Author: Remiz Rahnas
|
||||
Original Author URL: http://www.htmlremix.com
|
||||
Published date: 2008/09/24
|
||||
|
||||
Changes by Nick Fetchak:
|
||||
- IE8 standards mode compatibility
|
||||
- VML elements now positioned behind original box rather than inside of it - should be less prone to breakage
|
||||
Published date : 2009/11/18
|
||||
|
||||
|
||||
<public:attach event="oncontentready" onevent="oncontentready('v08vnSVo78t4JfjH')" />
|
||||
<script type="text/javascript">
|
||||
|
||||
// findPos() borrowed from http://www.quirksmode.org/js/findpos.html
|
||||
function findPos(obj) {
|
||||
var curleft = curtop = 0;
|
||||
|
||||
if (obj.offsetParent) {
|
||||
do {
|
||||
curleft += obj.offsetLeft;
|
||||
curtop += obj.offsetTop;
|
||||
} while (obj = obj.offsetParent);
|
||||
}
|
||||
|
||||
return({
|
||||
'x': curleft,
|
||||
'y': curtop
|
||||
});
|
||||
}
|
||||
|
||||
function oncontentready(classID) {
|
||||
if (this.className.match(classID)) { return(false); }
|
||||
|
||||
if (!document.namespaces.v) { document.namespaces.add("v", "urn:schemas-microsoft-com:vml"); }
|
||||
|
||||
this.className = this.className.concat(' ', classID);
|
||||
var arcSize = Math.min(parseInt(this.currentStyle['-moz-border-radius'] ||
|
||||
this.currentStyle['-webkit-border-radius'] ||
|
||||
this.currentStyle['border-radius'] ||
|
||||
this.currentStyle['-khtml-border-radius']) /
|
||||
Math.min(this.offsetWidth, this.offsetHeight), 1);
|
||||
var fillColor = this.currentStyle.backgroundColor;
|
||||
var fillSrc = this.currentStyle.backgroundImage.replace(/^url\("(.+)"\)$/, '$1');
|
||||
var strokeColor = this.currentStyle.borderColor;
|
||||
var strokeWeight = parseInt(this.currentStyle.borderWidth);
|
||||
var stroked = 'true';
|
||||
if (isNaN(strokeWeight)) {
|
||||
strokeWeight = 0;
|
||||
strokeColor = fillColor;
|
||||
stroked = 'false';
|
||||
}
|
||||
|
||||
this.style.background = 'transparent';
|
||||
this.style.borderColor = 'transparent';
|
||||
|
||||
// Find which element provides position:relative for the target element (default to BODY)
|
||||
var el = this;
|
||||
var limit = 100, i = 0;
|
||||
while ((typeof(el) != 'unknown') && (el.currentStyle.position != 'relative') && (el.tagName != 'BODY')) {
|
||||
el = el.parentElement;
|
||||
i++;
|
||||
if (i >= limit) { return(false); }
|
||||
}
|
||||
var el_zindex = parseInt(el.currentStyle.zIndex);
|
||||
if (isNaN(el_zindex)) { el_zindex = 0; }
|
||||
//alert('got tag '+ el.tagName +' with pos '+ el.currentStyle.position);
|
||||
|
||||
var rect_size = {
|
||||
'width': this.offsetWidth - strokeWeight,
|
||||
'height': this.offsetHeight - strokeWeight
|
||||
};
|
||||
var el_pos = findPos(el);
|
||||
var this_pos = findPos(this);
|
||||
this_pos.y = this_pos.y + (0.5 * strokeWeight) - el_pos.y;
|
||||
this_pos.x = this_pos.x + (0.5 * strokeWeight) - el_pos.x;
|
||||
|
||||
var rect = document.createElement('v:roundrect');
|
||||
rect.arcsize = arcSize +'px';
|
||||
rect.strokecolor = strokeColor;
|
||||
rect.strokeWeight = strokeWeight +'px';
|
||||
rect.stroked = stroked;
|
||||
rect.style.display = 'block';
|
||||
rect.style.position = 'absolute';
|
||||
rect.style.top = this_pos.y +'px';
|
||||
rect.style.left = this_pos.x +'px';
|
||||
rect.style.width = rect_size.width +'px';
|
||||
rect.style.height = rect_size.height +'px';
|
||||
rect.style.antialias = true;
|
||||
rect.style.zIndex = el_zindex - 1;
|
||||
|
||||
var fill = document.createElement('v:fill');
|
||||
fill.color = fillColor;
|
||||
fill.src = fillSrc;
|
||||
fill.type = 'tile';
|
||||
|
||||
rect.appendChild(fill);
|
||||
el.appendChild(rect);
|
||||
|
||||
var css = el.document.createStyleSheet();
|
||||
css.addRule("v\\:roundrect", "behavior: url(#default#VML)");
|
||||
css.addRule("v\\:fill", "behavior: url(#default#VML)");
|
||||
|
||||
isIE6 = /msie|MSIE 6/.test(navigator.userAgent);
|
||||
// IE6 doesn't support transparent borders, use padding to offset original element
|
||||
if (isIE6 && (strokeWeight > 0)) {
|
||||
this.style.borderStyle = 'none';
|
||||
this.style.paddingTop = parseInt(this.currentStyle.paddingTop || 0) + strokeWeight;
|
||||
this.style.paddingBottom = parseInt(this.currentStyle.paddingBottom || 0) + strokeWeight;
|
||||
}
|
||||
|
||||
if (typeof(window.rounded_elements) == 'undefined') {
|
||||
window.rounded_elements = new Array();
|
||||
|
||||
if (typeof(window.onresize) == 'function') { window.previous_onresize = window.onresize; }
|
||||
window.onresize = window_resize;
|
||||
}
|
||||
this.element.vml = rect;
|
||||
window.rounded_elements.push(this.element);
|
||||
}
|
||||
|
||||
function window_resize() {
|
||||
if (typeof(window.rounded_elements) == 'undefined') { return(false); }
|
||||
|
||||
for (var i in window.rounded_elements) {
|
||||
var el = window.rounded_elements[i];
|
||||
|
||||
var strokeWeight = parseInt(el.currentStyle.borderWidth);
|
||||
if (isNaN(strokeWeight)) { strokeWeight = 0; }
|
||||
|
||||
var parent_pos = findPos(el.vml.parentNode);
|
||||
var pos = findPos(el);
|
||||
pos.y = pos.y + (0.5 * strokeWeight) - parent_pos.y;
|
||||
pos.x = pos.x + (0.5 * strokeWeight) - parent_pos.x;
|
||||
|
||||
el.vml.style.top = pos.y +'px';
|
||||
el.vml.style.left = pos.x +'px';
|
||||
}
|
||||
|
||||
if (typeof(window.previous_onresize) == 'function') { window.previous_onresize(); }
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=Dieser Ordner wird online freigegeben.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<view title="Inhalt">
|
||||
<message>Wählen Sie ein Layout für den Inhalt</message>
|
||||
</view>
|
||||
</metadata>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
/* Sven Nickel - Jun. 2009 */
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
?>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<layout title="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_TITLE">
|
||||
<message><![CDATA[COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_DESC]]></message>
|
||||
</layout>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field name="content"
|
||||
type="list"
|
||||
default=""
|
||||
label="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CONTENT"
|
||||
description="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CONTENT_DESC">
|
||||
<option value="administration"><![CDATA[COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_ADMINISTRATION]]></option>
|
||||
<option value="mannschaftswettbewerbe"><![CDATA[COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_TEAM_COMPETITIONS]]></option>
|
||||
<option value="aktuelle_begegnungen"><![CDATA[COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CURRENT_TEAM_MATCHES]]></option>
|
||||
<option value="aktuelle_begegnungen_pin"><![CDATA[COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CURRENT_TEAM_MATCHES_WITH_PIN]]></option>
|
||||
<option value="spielerstatistiken"><![CDATA[COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_PLAYER_STATISTICS]]></option>
|
||||
<option value="turniere"><![CDATA[COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_TOURNAMENTS]]></option>
|
||||
<option value="turniervoranmeldungen"><![CDATA[COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_TOURNAMENT_REGISTRATIONS]]></option>
|
||||
<option value="ranglisten"><![CDATA[COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_RANKINGS]]></option>
|
||||
<option value="players"><![CDATA[COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_PLAYERS]]></option>
|
||||
<option value="teams"><![CDATA[COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_TEAMS_GROUPED]]></option>
|
||||
<option value="teams_vereinigt"><![CDATA[COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_TEAMS_JOINT]]></option>
|
||||
<option value="vereine"><![CDATA[COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CLUBS]]></option>
|
||||
<option value="spielorte"><![CDATA[COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_VENUES]]></option>
|
||||
<option value="termine"><![CDATA[COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_APPOINTMENTS]]></option>
|
||||
</field>
|
||||
<field name="titel"
|
||||
type="text"
|
||||
default=""
|
||||
label="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_TITLE"
|
||||
description="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_TITLE_DESC" />
|
||||
<field name="beschreibung"
|
||||
type="textarea"
|
||||
default=""
|
||||
cols="40"
|
||||
rows="10"
|
||||
label="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_DESCRIPTION"
|
||||
description="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_DESCRIPTION_DESC" />
|
||||
<field name="kategorien"
|
||||
type="text"
|
||||
default=""
|
||||
label="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CATEGORIES"
|
||||
description="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CATEGORIES_DESC" />
|
||||
</fieldset>
|
||||
</fields>
|
||||
</metadata>
|
||||
@@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=Dieser Ordner wird online freigegeben.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
/* Sven Nickel - Jun. 2009 */
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
?>
|
||||
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<layout title="COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_TITLE">
|
||||
<message><![CDATA[COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_DESC]]></message>
|
||||
</layout>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field name="content"
|
||||
type="list"
|
||||
default=""
|
||||
label="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CONTENT"
|
||||
description="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CONTENT_DESC">
|
||||
<option value="elorangliste"><![CDATA[COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_ELO_RANKING]]></option>
|
||||
</field>
|
||||
<field name="typ"
|
||||
type="list"
|
||||
default=""
|
||||
label="COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_TYPE"
|
||||
description="COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_ELO_RATING">
|
||||
<option value="beide"><![CDATA[COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_BOTH]]></option>
|
||||
<option value="einzel"><![CDATA[COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_SINGLES]]></option>
|
||||
<option value="doppel"><![CDATA[COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_DOUBLES]]></option>
|
||||
</field>
|
||||
<field name="kategorie_alle"
|
||||
type="list"
|
||||
default="aus"
|
||||
label="COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_CATEGORY_ALL"
|
||||
description="COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_SHOWN_PLAYER_CATEGORY">
|
||||
<option value="an"><![CDATA[COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_SHOW]]></option>
|
||||
<option value="aus"><![CDATA[COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_HIDE]]></option>
|
||||
</field>
|
||||
<field name="kategorie_herren"
|
||||
type="list"
|
||||
default="an"
|
||||
label="COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_CATEGORY_MEN"
|
||||
description="COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_SHOWN_PLAYER_CATEGORY">
|
||||
<option value="an"><![CDATA[COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_SHOW]]></option>
|
||||
<option value="aus"><![CDATA[COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_HIDE]]></option>
|
||||
</field>
|
||||
<field name="kategorie_damen"
|
||||
type="list"
|
||||
default="an"
|
||||
label="COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_CATEGORY_WOMEN"
|
||||
description="COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_SHOWN_PLAYER_CATEGORY">
|
||||
<option value="an"><![CDATA[COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_SHOW]]></option>
|
||||
<option value="aus"><![CDATA[COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_HIDE]]></option>
|
||||
</field>
|
||||
<field name="kategorie_junioren"
|
||||
type="list"
|
||||
default="an"
|
||||
label="COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_CATEGORY_JUNIORS"
|
||||
description="COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_SHOWN_PLAYER_CATEGORY">
|
||||
<option value="an"><![CDATA[COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_SHOW]]></option>
|
||||
<option value="aus"><![CDATA[COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_HIDE]]></option>
|
||||
</field>
|
||||
<field name="kategorie_senioren"
|
||||
type="list"
|
||||
default="an"
|
||||
label="COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_CATEGORY_SENIORS"
|
||||
description="COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_SHOWN_PLAYER_CATEGORY">
|
||||
<option value="an"><![CDATA[COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_SHOW]]></option>
|
||||
<option value="aus"><![CDATA[COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_HIDE]]></option>
|
||||
</field>
|
||||
<field name="kategorie_einstufung_herrendamen"
|
||||
type="list"
|
||||
default="inklusive"
|
||||
label="COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_CLASSIFICATION_MEN_WOMEN"
|
||||
description="COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_MEN_WOMEN_REGARDING_JUNIORS_SENIORS">
|
||||
<option value="inklusive"><![CDATA[COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_INCLUDING_JUNIORS_SENIORS]]></option>
|
||||
<option value="ohne"><![CDATA[COM_SPORTSMANAGER_LAYOUT_ELO_RANKING_OPTION_WITHOUT_JUNIORS_SENIORS]]></option>
|
||||
</field>
|
||||
<field name="titel"
|
||||
type="text"
|
||||
default=""
|
||||
label="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_TITLE"
|
||||
description="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_TITLE_DESC" />
|
||||
<field name="beschreibung"
|
||||
type="textarea"
|
||||
default=""
|
||||
cols="40"
|
||||
rows="10"
|
||||
label="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_DESCRIPTION"
|
||||
description="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_DESCRIPTION_DESC" />
|
||||
<field name="kategorien"
|
||||
type="text"
|
||||
default=""
|
||||
label="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CATEGORIES"
|
||||
description="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CATEGORIES_DESC" />
|
||||
</fieldset>
|
||||
</fields>
|
||||
</metadata>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
/* Sven Nickel - Jun. 2009 */
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
?>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<layout title="COM_SPORTSMANAGER_LAYOUT_INDIVIDUAL_COMPETITION_TITLE">
|
||||
<message><![CDATA[COM_SPORTSMANAGER_LAYOUT_INDIVIDUAL_COMPETITION_DESC]]></message>
|
||||
</layout>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field name="content"
|
||||
type="list"
|
||||
default=""
|
||||
label="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CONTENT"
|
||||
description="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CONTENT_DESC">
|
||||
<option value="individualwettbewerbe"><![CDATA[COM_SPORTSMANAGER_LAYOUT_INDIVIDUAL_COMPETITION_OPTION_INDIVIDUAL_COMPETITIONS]]></option>
|
||||
</field>
|
||||
<field name="ansicht"
|
||||
type="list"
|
||||
default=""
|
||||
label="COM_SPORTSMANAGER_LAYOUT_INDIVIDUAL_COMPETITION_OPTION_VIEW"
|
||||
description="COM_SPORTSMANAGER_LAYOUT_INDIVIDUAL_COMPETITION_OPTION_VIEW_DESC">
|
||||
<option value=""><![CDATA[COM_SPORTSMANAGER_LAYOUT_INDIVIDUAL_COMPETITION_OPTION_GROUPED_BY_COMPETITION]]></option>
|
||||
<option value="spiele"><![CDATA[COM_SPORTSMANAGER_LAYOUT_INDIVIDUAL_COMPETITION_OPTION_GAMES_JOINT]]></option>
|
||||
</field>
|
||||
<field name="titel"
|
||||
type="text"
|
||||
default=""
|
||||
label="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_TITLE"
|
||||
description="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_TITLE_DESC" />
|
||||
<field name="beschreibung"
|
||||
type="textarea"
|
||||
default=""
|
||||
cols="40"
|
||||
rows="10"
|
||||
label="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_DESCRIPTION"
|
||||
description="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_DESCRIPTION_DESC" />
|
||||
<field name="kategorien"
|
||||
type="text"
|
||||
default=""
|
||||
label="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CATEGORIES"
|
||||
description="COM_SPORTSMANAGER_LAYOUT_GENERAL_CONTENT_OPTION_CATEGORIES_DESC" />
|
||||
</fieldset>
|
||||
</fields>
|
||||
</metadata>
|
||||
@@ -0,0 +1,337 @@
|
||||
<?php
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
require_once(JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'views/sportsmanager/view_tools.php');
|
||||
|
||||
|
||||
class JSON_sportsmanager {
|
||||
|
||||
static function mannschaften($veranstaltung, $rows) {
|
||||
$teams = [];
|
||||
foreach ($rows as $team) {
|
||||
$team->teambild = teamImage($team->team_id, $team->verein_id);
|
||||
$teams[] = $team;
|
||||
}
|
||||
if ($veranstaltung == null) {
|
||||
return $teams;
|
||||
}
|
||||
|
||||
return [
|
||||
'veranstaltung' => $veranstaltung,
|
||||
'teams' => $teams,
|
||||
];
|
||||
}
|
||||
|
||||
static function tabelleAnzeigen($veranstaltung, $modus, $teams, $spieltag, $spieltage, $alleine_angezeigt, $praesentation) {
|
||||
foreach ($teams as $team) {
|
||||
$team->teambild = teamImage($team->team_id, $team->verein_id);
|
||||
}
|
||||
|
||||
return [
|
||||
'tabelle' => $teams,
|
||||
'modus' => $modus,
|
||||
];
|
||||
}
|
||||
|
||||
static function tabelleEigeneAnzeigen($veranstaltung, $modus, $teams, $alleine_angezeigt, $praesentation) {
|
||||
foreach($teams as $team) {
|
||||
$team->teambild = teamImage($team->team_id, $team->verein_id);
|
||||
}
|
||||
return [
|
||||
'tabelle' => $teams,
|
||||
'modus' => $modus,
|
||||
];
|
||||
}
|
||||
|
||||
static function _getPlayerDetails($game, $home_player_map, $away_player_map) {
|
||||
// TODO dynamisch machen
|
||||
$game->heim_spieler_1_vorname = isset($home_player_map[$game->heim_spieler_1_id])
|
||||
? $home_player_map[$game->heim_spieler_1_id]->vorname
|
||||
: NULL;
|
||||
$game->heim_spieler_1_nachname = isset($home_player_map[$game->heim_spieler_1_id])
|
||||
? $home_player_map[$game->heim_spieler_1_id]->nachname
|
||||
: NULL;
|
||||
$game->heim_spieler_1_bild = isset($home_player_map[$game->heim_spieler_1_id])
|
||||
? $home_player_map[$game->heim_spieler_1_id]->bild
|
||||
: NULL;
|
||||
|
||||
$game->heim_spieler_2_vorname = isset($home_player_map[$game->heim_spieler_2_id])
|
||||
? $home_player_map[$game->heim_spieler_2_id]->vorname
|
||||
: NULL;
|
||||
$game->heim_spieler_2_nachname = isset($home_player_map[$game->heim_spieler_2_id])
|
||||
? $home_player_map[$game->heim_spieler_2_id]->nachname
|
||||
: NULL;
|
||||
$game->heim_spieler_2_bild = isset($home_player_map[$game->heim_spieler_2_id])
|
||||
? $home_player_map[$game->heim_spieler_2_id]->bild
|
||||
: NULL;
|
||||
|
||||
$game->gast_spieler_1_vorname = isset($away_player_map[$game->gast_spieler_1_id])
|
||||
? $away_player_map[$game->gast_spieler_1_id]->vorname
|
||||
: NULL;
|
||||
$game->gast_spieler_1_nachname = isset($away_player_map[$game->gast_spieler_1_id])
|
||||
? $away_player_map[$game->gast_spieler_1_id]->nachname
|
||||
: NULL;
|
||||
$game->gast_spieler_1_bild = isset($away_player_map[$game->gast_spieler_1_id])
|
||||
? $away_player_map[$game->gast_spieler_1_id]->bild
|
||||
: NULL;
|
||||
|
||||
$game->gast_spieler_2_vorname = isset($away_player_map[$game->gast_spieler_2_id])
|
||||
? $away_player_map[$game->gast_spieler_2_id]->vorname
|
||||
: NULL;
|
||||
$game->gast_spieler_2_nachname = isset($away_player_map[$game->gast_spieler_2_id])
|
||||
? $away_player_map[$game->gast_spieler_2_id]->nachname
|
||||
: NULL;
|
||||
$game->gast_spieler_2_bild = isset($away_player_map[$game->gast_spieler_2_id])
|
||||
? $away_player_map[$game->gast_spieler_2_id]->bild
|
||||
: NULL;
|
||||
|
||||
}
|
||||
|
||||
static function adminEditBegegnungSpielplan($bestaetigen, $veranstaltung, $begegnung, $heim_team, $gast_team, $spiele, $heim_spieler, $gast_spieler, $teamspiel_modus, $encrypted_pin, $count_verlegen_aktionen, $erneut_oeffnen, $aus_uebersicht) {
|
||||
$heim_team->teambild = teamImage($heim_team->team_id, $heim_team->verein_id);
|
||||
$gast_team->teambild = teamImage($gast_team->team_id, $gast_team->verein_id);
|
||||
$heim_spieler_map = [];
|
||||
$gast_spieler_map = [];
|
||||
foreach ($heim_spieler as $player) {
|
||||
$player->bild = playerImage($player->spieler_id, $player->geschlecht);
|
||||
$heim_spieler_map[$player->spieler_id] = $player;
|
||||
}
|
||||
foreach ($gast_spieler as $player) {
|
||||
$player->bild = playerImage($player->spieler_id, $player->geschlecht);
|
||||
$gast_spieler_map[$player->spieler_id] = $player;
|
||||
}
|
||||
$begegnung->bezeichnung = $veranstaltung->bezeichnung;
|
||||
$begegnung->veranstaltung_id = $veranstaltung->veranstaltung_id;
|
||||
foreach ($spiele as $game) {
|
||||
self::_getPlayerDetails($game, $heim_spieler_map, $gast_spieler_map);
|
||||
}
|
||||
$begegnung->spieltag = Rundenbezeichnung($begegnung->spieltag, $veranstaltung->unterteilung == 0);
|
||||
return [
|
||||
'bestaetigen' => $bestaetigen,
|
||||
'veranstaltung' => $veranstaltung,
|
||||
'begegnung' => $begegnung,
|
||||
'heim_team' => $heim_team,
|
||||
'gast_team' => $gast_team,
|
||||
'spiele' => $spiele,
|
||||
'heim_spieler' => $heim_spieler,
|
||||
'gast_spieler' => $gast_spieler,
|
||||
'modus' => $teamspiel_modus,
|
||||
];
|
||||
}
|
||||
|
||||
static function mannschaftDetails($veranstaltung, $team, $mitglieder, $mailverteiler, $mitglieder_statistiken, $teamansprechpartner, $begegnungen, $vorheriges_team_id, $naechstes_team_id, $team_moderator, $details_anzeigen, $ansprechpartner_anzeigen, $weitere_veranstaltungen, $veranstaltungsbezeichnungen, $spielberechtigungen, $ansicht_vereinigt, $ist_vergangen) {
|
||||
global $sportsmanager_joomla_path;
|
||||
global $sportsmanager_joomla_url;
|
||||
|
||||
$team->teambild = teamImage($team->team_id, $team->verein_id);
|
||||
$team->color = getColorOfImage(str_replace($sportsmanager_joomla_url, $sportsmanager_joomla_path . '/', $team->teambild));
|
||||
foreach ($mitglieder as $m) {
|
||||
$m->bild = playerImage($m->spieler_id, $m->geschlecht);
|
||||
}
|
||||
foreach ($begegnungen as $begegnung) {
|
||||
$begegnung->heim_name = $begegnung->auswaerts == '1' ? $begegnung->gegner : $team->teamname;
|
||||
$begegnung->heim_teamgruppe = $begegnung->auswaerts == '1' ? $begegnung->gegner_teamgruppe_id : $team->teamgruppe_id;
|
||||
$begegnung->gast_name = $begegnung->auswaerts == '1' ? $team->teamname : $begegnung->gegner;
|
||||
$begegnung->gast_teamgruppe = $begegnung->auswaerts == '1' ? $team->teamgruppe_id : $begegnung->gegner_teamgruppe_id;
|
||||
$begegnung->spielort_name = $begegnung->heimspielort_name;
|
||||
$begegnung->heim_bild = $begegnung->auswaerts == '1' ? teamImage($begegnung->gegner_id, $begegnung->gegner_verein_id) : teamImage($team->team_id, $team->verein_id);
|
||||
$begegnung->gast_bild = $begegnung->auswaerts == '1' ? teamImage($team->team_id, $team->verein_id) : teamImage($begegnung->gegner_id, $begegnung->gegner_verein_id);
|
||||
$begegnung->bezeichnung = $veranstaltungsbezeichnungen[$begegnung->veranstaltung_id];
|
||||
$begegnung->spieltag = Rundenbezeichnung($begegnung->spieltag, $veranstaltung->unterteilung == 0);
|
||||
}
|
||||
|
||||
if (getUserID() == 0 && $ansprechpartner_anzeigen) {
|
||||
foreach ($teamansprechpartner as $ansprechpartner) {
|
||||
unset($ansprechpartner->mobil);
|
||||
unset($ansprechpartner->telefon);
|
||||
}
|
||||
}
|
||||
|
||||
$team->veranstaltung_name = $veranstaltungsbezeichnungen[$team->veranstaltung_id];
|
||||
return [
|
||||
'team' => $team,
|
||||
'mitglieder' => $mitglieder,
|
||||
'kontakt' => $ansprechpartner_anzeigen ? $teamansprechpartner : NULL,
|
||||
'begegnungen' => $begegnungen
|
||||
];
|
||||
}
|
||||
|
||||
static function JSON($data, $meta = NULL) {
|
||||
$response = [
|
||||
'data' => $data
|
||||
];
|
||||
if ($meta != NULL) {
|
||||
$response['meta'] = $meta;
|
||||
}
|
||||
header('Content-Type: application/json; charset=utf-8', true);
|
||||
echo json_encode($response);
|
||||
jexit();
|
||||
}
|
||||
|
||||
static function spielerstatistik($spielerstatistik, $spielerstatistik_punkte, $allein_angezeigt, $filter_saison_id, $vorherige_spielerstatistik_id, $naechste_spielerstatistik_id, $details_anzeigen) {
|
||||
$rank = 1;
|
||||
foreach ($spielerstatistik_punkte as $s) {
|
||||
$s->spieler_bild = playerImage($s->spieler_id, $s->geschlecht);
|
||||
$s->spieler_2_bild= playerImage($s->spieler_2_id, $s->geschlecht_2);
|
||||
$s->quote = ($s->spielpunkte_gewonnen > 0 || $s->spielpunkte_verloren > 0)
|
||||
? round($s->spielpunkte_gewonnen * 100 / ($s->spielpunkte_gewonnen + $s->spielpunkte_verloren), 0) . '%'
|
||||
: '-';
|
||||
$s->rank = '' . $rank;
|
||||
$rank++;
|
||||
}
|
||||
self::JSON($spielerstatistik_punkte);
|
||||
}
|
||||
|
||||
static function spielerDetails($spieler, $vereine, $veranstalter, $spieler_elo_verlauf_einzel, $spieler_elo_verlauf_doppel, $spielerNamen, $teamNamen, $veranstaltungBezeichnungen, $turnierdisziplinBezeichnungen, $individualwettbewerbBezeichnungen, $ranglistenplatzierungen, $turnierplatzierungen, $teams, $sortierung, $vorheriger_spieler_id, $naechster_spieler_id, $elo_detailliert, $statistik, $beginn, $kategorie, $einstufungen, $filter, $veranstaltungid, $veranstalterid, $einstufungid, $unabhaengige_ansicht, $details_anzeigen) {
|
||||
$letzte_einzel = [];
|
||||
$spieler->bild = playerImage($spieler->spieler_id, $spieler->geschlecht);
|
||||
for ($i = sizeof($spieler_elo_verlauf_einzel) - 1; $i >= max(sizeof($spieler_elo_verlauf_einzel)-10, 0); $i--) {
|
||||
$e = $spieler_elo_verlauf_einzel[$i];
|
||||
$letzte_einzel[] = [
|
||||
'datum' => $e['z'],
|
||||
'spieler_1' => isset($spielerNamen[$e['h1']]) ? [
|
||||
'spieler_id' => $e['h1'],
|
||||
'bild' => playerImage($e['h1'], 'M'),
|
||||
'vorname' => explode(', ',$spielerNamen[$e['h1']])[1],
|
||||
'nachname' => explode(', ',$spielerNamen[$e['h1']])[0],
|
||||
] : NULL,
|
||||
'spieler_team' => isset($e['th']) ? [
|
||||
'id' => $e['th'],
|
||||
'name' => $teamNamen[$e['th']],
|
||||
]: NULL,
|
||||
'gegner_1' => isset($spielerNamen[$e['g1']]) ? [
|
||||
'spieler_id' => $e['g1'],
|
||||
'bild' => playerImage($e['g1'], 'M'),
|
||||
'vorname' => explode(', ', $spielerNamen[$e['g1']])[1],
|
||||
'nachname' => explode(', ', $spielerNamen[$e['g1']])[0],
|
||||
] : NULL,
|
||||
'gegner_team' => isset($e['th']) && isset($e['tg']) ?
|
||||
[
|
||||
'id' => $e['tg'],
|
||||
'name' => $teamNamen[$e['tg']],
|
||||
] : NULL,
|
||||
'veranstaltung' => isset($e['v'])
|
||||
? $veranstaltungBezeichnungen[$e['v']]
|
||||
: (isset($e['t'])
|
||||
? $turnierdisziplinBezeichnungen[$e['t']]
|
||||
: $individualwettbewerbBezeichnungen[$e['i']]),
|
||||
'runde' => Rundenbezeichnung(abs($e['r']), isset($e['u']) && $e['u'] == 0),
|
||||
'runde_stufe' => !isset($e['u']) ? rundenstufe($e['rs']) : NULL,
|
||||
'ergebnis' => $e['s'],
|
||||
];
|
||||
}
|
||||
$letzte_doppel = [];
|
||||
for ($i = sizeof($spieler_elo_verlauf_doppel) - 1; $i >= max(sizeof($spieler_elo_verlauf_doppel) - 10, 0); $i--) {
|
||||
$d = $spieler_elo_verlauf_doppel[$i];
|
||||
$letzte_doppel[] = [
|
||||
'datum' => $d['z'],
|
||||
'spieler_1' => isset($spielerNamen[$d['h1']]) ? [
|
||||
'spieler_id' => $d['h1'],
|
||||
'bild' => playerImage($d['h1'], 'M'),
|
||||
'vorname' => explode(', ', $spielerNamen[$d['h1']])[1],
|
||||
'nachname' => explode(', ', $spielerNamen[$d['h1']])[0],
|
||||
] : NULL,
|
||||
'spieler_2' => isset($spielerNamen[$d['h2']]) ? [
|
||||
'spieler_id' => $d['h2'],
|
||||
'bild' => playerImage($d['h2'], 'M'),
|
||||
'vorname' => explode(', ', $spielerNamen[$d['h2']])[1],
|
||||
'nachname' => explode(', ', $spielerNamen[$d['h2']])[0],
|
||||
] : NULL,
|
||||
'spieler_team' => isset($d['th']) ? [
|
||||
'id' => $d['th'],
|
||||
'name' => $teamNamen[$d['th']],
|
||||
] : NULL,
|
||||
'gegner_1' => isset($spielerNamen[$d['g1']]) ? [
|
||||
'spieler_id' => $d['g1'],
|
||||
'bild' => playerImage($d['g1'], 'M'),
|
||||
'vorname' => explode(', ', $spielerNamen[$d['g1']])[1],
|
||||
'nachname' => explode(', ', $spielerNamen[$d['g1']])[0],
|
||||
] : NULL,
|
||||
'gegner_2' => isset($spielerNamen[$d['g2']]) ? [
|
||||
'spieler_id' => $d['g2'],
|
||||
'bild' => playerImage($d['g2'], 'M'),
|
||||
'vorname' => explode(', ', $spielerNamen[$d['g2']])[1],
|
||||
'nachname' => explode(', ', $spielerNamen[$d['g2']])[0],
|
||||
]: NULL,
|
||||
'gegner_team' => isset($d['th']) && isset($d['tg']) ?
|
||||
[
|
||||
'id' => $d['tg'],
|
||||
'name' => $teamNamen[$d['tg']],
|
||||
] : NULL,
|
||||
'veranstaltung' => isset($d['v'])
|
||||
? $veranstaltungBezeichnungen[$d['v']]
|
||||
: (isset($d['t'])
|
||||
? $turnierdisziplinBezeichnungen[$d['t']]
|
||||
: $individualwettbewerbBezeichnungen[$d['i']]),
|
||||
'runde' => Rundenbezeichnung(abs($d['r']), isset($d['u']) && $d['u'] == 0),
|
||||
'runde_stufe' => !isset($d['u']) ? rundenstufe($d['rs']) : NULL,
|
||||
'ergebnis' => $d['s'],
|
||||
];
|
||||
}
|
||||
self::JSON([
|
||||
'spieler' => $spieler,
|
||||
'vereine' => $vereine,
|
||||
'teams' => $teams,
|
||||
'veranstalter'=> $veranstalter,
|
||||
'ranglisten_platzierungen' => $ranglistenplatzierungen,
|
||||
'turnier_platzierungen' => $turnierplatzierungen,
|
||||
'statistik' => $statistik,
|
||||
'elo' => $elo_detailliert,
|
||||
'einstufung' => isset($spieler->einstufung_allgemein_id) ? $einstufungen[$spieler->einstufung_allgemein_id] : NULL,
|
||||
'einstufung_einzel' => isset($spieler->einstufung_einzel_id) ? $einstufungen[$spieler->einstufung_einzel_id] : NULL,
|
||||
'einstufung_doppel' => isset($spieler->einstufung_doppel_id) ? $einstufungen[$spieler->einstufung_doppel_id] : NULL,
|
||||
'einzel' => $letzte_einzel,
|
||||
'doppel' => $letzte_doppel,
|
||||
]);
|
||||
}
|
||||
|
||||
static function begegnungVerlegen($veranstaltung, $begegnung, $heim_team, $gast_team, $verlegen_aktionen, $berechtigt_fuer_akzeptieren, $aus_uebersicht, $vorschlagendes_team_id) {
|
||||
$letzte_aktionen = array();
|
||||
foreach ($verlegen_aktionen as $aktion) {
|
||||
if ($aktion->aktion == 1 || $aktion->aktion == 5 || $aktion == 10) {
|
||||
break;
|
||||
}
|
||||
array_push($letzte_aktionen, $aktion);
|
||||
}
|
||||
$termine = array();
|
||||
if (count($letzte_aktionen) > 0) {
|
||||
$eingetragen = $letzte_aktionen[0]->eingetragen;
|
||||
foreach ($letzte_aktionen as $aktion) {
|
||||
if ($aktion->eingetragen != $eingetragen || $aktion->aktion != 0 || $aktion->zeitpunkt == NULL) {
|
||||
break;
|
||||
}
|
||||
array_push($termine, $aktion);
|
||||
}
|
||||
}
|
||||
|
||||
$berechtigt_anfordern = $veranstaltung->initial_ohne_termin != 1 && (count($letzte_aktionen) == 0 || $letzte_aktionen[0]->aktion == 1);
|
||||
$berechtigt_vorschlagen = ($veranstaltung->initial_ohne_termin != 2 || (count($letzte_aktionen) != 0 && $letzte_aktionen[0]->aktion != 1))
|
||||
&& (!$veranstaltung->keine_gegenvorschlaege || count($letzte_aktionen) == 0 || $letzte_aktionen[0]->aktion != 3 || $letzte_aktionen[0]->team_id != $vorschlagendes_team_id)
|
||||
&& (count($termine) == 0 || !$veranstaltung->keine_gegenvorschlaege || $letzte_aktionen[0]->team_id == $vorschlagendes_team_id);
|
||||
$berechtigt_ablehnen = count($letzte_aktionen) != 0 && ($letzte_aktionen[0]->aktion == 0 || $letzte_aktionen[0]->aktion == 3 || $letzte_aktionen[0]->aktion == 4)
|
||||
&& ((($veranstaltung->ablehnen == 1 || $veranstaltung->ablehnen == 3) && $berechtigt_fuer_akzeptieren) || (($veranstaltung->ablehnen == 1 || $veranstaltung->ablehnen == 2)
|
||||
&& $berechtigt_vorschlagen));
|
||||
|
||||
$response = [];
|
||||
$anzahl_termine = $veranstaltung->termine_maximal == 0 ? 3 : $veranstaltung->termine_maximal;
|
||||
|
||||
for ($termin = 1; $termin <= $anzahl_termine; $termin++) {
|
||||
if (isset($termine[$termin-1])) {
|
||||
$response[] = [
|
||||
'begegnung_historie_id' => $termine[$termin-1]->begegnung_historie_id,
|
||||
'zeitpunkt' => $termine[$termin-1]->zeitpunkt
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
self::JSON([
|
||||
'termine' => $response,
|
||||
'berechtigt_anfordern' => $berechtigt_anfordern,
|
||||
'berechtigt_ablehnen' => $berechtigt_ablehnen,
|
||||
'berechtigt_akzeptieren' => $berechtigt_fuer_akzeptieren ? TRUE : FALSE,
|
||||
'termine_minimal' => $veranstaltung->termine_minimal,
|
||||
'termine_maximal' => $veranstaltung->termine_maximal,
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,502 @@
|
||||
<?php
|
||||
/*
|
||||
* Sports Manager (C) 2006-2020, Sven Nickel
|
||||
*/
|
||||
|
||||
// kein direkter Zugriff
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
function htmlentities_utf8($s) {
|
||||
return htmlentities($s, ENT_QUOTES, "UTF-8");
|
||||
}
|
||||
|
||||
function htmlentities_noquotes_utf8($s) {
|
||||
return htmlentities($s, ENT_NOQUOTES, "UTF-8");
|
||||
}
|
||||
|
||||
function addOnLoad($function) {
|
||||
?>
|
||||
<script language="JavaScript">
|
||||
function addLoadEvent(func) {
|
||||
var oldonload = window.onload;
|
||||
if (typeof window.onload != 'function') {
|
||||
window.onload = func;
|
||||
}
|
||||
else {
|
||||
window.onload = function () {
|
||||
if (oldonload) {
|
||||
oldonload();
|
||||
}
|
||||
func();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addLoadEvent(function () {<?php echo $function; ?>});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
function SportsManagerURL($weitereParameter = null, $ssl = 0) {
|
||||
return JRoute::_('index.php' . ($weitereParameter != null ? ("?" . ltrim($weitereParameter, "&")) : ""), false, $ssl);
|
||||
}
|
||||
|
||||
function NichtLeererString($s, $ersatz = "Keiner") {
|
||||
return !empty($s) ? $s : $ersatz;
|
||||
}
|
||||
|
||||
function hervorheben($titel) {
|
||||
if (empty($titel))
|
||||
return $titel;
|
||||
|
||||
return $titel . ' *';
|
||||
}
|
||||
|
||||
function Laenderkennungen() {
|
||||
$kennungen = array("AUT", "BEL", "BUL", "CZE", "DEN", "FRA", "GBR", "GER", "LUX", "NED", "SUI", "USA");
|
||||
|
||||
return $kennungen;
|
||||
}
|
||||
|
||||
function rundenstufe($stufe) {
|
||||
switch ($stufe) {
|
||||
case 0:
|
||||
$bezeichnung = JText::_('COM_SPORTSMANAGER_FINAL_RANKS');
|
||||
break;
|
||||
case 1:
|
||||
$bezeichnung = JText::_('COM_SPORTSMANAGER_MAIN_ROUND');
|
||||
break;
|
||||
case 2:
|
||||
$bezeichnung = JText::_('COM_SPORTSMANAGER_ADDITIONAL_ROUND');
|
||||
break;
|
||||
case 3:
|
||||
$bezeichnung = JText::_('COM_SPORTSMANAGER_2ND_ADDITIONAL_ROUND');
|
||||
break;
|
||||
case 10:
|
||||
$bezeichnung = JText::_('COM_SPORTSMANAGER_PRELIMINARY_ROUND');
|
||||
break;
|
||||
case 20:
|
||||
$bezeichnung = JText::_('COM_SPORTSMANAGER_REGISTRATIONS');
|
||||
break;
|
||||
default:
|
||||
$bezeichnung = "";
|
||||
} // switch
|
||||
|
||||
return $bezeichnung;
|
||||
}
|
||||
|
||||
function StringsZusammenfassen($titel1, $titel2, $ersatz = null, $separator = " / ") {
|
||||
if ($ersatz == null)
|
||||
$ersatz = JText::_('COM_SPORTSMANAGER_NONE');
|
||||
$t1 = NichtLeererString($titel1, $ersatz);
|
||||
$t2 = NichtLeererString($titel2, $ersatz);
|
||||
|
||||
return $t1 != $t2 ? ($t1 . $separator . $t2) : $t1;
|
||||
}
|
||||
|
||||
function Rundenbezeichnung($runde, $spieltag = false, $bezeichnung_verstecken = false, $kurzform = false) {
|
||||
if ($kurzform) {
|
||||
if ($runde >= 20000)
|
||||
return JText::sprintf('COM_SPORTSMANAGER_PLACE_FROM_TO_SHORTCUT', 99 - $runde % 100, 99 - floor(($runde - 20000) / 100) + 99 - ($runde % 100));
|
||||
|
||||
switch ($runde) {
|
||||
case 0:
|
||||
return $spieltag ? JText::_('COM_SPORTSMANAGER_MATCH_DAY_NONE') : JText::_('COM_SPORTSMANAGER_ROUND_NONE');
|
||||
case 19999:
|
||||
return JText::_('COM_SPORTSMANAGER_FINAL_SHORTCUT');
|
||||
case 19998:
|
||||
return JText::_('COM_SPORTSMANAGER_3RD_PLACE_SHORTCUT');
|
||||
case 19997:
|
||||
return JText::_('COM_SPORTSMANAGER_HALF_FINAL_SHORTCUT');
|
||||
case 19996:
|
||||
return JText::_('COM_SPORTSMANAGER_QUARTER_FINAL_SHORTCUT');
|
||||
case 19995:
|
||||
return JText::_('COM_SPORTSMANAGER_ROUND_OF_16_SHORTCUT');
|
||||
case 19994:
|
||||
return JText::_('COM_SPORTSMANAGER_ROUND_OF_32_SHORTCUT');
|
||||
case 19993:
|
||||
return JText::_('COM_SPORTSMANAGER_ROUND_OF_64_SHORTCUT');
|
||||
case 19992:
|
||||
return JText::_('COM_SPORTSMANAGER_ROUND_OF_128_SHORTCUT');
|
||||
}
|
||||
|
||||
return $bezeichnung_verstecken ? $runde : JText::sprintf($spieltag ? 'COM_SPORTSMANAGER_MATCH_DAY_NR_SHORTCUT' : 'COM_SPORTSMANAGER_ROUND_NR_SHORTCUT', $runde);
|
||||
}
|
||||
else {
|
||||
if ($runde >= 20000)
|
||||
return JText::sprintf('COM_SPORTSMANAGER_PLACE_FROM_TO', 99 - $runde % 100, 99 - floor(($runde - 20000) / 100) + 99 - ($runde % 100));
|
||||
|
||||
switch ($runde) {
|
||||
case 0:
|
||||
return $spieltag ? JText::_('COM_SPORTSMANAGER_MATCH_DAY_NONE') : JText::_('COM_SPORTSMANAGER_ROUND_NONE');
|
||||
case 19999:
|
||||
return JText::_('COM_SPORTSMANAGER_FINAL');
|
||||
case 19998:
|
||||
return JText::_('COM_SPORTSMANAGER_3RD_PLACE');
|
||||
case 19997:
|
||||
return JText::_('COM_SPORTSMANAGER_HALF_FINAL');
|
||||
case 19996:
|
||||
return JText::_('COM_SPORTSMANAGER_QUARTER_FINAL');
|
||||
case 19995:
|
||||
return JText::_('COM_SPORTSMANAGER_ROUND_OF_16');
|
||||
case 19994:
|
||||
return JText::_('COM_SPORTSMANAGER_ROUND_OF_32');
|
||||
case 19993:
|
||||
return JText::_('COM_SPORTSMANAGER_ROUND_OF_64');
|
||||
case 19992:
|
||||
return JText::_('COM_SPORTSMANAGER_ROUND_OF_128');
|
||||
}
|
||||
|
||||
return $bezeichnung_verstecken ? $runde : JText::sprintf($spieltag ? 'COM_SPORTSMANAGER_MATCH_DAY_NR' : 'COM_SPORTSMANAGER_ROUND_NR', $runde);
|
||||
}
|
||||
}
|
||||
|
||||
function FormatiertesDatum($s, $zeit_anzeigen = true, $wochentag_anzeigen = true) {
|
||||
if ($s != null && strlen($s) > 0) {
|
||||
$ts = getdate(strtotime($s));
|
||||
if ($wochentag_anzeigen) {
|
||||
$wochentage = array(JText::_('COM_SPORTSMANAGER_DAY_0_SHORTCUT'), JText::_('COM_SPORTSMANAGER_DAY_1_SHORTCUT'), JText::_('COM_SPORTSMANAGER_DAY_2_SHORTCUT'), JText::_('COM_SPORTSMANAGER_DAY_3_SHORTCUT'), JText::_('COM_SPORTSMANAGER_DAY_4_SHORTCUT'), JText::_('COM_SPORTSMANAGER_DAY_5_SHORTCUT'), JText::_('COM_SPORTSMANAGER_DAY_6_SHORTCUT'));
|
||||
if ($zeit_anzeigen)
|
||||
return sprintf("%s, %02d.%02d.%04d %02d:%02d", $wochentage[$ts["wday"]], $ts["mday"], $ts["mon"], $ts["year"], $ts["hours"], $ts["minutes"]);
|
||||
|
||||
return sprintf("%s, %02d.%02d.%04d", $wochentage[$ts["wday"]], $ts["mday"], $ts["mon"], $ts["year"]);
|
||||
}
|
||||
if ($zeit_anzeigen)
|
||||
return sprintf("%02d.%02d.%04d %02d:%02d", $ts["mday"], $ts["mon"], $ts["year"], $ts["hours"], $ts["minutes"]);
|
||||
|
||||
return sprintf("%02d.%02d.%04d", $ts["mday"], $ts["mon"], $ts["year"]);
|
||||
}
|
||||
|
||||
return JText::_('COM_SPORTSMANAGER_DATE_NONE');
|
||||
}
|
||||
|
||||
function FormatierterTermin($erster_tag, $letzter_tag, $jahr_anzeigen = false, $filter_jahr = null) {
|
||||
$erster_ts = getdate(strtotime($erster_tag));
|
||||
$letzter_ts = getdate(strtotime($letzter_tag));
|
||||
if (!empty($filter_jahr))
|
||||
$jahr_anzeigen = $erster_ts["year"] != $filter_jahr || $letzter_ts["year"] != $filter_jahr;
|
||||
$letzter_termin = sprintf("%02d.%02d." . ($jahr_anzeigen ? "%02d" : ""), $letzter_ts["mday"], $letzter_ts["mon"], $letzter_ts["year"]);
|
||||
if ($erster_tag == $letzter_tag)
|
||||
return $letzter_termin;
|
||||
if ($erster_ts["mon"] == $letzter_ts["mon"] && $erster_ts["year"] == $letzter_ts["year"])
|
||||
$erster_termin = sprintf("%02d.", $erster_ts["mday"]);
|
||||
else if (!$jahr_anzeigen || $erster_ts["year"] == $letzter_ts["year"])
|
||||
$erster_termin = sprintf("%02d.%02d.", $erster_ts["mday"], $erster_ts["mon"]);
|
||||
else
|
||||
$erster_termin = sprintf("%02d.%02d.%02d", $erster_ts["mday"], $erster_ts["mon"], $erster_ts["year"]);
|
||||
|
||||
return $erster_termin . "-" . $letzter_termin;
|
||||
}
|
||||
|
||||
function bildLoeschen($typ, $id) {
|
||||
global $sportsmanager_joomla_path;
|
||||
$typ_exploded = explode("/", $typ);
|
||||
$typ = $typ_exploded[0];
|
||||
$typ_prefix = count($typ_exploded) > 1 ? $typ_exploded[1] : "";
|
||||
$bilder_pfad = $sportsmanager_joomla_path . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'sportsmanager' . DIRECTORY_SEPARATOR . $typ;
|
||||
$pfad = $bilder_pfad . '/' . $typ_prefix . $id . ".";
|
||||
if (!is_file($pfad . 'png') && !is_file($pfad . 'jpg'))
|
||||
return;
|
||||
$alte_bilder = JFolder::files($bilder_pfad, '^' . $typ_prefix . $id . '\.|^' . $typ_prefix . 'I' . $id . 'T');
|
||||
foreach ($alte_bilder as $fn)
|
||||
JFile::delete($bilder_pfad . DIRECTORY_SEPARATOR . $fn);
|
||||
}
|
||||
|
||||
function bildIdentisch($typ1, $id1, $typ2, $id2) {
|
||||
global $sportsmanager_joomla_path;
|
||||
$typ1_exploded = explode("/", $typ1);
|
||||
$typ1 = $typ1_exploded[0];
|
||||
$typ1_prefix = count($typ1_exploded) > 1 ? $typ1_exploded[1] : "";
|
||||
$bilder_pfad1 = $sportsmanager_joomla_path . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'sportsmanager' . DIRECTORY_SEPARATOR . $typ1;
|
||||
$pfad1 = $bilder_pfad1 . '/' . $typ1_prefix . $id1 . ".";
|
||||
if (is_file($pfad1 . "png"))
|
||||
$ext = "png";
|
||||
else if (is_file($pfad1 . "jpg"))
|
||||
$ext = "jpg";
|
||||
else
|
||||
$ext = "";
|
||||
$pfad1 .= $ext;
|
||||
|
||||
$typ2_exploded = explode("/", $typ2);
|
||||
$typ2 = $typ2_exploded[0];
|
||||
$typ2_prefix = count($typ2_exploded) > 1 ? $typ2_exploded[1] : "";
|
||||
$bilder_pfad2 = $sportsmanager_joomla_path . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'sportsmanager' . DIRECTORY_SEPARATOR . $typ2;
|
||||
$pfad2 = $bilder_pfad2 . '/' . $typ2_prefix . $id2 . "." . $ext;
|
||||
|
||||
return files_identical($pfad1, $pfad2);
|
||||
}
|
||||
|
||||
function teamImage($teamId, $vereinId, $width = 240, $height = 240) {
|
||||
$url = bildURL("mannschaften", $teamId, 0, 0, $width, $height);
|
||||
|
||||
if ($url == null) {
|
||||
$url = bildURL("vereine", $vereinId, 0, 0, $width, $height);
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
function playerImage($playerId, $gender, $width = 180, $height = 240) {
|
||||
$url = bildURL("spieler", $playerId, $width, $height, 0,0,'', $gender == 'M' ? 'm' : 'w');
|
||||
if ($url == null) {
|
||||
$url = bildURL("mannschaftsmitglieder", $playerId, $width, $height, 0,0,'');
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
||||
function bildURL($typ, $id, $fixed_width = 0, $fixed_height = 0, $max_width = 0, $max_height = 0, $zusatz = "", $alternativ = "") {
|
||||
global $sportsmanager_joomla_path;
|
||||
global $sportsmanager_joomla_url;
|
||||
|
||||
$typ_exploded = explode("/", $typ);
|
||||
$typ = $typ_exploded[0];
|
||||
$typ_prefix = count($typ_exploded) > 1 ? $typ_exploded[1] : "";
|
||||
|
||||
$pfad = $sportsmanager_joomla_path . "/images/sportsmanager/" . $typ . "/" . $typ_prefix . $id . ".";
|
||||
if (is_file($pfad . "png"))
|
||||
$ext = "png";
|
||||
else if (is_file($pfad . "jpg"))
|
||||
$ext = "jpg";
|
||||
else if (!empty($alternativ)) {
|
||||
$id = $alternativ;
|
||||
$pfad = $sportsmanager_joomla_path . "/images/sportsmanager/" . $typ . "/" . $typ_prefix . $id . ".";
|
||||
if (is_file($pfad . "png"))
|
||||
$ext = "png";
|
||||
else if (is_file($pfad . "jpg"))
|
||||
$ext = "jpg";
|
||||
else
|
||||
return null;
|
||||
}
|
||||
else
|
||||
return null;
|
||||
|
||||
$time = filemtime($pfad . $ext);
|
||||
|
||||
if ($fixed_width > 0 && $fixed_height > 0) {
|
||||
$pfad_angepasst = $sportsmanager_joomla_path . "/images/sportsmanager/" . $typ . "/" . $typ_prefix . "I" . $id . "T" . $time . "W" . $fixed_width . "H" . $fixed_height . "." . $ext;
|
||||
if (is_file($pfad_angepasst)) {
|
||||
return $sportsmanager_joomla_url . 'images/sportsmanager/' . $typ . '/' . basename($pfad_angepasst);
|
||||
}
|
||||
}
|
||||
|
||||
$size = getimagesize($pfad . $ext);
|
||||
$width = $size[0];
|
||||
$height = $size[1];
|
||||
|
||||
$max_width = $fixed_width > 0 ? $fixed_width : $max_width;
|
||||
$max_height = $fixed_height > 0 ? $fixed_height : $max_height;
|
||||
|
||||
if (($fixed_width == 0 || $width == $fixed_width) && ($fixed_height == 0 || $height == $fixed_height) && ($fixed_width != 0 || $max_width == 0 || $width <= $max_width) && ($fixed_height != 0 || $max_height == 0 || $height <= $max_height)) {
|
||||
$pfad_angepasst = $sportsmanager_joomla_path . "/images/sportsmanager/" . $typ . "/" . $typ_prefix . "I" . $id . "T" . $time . "W" . $width . "H" . $height . "." . $ext;
|
||||
if (!is_file($pfad_angepasst)) {
|
||||
if (!copy($pfad . $ext, $pfad_angepasst))
|
||||
return null;
|
||||
}
|
||||
|
||||
return $sportsmanager_joomla_url . 'images/sportsmanager/' . $typ . '/' . basename($pfad_angepasst);
|
||||
}
|
||||
|
||||
$new_width = $width;
|
||||
$new_height = $height;
|
||||
|
||||
if ($max_height > 0 && $new_height > $max_height) {
|
||||
$new_width = max(round($new_width * $max_height / $new_height), 1);
|
||||
$new_height = $max_height;
|
||||
}
|
||||
if ($max_width > 0 && $new_width > $max_width) {
|
||||
$new_height = max(round($new_height * $max_width / $new_width), 1);
|
||||
$new_width = $max_width;
|
||||
}
|
||||
|
||||
if ($max_width > 0 && (($max_width - $new_width) % 2) == 1) // Toleranz bei nur 1 Pixel Unterschied
|
||||
$new_width += 1;
|
||||
if ($max_height > 0 && (($max_height - $new_height) % 2) == 1) // Toleranz bei nur 1 Pixel Unterschied
|
||||
$new_height += 1;
|
||||
|
||||
$pfad_angepasst = $sportsmanager_joomla_path . "/images/sportsmanager/" . $typ . "/" . $typ_prefix . "I" . $id . "T" . $time . "W" . max($fixed_width, $new_width) . "H" . max($fixed_height, $new_height) . "." . $ext;
|
||||
|
||||
if (!is_file($pfad_angepasst)) {
|
||||
$image = $ext == "png" ? imagecreatefrompng($pfad . $ext) : imagecreatefromjpeg($pfad . $ext);
|
||||
if ($image === false)
|
||||
return null;
|
||||
|
||||
$image_resized = imagecreatetruecolor(max($fixed_width, $new_width), max($fixed_height, $new_height));
|
||||
$color = $ext == "png" ? imagecolorallocatealpha($image_resized, 0, 0, 0, 127) : imagecolorallocate($image_resized, 64, 64, 64);
|
||||
imagefill($image_resized, 0, 0, $color);
|
||||
imagecopyresampled($image_resized, $image, round((imagesx($image_resized) - $new_width) / 2), round((imagesy($image_resized) - $new_height) / 2), 0, 0, $new_width, $new_height, $width, $height);
|
||||
if ($ext == "png") {
|
||||
imagesavealpha($image_resized, true);
|
||||
imagepng($image_resized, $pfad_angepasst);
|
||||
}
|
||||
else
|
||||
imagejpeg($image_resized, $pfad_angepasst);
|
||||
}
|
||||
|
||||
return $sportsmanager_joomla_url . 'images/sportsmanager/' . $typ . '/' . basename($pfad_angepasst);
|
||||
}
|
||||
|
||||
|
||||
function bildHTML($typ, $id, $fixed_width = 0, $fixed_height = 0, $max_width = 0, $max_height = 0, $zusatz = "", $alternativ = "") {
|
||||
global $sportsmanager_joomla_path;
|
||||
global $sportsmanager_joomla_url;
|
||||
|
||||
$typ_exploded = explode("/", $typ);
|
||||
$typ = $typ_exploded[0];
|
||||
$typ_prefix = count($typ_exploded) > 1 ? $typ_exploded[1] : "";
|
||||
|
||||
$pfad = $sportsmanager_joomla_path . "/images/sportsmanager/" . $typ . "/" . $typ_prefix . $id . ".";
|
||||
if (is_file($pfad . "png"))
|
||||
$ext = "png";
|
||||
else if (is_file($pfad . "jpg"))
|
||||
$ext = "jpg";
|
||||
else if (!empty($alternativ)) {
|
||||
$id = $alternativ;
|
||||
$pfad = $sportsmanager_joomla_path . "/images/sportsmanager/" . $typ . "/" . $typ_prefix . $id . ".";
|
||||
if (is_file($pfad . "png"))
|
||||
$ext = "png";
|
||||
else if (is_file($pfad . "jpg"))
|
||||
$ext = "jpg";
|
||||
else
|
||||
return null;
|
||||
}
|
||||
else
|
||||
return null;
|
||||
|
||||
$time = filemtime($pfad . $ext);
|
||||
|
||||
if ($fixed_width > 0 && $fixed_height > 0) {
|
||||
$pfad_angepasst = $sportsmanager_joomla_path . "/images/sportsmanager/" . $typ . "/" . $typ_prefix . "I" . $id . "T" . $time . "W" . $fixed_width . "H" . $fixed_height . "." . $ext;
|
||||
if (is_file($pfad_angepasst)) {
|
||||
return '<img src="' . $sportsmanager_joomla_url . 'images/sportsmanager/' . $typ . '/' . basename($pfad_angepasst) . '" width="' . $fixed_width . '" height="' . $fixed_height . '" ' . $zusatz . ' />';
|
||||
}
|
||||
}
|
||||
|
||||
$size = getimagesize($pfad . $ext);
|
||||
$width = $size[0];
|
||||
$height = $size[1];
|
||||
|
||||
$max_width = $fixed_width > 0 ? $fixed_width : $max_width;
|
||||
$max_height = $fixed_height > 0 ? $fixed_height : $max_height;
|
||||
|
||||
if (($fixed_width == 0 || $width == $fixed_width) && ($fixed_height == 0 || $height == $fixed_height) && ($fixed_width != 0 || $max_width == 0 || $width <= $max_width) && ($fixed_height != 0 || $max_height == 0 || $height <= $max_height)) {
|
||||
$pfad_angepasst = $sportsmanager_joomla_path . "/images/sportsmanager/" . $typ . "/" . $typ_prefix . "I" . $id . "T" . $time . "W" . $width . "H" . $height . "." . $ext;
|
||||
if (!is_file($pfad_angepasst)) {
|
||||
if (!copy($pfad . $ext, $pfad_angepasst))
|
||||
return null;
|
||||
}
|
||||
|
||||
return '<img src="' . $sportsmanager_joomla_url . 'images/sportsmanager/' . $typ . '/' . basename($pfad_angepasst) . '" width="' . $width . '" height="' . $height . '" ' . $zusatz . ' />';
|
||||
}
|
||||
|
||||
$new_width = $width;
|
||||
$new_height = $height;
|
||||
|
||||
if ($max_height > 0 && $new_height > $max_height) {
|
||||
$new_width = max(round($new_width * $max_height / $new_height), 1);
|
||||
$new_height = $max_height;
|
||||
}
|
||||
if ($max_width > 0 && $new_width > $max_width) {
|
||||
$new_height = max(round($new_height * $max_width / $new_width), 1);
|
||||
$new_width = $max_width;
|
||||
}
|
||||
|
||||
if ($max_width > 0 && (($max_width - $new_width) % 2) == 1) // Toleranz bei nur 1 Pixel Unterschied
|
||||
$new_width += 1;
|
||||
if ($max_height > 0 && (($max_height - $new_height) % 2) == 1) // Toleranz bei nur 1 Pixel Unterschied
|
||||
$new_height += 1;
|
||||
|
||||
$pfad_angepasst = $sportsmanager_joomla_path . "/images/sportsmanager/" . $typ . "/" . $typ_prefix . "I" . $id . "T" . $time . "W" . max($fixed_width, $new_width) . "H" . max($fixed_height, $new_height) . "." . $ext;
|
||||
|
||||
if (!is_file($pfad_angepasst)) {
|
||||
$image = $ext == "png" ? imagecreatefrompng($pfad . $ext) : imagecreatefromjpeg($pfad . $ext);
|
||||
if ($image === false)
|
||||
return null;
|
||||
|
||||
$image_resized = imagecreatetruecolor(max($fixed_width, $new_width), max($fixed_height, $new_height));
|
||||
$color = $ext == "png" ? imagecolorallocatealpha($image_resized, 0, 0, 0, 127) : imagecolorallocate($image_resized, 64, 64, 64);
|
||||
imagefill($image_resized, 0, 0, $color);
|
||||
imagecopyresampled($image_resized, $image, round((imagesx($image_resized) - $new_width) / 2), round((imagesy($image_resized) - $new_height) / 2), 0, 0, $new_width, $new_height, $width, $height);
|
||||
if ($ext == "png") {
|
||||
imagesavealpha($image_resized, true);
|
||||
imagepng($image_resized, $pfad_angepasst);
|
||||
}
|
||||
else
|
||||
imagejpeg($image_resized, $pfad_angepasst);
|
||||
}
|
||||
|
||||
return '<img src="' . $sportsmanager_joomla_url . 'images/sportsmanager/' . $typ . '/' . basename($pfad_angepasst) . '" width="' . max($fixed_width, $new_width) . '" height="' . max($fixed_height, $new_height) . '" ' . $zusatz . ' />';
|
||||
}
|
||||
|
||||
function terminDokumentname($id) {
|
||||
global $sportsmanager_joomla_path;
|
||||
|
||||
$pfad = $sportsmanager_joomla_path . "/images/sportsmanager/termine";
|
||||
$dokumente = JFolder::files($pfad, '^' . $id . ' ');
|
||||
|
||||
return !empty($dokumente) ? substr($dokumente[0], strlen((string) $id) + 1) : false;
|
||||
}
|
||||
|
||||
function lightBoxJSShow($lightbox_class = "lightbox") {
|
||||
return "show" . $lightbox_class . "();";
|
||||
}
|
||||
|
||||
function lightBoxJSHide($lightbox_class = "lightbox") {
|
||||
return "hide" . $lightbox_class . "();";
|
||||
}
|
||||
|
||||
function lightBoxClassHide($lightbox_class = "lightbox") {
|
||||
return $lightbox_class . "_close";
|
||||
}
|
||||
|
||||
function lightBoxHeader($lightbox_class = "lightbox") {
|
||||
?>
|
||||
<style type="text/css">
|
||||
div<?php echo "#" . $lightbox_class; ?> {
|
||||
position: fixed;
|
||||
left: 50px;
|
||||
right: 50px;
|
||||
top: 50px;
|
||||
bottom: 50px;
|
||||
border: 1px solid #999999;
|
||||
overflow: scroll;
|
||||
background-color: #e4e4e4;
|
||||
padding: 20px;
|
||||
display: none;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
div<?php echo "#" . $lightbox_class . "_close"; ?> {
|
||||
position: fixed;
|
||||
right: 0px;
|
||||
top: 0px;
|
||||
bottom: 0px;
|
||||
left: 0px;
|
||||
overflow: hidden;
|
||||
display: none;
|
||||
visibility: hidden;
|
||||
background-color: rgba(0, 0, 0, 0.8);
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
//<!--
|
||||
function show<?php echo $lightbox_class; ?>() {
|
||||
document.getElementById("<?php echo $lightbox_class; ?>").style.display = "inline";
|
||||
document.getElementById("<?php echo $lightbox_class; ?>").style.visibility = "visible";
|
||||
document.getElementById("<?php echo $lightbox_class . "_close"; ?>").style.display = "inline";
|
||||
document.getElementById("<?php echo $lightbox_class . "_close"; ?>").style.visibility = "visible";
|
||||
}
|
||||
|
||||
function hide<?php echo $lightbox_class; ?>() {
|
||||
document.getElementById("<?php echo $lightbox_class; ?>").style.display = "none";
|
||||
document.getElementById("<?php echo $lightbox_class; ?>").style.visibility = "hidden";
|
||||
document.getElementById("<?php echo $lightbox_class . "_close"; ?>").style.display = "none";
|
||||
document.getElementById("<?php echo $lightbox_class . "_close"; ?>").style.visibility = "hidden";
|
||||
}
|
||||
|
||||
//-->
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||