ok, did a simple testinstallation.
great work, Kleist, thanks for sharing!
I wanted to render the events from gregorian with bloX (full templefied outputs from arrays) , so I did little work on gregrorian to get the event-array.
added new view class ’GregorianEventarrayView.class.php’:
<?php
class GregorianEventarrayView {
/**
* @var GregorianConfig object
*/
private $config = NULL;
private $_events = array(); // Array of GregorianEvent objects
public function __construct(&$modx, &$xpdo) {
$this->config = new GregorianConfig();
}
public function setCalendar(&$cal) {
$this->cal = &$cal;
}
/**
* Set config variable
* @param string Config name
* @param mixed Config value (default: true)
* @return none
*/
public function set($name,$value = true) {
return $this->config->set($name,$value);
}
/**
* The overall method for showing a view.
* @return unknown_type
*/
public function render() {
//$this->_preRender();
//$events = $this->cal->getEventsMeta();
$this->_events = $this->cal->getFutureEvents();
$events=array();
foreach($this->_events as $key=>$e){
//echo '<pre>'.print_r($e->toArray(),true).'</pre>';
$events[]=$e->toArray();
}
return $events;
}
}
in GregorianController.class.php
changed
switch ($this->_action) {
case 'show':
$output .= $events;
break;
to:
switch ($this->_action) {
case 'show':
$events=$this->_getView();
if (is_array($events)){//added by Bruno for returning eventarray
$output = $events;
}else{
$output .= $events;
}
break;
now I can use for example this code as a blox-project ’getdatas.php’-file to generate the calendar-view:
<?php
$view='Eventarray';
$this->greg_output = include $modx->config['base_path'] . 'assets/snippets/Gregorian/Gregorian.snippet.php';
//print_r($this->greg_output);
foreach($this->greg_output as & $event){
$event['Time']=strtotime($event['dtstart']);
$event['Timeend']=strtotime($event['dtend']);
}
$month = abs($this->bloxconfig['month']);
$year=$this->bloxconfig['year'];
$timestampfirstday = xetadodb_mktime(0, 0, 0, $month, 01, $year);
$cal=$this->xettcal->getMonthCal($year, $month);
$bloxdatas=$this->xettcal->makeMonthArray($this->xetconfig,$cal,array(),$this->greg_output);
//echo '<pre>'.print_r($bloxdatas,true).'</pre>';
$bloxdatas['tsconfig'] = $timestampfirstday;
?>
prepare my project-templates for my needs and get this result:
(very simple, only for this test, nothing formatted)
would be nice to have a function in gregorian $this->cal->getEventsBetweenStartAndEnd($start,$end);