protected function getCategoriesForDatatable() { $return = ""; $arrObjItemshopCategorie = \Site\SiteHelper::getItemshopCategoriesRepository()->findAll(); if (count($arrObjItemshopCategorie) > 0) { foreach ($arrObjItemshopCategorie as $objItemshopCategorie) { $return .= '"' . $objItemshopCategorie->getNom() . '",'; } } return rtrim($return, ','); }
public function run() { $idCategorie = 8; $arrObjItemshop = \Site\SiteHelper::getItemshopRepository()->findItemsByCategorie($idCategorie, true); $templateTop = $this->objTwig->loadTemplate("ajaxCategorieGetArticles.html5.twig"); $viewItemshopDefault = $templateTop->render(["arrObjItemshop" => $arrObjItemshop]); $arrObjItemshopCategoriesCache = \Site\SiteHelper::getItemshopCategoriesRepository()->findCategoriesNotEmpty(); $this->arrayTemplate["arrObjItemshopCategories"] = $arrObjItemshopCategoriesCache; $this->arrayTemplate["viewItemshopDefault"] = $viewItemshopDefault; $view = $this->template->render($this->arrayTemplate); $this->response->setContent($view); $this->response->send(); }
public function run() { global $request; $mode = $request->query->get("mode"); if ($mode == "create") { $objItemshopCategories = new \Site\Entity\ItemshopCategories(); } else { if ($mode == "mod") { $id = $request->query->get("idCategorie"); $objItemshopCategories = \Site\SiteHelper::getItemshopCategoriesRepository()->find($id); } } $this->arrayTemplate["objItemshopCategories"] = $objItemshopCategories; $view = $this->template->render($this->arrayTemplate); $this->response->setContent($view); $this->response->send(); }
public function run() { global $request; $em = \Shared\DoctrineHelper::getEntityManager(); $idCategorie = $request->request->get("idCategorie"); if ($idCategorie > 0) { $objItemshopCategories = \Site\SiteHelper::getItemshopCategoriesRepository()->find($idCategorie); if ($objItemshopCategories !== null) { $em->remove($objItemshopCategories); $em->flush(); $result = array('result' => true, 'reasons' => ""); } else { $result = array('result' => false, 'reasons' => "La catégorie sélectionné n'éxiste pas."); } } else { $result = array('result' => false, 'reasons' => "Problème de transmission d'identifiant."); } echo json_encode($result); }
public function run() { global $request; $em = \Shared\DoctrineHelper::getEntityManager(); $categorieCat = $request->request->get("categorieCat"); $categorieNom = $request->request->get("categorieNom"); $categorieDescription = $request->request->get("categorieDescription"); if ($categorieCat > 0) { $objItemshopCategories = \Site\SiteHelper::getItemshopCategoriesRepository()->find($categorieCat); } else { $objItemshopCategories = new \Site\Entity\ItemshopCategories(); } $objItemshopCategories->setNom($categorieNom); $objItemshopCategories->setDescription($categorieDescription); $em->persist($objItemshopCategories); $em->flush(); $result = array('result' => true, 'reasons' => ""); echo json_encode($result); }
public function run() { global $request; $mode = $request->query->get("mode"); if ($mode == "create") { $objItemshop = new \Site\Entity\Itemshop(); } else { if ($mode == "mod") { $id = $request->query->get("idArticle"); $objItemshop = \Site\SiteHelper::getItemshopRepository()->find($id); if ($objItemshop->getType() != "2") { $objItemProto = \Player\PlayerHelper::getItemProtoRepository()->find($objItemshop->getIdItem()); $this->arrayTemplate["objItemProto"] = $objItemProto; } } } $arrObjItemShopCategorie = \Site\SiteHelper::getItemshopCategoriesRepository()->findAll(); $this->arrayTemplate["objItemshop"] = $objItemshop; $this->arrayTemplate["arrObjItemShopCategorie"] = $arrObjItemShopCategorie; $view = $this->template->render($this->arrayTemplate); $this->response->setContent($view); $this->response->send(); }