@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | private $container; |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Globals constructor. |
|
| 16 | - * @param ContainerInterface $container |
|
| 17 | - */ |
|
| 18 | - public function __construct(ContainerInterface $container) |
|
| 14 | + /** |
|
| 15 | + * Globals constructor. |
|
| 16 | + * @param ContainerInterface $container |
|
| 17 | + */ |
|
| 18 | + public function __construct(ContainerInterface $container) |
|
| 19 | 19 | { |
| 20 | 20 | $this->container = $container; |
| 21 | 21 | } |
@@ -38,23 +38,23 @@ discard block |
||
| 38 | 38 | return $package_name; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * this method send base bundle path related to ribs-admin |
|
| 43 | - * @param string|null $package |
|
| 44 | - * @param bool $dev_mode |
|
| 45 | - * @return string |
|
| 46 | - */ |
|
| 41 | + /** |
|
| 42 | + * this method send base bundle path related to ribs-admin |
|
| 43 | + * @param string|null $package |
|
| 44 | + * @param bool $dev_mode |
|
| 45 | + * @return string |
|
| 46 | + */ |
|
| 47 | 47 | public function getBaseBundlePath(string $package = "piou-piou/ribs-admin-bundle", bool $dev_mode = false): string |
| 48 | 48 | { |
| 49 | 49 | $path = $this->container->get('kernel')->getProjectDir(); |
| 50 | 50 | |
| 51 | - $dev_mode = $package === "piou-piou/ribs-admin-bundle" ? $this->container->getParameter("ribs_admin.dev_mode"): $dev_mode; |
|
| 51 | + $dev_mode = $package === "piou-piou/ribs-admin-bundle" ? $this->container->getParameter("ribs_admin.dev_mode"): $dev_mode; |
|
| 52 | 52 | |
| 53 | 53 | if ($dev_mode === true) { |
| 54 | 54 | $package = "/lib/".$this->getPackageDevName($package); |
| 55 | 55 | } else { |
| 56 | - $package = "/vendor/" . $package; |
|
| 57 | - } |
|
| 56 | + $package = "/vendor/" . $package; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | 59 | return $path . $package; |
| 60 | 60 | } |
@@ -48,10 +48,10 @@ |
||
| 48 | 48 | { |
| 49 | 49 | $path = $this->container->get('kernel')->getProjectDir(); |
| 50 | 50 | |
| 51 | - $dev_mode = $package === "piou-piou/ribs-admin-bundle" ? $this->container->getParameter("ribs_admin.dev_mode"): $dev_mode; |
|
| 51 | + $dev_mode = $package === "piou-piou/ribs-admin-bundle" ? $this->container->getParameter("ribs_admin.dev_mode") : $dev_mode; |
|
| 52 | 52 | |
| 53 | 53 | if ($dev_mode === true) { |
| 54 | - $package = "/lib/".$this->getPackageDevName($package); |
|
| 54 | + $package = "/lib/" . $this->getPackageDevName($package); |
|
| 55 | 55 | } else { |
| 56 | 56 | $package = "/vendor/" . $package; |
| 57 | 57 | } |
@@ -13,207 +13,207 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class UserLogs |
| 15 | 15 | { |
| 16 | - use GuidTrait; |
|
| 17 | - use CreatedUpdatedTrait; |
|
| 18 | - |
|
| 19 | - /** |
|
| 20 | - * @var integer |
|
| 21 | - * |
|
| 22 | - * @ORM\Column(name="id", type="integer", nullable=false) |
|
| 23 | - * @ORM\Id |
|
| 24 | - * @ORM\GeneratedValue(strategy="IDENTITY") |
|
| 25 | - */ |
|
| 26 | - private $id; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * @ORM\ManyToOne(targetEntity="PiouPiou\RibsAdminBundle\Entity\User") |
|
| 30 | - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false) |
|
| 31 | - */ |
|
| 32 | - private $user; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * @var string |
|
| 36 | - * |
|
| 37 | - * @ORM\Column(name="method", type="string", length=255, nullable=false) |
|
| 38 | - */ |
|
| 39 | - private $method; |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * @var string |
|
| 43 | - * |
|
| 44 | - * @ORM\Column(name="route", type="string", length=255, nullable=false) |
|
| 45 | - */ |
|
| 46 | - private $route; |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * @var string |
|
| 50 | - * |
|
| 51 | - * @ORM\Column(name="url", type="string", length=255, nullable=false) |
|
| 52 | - */ |
|
| 53 | - private $url; |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * @var string |
|
| 57 | - * |
|
| 58 | - * @ORM\Column(name="full_url", type="string", length=255, nullable=false) |
|
| 59 | - */ |
|
| 60 | - private $full_url; |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * @var string |
|
| 64 | - * |
|
| 65 | - * @ORM\Column(name="request_format", type="string", length=255, nullable=false) |
|
| 66 | - */ |
|
| 67 | - private $request_format; |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * @var string |
|
| 71 | - * |
|
| 72 | - * @ORM\Column(name="equest_parameters", type="json", nullable=true) |
|
| 73 | - */ |
|
| 74 | - private $request_parameters; |
|
| 75 | - |
|
| 76 | - /** |
|
| 77 | - * @return int |
|
| 78 | - */ |
|
| 79 | - public function getId() |
|
| 80 | - { |
|
| 81 | - return $this->id; |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * @param int $id |
|
| 86 | - */ |
|
| 87 | - public function setId($id) |
|
| 88 | - { |
|
| 89 | - $this->id = $id; |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * @return User |
|
| 94 | - */ |
|
| 95 | - public function getUser(): User |
|
| 96 | - { |
|
| 97 | - return $this->user; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * @param \User $user |
|
| 102 | - */ |
|
| 103 | - public function setUser($user) |
|
| 104 | - { |
|
| 105 | - $this->user = $user; |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - /** |
|
| 109 | - * @return string |
|
| 110 | - */ |
|
| 111 | - public function getMethod(): string |
|
| 112 | - { |
|
| 113 | - return $this->method; |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - /** |
|
| 117 | - * @param string $method |
|
| 118 | - * @return UserLogs |
|
| 119 | - */ |
|
| 120 | - public function setMethod(string $method): UserLogs |
|
| 121 | - { |
|
| 122 | - $this->method = $method; |
|
| 123 | - |
|
| 124 | - return $this; |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - /** |
|
| 128 | - * @return string |
|
| 129 | - */ |
|
| 130 | - public function getRoute(): string |
|
| 131 | - { |
|
| 132 | - return $this->route; |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - /** |
|
| 136 | - * @param string $route |
|
| 137 | - * @return UserLogs |
|
| 138 | - */ |
|
| 139 | - public function setRoute(string $route): UserLogs |
|
| 140 | - { |
|
| 141 | - $this->route = $route; |
|
| 142 | - |
|
| 143 | - return $this; |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * @return string |
|
| 148 | - */ |
|
| 149 | - public function getUrl(): string |
|
| 150 | - { |
|
| 151 | - return $this->url; |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - /** |
|
| 155 | - * @param string $url |
|
| 156 | - * @return UserLogs |
|
| 157 | - */ |
|
| 158 | - public function setUrl(string $url): UserLogs |
|
| 159 | - { |
|
| 160 | - $this->url = $url; |
|
| 161 | - |
|
| 162 | - return $this; |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - /** |
|
| 166 | - * @return string |
|
| 167 | - */ |
|
| 168 | - public function getFullUrl(): string |
|
| 169 | - { |
|
| 170 | - return $this->full_url; |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * @param string $full_url |
|
| 175 | - * @return UserLogs |
|
| 176 | - */ |
|
| 177 | - public function setFullUrl(string $full_url): UserLogs |
|
| 178 | - { |
|
| 179 | - $this->full_url = $full_url; |
|
| 180 | - |
|
| 181 | - return $this; |
|
| 182 | - } |
|
| 183 | - |
|
| 184 | - /** |
|
| 185 | - * @return string |
|
| 186 | - */ |
|
| 187 | - public function getRequestFormat(): string |
|
| 188 | - { |
|
| 189 | - return $this->request_format; |
|
| 190 | - } |
|
| 191 | - |
|
| 192 | - /** |
|
| 193 | - * @param string $request_format |
|
| 194 | - * @return UserLogs |
|
| 195 | - */ |
|
| 196 | - public function setRequestFormat(string $request_format): UserLogs |
|
| 197 | - { |
|
| 198 | - $this->request_format = $request_format; |
|
| 199 | - |
|
| 200 | - return $this; |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - public function getRequestParameters() |
|
| 204 | - { |
|
| 205 | - return $this->request_parameters; |
|
| 206 | - } |
|
| 207 | - |
|
| 208 | - /** |
|
| 209 | - * @param $request_parameters |
|
| 210 | - * @return UserLogs |
|
| 211 | - */ |
|
| 212 | - public function setRequestParameters($request_parameters): UserLogs |
|
| 213 | - { |
|
| 214 | - $this->request_parameters = $request_parameters; |
|
| 215 | - |
|
| 216 | - return $this; |
|
| 217 | - } |
|
| 16 | + use GuidTrait; |
|
| 17 | + use CreatedUpdatedTrait; |
|
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * @var integer |
|
| 21 | + * |
|
| 22 | + * @ORM\Column(name="id", type="integer", nullable=false) |
|
| 23 | + * @ORM\Id |
|
| 24 | + * @ORM\GeneratedValue(strategy="IDENTITY") |
|
| 25 | + */ |
|
| 26 | + private $id; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * @ORM\ManyToOne(targetEntity="PiouPiou\RibsAdminBundle\Entity\User") |
|
| 30 | + * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false) |
|
| 31 | + */ |
|
| 32 | + private $user; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * @var string |
|
| 36 | + * |
|
| 37 | + * @ORM\Column(name="method", type="string", length=255, nullable=false) |
|
| 38 | + */ |
|
| 39 | + private $method; |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * @var string |
|
| 43 | + * |
|
| 44 | + * @ORM\Column(name="route", type="string", length=255, nullable=false) |
|
| 45 | + */ |
|
| 46 | + private $route; |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * @var string |
|
| 50 | + * |
|
| 51 | + * @ORM\Column(name="url", type="string", length=255, nullable=false) |
|
| 52 | + */ |
|
| 53 | + private $url; |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * @var string |
|
| 57 | + * |
|
| 58 | + * @ORM\Column(name="full_url", type="string", length=255, nullable=false) |
|
| 59 | + */ |
|
| 60 | + private $full_url; |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * @var string |
|
| 64 | + * |
|
| 65 | + * @ORM\Column(name="request_format", type="string", length=255, nullable=false) |
|
| 66 | + */ |
|
| 67 | + private $request_format; |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * @var string |
|
| 71 | + * |
|
| 72 | + * @ORM\Column(name="equest_parameters", type="json", nullable=true) |
|
| 73 | + */ |
|
| 74 | + private $request_parameters; |
|
| 75 | + |
|
| 76 | + /** |
|
| 77 | + * @return int |
|
| 78 | + */ |
|
| 79 | + public function getId() |
|
| 80 | + { |
|
| 81 | + return $this->id; |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * @param int $id |
|
| 86 | + */ |
|
| 87 | + public function setId($id) |
|
| 88 | + { |
|
| 89 | + $this->id = $id; |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * @return User |
|
| 94 | + */ |
|
| 95 | + public function getUser(): User |
|
| 96 | + { |
|
| 97 | + return $this->user; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * @param \User $user |
|
| 102 | + */ |
|
| 103 | + public function setUser($user) |
|
| 104 | + { |
|
| 105 | + $this->user = $user; |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + /** |
|
| 109 | + * @return string |
|
| 110 | + */ |
|
| 111 | + public function getMethod(): string |
|
| 112 | + { |
|
| 113 | + return $this->method; |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + /** |
|
| 117 | + * @param string $method |
|
| 118 | + * @return UserLogs |
|
| 119 | + */ |
|
| 120 | + public function setMethod(string $method): UserLogs |
|
| 121 | + { |
|
| 122 | + $this->method = $method; |
|
| 123 | + |
|
| 124 | + return $this; |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + /** |
|
| 128 | + * @return string |
|
| 129 | + */ |
|
| 130 | + public function getRoute(): string |
|
| 131 | + { |
|
| 132 | + return $this->route; |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + /** |
|
| 136 | + * @param string $route |
|
| 137 | + * @return UserLogs |
|
| 138 | + */ |
|
| 139 | + public function setRoute(string $route): UserLogs |
|
| 140 | + { |
|
| 141 | + $this->route = $route; |
|
| 142 | + |
|
| 143 | + return $this; |
|
| 144 | + } |
|
| 145 | + |
|
| 146 | + /** |
|
| 147 | + * @return string |
|
| 148 | + */ |
|
| 149 | + public function getUrl(): string |
|
| 150 | + { |
|
| 151 | + return $this->url; |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + /** |
|
| 155 | + * @param string $url |
|
| 156 | + * @return UserLogs |
|
| 157 | + */ |
|
| 158 | + public function setUrl(string $url): UserLogs |
|
| 159 | + { |
|
| 160 | + $this->url = $url; |
|
| 161 | + |
|
| 162 | + return $this; |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + /** |
|
| 166 | + * @return string |
|
| 167 | + */ |
|
| 168 | + public function getFullUrl(): string |
|
| 169 | + { |
|
| 170 | + return $this->full_url; |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * @param string $full_url |
|
| 175 | + * @return UserLogs |
|
| 176 | + */ |
|
| 177 | + public function setFullUrl(string $full_url): UserLogs |
|
| 178 | + { |
|
| 179 | + $this->full_url = $full_url; |
|
| 180 | + |
|
| 181 | + return $this; |
|
| 182 | + } |
|
| 183 | + |
|
| 184 | + /** |
|
| 185 | + * @return string |
|
| 186 | + */ |
|
| 187 | + public function getRequestFormat(): string |
|
| 188 | + { |
|
| 189 | + return $this->request_format; |
|
| 190 | + } |
|
| 191 | + |
|
| 192 | + /** |
|
| 193 | + * @param string $request_format |
|
| 194 | + * @return UserLogs |
|
| 195 | + */ |
|
| 196 | + public function setRequestFormat(string $request_format): UserLogs |
|
| 197 | + { |
|
| 198 | + $this->request_format = $request_format; |
|
| 199 | + |
|
| 200 | + return $this; |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + public function getRequestParameters() |
|
| 204 | + { |
|
| 205 | + return $this->request_parameters; |
|
| 206 | + } |
|
| 207 | + |
|
| 208 | + /** |
|
| 209 | + * @param $request_parameters |
|
| 210 | + * @return UserLogs |
|
| 211 | + */ |
|
| 212 | + public function setRequestParameters($request_parameters): UserLogs |
|
| 213 | + { |
|
| 214 | + $this->request_parameters = $request_parameters; |
|
| 215 | + |
|
| 216 | + return $this; |
|
| 217 | + } |
|
| 218 | 218 | } |
| 219 | 219 | |
@@ -10,44 +10,44 @@ |
||
| 10 | 10 | |
| 11 | 11 | class UserLogsController extends AbstractController |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * list all user logs |
|
| 15 | - * @Route("/user-logs/{page}", requirements={"page" = "\d+"}, name="ribsadmin_userlogs") |
|
| 16 | - * @param ParameterBagInterface $parameterBag |
|
| 17 | - * @param int $page |
|
| 18 | - * @return Response |
|
| 19 | - */ |
|
| 20 | - public function list(ParameterBagInterface $parameterBag, int $page = 1): Response |
|
| 21 | - { |
|
| 22 | - $em = $this->getDoctrine()->getManager(); |
|
| 23 | - $max_per_page = $parameterBag->get("ribs_admin.paginator_element_per_page"); |
|
| 13 | + /** |
|
| 14 | + * list all user logs |
|
| 15 | + * @Route("/user-logs/{page}", requirements={"page" = "\d+"}, name="ribsadmin_userlogs") |
|
| 16 | + * @param ParameterBagInterface $parameterBag |
|
| 17 | + * @param int $page |
|
| 18 | + * @return Response |
|
| 19 | + */ |
|
| 20 | + public function list(ParameterBagInterface $parameterBag, int $page = 1): Response |
|
| 21 | + { |
|
| 22 | + $em = $this->getDoctrine()->getManager(); |
|
| 23 | + $max_per_page = $parameterBag->get("ribs_admin.paginator_element_per_page"); |
|
| 24 | 24 | |
| 25 | - $logs = $em->getRepository(UserLogs::class)->findAllPaginated($page, $max_per_page); |
|
| 26 | - $pagination = array( |
|
| 27 | - "page" => $page, |
|
| 28 | - "page_number" => ceil(count($logs) / 20), |
|
| 29 | - "route" => "ribsadmin_userlogs", |
|
| 30 | - "parameters" => array() |
|
| 31 | - ); |
|
| 25 | + $logs = $em->getRepository(UserLogs::class)->findAllPaginated($page, $max_per_page); |
|
| 26 | + $pagination = array( |
|
| 27 | + "page" => $page, |
|
| 28 | + "page_number" => ceil(count($logs) / 20), |
|
| 29 | + "route" => "ribsadmin_userlogs", |
|
| 30 | + "parameters" => array() |
|
| 31 | + ); |
|
| 32 | 32 | |
| 33 | - return $this->render("@RibsAdmin/userlogs/list.html.twig", [ |
|
| 34 | - "logs" => $logs, |
|
| 35 | - "pagination" => $pagination |
|
| 36 | - ]); |
|
| 37 | - } |
|
| 33 | + return $this->render("@RibsAdmin/userlogs/list.html.twig", [ |
|
| 34 | + "logs" => $logs, |
|
| 35 | + "pagination" => $pagination |
|
| 36 | + ]); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * show detail of a user log |
|
| 41 | - * @Route("/user-logs/show/{guid}", name="ribsadmin_userlogs_show") |
|
| 42 | - * @param string $guid |
|
| 43 | - * @return Response |
|
| 44 | - */ |
|
| 45 | - public function show(string $guid): Response |
|
| 46 | - { |
|
| 47 | - $log = $this->getDoctrine()->getRepository(UserLogs::class)->findOneByGuid($guid); |
|
| 39 | + /** |
|
| 40 | + * show detail of a user log |
|
| 41 | + * @Route("/user-logs/show/{guid}", name="ribsadmin_userlogs_show") |
|
| 42 | + * @param string $guid |
|
| 43 | + * @return Response |
|
| 44 | + */ |
|
| 45 | + public function show(string $guid): Response |
|
| 46 | + { |
|
| 47 | + $log = $this->getDoctrine()->getRepository(UserLogs::class)->findOneByGuid($guid); |
|
| 48 | 48 | |
| 49 | - return $this->render("@RibsAdmin/userlogs/show.html.twig", [ |
|
| 50 | - "log" => $log, |
|
| 51 | - ]); |
|
| 52 | - } |
|
| 49 | + return $this->render("@RibsAdmin/userlogs/show.html.twig", [ |
|
| 50 | + "log" => $log, |
|
| 51 | + ]); |
|
| 52 | + } |
|
| 53 | 53 | } |