Commit 60e0216a authored by SASSU Thomas's avatar SASSU Thomas
Browse files

fonction eloquent et etc

parent 0dd30a37
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "58ad4665ea57037daa2176094db2d412",
"content-hash": "cc18e66e95cadfdfa2cb91becd1b4524",
"packages": [
{
"name": "doctrine/inflector",
......@@ -220,6 +220,50 @@
],
"time": "2018-09-23T18:58:54+00:00"
},
{
"name": "illuminate/pagination",
"version": "v5.5.44",
"source": {
"type": "git",
"url": "https://github.com/illuminate/pagination.git",
"reference": "686b121987164d161fe3440f407014ad026bdbbc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/pagination/zipball/686b121987164d161fe3440f407014ad026bdbbc",
"reference": "686b121987164d161fe3440f407014ad026bdbbc",
"shasum": ""
},
"require": {
"illuminate/contracts": "5.5.*",
"illuminate/support": "5.5.*",
"php": ">=7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.5-dev"
}
},
"autoload": {
"psr-4": {
"Illuminate\\Pagination\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "The Illuminate Pagination package.",
"homepage": "https://laravel.com",
"time": "2017-10-13T15:07:13+00:00"
},
{
"name": "illuminate/support",
"version": "v5.5.44",
......@@ -529,16 +573,16 @@
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.13.1",
"version": "v1.14.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "7b4aab9743c30be783b73de055d24a39cf4b954f"
"reference": "34094cfa9abe1f0f14f48f490772db7a775559f2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f",
"reference": "7b4aab9743c30be783b73de055d24a39cf4b954f",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2",
"reference": "34094cfa9abe1f0f14f48f490772db7a775559f2",
"shasum": ""
},
"require": {
......@@ -550,7 +594,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.13-dev"
"dev-master": "1.14-dev"
}
},
"autoload": {
......@@ -584,20 +628,20 @@
"portable",
"shim"
],
"time": "2019-11-27T14:18:11+00:00"
"time": "2020-01-13T11:15:53+00:00"
},
{
"name": "symfony/translation",
"version": "v4.4.3",
"version": "v4.4.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "f5d2ac46930238b30a9c2f1b17c905f3697d808c"
"reference": "0a19a77fba20818a969ef03fdaf1602de0546353"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/f5d2ac46930238b30a9c2f1b17c905f3697d808c",
"reference": "f5d2ac46930238b30a9c2f1b17c905f3697d808c",
"url": "https://api.github.com/repos/symfony/translation/zipball/0a19a77fba20818a969ef03fdaf1602de0546353",
"reference": "0a19a77fba20818a969ef03fdaf1602de0546353",
"shasum": ""
},
"require": {
......@@ -660,7 +704,7 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2020-01-15T13:29:06+00:00"
"time": "2020-02-04T09:32:40+00:00"
},
{
"name": "symfony/translation-contracts",
......
......@@ -3,9 +3,11 @@ require_once __DIR__ . '/vendor/autoload.php';
session_start();
use \Slim\Slim as Slim;
use Illuminate\Database\Capsule\Manager as DB;
use \gp\controleurs\ControleurPrincipal as ControleurPrincipal;
use \gp\controleurs\ControleurScript as ControleurScript;
$db = new DB();
$db->addConnection(parse_ini_file('./src/conf/conf.ini'));
$db->addConnection(parse_ini_file('./conf/conf.ini'));
$db->setAsGlobal();
$db->bootEloquent();
......@@ -13,169 +15,15 @@ $db->bootEloquent();
$app = new \Slim\Slim();
$app->get('/',function () {
$c = new \fridgie\controleurs\ControleurPrincipal();
$c->afficherAccueil();
$c = new ControleurPrincipal();
// $c->afficherAccueil();
});
/*
* ----------------------------------------------------------------
* Controleur Recette
* ----------------------------------------------------------------
*/
$app->get('/indexrecette', function() {
$c = new \fridgie\controleurs\ControleurRecette();
$c->indexRecette();
});
$app->get('/recette',function () {
$c = new \fridgie\controleurs\ControleurRecette();
$c->getRecette();
});
$app->post('/recette',function () {
$c = new \fridgie\controleurs\ControleurRecette();
$c->afficherRecette();
});
$app->get('/afficherrecette/:id',function ($id) {
$c = new \fridgie\controleurs\ControleurRecette();
$c->afficherRecetteId($id);
});
$app->get('/nouvellerecette', function() {
$c = new \fridgie\controleurs\ControleurRecette();
$c->formulaireInsererRecette();
});
$app->post('/nouvellerecette', function() {
$c = new \fridgie\controleurs\ControleurRecette();
$c->traitementformulaireInsererRecette();
});
$app->get('/rechercherecette', function() {
$c = new \fridgie\controleurs\ControleurRecette();
$c->formulaireRechercheRecette();
});
$app->post('/rechercherecette', function() {
$c = new \fridgie\controleurs\ControleurRecette();
$c->traitementFormulaireRechercheRecette();
});
/*
* ----------------------------------------------------------------
* Controleur Evenement
* ----------------------------------------------------------------
*/
$app->get('/indexevenement', function() {
$c = new \fridgie\controleurs\ControleurEvenement();
$c->indexEvenement();
});
$app->get('/creationevenement',function () {
$c = new \fridgie\controleurs\ControleurEvenement();
$c->creerEvenement();
});
$app->post('/creationevenement',function () {
$c = new \fridgie\controleurs\ControleurEvenement();
$c->creerEvenementPost();
});
$app->get('/afficherevenements', function() {
$c = new \fridgie\controleurs\ControleurEvenement();
$c->afficherEvenements();
});
$app->get('/afficherevenement/:token',function ($token) {
$c = new \fridgie\controleurs\ControleurEvenement();
$c->afficherEvenement($token);
$app->get('/script_TD1/',function () {
$c = new ControleurScript();
$c->td1();
});
//$app->get('/participerevenement/:token', function($token) {
// $c = new \fridgie\controleurs\ControleurEvenement();
// $c->participerEvenement($token);
//});
$app->post('/participerevenement/:token', function($token) {
$c = new \fridgie\controleurs\ControleurEvenement();
$c->participerEvenementPost($token);
});
//par nom
$app->get('/rechercheevenement/:recherche',function ($recherche) {
$c = new \fridgie\controleurs\ControleurEvenement();
$c->rechercheEvenement($recherche);
});
/*
* ----------------------------------------------------------------
* Controleur Ingredient
* ----------------------------------------------------------------
*/
$app->post('/apporteringredient/:token', function($token) { //token = token de l'event
$c = new \fridgie\controleurs\ControleurIngredient();
$c->apporterIngredient($token);
header('Location: ../afficherevenement/' . $token);
exit();
});
$app->get('/apporteringredient/:token', function($token) { //token = token de l'event
$c = new \fridgie\controleurs\ControleurIngredient();
$c->apporterIngredientForm($token);
});
$app->get('/ingredient/:id', function($id) { //id = id de l'ingredient à afficher
$c = new \fridgie\controleurs\ControleurIngredient();
$c->afficherIngredient($id);
});
/*
* ----------------------------------------------------------------
* Controleur Client
* ----------------------------------------------------------------
*/
$app->get('/inscription', function() {
$c = new \fridgie\controleurs\ControleurClient();
$c->creerCompte();
});
$app->post('/inscription', function() {
$c = new \fridgie\controleurs\ControleurClient();
$c->traitementInscription();
});
$app->get('/connexion', function() {
$c = new \fridgie\controleurs\ControleurClient();
if (isset($_SESSION['Connexion']) == true) {
header('Location: ./moncompte');
exit();
}
else $c->identification();
});
$app->post('/connexion', function() {
$c = new \fridgie\controleurs\ControleurClient();
$c->traitementIdentification();
});
$app->post('/deconnexion', function() {
$c = new \fridgie\controleurs\ControleurClient();
$c->deconnexion();
});
$app->get('/moncompte', function() {
$c = new \fridgie\controleurs\ControleurClient();
$c->afficherCompte();
});
$app->post('/suppression', function() {
$c = new \fridgie\controleurs\ControleurClient();
$c->delete();
});
$app->run();
\ No newline at end of file
<?php
require_once __DIR__ . '../vendor/autoload.php';
session_start();
use \Slim\Slim as Slim;
use Illuminate\Database\Capsule\Manager as DB;
use \gp\controleurs\ControleurPrincipal as ControleurPrincipal;
use \gp\controleurs\ControleurScript as ControleurScript;
$db = new DB();
$db->addConnection(parse_ini_file('./conf/conf.ini'));
$db->setAsGlobal();
$db->bootEloquent();
$c = new ControleurScript();
$c->td1();
<?php
namespace gp\controleurs;
use gp\modeles\Platform;
use gp\modeles\Game;
use gp\modeles\Company;
use gp\modeles\Deck;
class ControleurScript
{
public function td1(){
echo "script TD1";
$tab=null;
$tab[] = $this->gameByName('Mario')->get();
$tab[] = $this->CompanyByCountry('Japan')->get();
$tab[] = $this->platformByBase('10000000')->get();
$tab[] = Game::skip(21173)->take(442)->get();
$data = Game::simplePaginate(500);
$s = "<p>--------------------------------------------------------<br>".
"Jeu contenant dans leur nom 'Mario'<br>".
"--------------------------------------------------------</p>";
echo $s;
foreach ($tab[0] as $game){
echo ("<p>{$game->name}</p>");
}
$s= "<p>--------------------------------------------------------<br>".
"Compagnies installées au 'Japon'<br>".
"--------------------------------------------------------</p>";
echo $s;
foreach ($tab[1] as $company){
echo ("<p>{$company->name}</p>");
}
$s = "<p>--------------------------------------------------------<br>".
"Plateformes dont la base installée est >= 10 000 000<br>".
"--------------------------------------------------------</p>";
echo $s;
foreach ($tab[2] as $plat){
echo ("<p>{$plat->name}</p>");
}
$s = "<p>--------------------------------------------------------<br>".
"liste de 442 jeux à partir du 21173ème<br>".
"--------------------------------------------------------</p>";
echo $s;
foreach ($tab[3] as $game){
echo ("<p>{$game->name}</p>");
}
$s = "<p>--------------------------------------------------------<br>".
"liste des jeux en paginant (taille des pages : 500)<br>".
"--------------------------------------------------------</p>";
echo $s;
$res = "";
foreach ($data as $t){
$res = $res . "<p>$t->name</p>";
}
$res = "<div class=\"container\">
$res
</div>";
echo $res;
}
private function gameByName($name){
return Game::where("name", "like", "%{$name}%");
}
private function companyByCountry($country){
return Company::where("location_country", "like", "{$country}");
}
private function platformByBase($base){
return Platform::where("install_base", ">=", "{$base}");
}
}
\ No newline at end of file
......@@ -279,7 +279,7 @@ class ClassLoader
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**
......@@ -377,11 +377,11 @@ class ClassLoader
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath.'\\';
$search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
$length = $this->prefixLengthsPsr4[$first][$search];
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
......
......@@ -6,12 +6,14 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'fridgie\\' => array($baseDir . '/src'),
'gp\\' => array($baseDir . '/src'),
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
'Symfony\\Contracts\\Translation\\' => array($vendorDir . '/symfony/translation-contracts'),
'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'),
'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
'Illuminate\\Support\\' => array($vendorDir . '/illuminate/support'),
'Illuminate\\Pagination\\' => array($vendorDir . '/illuminate/pagination'),
'Illuminate\\Database\\' => array($vendorDir . '/illuminate/database'),
'Illuminate\\Contracts\\' => array($vendorDir . '/illuminate/contracts'),
'Illuminate\\Container\\' => array($vendorDir . '/illuminate/container'),
......
......@@ -12,13 +12,14 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5
);
public static $prefixLengthsPsr4 = array (
'f' =>
'g' =>
array (
'fridgie\\' => 8,
'gp\\' => 3,
),
'S' =>
array (
'Symfony\\Polyfill\\Mbstring\\' => 26,
'Symfony\\Contracts\\Translation\\' => 30,
'Symfony\\Component\\Translation\\' => 30,
),
'P' =>
......@@ -29,6 +30,7 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5
'I' =>
array (
'Illuminate\\Support\\' => 19,
'Illuminate\\Pagination\\' => 22,
'Illuminate\\Database\\' => 20,
'Illuminate\\Contracts\\' => 21,
'Illuminate\\Container\\' => 21,
......@@ -40,7 +42,7 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5
);
public static $prefixDirsPsr4 = array (
'fridgie\\' =>
'gp\\' =>
array (
0 => __DIR__ . '/../..' . '/src',
),
......@@ -48,6 +50,10 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
),
'Symfony\\Contracts\\Translation\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/translation-contracts',
),
'Symfony\\Component\\Translation\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/translation',
......@@ -64,6 +70,10 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5
array (
0 => __DIR__ . '/..' . '/illuminate/support',
),
'Illuminate\\Pagination\\' =>
array (
0 => __DIR__ . '/..' . '/illuminate/pagination',
),
'Illuminate\\Database\\' =>
array (
0 => __DIR__ . '/..' . '/illuminate/database',
......
[
{
"name": "kylekatarnls/update-helper",
"version": "1.2.0",
"version_normalized": "1.2.0.0",
"name": "doctrine/inflector",
"version": "1.3.1",
"version_normalized": "1.3.1.0",
"source": {
"type": "git",
"url": "https://github.com/kylekatarnls/update-helper.git",
"reference": "5786fa188e0361b9adf9e8199d7280d1b2db165e"
"url": "https://github.com/doctrine/inflector.git",
"reference": "ec3a55242203ffa6a4b27c58176da97ff0a7aec1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/kylekatarnls/update-helper/zipball/5786fa188e0361b9adf9e8199d7280d1b2db165e",
"reference": "5786fa188e0361b9adf9e8199d7280d1b2db165e",
"url": "https://api.github.com/repos/doctrine/inflector/zipball/ec3a55242203ffa6a4b27c58176da97ff0a7aec1",
"reference": "ec3a55242203ffa6a4b27c58176da97ff0a7aec1",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.1.0 || ^2.0.0",
"php": ">=5.3.0"
"php": "^7.1"
},
"require-dev": {
"codeclimate/php-test-reporter": "dev-master",
"composer/composer": "2.0.x-dev || ^2.0.0-dev",
"phpunit/phpunit": ">=4.8.35 <6.0"
"phpunit/phpunit": "^6.2"
},
"time": "2019-07-29T11:03:54+00:00",
"type": "composer-plugin",
"time": "2019-10-30T19:59:35+00:00",
"type": "library",
"extra": {
"class": "UpdateHelper\\ComposerPlugin"
"branch-alias": {
"dev-master": "1.3.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"UpdateHelper\\": "src/"
"psr-4": {
"Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector"
}
},
"notification-url": "https://packagist.org/downloads/",
......@@ -40,41 +39,66 @@
],
"authors": [
{
"name": "Kyle",
"email": "kylekatarnls@gmail.com"
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "Update helper"
"description": "Common String Manipulations with regard to casing and singular/plural rules.",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"inflection",
"pluralize",
"singularize",
"string"
]
},
{
"name": "psr/container",
"version": "1.0.0",
"version_normalized": "1.0.0.0",
"name": "illuminate/container",
"version": "v5.5.44",
"version_normalized": "5.5.44.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/container.git",
"reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f"
"url": "https://github.com/illuminate/container.git",
"reference": "7917f4c86ecf7f4d0efcfd83248ad3e301e08858"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
"reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
"url": "https://api.github.com/repos/illuminate/container/zipball/7917f4c86ecf7f4d0efcfd83248ad3e301e08858",
"reference": "7917f4c86ecf7f4d0efcfd83248ad3e301e08858",
"shasum": ""
},
"require": {