示例#1
0
function transport($id)
{
    $transzone = new Transzone();
    $pays = new Pays();
    if (intval($_SESSION['navig']->adresse) > 0) {
        $adr = new Adresse();
        $adr->charger($_SESSION['navig']->adresse);
        $pays->charger($adr->pays);
    } else {
        $pays->charger($_SESSION['navig']->client->pays);
    }
    if (!$transzone->charger($id, $pays->zone)) {
        $_SESSION['navig']->commande->transport = "";
        return;
    }
    $_SESSION['navig']->commande->transport = $id;
}
示例#2
0
function modifier_transports($idtransport)
{
    $transzone = new Transzone();
    $zone = new Zone();
    $tr = new Modules();
    if ($tr->charger_id($_GET['id'])) {
        $zone = new Zone();
        ?>
		<div class="entete_liste_config" style="margin-top:15px;">
			<div class="titre"><?php 
        echo trad('MODIFICATION_TRANSPORT', 'admin') . ' ' . ActionsAdminModules::instance()->lire_titre_module($tr);
        ?>
</div>
		</div>

		<ul class="ligne1">
			<li style="width:250px;">
				<select class="form_select" id="zone">
				<?php 
        $query = "select * from {$zone->table}";
        $resul = $transzone->query($query);
        while ($resul && ($row = $transzone->fetch_object($resul))) {
            $test = new Transzone();
            if (!$test->charger($idtransport, $row->id)) {
                ?>
		     	<option value="<?php 
                echo $row->id;
                ?>
"><?php 
                echo $row->nom;
                ?>
</option>
		     	<?php 
            }
        }
        ?>
				</select>
			</li>
			<li><a href="javascript:ajouter($('#zone').val())"><?php 
        echo trad('AJOUTER_ZONE', 'admin');
        ?>
</a></li>
		</ul>

		<?php 
        $query = "select * from {$transzone->table} where transport=\"" . $idtransport . "\"";
        $resul = $transzone->query($query);
        $i = 0;
        while ($resul && ($row = $transzone->fetch_object($resul))) {
            $zone = new Zone();
            $zone->charger($row->zone);
            $fond = "ligne_" . ($i++ % 2 ? "fonce" : "claire") . "_BlocDescription";
            ?>
			<ul class="<?php 
            echo $fond;
            ?>
">
					<li style="width:492px;"><?php 
            echo $zone->nom;
            ?>
</li>
					<li style="width:32px;"><a href="javascript:supprimer(<?php 
            echo $row->id;
            ?>
)"><?php 
            echo trad('Supprimer', 'admin');
            ?>
</a></li>
			</ul>
			<?php 
        }
    }
}
示例#3
0
<?php

require_once __DIR__ . "/../auth.php";
require_once __DIR__ . "/../../fonctions/divers.php";
if (!est_autorise("acces_configuration")) {
    exit;
}
$request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
if ($request->isXmlHttpRequest() === false) {
    redirige("../accueil.php");
}
header('Content-Type: text/html; charset=utf-8');
if ($request->query->get('action') == "supprimer" && $request->query->get('zone', "") != "") {
    $transzone = new Transzone();
    $transzone->charger_id($request->query->get('zone'));
    $transzone->delete();
    echo 1;
} else {
    if ($request->query->get('action') == "ajouter" && $request->query->get('id', "") != "" && $request->query->get('zone', "") != "") {
        $transzone = new Transzone();
        $transzone->zone = $request->query->get('zone');
        $transzone->transport = $request->query->get('id');
        $id = $transzone->add();
        echo json_encode(array("res" => 1, "id" => $id));
    }
}
示例#4
0
function boucleTransport($texte, $args)
{
    // récupération des arguments
    $id = lireTag($args, "id", "int_list");
    $nom = lireTag($args, "nom", "string");
    $exclusion = lireTag($args, "exclusion", "string_list");
    $idpays = intval(lireTag($args, "pays", "int"));
    $cpostal = intval(lireTag($args, "cpostal", "string"));
    $montantmini = intval(lireTag($args, "montantmini", "float"));
    $search = "";
    $res = "";
    if ($id != "") {
        $search .= "and id in ({$id})";
    }
    if ($nom != "") {
        $search .= "and nom=\"{$nom}\"";
    }
    if ($exclusion != "") {
        $liste = "";
        $tabexcl = explode(",", $exclusion);
        for ($i = 0; $i < count($tabexcl); $i++) {
            $liste .= "'" . $tabexcl[$i] . "'" . ",";
        }
        $liste = rtrim($liste, ",");
        $search .= " and nom not in ({$liste})";
    }
    $modules = new Modules();
    $query = "select * from {$modules->table} where type='2' and actif='1' {$search} order by classement";
    $resul = CacheBase::getCache()->query($query);
    if (empty($resul)) {
        return "";
    }
    $pays = new Pays();
    if ($idpays > 0) {
        $pays->charger($idpays);
    } else {
        if ($_SESSION['navig']->adresse != "" && $_SESSION['navig']->adresse != 0) {
            $adr = new Adresse();
            $adr->charger($_SESSION['navig']->adresse);
            $pays->charger($adr->pays);
        } else {
            $pays->charger($_SESSION['navig']->client->pays);
        }
    }
    $transzone = new Transzone();
    $compt = 0;
    foreach ($resul as $row) {
        if (!$transzone->charger($row->id, $pays->zone)) {
            continue;
        }
        $compt++;
        $modules = new Modules();
        $modules->charger_id($row->id);
        try {
            $instance = ActionsModules::instance()->instancier($modules->nom);
            $port = round(port($row->id, $pays->id, $cpostal), 2);
            $titre = $instance->getTitre();
            $chapo = $instance->getChapo();
            $description = $instance->getDescription();
        } catch (Exception $ex) {
            $titre = $chapo = $description = '';
        }
        if ($port < $montantmini) {
            continue;
        }
        // Chercher le logo
        $exts = array('png', 'gif', 'jpeg', 'jpg');
        $logo = false;
        foreach ($exts as $ext) {
            $tmp = ActionsModules::instance()->lire_chemin_base() . "/{$row->nom}/logo.{$ext}";
            if (file_exists($tmp)) {
                $logo = ActionsModules::instance()->lire_url_base() . "/{$row->nom}/logo.{$ext}";
                break;
            }
        }
        $temp = str_replace("#NOM", $row->nom, $texte);
        $temp = str_replace("#TITRE", "{$titre}", $temp);
        $temp = str_replace("#CHAPO", "{$chapo}", $temp);
        $temp = str_replace("#DESCRIPTION", "{$description}", $temp);
        $temp = str_replace("#URLCMD", urlfond("commande", "action=transport&amp;id=" . $row->id, true), $temp);
        $temp = str_replace("#ID", "{$row->id}", $temp);
        $temp = str_replace("#LOGO", $logo, $temp);
        $temp = str_replace("#PORT", formatter_somme($port), $temp);
        $temp = str_replace("#COMPT", "{$compt}", $temp);
        $res .= $temp;
    }
    return $res;
}