noalyss  Version-6.7.2
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
Default_Menu Class Reference

Description of class_default_menu. More...

Public Member Functions

 __construct ()
 get ($p_string)
 input_value ()
 save ()
 set ($p_string, $p_value)
 verify ()

Static Public Member Functions

static test_me ()

Private Member Functions

 check_code ($p_string)

Private Attributes

 $a_menu_def
 $a_menu_def is an array of Default_Menu_SQL
 $code
 Possible value.

Detailed Description

Description of class_default_menu.

Author:
dany

Definition at line 29 of file class_default_menu.php.


Constructor & Destructor Documentation

Definition at line 42 of file class_default_menu.php.

References $cn, $idx, $menu, $ret, and Database\num_row().

    {
        global $cn;
        $menu = new Default_Menu_SQL($cn);
        $ret = $menu->seek();
        for ($i = 0; $i < Database::num_row($ret); $i++)
        {
            $tmenu = $menu->next($ret, $i);
            $idx = $tmenu->getp('md_code');
            $this->a_menu_def[$idx] = $tmenu->getp('me_code');
        }
        $this->code = explode(',', 'code_follow,code_invoice');
    }

Member Function Documentation

Default_Menu::check_code ( p_string) [private]

Definition at line 64 of file class_default_menu.php.

References $cn, and $count.

Referenced by verify().

    {
        global $cn;
        $count = $cn->get_value('select count(*) from v_menu_description_favori where '
                . 'code = $1', array($p_string));
        if ($count == 0)
        {
            throw new Exception('code_inexistant');
        }
    }
Default_Menu::get ( p_string)

Definition at line 91 of file class_default_menu.php.

    {
        return $this->a_menu_def[$p_string];
    }

Definition at line 56 of file class_default_menu.php.

References echo.

    {
        $code_invoice = new IText('code_invoice', $this->a_menu_def['code_invoice']);
        $code_follow = new IText('code_follow', $this->a_menu_def['code_follow']);
        echo '<p>' . _('Code pour création facture depuis gestion') . $code_invoice->input() . '</p>';
        echo '<p>' . _('Code pour appel gestion') . $code_follow->input() . '</p>';
    }

Definition at line 96 of file class_default_menu.php.

References $cn, $e, $value, and verify().

    {
        global $cn;
        try
        {
            $this->verify();
            foreach ($this->code as $key => $value)
            {
                $cn->exec_sql('update menu_default set me_code=$1 where
                        md_code =$2', array($value,$this->a_menu_def[$value]));
            }
        } catch (Exception $e)
        {
            $e->getTraceAsString();
            throw $e;
        }
    }
Default_Menu::set ( p_string,
p_value 
)

Definition at line 83 of file class_default_menu.php.

    {
        if (in_array($p_string, $this->code) == false)
        {
            throw new Exception("code_invalid");
        }
        $this->a_menu_def[$p_string] = $p_value;
    }
static Default_Menu::test_me ( ) [static]

Definition at line 114 of file class_default_menu.php.

References $a, $cn, $e, $g_failed, $g_succeed, $g_user, echo, and h2().

    {
        global $cn, $g_user, $g_succeed, $g_failed;

        echo h2('Constructor', '');
        $a = new Default_Menu();
        echo $g_succeed . 'constructor';
        if (count($a->a_menu_def) != 2)
            echo $g_failed;
        else
            echo $g_succeed;
        echo h2("input_value", "");
        $a->input_value();
        echo h2('verify');
        $a->verify();
        try {
            echo h2('Verify must failed');
            $a->set('code_follow', 'MEMNU/MEMEM/');
            $a->verify();   
        } catch (Exception $e) {
            echo $g_succeed. " OK ";
        }
        echo h2('Verify must succeed');
        try {
            $a->set('code_follow', 'GESTION/FOLLOW');
            $a->verify();
            echo $g_succeed. " OK ";
        } catch (Exception $e)
        {
            echo $g_failed."NOK";
        }
        echo h2('Save');
        $a->save();
        echo h2('GET');
        echo ( assert($a->get('code_follow')=='GESTION/FOLLOW') )?$g_succeed.$a->get('code_follow'):$g_failed.$a->get('code_follow');
        echo ( assert($a->get('code_invoice')=='COMPTA/VENMENU/VEN') )?$g_succeed.$a->get('code_invoice'):$g_failed.$a->get('code_invoice');
        echo $a->get('code_invoice');
    }

Definition at line 75 of file class_default_menu.php.

References $code, and check_code().

Referenced by save().

    {
        foreach ($this->code as $code)
        {
            $this->check_code($this->a_menu_def[$code]);
        }
    }

Field Documentation

Default_Menu::$a_menu_def [private]

$a_menu_def is an array of Default_Menu_SQL

Definition at line 35 of file class_default_menu.php.

Default_Menu::$code [private]

Possible value.

Definition at line 40 of file class_default_menu.php.

Referenced by verify().


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