You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.0 KiB
40 lines
1.0 KiB
<?php
|
|
class GatewaySources
|
|
{
|
|
private $con;
|
|
|
|
public function __construct($con){
|
|
$this->con = $con;
|
|
}
|
|
|
|
public function addSources($sources)
|
|
{
|
|
$query = "insert into sources(link) values (:link);";
|
|
$this->con->executeQuery($query, array(':link' => array($sources->getLink(), PDO::PARAM_STR)
|
|
)
|
|
);
|
|
}
|
|
|
|
public function deleteSources($link)
|
|
{
|
|
$query = "delete from sources where link = :link;";
|
|
$this->con->executeQuery($query, array(':link' => array($link, PDO::PARAM_STR)
|
|
)
|
|
);
|
|
}
|
|
|
|
public function getSources()
|
|
{
|
|
$query = "SELECT * FROM sources";
|
|
$this->con->executeQuery($query, array());
|
|
$results=$this->con->getResults();
|
|
$listeSources = array();
|
|
Foreach ($results as $source){
|
|
$listeSources[] = new Sources($source["link"]);
|
|
}
|
|
return $listeSources;
|
|
}
|
|
}
|
|
|
|
?>
|