Esempio n. 1
0
 public static function get_house()
 {
     $nhouse = rand(1, 50);
     //№ дома
     $naccess = rand(1, 5);
     //кол-во подъездов
     $nfloors = rand(1, 50);
     //кол-во этажей
     $area = rand(100, 1000);
     //площадь прилегающей территории
     $electricity = rand(0, 50);
     //потребленное электричество на этаже
     $house = new Establishment($nhouse, $naccess, $nfloors, $area, $electricity);
     for ($i = 0; $i < $naccess * $nfloors * Establishment::FLATSFLOOR; $i++) {
         $house->add_flat(self::get_flat());
     }
     return $house;
 }
Esempio n. 2
0
function viewPincho()
{
    $aux = new Establishment();
    $name = $_SESSION["name"];
    $bool = $aux->select($name);
    $id = $bool[0]["idEstablishment"];
    $p = new Pincho();
    $boolean = $p->select($id);
    if ($boolean == false) {
        header("Location: ../views/notPinchoEstablishment.php");
    } else {
        $name = $boolean["0"]["name"];
        $url = $boolean["0"]["url"];
        $description = $boolean["0"]["description"];
        $ingredients = $boolean["0"]["ingredients"];
        $price = $boolean["0"]["price"];
        header("Location: ../views/viewPinchoEstablishment.php?name={$name}&url={$url}&description={$description}&ingredients={$ingredients}&price={$price}");
    }
}
Esempio n. 3
0
 */
/**
 *  \file       	htdocs/hrm/establishment/info.php
 *  \brief      	Page to show info of an establishment
 */
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/hrm.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT . '/hrm/class/establishment.class.php';
$langs->load("admin");
$langs->load("hrm");
// Security check
if (!$user->admin) {
    accessforbidden();
}
$id = GETPOST('id', 'int');
// View
llxHeader();
if ($id) {
    $object = new Establishment($db);
    $object->fetch($id);
    $object->info($id);
    $head = establishment_prepare_head($object);
    dol_fiche_head($head, 'info', $langs->trans("Establishment"), 0, 'building');
    print '<table width="100%"><tr><td>';
    dol_print_object_info($object);
    print '</td></tr></table>';
    print '</div>';
}
llxFooter();
$db->close();
Esempio n. 4
0
$result = $db->query($sql);
if ($result) {
    $num = $db->num_rows($result);
    $i = 0;
    // Load attribute_label
    print '<table class="noborder" width="100%">';
    print "<tr class=\"liste_titre\">";
    print_liste_field_titre($langs->trans("Name"), $_SERVER["PHP_SELF"], "e.name", "", "", "", $sortfield, $sortorder);
    print_liste_field_titre($langs->trans("Address"), $_SERVER["PHP_SELF"], "e.address", "", "", "", $sortfield, $sortorder);
    print_liste_field_titre($langs->trans("Zipcode"), $_SERVER["PHP_SELF"], "e.zip", "", "", "", $sortfield, $sortorder);
    print_liste_field_titre($langs->trans("Town"), $_SERVER["PHP_SELF"], "e.town", "", "", "", $sortfield, $sortorder);
    print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "e.status", "", "", 'align="right"', $sortfield, $sortorder);
    print "</tr>\n";
    $var = true;
    if ($num > 0) {
        $establishmentstatic = new Establishment($db);
        while ($i < min($num, $limit)) {
            $obj = $db->fetch_object($result);
            $establishmentstatic->id = $obj->rowid;
            $establishmentstatic->name = $obj->name;
            $var = !$var;
            print '<tr ' . $bc[$var] . '>';
            print '<td>' . $establishmentstatic->getNomUrl(1) . '</td>';
            print '<td align="left">' . $obj->address . '</td>';
            print '<td align="left">' . $obj->zip . '</td>';
            print '<td align="left">' . $obj->town . '</td>';
            print '<td align="right">';
            print $establishmenttmp->getLibStatus(5);
            print '</td>';
            print "</tr>\n";
            $i++;
Esempio n. 5
0
<?php

require_once "../models/establishment.php";
if (isset($_POST["name"]) && isset($_POST["email"]) && isset($_POST["password"])) {
    $establishment = array();
    $establishment["name"] = $_POST["name"];
    $establishment["coordenates"] = $_POST["coordenates"];
    $establishment["phone"] = $_POST["phone"];
    $establishment["email"] = $_POST["email"];
    $establishment["schedule"] = $_POST["schedule"];
    $establishment["webpage"] = $_POST["webpage"];
    $establishment["password"] = $_POST["password"];
    $es = new Establishment();
    $boolean = $es->exists($establishment);
    if ($boolean == false) {
        $msg = "Establishment name already exists in system.";
        header("Location: ../views/signUpEstablishment.php?msg={$msg}");
    } else {
        $es->insertEstablishment($establishment);
        header("Location: ../views/signIn.php");
    }
} else {
    header("Location: ../views/signUpEstablishment.php");
}
function codeGeneration($namePopular)
{
    //Buscar el id del popular conociendo el nombre
    //Buscar el id del establecimiento actual
    //Buscar el id del pincho del establecimiento actual
    //Crear un array que contenga la id del establecimiento, la id del popular, la id del pincho y el codigo aleatorio generado, para insertarlo en la tabla codes.
    $e = new Establishment();
    $name = $_SESSION["name"];
    $bool = $e->select($name);
    if ($bool == false) {
        echo "Error del servidor";
    } else {
        $idEstablishment = $bool[0]["idEstablishment"];
        $p = new Pincho();
        $boolean = $p->select($idEstablishment);
        if ($boolean == false) {
            echo "Error del servidor";
        } else {
            $idPincho = $boolean[0]["code"];
            $popular = new Popular();
            $comp = $popular->select($namePopular);
            if ($comp == false) {
                $msg = "El popular introducido no existe";
                header("Location: ../views/generateCode.php?msg={$msg}");
            } else {
                $idPopular = $comp[0]["idPopular"];
                $codigoAleatorio = generarCodigo(10);
                $cod = new Codes();
                $tValid = $cod->isValid($codigoAleatorio);
                if ($tValid == false) {
                    $msg = "Error interno al generar el código.Repita el proceso";
                    header("Location: ../views/generateCode.php?msg={$msg}");
                } else {
                    $array = array();
                    $array["Pincho_Establishment_idEstablishment"] = $idEstablishment;
                    $array["Pincho_code"] = $idPincho;
                    $array["Popular_idPopular"] = $idPopular;
                    $array["Code"] = $codigoAleatorio;
                    $inserta = $cod->insert($array);
                    if ($inserta == true) {
                        $msg = "El codigo generado es {$codigoAleatorio}";
                        header("Location: ../views/generateCode.php?msg={$msg}");
                    } else {
                        echo "Error en la inserción";
                    }
                }
            }
        }
    }
}
Esempio n. 7
0
function getData()
{
    $e = new Establishment();
    $data = $e->selectData();
    if ($data == false) {
        $msg = "Null";
        header("Location: ../views/gastroMap.php?msg={$msg}");
    } else {
        $datos = array();
        $i = 0;
        foreach ($data as $c) {
            $datos[$i][1] = $c["name"];
            $datos[$i][2] = $c["coordenates"];
            $i = $i + 1;
        }
        $data = serialize($datos);
        header("Location: ../views/gastroMap.php?datos={$data}");
    }
}
Esempio n. 8
0
// Security check
if (!$user->admin) {
    accessforbidden();
}
$error = 0;
$action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$id = GETPOST('id', 'int');
// List of status
static $tmpstatus2label = array('0' => 'OpenEtablishment', '1' => 'CloseEtablishment');
$status2label = array('');
foreach ($tmpstatus2label as $key => $val) {
    $status2label[$key] = $langs->trans($val);
}
$object = new Establishment($db);
/*
 * Actions
 */
if ($action == 'confirm_delete' && $confirm == "yes") {
    $result = $object->delete($id);
    if ($result >= 0) {
        header("Location: ../admin/admin_establishment.php");
        exit;
    } else {
        setEventMessages($object->error, $object->errors, 'errors');
    }
} else {
    if ($action == 'add') {
        if (!$cancel) {
            $error = 0;
Esempio n. 9
0
         header("Location: ../views/homeOrganizer.php?msg={$msg}");
     } else {
         $msg = "Establishment was validated.";
         header("Location: ../views/homeOrganizer.php?msg={$msg}");
     }
 } else {
     if ($action == "eborra") {
         //A implementar en el futuro. Borrado del establecimiento.
     } else {
         if ($action == "assign") {
             header("Location: ../views/pinAssigPro.php");
         } else {
             if ($action == "management") {
                 $pro = new Professional();
                 $pop = new Popular();
                 $est = new Establishment();
                 $pin = new Pincho();
                 $establishments = serialize($est->selectAll());
                 $pinchos = serialize($pin->selectnAll());
                 $popular = serialize($pop->selectAll());
                 $professional = serialize($pro->selectAll());
                 header("Location: ../views/management.php?establishments={$establishments}&pinchos={$pinchos}&popular={$popular}&professional={$professional}");
             } else {
                 if ($action == "winner") {
                     //Seleccion de ganador del concurso
                     $p = new Pincho();
                     $finalistas = $p->selectFinalists();
                     if ($finalistas == false) {
                         $msg = "Not finalists selected by professional jury yet.";
                         header("Location: ../views/selectWinner.php?msg={$msg}");
                     } else {