@@ -86,7 +86,7 @@ function ($element) use ($category) {
8686 }
8787 echo '<select id="select_availableItems" size=" ' . count ($ availableItems_array ) + count ($ selectedItems_array ) . '"> ' ;
8888 foreach ($ availableItems_array as $ item ) {
89- echo '<option value=" ' .$ item ['id ' ]. '"> ' . $ item ['name ' ] . '</option> ' ;
89+ echo '<option value=" ' . $ item ['id ' ] . '"> ' . $ item ['name ' ] . '</option> ' ;
9090 }
9191 echo '</select> ' ;
9292 echo '</div> ' ;
@@ -377,20 +377,11 @@ private function showConfigCategoriesForm()
377377 $ menu .= '<td> ' ;
378378 $ menu .= '<input class="noEnterSubmit" onkeydown="createCategoryEnter()" type="text" id="newCategoryTitle" size="15" title="Please enter a type"> ' ;
379379 $ menu .= '<button type="button" onclick="createCategory()"> ' . _sx ('button ' , 'Add ' ) . '</button> ' ;
380- // $menu .= '<div style="clear: left;" id="categoriesContainer">';
381380 $ menu .= '<table class="listCustomCategories" id="categoriesContainer"> ' ;
382381 $ menu .= '<tbody> ' ;
383382
384383 $ categories_names = PluginReservationCategory::getCategoriesNames ();
385- // $all_reservation_items = PluginReservationCategory::getReservationItems('', '', false, ["filter_is_active" => false]);
386384 foreach ($ categories_names as $ category_name ) {
387- // $filtered_array = array_filter(
388- // $all_reservation_items,
389- // function ($element) use ($category_name) {
390- // return ($element['category_name'] == $category_name);
391- // }
392- // );
393-
394385 $ it = 0 ;
395386 if ($ category_name === "zzpluginnotcategorized " ) {
396387 continue ;
@@ -401,87 +392,13 @@ private function showConfigCategoriesForm()
401392 $ menu .= '<td><button type="button" onclick="deleteCategory( \'' . $ category_name . '\')" class="categoryClose" >X</td> ' ;
402393 $ menu .= '<input type="hidden" name="category_ ' . $ category_name . '" value=" ' . $ category_name . '"> ' ;
403394 $ menu .= '</tr> ' ;
404- // $menu .= $this->openCategoryHtml($category_name, $category_name);
405- // foreach ($filtered_array as $reservation_item) {
406- // $it++;
407- // $menu .= $this->makeItemHtml($reservation_item, $category_name, $it);
408- // }
409- // $menu .= $this->closeCategoryHtml();
410395 }
411396 $ menu .= '</tbody> ' ;
412397 $ menu .= '</table> ' ;
413398 $ menu .= '</td> ' ;
414- // $menu .= '<td>';
415-
416- // $menu .= $this->openCategoryHtml('zzpluginnotcategorized', '', false);
417- // // if (in_array('zzpluginnotcategorized', $categories_names)) {
418- // $filtered_array = array_filter(
419- // $all_reservation_items,
420- // function ($element) {
421- // return ($element['category_name'] === 'zzpluginnotcategorized' || is_null($element['category_name']));
422- // }
423- // );
424- // $it = 0;
425- // foreach ($filtered_array as $reservation_item) {
426- // $it++;
427- // $menu .= $this->makeItemHtml($reservation_item, 'zzpluginnotcategorized', $it);
428- // }
429- // // }
430- // $menu .= $this->closeCategoryHtml();
431-
432- // $menu .= '<div style="clear: left;"></div>';
433- // $menu .= '</td>';
434399 $ menu .= "</tr> " ;
435400 $ menu .= "</table> " ;
436401
437402 return $ menu ;
438403 }
439-
440- /**
441- * make html code for an item
442- * @param hash $reservation_item item
443- * @param string $category_name name of the category item
444- * @param integer $index index of the item
445- * @return string code html
446- */
447- private function makeItemHtml ($ reservation_item , $ category_name , $ index )
448- {
449- $ html = '<tr class="draggable" ' . ($ reservation_item ['is_active ' ] == '1 ' ? '' : 'style="background-color:#f36647 " ' ) . ' id="item_ ' . $ reservation_item ['id ' ] . '"> ' ;
450- $ html .= '<input type="hidden" name="item_ ' . $ reservation_item ['id ' ] . '" value=" ' . $ category_name . '"> ' ;
451- $ html .= '<td> ' . $ reservation_item ['name ' ] . '</td> ' ;
452- $ html .= '<td> ' . nl2br ($ reservation_item ['comment ' ]) . '</td> ' ;
453- $ html .= '<td class="index"> ' . $ index . '</td> ' ;
454- $ html .= '</tr> ' ;
455- return $ html ;
456- }
457-
458- /**
459- * make html code to open category
460- * @param string $category_name name of this category
461- * @param string $category_name title displayed
462- * @param boolean $deletable category is deletable or not
463- * @return string code html
464- */
465- private function openCategoryHtml ($ category_name , $ category_title , $ deletable = true )
466- {
467- $ html = '<table class="dropper" id="itemsCategory_ ' . $ category_name . '"> ' ;
468- $ html .= '<thead> ' ;
469- $ html .= '<th colspan="3" class="categoryTitle"> ' . $ category_title . '</th> ' ;
470- $ deletable && $ html .= '<td onclick="deleteCategory( \'' . $ category_name . '\')" class="categoryClose" >X</td> ' ;
471- $ html .= '</thead> ' ;
472- $ html .= '<input type="hidden" name="category_ ' . $ category_name . '" value=" ' . $ category_name . '"> ' ;
473- $ html .= '<tbody> ' ;
474- return $ html ;
475- }
476-
477- /**
478- * make html code to close category
479- * @return string code html
480- */
481- private function closeCategoryHtml ()
482- {
483- $ html = '</tbody> ' ;
484- $ html .= "</table> " ;
485- return $ html ;
486- }
487404}
0 commit comments