ThWboard Support-Forum (Archiv)

Ort: / Boardübersicht / XPortal Diskussion / Modulapi


Seite 1 von 1

Apfelkorn schrieb am 09.09.2002 um 20:59 Uhr

Ein kleiner Vorgeschmack auf das was kommt: Die BaseClass zur ModulAPI:

<?php
class CModuleBase
{
    var $name_int;
    var $name_ext;
    var $classtype;

    var $admin; // true, if administration is avaiable

    var $require; // imploded array of required modules
    var $incomp; // imploded array of incompatible modules

    function show($template) { return ""; }
    function install() {}
    function uninstall() {}

    function admin_event($event, $param) {}
    function admin() {}
};
?>



Bei der Funktion "admin_event" ist $event eine der folgenden Konstanten:
EV_NULL, EV_MODULE_ADD, EV_MODULE_DELETE, EV_USER_ADD, EV_USER_DELETE

(EV_NULL ist nur als Default-Wert für die Datenbank vorhanden)

$param ist ein implodierter Array, mit Semikola getrennt

Ich behalte mir Änderungen vor.

Ausserdem ein Teil vom Code vom Modul "navigation":

<?php
class m_navigation extends mBase
{
    function m_navigation()
    {
        $this->name_int = "navigation";
        $this->name_pub = "Navigation";
        $this->classtype = "B1";

        $this->admin = TRUE;

        $this->require = array(""); // Requires no mod
        $this->incomp  = array(""); // Works with every mod    
    }

    function show($template)
    {
        global $oDB, $aDB;

        $LINKS = "";

        $rindex = $oDB->QUERY("SELECT name, link FROM p" . $aDB['key'] . "_mod_navigation ORDER BY ord ASC");

        while($result = $oDB->FETCH_ARRAY($rindex))
            $LINKS .= "<a href=\"" . $result['link'] . "\">" . $result['name'] . "</a><br>";

        $template->assign("TITLE", $this->name_pub);
        $template->assign("CONTENT", $LINKS);
        return $template->getData();

    }

    function admin() {}

    function install() {}
    function uninstall () {}
};
?>



Der Code ist noch unvollständig, zeigt aber, dass das Modul nun eine eigene Tabelle benutzt, die es ermöglicht auch auf Inhalte ausserhalb des Portals zu linken (z.B. externe Forensoftware ;) )

Seite 1 von 1