noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 04/22: indentation


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 04/22: indentation
Date: Thu, 18 Jun 2015 15:56:05 +0000

sparkyx pushed a commit to branch master
in repository noalyss.

commit abacde331d9c39e5cc5f9b4ab19722861564573a
Author: Dany De Bontridder <address@hidden>
Date:   Sat Jun 13 19:59:10 2015 +0200

    indentation
---
 include/class_profile_menu.php |  408 ++++++++++++++++++++--------------------
 1 files changed, 207 insertions(+), 201 deletions(-)

diff --git a/include/class_profile_menu.php b/include/class_profile_menu.php
index 348f4a5..221cac0 100644
--- a/include/class_profile_menu.php
+++ b/include/class_profile_menu.php
@@ -19,6 +19,7 @@
 // Copyright Author Dany De Bontridder address@hidden
 
 require_once 'class_profile_menu_sql.php';
+
 /**
  * Manage the menu of a profile
  *
@@ -27,75 +28,76 @@ require_once 'class_profile_menu_sql.php';
 class Profile_Menu extends Profile_Menu_sql
 {
 
-       function __construct($p_cn,$p_id=-1)
-       {
-               $this->cn = $p_cn;
-                parent::__construct($p_cn, $p_id);
-       }
-       /**
-        * Display the content of a profile
-        * @param type $resource
-        * @param type $p_id
-        */
-       function sub_menu($resource, $p_id)
-       {
-               if (Database::num_row($resource) != 0)
-               {
-                       $gDossier = dossier::id();
-                       echo '<ul style="list-style-type:none">';
-                       for ($e = 0; $e < Database::num_row($resource); $e++)
-                       {
-                               $menu = Database::fetch_array($resource, $e);
-                               $me_code = $menu['me_code'];
+    function __construct($p_cn, $p_id=-1)
+    {
+        $this->cn=$p_cn;
+        parent::__construct($p_cn, $p_id);
+    }
+
+    /**
+     * Display the content of a profile
+     * @param type $resource
+     * @param type $p_id
+     */
+    function sub_menu($resource, $p_id)
+    {
+        if (Database::num_row($resource)!=0)
+        {
+            $gDossier=dossier::id();
+            echo '<ul style="list-style-type:none">';
+            for ($e=0; $e<Database::num_row($resource); $e++)
+            {
+                $menu=Database::fetch_array($resource, $e);
+                $me_code=$menu['me_code'];
 
-                               $me_code_dep = $menu['me_code_dep'];
+                $me_code_dep=$menu['me_code_dep'];
 
-                               $mp_type = $menu['p_type_display'];
+                $mp_type=$menu['p_type_display'];
 
-                               $me_menu = $menu['me_menu'];
-                               $me_desc = $menu['me_description'];
-                               $me_def=($menu['pm_default']=='1')?'<span 
class="notice" style="display:inline">Défaut</span>':'';
-                               $js = sprintf(
-                                               '<a class="line" 
href="javascript:void(0)" onclick="mod_menu(\'%s\',\'%s\')">%s</A>', $gDossier, 
$menu['pm_id'], $me_code);
-                               ?>
-                               <li>
+                $me_menu=$menu['me_menu'];
+                $me_desc=$menu['me_description'];
+                $me_def=($menu['pm_default']=='1')?'<span class="notice" 
style="display:inline">Défaut</span>':'';
+                $js=sprintf(
+                        '<a class="line" href="javascript:void(0)" 
onclick="mod_menu(\'%s\',\'%s\')">%s</A>', $gDossier, $menu['pm_id'], $me_code);
+                ?>
+                <li>
 
-                                       <?php echo  $me_menu?>
-                                       ( <?php echo  $js?> )
-                                       <?php echo  $me_desc?>  <?php echo 
$me_def?>
-                                       <?php 
-                                       $ret2 = $this->cn->exec_sql("
-                                                                       SELECT 
pm_id,
-                                                                               
pm.me_code,
-                                                                               
me_code_dep,
-                                                                               
p_id,
-                                                                               
p_order,
-                                                                               
p_type_display,
-                                                                               
pm_default,
-                                                                               
pm_desc,
-                                                                               
me_menu,
-                                                                               
me_description
-                                                                               
FROM profile_menu as pm
-                                                                               
        join profile_menu_type on (p_type_display=pm_type)
-                                                                               
        join menu_ref as mr on (mr.me_code=pm.me_code)
-                                                                               
where
-                                                                               
p_id=$1 and me_code_dep=$2
-                                                                               
order by p_order asc
-                                                       ", array($p_id, 
$me_code));
-                                       $this->sub_menu($ret2, $p_id);
-                                       echo "</li>";
-                               } //end loop e
-                               echo '</ul>';
-                       } // end if
-               }
+                    <?php echo $me_menu ?>
+                    ( <?php echo $js ?> )
+                    <?php echo $me_desc ?>  <?php echo $me_def ?>
+                    <?php
+                $ret2=$this->cn->exec_sql("
+                                    SELECT pm_id,
+                                            pm.me_code,
+                                            me_code_dep,
+                                            p_id,
+                                            p_order,
+                                            p_type_display,
+                                            pm_default,
+                                            pm_desc,
+                                            me_menu,
+                                            me_description
+                                            FROM profile_menu as pm
+                                                    join profile_menu_type on 
(p_type_display=pm_type)
+                                                    join menu_ref as mr on 
(mr.me_code=pm.me_code)
+                                            where
+                                            p_id=$1 and me_code_dep=$2
+                                            order by p_order asc
+                        ", array($p_id, $me_code));
+                    $this->sub_menu($ret2, $p_id);
+                    echo "</li>";
+                } //end loop e
+                echo '</ul>';
+            } // end if
+        }
 
-               /**
-                * Show a table with all the menu and the type
-                * @param type $p_id profile.p_id
-                */
-               function listing_profile($p_id)
-               {
-                       $array = $this->cn->get_array("
+        /**
+         * Show a table with all the menu and the type
+         * @param type $p_id profile.p_id
+         */
+        function listing_profile($p_id)
+        {
+            $array=$this->cn->get_array("
                        SELECT pm_id,
                                        pm.me_code,
                                        me_code_dep,
@@ -112,131 +114,132 @@ class Profile_Menu extends Profile_Menu_sql
                        p_id=$1 and p_type_display='M'
                        order by p_order asc
                        ", array($p_id));
-                       if (count($array) == 0)
-                       {
-                               // if not module show only menu
-                               $ret = $this->cn->exec_sql("
-                                                                               
SELECT pm_id,
-                                                                               
pm.me_code,
-                                                                               
me_code_dep,
-                                                                               
p_id,
-                                                                               
p_order,
-                                                                               
p_type_display,
-                                                                               
pm_default,
-                                                                               
pm_desc,
-                                                                               
me_menu,
-                                                                               
me_description
-                                                                               
FROM profile_menu as pm
-                                                                               
        join profile_menu_type on (p_type_display=pm_type)
-                                                                               
        join menu_ref as mr on (mr.me_code=pm.me_code)
-                                       where
-                                       p_id=$1 and p_type_display='E'
-                                       order by p_order asc
+            if (count($array)==0)
+            {
+                // if not module show only menu
+                $ret=$this->cn->exec_sql("
+                                    SELECT pm_id,
+                                    pm.me_code,
+                                    me_code_dep,
+                                    p_id,
+                                    p_order,
+                                    p_type_display,
+                                    pm_default,
+                                    pm_desc,
+                                    me_menu,
+                                    me_description
+                                    FROM profile_menu as pm
+                                            join profile_menu_type on 
(p_type_display=pm_type)
+                                            join menu_ref as mr on 
(mr.me_code=pm.me_code)
+                                    where
+                                    p_id=$1 and p_type_display='E'
+                                    order by p_order asc
                                                        ", array($p_id));
-                               echo '<ul style="list-style-type:none">';
+                echo '<ul style="list-style-type:none">';
 
-                               $this->sub_menu($ret, $p_id);
-                               // $this->listing_profile($p_id,$ret, 
$array[$i]['me_code']);
+                $this->sub_menu($ret, $p_id);
+                // $this->listing_profile($p_id,$ret, $array[$i]['me_code']);
 
-                               echo "</li>";
-                               echo '</ul>';
-                       }
-                       else
-                       {
-                               $this->cn->prepare("menu", "
+                echo "</li>";
+                echo '</ul>';
+            }
+            else
+            {
+                $this->cn->prepare("menu", "
                                SELECT pm_id,
-                                                                               
pm.me_code,
-                                                                               
me_code_dep,
-                                                                               
p_id,
-                                                                               
p_order,
-                                                                               
p_type_display,
-                                                                               
pm_default,
-                                                                               
pm_desc,
-                                                                               
me_menu,
-                                                                               
me_description
-                                                                               
FROM profile_menu as pm
-                                                                               
        join profile_menu_type on (p_type_display=pm_type)
-                                                                               
        join menu_ref as mr on (mr.me_code=pm.me_code)
-                                       where
-                                       p_id=$1 and me_code_dep=$2 and 
p_type_display in ('E','S')
-                                       order by p_order asc
+                                    pm.me_code,
+                                    me_code_dep,
+                                    p_id,
+                                    p_order,
+                                    p_type_display,
+                                    pm_default,
+                                    pm_desc,
+                                    me_menu,
+                                    me_description
+                                    FROM profile_menu as pm
+                                            join profile_menu_type on 
(p_type_display=pm_type)
+                                            join menu_ref as mr on 
(mr.me_code=pm.me_code)
+                                    where
+                                    p_id=$1 and me_code_dep=$2 and 
p_type_display in ('E','S')
+                                    order by p_order asc
                                                        ");
-                               echo '<ul style="list-style-type:none">';
-                               // Menu by module
-                               $gDossier = Dossier::id();
-                               for ($i = 0; $i < count($array); $i++)
-                               {
-                                       
$me_def=($array[$i]['pm_default']=='1')?'<span class="notice" 
style="display:inline">Défaut</span>':'';
-                                       $js = sprintf('<a class="line" 
style="display:inline;text-decoration:underline"
+                echo '<ul style="list-style-type:none">';
+                // Menu by module
+                $gDossier=Dossier::id();
+                for ($i=0; $i<count($array); $i++)
+                {
+                    $me_def=($array[$i]['pm_default']=='1')?'<span 
class="notice" style="display:inline">Défaut</span>':'';
+                    $js=sprintf('<a class="line" 
style="display:inline;text-decoration:underline"
                                                href="javascript:void(0)" 
onclick="mod_menu(\'%s\',\'%s\')">%s</A>', $gDossier, $array[$i]['pm_id'], 
$array[$i]['me_code']);
-                                       echo "<li>" . $array[$i]['me_menu'] . " 
(" . $js . ")" . $array[$i]['me_description']." ".$me_def;
+                    echo "<li>".$array[$i]['me_menu']." 
(".$js.")".$array[$i]['me_description']." ".$me_def;
 
-                                       $ret = $this->cn->execute("menu", 
array($p_id, $array[$i]['me_code']));
-                                       $this->sub_menu($ret, $p_id);
+                    $ret=$this->cn->execute("menu", array($p_id, 
$array[$i]['me_code']));
+                    $this->sub_menu($ret, $p_id);
 
-                                       echo "</li>";
-                               }// end loop i
-                               echo '</ul>';
-                               //*******************************************
-                               // show also menu without a module
-                               //*******************************************
-                               $ret = $this->cn->exec_sql("
-                                                                               
SELECT pm_id,
-                                                                               
pm.me_code,
-                                                                               
me_code_dep,
-                                                                               
p_id,
-                                                                               
p_order,
-                                                                               
p_type_display,
-                                                                               
pm_default,
-                                                                               
pm_desc,
-                                                                               
me_menu,
-                                                                               
me_description
-                                                                               
FROM profile_menu as pm
-                                                                               
        join profile_menu_type on (p_type_display=pm_type)
-                                                                               
        join menu_ref as mr on (mr.me_code=pm.me_code)
+                    echo "</li>";
+                }// end loop i
+                echo '</ul>';
+                //*******************************************
+                // show also menu without a module
+                //*******************************************
+                $ret=$this->cn->exec_sql("
+                                        SELECT pm_id,
+                                        pm.me_code,
+                                        me_code_dep,
+                                        p_id,
+                                        p_order,
+                                        p_type_display,
+                                        pm_default,
+                                        pm_desc,
+                                        me_menu,
+                                        me_description
+                                        FROM profile_menu as pm
+                                                join profile_menu_type on 
(p_type_display=pm_type)
+                                                join menu_ref as mr on 
(mr.me_code=pm.me_code)
                                        where
                                        p_id=$1 and  p_type_display not in 
('M','P') and me_code_dep is null
                                        order by p_order asc
                                                        ", array($p_id));
-                               if (Database::num_row($ret))
-                               {
-                                       echo "<h2>Menu sans module</h2>";
-                                       $this->sub_menu($ret, $p_id);
-                               }
-                       }
-               }
+                if (Database::num_row($ret))
+                {
+                    echo "<h2>Menu sans module</h2>";
+                    $this->sub_menu($ret, $p_id);
+                }
+            }
+        }
 
-               function printing($p_id)
-               {
-                       $ret = $this->cn->exec_sql("
-                               SELECT pm_id,
-                                                                               
pm.me_code,
-                                                                               
me_code_dep,
-                                                                               
p_id,
-                                                                               
p_order,
-                                                                               
p_type_display,
-                                                                               
pm_default,
-                                                                               
pm_desc,
-                                                                               
me_menu,
-                                                                               
me_description
-                                                                               
FROM profile_menu as pm
-                                                                               
        join profile_menu_type on (p_type_display=pm_type)
-                                                                               
        join menu_ref as mr on (mr.me_code=pm.me_code)
-                                       where
-                                       p_id=$1 and me_type='PR'
-                                       order by p_order asc
+        function printing($p_id)
+        {
+            $ret=$this->cn->exec_sql("
+                            SELECT pm_id,
+                                pm.me_code,
+                                me_code_dep,
+                                p_id,
+                                p_order,
+                                p_type_display,
+                                pm_default,
+                                pm_desc,
+                                me_menu,
+                                me_description
+                                FROM profile_menu as pm
+                                        join profile_menu_type on 
(p_type_display=pm_type)
+                                        join menu_ref as mr on 
(mr.me_code=pm.me_code)
+                                where
+                                p_id=$1 and me_type='PR'
+                                order by p_order asc
                                                        ", array($p_id));
-                       // Menu by module
-                       $gDossier = Dossier::id();
-                       $this->sub_menu($ret, $p_id);
-               }
-               /**
-                * Show the available profile for the profile $p_id, it 
concerns only the action of management (action-gestion)
-                * @param $p_id is the profile p_id
-                */
-               function available_profile($p_id)
-               {
-                       $array=$this->cn->get_array("
+            // Menu by module
+            $gDossier=Dossier::id();
+            $this->sub_menu($ret, $p_id);
+        }
+
+        /**
+         * Show the available profile for the profile $p_id, it concerns only 
the action of management (action-gestion)
+         * @param $p_id is the profile p_id
+         */
+        function available_profile($p_id)
+        {
+            $array=$this->cn->get_array("
                                        select 
p.p_id,p.p_name,s.p_granted,s.ua_id,s.ua_right
                                                from profile as p
                                                join user_sec_action_profile as 
s on (s.p_granted=p.p_id)
@@ -246,21 +249,22 @@ class Profile_Menu extends Profile_Menu_sql
                                                from profile as p2
                                                where
                                                p2.p_id not in (select 
p_granted from user_sec_action_profile where p_id = $1) order by p_name;
-                               ",array($p_id));
-                       $aright_value=array(
-                                                               
array('value'=>'R','label'=>_('Lecture')),
-                                                               
array('value'=>'W','label'=>_('Ecriture')),
-                                                               
array('value'=>'X','label'=>_('Aucun accès'))
-                                       );
-                       require_once 'template/user_sec_profile.php';
-               }
-               /**
-                * Show the available repository for the profile $p_id
-                * @param $p_id is the profile p_id
-                */
-               function available_repository($p_id)
-               {
-                       $array=$this->cn->get_array("
+                               ", array($p_id));
+            $aright_value=array(
+                array('value'=>'R', 'label'=>_('Lecture')),
+                array('value'=>'W', 'label'=>_('Ecriture')),
+                array('value'=>'X', 'label'=>_('Aucun accès'))
+            );
+            require_once 'template/user_sec_profile.php';
+        }
+
+        /**
+         * Show the available repository for the profile $p_id
+         * @param $p_id is the profile p_id
+         */
+        function available_repository($p_id)
+        {
+            $array=$this->cn->get_array("
                                        select 
p.r_id,p.r_name,s.ur_id,s.ur_right
                                                from stock_repository as p
                                                join profile_sec_repository as 
s on (s.r_id=p.r_id)
@@ -270,14 +274,16 @@ class Profile_Menu extends Profile_Menu_sql
                                                from stock_repository as p2
                                                where
                                                p2.r_id not in (select r_id 
from profile_sec_repository where p_id = $1) order by r_name;
-                               ",array($p_id));
-                       $aright_value=array(
-                                                               
array('value'=>'R','label'=>_('Lecture')),
-                                                               
array('value'=>'W','label'=>_('Ecriture')),
-                                                               
array('value'=>'X','label'=>_('Aucun accès'))
-                                       );
-                       require_once 'template/profile_sec_repository.php';
-               }
-       }
-       //end class
-       ?>
\ No newline at end of file
+                               ", array($p_id));
+            $aright_value=array(
+                array('value'=>'R', 'label'=>_('Lecture')),
+                array('value'=>'W', 'label'=>_('Ecriture')),
+                array('value'=>'X', 'label'=>_('Aucun accès'))
+            );
+            require_once 'template/profile_sec_repository.php';
+        }
+
+    }
+
+    //end class
+    ?>
\ No newline at end of file



reply via email to

[Prev in Thread] Current Thread [Next in Thread]