protected function createControls() { $panel = new CaptionedPanelControl($this, 'panel'); $panel->setCaption('Teilen von Dateien'); $upload = new UploaderControl($panel); $upload->setAction('uploadShare'); $upload->setNotify('medien'); $size = "<?php echo round({me_groesse}/1024/1024,1); ?> MB"; $sendLink = Configuration::get('site.url') . '/index.php/medien/get?token={me_token}'; $send = "<a class='btn-xs btn-default' href='mailto:?body=" . $sendLink . "'><span class='glyphicon glyphicon-envelope'></span></a>"; $editLink = Application::routing()->appLink('medien', 'editShare', array('id' => '{me_id}')); $edit = "<a class='btn-xs btn-default' href=" . $editLink . "><span class='glyphicon glyphicon-edit'></span></a>"; $buttons = $send . $edit; $token = new InputTextboxControl(null); $token->setValue($sendLink)->addCssClass('input-sm'); $valid = "<?php echo ((strtotime('{me_valid_until}')) < strtotime(date('d.m.Y'))) ? '<span style=\"color: red;\">Abgelaufen</span>' : '{me_valid_until}'; ?>"; $downloads = "<?php echo '{me_downloads}' == '' ? 0 : {me_downloads}?>"; $medien = new GridControl($panel, 'medien'); $medien->setEntity(new Medien(), array('share' => 1)); $medien->setDeleteAction('deleteMedien'); $medien->createColumn(GridColumn::LINK, 'me_titel')->setAppLink('medien', 'editShare', array('id' => '{me_id}')); $medien->createColumn(GridColumn::FIELD, 'me_erweiterung')->setHeader('Typ'); $medien->createColumn(GridColumn::FIELD, 'me_groesse', $size); $medien->createColumn(GridColumn::FIELD, 'me_token', $token->toHtml())->setHeader('Download-Link'); $medien->createColumn(GridColumn::FIELD, 'me_downloads', $downloads); $medien->createColumn(GridColumn::FIELD, 'me_valid_until', $valid); $medien->createColumn(GridColumn::FIELD, 'me_titel', $buttons)->setHeader(''); $medien->createColumn(GridColumn::DELETELINK); $hinweis = new CoreControls\HtmlControl($this); $hinweis->setInnerHtml("<span style='color: #AAA;'><b>Hinweis:</b> Abgelaufene Dateien werden nach 14 Tagen automatisch gelöscht.</span>"); }