svg
This commit is contained in:
@ -179,7 +179,7 @@ class CategoryController extends AbstractController
|
||||
return $this->redirectToRoute("app_home");
|
||||
}
|
||||
if($by!="admin"&&$by!="update") {
|
||||
if($this->getUser()!=$data->getCategory()->getUser()&&!$this->getUser()->hasRole("ROLE_ADMIN"))
|
||||
if($this->getUser()!=$data->getUser()&&!$this->getUser()->hasRole("ROLE_ADMIN"))
|
||||
return $this->redirectToRoute("app_home");
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ class HomeController extends AbstractController
|
||||
}
|
||||
|
||||
|
||||
public function feed($nb)
|
||||
public function feedhome($nb)
|
||||
{
|
||||
$feeds=[];
|
||||
|
||||
@ -123,12 +123,81 @@ class HomeController extends AbstractController
|
||||
$columns = array_column($feeds, 'pubtime');
|
||||
array_multisort($columns, SORT_DESC, $feeds);
|
||||
|
||||
$response = new Response($this->renderView('Home/feed.xml.twig',["feeds" => $feeds]));
|
||||
$response = new Response($this->renderView('Home/feed.xml.twig',["by"=>"home","feeds" => $feeds]));
|
||||
|
||||
$response->headers->set('Content-Type', 'application/xml; charset=utf-8');
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function feeduser($userpseudo,$nb)
|
||||
{
|
||||
$feeds=[];
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$qb = $em ->createQueryBuilder()
|
||||
->select('i')
|
||||
->from("App:Illustration", 'i')
|
||||
->from("App:Category", 'c')
|
||||
->from("App:User",'u')
|
||||
->Where('c=i.category')
|
||||
->andWhere('u=c.user')
|
||||
->andWhere('u.slug=:userpseudo')
|
||||
->setParameter('userpseudo',$userpseudo)
|
||||
->orderBy('i.submittime','DESC');
|
||||
if($nb!=0) $qb->setMaxResults($nb);
|
||||
$illustrations=$qb->getQuery()->getResult();
|
||||
foreach($illustrations as $illustration) {
|
||||
$tmp["path"] = "app_illustration_view";
|
||||
$tmp["type"] = "illustration";
|
||||
$tmp["idcat"] = $illustration->getCategory()->getId();
|
||||
$tmp["cat"] = $illustration->getCategory()->getName();
|
||||
$tmp["id"] = $illustration->getId();
|
||||
$tmp["name"] = $illustration->getName();
|
||||
$tmp["illustration"] = $illustration->getIllustration();
|
||||
$tmp["pubtime"] = $illustration->getSubmittime();
|
||||
$tmp["description"] = $illustration->getDescription();
|
||||
|
||||
array_push($feeds,$tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$qb = $em ->createQueryBuilder()
|
||||
->select('w')
|
||||
->from("App:Webzine", 'w')
|
||||
->from("App:User", 'u')
|
||||
->Where('u=w.user')
|
||||
->andWhere('u.slug=:userpseudo')
|
||||
->setParameter('userpseudo',$userpseudo)
|
||||
->orderBy('w.submittime','DESC');
|
||||
if($nb!=0) $qb->setMaxResults($nb);
|
||||
$webzines=$qb->getQuery()->getResult();
|
||||
foreach($webzines as $webzine) {
|
||||
if($webzine->getWebzinepages()) {
|
||||
$tmp["path"] = "app_webzine_view";
|
||||
$tmp["type"] = "webzine";
|
||||
$tmp["idcat"] = $webzine->getId();
|
||||
$tmp["cat"] = "Webzine".($webzine->getSet()?" - ".$webzine->getSet():"");
|
||||
$tmp["id"] = $webzine->getWebzinepages()[0]->getId();
|
||||
$tmp["name"] = $webzine->getName();
|
||||
$tmp["illustration"] = $webzine->getWebzinepages()[0]->getIllustration();
|
||||
$tmp["pubtime"] = $webzine->getSubmittime();
|
||||
$tmp["description"] = $webzine->getDescription();
|
||||
|
||||
array_push($feeds,$tmp);
|
||||
}
|
||||
}
|
||||
|
||||
$columns = array_column($feeds, 'pubtime');
|
||||
array_multisort($columns, SORT_DESC, $feeds);
|
||||
|
||||
$response = new Response($this->renderView('Home/feed.xml.twig',["by"=>"user","feeds" => $feeds]));
|
||||
|
||||
$response->headers->set('Content-Type', 'application/xml; charset=utf-8');
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function admin()
|
||||
{
|
||||
return $this->render('Home/admin.html.twig',[
|
||||
|
@ -111,6 +111,11 @@ class User implements UserInterface, \Serializable
|
||||
*/
|
||||
private $links;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Config", mappedBy="user", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
*/
|
||||
private $configs;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->groups = new ArrayCollection();
|
||||
@ -119,6 +124,7 @@ class User implements UserInterface, \Serializable
|
||||
$this->illustrations = new ArrayCollection();
|
||||
$this->webzines = new ArrayCollection();
|
||||
$this->links = new ArrayCollection();
|
||||
$this->configs = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getUsername(): ?string
|
||||
@ -387,6 +393,36 @@ class User implements UserInterface, \Serializable
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection|Config[]
|
||||
*/
|
||||
public function getConfigs(): Collection
|
||||
{
|
||||
return $this->configs;
|
||||
}
|
||||
|
||||
public function addConfig(Config $config): self
|
||||
{
|
||||
if (!$this->configs->contains($config)) {
|
||||
$this->configs[] = $config;
|
||||
$config->setUser($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeConfig(Config $config): self
|
||||
{
|
||||
if ($this->configs->removeElement($config)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($config->getUser() === $this) {
|
||||
$config->setUser(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPseudo(): ?string
|
||||
{
|
||||
|
Reference in New Issue
Block a user