Example #1
0
function list_html($List = array(), $table, $page, $header = array(), $add = true, $edit = true, $remove = true, $show = true)
{
    global $db_mapping, $secteur_module;
    // on recupere le mapping de la table en parametres
    $table_mapping = $db_mapping[$table];
    //echo 'Voici la liste des chapitres du MMORPG<br /><br />';
    echo '<table class="Admin list">';
    echo '<tr>';
    foreach ($table_mapping['champs'] as $champs => $prop) {
        if (in_array($champs, $header)) {
            echo '<th>' . $prop['label'] . '</th>';
        }
        if (isset($prop['increment'])) {
            $primary[] = $champs;
        }
        if (isset($prop['Ordering'])) {
            $orderer = $champs;
        }
    }
    foreach ($table_mapping['key'] as $champs => $r) {
        if (preg_match('/PRIMARY/i', $r['key'])) {
            //($r['key']=='PRIMARY')
            $primary[] = $champs;
        }
    }
    //if(isset($prop['increment']))
    echo '<th ' . (isset($orderer) ? "colspan='3'" : "") . '>';
    if ($add) {
        //echo '<form method="POST" action="'.get_link($page,'Admin').'" >';
        //echo '<input type="submit" name="Add" value="&plus;"/>';
        //echo '</form>';
        echo '<a href="' . get_link($page, $secteur_module, array('Add' => 'one')) . '">&plus;</a>';
    }
    echo '</th>';
    echo '</tr>';
    $ct = count($List);
    if (!empty($List)) {
        foreach ($List as $Chapter) {
            //$Chapter_ID = stripslashes($Chapter[$primary]);
            $push = array();
            echo '<tr>';
            foreach ($table_mapping['champs'] as $champs => $prop) {
                if (in_array($champs, $header)) {
                    echo '<td>';
                    if (isset($table_mapping['key'][$champs])) {
                        $key = $table_mapping['key'][$champs];
                        if (preg_match('/FOREIGN/i', $key['key'])) {
                            //( $key['key'] === 'FOREIGN')
                            echo get_foreign_value_db($table, $champs, $Chapter[$champs]);
                        } else {
                            echo $Chapter[$champs];
                        }
                    } else {
                        echo $Chapter[$champs];
                    }
                    echo '</td>';
                }
            }
            foreach ($primary as $_id_) {
                $push[$_id_] = $Chapter[$_id_];
            }
            if (isset($orderer)) {
                $push[$orderer] = $Chapter[$orderer];
                echo "<td>";
                if ($Chapter[$orderer] != 1) {
                    /*	echo "<form method='post' action='".get_link($page,'Admin')."'>";
                    			foreach($primary as $_id_)
                    				echo '<input type="hidden" name="'.$_id_.'" value="'.$Chapter[$_id_].'"/>';
                    				echo '<input type="hidden" name="'.$orderer.'" value="'.$Chapter[$orderer].'"/>';
                    				echo "<input type='submit' name='up_rank' value='&uArr;' />";
                    				echo "</form >";
                    			*/
                    $push['up_rank'] = 'one';
                    echo '<a href="' . get_link($page, $secteur_module, $push) . '">&uArr;</a>';
                    unset($push['up_rank']);
                }
                echo "</td>";
                echo "<td>";
                if ($Chapter[$orderer] != $ct) {
                    /*	echo "<form method='post' action='".get_link($page,'Admin')."'>";
                    			foreach($primary as $_id_)
                    				echo '<input type="hidden" name="'.$_id_.'" value="'.$Chapter[$_id_].'"/>';
                    				echo '<input type="hidden" name="'.$orderer.'" value="'.$Chapter[$orderer].'"/>';
                    				echo "<input type='submit' name='down_rank' value='&dArr;' />";
                    				echo "</form>";
                    			*/
                    $push['down_rank'] = 'one';
                    echo '<a href="' . get_link($page, $secteur_module, $push) . '">&dArr;</a>';
                    unset($push['down_rank']);
                }
                echo "</td>";
            }
            echo '<td>';
            /**
            			echo '<form method="POST" action="'.get_link($page,'Admin').'">';
            			
            			foreach($primary as $_id_)
            				echo '<input type="hidden" name="'.$_id_.'" value="'.$Chapter[$_id_].'"/>';
            				
            			if($edit)
            				echo '<input type="submit" name="Second_Edit" value="&check;"/>';
            			if($remove)
            				echo '<input type="submit" name="Second_Delete" value="&cross;"/>';
            				
            			echo '</form>';
            			**/
            if ($show) {
                $push['Second_Show'] = 'one';
                echo '<a href="' . get_link($page, $secteur_module, $push) . '">&sharp;</a>';
                unset($push['Second_Show']);
            }
            if ($edit) {
                $push['Second_Edit'] = 'one';
                echo '<a href="' . get_link($page, $secteur_module, $push) . '">&check;</a>';
                unset($push['Second_Edit']);
            }
            if ($remove) {
                echo init_popIn('remove-' . implode($push, "-") . '-form', "Suppression", confirm_remove_db($table, $page, $push[$_id_]), 'remove-link');
            }
            echo '</td>';
            echo '</tr>';
        }
    }
    echo '<tr><td colspan="">' . $ct . ' résultat(s)</td></tr>';
    echo '</table>';
}
<?php

if (verif_access("Admin")) {
    if (request_confirm('Edit')) {
        echo 'Voici la liste des Caracteristiques du MMORPG<br /><br />';
        list_html_db('Caranille_Caracteristiques', 'Caracteristiques', array('Caracteristique_Type', 'Caracteristique_Name', 'Caracteristique_Opposant', 'Caracteristique_Order'));
    } elseif (request_confirm('Second_Edit')) {
        $Caracteristique_ID = request_data('Caracteristique_ID');
        $Caracteristique_List = get_db("edit_admin", array('table' => 'Caranille_Caracteristiques', 'ID' => 'Caracteristique_ID', 'value' => $Caracteristique_ID));
        get_formulaire_Caracteristique($Caracteristique_List);
    } elseif (request_confirm('Second_Delete')) {
        $Caracteristique_ID = request_data('Caracteristique_ID');
        confirm_remove_db('Caranille_Caracteristiques', "Caracteristiques", $Caracteristique_ID);
        ?>
            <p>Supprimer definitivement ?</p>
                <form method="POST" action="<?php 
        echo get_link("Caracteristiques", "Admin");
        ?>
">
				<input type="hidden" name="Caracteristique_ID" value="<?php 
        echo $Caracteristique_ID;
        ?>
"/>
				<input type="submit" name="Back" value="Annuler" />
				<input type="submit" name="Delete" value="supprimer" />
				</form>
<?php 
    } elseif (request_confirm('Add')) {
        get_formulaire_Caracteristique();
    } else {
        echo 'Que souhaitez-vous faire ?<br />';
Example #3
0
<?php

if (verif_access("Admin")) {
    if (request_confirm('Edit')) {
        echo 'Voici la liste des chapitres du MMORPG<br /><br />';
        list_html_db('Caranille_Chapters', 'Chapters', array('Chapter_Number', 'Chapter_Name'));
    } else {
        if (request_confirm('Second_Edit')) {
            $Chapter_ID = request_data('Chapter_ID');
            $Chapter_List = get_db("edit_admin", array('table' => 'Caranille_Chapters', 'ID' => 'Chapter_ID', 'value' => $Chapter_ID));
            get_formulaire_chapter($Chapter_List);
        } else {
            if (request_confirm('Second_Delete')) {
                $Chapter_ID = request_data('Chapter_ID');
                confirm_remove_db('Caranille_Chapters', "Chapters", $Chapter_ID);
                ?>
            <p>Supprimer definitivement ?</p>
                <form method="POST" action="<?php 
                echo get_link("Chapters", "Admin");
                ?>
">
				<input type="hidden" name="Chapter_ID" value="<?php 
                echo $Chapter_ID;
                ?>
"/>
				<input type="submit" name="Back" value="Annuler" />
				<input type="submit" name="Delete" value="supprimer" />
				</form>
<?php 
            } else {
                if (request_confirm('Add')) {
Example #4
0
            echo '<input type="submit" name="Second_Edit" value="modifier">';
            echo '<input type="submit" name="Second_Delete" value="supprimer">';
            echo '</form></td>';
            echo '</tr>';
        }
        echo '</table>';
        //list_html_db('Caranille_Menus','Menus',array('Menu_Parent','Menu_Label','Menu_Link'));
    }
    if (request_confirm('Second_Edit')) {
        $Menu_ID = request_data('Menu_ID');
        $Menu_List = get_db("SELECT * FROM Caranille_Menus WHERE Menu_ID = '{$Menu_ID}' limit 1");
        get_formulaire_Menu($Menu_List);
    }
    if (request_confirm('Second_Delete')) {
        $Menu_ID = request_data('Menu_ID');
        confirm_remove_db('Caranille_Menus', "Menus", $Menu_ID);
        ?>
            <p>Supprimer definitivement ?</p>
                <form method="POST" action="<?php 
        echo get_link("Menus", "Admin");
        ?>
">
				<input type="hidden" name="Menu_ID" value="<?php 
        echo $Menu_ID;
        ?>
"/>
				<input type="submit" name="Back" value="Annuler" />
				<input type="submit" name="Delete" value="supprimer" />
				</form>
<?php 
    }