Da von @Sonnenspeer gewünscht...
Bezieht sich alles auf das Thema Form Page
Ich hab jetzt eine wichtige Sache, die auf jeden Fall zum Plugin dazu gehört: Den Status der Bewerbung bearbeiten + Message (Grund) mitschicken.
Das ganze möchte ich, sofern möglich, mit den wcfDialog verwirklichen. Dazu hab ich bereits:
<a href="#" class="button" id="appNoteItem" title="{lang}wcf.global.button.edit{/lang}">{lang}wcf.global.button.edit{/lang}</a>
<div id="appNote" style="display: none;">
<div id="appNoteContent" style="margin-top:10px;">
<form method="post" action="{link controller='Application' id=$app->appID}}{/link}">
<dl>
<dt><input type="radio" id="state" name="state" value="Angenommen"></dt>
</dl>
<dl>
<dt><input type="radio" id="state" name="state" value="Abgelehnt"></dt>
</dl>
<dl>
<dd>
<textarea id="conversation" name="conversation" value="{$conversation}" rows=10></textarea>
</dd>
</dl>
<div class="formSubmit">
<input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s" />
{@SECURITY_TOKEN_INPUT_TAG}
</div>
</form>
</div>
</div>
<script data-relocate="true">
//<![CDATA[
$(function() {
$('#appNoteItem').click(function() {
$('#appNote').wcfDialog({
title: '{lang}wcf.application.moderation.from{/lang} {$app->username}'
});
return false;
});
});
//]]>
</script>
{literal}
<script data-relocate="true">
//<![CDATA[
$.fn.pixels = function(property) {
return parseInt(this.css(property).slice(0,-2));
};
var $mainMenuHeight = $('#mainMenu').height();
var $marginTop = $('#logo').pixels('margin-top');
var $marginBottom = $('#logo').pixels('margin-bottom');
var $topHeaderGap = $('#logo').height() + $marginTop + $marginBottom;
var $wrapper = $('#mainMenu');
var $window = $(window);
$(function() {
var $scrollOffset = $window.scrollTop();
if ($scrollOffset > $topHeaderGap) {
$wrapper.addClass('fixed');
$('.navigationHeader').css("margin-top","51px");
}
else {
$wrapper.removeClass('fixed');
$('.navigationHeader').css("margin-top","0");
}
$(document).scroll(scrollPage).resize(scrollPage);
});
function scrollPage() {
var $scrollOffset = $window.scrollTop();
if ($scrollOffset > $topHeaderGap) {
$wrapper.addClass('fixed');
$('.navigationHeader').css("margin-top","51px");
}
else {
$wrapper.removeClass('fixed');
$('.navigationHeader').css("margin-top","0");
}
}
//]]>
</script>
{/literal}
Display More
Und die dazugehörige Klasse:
<?php
namespace wcf\form;
use wcf\data\app\Application;
use wcf\data\app\ApplicationAction;
use wcf\form\AbstractForm;
use wcf\system\WCF;
use wcf\form\MessageForm;
use wcf\system\exception\IllegalLinkException;
/**
* Shows the application mod add page.
*
* @author Fabi_995
* @copyright 2015 fabi-995.de
* @license LGPL
* @package de.fabi-995.wcf.application
*/
class ApplicationEditForm extends MessageForm {
/**
* @see \wcf\page\AbstractPage::$activeMenuItem
*/
public $activeMenuItem = 'wcf.page.application';
public $templateName = 'applicationEdit';
public $appID = 0;
public $app = null;
/**
* @see \wcf\page\IPage::readParameters()
*/
public function readParameters() {
AbstractForm::readParameters();
if (isset($_REQUEST['id'])) $this->appID = intval($_REQUEST['id']);
$this->app = new Application($this->appID);
if (!$this->app->appID) {
throw new IllegalLinkException();
}
if (!$this->app->canEdit()) {
throw new PermissionDeniedException();
}
}
/**
* @see Form::save()
*/
public function save() {
parent::save();
// update
$this->objectAction = new ApplicationAction(array($this->appID), 'update', array('data' => array_merge($this->additionalFields, array(
'state' => $this->state,
'conversation' => $this->conversation,
))));
$this->objectAction->executeAction();
$this->saved();
// show success message
WCF::getTPL()->assign(array(
'success' => true
));
}
/**
* @see Page::assignVariables()
*/
public function assignVariables() {
parent::assignVariables();
WCF::getTPL()->assign(array(
'app' => $this->app,
'conversation' => $this->conversation,
'state' => $this->state,
'action' => 'edit'
));
}
}
?>
Display More
Das Template wird in die application.tpl includet.
Das Dialogfeld kommt auch prima (Bis auf das die Sprachvariablen noch fehlen)
Aber ich glaube, ich hab 1. schonmal einen Denkfehler, weil woher weiß das Edit.tpl welche application bearbeitet werden soll und 2. Hab ich irgendwie meine Zweifel ob das überhaupt funktioniert. Mir wäre im normalen WCF solch eine Funktion, sprich DB eingaben über das Dialogfeld, nicht bekannt...
Irgendwelche Ratschläge, wie ich das ganze am besten angehen soll?
Mir wäre im normalen WCF solch eine Funktion, sprich DB eingaben über das Dialogfeld, nicht bekannt...
Hab das Forum nochmal "untersucht", und doch solch eine art Funktion gefunden, nämlich bspw. das Editieren von Threads.
Und sowas will ich auch, nur bekomme ich es einfach nicht hin. Entweder bekomme ich Fehler das etwas undefiniert sei, obwohl es in der Edit Klasse zu 100% definiert ist, werde beim absenden auf eine nicht verfügbare Seite weitergeleitet, oder es passiert beim Absenden einfach nichts... Ich bin da langsam irgendwie am verzweifeln
Ich brauch ja nur 2 Radio Buttons á Annehmen / Ablehnen und eine kleine Message schreiben, wieso, weshalb, warum.