function Cnx() { $this->link = StaticConnection::getHandle(); self::$host = ''; self::$login_mysql = ''; self::$password_mysql = ''; self::$db = ''; }
function __construct() { parent::__construct(); }
function bouclePage($texte, $args) { global $page, $id_rubrique, $id_dossier; // récupération des arguments $num = lireTag($args, "num", "int"); $courante = lireTag($args, "courante", "int"); $pagecourante = lireTag($args, "pagecourante", "int"); $typeaff = lireTag($args, "typeaff", "int"); $max = lireTag($args, "max", "int"); $affmin = lireTag($args, "affmin", "int"); $avance = lireTag($args, "avance", "string"); $type_page = lireTag($args, "type_page", "int"); /** PARAMÈTRES DÉPRÉCIÉS, A NE PLUS UTILISER */ $deb = lireTag($args, "deb", "int"); $totbloc = lireTag($args, "totbloc", "int"); /** FIN PARAMÈTRES DÉPRÉCIÉS */ $i = ""; if ($page <= 0) { $page = 1; } $bpage = $page; $res = ""; $cnx = new Cnx(); if (!$type_page) { $query = boucleProduit($texte, str_replace("num", "null", $args), 1); } else { $query = boucleContenu($texte, str_replace("num", "null", $args), 1); } if ($query != "") { $pos = strpos($query, "limit"); if ($pos > 0) { $query = substr($query, 0, $pos); } $resul = $cnx->query($query); $nbres = $cnx->num_rows($resul); } else { $nbres = 0; } $page = $bpage; $nbpage = $num ? ceil($nbres / $num) : 0; if ($page + 1 > $nbpage) { $pagesuiv = $page; } else { $pagesuiv = $page + 1; } if ($page - 1 <= 0) { $pageprec = 1; } else { $pageprec = $page - 1; } if ($nbpage < $affmin) { return; } if ($nbpage == 1) { return; } if ($typeaff == 1) { if (!$max) { $max = $nbpage + 1; } if ($page && $max && $page > $max) { $i = ceil($page / $max) * $max - $max + 1; } if ($i == 0) { $i = 1; } $fin = $i + $max; for (; $i < $nbpage + 1 && $i < $fin; $i++) { $temp = str_replace("#PAGE_NUM", "{$i}", $texte); $temp = str_replace("#PAGE_SUIV", "{$pagesuiv}", $temp); $temp = str_replace("#PAGE_PREC", "{$pageprec}", $temp); $temp = str_replace("#RUBRIQUE", "{$id_rubrique}", $temp); $temp = str_replace("#DOSSIER", "{$id_dossier}", $temp); if ($pagecourante && $pagecourante == $i) { if ($courante == "1" && $page == $i) { $res .= $temp; } else { if ($courante == "0" && $page != $i) { $res .= $temp; } else { if ($courante == "") { $res .= $temp; } } } } else { if (!$pagecourante) { $res .= $temp; } } } } else { if ($typeaff == "0" && ($avance == "precedente" && $pageprec != $page)) { $temp = str_replace("#PAGE_NUM", "{$page}", $texte); $temp = str_replace("#PAGE_PREC", "{$pageprec}", $temp); $temp = str_replace("#RUBRIQUE", "{$id_rubrique}", $temp); $temp = str_replace("#DOSSIER", "{$id_dossier}", $temp); $res .= $temp; } else { if ($typeaff == "0" && ($avance == "suivante" && $pagesuiv != $page)) { $temp = str_replace("#PAGE_NUM", "{$page}", $texte); $temp = str_replace("#PAGE_SUIV", "{$pagesuiv}", $temp); $temp = str_replace("#RUBRIQUE", "{$id_rubrique}", $temp); $temp = str_replace("#DOSSIER", "{$id_dossier}", $temp); $res .= $temp; } else { if ($typeaff == "0" && $avance == "") { $temp = str_replace("#PAGE_NUM", "{$page}", $texte); $temp = str_replace("#PAGE_SUIV", "{$pagesuiv}", $temp); $temp = str_replace("#PAGE_PREC", "{$pageprec}", $temp); $temp = str_replace("#RUBRIQUE", "{$id_rubrique}", $temp); $temp = str_replace("#DOSSIER", "{$id_dossier}", $temp); $res .= $temp; } else { if ($typeaff == "2") { /** DEPREACTED le typeaff 2 n'est plus utilisé, concervé pour rétrocompatibilité */ if (!$deb) { $deb = 0; } if ($page) { $_SESSION['navig']->page = $page; } if (!$page || $page == 1) { $page = 0; } if (!$totbloc) { $totbloc = 1; } if ($page) { $deb = ($page - 1) * $totbloc * $num + $deb; } $fin = $deb + $num; $query = str_replace("*", "count(*) as max", $query); $resul = $cnx->query($query); $max = $cnx->get_result($resul, 0, "max"); if ($fin > $max) { $fin = $max; } $temp = str_replace("#DEBUT", $deb, $texte); $temp = str_replace("#FIN", $fin, $temp); $temp = str_replace("#MAX", $max, $temp); $res .= $temp; /** END DEPRECATED */ } } } } } return $res; }
/*************************************************************************************/ require_once "pre.php"; require_once "auth.php"; require_once "../lib/magpierss/extlib/Snoopy.class.inc"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php require_once "title.php"; ?> </head> <?php $cnx = new Cnx(); function get_result($query) { global $cnx; $resul = $cnx->query($query); return $resul ? $cnx->get_result($resul, 0, 0) : 0; } $cond_commande_paye = "statut >= " . Commande::PAYE . " and statut <> " . Commande::ANNULE; $in_commande_paye = "select id from " . Commande::TABLE . " where {$cond_commande_paye}"; $nbclient = get_result("select count(*) as nb from " . Client::TABLE); $nbproduit = get_result("select count(*) as nb from " . Produit::TABLE); $nbcmdinstance = get_result("select count(*) as nb from " . Commande::TABLE . " where statut < " . Commande::TRAITEMENT); $nbcmdtraitement = get_result("select count(*) as nb from " . Commande::TABLE . " where statut = " . Commande::TRAITEMENT); $nbcmdlivree = get_result("select count(*) as nb from " . Commande::TABLE . " where statut = " . Commande::EXPEDIE); $nbproduitenligne = get_result("select count(*) as nb from " . Produit::TABLE . " where ligne=1"); $nbproduithorsligne = $nbproduit - $nbproduitenligne;