Skip to content

Instantly share code, notes, and snippets.

@DavidOliver
Last active December 15, 2015 23:19
Show Gist options
  • Save DavidOliver/5339113 to your computer and use it in GitHub Desktop.
Save DavidOliver/5339113 to your computer and use it in GitHub Desktop.
<?php
require_once(TOOLKIT . '/class.datasource.php');
Class datasourcetour_l_current_presentation_images extends SectionDatasource{
public $dsParamROOTELEMENT = 'tour-l-current-presentation-images';
public $dsParamORDER = 'asc';
public $dsParamPAGINATERESULTS = 'yes';
public $dsParamLIMIT = '1';
public $dsParamSTARTPAGE = '1';
public $dsParamREDIRECTONEMPTY = 'no';
public $dsParamSORT = 'system:id';
public $dsParamASSOCIATEDENTRYCOUNTS = 'no';
public $dsParamFILTERS = array(
'279' => '{$tour:0}',
'282' => 'en'
);
public function __construct($env=NULL, $process_params=true){
parent::__construct($env, $process_params);
$this->_dependencies = array('$ds-tour-l-current.system-id');
}
public function about(){
return array(
'name' => 'Tour (L) (current): Presentation images',
'author' => array(
'name' => 'David Oliver',
'website' => '',
'email' => ''),
'version' => 'Symphony 2.3',
'release-date' => '2013-03-04T18:56:58+00:00'
);
}
public function getSource(){
return '57';
}
public function allowEditorToParse(){
return false;
}
public function execute(array &$param_pool) {
$result = new XMLElement('tour-l-current-presentation-images');
foreach(scandir(WORKSPACE . '/uploads/tours/presentations/by-tours-l/' . $param_pool['ds-tour-l-current.system-id'][0]) as $file) {
if (preg_match('#\.png$#', $file)) {
$result->appendChild(new XMLElement('image', $file));
}
}
return $result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment