...
 
Commits (4)
{
"github-slug": "silverstripe/silverstripe-installer",
"changelog-holder": "silverstripe/framework",
"changelog-path": "docs/en/04_Changelogs/{stability}/{version}.md",
"child-stability-inherit": true,
"dependency-constraint": "exact",
"vendors": [
"silverstripe"
],
"archives": [
{
"recipe": "silverstripe/installer",
"files": [
"SilverStripe-cms-v{version}.zip",
"SilverStripe-cms-v{version}.tar.gz"
]
}
]
}
# For more information about the properties used in
# this file, please see the EditorConfig documentation:
# http://editorconfig.org/
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.yml]
indent_size = 2
indent_style = space
[{.travis.yml,package.json}]
# The indent size used in the `package.json` file cannot be changed
# https://github.com/npm/npm/pull/3180#issuecomment-16336516
indent_size = 2
indent_style = space
# ignore composer lock file
composer.lock
# ignore cache folder
/silverstripe-cache/
# ignore all environment files
_ss_environment.php
# ignore composer vendor folder
/vendor/
/framework/
/cms/
/assets/
/siteconfig/
/reports/
/blog/
/lumberjack/
/tagfield/
## Overview
Base project folder for a SilverStripe ([http://silverstripe.org](http://silverstripe.org)) installation. Requires additional modules to function:
* [`framework`](http://github.com/silverstripe/silverstripe-framework): Module including the base framework
* [`cms`](http://github.com/silverstripe/silverstripe-cms): Module including a Content Management System
* [`siteconfig`](http://github.com/silverstripe/silverstripe-siteconfig): Module providing a Settings tab in the admin section allowing users to set site wide global configuration.
* `themes/simple` (optional)
## Installation ##
See [installation on different platforms](http://doc.silverstripe.org/framework/en/installation/),
and [installation from source](http://doc.silverstripe.org/framework/en/installation/from-source).
## Bugtracker ##
Bugs are tracked on github.com ([framework issues](https://github.com/silverstripe/silverstripe-framework/issues),
[cms issues](https://github.com/silverstripe/silverstripe-cms/issues)).
Please read our [issue reporting guidelines](http://doc.silverstripe.org/framework/en/misc/contributing/issues).
## Development and Contribution ##
If you would like to make changes to the SilverStripe core codebase, we have an extensive [guide to contributing code](http://doc.silverstripe.org/framework/en/misc/contributing/code).
## Links ##
* [Changelogs](http://doc.silverstripe.org/framework/en/changelogs/)
* [Bugtracker: Framework](https://github.com/silverstripe/silverstripe-framework/issues)
* [Bugtracker: CMS](https://github.com/silverstripe/silverstripe-cms/issues)
* [Bugtracker: Installer](https://github.com/silverstripe/silverstripe-installer/issues)
* [Forums](http://silverstripe.org/forums)
* [Developer Mailinglist](https://groups.google.com/forum/#!forum/silverstripe-dev)
## License ##
Copyright (c) 2007-2013, SilverStripe Limited - www.silverstripe.com
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of SilverStripe nor the names of its contributors may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
{
"name": "silverstripe/installer",
"description": "The SilverStripe Framework Installer",
"require": {
"php": ">=5.3.3",
"silverstripe/cms": "3.7.3@stable",
"silverstripe/framework": "3.7.3@stable",
"silverstripe/reports": "3.7.3@stable",
"silverstripe/siteconfig": "3.7.3@stable",
"silverstripe-themes/simple": "3.1.*",
"silverstripe/blog": "2.5.2",
"webbuilders-group/silverstripe-stripe-gateway": "dev-master"
},
"require-dev": {
"phpunit/phpunit": "^3 || ^4 || ^5"
},
"extra": [],
"config": {
"process-timeout": 600
},
"prefer-stable": true,
"minimum-stability": "dev"
}
favicon.ico

1.37 KB

<?php
/************************************************************************************
************************************************************************************
** **
** If you can read this text in your browser then you don't have PHP installed. **
** Please install PHP 5.3.3 or higher, preferably PHP 5.3.4+. **
** **
************************************************************************************
************************************************************************************/
/**
* This script bolts on top of SilverStripe to allow access without the use of .htaccess
* rewriting rules.
*/
// This is the URL of the script that everything must be viewed with.
define('BASE_SCRIPT_URL', 'index.php/');
$ruLen = strlen($_SERVER['REQUEST_URI']);
$snLen = strlen($_SERVER['SCRIPT_NAME']);
$isIIS = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false);
// IIS will populate server variables using one of these two ways
if ($isIIS) {
if ($_SERVER['REQUEST_URI'] == $_SERVER['SCRIPT_NAME']) {
$url = "";
} elseif ($ruLen > $snLen && substr($_SERVER['REQUEST_URI'], 0, $snLen + 1) == ($_SERVER['SCRIPT_NAME'] . '/')) {
$url = substr($_SERVER['REQUEST_URI'], $snLen+1);
$url = strtok($url, '?');
} else {
$url = $_SERVER['REQUEST_URI'];
if ($url[0] == '/') {
$url = substr($url, 1);
}
$url = strtok($url, '?');
}
// Apache will populate the server variables this way
} else {
if ($ruLen > $snLen && substr($_SERVER['REQUEST_URI'], 0, $snLen+1) == ($_SERVER['SCRIPT_NAME'] . '/')) {
$url = substr($_SERVER['REQUEST_URI'], $snLen+1);
$url = strtok($url, '?');
} else {
$url = "";
}
}
$_GET['url'] = $_REQUEST['url'] = $url;
$fileName = dirname($_SERVER['SCRIPT_FILENAME']) . '/' . $url;
/**
* This code is a very simple wrapper for sending files
* Very quickly pass through references to files
*/
if ($url && file_exists($fileName)) {
$fileURL = (dirname($_SERVER['SCRIPT_NAME'])=='/'?'':dirname($_SERVER['SCRIPT_NAME'])) . '/' . $url;
if (isset($_SERVER['QUERY_STRING'])) {
$fileURL .= '?' . $_SERVER['QUERY_STRING'];
}
header($_SERVER['SERVER_PROTOCOL'] . ' 301 Moved Permanently');
header("Location: $fileURL");
die();
}
require_once 'framework/main.php';
<FilesMatch "\.(php|php3|php4|php5|phtml|inc)$">
Deny from all
</FilesMatch>
\ No newline at end of file
<?php
global $project;
$project = 'mysite';
global $databaseConfig;
$databaseConfig = array(
'type' => 'MySQLPDODatabase',
'server' => '172.17.0.1',
'username' => 'oeru',
'password' => 'LcaKaF2OTMJyANpOv',
'database' => 'oeru_20190611',
'path' => ''
);
// Set the site locale
i18n::set_locale('en_GB');
// Enable nested URLs for this site (e.g. page/sub-page/)
if (class_exists('SiteTree')) SiteTree::enable_nested_urls();
HtmlEditorConfig::get('cms')->setOption('auto_resize', 'true');
HtmlEditorConfig::get('cms')->setOption('theme_advanced_blockformats', 'h3, h4, h5, p');
//Disable blog comments
//BlogEntry::$defaults["ProvideComments"] = false;
//Add site config
Object::add_extension('SiteConfig', 'MySiteConfig');
//Enable search engine
FulltextSearchable::enable();
---
Name: mysite
After:
- 'framework/*'
- 'cms/*'
---
# YAML configuration for SilverStripe
# See http://doc.silverstripe.org/framework/en/topics/configuration
# Caution: Indentation through two spaces, not tabs
SSViewer:
theme: 'oeru'
PaymentGateway:
environemnt:
'dev'
PaymentProcessor:
supported_methods:
dev:
- 'StripePaymentGateway'
live:
- 'StripePaymentGateway'
StripeGateway:
test_api_secret: "sk_test_WbzTKkWUHqJWQiNoPhHU8KmN"
api_secret: "sk_live_1Q7DbvLk8e4RTL5u89XRbyx8"
?<style>
.icon.icon-newsplash { background: url('themes/oeru/img/newsplash-gray-icon.png');
</style>
<div class="cms-menu cms-panel cms-panel-layout west" id="cms-menu" data-layout-type="border">
<div class="cms-logo-header north">
<div class="cms-logo">
<a href="$ApplicationLink" target="_blank" title="SilverStripe (Version - $CMSVersion)">
SilverStripe <% if CMSVersion %><abbr class="version">$CMSVersion</abbr><% end_if %>
</a>
<span><% if SiteConfig %>$SiteConfig.Title<% else %>$ApplicationName<% end_if %></span>
</div>
<div class="cms-login-status">
<a href="Security/logout" class="logout-link" title="<% _t('LeftAndMain_Menu_ss.LOGOUT','Log out') %>"><% _t('LeftAndMain_Menu_ss.LOGOUT','Log out') %></a>
<% with CurrentMember %>
<span>
<% _t('LeftAndMain_Menu_ss.Hello','Hi') %>
<a href="{$AbsoluteBaseURL}admin/myprofile" class="profile-link ss-ui-dialog-link" data-popupclass="edit-profile-popup">
<% if FirstName && Surname %>$FirstName $Surname<% else_if FirstName %>$FirstName<% else %>$Email<% end_if %>
</a>
</span>
<% end_with %>
</div>
</div>
<div class="cms-panel-content center">
<ul class="cms-menu-list">
<% loop MainMenu %>
<li class="$LinkingMode $FirstLast <% if LinkingMode == 'link' %><% else %>opened<% end_if %>" id="Menu-$Code" title="$Title.ATT">
<a href="$Link" <% if Code == 'Help' %>target="_blank"<% end_if%>>
<span class="icon icon-16 icon-{$Code.LowerCase}">&nbsp;</span>
<span class="text">$Title</span>
</a>
</li>
<% end_loop %>
<li id="newSplash" class="link" title="newSplash">
<a href="http://newsplash.co.nz/" target="_blank">
<span class="icon icon-16 icon-newsplash"> </span>
<span class="text">newSplash Studio</span>
</a>
</li>
</ul>
</div>
<div class="cms-panel-toggle south">
<a class="toggle-expand" href="#"><span>&raquo;</span></a>
<a class="toggle-collapse" href="#"><span>&laquo;</span></a>
</div>
</div>
\ No newline at end of file
<?php
class AccordionPage extends Page {
private static $icon = "themes/oeru/img/icon-speech.png";
private static $db = array(
'Content' => 'HTMLText'
);
private static $has_one = array();
private static $allowed_children = array();
private static $has_many = array(
'AccordionItem' => 'AccordionItem'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$accordiongrid = new GridField(
'AccordionItem',
'',
AccordionItem::get()->where("AccordionID = '$this->ID'"),
GridFieldConfig_RelationEditor::create()
);
$fields->addFieldToTab('Root.Main', $accordiongrid);
return $fields;
}
}
class AccordionPage_Controller extends Page_Controller {
/**
* An array of actions that can be accessed via a request. Each array element should be an action name, and the
* permissions or conditions required to allow the user to access it.
*
* <code>
* array (
* 'action', // anyone can access this action
* 'action' => true, // same as above
* 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
* 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
* );
* </code>
*
* @var array
*/
public static $allowed_actions = array (
);
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
//Requirements::themedCSS('reset');
//Requirements::themedCSS('layout');
//Requirements::themedCSS('typography');
//Requirements::themedCSS('form');
}
public function getAccordionItems() {
return AccordionItem::get()->where("AccordionID = '$this->ID'");
}
}
<?php
class ContactPage extends Page {
static $icon = "themes/oeru/img/icon-mail.png";
private static $db = array(
'Mailto' => 'Varchar(100)',
'SubmitText' => 'HTMLText'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.OnSubmission", new TextField('Mailto', 'Send email to'));
$fields->addFieldToTab("Root.OnSubmission", new HTMLEditorField('SubmitText', 'Success Message'));
return $fields;
}
}
class ContactPage_Controller extends Page_Controller {
static $allowed_actions = array(
'ContactForm'
);
function ContactForm() {
// Create fields
$fields = new FieldList(
new TextField('Name', 'Name*'),
new EmailField('Email', 'Email*'),
new TextareaField('Comments','Comments*')
);
// Create action
$actions = new FieldList(
new FormAction('SendContactForm', 'Send')
);
// Create Validators
$validator = new RequiredFields('Name', 'Email', 'Comments');
return new Form($this, 'ContactForm', $fields, $actions, $validator);
}
function SendContactForm($data, $form) {
//Set data
$From = $data['Email'];
$To = $this->Mailto;
$Subject = "OERu Website - New enquiry";
$email = new Email($From, $To, $Subject);
//set template
$email->setTemplate('EmailTemplate');
//populate template
$email->populateTemplate($data);
//send mail
$email->send();
//return to submitted message
$this->Redirect($this->Link("?success=1"));
}
public function Success()
{
return isset($_REQUEST['success']) && $_REQUEST['success'] == "1";
}
}
<?php
class CourseMainPage extends Page {
static $icon = "themes/oeru/img/icon-other.png";
private static $db = array();
private static $has_one = array();
private static $allowed_children = array();
private static $has_many = array();
function getCMSFields() {
$fields = parent::getCMSFields();
return $fields;
}
}
class CourseMainPage_Controller extends Page_Controller {
/**
* An array of actions that can be accessed via a request. Each array element should be an action name, and the
* permissions or conditions required to allow the user to access it.
*
* <code>
* array (
* 'action', // anyone can acc
* ess this action
* 'action' => true, // same as above
* 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
* 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
* );
* </code>
*
* @var array
*/
public static $allowed_actions = array (
);
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
//Requirements::themedCSS('reset');
//Requirements::themedCSS('layout');
//Requirements::themedCSS('typography');
//Requirements::themedCSS('form');
Requirements::javascript("themes/oeru/js/customSort.js");
}
public function getCoursePages() {
$queryType = '';
$queryDate = '';
/*
* CASE
* WHEN StartDate IS NULL THEN DATE_ADD(REPLACE(IndictiveStart, 'Q', '-01-0'), INTERVAL 1 YEAR) # New/Planned
* WHEN Date(StartDate) > Date(Now()) THEN DATE_SUB(StartDate, INTERVAL 10 YEAR) # Future
* WHEN Date(EndDate) < Date(Now()) THEN DATE_ADD(EndDate, INTERVAL 10 YEAR) #Past
* ELSE StartDate # Current
* END ASC;
*/
$querySorter = "CASE WHEN StartDate IS NULL THEN DATE_ADD(REPLACE(IndictiveStart, 'Q', '-01-0'), INTERVAL 1 YEAR) WHEN Date(StartDate) > Date(Now()) THEN DATE_SUB(StartDate, INTERVAL 10 YEAR) WHEN Date(EndDate) < Date(Now()) THEN DATE_ADD(EndDate, INTERVAL 10 YEAR) ELSE StartDate END ASC";
if((isset($_REQUEST['type'])) || (isset($_REQUEST['courses']))) {
if(isset($_REQUEST['type'])) {
$queryType = " AND Type Like '%".$_REQUEST['type']."%'";
}
if (isset($_REQUEST['courses'])) {
if($_REQUEST['courses'] == "future") {
$queryDate = "Date(EndDate) > Date(Now()) AND Date(StartDate) > Date(Now())";
}
else if ($_REQUEST['courses'] == "current") {
$queryDate = "Date(EndDate) > Date(Now()) AND Date(StartDate) < Date(Now())";
}
else if ($_REQUEST['courses'] == "past") {
$queryDate = "Date(EndDate) < Date(Now()) AND Date(StartDate) < Date(Now())";
}
else if ($_REQUEST['courses'] == "new") {
$queryDate = "StartDate is null";
}
else {
$queryType = substr($queryType, 4,strlen($queryType)-4);
}
}
if($_REQUEST['courses'] == "future") {
$data = CoursePage::get()->where($queryDate.$queryType)->sort("StartDate ASC");
}
else if ($_REQUEST['courses'] == "past") {
$data = CoursePage::get()->where($queryDate.$queryType)->sort("StartDate DESC");
}
else if ($_REQUEST['courses'] == "current") {
$data = CoursePage::get()->where($queryDate.$queryType)->sort("StartDate ASC");
}
else
$data = CoursePage::get()->where($queryDate.$queryType)->sort($querySorter);
return $data;
}
return CoursePage::get()->where("1")->sort($querySorter);
}
public function Courses() {
return CoursePage::get();
}
}
<?php
class CourseMainPage extends Page {
static $icon = "themes/oeru/img/icon-other.png";
private static $db = array();
private static $has_one = array();
private static $allowed_children = array();
private static $has_many = array();
function getCMSFields() {
$fields = parent::getCMSFields();
return $fields;
}
}
class CourseMainPage_Controller extends Page_Controller {
/**
* An array of actions that can be accessed via a request. Each array element should be an action name, and the
* permissions or conditions required to allow the user to access it.
*
* <code>
* array (
* 'action', // anyone can acc
* ess this action
* 'action' => true, // same as above
* 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
* 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
* );
* </code>
*
* @var array
*/
public static $allowed_actions = array (
);
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
//Requirements::themedCSS('reset');
//Requirements::themedCSS('layout');
//Requirements::themedCSS('typography');
//Requirements::themedCSS('form');
Requirements::javascript("themes/oeru/js/customSort.js");
}
public function getCoursePages() {
$queryType = '';
$queryDate = '';
$querySorter = "CASE WHEN StartDate IS NULL THEN DATE_ADD(REPLACE(IndictiveStart, 'Q', '-01-0'), INTERVAL 1 YEAR) WHEN Date(StartDate) > Date(Now()) THEN DATE_SUB(StartDate, INTERVAL 10 YEAR) WHEN Date(EndDate) < Date(Now()) THEN DATE_ADD(EndDate, INTERVAL 10 YEAR) ELSE StartDate END ASC";
if((isset($_REQUEST['type'])) || (isset($_REQUEST['courses']))) {
if(isset($_REQUEST['type'])) {
$queryType = " AND Type Like '%".$_REQUEST['type']."%'";
}
if (isset($_REQUEST['courses'])) {
if($_REQUEST['courses'] == "future") {
$queryDate = "Date(EndDate) > Date(Now()) AND Date(StartDate) > Date(Now())";
}
else if ($_REQUEST['courses'] == "current") {
$queryDate = "Date(EndDate) > Date(Now()) AND Date(StartDate) < Date(Now())";
}
else if ($_REQUEST['courses'] == "past") {
$queryDate = "Date(EndDate) < Date(Now()) AND Date(StartDate) < Date(Now())";
}
else if ($_REQUEST['courses'] == "new") {
$queryDate = "StartDate is null";
}
else {
$queryType = substr($queryType, 4,strlen($queryType)-4);
}
}
if($_REQUEST['courses'] == "future") {
$data = CoursePage::get()->where($queryDate.$queryType)->sort("StartDate ASC");
}
else if ($_REQUEST['courses'] == "past") {
$data = CoursePage::get()->where($queryDate.$queryType)->sort("StartDate DESC");
}
else if ($_REQUEST['courses'] == "current") {
$data = CoursePage::get()->where($queryDate.$queryType)->sort("StartDate ASC");
}
else
$data = CoursePage::get()->where($queryDate.$queryType)->sort($querySorter);
return $data;
}
return CoursePage::get()->where("1")->sort($querySorter);
}
public function Courses() {
return CoursePage::get();
}
}
This diff is collapsed.
This diff is collapsed.
<?php
class Credits extends Page {
private static $icon = "themes/oeru/img/icon-home.png";
private static $db = array();
private static $has_one = array();
private static $allowed_children = array();
private static $has_many = array(
'HomeSection' => 'HomeSection'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$homeSectionField = new GridField(
'HomeSection',
'',
HomeSection::get()->where("ParentID = '$this->ID'"),
GridFieldConfig_RelationEditor::create()
);
$fields->addFieldToTab('Root.Main', new HeaderField("HomeSectionName", "Sections"));
$fields->addFieldToTab('Root.Main', $homeSectionField);
return $fields;
}
}
class Credits_Controller extends Page_Controller {
/**
* An array of actions that can be accessed via a request. Each array element should be an action name, and the
* permissions or conditions required to allow the user to access it.
*
* <code>
* array (
* 'action', // anyone can access this action
* 'action' => true, // same as above
* 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
* 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
* );
* </code>
*
* @var array
*/
public static $allowed_actions = array (
);
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
//Requirements::themedCSS('reset');
//Requirements::themedCSS('layout');
//Requirements::themedCSS('typography');
//Requirements::themedCSS('form');
Requirements::themedCSS('flexslider');
Requirements::javascript("themes/oeru/js/jquery.flexslider.min.js");
}
public function getHomeSections() {
return HomeSection::get()->where("ParentID = '$this->ID'");
}
}
<?php
class FacilitatorPage extends Page {
private static $icon = "themes/oeru/img/icon-user.png";
private static $db = array();
private static $has_one = array();
private static $allowed_children = array(
"Facilitator" => "Facilitator"
);
private static $has_many = array(
"Facilitator" => "Facilitator"
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeByName('Content');
$fields->removeByName('Metadata');
$facilitatorField = new GridField(
'Facilitator',
'Facilitator',
Facilitator::get()->where("Partner = '$this->ParentID'"),
GridFieldConfig_RelationEditor::create()
);
$fields->addFieldToTab("Root.Main",$facilitatorField);
return $fields;
}
}
class FacilitatorPage_Controller extends Page_Controller {
/**
* An array of actions that can be accessed via a request. Each array element should be an action name, and the
* permissions or conditions required to allow the user to access it.
*
* <code>
* array (
* 'action', // anyone can access this action
* 'action' => true, // same as above
* 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
* 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
* );
* </code>
*
* @var array
*/
public static $allowed_actions = array (
);
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
//Requirements::themedCSS('reset');
//Requirements::themedCSS('layout');
//Requirements::themedCSS('typography');
//Requirements::themedCSS('form');
Requirements::javascript("themes/oeru/js/jquery.isotope.min.js");
}
public function getFacilitators() {
return Facilitator::get()->where("Partner = '$this->ParentID'");
}
}
<?php
class HomePage extends Page {
private static $icon = "themes/oeru/img/icon-home.png";
private static $db = array();
private static $has_one = array();
private static $allowed_children = array();
private static $has_many = array(
'HomeSection' => 'HomeSection',
'HeroItem' => 'HeroItem'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeByName('Content');
//$config = GridFieldConfig_RelationEditor::create();
//$config->removeComponentsByType(new GridFieldAddExistingAutocompleter());
//$config->removeComponentsByType(new GridFieldAddNewButton());
//$config->addComponent(new GridFieldAddExistingNLAutocompleter('buttons-before-left'));
//$config->removeComponentsByType(new GridFieldDeleteAction());
//$config->addComponent(new GridFieldNLDeleteAction(true));
$homeSectionField = new GridField(
'HomeSection',
'',
HomeSection::get()->where("ParentID = '$this->ID'"),
GridFieldConfig_RelationEditor::create()
);
$name =
$heroItemField = new GridField(
"HeroItem",
"",
HeroItem::get(),
GridFieldConfig_RelationEditor::create()
);
//print_r($mentorsField);
$fields->addFieldToTab('Root.Main', new HeaderField("HomeSectionName", "Sections"));
$fields->addFieldToTab('Root.Main', $homeSectionField);
$fields->addFieldToTab('Root.Main', new HeaderField("HeroName", "Hero Carousel"));
$fields->addFieldToTab('Root.Main', $heroItemField);
return $fields;
}
}
class HomePage_Controller extends Page_Controller {
/**
* An array of actions that can be accessed via a request. Each array element should be an action name, and the
* permissions or conditions required to allow the user to access it.
*
* <code>
* array (
* 'action', // anyone can access this action
* 'action' => true, // same as above
* 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
* 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
* );
* </code>
*
* @var array
*/
public static $allowed_actions = array (
);
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
//Requirements::themedCSS('reset');
//Requirements::themedCSS('layout');
//Requirements::themedCSS('typography');
//Requirements::themedCSS('form');
Requirements::themedCSS('flexslider');
Requirements::javascript("themes/oeru/js/jquery.flexslider.min.js");
}
public function getHomeSections() {
return HomeSection::get()->where("ParentID = '$this->ID'");
}
public function getheroItems() {
return HeroItem::get();
}
public function getPartnerPages() {
return PartnerPage::get()->sort('RAND()');
}
public function getPartnerVideo() {
return PartnerPage::get()->where("VideoURL != ''")->sort('RAND()')->first(1);
}
}
<?php
class Page extends SiteTree {
//static $icon = "themes/oeru/img/icon-speech.png";
private static $db = array(
"Nav" => "Int"
);
private static $has_one = array(
);
private static $allowed_children = array(
"AccordionPage", "ContactPage", "CourseMainPage", "HomePage", "PartnerMainPage", "ErrorPage", "Page", "BlogHolder", "SubscriptionPage", "UnsubscriptionPage", "RegisterCourseUpdate"
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeByName('Metadata');
//Only show nav options on parent pages
if($this->ParentID == 0)
{
$fields->addFieldToTab('Root.Main', new HeaderField("NavigationSection", "Navigation Settings"));
$navoptions = array(
"1" => "Show Page in top navigation",
"2" => "Show Page in bottom navigation",
"3" => "Hide page"
);
$fields->addFieldToTab('Root.Main', new OptionsetField("Nav", "", $navoptions, "1"));
}
return $fields;
}
}
class Page_Controller extends ContentController {
/**
* An array of actions that can be accessed via a request. Each array element should be an action name, and the
* permissions or conditions required to allow the user to access it.
*
* <code>
* array (
* 'action', // anyone can access this action
* 'action' => true, // same as above
* 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
* 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
* );
* </code>
*
* @var array
*/
private static $allowed_actions = array (
);
public function init() {
parent::init();
}
public function getTypeCSSName() {
return lcfirst($this->ClassName);
}
}
<?php
class PartnerMainPage extends Page {
private static $icon = "themes/oeru/img/icon-briefcase.png";
private static $db = array(
'IsotopeTitle' => 'Text',
'PartnerLogoDisclaimer' => 'Text'
);
private static $has_one = array();
private static $allowed_children = array(
'PartnerPage' => 'PartnerPage'
);
private static $has_many = array();
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Main", new TextField( 'IsotopeTitle', 'Isotope Title', $this->IsotopeTitle));
$fields->addFieldToTab("Root.Main", new TextField( 'PartnerLogoDisclaimer', 'Partner Logo Disclaimer', $this->PartnerLogoDisclaimer));
return $fields;
}
}
class PartnerMainPage_Controller extends Page_Controller {
/**
* An array of actions that can be accessed via a request. Each array element should be an action name, and the
* permissions or conditions required to allow the user to access it.
*
* <code>
* array (
* 'action', // anyone can access this action
* 'action' => true, // same as above
* 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
* 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
* );
* </code>
*
* @var array
*/
private static $allowed_actions = array (
);
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
//Requirements::themedCSS('reset');
//Requirements::themedCSS('layout');
//Requirements::themedCSS('typography');
//Requirements::themedCSS('form');
Requirements::javascript("themes/oeru/js/jquery.isotope.min.js");
}
public function getPartnerPages() {
return PartnerPage::get()->sort('RAND()');
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?php
class TopLevelPage extends Page {
private static $icon = "themes/oeru/img/icon-home.png";
private static $db = array(
"AmInFooter" => "Boolean"
);
private static $has_one = array();
private $allowed_children = array();
private static $has_many = array();
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', new CheckboxField("AmInFooter", "Menu appears in the Footer"));
return $fields;
}
}
class TopLevelPage_Controller extends Page_Controller {
/**
* An array of actions that can be accessed via a request. Each array element should be an action name, and the
* permissions or conditions required to allow the user to access it.
*
* <code>
* array (
* 'action', // anyone can access this action
* 'action' => true, // same as above
* 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
* 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
* );
* </code>
*
* @var array
*/
public static $allowed_actions = array (
);
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
//Requirements::themedCSS('reset');
//Requirements::themedCSS('layout');
//Requirements::themedCSS('typography');
//Requirements::themedCSS('form');
}
}
<?php
class AccordionItem extends DataObject {
public static $singularName = 'AccordionItem';
public static $pluralName = 'AccordionItems';
private static $db = array(
'Title' => 'Text',
'Content' => 'HTMLText',
'AccordionID' => 'Int'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->push(new HiddenField("AccordionID", "AccordionID", $this->AccordionID));
$fields->push(new TextField("Title", "Title", $this->Title));
$fields->push(new HTMLEditorField('Content', 'Content', $this->Content));
return $fields;
}
public static $summary_fields = array(
'Title' => 'Title'
);
protected function onBeforeWrite() {
$this->Title = preg_replace('/[\x00-\x1F]/u', '', $this->Title);
$this->Content = preg_replace('/[\x00-\x1F]/u', '', $this->Content);
$myleftandmain = LeftAndMain::curr();
$parentLink = $myleftandmain->breadcrumbs()->last()->Link;
$parentArray = explode('/', $parentLink);
$myParentID = array_pop($parentArray);
$this->AccordionID = $myParentID;
parent::onBeforeWrite();
}
}
<?php
class CourseUpdate extends DataObject {
//public static $singularName = 'AccordionItem';
//public static $pluralName = 'AccordionItems';
public static $db = array(
);
public function getCMSFields() {
$fields = parent::getCMSFields();
return $fields;
}
}
\ No newline at end of file
<?php
/**
* a Home Section contains a Title, Content, Image, ButtonText and Color
*/
class Credential extends DataObject {
public static $singularName = 'Credential';
public static $pluralName = 'Credentials';
public static $db = array (
"Name" => "Text"
);
public static $summary_fields = array( );
static $belongs_many_many = array(
"CoursePages" => "CoursePage"
);
public static $has_one = array();
public static $has_many = array();
public function getCMSFields() {
$fields = new FieldList();
$fields->push( new TextField( 'Name', 'Name', $this->Name ) );
return $fields;
}
/*
* Filter the nasty ETX characters that come from copy-pasting stuff from
* photoshop
*
*/
/*
public static $singular_name = 'StudentStory';
public static $plural_name = 'StudentStories';
public static $db = array(
'Title' => 'Text',
'Summary' => 'Text',
'Content' => 'HTMLText',
'ClassOverride' => 'Text',
'Hidden' => 'Boolean'
);
public static $summary_fields = array( 'Title'=> 'Title');
public static $has_one = array(
'Image' => 'Image',
'Parent' => 'DataObject',
'Programme' => 'ProgrammeInformationPage'
);
public static $has_many = array();
Filter the nasty ETX characters that come from copy-pasting stuff from
photoshop
protected function onBeforeWrite() {
$this->Title = preg_replace('/[\x00-\x1F]/u', '', $this->Title);
$this->Summary = preg_replace('/[\x00-\x1F]/u', '', $this->Summary);
$myleftandmain = LeftAndMain::curr();
$parentLink = $myleftandmain->breadcrumbs()->last()->Link;
$parentArray = explode('/', $parentLink);
$myParentID = array_pop($parentArray);
$this->ParentID = $myParentID;
parent::onBeforeWrite();
}
protected function onAfterWrite() {
parent::onAfterWrite();
$dataobjecttype = StudentStoriesPage::get()->byID($this->MyParentID);
if($dataobjecttype) {
$newstudylink = StudentStoryLink::create();
$newstudylink->ParentID = $this->MyParentID;
$newstudylink->StudentStoryID = $this->ID;
$newstudylink->write();
$this->ParentID = $newstudylink->ID;
}
}
protected function onBeforeDelete() {
if($this->ClassName == 'StudentStory') {
$studentStoryID = $this->ID;
//get ParentID from url
$myleftandmain = LeftAndMain::curr();
$parentLink = $myleftandmain->breadcrumbs()->last()->Link;
$parentArray = explode('/', $parentLink);
$myParentID = array_pop($parentArray);
//query table for instance
$myLinkID = StudentStoryLink::get()->where(array("\"ParentID\" = '".$myParentID."'", "\"StudentStoryID\" = '".$studentStoryID."'"));
foreach ($myLinkID as $memb) {
$memb->delete();
}
}
exit();
parent::onBeforeDelete();
}
public function getCMSFields() {
$fields = new FieldList();
$myleftandmain = LeftAndMain::curr();
$parentLink = $myleftandmain->breadcrumbs()->last()->Link;
$parentArray = explode('/', $parentLink);
$parentID = array_pop($parentArray);
if(is_numeric($parentID)) {
$fields->push( new HiddenField( 'MyParentID','MyParentID', $parentID ) );
}
$fields->push( new TextField( 'Title', 'Title', $this->Title ) );
$imgdesc = '<br/><span style="font-weight:normal">702 x 488</span>';
$UploadField = new UploadField('Image', 'Upload an image'.$imgdesc, $this->Image);
$UploadField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
$UploadField->setConfig('allowedMaxFileNumber', 1);
$UploadField->setRecord($this);
$UploadField->folderName = 'studentstories';
$fields->push( $UploadField );
$fields->push( new TextareaField( 'Summary', 'Summary', $this->Summary ) );
$dropdown = new DropdownField('ProgrammeID', 'Qualification',
ProgrammeInformationPage::get()->map('ID', 'Title') );
$dropdown->setEmptyString('No programme');
$fields->push($dropdown);
$dropdown1 = new OpColorField('ClassOverride', 'Color Override', $this->ClassOverride);
$dropdown1->setEmptyString('');
$fields->push($dropdown1);
$fields->push( new HTMLEditorField( 'Content', 'Content', $this->Content ) );
$fields->push( new CheckboxField('Hidden', 'Hidden') );
return $fields;
}
public function CSSName() {
if ($this->ClassOverride) {
return $this->ClassOverride;
}
}
*/
}
<?php
/**
* a Home Section contains a Title, Content, Image, ButtonText and Color
*/
class Facilitator extends DataObject {
public static $singularName = 'Facilitator';
public static $pluralName = 'Facilitators';
public static $db = array (
"Name" => "Text",
"Summary" => "Text",
"Partner" => "Int"
);
static $searchable_fields = array(
"Name"
);
public static $summary_fields = array(
"Thumbnail", "Name", "Summary"
);
public static $has_one = array(
"Image" => "Image"
//"Partner" => "PartnerPage"
);
static $belongs_many_many = array(
//"CoursePages" => "CoursePage"
);
public static $has_many = array();
protected function onBeforeWrite() {
$this->Title = preg_replace('/[\x00-\x1F]/u', '', $this->Title);
$this->Summary = preg_replace('/[\x00-\x1F]/u', '', $this->Summary);
$myleftandmain = LeftAndMain::curr();
$parentLink = $myleftandmain->breadcrumbs()->last()->Link;
$parentArray = explode('/', $parentLink);
$myParentID = array_pop($parentArray);
$partnerID = DataObject::get_by_id('SiteTree', $myParentID);
//print_r($str->ParentID);
$this->Partner = $partnerID->ParentID;
parent::onBeforeWrite();
}
public function getCMSFields() {
$fields = new FieldList();
$myleftandmain = LeftAndMain::curr();
$parentLink = $myleftandmain->breadcrumbs()->last()->Link;
$parentArray = explode('/', $parentLink);
$myParentID = array_pop($parentArray);
$partnerID = DataObject::get_by_id('SiteTree', $myParentID);
//print_r($myParentID->Parent);
//$str = DataObject::get_by_id('SiteTree', $myParentID);
//print_r($str->ParentID);
$imgdesc = '<br/><span style="font-weight:normal">100 x 100</span>';
$UploadField = new UploadField('Image', 'Profile Image'.$imgdesc, $this->Image);
$UploadField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
$UploadField->setConfig('allowedMaxFileNumber', 1);
$UploadField->setRecord($this);
$UploadField->folderName = 'facilitators';
$fields->push($UploadField );
$fields->push(new TextField( 'Name', 'Title', $this->Title ) );
$fields->push(new TextareaField( 'Summary', 'Summary', $this->Summary ) );
$str = SiteTree::get()->where("ClassName='PartnerPage'");
$array = new ArrayList();
foreach($str as $key => $data) {
$do = new DataObject();
$do->Titles = $data->Title;
$do->MyID = $data->ID;
$array->push($do);
}
$fields->push(new DropdownField('Partner','Partner Organisation',$array->map('MyID','Titles'),$partnerID->ParentID));
return $fields;
}
public function getThumbnail() {
return $this->Image()->CMSThumbnail();
}
public function getFacilitator() {
return Facilitator::get();
}
public function getShortSummary( $word_limit = 23 ) {
$NoHTML = strip_tags( $this->Summary );
$words = explode( ' ', $NoHTML );
return implode( ' ', array_slice( $words, 0, $word_limit ) );
}
public function getFacilitatorSummary() {
$partnerName = DataObject::get_by_id('SiteTree', $this->Partner);
$string = $this->Name .', '. $partnerName->Title;
return $string;
}
}
<?php
class HeroItem extends DataObject {
private static $db = array(
'SortOrder' => 'Int',
'Title' => 'Text',
'Summary' => 'Text',
'PageLink' => 'Text',
'PageLinkText' => 'Text'
);
// One-to-one relationship with gallery page
private static $has_one = array(
'Image' => 'Image',
'HeroItem' => 'HeroItem',
'Page' => 'SiteTree'
);
// tidy up the CMS by not showing these fields
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->push(new TextField("Title", "Title", $this->Title));