/**
     * Display the content
     * @see PluginPanel::displayContent()
     */
    protected function displayContent()
    {
        echo $this->getStyle();
        echo '<div id="schuhe">';
        // TODO: Use data from shoe factory
        $inuse = true;
        $schuhe = DB::getInstance()->query('SELECT * FROM `' . PREFIX . 'shoe` WHERE accountid = ' . SessionAccountHandler::getId() . ' ORDER BY `inuse` DESC, `km` DESC')->fetchAll();
        foreach ($schuhe as $schuh) {
            $Shoe = new Shoe($schuh);
            if ($inuse && $Shoe->isInUse() == 0) {
                echo '<div id="hiddenschuhe" style="display:none;">';
                $inuse = false;
            }
            echo '<p style="position:relative;">
				<span class="right">' . $Shoe->getKmString() . '</span>
				<strong>' . ShoeFactory::getSearchLink($schuh['id']) . '</strong>
				' . $this->getShoeUsageImage($Shoe->getKm()) . '
			</p>';
        }
        if (empty($schuhe)) {
            echo HTML::em(__('You don\'t have any shoes'));
        }
        if (!$inuse) {
            echo '</div>';
        }
        echo '</div>';
        if (!$inuse) {
            echo Ajax::toggle('<a class="right" href="#schuhe" name="schuhe">' . __('Show unused shoes') . '</a>', 'hiddenschuhe');
        }
        echo HTML::clearBreak();
    }
Exemple #2
0
} else {
    $Header = __('Edit shoe');
    $Mode = StandardFormular::$SUBMIT_MODE_EDIT;
    $Shoe = new Shoe(Request::sendId());
}
$Formular = new StandardFormular($Shoe, $Mode);
if ($Formular->submitSucceeded()) {
    header('Location: window.schuhe.table.php');
    ShoeFactory::clearCache();
    exit;
}
if (Request::sendId() > 0) {
    $DeleteText = '<strong>' . __('Delete shoe') . ' &raquo;</strong>';
    $DeleteUrl = $_SERVER['SCRIPT_NAME'] . '?delete=true&id=' . $Shoe->id();
    $DeleteLink = Ajax::link($DeleteText, 'ajax', $DeleteUrl);
    if ($Shoe->getKm() != $Shoe->getAdditionalKm()) {
        $DeleteLink = __('The shoe cannot be deleted as long it is used for some activity.');
    }
    $DeleteFieldset = new FormularFieldset(__('Delete shoe'));
    $DeleteFieldset->addWarning($DeleteLink);
    $Formular->addFieldset($DeleteFieldset);
}
$Factory = new PluginFactory();
$Plugin = $Factory->newInstance('RunalyzePluginPanel_Schuhe');
echo '<div class="panel-heading">';
echo '<div class="panel-menu"><ul><li>' . $Plugin->tableLink() . '</li></ul></div>';
echo '<h1>' . $Header . '</h1>';
echo '</div>';
echo '<div class="panel-content">';
$Formular->setId('shoe');
$Formular->setLayoutForFields(FormularFieldset::$LAYOUT_FIELD_W33);