diff --git a/src/lib/Movement.php b/src/lib/Movement.php
index e29d710..413e9ea 100644
--- a/src/lib/Movement.php
+++ b/src/lib/Movement.php
@@ -7,4 +7,16 @@ use Garradin\Plugin\Materiels\Equipment;
class Movement
{
+ public function listAllOneSide($side)
+ // return all entries if side is 0 or all outputs if side is 1 ordered by date
+ {
+ $mvts = DB::getInstance()->get("SELECT * FROM plugin_materiels_movement WHERE side = '{$side}' ORDER BY mvt_date DESC;");
+ // for each movements get the equipment's designation
+ $eqmt = new Equipment;
+ foreach ($mvts as $key => $value) {
+ $mvt_eqmt = $eqmt->get($value->equipment_id);
+ $mvts[$key]->equipment = $mvt_eqmt->designation;
+ }
+ return $mvts;
+ }
}
diff --git a/src/templates/mouvements/entrees/index.tpl b/src/templates/mouvements/entrees/index.tpl
index 6caf332..cd72e22 100644
--- a/src/templates/mouvements/entrees/index.tpl
+++ b/src/templates/mouvements/entrees/index.tpl
@@ -1,37 +1,17 @@
+
{include file="%s_nav.tpl"|args:$plugin_tpl current_nav="entrees"}
-
+
+
Ajouter une entrée pour du
{linkbutton shape="plus" label="Matériel répertorié" href="repertorie.php"}
{linkbutton shape="plus" label="Matériel non répertorié" href="non_repertorie.php"}
{linkbutton shape="plus" label="Matériel en retour de location / prêt" href="retour.php"}
-
-{if $entries}
-
-
- Date
- Type
- Nombre
- Matériel
- Remarques
-
-
-
- {foreach from=$entries item="entry"}
-
- {$entry.entry_date|date_format:'%d/%m/%y'}
- {$entry.kind}
- {$entry.equipment_number}
- {$entry.equipment}
- {$entry.additional_comment}
-
- {linkbutton shape="delete" label="Supprimer" href="supprimer_entree.php?id=%d"|args:$entry.id}
-
-
- {/foreach}
-
-
-{/if}
-
+
+
+{include file="%smouvements/tableau_mouvements.tpl"|args:$plugin_tpl mvts=$mvts del_href="supprimer_entree.php?id=%d"}
+
+
{include file="admin/_foot.tpl"}
+
diff --git a/src/templates/mouvements/tableau_mouvements.tpl b/src/templates/mouvements/tableau_mouvements.tpl
new file mode 100644
index 0000000..3e71ffa
--- /dev/null
+++ b/src/templates/mouvements/tableau_mouvements.tpl
@@ -0,0 +1,28 @@
+
+{if $mvts}
+
+
+ Date
+ Type
+ Nombre
+ Matériel
+ Remarques
+
+
+
+ {foreach from=$mvts item="mvt"}
+
+ {$mvt.mvt_date|date_format:'%d/%m/%y'}
+ {$mvt.kind}
+ {$mvt.equipment_number}
+ {$mvt.equipment}
+ {$mvt.additional_comment}
+
+ {linkbutton shape="delete" label="Supprimer" href=$del_href|args:$mvt.id}
+
+
+ {/foreach}
+
+
+{/if}
+
diff --git a/src/www/admin/categories/_inc.php b/src/www/admin/categories/_inc.php
index c3651f2..e81d395 100644
--- a/src/www/admin/categories/_inc.php
+++ b/src/www/admin/categories/_inc.php
@@ -4,6 +4,8 @@
namespace Garradin;
+require_once __DIR__ . '/../_inc.php';
+
use Garradin\Plugin\Materiels\Category;
$cat = new Category;
diff --git a/src/www/admin/categories/index.php b/src/www/admin/categories/index.php
index e423fb9..b7868c0 100644
--- a/src/www/admin/categories/index.php
+++ b/src/www/admin/categories/index.php
@@ -2,7 +2,6 @@
namespace Garradin;
-require_once __DIR__ . '/../_inc.php';
require_once __DIR__ . '/_inc.php';
use Garradin\Utils;
diff --git a/src/www/admin/categories/materiels_par_categorie.php b/src/www/admin/categories/materiels_par_categorie.php
index 0ad0f7a..80b7f0e 100644
--- a/src/www/admin/categories/materiels_par_categorie.php
+++ b/src/www/admin/categories/materiels_par_categorie.php
@@ -2,7 +2,6 @@
namespace Garradin;
-require_once __DIR__ . '/../_inc.php';
require_once __DIR__ . '/_inc.php';
use Garradin\Plugin\Materiels\Equipment;
diff --git a/src/www/admin/categories/modifier_categorie.php b/src/www/admin/categories/modifier_categorie.php
index c93d9c1..75b2707 100644
--- a/src/www/admin/categories/modifier_categorie.php
+++ b/src/www/admin/categories/modifier_categorie.php
@@ -2,7 +2,6 @@
namespace Garradin;
-require_once __DIR__ . '/../_inc.php';
require_once __DIR__ . '/_inc.php';
use Garradin\Utils;
diff --git a/src/www/admin/categories/supprimer_categorie.php b/src/www/admin/categories/supprimer_categorie.php
index 598ed47..2df7923 100644
--- a/src/www/admin/categories/supprimer_categorie.php
+++ b/src/www/admin/categories/supprimer_categorie.php
@@ -2,7 +2,6 @@
namespace Garradin;
-require_once __DIR__ . '/../_inc.php';
require_once __DIR__ . '/_inc.php';
use Garradin\Utils;
diff --git a/src/www/admin/mouvements/_inc.php b/src/www/admin/mouvements/_inc.php
new file mode 100644
index 0000000..5b821c1
--- /dev/null
+++ b/src/www/admin/mouvements/_inc.php
@@ -0,0 +1,11 @@
+listAllOneSide(0);
-$entries = $entry->listAll();
-
-foreach ($entries as $key => $value) {
- $entry_eqmt = $eqmt->get($value->equipment_id);
- $entries[$key]->equipment = $entry_eqmt->designation;
-}
-
-$tpl->assign(compact('entries'));
+$tpl->assign(compact('mvts'));
$tpl->display(PLUGIN_ROOT . '/templates/mouvements/entrees/index.tpl');