[ghelda-devel] [62] Initial push of plugin Requests.

[ Thread Index | Date Index | More lists.tuxfamily.org/ghelda-devel Archives ]


Revision: 62
Author:   odyx
Date:     2009-07-21 23:26:43 +0200 (Tue, 21 Jul 2009)

Log Message:
-----------
Initial push of plugin Requests.

Added Paths:
-----------
    trunk/plugins/Requests.php


Added: trunk/plugins/Requests.php
===================================================================
--- trunk/plugins/Requests.php	                        (rev 0)
+++ trunk/plugins/Requests.php	2009-07-21 21:26:43 UTC (rev 62)
@@ -0,0 +1,90 @@
+<?php
+/*
+ *  Ghelda - Gestion Hiérarchisée En Ligne D'Adresses
+ *         - Online Hierarchical Handling Of Adresses
+ *
+ *  Copyright (C) 2009 Didier Raboud
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU Affero General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Affero General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Affero General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+define('G_REQUESTS_URL_MODE','mode');
+define('G_REQUESTS_DEFAULT_MODE','list');
+define('G_REQUESTS_ID','request_id');
+define('G_REQUESTS_ID_NEW',-1);
+
+class Requests extends Plugin {
+    // List of the modes
+    private $modes = array('list');
+    // Actual mode
+    private $mode;
+    
+    //! Constructor
+    function __construct(&$parentRef,$name)
+    {
+        return parent::__construct(&$parentRef,$name);
+    }
+
+   function modesMenu()
+    {
+        $this->startTrad();
+        $targets['Tname'] = T_('Requests');
+        $targets['list']['name'] = T_('List');
+        $this->stopTrad();
+        return $targets;
+    }
+
+    function main()
+    {   $this->startTrad();
+
+        // Take the mode from the URL or take the default mode
+        $this->mode = array_key_exists(G_REQUESTS_URL_MODE,$this->url->querystring) ? $this->url->querystring[G_REQUESTS_URL_MODE] : G_REQUESTS_DEFAULT_MODE;
+
+        // If the mode is not know, trigger an error
+        if(array_search($this->mode,$this->modes) === false) {
+            trigger_error(T_('Intrusion tentative detected: ').T_("Don't try to use undefined mode names!"), G_E_LOG);
+            return false;
+        }
+
+        // Only execute if the user is authentified
+        if($this->authH->getAuth()) {
+            // From here, we are in know mode
+            // Get the Id from a query or edit myself
+            $groups_id = array_key_exists(G_REQUESTS_ID,$_GET) ? $_GET[G_REQUESTS_ID] : G_REQUESTS_ID_NEW;
+
+            switch($this->mode) {
+                case 'list':    $this->m_list();    break;
+            }
+        }
+
+        $this->stopTrad();
+    }
+    
+    function functionality($funcStr,$funcArgs = '')
+    {
+        switch($funcStr) {
+            case "xxx":
+                return $this->xxx($funcArgs);
+                break;
+        }
+    }
+
+    private function m_list()
+    {   $this->startTrad();
+        
+        $this->stopTrad();
+        return false;
+    }
+}
+?>
\ No newline at end of file


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/