Example #1
0
 public function action_ajaxdelete()
 {
     if ($this->req->idloc) {
         $db = DB::get_instance();
         $lm = new LocationManager($db);
         $loc = $lm->get($this->req->idloc);
         echo var_dump($loc);
         echo var_dump($this->req->idloc);
         if ($loc) {
             $lm->delete($loc);
         }
         exit;
     }
 }
<?php

//$city = isset($_GET['q'])?$_GET['q']:"";
require_once '../config.php';
require_once BUSINESS_DIR_LOCATION . 'LocationManager.php';
$city = isset($_POST['city']) ? $_POST['city'] : "";
//$city="Mazar-e-Sharif";
if ($city == "") {
    echo "";
}
$LocationManager = new LocationManager();
$province = $LocationManager->getProvinceByCityName($city);
//$country="";
$country = $LocationManager->getCountryByProvinceName($province->getProvinceName());
echo $province->getProvinceName() . "," . $country->getCountryName() . "\n";
Example #3
0
        $usertype = $Locations->getUserType();
        $regdate = $Locations->getRegistrationDate();
        $location = $Locations->getLocation();
        $mediaid = $Locations->getMediaId();
        $ratingid = $Locations->getUserRatingId();
        $emailsub = $Locations->getEmailSub();
        ?>
        <?php 
        echo "The user is: " . $fname . "<br>";
        ?>
        <?php 
    }
    // end of foreach loop
}
// end of if statement
$LocationManager = new LocationManager();
$Locations = $LocationManager->getUserByLocation(1);
echo "<br/><br/><br/><b>Locations BY LOCATION</b><br>";
$userCount = count($Locations);
if ($userCount > 0) {
    foreach ($Locations as $Locations) {
        $uid = $Locations->getUserId();
        $fname = $Locations->getFirstName();
        $lname = $Locations->getLastName();
        $pwd = $Locations->getPassword();
        $loginid = $Locations->getLogin();
        $email = $Locations->getEmail();
        $dob = $Locations->getDOB();
        $language = $Locations->getUserLanguage();
        $usertype = $Locations->getUserType();
        $regdate = $Locations->getRegistrationDate();
Example #4
0
// tell the client that it is a JSON object
header('content-type: application/json; charset=utf-8');
require_once "../tools/UtilityManager.class.php";
require_once "../tools/LocationManager.class.php";
if (isset($_GET['agency'])) {
    $agencyShortName = $_GET['agency'];
} else {
    $agencyShortName = "";
}
$date = $_GET["date"];
$typeid = "";
if (isset($_GET['year'])) {
    $typeid = $_GET["typeid"];
    if ($util->IsNumber($typeid) == false) {
        $typeid = "";
    }
}
// do some sanity checking
$util = new UtilityManager();
if ($date == "" || $util->IsValidDate($date) == 0 || $util->IsValidDate($date) == False) {
    // not a valid date, set to today's date
    $date = date("Y-m-d");
}
$mgr = new LocationManager();
if ($typeid == "") {
    $locations = $mgr->GetLocationsByDay($date, $agencyShortName);
    echo json_encode($locations);
} else {
    $locations = $mgr->GetLocationsByDayByType($date, $typeid);
    echo '{"typeid": "' . $typeid . '", "locations": ' . json_encode($locations) . '}';
}
Example #5
0
<?php

//  	include "../../config.php";
include "header.php";
require_once BUSINESS_DIR_USER . 'UserManager.php';
require_once BUSINESS_DIR_LOCATION . 'LocationManager.php';
require_once BUSINESS_DIR_ENTRY . "EntryManager.php";
require_once BUSINESS_DIR_ENTRY . "Entry.php";
require_once BUSINESS_DIR_RATING . 'RatingManager.php';
require_once BUSINESS_DIR_RATING . 'Rating.php';
$userManager = new UserManager();
$locationManager = new LocationManager();
$EntryManager = new EntryManager();
$Rating = new RatingManager();
$userId = intval($_GET["id"]);
// for profile update permission
$user_id = 0;
//    if ($userId =="")
//    {
//        //redirect to homepage
//        header("Location: http://localhost/tarboz/");
//    }
if (isset($_SESSION['user'])) {
    $user = $_SESSION['user'];
    $user_id = $user->getUserId();
}
$User_Login = $userManager->getUserByUserId($userId);
$id = $User_Login->getUserId();
$fname = $User_Login->getFirstName();
$lname = $User_Login->getLastName();
$email = $User_Login->getEmail();
Example #6
0
    <?php 
// Include utility files
require_once '../config.php';
require_once BUSINESS_DIR_LOCATION . 'LocationManager.php';
$LocationManager = new LocationManager();
$arrayval[] = "";
$Country = $LocationManager->getCountries();
echo "<br/><br/><br/><b>See All Countries</b><br>";
$userCount = count($Country);
$i = 0;
if ($userCount > 0) {
    foreach ($Country as $country) {
        $i++;
        $countryid = $country->getCountryId();
        $countryname = $country->getCountryName();
        $countrycode = $country->getCountryCode();
        $arrayval[$i] = $countryname;
        echo "The user is: testest" . $countryname . "<br/>";
    }
    // end of foreach loop
    //$data = json_encode($arrayval);
}
// end of if statement
//For Provinces
$provincesbycountryid = $LocationManager->getProvincesByCountryId(1);
$getProvincesByCountryName = $LocationManager->getProvincesByCountryName("AfghAnistan");
$citybyCountryid = $LocationManager->getCitiesByCountryId(1);
$citybyprovinceid = $LocationManager->getCitiesByProvinceId(1);
echo "<br/><br/><br/><b>Provinces by CountryId</b><br>";
$userCount = count($provincesbycountryid);
if ($userCount > 0) {
 /**
  * @param bool|string   $caller the calling directory
  * @return array
  */
 protected static function get_locations_caller($caller = false)
 {
     $locs = array();
     if ($caller && is_string($caller)) {
         $caller = realpath($caller);
         if (is_dir($caller)) {
             $locs[] = $caller;
         }
         $caller = trailingslashit($caller);
         foreach (LocationManager::get_locations_theme_dir() as $dirname) {
             $caller_sub = realpath($caller . $dirname);
             if (is_dir($caller_sub)) {
                 $locs[] = $caller_sub;
             }
         }
     }
     return $locs;
 }
        case 'CHANGE_AVATAR':
            echo UserManager::changeUserAvatar($_REQUEST['id'], $_REQUEST['avatar']);
            break;
        case 'UPDATE_GCMID':
            echo UserManager::updateGcmId($_REQUEST['id'], $_REQUEST['gcmid']);
            break;
        case 'SET_PUBLIC':
            echo UserManager::setPublic($_REQUEST['id'], $_REQUEST['ispublic']);
            break;
        case 'GET_NEW_USERLIST':
            echo json_encode(UserManager::getNewUserIdListByNumberList($_REQUEST['id'], $_REQUEST['numberlist']));
            break;
        case 'FIND_IN_DISTANCE':
            echo json_encode(LocationManager::getUserInDistance($_REQUEST['lat'], $_REQUEST['lng'], $_REQUEST['d']));
            break;
        case 'FIND_IN_CURRENT_ADDRESS':
            echo json_encode(LocationManager::getUserInCurAddress($_REQUEST['addr']));
            break;
            /*case 'FIND_IN_ADDRESS':
            		echo json_encode(array('users'=>UserManager::getUserByAddress($_REQUEST['addr'])));
            		break;*/
        /*case 'FIND_IN_ADDRESS':
        		echo json_encode(array('users'=>UserManager::getUserByAddress($_REQUEST['addr'])));
        		break;*/
        default:
            echo "Unknown type";
            break;
    }
} else {
    echo "You don't have permission!";
}
Example #9
0
<?php

//$city = isset($_GET['q'])?$_GET['q']:"";
require_once '../config.php';
require_once BUSINESS_DIR_LOCATION . 'LocationManager.php';
//$city="To";
$city = isset($_GET['q']) ? $_GET['q'] : "";
$LocationManager = new LocationManager();
$arrayval[] = "";
$City = $LocationManager->searchCity($city);
//echo "<br/><br/><br/><b>See All Countries</b><br>";
$userCount = count($City);
$i = 0;
if ($userCount > 0) {
    foreach ($City as $city) {
        $i++;
        //$countryid = $city->getCountryId();
        echo $city->getCityName() . "\n";
    }
    // end of foreach loop
}
// end of if statement
Example #10
0
        $_hx = array("uid", "fid", "share");
        $_tbx = FriendManager::getAllFriendList();
        show($_hx, $_tbx);
        break;
    case "c":
        echo "<h1 style='color:#09C'>CHAT DATA</h1>";
        require_once "chats.php";
        $_hx = array("timest", "sender", "recipient", "msg");
        $_tbx = ChatsManager::getAllChats();
        show($_hx, $_tbx);
        break;
    case "h":
        echo "<h1 style='color:#09C'>HISTORY DATA</h1>";
        require_once "history.php";
        $_hx = array("timest", "lat", "lng");
        $_tbx = HistoryManager::getAllUserHistory();
        show($_hx, $_tbx);
        break;
    case "l":
        echo "<h1 style='color:#09C'>LOCATION DATA</h1>";
        require_once "location.php";
        $_hx = array("lat", "lng", "street", "sublocality", "locality", "adminstrative_area", "country", "fulladdr");
        $_tbx = LocationManager::getAllLocationData();
        show($_hx, $_tbx);
        break;
    default:
        break;
}
?>
</body>
</html>
Example #11
0
 /**
  * @param bool|string   $caller the calling directory or false
  */
 public function __construct($caller = false)
 {
     $this->locations = LocationManager::get_locations($caller);
     $this->cache_mode = apply_filters('timber_cache_mode', $this->cache_mode);
     $this->cache_mode = apply_filters('timber/cache/mode', $this->cache_mode);
 }
Example #12
0
 public function action_valide()
 {
     $flag = false;
     if ($this->req->dateloc and $this->req->daterendu) {
         $locm = $this->req->datelocm;
         $loch = $this->req->dateloch;
         $rendum = $this->req->daterendum;
         $renduh = $this->req->daterenduh;
         //$this->site->ajouter_message($this->req->dateloc ."h ". $this->req->dateloch."_".$this->req->datelocm ."____".$this->req->daterendu ."h ". $this->req->daterenduh."_".$this->req->daterendum);
         if ($this->req->dateloc > $this->req->daterendu) {
             $this->site->ajouter_message("loc> rendu");
         } else {
             if ($this->req->dateloc == $this->req->daterendu) {
                 if ($loch + 6 > $renduh) {
                     $this->site->ajouter_message("loc = rendu mais hloc>hrendu car durée minimal d'une location =6heure");
                     $flag = true;
                 } else {
                     if ($loch == $renduh) {
                         $this->site->ajouter_message("Durée minimal d'une location = 6heures");
                         $flag = true;
                     }
                 }
             }
         }
         //On récupère les locations de la voiture concerné pour vérifié que les date voulu par l'utilisateur sont libre.
         $lm = new LocationManager(DB::get_instance());
         $info = $lm->infoLoc($this->req->id);
         //dateloc et daterendu sont les date rentrer par l'utilisateur
         $dateloc = $this->req->dateloc . " " . $this->req->dateloch . ":" . $this->req->datelocm . ":00";
         $daterendu = $this->req->daterendu . " " . $this->req->daterenduh . ":" . $this->req->daterendum . ":00";
         $dateloc = new DateTime($dateloc);
         $dateloc = $dateloc->format('YmdHis');
         $daterendu = new DateTime($daterendu);
         $daterendu = $daterendu->format('YmdHis');
         foreach ($info as $i) {
             // date à tester :
             $start = $i->getDateLoc();
             $stop = $i->getDateRendu();
             $now = date('Y-m-d H:i:s', time() + 3600);
             //Date actuelle.
             //$tmp2=explode(" ",$l->getDateRendu());
             // $finloc=$l->getDateRendu();
             // $debloc =$l->getDateLoc();
             // on transforme les date en objet datetime. format YYYYMMDDHHMMSS ( 2009-10-10 10:00:00 donnera 20091010100000).
             //start et stop sont les date de debut/fin des différent location enregistrer en DB
             $start = new DateTime($start);
             $start = $start->format('YmdHis');
             $stop = new DateTime($stop);
             $stop = $stop->format('YmdHis');
             $now = new DateTime($now);
             $now = $now->format('YmdHis');
             /*
             $debloc = new DateTime($debloc);
             $debloc = $debloc->format('YmdHis');
             $finloc = new DateTime($finloc);
             $finloc = $finloc->format('YmdHis');
             */
             if ($start <= $dateloc && $stop >= $dateloc || ($dateloc <= $now || $daterendu <= $now) || $start <= $daterendu && $stop >= $daterendu) {
                 $flag = true;
             }
         }
         //location pas encore completement au point
         if (!$flag) {
             $user = $this->session->user;
             $l['dateLoc'] = $this->req->dateloc . " " . $loch . ":" . $locm . ":00";
             $l['dateRendu'] = $this->req->daterendu . " " . $renduh . ":" . $rendum . ":00";
             $l['prixLoc'] = "75000";
             //prix arbitraire temporaire
             $l['idVoiture'] = $this->req->id;
             $l['idClient'] = $user->getIdClient();
             $loc = new Location($l);
             $lm->add($loc);
             $this->site->ajouter_message("Location enregistrée!");
             Site::redirect("index");
         } else {
             $this->site->ajouter_message("Vos dates de location ne sont pas valide.");
         }
     } else {
         $this->site->ajouter_message("date loc ou date rendu non renseigné");
     }
     Site::redirect("loc", "rent&id=" . $this->req->id);
 }
 public function edit_post()
 {
     $Location = $this->obj;
     $LocationMan = new LocationManager();
     $this->HookManager->event[] = 'LOCATION_EDIT_POST';
     $this->HookManager->processEvent('LOCATION_EDIT_POST', array('Location' => &$Location));
     try {
         if ($_REQUEST['name'] != $Location->get('name') && $LocationMan->exists($_REQUEST['name'])) {
             throw new Exception('A location with that name already exists.');
         }
         if ($_REQUEST['update']) {
             if ($_REQUEST['storagegroup']) {
                 $Location->set('name', $_REQUEST['name'])->set('storageGroupID', $_REQUEST['storagegroup']);
             }
             $Location->set('storageNodeID', $_REQUEST['storagenode'])->set('tftp', $_REQUEST['tftp']);
             if ($Location->save()) {
                 $this->FOGCore->setMessage('Location Updated');
                 $this->FOGCore->redirect('?node=location&sub=edit&id=' . $Location->get('id'));
             }
         }
     } catch (Exception $e) {
         $this->FOGCore->setMessage($e->getMessage());
         $this->FOGCore->redirect($this->formAction);
     }
 }
<?php

require 'history.php';
require "appmanager.php";
require "location.php";
if (AppManager::checkAppCode($_REQUEST['appcode'])) {
    switch ($_REQUEST['type']) {
        case 'GET_HISTORY':
            echo json_encode(array("history" => HistoryManager::getUserHistory($_REQUEST['id'])));
            break;
        case 'GET_LAST_LOCATION':
            echo json_encode(HistoryManager::getLastUserHistory($_REQUEST['id']));
            break;
        case 'CREATE_HISTORY':
            $rs = HistoryManager::addNewHistory($_REQUEST['id'], new History(NULL, $_REQUEST['latitude'], $_REQUEST['longtitude']));
            if ($rs > 0) {
                $rs = LocationManager::updateNewLocation($_REQUEST['id'], $_REQUEST['latitude'], $_REQUEST['longtitude']);
            }
            echo $rs;
            break;
        case 'REMOVE_HISTORY':
            echo HistoryManager::removeHistory($_REQUEST['id']);
            break;
        default:
            echo "Unknown type";
            break;
    }
}