Standardactions (CRUD[L])
Zunächst ist für fast jedes Modul das bekannte CRUD Actionset nötig. CRUD steht für "Create", "Read", "Update", "Delete" und wird vom RedSpark Framework um "List" erweitert.
Die Actions können per Hand angelegt werden, werden aber auch über das Skript zur Erzeugung von Models automatisch angeleg.

Die Actions können per Hand angelegt werden, werden aber auch über das Skript zur Erzeugung von Models automatisch angeleg.
<MyApp>/RsModule/<MyModule>/Controller/Action/Create.php
<?php
class
RedSparkKickstart_RsModule_Kickstart_Controller_Action_Create
extends
Redspark_RsModule_Abstract_Controller_Action_Create
{
/**
* Initialize basic attribs.
*/
protected function init($options=array()) {
parent::init(
array(
parent::INIT_OPTIONS_MODELNAME => 'Kick'
)
);
}
}
?>
<MyApp>/RsModule/<MyModule>/Controller/Action/Read.php
<?php
class
RedSparkKickstart_RsModule_Kickstart_Controller_Action_Read
extends
Redspark_RsModule_Abstract_Controller_Action_Read
{
/**
* Initialize basic attribs.
*/
protected function init($options=array()) {
parent::init(
array(
parent::INIT_OPTIONS_MODELNAME => 'Kick',
)
);
}
}
?>
<MyApp>/RsModule/<MyModule>/Controller/Action/Update.php
<?php
class
RedSparkKickstart_RsModule_Kickstart_Controller_Action_Update
extends
Redspark_RsModule_Abstract_Controller_Action_Update
{
/**
* Initialize basic attribs.
*/
protected function init($options=array()) {
parent::init(
array(
parent::INIT_OPTIONS_MODELNAME => 'Kick'
)
);
}
}
?>
<MyApp>/RsModule/<MyModule>/Controller/Action/Delete.php
<?php
class
RedSparkKickstart_RsModule_Kickstart_Controller_Action_Delete
extends
Redspark_RsModule_Abstract_Controller_Action_Delete
{
/**
* Initialize basic attribs.
*/
protected function init($options=array()) {
parent::init(
array(
parent::INIT_OPTIONS_MODELNAME => 'Kick',
parent::INIT_OPTIONS_NAMEATTRIB => 'kickstartname'
)
);
}
}
?>
<MyApp>/RsModule/<MyModule>/Controller/Action/List.php
<?php
class
RedSparkKickstart_RsModule_Kickstart_Controller_Action_List
extends
RedSparkCore_RsModule_Abstract_Controller_Action_Listing
{
/**
* Model on which we do our listing
*
* @var RedSparkKickstart_RsModule_Kickstart_Model_Kick
*/
protected $_model = null;
/**
* Init the listing with model info, some text and optionaly actions
*
* @param Array $options
*/
protected function init($options=array()) {
parent::init(Array(
/* Model */
parent::INIT_OPTIONS_MODELNAME => 'Kick',
/* Text */
parent::INIT_OPTIONS_LISTINGNAME => $this->_('Kickstart overview'),
parent::INIT_OPTIONS_LISTINGDESCRIPTION => $this->_('This list shows all Kickstart elements.'),
parent::INIT_OPTIONS_MAINGROUPNAME => $this->_('Kickstart'),
parent::INIT_OPTIONS_NEWLINKTEXT => $this->_('Create new Kick'),
parent::INIT_OPTIONS_NO_ITEMS_TEXT => $this->_('No Kick inserted'),
/* Actions */
//parent::INIT_OPTIONS_NEWLINKACTION => 'Create',
//parent::INIT_OPTIONS_DETAILSLINKACTION => 'Read',
parent::INIT_OPTIONS_AJAXDETAILS => true,
parent::INIT_OPTIONS_EXPORTLINKS => true,
/* suche */
//parent::INIT_OPTIONS_LISTINGSEARCH => false
/* limit shown entries on page. Automatic pagination will appear */
parent::INIT_OPTIONS_ENTRIES_PER_PAGE => 15
));
/*
*
*/
}
}
?>
Eigene Actions
Eigene Actions sind sehr einfach zu implementieren: Actionklasse anlegen, Recht auf die Action hinzufügen, Default Subaction implementieren, ggf. eine View anlegen (siehe achter Schritt) fertig! Einige Beispiele finden sich in Schritt Zehn - Weitere Möglichkeiten.Zwischenstand
Glückwunsch! Sollten Sie alle Schritte wie beschrieben durchgeführt haben, Sollten Sie jetzt ein vergleichbares Formular sehen und Elemente in Ihrem neuen Modul verwalten können.