import version 0.1 mw_pages.0.1
authordj3c1t <dj3c1t@free.fr>
Sat, 1 Dec 2012 11:36:01 +0000 (12:36 +0100)
committerdj3c1t <dj3c1t@free.fr>
Sat, 1 Dec 2012 11:36:01 +0000 (12:36 +0100)
18 files changed:
app/data/modules/sql/mw_data_pages.php [new file with mode: 0644]
app/data/modules/xml/mw_data_pages.php [new file with mode: 0644]
app/mods/pages/admin.php [new file with mode: 0644]
app/mods/pages/index.php [new file with mode: 0644]
app/mods/pages/view.php [new file with mode: 0644]
mw_pages.php [new file with mode: 0644]
out/dist/css/actions/pages_admin.css [new file with mode: 0644]
out/dist/css/actions/pages_view.css [new file with mode: 0644]
out/dist/functions.php [new file with mode: 0644]
out/dist/js/actions/pages_admin.js [new file with mode: 0644]
out/dist/layouts/pages.xml [new file with mode: 0644]
out/dist/page.php [new file with mode: 0644]
out/dist/views/pages/admin/add.php [new file with mode: 0644]
out/dist/views/pages/admin/edit.php [new file with mode: 0644]
out/dist/views/pages/admin/list.php [new file with mode: 0644]
out/dist/views/pages/colonne.php [new file with mode: 0644]
out/dist/views/pages/view/index.php [new file with mode: 0644]
out/dist/views/pages/view/page.php [new file with mode: 0644]

diff --git a/app/data/modules/sql/mw_data_pages.php b/app/data/modules/sql/mw_data_pages.php
new file mode 100644 (file)
index 0000000..3ef0b6c
--- /dev/null
@@ -0,0 +1,156 @@
+<?php
+
+  class mw_data_pages extends mw_data
+  {
+
+    function page_ariane($id, $ariane = array())
+    { if($page = $this->page($id))
+      { if($page["id_parent"]) $ariane = $this->page_ariane($page["id_parent"], $ariane);
+        $ariane[] = $page;
+        return $ariane;
+      }
+      return false;
+    }
+
+    function pages($params = array())
+    { $id_parent = isset($params["id_parent"]) ? $params["id_parent"] : null;
+      $enabled = isset($params["enabled"]) ? ($params["enabled"] ? "1" : "0") : null;
+      $user = isset($params["user"]) ? $params["user"] : null;
+      $order_by = isset($params["order_by"]) ? $params["order_by"] : null;
+      $order = isset($params["order"]) ? $params["order"] : "ASC";
+      $start = isset($params["start"]) ? $params["start"] : null;
+      $max = isset($params["max"]) ? $params["max"] : null;
+      $sgbd = $this->sgbd();
+      $pages = array("list" => array(), "total" => 0);
+      $SELECT = "SELECT * FROM #--pages";
+      $COUNT_SELECT = "SELECT count(*) as n FROM #--pages";
+      $WHERE = "";
+      $WHERE .= (isset($id_parent) ? ($WHERE ? " AND" : " WHERE")." id_parent".(strlen($id_parent) > 0 ? "=".$this->eq($id_parent) : " IS NULL") : "");
+      $WHERE .= (isset($enabled) ? ($WHERE ? " AND" : " WHERE")." enabled=".$this->eq($enabled) : "");
+      $WHERE .= (isset($user) ? ($WHERE ? " AND" : " WHERE")." user_creation=".$this->eq($user) : "");
+      $ORDER_BY =
+      ( isset($order_by) ?
+          " ORDER BY ".$order_by.(isset($order) ? " ".$order : "")
+        : ""
+      );
+      $LIMIT = isset($max) ? " LIMIT ".$max.(isset($start) ? " OFFSET ".$start : "") : "";
+      $sql = $COUNT_SELECT.$WHERE;
+      $rst = $sgbd->query($sql);
+      if(!isset($rst)) return false;
+      if($v_rst = $sgbd->fetch_assoc($rst)) $pages["total"] = $v_rst["n"];
+      $sgbd->free_result($rst);
+      if($pages["total"])
+      { $sql = $SELECT.$WHERE.$ORDER_BY.$LIMIT;
+        $rst = $sgbd->query($sql);
+        if(!isset($rst)) return false;
+        while($v_rst = $sgbd->fetch_assoc($rst)) $pages["list"][$v_rst["id"]] = $v_rst;
+        $sgbd->free_result($rst);
+      }
+      return $pages;
+    }
+
+    function pages_arbo($params = array())
+    { $id_parent = isset($params["id_parent"]) ? $params["id_parent"] : null;
+      $enabled = isset($params["enabled"]) ? ($params["enabled"] ? "1" : "0") : null;
+      $user = isset($params["user"]) ? $params["user"] : null;
+      $order_by = isset($params["order_by"]) ? $params["order_by"] : null;
+      $order = isset($params["order"]) ? $params["order"] : "ASC";
+      $sgbd = $this->sgbd();
+      $arbo = array();
+      if(isset($id_parent))
+      { if($parent = $this->page($id_parent)) $arbo = $parent;
+        else return false;
+      }
+      $arbo["subs"] = array();
+      $SELECT = "SELECT id FROM #--pages";
+      $WHERE = "";
+      $WHERE .= ($WHERE ? " AND" : " WHERE")." id_parent".(isset($id_parent) && $id_parent ? "=".$this->eq($id_parent) : " IS NULL");
+      $WHERE .= (isset($enabled) ? ($WHERE ? " AND" : " WHERE")." enabled=".$this->eq($enabled) : "");
+      $WHERE .= (isset($user) ? ($WHERE ? " AND" : " WHERE")." user_creation=".$this->eq($user) : "");
+      $ORDER_BY =
+      ( isset($order_by) ?
+          " ORDER BY ".$order_by.(isset($order) ? " ".$order : "")
+        : ""
+      );
+      $sql = $SELECT.$WHERE.$ORDER_BY;
+      $rst = $sgbd->query($sql);
+      if(!isset($rst)) return false;
+      while($v_rst = $sgbd->fetch_assoc($rst))
+      { $params["id_parent"] = $v_rst["id"];
+        $arbo["subs"][] = $this->pages_arbo($params);
+      }
+      $sgbd->free_result($rst);
+      return $arbo;
+    }
+
+    function page($id)
+    { $page = array();
+      $sgbd = $this->sgbd();
+      $sql = "SELECT * FROM #--pages WHERE id=".$this->eq($id);
+      $rst = $sgbd->query($sql);
+      if(!isset($rst)) return false;
+      if($v_rst = $sgbd->fetch_assoc($rst)) $page = $v_rst;
+      return $page;
+    }
+
+    function add_page($params)
+    { $id_parent = isset($params["id_parent"]) ? $params["id_parent"] : null;
+      $title = isset($params["title"]) ? $params["title"] : null;
+      $content = isset($params["content"]) ? $params["content"] : null;
+      $user = isset($params["user"]) ? $params["user"] : null;
+      $enabled = isset($params["enabled"]) ? ($params["enabled"] ? 1 : 0) : 1;
+      $position = isset($params["position"]) ? $params["position"] : 0;
+      $sgbd = $this->sgbd();
+      $sql =
+       "INSERT INTO #--pages"
+      ."(id_parent, title, content, date_creation, user_creation, date_last_update, user_last_update, enabled, position)"
+      ." VALUES"
+      ."( ".$this->eq($id_parent)
+      .", ".$this->eq($title)
+      .", ".$this->eq($content)
+      .", '".date("Y-m-d H:i:s")."'"
+      .", ".$this->eq($user)
+      .", '".date("Y-m-d H:i:s")."'"
+      .", ".$this->eq($user)
+      .", ".$this->eq($enabled)
+      .", ".$this->eq($position)
+      .")";
+      if($sgbd->query($sql)) return $sgbd->insert_id();
+      return false;
+    }
+
+    function set_page($id, $params, $RAZ = false)
+    { if($page = $this->page($id))
+      { $id_parent = isset($params["id_parent"]) ? $params["id_parent"] : ($RAZ ? null : $page["id_parent"]);
+        $title = isset($params["title"]) ? $params["title"] : ($RAZ ? null : $page["title"]);
+        $content = isset($params["content"]) ? $params["content"] : ($RAZ ? null : $page["content"]);
+        $user = isset($params["user"]) ? $params["user"] : null;
+        $enabled = isset($params["enabled"]) ? ($params["enabled"] ? 1 : 0) : ($RAZ ? 1 : $page["enabled"]);
+        $position = isset($params["position"]) ? $params["position"] : ($RAZ ? 0 : $page["position"]);
+        $sgbd = $this->sgbd();
+        $sql =
+         "UPDATE #--pages SET"
+        ."  id_parent=".$this->eq($id_parent)
+        .", title=".$this->eq($title)
+        .", content=".$this->eq($content)
+        .", date_last_update='".date("Y-m-d H:i:s")."'"
+        .", user_last_update=".$this->eq($user)
+        .", enabled=".$this->eq($enabled)
+        .", position=".$this->eq($position)
+        ." WHERE id=".$this->eq($id);
+        if($sgbd->query($sql)) return true;
+      }
+      return false;
+    }
+
+    function del_page($id)
+    { $sgbd = $this->sgbd();
+      if($sgbd->query("DELETE FROM #--pages WHERE id=".$this->eq($id)))
+      { return $sgbd->query("UPDATE #--pages SET id_parent=NULL WHERE id_parent=".$this->eq($id)) ? true : false;
+      }
+      return false;
+    }
+
+  }
+
+?>
\ No newline at end of file
diff --git a/app/data/modules/xml/mw_data_pages.php b/app/data/modules/xml/mw_data_pages.php
new file mode 100644 (file)
index 0000000..18a3613
--- /dev/null
@@ -0,0 +1,175 @@
+<?php
+
+  class mw_data_pages extends mw_data
+  {
+
+    function page_ariane($id, $ariane = array())
+    { if($page = $this->page($id))
+      { if($page["id_parent"]) $ariane = $this->page_ariane($page["id_parent"], $ariane);
+        $ariane[] = $page;
+        return $ariane;
+      }
+      return false;
+    }
+
+    function pages($params = array())
+    { $id_parent = isset($params["id_parent"]) ? $params["id_parent"] : null;
+      $enabled = isset($params["enabled"]) ? ($params["enabled"] ? "1" : "0") : null;
+      $user = isset($params["user"]) ? $params["user"] : null;
+      $order_by = isset($params["order_by"]) ? $params["order_by"] : null;
+      $order = isset($params["order"]) ? $params["order"] : "ASC";
+      $start = isset($params["start"]) ? $params["start"] : null;
+      $max = isset($params["max"]) ? $params["max"] : null;
+      $sgbd = $this->sgbd();
+      $pages = array("list" => array(), "total" => 0);
+      $res = array();
+      if($rst = $sgbd->open_data("pages"))
+      { while($v_rst = $sgbd->fetch_data($rst))
+        { if(isset($v_rst)) $res[$v_rst["id"]] = $v_rst;
+          else
+          { $res = false;
+            break;
+          }
+        }
+        $sgbd->close_data($rst);
+        if($res !== false)
+        { if(isset($order_by)) $res = $this->ordonne($res, "position", isset($order) ? $order : "ASC");
+          foreach($res as $id_res => $v_rst)
+          { $MATCH = true;
+            if(isset($id_parent))
+            { $MATCH =
+              (    ($id_parent && isset($v_rst["id_parent"]) && ($id_parent == $v_rst["id_parent"]))
+                || ($id_parent == "" && !$v_rst["id_parent"])
+              );
+            }
+            if($MATCH)
+            { if(isset($enabled))
+              { $MATCH = ($v_rst["enabled"] == $enabled);
+              }
+            }
+            if($MATCH)
+            { if(isset($user))
+              { $MATCH = ($v_rst["user_creation"] == $user);
+              }
+            }
+            if($MATCH)
+            { $pages["total"]++;
+              $MATCH = !isset($start) || !$max || ($pages["total"] > $start && $pages["total"] <= ($start + $max));
+            }
+            if($MATCH) $pages["list"][$v_rst["id"]] = $v_rst;
+          }
+        }
+      }
+      else return false;
+      return $pages;
+    }
+
+    function pages_arbo($params = array())
+    { $params["id_parent"] = isset($params["id_parent"]) ? $params["id_parent"] : "";
+      $params["enabled"] = isset($params["enabled"]) ? ($params["enabled"] ? "1" : "0") : null;
+      $params["user"] = isset($params["user"]) ? $params["user"] : null;
+      $params["order_by"] = isset($params["order_by"]) ? $params["order_by"] : null;
+      $params["order"] = isset($params["order"]) ? $params["order"] : "ASC";
+      $sgbd = $this->sgbd();
+      $arbo = array();
+      if($params["id_parent"])
+      { if($parent = $this->page($params["id_parent"])) $arbo = $parent;
+        else return false;
+      }
+      $arbo["subs"] = array();
+      if(($subs = $this->pages($params)) !== false)
+      { foreach($subs["list"] as $id_sub => $sub)
+        { $params["id_parent"] = $sub["id"];
+          $arbo["subs"][] = $this->pages_arbo($params);
+        }
+      }
+      return $arbo;
+    }
+
+    function page($id)
+    { $sgbd = $this->sgbd();
+      return ($page = $sgbd->get_data("pages", $id)) ? $page : false;
+    }
+
+    function add_page($params)
+    { $id_parent = isset($params["id_parent"]) ? $params["id_parent"] : null;
+      $title = isset($params["title"]) ? $params["title"] : null;
+      $content = isset($params["content"]) ? $params["content"] : null;
+      $user = isset($params["user"]) ? $params["user"] : null;
+      $enabled = isset($params["enabled"]) ? ($params["enabled"] ? 1 : 0) : 1;
+      $position = isset($params["position"]) ? $params["position"] : 0;
+      $sgbd = $this->sgbd();
+      return
+      ( ( $id_page = $sgbd->add_data
+          ( "pages",
+            array
+            ( "id_parent" => $id_parent,
+              "title" => $title,
+              "content" => $content,
+              "date_creation" => date("Y-m-d H:i:s"),
+              "user_creation" => $user,
+              "date_last_update" => date("Y-m-d H:i:s"),
+              "user_last_update" => $user,
+              "enabled" => $enabled,
+              "position" => $position
+            )
+          )
+        ) ? $id_page : false
+      );
+    }
+
+    function set_page($id, $params, $RAZ = false)
+    { if($page = $this->page($id))
+      { $id_parent = isset($params["id_parent"]) ? $params["id_parent"] : ($RAZ ? null : $page["id_parent"]);
+        $title = isset($params["title"]) ? $params["title"] : ($RAZ ? null : $page["title"]);
+        $content = isset($params["content"]) ? $params["content"] : ($RAZ ? null : $page["content"]);
+        $user = isset($params["user"]) ? $params["user"] : null;
+        $enabled = isset($params["enabled"]) ? ($params["enabled"] ? 1 : 0) : ($RAZ ? 1 : $page["enabled"]);
+        $position = isset($params["position"]) ? $params["position"] : ($RAZ ? 0 : $page["position"]);
+        $sgbd = $this->sgbd();
+        return $sgbd->set_data
+        ( "pages",
+          $id,
+          array
+          ( "id_parent" => $id_parent,
+            "title" => $title,
+            "content" => $content,
+            "date_creation" => $page["date_creation"],
+            "user_creation" => $page["user_creation"],
+            "date_last_update" => date("Y-m-d H:i:s"),
+            "user_last_update" => $user,
+            "enabled" => $enabled,
+            "position" => $position
+          )
+        );
+      }
+      return false;
+    }
+
+    function del_page($id)
+    { $sgbd = $this->sgbd();
+      if($sgbd->del_data("pages", $id))
+      { $OK = true;
+        if($rst = $sgbd->open_data("pages"))
+        { while($v_rst = $sgbd->fetch_data($rst))
+          { if(isset($v_rst))
+            { if(isset($v_rst["id_parent"]) && isset($v_rst["id"]) && $v_rst["id_parent"] == $id)
+              { unset($v_rst["id_parent"]);
+                if(!$sgbd->set_data("pages", $v_rst["id"], $v_rst))
+                { $OK = false;
+                  break;
+                }
+              }
+            }
+            else $OK = false;
+          }
+          $sgbd->close_data($rst);
+        }
+        return $OK;
+      }
+      return false;
+    }
+
+  }
+
+?>
\ No newline at end of file
diff --git a/app/mods/pages/admin.php b/app/mods/pages/admin.php
new file mode 100644 (file)
index 0000000..48e4f89
--- /dev/null
@@ -0,0 +1,178 @@
+<?php
+
+  class mw_pages_admin extends mw_mod
+  {
+
+    function index(&$env)
+    { $data = $env->data();
+      if(($arbo = $data->pages_arbo()) !== false)
+      { $env->set_out("arbo", $arbo);
+        $id_parent = isset($_GET[$env->param("parent")]) ? $_GET[$env->param("parent")] : null;
+        if
+        ( ( $pages = $data->pages
+            ( array
+              ( "id_parent" => $id_parent,
+                "order_by"  => "position",
+                "order"     => "ASC",
+                "start"     => isset($_GET[$env->param("start")]) && $_GET[$env->param("start")] ? $_GET[$env->param("start")] : 0,
+                "max"       => $env->config("max_list")
+              )
+            )
+          ) !== false
+        )
+        { $env->set_out("pages", $pages);
+          $ariane = array();
+          if($id_parent)
+          { if(($ariane = $data->page_ariane($id_parent)) === false)
+            { $env->erreur("impossible de lire le fil d'ariane");
+            }
+          }
+          $env->set_out("ariane", $ariane);
+        }
+        else $env->erreur("impossible de lire la liste des pages");
+      }
+      else $env->erreur("impossible de lire l'arborescence des pages");
+    }
+
+    function validate_POST_page(&$env, $page = null)
+    { $page = isset($page) ? $page : array();
+      $_page = array();
+      if(($user = $env->user()) && $user["id"])
+      { if($_POST)
+        { $_page["id_parent"] = isset($_POST["id_parent"]) ? ($_POST["id_parent"] ? $_POST["id_parent"] : null) : ($page["id_parent"] ? $page["id_parent"] : null);
+          $_page["title"] = isset($_POST["title"]) ? $_POST["title"] : ($page["title"] ? $page["title"] : null);
+          $_page["content"] = isset($_POST["content"]) ? $_POST["content"] : ($page["content"] ? $page["content"] : null);
+          $_page["user"] = $user["id"];
+          $_page["enabled"] = isset($_POST["enabled"]) ? $_POST["enabled"] : ($page["enabled"] ? $page["enabled"] : 1);
+          $_page["position"] = isset($_POST["position"]) ? $_POST["position"] : ($page["position"] ? $page["position"] : 0);
+        }
+      }
+      else $env->message("impossible de lire les informations de l'utilisateur");
+      return $_page;
+    }
+
+    function add(&$env)
+    { $data = $env->data();
+      if(($arbo = $data->pages_arbo()) !== false)
+      { $env->set_out("arbo", $arbo);
+        $page = array();
+        if($_POST)
+        { $page = $this->validate_POST_page($env);
+          if(!$env->messages())
+          { if(($id_page = $data->add_page($page)) !== false)
+            { $env->redirect
+              ( $env->url("pages/admin"),
+                "la page a &eacute;t&eacute; ajout&eacute;e"
+              );
+            }
+            else $env->erreur("impossible d'ajouter la page");
+          }
+        }
+        $env->set_out("page", $page);
+      }
+      else $env->erreur("impossible de lire l'arborescence des pages");
+    }
+
+    function edit(&$env)
+    { $data = $env->data();
+      if($page = $data->page($_GET[$env->param("id")]))
+      { if(($arbo = $data->pages_arbo()) !== false)
+        { $env->set_out("arbo", $arbo);
+          if($_POST)
+          { $page = $this->validate_POST_page($env, $page);
+            if(!$env->messages())
+            { if($data->set_page($_GET[$env->param("id")], $page))
+              { $env->redirect
+                ( $env->url("pages/admin"),
+                  "la page a &eacute;t&eacute; modifi&eacute;e"
+                );
+              }
+              else $env->erreur("impossible de modifier la page");
+            }
+          }
+          $env->set_out("page", $page);
+        }
+        else $env->erreur("impossible de lire l'arborescence des pages");
+      }
+      else $env->erreur("impossible de lire les informations de la page");
+    }
+
+    function edit_pages(&$env)
+    { if(($user = $env->user()) && $user["id"])
+      { if($_POST)
+        { $data = $env->data();
+          $OK = true;
+          foreach($_POST as $key => $value)
+          { $OK = true;
+            if(substr($key, 0, 9) == "position_")
+            { $id_page = substr($key, 9);
+              $enabled = isset($_POST["enabled_".$id_page]) && $_POST["enabled_".$id_page] ? 1 : 0;
+              if(!$data->set_page($id_page, array("position" => $value, "enabled" => $enabled)))
+              { $env->erreur("impossible d'enregistrer la position");
+                $OK = false;
+                $break;
+              }
+            }
+          }
+          if($OK)
+          { $env->redirect
+            ( $env->url("pages/admin"),
+              "Les informations des pages ont &eacute;t&eacute; enregistr&eacute;es"
+            );
+          }
+        }
+        else $env->erreur("donnees manquantes");
+      }
+      else $env->erreur("impossible de lire les informations de l'utilisateur");
+    }
+
+    function set_accueil(&$env)
+    { if(($user = $env->user()) && $user["id"])
+      { $data = $env->data();
+        $start_action = "";
+        $start_action_params = "";
+        $id_page = $_POST["id"] ? $_POST["id"] : "";
+        if($id_page)
+        { if($page = $data->page($id_page))
+          { $start_action = "pages/view/page";
+            $start_action_params = @serialize(array("id" => $id_page));
+          }
+          else
+          { $start_action = false;
+            $env->erreur("impossible de lire les informations de la page");
+          }
+        }
+        if($start_action !== false && $start_action_params !== false)
+        { if
+          (    $data->set_config("start_action", $start_action)
+            && $data->set_config("start_action_params", $start_action_params)
+          )
+          { $data->set_config("plugins_pages_start_id", $id_page);
+            $env->redirect
+            ( $env->url("pages/admin"),
+              "La page d'accueil a &eacute;t&eacute; enregistr&eacute;e"
+            );
+          }
+          else $env->erreur("impossible d'enregistrer la page d'accueil dans la configuration");
+        }
+      }
+      else $env->erreur("impossible de lire les informations de l'utilisateur");
+    }
+
+    function del(&$env)
+    { $data = $env->data();
+      if($page = $data->page($_GET[$env->param("id")]))
+      { if($data->del_page($page["id"]))
+        { $env->redirect
+          ( $env->url("pages/admin"),
+            "la page a &eacute;t&eacute; supprim&eacute;e"
+          );
+        }
+        else $env->erreur("Impossible de supprimer la page");
+      }
+      else $env->erreur("impossible de lire les informations de la page");
+    }
+
+  }
+
+?>
\ No newline at end of file
diff --git a/app/mods/pages/index.php b/app/mods/pages/index.php
new file mode 100644 (file)
index 0000000..696b5c2
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+
+  class mw_pages_index extends mw_mod
+  {
+
+    function index(&$env)
+    { $env->run("pages/view");
+    }
+
+  }
+
+?>
\ No newline at end of file
diff --git a/app/mods/pages/view.php b/app/mods/pages/view.php
new file mode 100644 (file)
index 0000000..da382f0
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+
+  class mw_pages_view extends mw_mod
+  {
+
+    function index(&$env)
+    {
+    }
+
+    function page(&$env)
+    { $data = $env->data();
+      if(($arbo = $data->pages_arbo(array("enabled" => 1))) !== false)
+      { $env->set_out("arbo", $arbo);
+        if(($page = $data->page($_GET[$env->param("id")])) && $page["enabled"])
+        { $env->set_out("page", $page);
+          if
+          ( ( $pages = $data->pages
+              ( array
+                ( "id_parent" => $page["id"],
+                  "enabled"   => 1,
+                  "order_by"  => "position",
+                  "order"     => "ASC"
+                )
+              )
+            ) !== false
+          )
+          { $env->set_out("pages", $pages);
+            if(($ariane = $data->page_ariane($page["id"])) !== false)
+            { $env->set_out("ariane", $ariane);
+            }
+            else $env->erreur("impossible de lire le fil d'ariane");
+          }
+          else $env->erreur("impossible de lire la liste des pages");
+        }
+        else $env->erreur("impossible de lire la page");
+      }
+      else $env->erreur("impossible de lire l'arborescence des pages");
+    }
+
+  }
+
+?>
\ No newline at end of file
diff --git a/mw_pages.php b/mw_pages.php
new file mode 100644 (file)
index 0000000..056efbc
--- /dev/null
@@ -0,0 +1,252 @@
+<?php
+
+  class mw_pages extends mw_plugin
+  {
+
+    function title($env)
+    { return "Pages";
+    }
+
+    function description($env)
+    { return "Pour ajouter des pages, avec un &eacute;diteur dans l'administration du site";
+    }
+
+    function init($env)
+    { $env->set_link("plugins/admin/mw_pages", $env->url("pages/admin"), "&eacute;diter les pages");
+      $data = $env->data();
+      if
+      ( ( $pages = $data->pages
+          ( array
+            ( "id_parent" => "",
+              "enabled"   => 1,
+              "order_by"  => "position",
+              "order"     => "ASC"
+            )
+          )
+        ) !== false
+      )
+      { foreach($pages["list"] as $id_page => $page)
+        { $env->set_link
+          ( "menu_top/mw_page_".$id_page,
+            $env->url("pages/view/page", array("id" => $id_page)),
+            $page["title"],
+            $page["position"]
+          );
+        }
+      }
+      return true;
+    }
+
+    function enable($env)
+    { $plugins_pages_start_id = $env->config("plugins_pages_start_id");
+      if($plugins_pages_start_id)
+      { $data = $env->data();
+        if
+        (    $data->set_config("start_action", "pages/view/page")
+          && $data->set_config("start_action_params", @serialize(array("id" => $plugins_pages_start_id)))
+        )
+        { return true;
+        }
+        return false;
+      }
+      return true;
+    }
+
+    function disable($env)
+    { $start_action = $env->config("start_action");
+      if($start_action == "pages/view/page")
+      { $data = $env->data();
+        if
+        (    $data->set_config("start_action", "")
+          && $data->set_config("start_action_params", "")
+        )
+        { return true;
+        }
+        return false;
+      }
+      return true;
+    }
+
+    // ---------------------------------------------------------------------------------
+    //                                                                           install
+    //
+
+    function install($env)
+    { if($env->bdd("sgbd") == "xml") return $this->install_xml($env);
+      if($env->bdd("sgbd") == "sqlite") return $this->install_sqlite($env);
+      if($env->bdd("sgbd") == "mysql") return $this->install_mysql($env);
+    }
+
+    function install_xml($env)
+    { $data = $env->data();
+      $sgbd = $data->sgbd();
+      $EXISTS = $sgbd->data_exists("pages");
+      if(!isset($EXISTS))
+      { return "impossible de savoir si la table #--pages existe";
+      }
+      if($EXISTS)
+      { return "la table #--pages existe deja";
+      }
+      if(!$sgbd->create_data("pages"))
+      { return "imposible de creer la table #--pages";
+      }
+      if(!$sgbd->add_data("action_status", array("action" => "pages/admin", "id_status" => "1")))
+      { $sgbd->remove_data("pages");
+        return "impossible d'ajouter un statut pour l'action pages/admin";
+      }
+      return true;
+    }
+
+    function install_sqlite($env)
+    { $data = $env->data();
+      $sgbd = $data->sgbd();
+      $EXISTS = $sgbd->table_exists("#--pages");
+      if(!isset($EXISTS))
+      { return "impossible de savoir si la table #--pages existe";
+      }
+      if($EXISTS)
+      { return "la table #--pages existe deja";
+      }
+      $sql =
+       "CREATE TABLE #--pages"
+      ."( id INTEGER NOT NULL PRIMARY KEY"
+      .", id_parent INTEGER NULL"
+      .", title VARCHAR NULL"
+      .", content TEXT NULL"
+      .", date_creation TEXT NOT NULL"
+      .", user_creation INTEGER NOT NULL"
+      .", date_last_update TEXT NOT NULL"
+      .", user_last_update INTEGER NOT NULL"
+      .", enabled INTEGER NOT NULL DEFAULT 1"
+      .", position INTEGER NOT NULL DEFAULT 0"
+      .")";
+      if(!$sgbd->query($sql))
+      { return "imposible de creer la table #--pages";
+      }
+      if(!$sgbd->query("INSERT INTO #--action_status(action, id_status) VALUES('pages/admin', 1)"))
+      { $sgbd->query("DROP TABLE \"main\".\"#--pages\"");
+        return "impossible d'ajouter un statut pour l'action pages/admin";
+      }
+      return true;
+    }
+
+    function install_mysql($env)
+    { $data = $env->data();
+      $sgbd = $data->sgbd();
+      $EXISTS = $sgbd->table_exists("#--pages");
+      if(!isset($EXISTS))
+      { return "impossible de savoir si la table #--pages existe";
+      }
+      if($EXISTS)
+      { return "la table #--pages existe deja";
+      }
+      $sql =
+       "CREATE TABLE #--pages"
+      ."( id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY"
+      .", id_parent INT(11) NULL"
+      .", title VARCHAR(255) NULL"
+      .", content TEXT NULL"
+      .", date_creation DATETIME NOT NULL"
+      .", user_creation INT(11) NOT NULL"
+      .", date_last_update DATETIME NOT NULL"
+      .", user_last_update INT(11) NOT NULL"
+      .", enabled TINYINT NOT NULL DEFAULT '1'"
+      .", position INT(11) NOT NULL DEFAULT '0'"
+      .") DEFAULT CHARSET=utf8";
+      if(!$sgbd->query($sql))
+      { return "imposible de creer la table #--pages";
+      }
+      if(!$sgbd->query("INSERT INTO #--action_status(action, id_status) VALUES('pages/admin', 1)"))
+      { $sgbd->query("DROP TABLE #--pages");
+        return "impossible d'ajouter un statut pour l'action pages/admin";
+      }
+      return true;
+    }
+
+    // ---------------------------------------------------------------------------------
+    //                                                                         uninstall
+    //
+
+    function uninstall($env)
+    { if($env->bdd("sgbd") == "xml") return $this->uninstall_xml($env);
+      if($env->bdd("sgbd") == "sqlite") return $this->uninstall_sqlite($env);
+      if($env->bdd("sgbd") == "mysql") return $this->uninstall_mysql($env);
+    }
+
+    function uninstall_xml($env)
+    { $data = $env->data();
+      $sgbd = $data->sgbd();
+      if(!$this->disable($env)) return "impossible de desactiver le plugin";
+      $data->del_config("plugins_pages_start_id");
+      $EXISTS = $sgbd->data_exists("pages");
+      if(!isset($EXISTS))
+      { return "impossible de savoir si la table #--pages existe";
+      }
+      if(!$EXISTS)
+      { // return "la table #--pages n'existe pas";
+      }
+      elseif(!$sgbd->remove_data("pages"))
+      { return "imposible de supprimer la table #--pages";
+      }
+      $ids = array();
+      if($rst = $sgbd->open_data("action_status"))
+      { while($v_rst = $sgbd->fetch_data($rst))
+        { if(isset($v_rst))
+          { if(isset($v_rst["action"]) && isset($v_rst["id"]) && $v_rst["action"] == "pages/admin")
+            { $ids[] = $v_rst["id"];
+            }
+          }
+          else $ids = false;
+        }
+        $sgbd->close_data($rst);
+      }
+      if($ids !== false)
+      { foreach($ids as $id)
+        { $sgbd->del_data("action_status", $id);
+        }
+      }
+      return true;
+    }
+
+    function uninstall_sqlite($env)
+    { $data = $env->data();
+      $sgbd = $data->sgbd();
+      if(!$this->disable($env)) return "impossible de desactiver le plugin";
+      $data->del_config("plugins_pages_start_id");
+      $EXISTS = $sgbd->table_exists("#--pages");
+      if(!isset($EXISTS))
+      { return "impossible de savoir si la table #--pages existe";
+      }
+      if(!$EXISTS)
+      { // return "la table #--pages n'existe pas";
+      }
+      elseif(!$sgbd->query("DROP TABLE \"main\".\"#--pages\""))
+      { return "imposible de supprimer la table #--pages";
+      }
+      $sgbd->query("DELETE FROM #--action_status WHERE action='pages/admin'");
+      return true;
+    }
+
+    function uninstall_mysql($env)
+    { $data = $env->data();
+      $sgbd = $data->sgbd();
+      if(!$this->disable($env)) return "impossible de desactiver le plugin";
+      $data->del_config("plugins_pages_start_id");
+      $EXISTS = $sgbd->table_exists("#--pages");
+      if(!isset($EXISTS))
+      { return "impossible de savoir si la table #--pages existe";
+      }
+      if(!$EXISTS)
+      { // return "la table #--pages n'existe pas";
+      }
+      elseif(!$sgbd->query("DROP TABLE #--pages"))
+      { return "imposible de supprimer la table #--pages";
+      }
+      $sgbd->query("DELETE FROM #--action_status WHERE action='pages/admin'");
+      return true;
+    }
+
+  }
+
+
+?>
\ No newline at end of file
diff --git a/out/dist/css/actions/pages_admin.css b/out/dist/css/actions/pages_admin.css
new file mode 100644 (file)
index 0000000..cb9a939
--- /dev/null
@@ -0,0 +1 @@
+@import url("../../../../../../out/dist/css/actions/admin.css");
diff --git a/out/dist/css/actions/pages_view.css b/out/dist/css/actions/pages_view.css
new file mode 100644 (file)
index 0000000..a358089
--- /dev/null
@@ -0,0 +1,29 @@
+ul.pages_menu
+{ list-style-type: none;
+  margin: 5px 20px 5px 10px;
+  padding: 0;
+}
+
+ul.pages_menu ul
+{ list-style-type: none;
+  margin: 0 0 0 20px;
+  padding: 0;
+}
+
+ul.pages_menu li
+{ margin: 1px 0;
+  padding: 0;
+  border-bottom: solid 1px #e5e5e5;
+}
+
+ul.pages_menu li a
+{ display: block;
+  line-height: 2em;
+  padding: 0 1em;
+  background-color: #f5f5f5;
+}
+
+ul.pages_menu li a:hover
+{ color: #000066;
+  background-color: #f1f1f1;
+}
\ No newline at end of file
diff --git a/out/dist/functions.php b/out/dist/functions.php
new file mode 100644 (file)
index 0000000..eae629a
--- /dev/null
@@ -0,0 +1,112 @@
+<?php
+
+  if(!function_exists("datetime2timestamp")) :
+  function datetime2timestamp($string)
+  { list($date, $time) = explode(" ", $string);
+    list($year, $month, $day) = explode("-", $date);
+    list($hour, $minute, $second) = explode(":", $time);
+    $timestamp = mktime($hour, $minute, $second, $month, $day, $year);
+    return $timestamp;
+  }
+  endif;
+
+  if(!function_exists("pages_arbo_navig_lis")) :
+  function pages_arbo_navig_lis($env, $arbo, $ariane = array())
+  { $content = "";
+    if($arbo["subs"])
+    { if($path_item = array_shift($ariane))
+      { foreach($arbo["subs"] as $page)
+        { $content .= "<li".($path_item["id"] == $page["id"] ? " class=\"current\"" : "")."><a href=\"".$env->url("pages/view/page", array("id" => $page["id"]))."\">".$page["title"]."</a></li>\n";
+          if($path_item["id"] == $page["id"])
+          { if($sub_content = pages_arbo_navig_lis($env, $page, $ariane))
+            { $content .=
+               "<ul>\n"
+              .$sub_content
+              ."</ul>\n";
+            }
+          }
+        }
+      }
+      else
+      { foreach($arbo["subs"] as $page)
+        { $content .= "<li><a href=\"".$env->url("pages/view/page", array("id" => $page["id"]))."\">".$page["title"]."</a></li>\n";
+        }
+      }
+    }
+    return $content;
+  }
+  endif;
+
+  if(!function_exists("pages_arbo_edit_select_options")) :
+  function pages_arbo_edit_select_options($arbo, $id_page, $id_parent, $indent_increment = "", $indent = "")
+  { $arbo["id"] = $arbo["id"] ? $arbo["id"] : "";
+    $content =
+     "<option"
+    ." value=\"".$arbo["id"]."\""
+    .(isset($id_parent) && ($arbo["id"] == $id_parent) ? " selected=\"selected\"" : "")
+    .">"
+    .$indent.($arbo["id"] ? $arbo["title"] : "Aucune")
+    ."</option>";
+    if($arbo["subs"])
+    { $indent .= $indent_increment;
+      foreach($arbo["subs"] as $i => $sub)
+      { if(!isset($id_page) || $id_page != $sub["id"])
+        { $content .= pages_arbo_edit_select_options($sub, $id_page, $id_parent, $indent_increment, $indent);
+        }
+      }
+    }
+    return $content;
+  }
+  endif;
+
+  if(!function_exists("pages_arbo_list_select_options")) :
+  function pages_arbo_list_select_options($env, $etat, $arbo, $current_page_id, $indent_increment = "", $indent = "")
+  { $arbo["id"] = isset($arbo["id"]) ? $arbo["id"] : "";
+    $content =
+     "<option"
+    ." value=\"".$env->url($etat, array("parent" => $arbo["id"]))."\""
+    .(isset($current_page_id) && ($arbo["id"] == $current_page_id) ? " selected=\"selected\"" : "")
+    .">"
+    .$indent.($arbo["id"] ? $arbo["title"] : "Racine des pages")
+    ."</option>";
+    if($arbo["subs"])
+    { $indent .= $indent_increment;
+      foreach($arbo["subs"] as $i => $sub)
+      { $content .= pages_arbo_list_select_options($env, $etat, $sub, $current_page_id, $indent_increment, $indent);
+      }
+    }
+    return $content;
+  }
+  endif;
+
+  if(!function_exists("pages_arbo_start_select_options")) :
+  function pages_arbo_start_select_options($env, $arbo, $current_start_action, $current_start_action_params, $indent_increment = "", $indent = "")
+  { $arbo["id"] = isset($arbo["id"]) ? $arbo["id"] : "";
+    if($arbo["id"])
+    { $content =
+       "<option"
+      ." value=\"".$arbo["id"]."\""
+      .(    isset($current_start_action)
+         && ($current_start_action == "pages/view/page")
+         && isset($current_start_action_params["id"])
+         && ($arbo["id"] == $current_start_action_params["id"])
+         ?
+           " selected=\"selected\""
+         : ""
+       )
+      .">"
+      .$indent.$arbo["title"]
+      ."</option>";
+    }
+    if($arbo["subs"])
+    { $indent .= $indent_increment;
+      $indent .= "&nbsp;&nbsp;";
+      foreach($arbo["subs"] as $i => $sub)
+      { $content .= pages_arbo_start_select_options($env, $sub, $current_start_action, $current_start_action_params, $indent_increment, $indent);
+      }
+    }
+    return $content;
+  }
+  endif;
+
+?>
\ No newline at end of file
diff --git a/out/dist/js/actions/pages_admin.js b/out/dist/js/actions/pages_admin.js
new file mode 100644 (file)
index 0000000..a329012
--- /dev/null
@@ -0,0 +1,13 @@
+$(document).ready
+( function()
+  { init_tinymce();
+  }
+);
+
+function init_tinymce()
+{ $(".tinymce").each
+  ( function()
+    { tinyMCE.execCommand("mceAddControl", true, $(this).attr("id"));
+    }
+  );
+}
diff --git a/out/dist/layouts/pages.xml b/out/dist/layouts/pages.xml
new file mode 100644 (file)
index 0000000..cf7ec4b
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<layout>
+
+  <pages page="page.php">
+    <view>
+      <index content="views/pages/view/index.php" />
+      <page content="views/pages/view/page.php" />
+    </view>
+    <admin page="admin.php">
+      <index content="views/pages/admin/list.php" />
+      <add content="views/pages/admin/add.php" />
+      <edit content="views/pages/admin/edit.php" />
+    </admin>
+  </pages>
+
+</layout>
\ No newline at end of file
diff --git a/out/dist/page.php b/out/dist/page.php
new file mode 100644 (file)
index 0000000..cfb4e37
--- /dev/null
@@ -0,0 +1,60 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
+  <head>
+    <?php require $this->out_file("views/head.php"); ?>
+  </head>
+  <body>
+
+    <div id="header">
+      <div class="content">
+<?php require $this->out_file("views/header.php"); ?>
+     </div>
+    </div>
+
+    <div id="menu_top">
+      <div class="content">
+<?php if($this->out_config("navig_menu_top")) require $this->out_file("views/top_menu.php"); ?>
+      </div>
+    </div>
+
+    <div class="clear"><!-- --></div>
+
+    <div id="main">
+      <div class="content">
+
+<?php if($this->out_config("colonne")) : ?>
+        <div id="colonne">
+<?php require $this->out_file("views/pages/colonne.php"); ?>
+        </div>
+<?php endif; ?>
+
+        <div id="center"<?= $this->out_config("colonne") ? "" : " class=\"no_colonne\"" ?>>
+<?php require $this->out_file("views/messages.php"); ?>
+<?php
+
+  if($this->out_file_exists($layout["content"])) :
+
+?>
+
+<?php
+
+  require $this->out_file($layout["content"]);
+  endif;
+
+?>
+
+        </div>
+
+        <div class="clear"><!-- --></div>
+
+      </div>
+    </div>
+
+    <div id="footer">
+      <div class="content">
+<?php require $this->out_file("views/footer.php"); ?>
+     </div>
+    </div>
+
+  </body>
+</html>
\ No newline at end of file
diff --git a/out/dist/views/pages/admin/add.php b/out/dist/views/pages/admin/add.php
new file mode 100644 (file)
index 0000000..1568493
--- /dev/null
@@ -0,0 +1,32 @@
+<?php require $this->out_file("views/tinymce.init.js.php"); ?>
+
+<h2>Nouvelle page</h2>
+
+<ul class="admin">
+  <li><a href="<?= $this->url("pages/admin") ?>">Retour &agrave; la liste des pages</a></li>
+</ul>
+
+<form name="page_form" action="<?= $this->url("pages/admin/add") ?>" method="post">
+  <ul class="form">
+    <li>
+      <p>
+        Titre :
+        <input type="text" size="50" name="title" id="title" value="<?= $this->out["page"]["title"] ?>" />
+      </p>
+    </li>
+    <li>
+      <p>
+        Page parente :
+        <select name="id_parent">
+          <?php echo pages_arbo_edit_select_options($this->out["arbo"], null, $this->out["page"]["id_parent"], "&nbsp;&nbsp;"); ?>
+        </select>
+      </p>
+    </li>
+    <li>
+      <textarea class="tinymce" cols="60" rows="10" name="content" id="content"><?= $this->out["page"]["content"] ?></textarea>
+    </li>
+    <li class="buttons">
+      <input type="submit" value="Ajouter" />
+    </li>
+  </ul>
+</form>
\ No newline at end of file
diff --git a/out/dist/views/pages/admin/edit.php b/out/dist/views/pages/admin/edit.php
new file mode 100644 (file)
index 0000000..4eb8676
--- /dev/null
@@ -0,0 +1,32 @@
+<?php require $this->out_file("views/tinymce.init.js.php"); ?>
+
+<h2>Modifier une page</h2>
+
+<ul class="admin">
+  <li><a href="<?= $this->url("pages/admin") ?>">Retour &agrave; la liste des pages</a></li>
+</ul>
+
+<form name="page_form" action="<?= $this->url("pages/admin/edit", array("id" => $this->out["page"]["id"])) ?>" method="post">
+  <ul class="form">
+    <li>
+      <p>
+        Titre :
+        <input type="text" size="50" name="title" id="title" value="<?= $this->out["page"]["title"] ?>" />
+      </p>
+    </li>
+    <li>
+      <p>
+        Page parente :
+        <select name="id_parent">
+          <?php echo pages_arbo_edit_select_options($this->out["arbo"], $this->out["page"]["id"], $this->out["page"]["id_parent"], "&nbsp;&nbsp;"); ?>
+        </select>
+      </p>
+    </li>
+    <li>
+      <textarea class="tinymce" cols="60" rows="10" name="content" id="content"><?= $this->out["page"]["content"] ?></textarea>
+    </li>
+    <li class="buttons">
+      <input type="submit" value="Enregistrer" />
+    </li>
+  </ul>
+</form>
\ No newline at end of file
diff --git a/out/dist/views/pages/admin/list.php b/out/dist/views/pages/admin/list.php
new file mode 100644 (file)
index 0000000..a48ef7f
--- /dev/null
@@ -0,0 +1,78 @@
+<h2>Pages</h2>
+
+<ul class="admin">
+  <li><a class="add" href="<?= $this->url("pages/admin/add") ?>">Nouvelle page</a></li>
+</ul>
+
+<form name="accueil_form" action="<?= $this->url("pages/admin/set_accueil") ?>" method="post">
+<ul class="admin">
+  <li>Page d'accueil du site</li>
+  <li>
+    <select name="id">
+      <option value=""<?= $this->config("start_action") ? "" : " selected=\"selected\"" ?>>Page par d&eacute;faut du site</option>
+      <?php echo pages_arbo_start_select_options($this, $this->out["arbo"], $this->config("start_action"), $this->config("start_action_params"), "&nbsp;&nbsp;"); ?>
+    </select>
+  </li>
+  <li class="buttons">
+    <input type="submit" value="Enregistrer" />
+  </li>
+</ul>
+</form>
+
+<ul class="admin">
+  <li>Page parente</li>
+  <li>
+    <select onchange="document.location=this.options[this.selectedIndex].value;">
+      <option value="<?= $this->url("pages/admin") ?>"<?= isset($_GET[$this->param("parent")]) ? "" : " selected=\"selected\"" ?>>Afficher toutes les pages</option>
+      <?php echo pages_arbo_list_select_options($this, "pages/admin", $this->out["arbo"], $_GET[$this->param("parent")], "&nbsp;&nbsp;"); ?>
+    </select>
+  </li>
+</ul>
+
+<?php if($this->out["pages"]["total"]) : ?>
+
+<?php if($this->out["pages"]["total"] > $this->config("max_list")) : ?>
+
+<?php $items = "pages"; $legend = "pages"; require $this->out_file("views/navig.php"); ?>
+
+<?php endif; ?>
+
+<form name="pages_form" action="<?= $this->url("pages/admin/edit_pages") ?>" method="post">
+<table class="admin">
+  <tr>
+    <th>titre</th>
+    <th>date cr&eacute;ation</th>
+    <th align="center">position</th>
+    <th align="center">active</th>
+    <th align="center" colspan="2">actions</th>
+  </tr>
+<?php foreach($this->out["pages"]["list"] as $id_page => $page) : ?>
+  <tr class="hl">
+    <td><?= $page["title"] ?></td>
+    <td><?= date("j M Y : G\hi", datetime2timestamp($page["date_creation"])) ?></td>
+    <td class="action"><input type="text" size="3" name="position_<?= $id_page ?>" value="<?= $page["position"] ?>" /></td>
+    <td class="action"><input type="checkbox" name="enabled_<?= $id_page ?>" <?= $page["enabled"] ? "checked=\"checked\"" : "" ?> /></td>
+    <td class="action">
+    <a href="<?= $this->url("pages/admin/edit", array("id" => $id_page)) ?>"
+       class="admin_link"
+       title="modifier cette page"><img src="<?= $this->out_file("icons/edit.gif") ?>" /></a>
+    </td>
+    <td class="action">
+    <a href="<?= $this->url("pages/admin/del", array("id" => $id_page)) ?>"
+       class="admin_link"
+       title="supprimer cette page"><img src="<?= $this->out_file("icons/del.gif") ?>"
+       onclick="return confirm('Supprimer cette page ?')"/></a>
+    </td>
+  </tr>
+<?php endforeach; ?>
+  <tr class="hl">
+    <td colspan="2">&nbsp;</td>
+    <td colspan="2" align="center"><input type="submit" value="Enregistrer" /></td>
+    <td colspan="2">&nbsp;</td>
+  </tr>
+</table>
+</form>
+
+<?php else : ?>
+<p>Aucune page pour le moment.</p>
+<?php endif; ?>
diff --git a/out/dist/views/pages/colonne.php b/out/dist/views/pages/colonne.php
new file mode 100644 (file)
index 0000000..4145c3e
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+
+  if($this->out["arbo"]) :
+  $current_page_id = isset($_GET[$this->param("id")]) ? $_GET[$this->param("id")] : null;
+
+?>
+<ul class="pages_menu">
+<?php echo pages_arbo_navig_lis($this, $this->out["arbo"], $this->out["ariane"]); ?>
+</ul>
+<?php endif; ?>
diff --git a/out/dist/views/pages/view/index.php b/out/dist/views/pages/view/index.php
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/out/dist/views/pages/view/page.php b/out/dist/views/pages/view/page.php
new file mode 100644 (file)
index 0000000..f0d299f
--- /dev/null
@@ -0,0 +1,23 @@
+<h2>
+<?php $k = 0; foreach($this->out["ariane"] as $page) : if($k < count($this->out["ariane"]) - 1) : ?>
+  <?php if($k > 0) : ?>
+  &raquo;
+  <?php endif; ?>
+  <a href="<?= $this->url("pages/view/page", array("id" => $page["id"])) ?>"><?= $page["title"] ?></a>
+<?php $k++; endif; endforeach; ?>
+  <?php if($k > 0) : ?>
+  &raquo;
+  <?php endif; ?>
+  <?= $this->out["page"]["title"] ?>
+</h2>
+
+<div>
+  <?= $this->out["page"]["content"]  ?>
+</div>
+<?php if($this->out["pages"]["list"]) : ?>
+<ul class="pages_menu">
+<?php foreach($this->out["pages"]["list"] as $page) : ?>
+  <li><a href="<?= $this->url("pages/view/page", array("id" => $page["id"])) ?>"><?= $page["title"] ?></a></li>
+<?php endforeach; ?>
+</ul>
+<?php endif; ?>