mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 11:06:02 +02:00
Converted to PSR-2
This commit is contained in:
parent
e50887240b
commit
a18cb30402
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
class BasicFieldsTestPage extends TestPage {
|
||||
class BasicFieldsTestPage extends TestPage
|
||||
{
|
||||
private static $db = array(
|
||||
'Required' => 'Text',
|
||||
'Validated' => 'Text',
|
||||
@ -58,19 +59,23 @@ class BasicFieldsTestPage extends TestPage {
|
||||
'Validated' => 2
|
||||
);
|
||||
|
||||
function requireDefaultRecords() {
|
||||
public function requireDefaultRecords()
|
||||
{
|
||||
parent::requireDefaultRecords();
|
||||
|
||||
if($inst = DataObject::get_one('BasicFieldsTestPage')) {
|
||||
if ($inst = DataObject::get_one('BasicFieldsTestPage')) {
|
||||
$data = $this->getDefaultData();
|
||||
$inst->update($data);
|
||||
$inst->write();
|
||||
}
|
||||
}
|
||||
|
||||
function getDefaultData() {
|
||||
public function getDefaultData()
|
||||
{
|
||||
$cats = TestCategory::get();
|
||||
if(!$cats->Count()) return array(); // not initialized yet
|
||||
if (!$cats->Count()) {
|
||||
return array();
|
||||
} // not initialized yet
|
||||
|
||||
$firstCat = $cats->offsetGet(0);
|
||||
$thirdCat = $cats->offsetGet(2);
|
||||
@ -108,7 +113,8 @@ class BasicFieldsTestPage extends TestPage {
|
||||
);
|
||||
}
|
||||
|
||||
function getCMSFields() {
|
||||
public function getCMSFields()
|
||||
{
|
||||
$fields = parent::getCMSFields();
|
||||
|
||||
$description = 'This is <strong>bold</strong> help text';
|
||||
@ -157,11 +163,11 @@ class BasicFieldsTestPage extends TestPage {
|
||||
|
||||
// All these date/time fields generally have issues saving directly in the CMS
|
||||
$fields->addFieldsToTab('Root.DateTime', array(
|
||||
$calendarDateField = Object::create('DateField', 'CalendarDate','DateField with calendar'),
|
||||
Object::create('DateField', 'Date','DateField'),
|
||||
$dmyDateField = Object::create('DateField', 'DMYDate','DateField with separate fields'),
|
||||
Object::create('TimeField', 'Time','TimeField'),
|
||||
$timeFieldDropdown = Object::create('TimeField', 'TimeWithDropdown','TimeField with dropdown'),
|
||||
$calendarDateField = Object::create('DateField', 'CalendarDate', 'DateField with calendar'),
|
||||
Object::create('DateField', 'Date', 'DateField'),
|
||||
$dmyDateField = Object::create('DateField', 'DMYDate', 'DateField with separate fields'),
|
||||
Object::create('TimeField', 'Time', 'TimeField'),
|
||||
$timeFieldDropdown = Object::create('TimeField', 'TimeWithDropdown', 'TimeField with dropdown'),
|
||||
Object::create('DatetimeField', 'DateTime', 'DateTime'),
|
||||
$dateTimeShowCalendar = Object::create('DatetimeField', 'DateTimeWithCalendar', 'DateTime with calendar')
|
||||
));
|
||||
@ -172,25 +178,25 @@ class BasicFieldsTestPage extends TestPage {
|
||||
$dateTimeShowCalendar->getTimeField()->setConfig('showdropdown', true);
|
||||
|
||||
$fields->addFieldsToTab('Root.File', array(
|
||||
$bla = UploadField::create('File','FileUploadField')
|
||||
$bla = UploadField::create('File', 'FileUploadField')
|
||||
->setDescription($description)
|
||||
->setConfig('allowedMaxFileNumber', 1)
|
||||
->setConfig('canPreviewFolder', false),
|
||||
UploadField::create('AttachedFile','UploadField with canUpload=false')
|
||||
UploadField::create('AttachedFile', 'UploadField with canUpload=false')
|
||||
->setDescription($description)
|
||||
->setConfig('canUpload', false),
|
||||
UploadField::create('Image','UploadField for image')
|
||||
UploadField::create('Image', 'UploadField for image')
|
||||
->setDescription($description),
|
||||
UploadField::create('HasManyFiles','UploadField for has_many')
|
||||
UploadField::create('HasManyFiles', 'UploadField for has_many')
|
||||
->setDescription($description),
|
||||
UploadField::create('ManyManyFiles','UploadField for many_many')
|
||||
UploadField::create('ManyManyFiles', 'UploadField for many_many')
|
||||
->setDescription($description)
|
||||
));
|
||||
|
||||
$data = $this->getDefaultData();
|
||||
foreach($fields->dataFields() as $field) {
|
||||
foreach ($fields->dataFields() as $field) {
|
||||
$name = $field->getName();
|
||||
if(isset($data[$name])) {
|
||||
if (isset($data[$name])) {
|
||||
$field->setValue($data[$name]);
|
||||
}
|
||||
}
|
||||
@ -200,14 +206,16 @@ class BasicFieldsTestPage extends TestPage {
|
||||
);
|
||||
|
||||
$tabs = array('Root.Text', 'Root.Numeric', 'Root.Option', 'Root.DateTime', 'Root.File');
|
||||
foreach($tabs as $tab) {
|
||||
foreach ($tabs as $tab) {
|
||||
$tabObj = $fields->fieldByName($tab);
|
||||
foreach($tabObj->FieldList() as $field) {
|
||||
foreach ($tabObj->FieldList() as $field) {
|
||||
$field
|
||||
->setDescription($description);
|
||||
// ->addExtraClass('cms-description-tooltip');
|
||||
|
||||
if(in_array($field->getName(), $blacklist)) continue;
|
||||
if (in_array($field->getName(), $blacklist)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$disabledField = $field->performDisabledTransformation();
|
||||
$disabledField->setTitle($disabledField->Title() . ' (disabled)');
|
||||
@ -244,24 +252,27 @@ class BasicFieldsTestPage extends TestPage {
|
||||
);
|
||||
|
||||
return $fields;
|
||||
|
||||
}
|
||||
|
||||
public function getCMSValidator() {
|
||||
public function getCMSValidator()
|
||||
{
|
||||
return new RequiredFields('Required');
|
||||
}
|
||||
|
||||
public function validate() {
|
||||
public function validate()
|
||||
{
|
||||
$result = parent::validate();
|
||||
if(!$this->Validated || $this->Validated < 1 || $this->Validated > 3) {
|
||||
if (!$this->Validated || $this->Validated < 1 || $this->Validated > 3) {
|
||||
$result->error('"Validated" field needs to be between 1 and 3');
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
class BasicFieldsTestPage_Controller extends TestPage_Controller {
|
||||
function AutoCompleteItems() {
|
||||
class BasicFieldsTestPage_Controller extends TestPage_Controller
|
||||
{
|
||||
public function AutoCompleteItems()
|
||||
{
|
||||
$items = array(
|
||||
'TestItem1',
|
||||
'TestItem2',
|
||||
@ -271,5 +282,3 @@ class BasicFieldsTestPage_Controller extends TestPage_Controller {
|
||||
return implode(',', $items);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
class Company extends DataObject {
|
||||
class Company extends DataObject
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
@ -55,39 +56,42 @@ class Company extends DataObject {
|
||||
'CEO',
|
||||
);
|
||||
|
||||
public function getCMSFields() {
|
||||
public function getCMSFields()
|
||||
{
|
||||
$fields = parent::getCMSFields();
|
||||
$fields->addFieldToTab('Root.Main',
|
||||
$uploadField = UploadField::create('GroupPhotos')
|
||||
);
|
||||
if(method_exists('UploadField', 'setAllowedFileCategories')) {
|
||||
if (method_exists('UploadField', 'setAllowedFileCategories')) {
|
||||
$uploadField->setAllowedFileCategories('image');
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
function validate() {
|
||||
if(!$this->Title) {
|
||||
public function validate()
|
||||
{
|
||||
if (!$this->Title) {
|
||||
return new ValidationResult(false, 'Title is required');
|
||||
} else {
|
||||
return parent::validate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function DynamicProperty() {
|
||||
public function DynamicProperty()
|
||||
{
|
||||
return sprintf('%s (%s)', $this->Name, $this->CEO);
|
||||
}
|
||||
|
||||
public function requireDefaultRecords() {
|
||||
public function requireDefaultRecords()
|
||||
{
|
||||
parent::requireDefaultRecords();
|
||||
$companySet = DataObject::get('Company');
|
||||
foreach ($companySet as $company) {
|
||||
$company->delete();
|
||||
}
|
||||
|
||||
foreach($this->data() as $companyData){
|
||||
foreach ($this->data() as $companyData) {
|
||||
$company = new Company();
|
||||
$company->Name = $companyData[0];
|
||||
$company->Category = $companyData[1];
|
||||
@ -95,7 +99,7 @@ class Company extends DataObject {
|
||||
$company->CEO = $companyData[3];
|
||||
$company->write();
|
||||
}
|
||||
DB::alteration_message("Added default records to Company table","created");
|
||||
DB::alteration_message("Added default records to Company table", "created");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -103,7 +107,8 @@ class Company extends DataObject {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function data() {
|
||||
public function data()
|
||||
{
|
||||
return array(
|
||||
0 => array("Walmart", "Retail", "421.849", "Michael Duke"),
|
||||
1 => array("ExxonMobil", "Oil and gas", "370.125", "Rex W. Tillerson"),
|
||||
|
@ -4,7 +4,8 @@
|
||||
* Description of Employees
|
||||
*
|
||||
*/
|
||||
class Employee extends DataObject {
|
||||
class Employee extends DataObject
|
||||
{
|
||||
|
||||
private static $db = array(
|
||||
'Name' => 'Varchar',
|
||||
@ -20,10 +21,11 @@ class Employee extends DataObject {
|
||||
'PastCompanies' => 'Company'
|
||||
);
|
||||
|
||||
function getCMSFields() {
|
||||
public function getCMSFields()
|
||||
{
|
||||
$fields = parent::getCMSFields();
|
||||
|
||||
if(method_exists('ManyManyList', 'getExtraFields')) {
|
||||
if (method_exists('ManyManyList', 'getExtraFields')) {
|
||||
$fields->addFieldToTab('Root.Main',
|
||||
new NumericField('ManyMany[YearStart]', 'Year started (3.1, many-many only)')
|
||||
);
|
||||
@ -33,7 +35,7 @@ class Employee extends DataObject {
|
||||
}
|
||||
|
||||
// 3.1 only
|
||||
if(method_exists('UploadField', 'setAllowedFileCategories')) {
|
||||
if (method_exists('UploadField', 'setAllowedFileCategories')) {
|
||||
$fields->dataFieldByName('ProfileImage')->setAllowedFileCategories('image');
|
||||
}
|
||||
|
||||
@ -41,24 +43,28 @@ class Employee extends DataObject {
|
||||
return $fields;
|
||||
}
|
||||
|
||||
public function requireDefaultRecords() {
|
||||
public function requireDefaultRecords()
|
||||
{
|
||||
parent::requireDefaultRecords();
|
||||
$employeeSet = DataObject::get('Employee');
|
||||
foreach ($employeeSet as $employee) {
|
||||
$employee->delete();
|
||||
}
|
||||
|
||||
foreach($this->data() as $employeeName){
|
||||
foreach ($this->data() as $employeeName) {
|
||||
$employee = new Employee();
|
||||
$employee->Name = $employeeName;
|
||||
$employee->write();
|
||||
}
|
||||
DB::alteration_message("Added default records to Employee table","created");
|
||||
DB::alteration_message("Added default records to Employee table", "created");
|
||||
}
|
||||
|
||||
public function validate() {
|
||||
public function validate()
|
||||
{
|
||||
$result = parent::validate();
|
||||
if(!$this->Name) $result->error('"Name" can\'t be blank');
|
||||
if (!$this->Name) {
|
||||
$result->error('"Name" can\'t be blank');
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -67,7 +73,8 @@ class Employee extends DataObject {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function data() {
|
||||
public function data()
|
||||
{
|
||||
return array(
|
||||
'Hayley', 'Octavius', 'Walker', 'Gary','Elton','Janna','Ursa','Lars','Moses','Lareina',
|
||||
'Elmo','Cara','Shea','Duncan','Velma','Acton','Galena','Heidi','Troy','Elliott','Cara',
|
||||
|
@ -5,17 +5,20 @@
|
||||
*
|
||||
* @todo Allow passing in counts
|
||||
*/
|
||||
class FTPageMakerTask extends BuildTask {
|
||||
class FTPageMakerTask extends BuildTask
|
||||
{
|
||||
|
||||
|
||||
function run($request) {
|
||||
public function run($request)
|
||||
{
|
||||
echo "<h1>Making pages</h1>";
|
||||
// Creates 3^5 pages
|
||||
$this->makePages(3,5);
|
||||
$this->makePages(3, 5);
|
||||
}
|
||||
|
||||
protected function makePages($count, $depth, $prefix = "", $parentID = 0) {
|
||||
for($i=1;$i<=$count;$i++) {
|
||||
protected function makePages($count, $depth, $prefix = "", $parentID = 0)
|
||||
{
|
||||
for ($i=1;$i<=$count;$i++) {
|
||||
$page = new Page();
|
||||
$page->ParentID = $parentID;
|
||||
$page->Title = "Test page $prefix$i";
|
||||
@ -23,7 +26,9 @@ class FTPageMakerTask extends BuildTask {
|
||||
$page->publish('Stage', 'Live');
|
||||
|
||||
echo "<li>Created '$page->Title'";
|
||||
if($depth > 1) $this->makePages($count, $depth-1, $prefix."$i.", $page->ID);
|
||||
if ($depth > 1) {
|
||||
$this->makePages($count, $depth-1, $prefix."$i.", $page->ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
class FileUploadRole extends DataExtension{
|
||||
class FileUploadRole extends DataExtension
|
||||
{
|
||||
private static $has_one = array(
|
||||
'AFile' => 'File',
|
||||
'AImage' => 'Image',
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
class FrameworkTestFileExtension extends DataExtension {
|
||||
class FrameworkTestFileExtension extends DataExtension
|
||||
{
|
||||
private static $has_one = array(
|
||||
'Company' => 'Company',
|
||||
'BasicFieldsTestPage' => 'BasicFieldsTestPage'
|
||||
|
@ -1,23 +1,25 @@
|
||||
<?php
|
||||
|
||||
class FrameworkTestRole extends DataExtension {
|
||||
class FrameworkTestRole extends DataExtension
|
||||
{
|
||||
|
||||
private static $has_one = array(
|
||||
'FavouritePage' => 'SiteTree',
|
||||
);
|
||||
|
||||
function updateCMSFields(FieldList $fields) {
|
||||
public function updateCMSFields(FieldList $fields)
|
||||
{
|
||||
$fields->addFieldToTab(
|
||||
'Root.Main',
|
||||
new TreeDropdownField("FavouritePageID", "Favourite page", "SiteTree")
|
||||
);
|
||||
}
|
||||
|
||||
function requireDefaultRecords() {
|
||||
public function requireDefaultRecords()
|
||||
{
|
||||
$hasTestMembers = DataObject::get('Member')->find('Email', 'hayley@test.com');
|
||||
if(!$hasTestMembers) {
|
||||
|
||||
foreach($this->data() as $name) {
|
||||
if (!$hasTestMembers) {
|
||||
foreach ($this->data() as $name) {
|
||||
$member = new Member(array(
|
||||
'FirstName' => $name,
|
||||
'FirstName' => 'Smith',
|
||||
@ -26,7 +28,7 @@ class FrameworkTestRole extends DataExtension {
|
||||
$member->write();
|
||||
}
|
||||
|
||||
DB::alteration_message("Added default records to Member table","created");
|
||||
DB::alteration_message("Added default records to Member table", "created");
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,7 +37,8 @@ class FrameworkTestRole extends DataExtension {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function data() {
|
||||
public function data()
|
||||
{
|
||||
return array(
|
||||
'Hayley', 'Octavius', 'Walker', 'Gary', 'Elton', 'Janna', 'Ursa', 'Lars', 'Moses', 'Lareina', 'Elmo', 'Shea', 'Duncan', 'Velma', 'Acton', 'Galena', 'Heidi', 'Troy', 'Elliott', 'Whitney', 'Summer', 'Olga', 'Tatum', 'Zeph', 'Jared', 'Hilda', 'Quinlan', 'Chaim', 'Xenos', 'Cara', 'Tatiana', 'Tyrone', 'Juliet', 'Chester', 'Hannah', 'Imani', 'Quinn', 'Ariel', 'Aretha', 'Courtney ', 'Shellie', 'Garrett', 'Camilla', 'Simon', 'Mohammad', 'Kirby', 'Rae', 'Xena', 'Noel', 'Omar', 'Shannon', 'Iola', 'Maia', 'Serina', 'Taylor', 'Alice', 'Lucy', 'Austin', 'Abel', 'Yetta', 'Ulysses', 'Donovan', 'Castor', 'Emmanuel', 'Nero', 'Virginia', 'Gregory', 'Neville', 'Len', 'Knox', 'Gavin', 'Pascale', 'Hyatt', 'Alden', 'Emerald', 'Cherokee', 'Adam', 'Uma', 'Serena', 'Isabelle', 'Kieran', 'Gay', 'Lavinia', 'Elvis', 'Illana', 'Lee', 'Ariana', 'Hilel', 'Gage', 'Larissa', 'Richard', 'Allen'
|
||||
);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
class FrameworkTestSiteTreeExtension extends DataExtension {
|
||||
class FrameworkTestSiteTreeExtension extends DataExtension
|
||||
{
|
||||
|
||||
private static $has_one = array('RelationFieldsTestPage' => 'RelationFieldsTestPage');
|
||||
private static $belongs_many_many = array('RelationFieldsTestPages' => 'RelationFieldsTestPage');
|
||||
|
||||
}
|
||||
|
@ -4,24 +4,30 @@
|
||||
* These configurations are assumed to be evaluated in mysite/_config.php,
|
||||
* with custom switches for the different options.
|
||||
*/
|
||||
class FrameworktestRegressSessionAdmin extends Controller {
|
||||
class FrameworktestRegressSessionAdmin extends Controller
|
||||
{
|
||||
|
||||
protected $template = 'BlankPage';
|
||||
|
||||
function init() {
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
if(!Permission::check('ADMIN')) return Security::permissionFailure($this);
|
||||
if (!Permission::check('ADMIN')) {
|
||||
return Security::permissionFailure($this);
|
||||
}
|
||||
}
|
||||
|
||||
function Link($action = null) {
|
||||
public function Link($action = null)
|
||||
{
|
||||
return Controller::join_links('dev', 'regress', $action);
|
||||
}
|
||||
|
||||
function Form() {
|
||||
public function Form()
|
||||
{
|
||||
$isRunning = (Session::get('db'));
|
||||
|
||||
if($isRunning) {
|
||||
if ($isRunning) {
|
||||
$actions = new FieldList(
|
||||
new FormAction('endsession', 'End Session')
|
||||
);
|
||||
@ -60,8 +66,8 @@ class FrameworktestRegressSessionAdmin extends Controller {
|
||||
);
|
||||
$dbField->setHasEmptyDefault(false);
|
||||
|
||||
if($isRunning) {
|
||||
foreach($form->Fields() as $field) {
|
||||
if ($isRunning) {
|
||||
foreach ($form->Fields() as $field) {
|
||||
$form->Fields()->replaceField($field->Name(),
|
||||
$field->performReadonlyTransformation()
|
||||
);
|
||||
@ -71,18 +77,19 @@ class FrameworktestRegressSessionAdmin extends Controller {
|
||||
return $form;
|
||||
}
|
||||
|
||||
function startsession($data, $form) {
|
||||
public function startsession($data, $form)
|
||||
{
|
||||
Session::set('enabletranslatable', (isset($data['enabletranslatable'])) ? $data['enabletranslatable'] : null);
|
||||
Session::set('db', $data['db']);
|
||||
|
||||
return $this->redirect('dev/build/?BackURL=admin');
|
||||
}
|
||||
|
||||
function endsession() {
|
||||
public function endsession()
|
||||
{
|
||||
Session::set('enabletranslatable', null);
|
||||
Session::set('db', null);
|
||||
|
||||
return $this->redirectBack();
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
class GridFieldTestPage extends TestPage {
|
||||
class GridFieldTestPage extends TestPage
|
||||
{
|
||||
|
||||
private static $has_one = array(
|
||||
"HasOneCompany" => "Company",
|
||||
@ -13,27 +14,28 @@ class GridFieldTestPage extends TestPage {
|
||||
"ManyManyCompanies" => "Company",
|
||||
);
|
||||
|
||||
public function getCMSFields() {
|
||||
public function getCMSFields()
|
||||
{
|
||||
$fields = parent::getCMSFields();
|
||||
|
||||
$grids = array();
|
||||
|
||||
$config = new GridFieldConfig_RecordEditor();
|
||||
$grid = new GridField('Companies', 'Companies', new DataList('Company'),$config);
|
||||
$grid = new GridField('Companies', 'Companies', new DataList('Company'), $config);
|
||||
$fields->addFieldToTab('Root.NoRelation', $grid);
|
||||
$grids[] = $grid;
|
||||
|
||||
$config = new GridFieldConfig_RelationEditor();
|
||||
$grid = new GridField('HasManyCompanies', 'HasManyCompanies', $this->HasManyCompanies(),$config);
|
||||
$grid = new GridField('HasManyCompanies', 'HasManyCompanies', $this->HasManyCompanies(), $config);
|
||||
$fields->addFieldToTab('Root.HasMany', $grid);
|
||||
$grids[] = $grid;
|
||||
|
||||
$config = new GridFieldConfig_RelationEditor();
|
||||
$grid = new GridField('ManyManyCompanies', 'ManyManyCompanies', $this->ManyManyCompanies(),$config);
|
||||
$grid = new GridField('ManyManyCompanies', 'ManyManyCompanies', $this->ManyManyCompanies(), $config);
|
||||
$fields->addFieldToTab('Root.ManyMany', $grid);
|
||||
$grids[] = $grid;
|
||||
|
||||
foreach($grids as $grid) {
|
||||
foreach ($grids as $grid) {
|
||||
$grid
|
||||
->setDescription('This is <strong>bold</strong> help text');
|
||||
// ->addExtraClass('cms-description-tooltip');
|
||||
@ -41,11 +43,10 @@ class GridFieldTestPage extends TestPage {
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class GridFieldTestPage_Controller extends Page_Controller {
|
||||
class GridFieldTestPage_Controller extends Page_Controller
|
||||
{
|
||||
|
||||
private static $allowed_actions = array(
|
||||
'Form',
|
||||
@ -57,19 +58,21 @@ class GridFieldTestPage_Controller extends Page_Controller {
|
||||
*/
|
||||
public $Title = "GridFieldTestPage";
|
||||
|
||||
public function init(){
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
Requirements::css('frameworktest/css/gridfieldtest.css','screen');
|
||||
Requirements::css('frameworktest/css/gridfieldtest.css', 'screen');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Form
|
||||
*/
|
||||
public function Form(){
|
||||
public function Form()
|
||||
{
|
||||
$config = new GridFieldConfig_RecordEditor();
|
||||
|
||||
$grid = new GridField('Companies', 'Companies', new DataList('Company'),$config);
|
||||
return new Form($this,'Form',new FieldList($grid),new FieldList());
|
||||
$grid = new GridField('Companies', 'Companies', new DataList('Company'), $config);
|
||||
return new Form($this, 'Form', new FieldList($grid), new FieldList());
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,10 @@
|
||||
<?php
|
||||
|
||||
class Organisation extends DataObject {
|
||||
class Organisation extends DataObject
|
||||
{
|
||||
|
||||
// Used to test the Multiform module
|
||||
private static $db = array(
|
||||
'OrganisationName' => 'Text'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
class RelationFieldsTestPage extends TestPage {
|
||||
class RelationFieldsTestPage extends TestPage
|
||||
{
|
||||
|
||||
private static $has_one = array(
|
||||
"HasOneCompany" => "Company",
|
||||
@ -20,7 +21,8 @@ class RelationFieldsTestPage extends TestPage {
|
||||
'Title' => 'Relational Fields'
|
||||
);
|
||||
|
||||
function getCMSFields() {
|
||||
public function getCMSFields()
|
||||
{
|
||||
$fields = parent::getCMSFields();
|
||||
|
||||
$allFields = array();
|
||||
@ -40,7 +42,7 @@ class RelationFieldsTestPage extends TestPage {
|
||||
$fields->addFieldsToTab('Root.Tree', $treeFields);
|
||||
$allFields += $treeFields;
|
||||
|
||||
foreach($allFields as $field) {
|
||||
foreach ($allFields as $field) {
|
||||
$field
|
||||
->setDescription('This is <strong>bold</strong> help text')
|
||||
->addExtraClass('cms-help');
|
||||
@ -51,6 +53,6 @@ class RelationFieldsTestPage extends TestPage {
|
||||
}
|
||||
}
|
||||
|
||||
class RelationFieldsTestPage_Controller extends TestPage_Controller {
|
||||
|
||||
class RelationFieldsTestPage_Controller extends TestPage_Controller
|
||||
{
|
||||
}
|
||||
|
@ -3,7 +3,8 @@
|
||||
/**
|
||||
* A data type that is related many-many to RelationFieldsTestPage, for testing purposes
|
||||
*/
|
||||
class TestCategory extends DataObject {
|
||||
class TestCategory extends DataObject
|
||||
{
|
||||
private static $db = array(
|
||||
"Title" => "Varchar",
|
||||
);
|
||||
@ -14,23 +15,25 @@ class TestCategory extends DataObject {
|
||||
/**
|
||||
* Returns a dropdown map of all objects of this class
|
||||
*/
|
||||
static function map() {
|
||||
public static function map()
|
||||
{
|
||||
$categories = DataObject::get('TestCategory');
|
||||
if($categories) return $categories->map('ID', 'Title')->toArray();
|
||||
else return array();
|
||||
if ($categories) {
|
||||
return $categories->map('ID', 'Title')->toArray();
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
function requireDefaultRecords(){
|
||||
public function requireDefaultRecords()
|
||||
{
|
||||
$class = $this->class;
|
||||
if(!DataObject::get_one($class)) {
|
||||
foreach(array("A","B","C","D") as $item) {
|
||||
if (!DataObject::get_one($class)) {
|
||||
foreach (array("A", "B", "C", "D") as $item) {
|
||||
$page = new $class();
|
||||
$page->Title = "Test Category $item";
|
||||
$page->write();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -1,20 +1,22 @@
|
||||
<?php
|
||||
|
||||
class TestFileUploadPage extends TestPage{
|
||||
|
||||
class TestFileUploadPage extends TestPage
|
||||
{
|
||||
}
|
||||
|
||||
class TestFileUploadPage_Controller extends TestPage_Controller{
|
||||
class TestFileUploadPage_Controller extends TestPage_Controller
|
||||
{
|
||||
|
||||
private static $allowed_actions = array(
|
||||
'Form'
|
||||
);
|
||||
|
||||
function Form(){
|
||||
public function Form()
|
||||
{
|
||||
$fields = new FieldList(
|
||||
new EmailField('Email', 'EmailField'),
|
||||
new FileField('AFile','FileField'),
|
||||
$aImage = new UploadField('AImage','SimpleImageField')
|
||||
new FileField('AFile', 'FileField'),
|
||||
$aImage = new UploadField('AImage', 'SimpleImageField')
|
||||
);
|
||||
|
||||
$aImage->allowedExtensions = array('jpg', 'gif', 'png');
|
||||
@ -25,7 +27,8 @@ class TestFileUploadPage_Controller extends TestPage_Controller{
|
||||
return new Form($this, "Form", $fields, $actions);
|
||||
}
|
||||
|
||||
function addMember($data, $form){
|
||||
public function addMember($data, $form)
|
||||
{
|
||||
$member = new Member();
|
||||
$form->saveInto($member);
|
||||
$member->write();
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
class TestModelAdmin extends ModelAdmin {
|
||||
class TestModelAdmin extends ModelAdmin
|
||||
{
|
||||
private static $url_segment = 'test';
|
||||
private static $menu_title = 'Test ModelAdmin';
|
||||
|
||||
@ -8,7 +9,4 @@ class TestModelAdmin extends ModelAdmin {
|
||||
"Company",
|
||||
"Employee",
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -3,27 +3,32 @@
|
||||
/**
|
||||
* Parent class of all test pages
|
||||
*/
|
||||
class TestPage extends Page {
|
||||
class TestPage extends Page
|
||||
{
|
||||
|
||||
/**
|
||||
* We can only create subclasses of TestPage
|
||||
*/
|
||||
function canCreate($member = null) {
|
||||
public function canCreate($member = null)
|
||||
{
|
||||
// Don't allow creation other than through requireDefaultRecords
|
||||
return false;
|
||||
}
|
||||
|
||||
function requireDefaultRecords(){
|
||||
if($this->class == 'TestPage') return;
|
||||
public function requireDefaultRecords()
|
||||
{
|
||||
if ($this->class == 'TestPage') {
|
||||
return;
|
||||
}
|
||||
|
||||
$class = $this->class;
|
||||
if(!DataObject::get_one($class)) {
|
||||
if (!DataObject::get_one($class)) {
|
||||
// Try to create common parent
|
||||
$parent = SiteTree::get()
|
||||
->filter('URLSegment', 'feature-test-pages')
|
||||
->First();
|
||||
|
||||
if(!$parent) {
|
||||
if (!$parent) {
|
||||
$parent = new Page(array(
|
||||
'Title' => 'Feature Test Pages',
|
||||
'Content' => 'A collection of pages for testing various features in the SilverStripe CMS',
|
||||
@ -35,20 +40,22 @@ class TestPage extends Page {
|
||||
|
||||
// Create actual page
|
||||
$page = new $class();
|
||||
$page->Title = str_replace("TestPage","",$class);
|
||||
$page->Title = str_replace("TestPage", "", $class);
|
||||
$page->ShowInMenus = 0;
|
||||
if($parent) $page->ParentID = $parent->ID;
|
||||
if ($parent) {
|
||||
$page->ParentID = $parent->ID;
|
||||
}
|
||||
$page->write();
|
||||
$page->publish('Stage', 'Live');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Parent class of all test page controllers
|
||||
*/
|
||||
class TestPage_Controller extends Page_Controller {
|
||||
class TestPage_Controller extends Page_Controller
|
||||
{
|
||||
private static $allowed_actions = array(
|
||||
'Form',
|
||||
'save',
|
||||
@ -57,7 +64,8 @@ class TestPage_Controller extends Page_Controller {
|
||||
/**
|
||||
* This form is exactly like the CMS form. It gives us an opportunity to test the fields outside of the CMS context
|
||||
*/
|
||||
function Form() {
|
||||
public function Form()
|
||||
{
|
||||
$fields = $this->getCMSFields();
|
||||
$actions = new FieldList(
|
||||
new FormAction("save", "Save"),
|
||||
@ -69,17 +77,20 @@ class TestPage_Controller extends Page_Controller {
|
||||
return $form;
|
||||
}
|
||||
|
||||
function save($data, $form) {
|
||||
public function save($data, $form)
|
||||
{
|
||||
$form->saveInto($this->dataRecord);
|
||||
$this->dataRecord->write();
|
||||
$this->redirectBack();
|
||||
}
|
||||
|
||||
function gohome() {
|
||||
public function gohome()
|
||||
{
|
||||
$this->redirect("./");
|
||||
}
|
||||
|
||||
function EmailForm() {
|
||||
public function EmailForm()
|
||||
{
|
||||
return new Form($this, "EmailForm", new FieldList(
|
||||
new TextField("Email", "Email address")
|
||||
), new FieldList(
|
||||
@ -87,14 +98,16 @@ class TestPage_Controller extends Page_Controller {
|
||||
));
|
||||
}
|
||||
|
||||
function email() {
|
||||
public function email()
|
||||
{
|
||||
return array(
|
||||
'Content' => '<p>Use this form to send a test email</p>',
|
||||
'Form' => $this->EmailForm()
|
||||
);
|
||||
}
|
||||
|
||||
function sendEmail($data, $form) {
|
||||
public function sendEmail($data, $form)
|
||||
{
|
||||
$email = new Email();
|
||||
$email->setTo($data['Email']);
|
||||
$email->setFrom($data['Email']);
|
||||
@ -105,4 +118,3 @@ class TestPage_Controller extends Page_Controller {
|
||||
echo "<p>email sent to " . $data['Email'] . "</p>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -1,29 +1,33 @@
|
||||
<?php
|
||||
|
||||
class Page2MultiForm extends MultiForm {
|
||||
class Page2MultiForm extends MultiForm
|
||||
{
|
||||
|
||||
public static $start_step = 'Page2PersonalDetailsFormStep';
|
||||
|
||||
public function finish($data, $form) {
|
||||
public function finish($data, $form)
|
||||
{
|
||||
parent::finish($data, $form);
|
||||
$steps = DataObject::get('MultiFormStep', "SessionID = {$this->session->ID}");
|
||||
if($steps) {
|
||||
foreach($steps as $step) {
|
||||
if($step->class == 'Page2PersonalDetailsFormStep') {
|
||||
if ($steps) {
|
||||
foreach ($steps as $step) {
|
||||
if ($step->class == 'Page2PersonalDetailsFormStep') {
|
||||
$member = new Member();
|
||||
$data = $step->loadData();
|
||||
if($data) {
|
||||
if ($data) {
|
||||
$member->update($data);
|
||||
$member->write();
|
||||
}
|
||||
}
|
||||
|
||||
if($step->class == 'Page2OrganisationDetailsFormStep') {
|
||||
if ($step->class == 'Page2OrganisationDetailsFormStep') {
|
||||
$organisation = new Organisation();
|
||||
$data = $step->loadData();
|
||||
if($data) {
|
||||
if ($data) {
|
||||
$organisation->update($data);
|
||||
if($member && $member->ID) $organisation->MemberID = $member->ID;
|
||||
if ($member && $member->ID) {
|
||||
$organisation->MemberID = $member->ID;
|
||||
}
|
||||
$organisation->write();
|
||||
}
|
||||
}
|
||||
@ -36,29 +40,29 @@ class Page2MultiForm extends MultiForm {
|
||||
}
|
||||
}
|
||||
|
||||
class Page2PersonalDetailsFormStep extends MultiFormStep {
|
||||
class Page2PersonalDetailsFormStep extends MultiFormStep
|
||||
{
|
||||
|
||||
public static $next_steps = 'Page2OrganisationDetailsFormStep';
|
||||
|
||||
function getFields() {
|
||||
public function getFields()
|
||||
{
|
||||
return new FieldList(
|
||||
new TextField('FirstName', 'First name'),
|
||||
new TextField('Surname', 'Surname')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Page2OrganisationDetailsFormStep extends MultiFormStep {
|
||||
class Page2OrganisationDetailsFormStep extends MultiFormStep
|
||||
{
|
||||
|
||||
public static $is_final_step = true;
|
||||
|
||||
function getFields() {
|
||||
public function getFields()
|
||||
{
|
||||
return new FieldList(
|
||||
new TextField('OrganisationName', 'Organisation Name')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -1,22 +1,22 @@
|
||||
<?php
|
||||
|
||||
class Page2MultiFormTestPage extends Page {
|
||||
|
||||
class Page2MultiFormTestPage extends Page
|
||||
{
|
||||
}
|
||||
|
||||
class Page2MultiFormTestPage_Controller extends Page_Controller {
|
||||
class Page2MultiFormTestPage_Controller extends Page_Controller
|
||||
{
|
||||
|
||||
function Page2MultiForm() {
|
||||
public function Page2MultiForm()
|
||||
{
|
||||
return new Page2MultiForm($this, 'Page2MultiForm');
|
||||
}
|
||||
|
||||
function finished() {
|
||||
public function finished()
|
||||
{
|
||||
return array(
|
||||
'Title' => 'Thank you for your submission',
|
||||
'Content' => '<p>You have successfully submitted the form. Thanks!</p>'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -1,29 +1,33 @@
|
||||
<?php
|
||||
|
||||
class Page3MultiForm extends MultiForm {
|
||||
class Page3MultiForm extends MultiForm
|
||||
{
|
||||
|
||||
public static $start_step = 'Page3StartFormStep';
|
||||
|
||||
public function finish($data, $form) {
|
||||
public function finish($data, $form)
|
||||
{
|
||||
parent::finish($data, $form);
|
||||
$steps = DataObject::get('MultiFormStep', "SessionID = {$this->session->ID}");
|
||||
if($steps) {
|
||||
foreach($steps as $step) {
|
||||
if($step->class == 'Page3PersonalDetailsFormStep') {
|
||||
if ($steps) {
|
||||
foreach ($steps as $step) {
|
||||
if ($step->class == 'Page3PersonalDetailsFormStep') {
|
||||
$member = new Member();
|
||||
$data = $step->loadData();
|
||||
if($data) {
|
||||
if ($data) {
|
||||
$member->update($data);
|
||||
$member->write();
|
||||
}
|
||||
}
|
||||
|
||||
if($step->class == 'Page3OrganisationDetailsFormStep') {
|
||||
if ($step->class == 'Page3OrganisationDetailsFormStep') {
|
||||
$organisation = new Organisation();
|
||||
$data = $step->loadData();
|
||||
if($data) {
|
||||
if ($data) {
|
||||
$organisation->update($data);
|
||||
if($member && $member->ID) $organisation->MemberID = $member->ID;
|
||||
if ($member && $member->ID) {
|
||||
$organisation->MemberID = $member->ID;
|
||||
}
|
||||
$organisation->write();
|
||||
}
|
||||
}
|
||||
@ -34,15 +38,15 @@ class Page3MultiForm extends MultiForm {
|
||||
$controller = $this->getController();
|
||||
$controller->redirect($controller->Link() . 'finished');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class Page3StartFormStep extends MultiFormStep {
|
||||
class Page3StartFormStep extends MultiFormStep
|
||||
{
|
||||
|
||||
public static $next_steps = 'Page3PersonalDetailsFormStep';
|
||||
|
||||
function getFields() {
|
||||
public function getFields()
|
||||
{
|
||||
return new FieldList(
|
||||
new LiteralField('Details', '<b>This is important</b><br />
|
||||
<p>You will receiving email once you participate in this survey. <br />
|
||||
@ -53,33 +57,31 @@ class Page3StartFormStep extends MultiFormStep {
|
||||
new CheckboxField('Unsubscribe', 'Tick that you confirm the above details.')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Page3PersonalDetailsFormStep extends MultiFormStep {
|
||||
class Page3PersonalDetailsFormStep extends MultiFormStep
|
||||
{
|
||||
|
||||
public static $next_steps = 'Page3OrganisationDetailsFormStep';
|
||||
|
||||
function getFields() {
|
||||
public function getFields()
|
||||
{
|
||||
return new FieldList(
|
||||
new TextField('FirstName', 'First name'),
|
||||
new TextField('Surname', 'Surname')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class Page3OrganisationDetailsFormStep extends MultiFormStep {
|
||||
class Page3OrganisationDetailsFormStep extends MultiFormStep
|
||||
{
|
||||
|
||||
public static $is_final_step = true;
|
||||
|
||||
function getFields() {
|
||||
public function getFields()
|
||||
{
|
||||
return new FieldList(
|
||||
new TextField('OrganisationName', 'Organisation Name')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -1,22 +1,22 @@
|
||||
<?php
|
||||
|
||||
class Page3MultiFormTestPage extends Page {
|
||||
|
||||
class Page3MultiFormTestPage extends Page
|
||||
{
|
||||
}
|
||||
|
||||
class Page3MultiFormTestPage_Controller extends Page_Controller {
|
||||
class Page3MultiFormTestPage_Controller extends Page_Controller
|
||||
{
|
||||
|
||||
function Page3MultiForm() {
|
||||
public function Page3MultiForm()
|
||||
{
|
||||
return new Page3MultiForm($this, 'Page3MultiForm');
|
||||
}
|
||||
|
||||
function finished() {
|
||||
public function finished()
|
||||
{
|
||||
return array(
|
||||
'Title' => 'Thank you for your submission',
|
||||
'Content' => '<p>You have successfully submitted the form. Thanks!</p>'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -1,21 +1,23 @@
|
||||
<?php
|
||||
class TestMultiForm extends MultiForm {
|
||||
class TestMultiForm extends MultiForm
|
||||
{
|
||||
public static $start_step = 'TestMultiFormStepOne';
|
||||
|
||||
function finish($data, $form) {
|
||||
public function finish($data, $form)
|
||||
{
|
||||
parent::finish($data, $form);
|
||||
|
||||
$savedSteps = $this->getSavedSteps();
|
||||
|
||||
$savedData = array();
|
||||
foreach($savedSteps as $step) {
|
||||
foreach ($savedSteps as $step) {
|
||||
$savedData = array_merge($savedData, $step->loadData());
|
||||
}
|
||||
|
||||
$fields = new FieldList();
|
||||
$fields->push(new LiteralField("Heading", "<h3>You have submitted the following information:</h3>"));
|
||||
|
||||
foreach($savedData as $key=>$value) {
|
||||
foreach ($savedData as $key=>$value) {
|
||||
$fields->push(new LiteralField($key . '_copy', "<p><strong>$key</strong> $value</p>"));
|
||||
}
|
||||
|
||||
@ -25,23 +27,25 @@ class TestMultiForm extends MultiForm {
|
||||
}
|
||||
}
|
||||
|
||||
class TestMultiFormStepOne extends MultiFormStep {
|
||||
class TestMultiFormStepOne extends MultiFormStep
|
||||
{
|
||||
public static $next_steps = 'TestMultiFormStepTwo';
|
||||
|
||||
function getFields() {
|
||||
public function getFields()
|
||||
{
|
||||
return new FieldList(
|
||||
new TextField('FirstName', 'First name'),
|
||||
new TextField('Surname', 'Surname')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class TestMultiFormStepTwo extends MultiFormStep {
|
||||
class TestMultiFormStepTwo extends MultiFormStep
|
||||
{
|
||||
public static $next_steps = 'TestMultiFormStepThree';
|
||||
|
||||
function getFields() {
|
||||
|
||||
public function getFields()
|
||||
{
|
||||
return new FieldList(
|
||||
new TextField('Email', 'Email'),
|
||||
new TextField('Address', 'Address')
|
||||
@ -50,23 +54,27 @@ class TestMultiFormStepTwo extends MultiFormStep {
|
||||
}
|
||||
|
||||
|
||||
class TestMultiFormStepThree extends MultiFormStep {
|
||||
class TestMultiFormStepThree extends MultiFormStep
|
||||
{
|
||||
public static $is_final_step = true;
|
||||
|
||||
function getFields() {
|
||||
public function getFields()
|
||||
{
|
||||
$form = $this->getForm();
|
||||
$savedSteps = $form->getSavedSteps();
|
||||
|
||||
$savedData = array();
|
||||
foreach($savedSteps as $step) {
|
||||
foreach ($savedSteps as $step) {
|
||||
$savedData = array_merge($savedData, $step->loadData());
|
||||
}
|
||||
|
||||
$fields = new FieldList();
|
||||
$fields->push(new LiteralField("Heading", "<h3>You have submitted the following information:</h3>"));
|
||||
|
||||
foreach($savedData as $key=>$value) {
|
||||
if(preg_match("/_copy$/", $key)) continue;
|
||||
foreach ($savedData as $key=>$value) {
|
||||
if (preg_match("/_copy$/", $key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fields->push(new LiteralField($key . '_copy', "<p><strong>$key</strong> $value</p>"));
|
||||
}
|
||||
@ -74,4 +82,3 @@ class TestMultiFormStepThree extends MultiFormStep {
|
||||
return $fields;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,18 +1,21 @@
|
||||
<?php
|
||||
class TestMultiFormPage extends Page {
|
||||
|
||||
class TestMultiFormPage extends Page
|
||||
{
|
||||
}
|
||||
|
||||
class TestMultiFormPage_Controller extends Page_Controller {
|
||||
class TestMultiFormPage_Controller extends Page_Controller
|
||||
{
|
||||
|
||||
function Form() {
|
||||
public function Form()
|
||||
{
|
||||
$form = new TestMultiForm($this, 'Form', new FieldList(), new FieldList());
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
function FormMessage() {
|
||||
if(Session::get('MultiFormMessage')) {
|
||||
public function FormMessage()
|
||||
{
|
||||
if (Session::get('MultiFormMessage')) {
|
||||
$message = Session::get('MultiFormMessage');
|
||||
Session::clear('MultiFormMessage');
|
||||
|
||||
|
@ -1,15 +1,17 @@
|
||||
<?php
|
||||
class RecaptchaTestPage extends Page {
|
||||
|
||||
class RecaptchaTestPage extends Page
|
||||
{
|
||||
}
|
||||
|
||||
class RecaptchaTestPage_Controller extends Page_Controller {
|
||||
class RecaptchaTestPage_Controller extends Page_Controller
|
||||
{
|
||||
|
||||
function Form() {
|
||||
public function Form()
|
||||
{
|
||||
$fields = new FieldList(
|
||||
new TextField('MyText')
|
||||
);
|
||||
if(class_exists('RecaptchaField')) {
|
||||
if (class_exists('RecaptchaField')) {
|
||||
$fields->push(new RecaptchaField('MyRecaptcha'));
|
||||
} else {
|
||||
$fields->push(new LiteralField('<p class="message error">RecaptchaField class not found</p>'));
|
||||
@ -28,10 +30,10 @@ class RecaptchaTestPage_Controller extends Page_Controller {
|
||||
return $form;
|
||||
}
|
||||
|
||||
function submit($data, $form) {
|
||||
public function submit($data, $form)
|
||||
{
|
||||
$form->sessionMessage('Hooray!', 'good');
|
||||
|
||||
return Director::redirectBack();
|
||||
}
|
||||
|
||||
}
|
@ -1,18 +1,21 @@
|
||||
<?php
|
||||
class SifrPage extends Page {
|
||||
class SifrPage extends Page
|
||||
{
|
||||
|
||||
function getCMSFields() {
|
||||
public function getCMSFields()
|
||||
{
|
||||
$fields = parent::getCMSFields();
|
||||
$fields->addFieldToTab("Root.Content.SifrSampleImage", new LiteralField("SifrSampleImage", '<p><img src="frameworktest/images/sifr_sample.png"/></p>'));
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class SifrPage_Controller extends Page_Controller {
|
||||
class SifrPage_Controller extends Page_Controller
|
||||
{
|
||||
|
||||
function init() {
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
Sifr::add_font('blackout', 'themes/fonts/blackout.swf');
|
||||
|
Loading…
Reference in New Issue
Block a user