tout fonctionne.
This commit is contained in:
parent
30ef3179d9
commit
7f87a459bd
59
atelier.php
59
atelier.php
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
|
||||
// TODO: vérifier disponibilité de la salle
|
||||
require_once("session_init.php");
|
||||
require_once("config.inc.php");
|
||||
require_once('fonctions.php');
|
||||
|
@ -22,28 +25,17 @@ if ( !($opt = getopt( 'h::', $param, $optind)) )
|
|||
exit(1);
|
||||
}
|
||||
|
||||
$args = array_slice($argv, $optind);
|
||||
//print_r($opt);
|
||||
if ( !isset($opt["cat"]))
|
||||
$cat = getpost( "cat", "all" );
|
||||
$action = getpost( "action", "sondage" );
|
||||
$date = getpost("date");
|
||||
$heure = getpost("heure");
|
||||
$courriel = getpost("courriel");
|
||||
|
||||
echo "action = " . $action;
|
||||
if( !empty(getopt("h")) or !empty(getopt("help")) )
|
||||
{
|
||||
$opt["cat"] = "all";
|
||||
}
|
||||
if ( !empty( $args))
|
||||
{
|
||||
$opt["action"] = $args[0];
|
||||
}
|
||||
echo "action = " . $opt["action"];
|
||||
if ( count($_POST) == 0 && count($_GET) == 0 && $argc <= 1 )
|
||||
{
|
||||
// affiche le résumé des sondages
|
||||
require_once("recap.php");
|
||||
recap();
|
||||
}else
|
||||
{
|
||||
if( array_key_exists("h", $opt) or array_key_exists("help", $opt))
|
||||
{
|
||||
// affiche l'aide de la commande
|
||||
print "Aide de la commande atelier.php\n
|
||||
// affiche l'aide de la commande
|
||||
print "Aide de la commande atelier.php\n
|
||||
atelier.php [--h|-h] [--date=<date>] [--heure=<heure>] [action=<action>] [cat=<catégorie>]
|
||||
atelier.php --action=sondage --date=<01/01/20> --heure=<10h30>
|
||||
atelier.php --action=sendmail [cat=<all|membres|contacts>]
|
||||
|
@ -58,15 +50,23 @@ Avec l'argument --action=sendmail, elle envoi un mail contenant la liste des ate
|
|||
\t\t--courriel\tadresse courriel du destinataire
|
||||
";
|
||||
|
||||
}else
|
||||
{
|
||||
if ( empty($action) )
|
||||
{
|
||||
// affiche le résumé des sondages
|
||||
require_once("recap.php");
|
||||
recap();
|
||||
}else
|
||||
{
|
||||
switch ($opt["action"])
|
||||
|
||||
switch ($action)
|
||||
{
|
||||
case "sondage":
|
||||
// sondage => crée un nouveau sondage
|
||||
// enregistre le sondage dans la base opensurvey de dolibarr
|
||||
echo "Création du sondage ";
|
||||
$date_time = date_reservation( $opt["date"], $opt["heure"]);
|
||||
$date_time = date_reservation( $date, $heure);
|
||||
if ( !verif_agenda( $date_time ) )
|
||||
{
|
||||
echo 'La date est disponible';
|
||||
|
@ -78,8 +78,8 @@ Avec l'argument --action=sendmail, elle envoi un mail contenant la liste des ate
|
|||
$sondage->mail_admin = "contact@lalis.fr";
|
||||
$sondage->nom_admin = "Daniel";
|
||||
$sondage->titre = "Atelier du " . $opt["date"] . " à " . $opt["heure"];
|
||||
//$sondage->write($db);
|
||||
echo $sondage;
|
||||
$sondage->write($db);
|
||||
print_r($sondage);
|
||||
$db->close();
|
||||
|
||||
// enregistre la réservation dans mrbs
|
||||
|
@ -87,13 +87,14 @@ Avec l'argument --action=sendmail, elle envoi un mail contenant la liste des ate
|
|||
$db = new db("librepcfr", "librepc");
|
||||
|
||||
$reservation = new reservation( $date_time[ "ts_debut" ], $date_time["ts_fin"], addslashes(html_entity_decode($commentaires, ENT_QUOTES )));
|
||||
//$reservation->write($db);
|
||||
echo $reservation . EOL;
|
||||
$reservation->write($db);
|
||||
print_r($reservation) . EOL;
|
||||
|
||||
// envoi de l'évènement sur l'agenda nextcloud
|
||||
require_once("send_nextcloud.php");
|
||||
echo "Ajout à l'agenda Nextcloud" . EOL;
|
||||
require_once('send_nextcloud.php');
|
||||
//envoi_event($date_time, $opt, $base_url . "dbarr/public/opensurvey/studs.php?sondage=" . $sondage->id_sondage);
|
||||
envoi_event($date_time, $opt, $base_url . "dbarr/public/opensurvey/studs.php?sondage=" . $sondage->id_sondage);
|
||||
}else
|
||||
{
|
||||
echo "La date n'est pas disponible.";
|
||||
|
@ -102,7 +103,7 @@ Avec l'argument --action=sendmail, elle envoi un mail contenant la liste des ate
|
|||
break;
|
||||
case "sendmail":
|
||||
require_once("send_mail.php");
|
||||
//send_mail( $opt["cat"], (empty($opt["courriel"])?"": $opt["courriel"]) );
|
||||
send_mail( $cat, $courriel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,18 @@ $calendriers = array(
|
|||
array( "url" => 'https://librepc.ddns.net:10081/cloud/remote.php/dav/principals/users/daniel/',
|
||||
"nom" => 'daniel',
|
||||
"pw" => 'Highlander%42',
|
||||
"cal" => 'perso' )
|
||||
|
||||
"cal" => 'default' ),
|
||||
array( "url" => 'https://lalis69.ddns.net:10443/laliscloud/remote.php/dav/principals/users/DTux/',
|
||||
"nom" => 'DTux',
|
||||
"pw" => '69Daniel%001',
|
||||
"cal" => 'personal' ),
|
||||
array( "url" => 'https://lalis69.ddns.net:10443/laliscloud/remote.php/dav/principals/users/DTux/',
|
||||
"nom" => 'DTux',
|
||||
"pw" => '69Daniel%001',
|
||||
"cal" => 'personal_shared_by_lalis' ),
|
||||
array( "url" => 'https://lalis69.ddns.net:10443/laliscloud/remote.php/dav/principals/users/lalis/',
|
||||
"nom" => 'lalis',
|
||||
"pw" => 'Lalis69_cloud',
|
||||
"cal" => 'personal' ),
|
||||
);
|
||||
?>
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* listCalendars
|
||||
*
|
||||
* Copyright 2014 Michael Palm <palm.michael@gmx.de>
|
||||
*
|
||||
* Open this file in a webbrowser to view a list of all accessible calendars
|
||||
* on the server and the information related to those calendars. It can be used
|
||||
* to determine the calendar-id, needed for SimpleCalDAV.
|
||||
*
|
||||
* @package simpleCalDAV
|
||||
*/
|
||||
|
||||
require_once('./include/SimpleCalDAVClient.php');
|
||||
|
||||
if($_POST == null) {
|
||||
echo '
|
||||
<form action="#" method="post">
|
||||
<p>This formular can be used to view a list of all accessible calendars on the server and the information related to those calendars. It can be used to determine the calendar-id, needed for SimpleCalDAV.</p>
|
||||
<p>Calendar-URL:<br><input name="url" type="text" size="30" maxlength="100"></p>
|
||||
<p>Username:<br><input name="user" type="text" size="30" maxlength="100"></p>
|
||||
<p>Password:<br><input name="pass" type="text" size="30" maxlength="100"></p>
|
||||
<input type="submit" value=" Show! ">
|
||||
</form>';
|
||||
}
|
||||
|
||||
else {
|
||||
$client = new SimpleCalDAVClient();
|
||||
|
||||
try {
|
||||
$client->connect($_POST['url'], $_POST['user'], $_POST['pass']);
|
||||
|
||||
$calendars = $client->findCalendars();
|
||||
|
||||
echo'
|
||||
<table>';
|
||||
|
||||
$i = 0;
|
||||
foreach($calendars as $cal) {
|
||||
$i++;
|
||||
|
||||
echo '
|
||||
<tr> <td></td> <td><strong>Calendar #'.$i.'</strong></td> </tr>
|
||||
<tr> <td>URL:</td> <td>'.$cal->getURL().'</td> </tr>
|
||||
<tr> <td>Display Name:</td> <td>'.$cal->getDisplayName().'</td> </tr>
|
||||
<tr> <td>Calendar ID:</td> <td>'.$cal->getCalendarID().'</td> </tr>
|
||||
<tr> <td>CTAG:</td> <td>'.$cal->getCTag().'</td> </tr>
|
||||
<tr> <td>RBG-Color:</td> <td>'.$cal->getRBGcolor().'</td> </tr>
|
||||
<tr> <td>Order:</td> <td>'.$cal->getOrder().'</td> </tr>
|
||||
<tr> <td></td> <td></td> </tr>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</table>';
|
||||
}
|
||||
|
||||
catch (Exception $e) {
|
||||
echo $e->__toString();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
/**
|
||||
* listCalendars
|
||||
*
|
||||
* Copyright 2014 Michael Palm <palm.michael@gmx.de>
|
||||
*
|
||||
* Open this file in a webbrowser to view a list of all accessible calendars
|
||||
* on the server and the information related to those calendars. It can be used
|
||||
* to determine the calendar-id, needed for SimpleCalDAV.
|
||||
*
|
||||
* @package simpleCalDAV
|
||||
*/
|
||||
require_once("session_init.php");
|
||||
require_once("config.inc.php");
|
||||
require_once('SimpleCalDAVClient.php');
|
||||
require_once('fonctions.php');
|
||||
|
||||
$param = array(
|
||||
"url::",
|
||||
"user::",
|
||||
"help::",
|
||||
"pass::",
|
||||
);
|
||||
$optind=null;
|
||||
|
||||
if ( !($opt = getopt( 'h::', $param, $optind)) )
|
||||
{
|
||||
echo "erreur de paramètre de la commande" . EOL;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if( !empty(getopt("h")) or !empty(getopt("help")) )
|
||||
{
|
||||
echo "les arguments sont:
|
||||
--url=<url du serveur dav>
|
||||
--user=<identifiant utilisateur>
|
||||
--pass=<mot de passe dde l'utilisateur>";
|
||||
}else
|
||||
{
|
||||
|
||||
$url = getpost("url");
|
||||
$user = getpost("user");
|
||||
$pass = getpost("pass");
|
||||
|
||||
if( empty($url))
|
||||
{
|
||||
echo '
|
||||
<form action="#" method="post">
|
||||
<p>This formular can be used to view a list of all accessible calendars on the server and the information related to those calendars. It can be used to determine the calendar-id, needed for SimpleCalDAV.</p>
|
||||
<p>Calendar-URL:<br><input name="url" type="text" size="30" maxlength="100"></p>
|
||||
<p>Username:<br><input name="user" type="text" size="30" maxlength="100"></p>
|
||||
<p>Password:<br><input name="pass" type="text" size="30" maxlength="100"></p>
|
||||
<input type="submit" value=" Show! ">
|
||||
</form>';
|
||||
}
|
||||
|
||||
else {
|
||||
$client = new SimpleCalDAVClient();
|
||||
|
||||
try {
|
||||
$client->connect($url, $user, $pass);
|
||||
$calendars = $client->findCalendars();
|
||||
|
||||
echo'
|
||||
<table>';
|
||||
|
||||
$i = 0;
|
||||
foreach($calendars as $cal)
|
||||
{
|
||||
$i++;
|
||||
|
||||
echo '
|
||||
<tr> <td></td> <td><strong>Calendar #'.$i.'</strong></td> </tr>
|
||||
<tr> <td>URL:</td> <td>'.$cal->getURL().'</td> </tr>
|
||||
<tr> <td>Display Name:</td> <td>'.$cal->getDisplayName().'</td> </tr>
|
||||
<tr> <td>Calendar ID:</td> <td>'.$cal->getCalendarID().'</td> </tr>
|
||||
<tr> <td>CTAG:</td> <td>'.$cal->getCTag().'</td> </tr>
|
||||
<tr> <td>RBG-Color:</td> <td>'.$cal->getRBGcolor().'</td> </tr>
|
||||
<tr> <td>Order:</td> <td>'.$cal->getOrder().'</td> </tr>
|
||||
<tr> <td></td> <td></td> </tr>';
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
|
||||
}catch (Exception $e)
|
||||
{
|
||||
echo $e->__toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue