linkedin + some css

This commit is contained in:
Florian Bouillon 2019-03-07 16:32:27 +01:00
parent 081ed3a1de
commit a4d60d2f76
9 changed files with 89 additions and 18 deletions

View File

@ -164,13 +164,14 @@ a{
padding-right: 2%; padding-right: 2%;
} }
@media only screen and (min-width: 992px) { @media (min-width: 992px) {
.articleHome { .articleHome {
padding-right: 10%; padding-right: 10%;
padding-left: 10%; padding-left: 10%;
} }
} }
.bloc_principal_titre .bloc_principal_titre
.nav_imie { .nav_imie {
@ -178,7 +179,7 @@ a{
background-color: #1c1c1c; background-color: #1c1c1c;
} }
.nav_blog { .nav_blog .container-fluid {
height: 80px; height: 80px;
background-color: #110230; background-color: #110230;
margin-bottom: 70px; margin-bottom: 70px;
@ -853,6 +854,9 @@ label{
} }
@media screen and (max-width: 640px) { @media screen and (max-width: 640px) {
.item_nav_imie.right {
display: none;
}
.contact-footer{ .contact-footer{
display: none; display: none;
} }
@ -874,10 +878,6 @@ label{
display:none; display:none;
} }
.nav_imie {
height: 0;
}
#twi { #twi {
height: 0; height: 0;
width: 0; width: 0;
@ -1031,3 +1031,10 @@ table {
color: inherit; color: inherit;
text-decoration: inherit; text-decoration: inherit;
} }
@media (max-width: 992px) {
.item_nav_imie.right, .item_nav_blog_droite {
display: none;
}
}

View File

@ -6,11 +6,11 @@
<div class="row"> <div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<ul> <ul>
<li class="item_nav_imie link"><a href="https://imie44.ymag.cloud" target="_blank">Accès Net-Yparéo</a></li> <li class="item_nav_imie link right"><a href="https://imie44.ymag.cloud" target="_blank">Accès Net-Yparéo</a></li>
<li class="item_nav_imie link"><a href="https://www.imie.fr" target="_blank">IMIE Numérique</a></li> <li class="item_nav_imie link right"><a href="https://www.imie.fr" target="_blank">IMIE Numérique</a></li>
<li class="item_nav_imie social"><a href="https://twitter.com/EcoleIMIE" target="_blank"> <li class="item_nav_imie social right"><a href="https://twitter.com/EcoleIMIE" target="_blank">
<tag type="svg" file="twitter" style="color: white; width: 18px; height: 18px" /></a></li> <tag type="svg" file="twitter" style="color: white; width: 18px; height: 18px" /></a></li>
<li class="item_nav_imie social"><a href="https://www.facebook.com/EcolesIMIE/" target="_blank"> <li class="item_nav_imie social right"><a href="https://www.facebook.com/EcolesIMIE/" target="_blank">
<tag type="svg" file="facebook" style="color: white; width: 18px; height: 18px" /></a></li> <tag type="svg" file="facebook" style="color: white; width: 18px; height: 18px" /></a></li>
<li class="item_nav_imie link" style="float: left;color: #ff004c;"> <li class="item_nav_imie link" style="float: left;color: #ff004c;">
<tag type="isLoggedIn"> <tag type="isLoggedIn">
@ -25,7 +25,7 @@
<tag type="isLoggedIn" role="ROLE_ADMIN"> <tag type="isLoggedIn" role="ROLE_ADMIN">
<if true> <if true>
<li class="item_nav_imie link" style="float: left"> <li class="item_nav_imie link" style="float: left">
<a href="/users">Utilisateurs</a> <a href="/users/">Utilisateurs</a>
</li> </li>
</if> </if>
</tag> </tag>
@ -33,11 +33,19 @@
<if true> <if true>
<li class="item_nav_imie link" style="float: left"> <li class="item_nav_imie link" style="float: left">
<a href="/post/new">Ajouter un article</a> <a href="/post/new/">Ajouter un article</a>
</li> </li>
</if> </if>
</tag> </tag>
<tag type="isLoggedIn" role="ROLE_EDITOR">
<if true>
<li class="item_nav_imie link" style="float: left">
<a href="/user/edit/">Editer son utilisateur</a>
</li>
</if>
</tag>
<tag type="isLoggedIn" role="ROLE_EDITOR"> <tag type="isLoggedIn" role="ROLE_EDITOR">
<if true> <if true>
<li class="item_nav_imie link" style="float: left"> <li class="item_nav_imie link" style="float: left">

View File

@ -35,6 +35,7 @@
</h3> </h3>
<h3 class="job"> <h3 class="job">
<tag type="authorTag" column="job" /> <tag type="authorTag" column="job" />
<tag type="authorTag" column="linkedin" />
</h3> </h3>
</div> </div>
</div> </div>

View File

@ -21,6 +21,7 @@
<tag type="userEditor" element="username" /> <tag type="userEditor" element="username" />
<input name="password" id="password" type="password" placeholder="Mot de passe" /> <input name="password" id="password" type="password" placeholder="Mot de passe" />
<tag type="userEditor" element="job" /> <tag type="userEditor" element="job" />
<tag type="userEditor" element="linkedin" />
<select name="role"> <select name="role">
<tag type="userEditor" element="role" /> <tag type="userEditor" element="role" />
</select> </select>

View File

@ -19,6 +19,7 @@ class UserController extends Controller {
$user->setUsername($_POST["username"]); $user->setUsername($_POST["username"]);
$user->setPassword($_POST["password"]); $user->setPassword($_POST["password"]);
$user->setRole($_POST["role"]); $user->setRole($_POST["role"]);
$user->setLinkedin($_POST["linkedin"]);
Author::add($user); Author::add($user);
header("Location: /users/"); header("Location: /users/");
} }
@ -49,12 +50,34 @@ class UserController extends Controller {
if($_POST["password"] != '') $user->setPassword($_POST["password"]); if($_POST["password"] != '') $user->setPassword($_POST["password"]);
$user->setRole($_POST["role"]); $user->setRole($_POST["role"]);
$user->setJob($_POST["job"]); $user->setJob($_POST["job"]);
$user->setLinkedin($_POST["linkedin"]);
Author::update($user); Author::update($user);
header("Location: /users/"); header("Location: /users/");
} }
return file_get_contents(DIR."/html/user_edit.html"); return file_get_contents(DIR."/html/user_edit.html");
} }
/**
* @route /\/user\/edit\/$/
* @editor
* @title Modifier un utilisateur
*/
public function userEdit() {
$_GET['edit_user'] = $_SESSION["author"]->getId();
if(isset($_POST["username"]) && isset($_POST["password"]) && isset($_POST["job"]) && isset($_POST["role"])) {
$user = Author::get($_GET["edit_user"]);
$user->setUsername($_POST["username"]);
if($_POST["password"] != '') $user->setPassword($_POST["password"]);
$user->setRole($_POST["role"]);
$user->setJob($_POST["job"]);
$user->setLinkedin($_POST["linkedin"]);
Author::update($user);
header("Location: /");
}
return file_get_contents(DIR."/html/user_edit.html");
}
/** /**
* @route /\/users\/[0-9]+\/delete\/$/ * @route /\/users\/[0-9]+\/delete\/$/
* @admin * @admin

View File

@ -21,9 +21,18 @@ class AuthorTag extends Tag {
$doc = $this->getDoc(); $doc = $this->getDoc();
$col = "get" . ucfirst($attr); if($attr == "username") {
$txt = $doc->createElement("a");
$txt->setAttribute("href", "https://www.linkedin.com/in/".$author->getLinkedin() . "/");
$txt->setAttribute("target", "_blank");
$txt->appendChild($doc->createTextNode($author->getUsername()));
} else {
$col = "get" . ucfirst($attr);
$txt = $doc->createTextNode($author->$col());
}
$txt = $doc->createTextNode($author->$col());
$pok->parentNode->insertBefore($txt, $pok); $pok->parentNode->insertBefore($txt, $pok);
} }

View File

@ -36,6 +36,13 @@ class UserEditor extends \App\Tags\Tag {
$input->setAttribute("placeholder", "Nom d'utilisateur"); $input->setAttribute("placeholder", "Nom d'utilisateur");
$el->parentNode->insertBefore($input, $el); $el->parentNode->insertBefore($input, $el);
break; break;
case 'linkedin':
$input = $doc->createElement("input");
$input->setAttribute("value", $user->getLinkedin());
$input->setAttribute("name", "linkedin");
$input->setAttribute("placeholder", "https://www.linkedin.com/in/ton_nom_dutilisateur/");
$el->parentNode->insertBefore($input, $el);
break;
case 'job': case 'job':
$input = $doc->createElement("input"); $input = $doc->createElement("input");
$input->setAttribute("value", $user->getJob()); $input->setAttribute("value", $user->getJob());

View File

@ -16,6 +16,8 @@ class Author {
private $role = "ROLE_USER"; private $role = "ROLE_USER";
private $linkedin;
public function __construct(){} public function __construct(){}
public function getId() { public function getId() {
@ -42,6 +44,10 @@ class Author {
return $this->role; return $this->role;
} }
public function getLinkedin() {
return $this->linkedin;
}
public function setId($id) { public function setId($id) {
$this->id = $id; $this->id = $id;
} }
@ -66,6 +72,10 @@ class Author {
$this->role = $role; $this->role = $role;
} }
public function setLinkedin($linkedin) {
$this->linkedin = $linkedin;
}
@ -80,6 +90,7 @@ class Author {
$au->setUsername($array["username"]); $au->setUsername($array["username"]);
$au->setHashedPassword($array["password"]); $au->setHashedPassword($array["password"]);
$au->setJob($array["job"]); $au->setJob($array["job"]);
$au->setLinkedin($array["linkedin"]);
$au->setRole($array["role"]); $au->setRole($array["role"]);
return $au; return $au;
} }
@ -113,13 +124,14 @@ class Author {
} }
public static function add(Author $author) { public static function add(Author $author) {
$query = "INSERT INTO users (id, username, password, job, role) $query = "INSERT INTO users (id, username, password, job, role, linkedin)
VALUES (NULL, :username, :password, :job, :role);"; VALUES (NULL, :username, :password, :job, :role, :linkedin);";
$username = $author->getUsername(); $username = $author->getUsername();
$password = $author->getPassword(); $password = $author->getPassword();
$job = $author->getJob(); $job = $author->getJob();
$role = $author->getRole(); $role = $author->getRole();
$linkedin = $author->getLinkedin();
$pdo = Functions::connect(); $pdo = Functions::connect();
$prepared = $pdo->prepare($query); $prepared = $pdo->prepare($query);
@ -127,6 +139,7 @@ class Author {
$prepared->bindParam(":password", $password); $prepared->bindParam(":password", $password);
$prepared->bindParam(":job", $job); $prepared->bindParam(":job", $job);
$prepared->bindParam(":role", $role); $prepared->bindParam(":role", $role);
$prepared->bindParam(":linkedin", $linkedin);
$prepared->execute(); $prepared->execute();
// var_dump($prepared->errorInfo()); // var_dump($prepared->errorInfo());
// die; // die;
@ -139,11 +152,12 @@ class Author {
} }
public static function update(Author $author) { public static function update(Author $author) {
Functions::connect()->prepare("UPDATE users SET username=:username, password=:password, job=:job, role=:role WHERE id=:id")->execute(array( Functions::connect()->prepare("UPDATE users SET username=:username, password=:password, job=:job, role=:role, linkedin=:linkedin WHERE id=:id")->execute(array(
":username" => $author->getUsername(), ":username" => $author->getUsername(),
":password" => $author->getPassword(), ":password" => $author->getPassword(),
":job" => $author->getJob(), ":job" => $author->getJob(),
":role" => $author->getRole(), ":role" => $author->getRole(),
":linkedin" => $author->getLinkedin(),
":id" => $author->getId() ":id" => $author->getId()
)); ));
} }

View File

@ -131,6 +131,7 @@ CREATE TABLE `users` (
`username` varchar(128) DEFAULT NULL, `username` varchar(128) DEFAULT NULL,
`job` varchar(560) DEFAULT NULL, `job` varchar(560) DEFAULT NULL,
`password` varchar(60) DEFAULT NULL, `password` varchar(60) DEFAULT NULL,
`linkedin` varchar(100) DEFAULT NULL,
`role` varchar(100) NOT NULL DEFAULT 'ROLE_USER' `role` varchar(100) NOT NULL DEFAULT 'ROLE_USER'
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;