This repository has been archived by the owner on Oct 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/planning_sync_CLI_1.0' into main
- Loading branch information
Showing
5 changed files
with
145 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,52 @@ | ||
<?php | ||
|
||
require_once __DIR__ . '/vendor/autoload.php'; | ||
require_once __DIR__ . '/env.php'; | ||
require_once __DIR__ . '/functions.php'; | ||
|
||
print("MYGES CALENDAR SYNC (by Nospy)" . PHP_EOL); | ||
printDivider(); | ||
|
||
print "Entrez le nombre de jours que vous souhaitez synchroniser à partir d'aujourd'hui : "; | ||
$days = trim(fgets(STDIN)); | ||
if (!ctype_digit($days)) { | ||
die; | ||
} | ||
|
||
printDivider(); | ||
print "Connexion à myges..." . PHP_EOL; | ||
$me = getMe(); | ||
print "Connecté !" . PHP_EOL; | ||
|
||
printDivider(); | ||
printf("Récupération des cours sur %d jours..." . PHP_EOL, $days); | ||
$agenda = getAgenda($days, $me); | ||
printf("Réussi ! %d cours trouvés" . PHP_EOL, sizeof($agenda)); | ||
|
||
print "Traitement des doublons..." . PHP_EOL; | ||
$agenda = removeDuplicate($agenda); | ||
printf("Réussi : %d cours uniques" . PHP_EOL, sizeof($agenda)); | ||
|
||
printDivider(); | ||
print "Connexion à l'API google..." . PHP_EOL; | ||
$client = getCalendarClient(); | ||
print "Connecté !" . PHP_EOL; | ||
|
||
printDivider(); | ||
printf("Récupération de la liste des cours présent sur le calendrier google sur %d jours..." . PHP_EOL, $days); | ||
$events = getEvent($client, $days); | ||
printf("Réussi ! %d cours trouvés" . PHP_EOL, sizeof($events)); | ||
|
||
printDivider(); | ||
print "Nettoyage des cours sur le calendrier google..." . PHP_EOL; | ||
removeEvents($client, $events); | ||
print "Les cours ont été supprimés de l'agenda google!" . PHP_EOL; | ||
|
||
printDivider(); | ||
print "Ajout des cours sur le calendrier google..." . PHP_EOL; | ||
addEvents($client, $agenda); | ||
printDivider(); | ||
print "Les cours ont été ajoutés!" . PHP_EOL; | ||
|
||
<?php | ||
|
||
require_once __DIR__ . '/vendor/autoload.php'; | ||
require_once __DIR__ . '/env.php'; | ||
require_once __DIR__ . '/functions.php'; | ||
|
||
print("MYGES CALENDAR SYNC (by Nospy)" . PHP_EOL); | ||
printDivider(); | ||
|
||
$days = $argv[1]; | ||
|
||
while (!ctype_digit($days) && $days >= 0) { | ||
print "Entrez le nombre de jours que vous souhaitez synchroniser à partir d'aujourd'hui : "; | ||
$days = trim(fgets(STDIN)); | ||
} | ||
|
||
printDivider(); | ||
print "Connexion à MyGES..." . PHP_EOL; | ||
$me = getMe(); | ||
print "Connecté !" . PHP_EOL; | ||
|
||
printDivider(); | ||
printf("Récupération des cours sur %d jours..." . PHP_EOL, $days); | ||
$agenda = getAgenda($me, $days); | ||
printf("Réussi ! %d cours trouvés" . PHP_EOL, sizeof($agenda)); | ||
|
||
print "Traitement des doublons..." . PHP_EOL; | ||
$agenda = removeDuplicate($agenda); | ||
printf("Réussi ! %d cours uniques" . PHP_EOL, sizeof($agenda)); | ||
|
||
printDivider(); | ||
print "Connexion à l'API google..." . PHP_EOL; | ||
$client = getCalendarClient(); | ||
print "Connecté !" . PHP_EOL; | ||
|
||
printDivider(); | ||
printf("Récupération de la liste des cours présent sur le calendrier google sur %d jours..." . PHP_EOL, $days); | ||
$events = getEvent($client, $days); | ||
printf("Réussi ! %d cours trouvés" . PHP_EOL, sizeof($events)); | ||
|
||
printDivider(); | ||
print "Nettoyage des cours sur le calendrier google..." . PHP_EOL; | ||
batchRemoveEvents($client, $events); | ||
print "Les cours ont été supprimés de l'agenda google!" . PHP_EOL; | ||
|
||
printDivider(); | ||
print "Ajout des cours sur le calendrier google..." . PHP_EOL; | ||
batchAddEvents($client, $agenda); | ||
printDivider(); | ||
print "Les cours ont été ajoutés!" . PHP_EOL; | ||
|
||
print "Finit." . PHP_EOL; |