evolution items

This commit is contained in:
Arnaud Fornerot 2022-12-05 12:05:16 +01:00
parent d0d8183f7a
commit 1a54b9a3f9
5 changed files with 35 additions and 12 deletions

View File

@ -65,6 +65,10 @@ class ItemController extends Controller
{
// Initialisation de l'enregistrement
$data = new Item();
if($this->GetParameter("activate_widsonde")) {
$data->setClicksonde(true);
$data->setClicksondeservice("PAGE_ENT");
}
// Création du formulaire
$form = $this->createForm(ItemType::class,$data,array(
@ -206,6 +210,26 @@ class ItemController extends Controller
return $response;
}
public function forceorderAction(Request $request)
{
$em = $this->getDoctrine()->getManager();
$categorys=$em->getRepository("CadolesPortalBundle:Itemcategory")->findAll();
foreach($categorys as $category) {
$i=0;
$items=$em->getRepository("CadolesPortalBundle:Item")->findBy(["itemcategory"=>$category],["title"=>"ASC"]);
foreach($items as $item) {
$i++;
$item->setRowOrder($i);
$em->flush();
}
}
// Retour à la liste
return $this->redirectToRoute($this->labelroute);
}
protected function getDatas()
{
$em = $this->getDoctrine()->getManager();

View File

@ -150,10 +150,12 @@ class ItemType extends AbstractType
if($options["activate_widsonde"]) {
$builder
/*
->add('clicksonde', CheckboxType::class, [
"label" => "Exécuter une sonde statistique sur le clic",
"required" => false
])
*/
->add('clicksondeservice', ChoiceType::class, [
"label" => 'Type de Service associé à la sonde',

View File

@ -117,6 +117,10 @@ cadoles_portal_config_item_order:
path: /config/item/order
defaults: { _controller: CadolesPortalBundle:Item:order }
cadoles_portal_config_item_forceorder:
path: /config/item/forceorder
defaults: { _controller: CadolesPortalBundle:Item:forceorder }
cadoles_portal_config_ajax_item_seleclist:
path: /config/item/ajax/selectlist
defaults: { _controller: CadolesPortalBundle:Item:ajaxseleclist }

View File

@ -67,8 +67,7 @@
{{ form_row(form.ssoitem) }}
{% endif %}
{% if form.clicksonde is defined %}
{{ form_row(form.clicksonde) }}
{% if form.clicksondeservice is defined %}
<div id="divclicksondeservice">
{{ form_row(form.clicksondeservice) }}
</div>
@ -133,13 +132,5 @@
if($("#item_target").val()=="frame") {
$("#divhelp").show();
}
if($("#item_clicksonde").is(':checked')) {
$("#divclicksondeservice").show();
}
else {
$("#divclicksondeservice").hide();
}
}
{% endblock %}

View File

@ -11,6 +11,8 @@
<p>
<a href="{{ path('cadoles_portal_config_item_submit') }}" class="btn btn-success">Ajouter un Item</a>
<a href="{{ path('cadoles_portal_config_itemcategory_submit') }}" class="btn btn-success">Ajouter une Categorie</a>
<a href="{{ path('cadoles_portal_config_item_forceorder') }}" class="btn btn-success pull-right">Ordonner les items en alpha</a>
</p>
<div class="category-list">