This repository has been archived by the owner on Jul 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from Prytoegrian:topic/assets
- Loading branch information
1 parent
0528042
commit 36adf6c
Showing
180 changed files
with
489 additions
and
363 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
$runner->addTestsFromDirectory(__DIR__ . '/Tests/Units'); | ||
$script->bootstrapFile(__DIR__ . '/.bootstrap.atoum.php'); |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
/* Autoload */ | ||
define('ROOT_PATH', ''); | ||
require_once ROOT_PATH . 'vendor/autoload.php'; |
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
namespace App\Helpers; | ||
|
||
/** | ||
* Classe de formatage de petits utilitaires de l'application | ||
* | ||
* @since 1.9 | ||
* @author Prytoegrian <prytoegrian@protonmail.com> | ||
* @see \Tests\Units\App\Helpers\Formatter | ||
*/ | ||
class Formatter | ||
{ | ||
/** | ||
* Transforme une date du format français (dd/mm/YYY) au format ISO (YYYY-mm-dd) | ||
* | ||
* @param string $date | ||
* | ||
* @access public | ||
* @static | ||
* @return string | ||
* @throws \Exception Si le paramètre d'entrée n'est pas bien formé | ||
* @TODO \Exception out of bounds ? | ||
* @since 1.9 | ||
*/ | ||
public static function dateFr2Iso($date) | ||
{ | ||
if (!preg_match('#^(\d{2})/(\d{2})/(\d{4})$#', $date, $matches)) { | ||
throw new \Exception('Date mal formée'); | ||
} | ||
return $matches[3] . '-' . $matches[2] . '-' . $matches[1]; | ||
} | ||
|
||
/** | ||
* Transforme une date du format ISO (YYYY-mm-dd) au format français (dd/mm/YYYY) | ||
* | ||
* @param string $date | ||
* | ||
* @access public | ||
* @static | ||
* @return string | ||
* @throws \Exception Si le paramètre d'entrée n'est pas bien formé | ||
* @TODO \Exception out of bounds ? | ||
* @since 1.9 | ||
*/ | ||
public static function dateIso2Fr($date) | ||
{ | ||
if (!preg_match('#^(\d{4})-(\d{2})-(\d{2})$#', $date, $matches)) { | ||
throw new \Exception('Date mal formée'); | ||
} | ||
return $matches[3] . '/' . $matches[2] . '/' . $matches[1]; | ||
} | ||
} |
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
template/reboot/css/reboot.css → Public/Assets/Css/reboot.css
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
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 |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/** | ||
* Ouvre une popup | ||
* | ||
* @param string MyFile nom du fichier contenant le code HTML du pop-up | ||
* @param string MyWindow nom de la fenêtre (ne pas mettre d'espace) | ||
* @param int MyWidth entier indiquant la largeur de la fenêtre en pixels | ||
* @param int MyHeight entier indiquant la hauteur de la fenêtre en pixels | ||
*/ | ||
function OpenPopUp(MyFile,MyWindow,MyWidth,MyHeight) | ||
{ | ||
var ns4 = (document.layers)? true:false; //NS 4 | ||
var ie4 = (document.all)? true:false; //IE 4 | ||
var dom = (document.getElementById)? true:false; //DOM | ||
var xMax, yMax, xOffset, yOffset;; | ||
|
||
if (ie4 || dom) { | ||
xMax = screen.width; | ||
yMax = screen.height; | ||
} else if (ns4) { | ||
xMax = window.outerWidth; | ||
yMax = window.outerHeight; | ||
} else { | ||
xMax = 800; | ||
yMax = 600; | ||
} | ||
xOffset = (xMax - MyWidth)/2; | ||
yOffset = (yMax - MyHeight)/2; | ||
window.open(MyFile,MyWindow,'width='+MyWidth | ||
+',height='+MyHeight | ||
+',screenX='+xOffset | ||
+',screenY='+yOffset | ||
+',top='+yOffset | ||
+',left='+xOffset | ||
+',scrollbars=yes,resizable=yes'); | ||
} | ||
|
||
/** | ||
* Compte le nombre de jours de congés entre deux dates en fonctions du contexte (temps partiel, jours fériés, fermeture, ...) | ||
*/ | ||
function compter_jours() | ||
{ | ||
$(document).ready(function () { | ||
var login = document.forms["dem_conges"].user_login.value; | ||
var session = document.forms["dem_conges"].session.value; | ||
var d_debut = document.forms["dem_conges"].new_debut.value; | ||
var d_fin = document.forms["dem_conges"].new_fin.value; | ||
var opt_deb = document.forms["dem_conges"].new_demi_jour_deb.value; | ||
var opt_fin = document.forms["dem_conges"].new_demi_jour_fin.value; | ||
var p_num = ""; | ||
|
||
if( document.forms["dem_conges"].p_num_to_update ) { | ||
var p_num = document.forms["dem_conges"].p_num_to_update.value; | ||
} | ||
|
||
if( (d_debut) && (d_fin)) { | ||
var page = '../calcul_nb_jours_pris.php?session=' + session + '&date_debut=' + d_debut + '&date_fin=' + d_fin+'&user=' + login + '&opt_debut=' +opt_deb + '&opt_fin=' + opt_fin + '&p_num=' +p_num; | ||
|
||
$.ajax({ | ||
type : 'GET', | ||
url : page, | ||
dataType : 'text', // expected returned data format. | ||
success : function(data) | ||
{ | ||
var arr = new Array(); | ||
arr = JSON.parse(data); | ||
document.forms["dem_conges"].new_nb_jours.value=arr["nb"]; | ||
document.getElementById('comment_nbj').innerHTML = arr["comm"]; | ||
}, | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
/** | ||
* Génère le datepicker sur un champ, paramétré par des options précises | ||
* | ||
* @param object opts | ||
*/ | ||
function generateDatePicker(opts) | ||
{ | ||
var defaultOpts = { | ||
format : 'dd/mm/yyyy', | ||
language : 'fr', | ||
autoclose : true, | ||
todayHighlight : true, | ||
daysOfWeekDisabled : [], | ||
datesDisabled : [], | ||
startDate : '' | ||
}; | ||
var toApply = defaultOpts; | ||
|
||
/* On ne peut pas écraser une option qui n'existe en défaut */ | ||
for (var i in defaultOpts) { | ||
toApply[i] = (undefined !== opts[i]) ? opts[i] : defaultOpts[i]; | ||
} | ||
$(document).ready(function () { | ||
$('input.date').datepicker(toApply).on("change", function() { | ||
compter_jours(); | ||
}); | ||
}); | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
namespace Tests\Units\App\Helpers; | ||
|
||
use \App\Helpers\Formatter as _Formatter; | ||
use \atoum; | ||
|
||
/** | ||
* Classe de test des formatages | ||
* | ||
* @since 1.9 | ||
* @author Prytoegrian <prytoegrian@protonmail.com> | ||
* @see \App\Helpers\Formatter | ||
*/ | ||
class Formatter extends atoum | ||
{ | ||
/** | ||
* Test de la transformation d'une date Fr -> ISO avec une date mal formée | ||
* | ||
* @return void | ||
* @access public | ||
* @since 1.9 | ||
*/ | ||
public function testDateFr2IsoBadFormat() | ||
{ | ||
$string = 'test'; | ||
|
||
$this->exception(function () use ($string) { | ||
_Formatter::dateFr2Iso($string); | ||
})->isInstanceOf('\Exception'); | ||
} | ||
|
||
/** | ||
* Test de la transformation d'une date Fr -> ISO avec une date bien formée | ||
* | ||
* @return void | ||
* @access public | ||
* @since 21.9 | ||
*/ | ||
public function testDateFr2IsoWithoutError() | ||
{ | ||
$date = '25/12/1969'; | ||
|
||
$return = _Formatter::dateFr2Iso($date); | ||
|
||
$this->string($return)->isIdenticalTo('1969-12-25'); | ||
} | ||
|
||
/** | ||
* Test de la transformation d'une date ISO -> Fr avec une date mal formée | ||
* | ||
* @access public | ||
* @return void | ||
* @since 1.9 | ||
*/ | ||
public function testDateIso2FrBadFormat() | ||
{ | ||
$string = 'test'; | ||
|
||
$this->exception(function () use ($string) { | ||
_Formatter::dateIso2Fr($string); | ||
})->isInstanceOf('\Exception'); | ||
} | ||
|
||
/** | ||
* Test de la transformation d'une date ISO -> Fr avec une date bien formée | ||
* | ||
* @access public | ||
* @return void | ||
* @since 1.9 | ||
*/ | ||
public function testDateIso2FrWithoutError() | ||
{ | ||
$date = '5555-33-22'; | ||
|
||
$return = _Formatter::dateIso2Fr($date); | ||
|
||
$this->string($return)->isIdenticalTo('22/33/5555'); | ||
} | ||
} |
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
Oops, something went wrong.