Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converted to PSR-2 #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions code/ImageResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,39 @@
//Commented out due to this already being used in tabpage
class ImageResource extends DataObject
{
public static $db = array (
public static $db = array(
'Title' => 'Text',
'Caption' => 'Text',
'SortID'=>'Int'
'SortID'=>'Int'
);



public static $default_sort='SortID';

static $has_one = array (
public static $has_one = array(
'Attachment' => 'Image', //Needs to be an image
'SuperSizePage' => 'SuperSizePage',
'HomePage' => 'HomePage'

);

public static $summary_fields = array(
'Thumbnail'=>'Thumbnail',
'Title' => 'Title',
'Caption' => 'Caption'
);

public function getThumbnail() {
if ($Image = $this->Attachment()->ID) {
return $this->Attachment()->SetWidth(80);
} else {
return '(No Image)';
}
}

public function getCMSFields()
'Thumbnail'=>'Thumbnail',
'Title' => 'Title',
'Caption' => 'Caption'
);

public function getThumbnail()
{
if ($Image = $this->Attachment()->ID) {
return $this->Attachment()->SetWidth(80);
} else {
return '(No Image)';
}
}

public function getCMSFields()
{
return new Fieldlist(
new TextField('Title'),
Expand Down
110 changes: 53 additions & 57 deletions code/SuperSizePage.php
Original file line number Diff line number Diff line change
@@ -1,43 +1,44 @@
<?php

class SuperSizePage extends Page {
class SuperSizePage extends Page
{


//for text variables
//for text variables
/*
Static $db = array(
'Text1' => 'Text',
'Text2' => 'Text'
);
Static $db = array(
'Text1' => 'Text',
'Text2' => 'Text'
);
*/


// for photos

/*
public static $has_one = array(
'Photo' => 'Image',
'Photo2' => 'Image'
);
'Photo' => 'Image',
'Photo2' => 'Image'
);

*/

static $has_many = array (
public static $has_many = array(
'Images' => 'ImageResource'
);


//for CMS mod
function getCMSFields() {

$fields = parent::getCMSFields();
public function getCMSFields()
{
$fields = parent::getCMSFields();

$config = GridFieldConfig_RelationEditor::create(10);
$config->addComponent(new GridFieldSortableRows('SortID'));
$config = GridFieldConfig_RelationEditor::create(10);
$config->addComponent(new GridFieldSortableRows('SortID'));
// Set the names and data for our gridfield columns
/*
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array(
Expand All @@ -53,51 +54,46 @@ function getCMSFields() {
'ImageResource', // Field title
$this->Images(), // List of all related images
$config
);
);
// Create a tab named "gallery" and add our field to it
$fields->addFieldToTab('Root.Gallery', $imagesField);



$fields->addFieldToTab("Root.Content.Gallery", new HeaderField("Images for the gallery","2"));





return $fields;

}



$fields->addFieldToTab("Root.Content.Gallery", new HeaderField("Images for the gallery", "2"));





return $fields;
}
}

class SuperSizePage_Controller extends Page_Controller {
public function init() {
parent::init();
class SuperSizePage_Controller extends Page_Controller
{
public function init()
{
parent::init();

// Note: you should use SS template require tags inside your templates
// instead of putting Requirements calls here. However these are
// included so that our older themes still work
/*
// Note: you should use SS template require tags inside your templates
// instead of putting Requirements calls here. However these are
// included so that our older themes still work
/*
Requirements::themedCSS('layout');
Requirements::themedCSS('typography');
Requirements::themedCSS('form');
Requirements::themedCSS('typography');
Requirements::themedCSS('form');
*/
//Requirements::css("themes/nzproperty/js/fancybox/jquery.fancybox-1.3.4.css");

//Requirements::javascript("themes/nzproperty/js/fancybox/jquery.fancybox-1.3.4.js");
//Requirements::javascript("themes/nzproperty/js/fancybox/gallery.js");
Requirements::clear();

//Requirements::css(MODULE_SUPERSIZE_DIR . '/css/supersized.css');

Requirements::javascript(MODULE_SUPERSIZE_DIR . '/js/jquery.easing.min.js');
Requirements::javascript(MODULE_SUPERSIZE_DIR . '/js/supersized.3.2.5.min.js');
Requirements::javascript(MODULE_SUPERSIZE_DIR . '/theme/supersized.shutter.min.js');

}



//Requirements::css("themes/nzproperty/js/fancybox/jquery.fancybox-1.3.4.css");

//Requirements::javascript("themes/nzproperty/js/fancybox/jquery.fancybox-1.3.4.js");
//Requirements::javascript("themes/nzproperty/js/fancybox/gallery.js");
Requirements::clear();

//Requirements::css(MODULE_SUPERSIZE_DIR . '/css/supersized.css');

Requirements::javascript(MODULE_SUPERSIZE_DIR . '/js/jquery.easing.min.js');
Requirements::javascript(MODULE_SUPERSIZE_DIR . '/js/supersized.3.2.5.min.js');
Requirements::javascript(MODULE_SUPERSIZE_DIR . '/theme/supersized.shutter.min.js');
}
}