Merge branch 'pre-master' of https://codefirst.iut.uca.fr/git/roxane.rossetto/Php_RSS into pre-master
commit
758f6eeb31
@ -1,14 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="MessDetectorOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCSFixerOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCodeSnifferOptionsConfiguration">
|
||||
<option name="highlightLevel" value="WARNING" />
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PhpIncludePathManager">
|
||||
<include_path>
|
||||
<path value="$PROJECT_DIR$/vendor/composer" />
|
||||
<path value="$PROJECT_DIR$/vendor/twig/twig" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-mbstring" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
|
||||
<path value="$PROJECT_DIR$/mvc_PSR4_twig/vendor/symfony/polyfill-mbstring" />
|
||||
<path value="$PROJECT_DIR$/mvc_PSR4_twig/vendor/symfony/polyfill-ctype" />
|
||||
<path value="$PROJECT_DIR$/mvc_PSR4_twig/vendor/composer" />
|
||||
<path value="$PROJECT_DIR$/mvc_PSR4_twig/vendor/twig/twig" />
|
||||
</include_path>
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="8.0">
|
||||
<option name="suggestChangeDefaultLanguageLevel" value="false" />
|
||||
</component>
|
||||
<component name="PhpStanOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PsalmOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/mvc_PSR4_twig.iml" filepath="$PROJECT_DIR$/.idea/mvc_PSR4_twig.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/config" isTestSource="false" packagePrefix="config\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/controleur" isTestSource="false" packagePrefix="controleur\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/metier" isTestSource="false" packagePrefix="modeles\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-ctype" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-mbstring" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/twig/twig" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PhpIncludePathManager">
|
||||
<include_path>
|
||||
<path value="$PROJECT_DIR$/vendor/composer" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-mbstring" />
|
||||
<path value="$PROJECT_DIR$/vendor/twig/twig" />
|
||||
</include_path>
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="8.0">
|
||||
<option name="suggestChangeDefaultLanguageLevel" value="false" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace DAL;
|
||||
|
||||
use App\modeles\Article;
|
||||
use PDO;
|
||||
class ArticleGateway
|
||||
{
|
||||
private $con;
|
||||
|
||||
/**
|
||||
* @param $con
|
||||
*/
|
||||
public function __construct($con)
|
||||
{
|
||||
$this->con = $con;
|
||||
}
|
||||
|
||||
public function getAllArticles():array
|
||||
{
|
||||
$query = 'SELECT * FROM Article;';
|
||||
$this->con->executeQuery($query, array());
|
||||
return $this->con->getResults();
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace modeles;
|
||||
namespace DAL;
|
||||
|
||||
use PDO;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace modeles;
|
||||
namespace DAL;
|
||||
|
||||
use PDO;
|
||||
|
@ -1,127 +1,118 @@
|
||||
<?php
|
||||
|
||||
namespace modeles;
|
||||
namespace metier;
|
||||
|
||||
class Article
|
||||
{
|
||||
private int $id;
|
||||
private string $title;
|
||||
private string $date;
|
||||
private string $description;
|
||||
private string $guid;
|
||||
private string $link;
|
||||
private string $mediaContent;
|
||||
private int $provenance;
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param string $title
|
||||
* @param string $date
|
||||
* @param string $description
|
||||
* @param string $guid
|
||||
* @param string $link
|
||||
* @param string $mediaContent
|
||||
* @param int $provenance
|
||||
*/
|
||||
public function __construct(string $title, string $date, string $description, string $guid, string $link, string $mediaContent)
|
||||
public function __construct(int $id, string $title, string $date, string $description, string $guid, string $link, string $mediaContent, int $provenance)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->title = $title;
|
||||
$this->date = $date;
|
||||
$this->description = $description;
|
||||
$this->guid = $guid;
|
||||
$this->link = $link;
|
||||
$this->mediaContent = $mediaContent;
|
||||
$this->provenance = $provenance;
|
||||
}
|
||||
|
||||
public function getId(): int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setId(int $id): void
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle(): string
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $title
|
||||
*/
|
||||
public function setTitle(string $title): void
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDate(): string
|
||||
{
|
||||
return $this->date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $date
|
||||
*/
|
||||
public function setDate(string $date): void
|
||||
{
|
||||
$this->date = $date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription(): string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $description
|
||||
*/
|
||||
public function setDescription(string $description): void
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getGuid(): string
|
||||
{
|
||||
return $this->guid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $guid
|
||||
*/
|
||||
public function setGuid(string $guid): void
|
||||
{
|
||||
$this->guid = $guid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLink(): string
|
||||
{
|
||||
return $this->link;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $link
|
||||
*/
|
||||
public function setLink(string $link): void
|
||||
{
|
||||
$this->link = $link;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMediaContent(): string
|
||||
{
|
||||
return $this->mediaContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $mediaContent
|
||||
*/
|
||||
public function setMediaContent(string $mediaContent): void
|
||||
{
|
||||
$this->mediaContent = $mediaContent;
|
||||
}
|
||||
|
||||
public function getProvenance(): int
|
||||
{
|
||||
return $this->provenance;
|
||||
}
|
||||
|
||||
public function setProvenance(int $provenance): void
|
||||
{
|
||||
$this->provenance = $provenance;
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace modeles;
|
||||
namespace metier;
|
||||
|
||||
class Flux
|
||||
{
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace model;
|
||||
|
||||
use DAL;
|
||||
use metier;
|
||||
class ArticleModel
|
||||
{
|
||||
public static function getArticles() : array
|
||||
{
|
||||
$gwArticle = new DAL\ArticleGateway(new DAL\Connection('mysql:host = localhost; dbname = dbrorossetto', 'rorossetto', 'tpphp'));
|
||||
$res = $gwArticle->getAllArticles();
|
||||
foreach($res as $row){
|
||||
$tabArticle[] = new metier\Article($row['id'], $row['title'],$row['datePub'],$row['description'],$row['guid'],$row['link'],$row['mediaContent'],$row['provenance'] );
|
||||
}
|
||||
return $tabArticle;
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>All Articles</title>
|
||||
</head>
|
||||
<body>
|
||||
{% for value in tabArticle.Article %}
|
||||
<p>{{value}}</p>
|
||||
{% endfor %}
|
||||
</body>
|
||||
</html>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue