This commit is contained in:
afornerot 2019-04-26 15:51:39 +02:00
parent 7ec1602335
commit 3c185e9635
5 changed files with 58 additions and 14 deletions

View File

@ -1,15 +1,13 @@
SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
(-100, 'ldapbundle', '0000000A');
(-100, 'BER', 'BERSIREN');
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
(-100, -100, 'admin', 'Administrateur', 'ldapbundle', 'PWD_CAS', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '0000000A', 'simple');
(-100, -100, 'admin', 'Administrateur', 'BER', '', 'admin.ber-assos.fr', 'admin.jpg', 'ROLE_ADMIN', 'BERSIREN', 'simple');
TRUNCATE TABLE sidebar;
@ -47,7 +45,7 @@ INSERT IGNORE INTO `config` (`order`, `visible`, `changeable`, `required`, `type
('002', 1, 0, 1, 'string', 'version', '1.0.0', '', 'Version de l\'application'),
('003', 1, 1, 0, 'string', 'subappname', 'Portail', '', 'Le sous titre de votre site'),
('004', 1, 1, 1, 'logo', 'logo', 'uploads/logo/logo.png', '', 'Le logo de votre site'),
('005', 0, 1, 0, 'theme', 'theme', '', '', 'Le theme de votre site'),
('005', 1, 1, 0, 'theme', 'theme', '', '', 'Le theme de votre site'),
('040', 1, 1, 1, 'boolean', 'fgheader', '1', '', 'Utiliser une image en bannière du site'),
@ -60,6 +58,6 @@ INSERT IGNORE INTO `config` (`order`, `visible`, `changeable`, `required`, `type
('060', 1, 1, 1, 'font', 'fontfacetitle', 'Anton-Regular', '', 'Police des titres de votre site'),
('061', 1, 1, 1, 'font', 'fontfacebody', 'Helvetica', '', 'Police des titres de votre site'),
('200', 1, 0, 1, 'boolean', 'PROXYactivate', '1', '', 'Définit un Proxy'),
('201', 1, 0, 1, 'string', 'PROXYserver', '192.168.57.160', 'PROXYactivate','Adresse du Proxy'),
('202', 1, 0, 1, 'string', 'PROXYport', '8080', 'PROXYactivate','Port du Proxy');
('200', 1, 0, 1, 'boolean', 'PROXYactivate', '0', '', 'Définit un Proxy'),
('201', 1, 0, 1, 'string', 'PROXYserver', '', 'PROXYactivate','Adresse du Proxy'),
('202', 1, 0, 1, 'string', 'PROXYport', '', 'PROXYactivate','Port du Proxy');

View File

@ -547,26 +547,38 @@ class SynchroICSCommand extends Command
$this->writeln("connected");
$this->writeln("");
$tbuid=array();
$arrayOfCalendars = $client->findCalendars();
$arrayOfCalendars = $client->findCalendars("afornerot");
foreach($arrayOfCalendars as $calcalendar) {
if($calcalendar->getDisplayName()!=$calendar->getCaldavname()) continue;
$client->setCalendar($calcalendar);
$events = $client->getEvents();
foreach ($events as $calevent) {
$event=$this->icsToArray($calevent->getData())[2];
foreach($event as $key => $value) {
if (strpos($key, 'DTSTART') === 0) $event["DTSTART"]=new \datetime($value);
if (strpos($key, 'DTEND') === 0) $event["DTEND"]=new \datetime($value);
}
$event["SUMMARY"] = (isset($event["SUMMARY"])?$event["SUMMARY"]:"");
$event["DESCRIPTION"] = (isset($event["DESCRIPTION"])?$event["DESCRIPTION"]:"");
$event["DTSTART"] = (isset($event["DTSTART;VALUE=DATE"])?new \datetime($event["DTSTART;VALUE=DATE"]):"");
$event["DTEND"] = (isset($event["DTEND;VALUE=DATE"])?new \datetime($event["DTEND;VALUE=DATE"]):"");
$event["ALLDAY"] = (isset($event["ALLDAY"])?$event["ALLDAY"]:"");
$event["SEQUENCE"] = (isset($event["SEQUENCE"])?$event["SEQUENCE"]:"");
$event["UID"] = (isset($event["UID"])?$event["UID"]:"");
$event["DURATION"] = (isset($event["DURATION"])?$event["DURATION"]:"");
if($event["UID"]!="") {
// On sauvegarde l'uid
array_push($tbuid,$event["UID"]);
if(!isset($event["DTEND"])&&isset($event["DURATION"])) {
$event["DTEND"]=clone $event["DTSTART"];
$event["DTEND"]->add(new \DateInterval($event["DURATION"]));
}
// Allday ?
$allday=0;
if($event["ALLDAY"]==1||$event["SEQUENCE"]>=1)
@ -641,7 +653,7 @@ class SynchroICSCommand extends Command
//dump($subValue);
$subValueArr = explode(":", $subValue, 2);
//dump($subValueArr);
$icsDates[$key][$subValueArr[0]] = $subValueArr[1];
if(key_exists(1,$subValueArr)) $icsDates[$key][$subValueArr[0]] = $subValueArr[1];
}
}
}

View File

@ -67,6 +67,12 @@ class Calendar
*/
private $login;
/**
* @var string
*
* @ORM\Column(name="caldavname", type="string", nullable=true)
*/
private $caldavname;
/**
* @var string
@ -340,7 +346,29 @@ class Calendar
return $this->login;
}
/**
* Set caldavname
*
* @param string $caldavname
*
* @return Calendar
*/
public function setCaldavname($caldavname)
{
$this->caldavname = $caldavname;
return $this;
}
/**
* Get caldavname
*
* @return string
*/
public function getCaldavname()
{
return $this->caldavname;
}
/**
* Set salt

View File

@ -49,6 +49,11 @@ class CalendarType extends AbstractType
'required' => false,
])
->add('caldavname', TextType::class, [
'label' => "Nom du Calendrier CalDAV",
'required' => false,
])
->add('login', TextType::class, [
'label' => "Login",
'required' => false,

View File

@ -58,6 +58,7 @@
{{ form_row(form.url) }}
</div>
<div id="login" style="display:none">
{{ form_row(form.caldavname) }}
{{ form_row(form.login) }}
{{ form_row(form.password) }}
</div>