function genMenu($arr) { global $actives; foreach ($arr as $name => $content) { if (substr($name, 0, 2) === "//") { # pass } else { if (is_array($content)) { if (in_array($name, $actives)) { echo "<li class=\"dropdown active\">\n"; } else { echo "<li class=\"dropdown\">\n"; } echo "<a class=\"dropdown-toggle\" data-toggle=\"dropdown\" href=\"#\">{$name}<span class=\"caret\"></span></a>\n"; echo "<ul class=\"dropdown-menu\">\n"; genMenu($content); echo "</ul>\n"; echo "</li>\n"; } else { if (in_array($name, $actives)) { echo "<li class=\"active\">"; } else { echo "<li>"; } echo "<a href=\"/{$content}\">{$name}</a></li>\n"; } } } }
?> <div id="page-wrapper"> <!-- Header --> <header id="header"> <h1 id="logo"><a href="<?php echo $_SITE['url']; ?> "><?php echo $_SITE['title']; ?> </a></h1> <nav id="nav"> <ul> <?php genMenu(); ?> </ul> </nav> </header> <!-- Banner --> <section id="banner"> <div class="content"> <header class="major"> <h2>Welcome to <?php echo $_SITE['title']; ?> !</h2> <p><?php echo $_SITE['description'];
function genContent($authResult = 0) { global $nomConvivialAmap; global $language; global $link; global $dbName; global $messageAccueil; echo '<div id = "news" class="news"></div><div id="authResult"><p>' . $messageAccueil . '</p></div> <div class="main"><p class="amapTitle" id = "mainTitle" style="width:100%; text-align:left">' . $nomConvivialAmap . '.</p></div>'; switch ($authResult) { case 0: switch ($language) { case 'fr': $text1 = 'utilisateur'; $text2 = 'mot de passe'; break; default: $text1 = 'username'; $text2 = 'password'; break; } genMenu(0); echo ' <div class="main"> <form class = "auth" name="auth" method="post" action="./login.php"> <table> <tr><td rowspan=3><img src = "./customize/images/' . $dbName . 'Logo_s.png" style = "padding:0px 0px 0px 0px; border:2px solid dodgerblue; border-radius : 15px; margin:0px 5px 0px 0px; width:65%; padding: 3px 3px 3px 3px; background-color:white; height=50%"/></td><td style="text-align : left">' . $text1 . '</td><td><input type="text" name="username" required/></td></tr> <tr><td style="text-align:left">' . $text2 . '</td><td><input type="password" name="password" required/></td></tr> <tr><td colspan = 2><input style="width:100%" type="submit" name="submit" value="connexion"/><img src="smallrad.png" style = "height : 150px; width:79px; display : none" alt=""/></td></tr> </table> </form>'; switch ($language) { case 'fr': $text1 = 'mot de passe oublié ?'; $text2 = 'créez votre compte'; break; default: $text1 = 'forgot you password ?'; $text2 = 'new visitor : sign up !'; break; } #echo '<div class="g-signin2" data-onsuccess="onSignIn"></div>'; echo '<p><a style="font-size:.6em" href="./frgtPwd.php">' . $text1 . '</a><br/> <a style="font-size:.6em" href="./newAcc.php">' . $text2 . '</a></p> </div>'; break; case 1: $isProdRqt = "select isProd from adherents where idadherent = " . $_SESSION['idAdherent'] . ";"; $isProdResult = getSqlData($isProdRqt, "fetch_row", "0"); echo '<div id = "navbar">'; switch ($isProdResult) { case 1: switch ($language) { case 'fr': $text = 'Voir les commandes sur mes offres en cours.'; break; default: $text = 'See the ongoing orders on my current offers.'; break; } echo '<ul><li><a href = "./viewAll.php">' . $text . '</a></li>'; switch ($language) { case 'fr': $text = 'Historique de toutes les commandes'; break; default: $text = '"All offers" history'; break; } echo '<li><i><a href = "./synthAll.php">' . $text . '</a></i></li></ul><br/>'; switch ($language) { case 'fr': $text1 = 'Offres et Produits'; $text2 = 'créer produit(s)'; $text3 = 'créer offre'; $text4 = 'alimenter offre'; $text5 = 'Modification'; $text6 = 'modifier produit(s)'; break; default: $text1 = 'offers and products'; $text2 = 'create product(s)'; $text3 = 'create offer'; $text4 = 'buil offer'; $text5 = 'modification'; $text6 = 'modify products'; break; } echo ' <p> <ol><h1><u>' . $text1 . '</u></h1> <li><a href = "./addProd.php">' . $text2 . '<a></li> <li><a href = "./newOffr.php">' . $text3 . '</a></li> <li><a href = "./choixOffre.php">' . $text4 . '</a></li> </ol> <ul><h1><u>' . $text5 . '</u></h1> <li><a href = "./seeProd.php">' . $text6 . '</a></li> </ul> </p> </div>'; break; case 0: #recherche du nombre de commandes en cours $ongoingCmdRqt = 'select count(distinct b.idOffre) from produits b inner join commandes a on a.prodId = b.id where a.status < 3 and a.idAdherent = ' . $_SESSION['idAdherent'] . ' group by b.idOffre having sum(a.qte)>0;'; $ongoingCmdResult = getSqlData($ongoingCmdRqt, 'num_rows', '0'); echo '<p><ul>'; switch ($language) { case 'fr': $text1 = 'Passer une commande'; $text2 = 'mes commandes en cours'; $text2_2 = 'Mettre à jour mes décoches'; break; default: $text1 = 'place an order'; $text2 = 'my ongoing orders'; $text2_2 = 'Mettre à jour mes décoches'; break; } echo ' <li><a href = "./setMyOrd.php">' . $text1 . '</a></li> <li><a href="./seeMyCmd.php">' . $text2 . ' (<strong>' . $ongoingCmdResult . '</strong>)</a>'; # ids des commandes actives $activCmdIdsRqt = 'SELECT concat(c.nom, \' (\', d.prenom, \' \', d.nomF, \')\') FROM commandes a, produits b, offres c, adherents d WHERE a.idAdherent = ' . $_SESSION['idAdherent'] . ' AND d.idAdherent = c.idProducteur AND a.status <3 AND a.prodId = b.id AND c.idOffre = b.idOffre GROUP BY c.nom HAVING sum( a.qte ) >0 ;'; $superUserRqt = 'select superviseur from adherents where idAdherent = ' . $_SESSION['idAdherent'] . ';'; $superUserRqtResult = mysql_query($superUserRqt, $link); while ($row = mysql_fetch_row($superUserRqtResult)) { $isSU = $row[0]; } $activCmdIdsResult = mysql_query($activCmdIdsRqt, $link); echo '<ul>'; while ($row = mysql_fetch_row($activCmdIdsResult)) { foreach ($row as $var) { echo '<li>' . $var . '</li>'; } } echo '</ul></li>'; //décoches if ($dbName == 'amap') { $isMainAcc = getUserInfo($_SESSION['idAdherent'], 'mainAcc', 'adherents'); if ($isMainAcc == 1) { echo '<li><a href="./calDec.php">' . $text2_2 . '</a></li>'; } else { echo '<li title="vous devez d\'abord configurer votre compte dans Mes Infos"><a href="./mesInfos.php">' . $text2_2 . '</a></li>'; } } echo '</ul>'; echo '</p>'; if ($isSU == 1) { echo '<p><ul>'; switch ($language) { case 'fr': $text1 = 'SUPERVue :-)'; $text2 = 'SUPERVueDétaillée :-)'; $text2_2 = 'SUPERVision décoches !'; break; default: $text1 = 'SUPERView :-)'; $text2 = 'detailedSUPERView :-)'; $text2_2 = 'SUPERVision décoches !'; break; } echo '<li class="super"><a href = "./synthAll.php">' . $text1 . '</a></li>'; echo '<li class="super"><a href = "./viewAll.php">' . $text2 . '</a></li>'; echo '<li class="super"><a href = "./manDec.php">' . $text2_2 . '</a></li>'; echo '</ul></p>'; } echo '</div>'; break; } switch ($language) { case 'fr': $text1 = 'mes infos'; $text2 = 'se déconnecter'; break; default: $text1 = 'my info'; $text2 = 'log out'; break; } echo '<div class = "main"><img style = "width:431px; height:655px" src="./customize/images/' . $dbName . 'Logo.png"/></div> <div id = "discodiv"> <ul> <li> <a href="mesInfos.php">' . $text1 . '</a> </li> <li> <a href="./disconnect.php">' . $text2 . '</a> </li> </ul> </div>'; } }