Hallo,
gibt es sowas wie eine Anleitung zum erstellen von Plugins? Ich würde gerne welche Programmieren aber ich habe keine Lust mir erstmal bestehende anzuschauen und dann nach meinem Gusto anzupassen.
Gruß
m47h
Code: Select all
$PLUGINKEY = 'RunalyzePluginPanel_NAME';
Code: Select all
abstract protected function initPlugin();
abstract protected function getDefaultConfigVars();
abstract protected function displayContent();
// Optional
protected function prepareForDisplay() {}
Code: Select all
protected function initPlugin() {
$this->type = Plugin::$PANEL; // oder $STAT oder $TOOL
$this->name = 'Name ...';
$this->description = 'Beschreibung ...';
}
Code: Select all
protected function getDefaultConfigVars() {
$config = array();
$config['option'] = array('type' => 'bool', 'var' => false, 'description' => '...');
$config['value'] = array('type' => 'int', 'var' => 10, 'description' => '...');
$config['array'] = array('type' => 'array', 'var' => array(1, 2, 3), 'description' => '...');
return $config;
}
Code: Select all
<?php
/**
* This file contains the class of the RunalyzePluginPanel "NAME".
* @package Runalyze\Plugins\Panels
*/
$PLUGINKEY = 'RunalyzePluginPanel_NAME';
/**
* Class: RunalyzePluginPanel_NAME
* @author ...
* @package Runalyze\Plugins\Panels
*/
class RunalyzePluginPanel_NAME extends PluginPanel {
/**
* Initialize this plugin
* @see PluginPanel::initPlugin()
*/
protected function initPlugin() {
$this->type = Plugin::$PANEL;
$this->name = 'Name ...';
$this->description = '...';
}
/**
* Set default config-variables
* @see PluginPanel::getDefaultConfigVars()
*/
protected function getDefaultConfigVars() {
$config = array();
$config['option'] = array('type' => 'bool', 'var' => false, 'description' => '...');
$config['value'] = array('type' => 'int', 'var' => 10, 'description' => '...');
$config['array'] = array('type' => 'array', 'var' => array(1, 2, 3), 'description' => '...');
return $config;
}
/**
* Display the content
* @see PluginPanel::displayContent()
*/
protected function displayContent() {
$Query = '
SELECT
`id`, `time`, `sportid`, `distance`, `s`
FROM `'.PREFIX.'training`
WHERE
`time` >= '.(time() - 14*DAY_IN_S);
$Trainings = DB::getInstance()->query($Query)->fetchAll();
foreach ($Training as $Data) {
$Sport = new Sport($Data['sportid']);
echo date('d.m.Y', $Data['time']).': ';
echo $Sport->name().' - ';
echo Helper::Unknown(Running::Km($Data['distance']), 'ohne Distanz').', ';
echo Time::toString($Data['s']).'<br>';
}
if (empty($Training))
echo HTML::warning('Trainiere doch bitte endlich wieder!');
}
}
Das wollen wir noch anders lösen, deshalb sollte das erstmal weg bleiben.brjbrj wrote:Krank [als Checkbox und solche Tage im Kalender vielleicht rot anzeigen]]
Users browsing this forum: No registered users and 1 guest