Commit 557cadf7 authored by Francesco Iannuzzelli's avatar Francesco Iannuzzelli

#26 Images in calendar event

parent 1ff9df63
......@@ -64,6 +64,8 @@ class Events
*/
public $id_group;
private $img_sizes;
/**
* Initialize local properties
*
......@@ -73,7 +75,8 @@ class Events
$this->geo = new Geo();
$this->id_topic = 0;
$this->id_group = 0;
$ini = new Ini;
$conf = new Configuration();
$this->img_sizes = $conf->Get("img_sizes");
}
/**
......@@ -287,6 +290,7 @@ class Events
if($row['has_image']) {
$e['thumb'] = $irl->PublicUrlGlobal("event_image",array('id'=>$row['id_event'],'size'=>1,'format'=>'jpg'),TRUE );
$e['image'] = $irl->PublicUrlGlobal("event_image",array('id'=>$row['id_event'],'size'=>3,'format'=>'jpg'),TRUE );
$e['large'] = $irl->PublicUrlGlobal("event_image",array('id'=>$row['id_event'],'size'=>5,'format'=>'jpg'),TRUE );
}
if($json) {
$events[] = $e;
......@@ -302,8 +306,10 @@ class Events
include_once(SERVER_ROOT."/../classes/event.php");
$e = new Event();
$event = $e->EventGet($id_event);
$events = [$event];
$events = $this->EventsObj($events,false);
$base_url = $this->IcsCalendarInit($id_event,$event['title']);
$this->IcsEvent($event, $base_url);
$this->IcsEvent($events['e'.$id_event], $base_url);
return $this->vcalendar->returnCalendar();
}
......@@ -346,9 +352,18 @@ class Events
$description = str_replace("\t",'',trim($event['description']));
$vevent->setProperty('DESCRIPTION', $description . "\n\n$link");
$vevent->setProperty( "URL", $link);
if($event['has_image']=='1') {
$images = array();
$images[] = "thumbnail;{$event['thumb']};{$this->img_sizes[1]};" . floor($this->img_sizes[1] / $event['image_ratio']);
$images[] = "medium;{$event['image']};{$this->img_sizes[3]};" . floor($this->img_sizes[3] / $event['image_ratio']);
$images[] = "large;{$event['large']};{$this->img_sizes[5]};" . floor($this->img_sizes[5] / $event['image_ratio']);
$vevent->setXprop('X-WP-IMAGES-URL',$images);
}
}
private function IcsCalendarInit($id='',$name='',$desc='') {
$calname = "Calendario PeaceLink";
$caldesc = $desc!=''? $desc : "Gli appuntamenti del mondo pacifista italiano";
require(SERVER_ROOT."/../others/vendor/autoload.php");
include_once(SERVER_ROOT."/../classes/ini.php");
include_once(SERVER_ROOT."/../classes/texthelper.php");
......@@ -358,15 +373,14 @@ class Events
$config = [
'UNIQUE_ID' => "peacelink.it"
];
$this->vcalendar = new Kigkonsult\Icalcreator\Vcalendar($config);
$this->vcalendar->setProperty( 'method', "PUBLISH" );
$calname = "Calendario PeaceLink";
$caldesc = $desc!=''? $desc : "Gli appuntamenti del mondo pacifista italiano";
$uuid = "pck-events";
if($id!='') {
$uuid .= "-{$id}";
$calname .= " - {$name}";
$config['filename'] = "{$uuid}.ics"; // date( "YmdHis" ).".ics"
}
$this->vcalendar = new Kigkonsult\Icalcreator\Vcalendar($config);
$this->vcalendar->setProperty( 'method', "PUBLISH" );
$this->vcalendar->setProperty( "x-wr-calname", $calname);
$this->vcalendar->setProperty( "X-WR-CALDESC", $caldesc );
$this->vcalendar->setProperty( "X-WR-TIMEZONE", $tz );
......@@ -766,6 +780,7 @@ class EventsREST
$name = $params['prov'];
$desc = "Appuntamenti nella provincia di {$params['prov']}";
}
$ee = new Events();
echo $ee->ExportIcsEvents($return['events'],$id,$name,$desc);
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment