noalyss  Version-6.7.2
Public Member Functions | Static Public Member Functions
Extension Class Reference

manage the extension, it involves the table extension More...

Inheritance diagram for Extension:
Menu_Ref_sql

Public Member Functions

 can_request ($p_login)
 return 1 if the user given in parameter can access this extension otherwise returns 0
 insert_plugin ()
 remove_plugin ()
 search ($p_what)
 search a extension, the what is the column (extends_code
 update_plugin ()
 verify ()

Static Public Member Functions

static check_plugin_version ()
static check_version ($i)
static clean (Database $p_cn)
 remove all the schema from the plugins
static make_array ($cn)
 make an array of the available plugin for the current user

Detailed Description

manage the extension, it involves the table extension

Data member

Definition at line 40 of file class_extension.php.


Member Function Documentation

Extension::can_request ( p_login)

return 1 if the user given in parameter can access this extension otherwise returns 0

Parameters:
$p_loginthe user login
Returns:
1 has access, 0 has no access

Definition at line 63 of file class_extension.php.

References cn.

    {
                $cnt=$this->cn->get_value("select count(*) from menu_ref
                                                                                join profile_menu using (me_code)
                                                                                join profile_user using (p_id)
                                                                                where
                                                                                me_code=$1
                                                                                and user_name=$2",
                                                                array($this->me_code,$p_login));
                if ( $cnt > 0)        return 1;
                return 0;
    }
static Extension::check_plugin_version ( ) [static]

Definition at line 165 of file class_extension.php.

References $g_user, and echo.

Referenced by check_version().

        {
            global $g_user,$version_plugin;
            if ($g_user->Admin() == 1)
            {
                if (SITE_UPDATE_PLUGIN != "")
                {
                    $update = @file_get_contents(SITE_UPDATE_PLUGIN);
                    if ($update > $version_plugin)
                    {
                        echo '<div class="inner_box" style="position:absolute;zindex:2;top:5px;left:360px">';
                        echo '<p class="notice">';
                        echo "Mise à jour disponible des plugins pour NOALYSS, version actuelle : $update votre version $version_plugin";
                        echo '</p>';
                        echo '</div>';
                    }
                }
            }
        }
static Extension::check_version ( i) [static]

Definition at line 88 of file class_extension.php.

References $version_noalyss, alert(), check_plugin_version(), and exit.

    {
        global $version_noalyss;
        if ( ! isset ($version_noalyss) || $version_noalyss < $i )
        {
            alert('Cette extension ne fonctionne pas sur cette version de NOALYSS'.
                  ' Veuillez mettre votre programme a jour. Version minimum '.$i);
            exit();
        }
        Extension::check_plugin_version();
    }
static Extension::clean ( Database p_cn) [static]

remove all the schema from the plugins

Parameters:
Database$p_cn

Definition at line 156 of file class_extension.php.

References Database\exec_sql(), and Database\exist_schema().

        {
                $a_ext=array("tva_belge","amortissement","impdol","coprop","importbank");
                for($i=0;$i<count($a_ext);$i++){
                        if ($p_cn->exist_schema($a_ext[$i])) {
                                $p_cn->exec_sql("drop schema ".$a_ext[$i]." cascade");
                        }
                }
        }

insert into default profile

Definition at line 99 of file class_extension.php.

References $count, alert(), cn, echo, Menu_Ref_sql\insert(), and verify().

        {
                try
                {
                        $this->cn->start();
                        $this->verify();
                        // check if duplicate
                        $this->me_code = strtoupper($this->me_code);
                        $count = $this->cn->get_value("select count(*) from menu_ref where me_code=$1", array($this->me_code));
                        if ($count != 0)
                                throw new Exception("Doublon");
                        $this->me_type = 'PL';
                        $this->insert();
                        /**
                         * insert into default profile
                         */
                        $this->cn->exec_sql("insert into profile_menu(me_code,me_code_dep,p_type_display,p_id)
                                        values ($1,$2,$3,$4)",array($this->me_code,'EXT','S',1));
                        $this->cn->commit();
                }
                catch (Exception $exc)
                {
                        echo alert($exc->getMessage());
                }
        }
static Extension::make_array ( cn) [static]

make an array of the available plugin for the current user

Returns:
an array
See also:
ISelect

Definition at line 79 of file class_extension.php.

References $a, $cn, and $sql.

    {
        $sql="select DISTINCT me_code as value, me_menu as label from ".
             " menu_ref join profile_menu using (me_code)
                                 join profile_user using (p_id) where ".
             " user_name=$1 and me_type='PL' ORDER BY ME_MENU";
        $a=$cn->get_array($sql,array($_SESSION['g_user']));
        return $a;
    }

Definition at line 139 of file class_extension.php.

References alert(), cn, and echo.

        {
                try
                {
                        $this->cn->start();
                        $this->delete();
                        $this->cn->commit();
                }
                catch (Exception $exc)
                {
                        echo alert($exc->getMessage());
                }
        }
Extension::search ( p_what)

search a extension, the what is the column (extends_code

Definition at line 52 of file class_extension.php.

References Menu_Ref_sql\load().

    {
                $this->me_code=strtoupper($p_what);
                if ( $this->load() == -1) return null;
                return 1;
    }

Definition at line 124 of file class_extension.php.

References alert(), cn, echo, Menu_Ref_sql\update(), and verify().

        {
                try
                {
                        $this->cn->start();
                        $this->verify();
                        $this->me_type = 'PL';
                        $this->update();
                        $this->cn->commit();
                }
                catch (Exception $exc)
                {
                        echo alert($exc->getMessage());
                }
        }

Reimplemented from Menu_Ref_sql.

Definition at line 42 of file class_extension.php.

References trim().

Referenced by insert_plugin(), and update_plugin().

    {
        // Verify that the elt we want to add is correct
        if (trim($this->me_code)=="") throw new Exception('Le code ne peut pas être vide');
        if (trim($this->me_menu)=="") throw new Exception('Le nom ne peut pas être vide');
        if (trim($this->me_file)=="") throw new Exception('Chemin incorrect');
        if (file_exists('..'.DIRECTORY_SEPARATOR.'include'.DIRECTORY_SEPARATOR.'ext'.DIRECTORY_SEPARATOR.$this->me_file) == false)
            throw new Exception ('Extension non trouvée, le chemin est-il correct?');
    }

The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations