/**
  * locationGenerator with the coordinates data, it connects to
  * Google Place API for get more information about location.
  * This function builds a location array ready to be listed.
  *
  * @param  int    $media_id
  * @param  array  $location
  * @return array  response
  *         int    response[id] instagram media id
  *         array  response[location][geopoint] coordinates
  *         string response[location][reference] coordinate reference
  *         provides by google
  *         string response[location][address] coordinate address
  *         provides by google
  *         int    response[location][id] instragram location id
  *         string response[location][name] instragram location name
  */
 private function locationGenerator($media_id, $location)
 {
     $response = array('id' => $media_id, 'location' => null);
     if (!empty($location->latitude) && !empty($location->longitude)) {
         $google_data = $this->place->get($location->latitude, $location->longitude);
         $response['location'] = array('geopoint' => array('latitude' => $location->latitude, 'longitude' => $location->longitude), 'reference' => $google_data['reference'], 'address' => $google_data['address']);
     }
     if (!empty($location->id)) {
         $response['location']['id'] = $location->id;
     }
     if (!empty($location->name)) {
         $response['location']['name'] = $location->name;
     }
     return $response;
 }
Ejemplo n.º 2
0
                            $DCA->addHours($dow, $o, $c, $is24, 0);
                            echo "<span style='color:green;'>SET</span>";
                        } else {
                            echo "<span style='color:red;'>NOT SET</span>";
                        }
                    }
                    echo "<br><br>";
                }
                echo "<br><hr><br>";
            }
        }
    }
}
//New Place
$DLRA = new place("Disneyland Park");
$DCA = new place("Disney California Adventure Park");
//Address
$DLRA->addAddress($address1, $address2, $city, $state, $zip, $country, $latitude, $longitude);
$DCA->addAddress($address1, $address2, $city, $state, $zip, $country, $latitude2, $longitude2);
//Details
$DLRA->addDetails($phone, $type, $drivethru, $wifi, $plus18, $plus21, $alcohol, 1);
$DCA->addDetails($phone, $type, $drivethru, $wifi, $plus18, $plus21, $alcohol2, 7);
//Time Settings
$DLRA->timeSettings($timezone, $dlst);
$DCA->timeSettings($timezone, $dlst);
parseJSON($json);
if (!$DLRA->hoursSet() || !$DCA->hoursSet()) {
    echo "<h2>Loading 2nd</h2>";
    parseJSON($json2);
}
$DLRA->writeDB();
Ejemplo n.º 3
0
 function __construct($data) {
   parent::__construct($data);
   if(is_string($this->data[member_ids])) {
     $this->data[member_ids]=parse_array($this->data[member_ids]);
     $this->data[member_roles]=parse_array($this->data[member_roles]);
     load_objects($this->data[member_ids]);
     foreach($this->data[member_ids] as $i=>$mem) {
       $obj=load_object($mem);
       $this->members[]=array($obj, $this->data[member_roles][$i]);
     }
   }
 }
Ejemplo n.º 4
0
// For "custom" directory
require_once DOL_DOCUMENT_ROOT . "/core/lib/functions2.lib.php";
dol_include_once('/pos/class/place.class.php');
dol_include_once('/pos/backend/lib/place.lib.php');
if (!$user->rights->pos->backend) {
    accessforbidden();
}
$langs->load("pos@pos");
// Security check
$socid = 0;
$id = GETPOST('id');
if ($user->societe_id) {
    $socid = $user->societe_id;
}
//$result=restrictedArea($user,'pos',$id,'');
/*
 * View
 */
$helpurl = 'EN:Module_DoliPos|FR:Module_DoliPos_FR|ES:M&oacute;dulo_DoliPos';
llxHeader('', '', $helpurl);
$place = new place($db);
$place->fetch($id);
$place->info($id);
$head = place_prepare_head($place);
dol_fiche_head($head, 'info', $langs->trans("place"), 0, 'placedesk');
print '<table width="100%"><tr><td>';
dol_print_object_info($place);
print '</td></tr></table>';
print '</div>';
llxFooter();
$db->close();
Ejemplo n.º 5
0
         print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=edit&id=' . $place->id . '">' . $langs->trans("Modify") . '</a>';
     }
     $canbedeleted = $place->can_be_deleted();
     // Renvoi vrai si compte sans mouvements
     if ($user->rights->pos->backend && $canbedeleted) {
         print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $place->id . '">' . $langs->trans("Delete") . '</a>';
     }
     print '</div>';
 }
 /* ************************************************************************** */
 /*                                                                            */
 /* Edition                                                                    */
 /*                                                                            */
 /* ************************************************************************** */
 if (GETPOST("id") && $action == 'edit' && $user->rights->pos->backend) {
     $place = new place($db);
     $place->fetch(GETPOST('id', 'int'));
     print_fiche_titre($langs->trans("EditPlace"));
     print "<br>";
     print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $place->id . '" method="post" name="formsoc">';
     print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
     print '<input type="hidden" name="action" value="update">';
     print '<input type="hidden" name="id" value="' . GETPOST('id', 'int') . '">' . "\n\n";
     print '<table class="border" width="100%">';
     // Name
     print '<tr><td valign="top" class="fieldrequired">' . $langs->trans("Name") . '</td>';
     print '<td colspan="3"><input size="30" type="text" class="flat" name="name" value="' . $place->name . '"></td></tr>';
     // Description
     print '<tr><td valign="top" class="fieldrequired">' . $langs->trans("Description") . '</td>';
     print '<td colspan="3"><input size="30" type="text" class="flat" name="description" value="' . $place->description . '"></td></tr>';
     print '<tr><td align="center" colspan="4"><input value="' . $langs->trans("Modify") . '" type="submit" class="button">';
Ejemplo n.º 6
0
<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/place.php";
session_start();
if (empty($_SESSION['list_of_places'])) {
    $_SESSION['list_of_places'] = array();
}
$app = new Silex\Application();
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
$app->get("/", function () use($app) {
    return $app['twig']->render('places.html.twig', array('places' => Place::getAll()));
});
$app->post("/places", function () use($app) {
    $place = new Place($_POST['location'], $_POST['photo']);
    $place->save();
    return $app["twig"]->render('create_place.html.twig', array('newplace' => $place));
});
$app->post("/delete_places", function () use($app) {
    place::deleteAll();
    return $app['twig']->render('delete_place.html.twig');
});
return $app;
Ejemplo n.º 7
0
 print '<input type="hidden" name="sortorder" value="' . $sortorder . '">';
 print '<input class="flat" type="text" name="search_name" value="' . $search_name . '">';
 print '</td>';
 print '<td></td>';
 print '<td></td>';
 print '<td></td>';
 print '<td colspan="2" class="liste_titre" align="right">';
 print '<input type="image" class="liste_titre" name="button_search" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
 print '&nbsp; ';
 print '<input type="image" class="liste_titre" name="button_removefilter" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/searchclear.png" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
 print '</td>';
 print "</tr>\n";
 $var = True;
 while ($i < min($num, $conf->liste_limit)) {
     $obj = $db->fetch_object($resql);
     $placewil = new place($db);
     $placewil->fetch($obj->rowid);
     $var = !$var;
     print "<tr {$bc[$var]}>";
     print '<td width="30%">' . $placewil->getNomUrl(1) . '</td>';
     //print "<td>".$obj->fk_device."</td>\n";
     print '<td align="left">' . $placewil->getLibStatut(4) . '</td>';
     $url = 'place.php?id=' . $obj->rowid;
     if (!$placewil->is_inUse()) {
         if ($placewil->is_notInUse()) {
             if ($user->rights->pos->backend) {
                 print "<td></td>\n";
                 print '<td align="left">';
                 print '<form action="' . $url . '" name="free" method="POST">';
                 print '<input type="hidden" name="id" value="' . $placewil->id . '">';
                 print '<input type="hidden" name="action" value="closeplace">';
Ejemplo n.º 8
0
$hours_closed = 127;
$hours_24 = 0;
$timezone = -8;
$dlst = 1;
$hash = sha1($address1 . $address2 . $city . $state . $country . $zip);
function convertDHours($time)
{
    if (strpos($time, " ") !== FALSE) {
        $time = substr($time, 0, strpos($time, " "));
    }
    //echo "|".$time."|";
    return date("H:i:s", strtotime($time . "m"));
}
//New Place
$DLRA = new place("Disneyland Park");
$DCA = new place("Disney California Adventure Park");
//Address
$DLRA->addAddress($address1, $address2, $city, $state, $zip, $country, $latitude, $longitude);
$DCA->addAddress($address1, $address2, $city, $state, $zip, $country, $latitude2, $longitude2);
//Details
$DLRA->addDetails($phone, $type, $drivethru, $wifi, $plus18, $plus21, $alcohol, 1);
$DCA->addDetails($phone, $type, $drivethru, $wifi, $plus18, $plus21, $alcohol2, 7);
//Time Settings
$DLRA->timeSettings($timezone, $dlst);
$DCA->timeSettings($timezone, $dlst);
foreach ($json["weeks"] as $week) {
    foreach ($week as $day) {
        if ($day["id"] != NULL) {
            $date = substr($day["id"], 0, 4) . "-" . substr($day["id"], 4, 2) . "-" . substr($day["id"], -2);
            echo $date . "<br>";
            $dowe = date("l (w)", strtotime($date));
Ejemplo n.º 9
0
$form = new Form($db);
// If lib forced
if (!empty($_GET["lib"])) {
    $conf->global->MAIN_GRAPH_LIBRARY = GETPOST('lib');
}
$datetime = time();
$year = dol_print_date($datetime, "%Y");
$month = dol_print_date($datetime, "%m");
$day = dol_print_date($datetime, "%d");
if (!empty($_GET["year"])) {
    $year = sprintf("%04d", GETPOST('year'));
}
if (!empty($_GET["month"])) {
    $month = sprintf("%02d", GETPOST('month'));
}
$place = new place($db);
if ($id && !preg_match('/,/', $_id)) {
    $result = $place->fetch($id);
} elseif ($ref) {
    $result = $place->fetch($id, $ref);
    $id = $place->id;
}
$result = dol_mkdir($conf->pos->dir_temp);
if ($result < 0) {
    $langs->load("errors");
    $error++;
    $mesg = '<div class="error">' . $langs->trans("ErrorFailedToCreateDir") . '</div>';
} else {
    // Definition de $width et $height
    $width = 768;
    $height = 200;