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>"); }
protected function getStdEditControl($readOnly = false) { //$control = new InputFileControl(null, $this->name); $control = new UploaderControl(null, $this->name); $control->setTargetFilename($this->entity->id); $control->setToken($this->entity->__toToken()); return $control; }
protected function getStdEditControl($readOnly = false) { $control = new ControlContainer(null); $id = 'image' . $this->name; if ($this->getValue() != '' && file_exists('medien/-1/' . $this->getValue())) { $url = Configuration::get('site.url') . "/medien/-1/thumbs/{$this->getValue()}"; } else { $url = Configuration::get('site.url') . "/pixel.png"; } $htmlControl = new HtmlControl($control); $htmlControl->setInnerHtml("<img src=\"{$url}\" id=\"{$id}\" class=\"img-thumbnail\" />"); $uploader = new UploaderControl($control, $this->name); $uploader->setTargetFilename($this->entity->id); $uploader->setValue($this->getValue()); return $control; }
protected function createControls() { $panel = new CaptionedPanelControl($this, 'panelGalerie'); $panel->setCaption($this->controller->kollektion->ko_bezeichnung)->setCollapsed(true); $dokumente = new GalerieControl($panel, 'dok'); $dokumente->setOrdner($this->controller->kollektion); $dokumente->setRekursiv(true); $dokumente->setShowDelete($this->request->showDelete); $dokumente->setShowDrehen($this->request->showDrehen); $dokumente->setShowSave($this->request->showSave); if (isset($this->request->columns)) { $dokumente->setColumns($this->request->columns); } if (isset($this->request->upload)) { // TODO: Uploader muss überarbeitet werden $upload = new UploaderControl($panel, 'myUpload2'); $upload->setKollektionId($this->controller->kollektion->id); } }
protected function createControls() { $showNew = true; if (isset($this->request->showNew)) { $showNew = $this->request->showNew; } $showUp = true; if (isset($this->request->showUp)) { $showUp = $this->request->showUp; } if (!$this->request->ajax) { $panel = new CoreControls\ControlContainer($this, 'pnlAjax'); $panel->setSkin('<div id="pnlAjax">{controls}</div>'); } else { $panel = $this; } $panel = new CoreControls\ControlContainer($panel, 'panel'); //$panel->setCaption('Dokumente / Medien'); //if ($this->controller->kollektion != null) { // $panel->setCaption($this->controller->kollektion->ko_bezeichnung); //} if ($showNew) { $button = new StdControls\ButtonControl($panel, 'btnNeuOrdner'); $button->setCaption('Neuer Ordner')->addCssClass('btn-small')->addCssClass('nfs-modal'); if ($this->controller->kollektion != null) { $button->setLink('medien', 'newKollektion', array('parent' => $this->controller->kollektion->id)); } else { $button->setLink('medien', 'newKollektion', array('parent' => 0)); } } if ($this->controller->kollektion !== null) { $uploader = new UploaderControl($this, 'uploader'); $uploader->setKollektionId($this->controller->kollektion->id); //->setNotify('dok'); } else { Javascript::requireLibrary('jqueryuploader'); } $dokumente = new DokumentenControl($panel, 'dok'); $dokumente->setOrdner($this->controller->kollektion)->setShowUp($showUp)->setAjaxTarget('pnlAjax'); }