public function indexAction()
 {
     if ($this->values['permisos']['permisosModulo']['UP']) {
         $agentes = new Agentes();
         $zonas = new Zonas();
         $this->values['comerciales'] = $agentes->getComerciales('', $_SESSION['suc'], false);
         $this->values['zonas'] = $zonas->fetchAll($_SESSION['suc']);
         unset($agentes);
         unset($zonas);
         $template = $this->entity . '/index.html.twig';
     } else {
         $template = "_global/forbiden.html.twig";
     }
     return array('template' => $template, 'values' => $this->values);
 }
Example #2
0
/**
 * Construye un tag html <select> con todas las zonas comerciales de una sucursal.
 * @param integer $idSucursal ID de la sucursal
 * @return string Codigo html con el tag select
 */
function zonasSucursal($idSucursal = '')
{
    $zona = new Zonas();
    $rows = $zona->fetchAll($idSucursal);
    unset($zona);
    if ($nameSelect == '') {
        $nameSelect = $_GET['nameselect'];
    }
    if ($idSelect == '') {
        $idSelect = $_GET['idselect'];
    }
    if ($idSucursal == '') {
        $idSucursal = $_SESSION['suc'];
    }
    $ch = "<div class='Etiqueta'>Zona de Venta</div>";
    $ch .= "<select name='" . $nameSelect . "' id='" . $idSelect . "' class='Select'>";
    foreach ($rows as $row) {
        $ch .= "<option value='" . $row['Id'] . "'>" . $row['Value'] . "</option>";
    }
    $ch .= "</select>";
    return $ch;
}