This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ControllerExtension extends Extension { | |
private static $error_codes = array( | |
400 => 'Bad Request', | |
401 => 'Unauthorized', | |
403 => 'Forbidden', | |
404 => 'Not Found', | |
405 => 'Method Not Allowed', | |
406 => 'Not Acceptable', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Forms\GridField; | |
use SilverStripe\ORM\SS_List; | |
use SilverStripe\Forms\GridField\GridField; | |
use SilverStripe\Forms\GridField\GridField_DataManipulator; | |
/** | |
* Custom gridfield that applies canView permissions to list before manipulation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Forms; | |
use SilverStripe\Forms\DropdownField; | |
class SingleSelectListBoxDropdownField extends DropdownField | |
{ | |
/** | |
* Force this field to appear as if it saves an array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def CalculateDistance(Lat1, Lon1, Lat2, Lon2): | |
Lat1 = float(Lat1) | |
Lon1 = float(Lon1) | |
Lat2 = float(Lat2) | |
Lon2 = float(Lon2) | |
nDLat = (Lat1 - Lat2) * 0.017453293 | |
nDLon = (Lon1 - Lon2) * 0.017453293 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Helper class designed to reduce the vat rates on order items when a | |
* BookableProduct is added to cart. | |
* | |
*/ | |
class VatReducer extends Object | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use SilverStripe\Omnipay\GatewayInfo; | |
use SilverStripe\Omnipay\GatewayFieldsFactory; | |
use SilverStripe\Omnipay\Service\ServiceFactory; | |
/** | |
* Summary Controller is responsible for displaying all order data before posting | |
* to the final payment gateway. | |
* |