function showInfoSub($respondentOrHousehold, $edit = false) { $returnStr = '<table>'; if ($respondentOrHousehold instanceof Respondent) { $returnStr .= '<tr><td style="width:100px">' . Language::labelRespondentName() . ':</td><td><b>' . $this->showInputBox('firstname', $respondentOrHousehold->getFirstName(), $edit) . '</td><td align=left>' . $this->showInputBox('lastname', $respondentOrHousehold->getLastName(), $edit) . '</b></td></tr>'; } else { $returnStr .= '<tr><td style="width:100px">' . Language::labelRespondentName() . ':</td><td><b>' . $this->showInputBox('name', $respondentOrHousehold->getName(), $edit) . '</td><td></td></tr>'; } $info1 = $this->defaultDisplayInfoAddressColumns(); //return array('address1_dec' => Language::labelDwelling(), 'city_dec' => Language::labelVillage()); foreach ($info1 as $key => $info) { $info1edit = $edit; if ($edit == true && $respondentOrHousehold instanceof Respondent) { $info1edit = false; } $returnStr .= '<tr><td>' . $info . ':</td><td colspan=2 style="width:200px">' . $this->showInputBox(rtrim($key, '_dec'), $respondentOrHousehold->getDataByField($key), $info1edit) . '</td></tr>'; } //SET THIS THROUGH defaultDisplayInfo1AddressColumns // $returnStr .= '<tr><td valign=top>Address 1:</td><td colspan=2 style="width:200px">' . $this->showInputBox('address1', $respondentOrHousehold->getAddress1(), $edit) . '</td></tr>'; // $returnStr .= '<tr><td>Address 2:</td><td colspan=2>' . $this->showInputBox('address2', $respondentOrHousehold->getAddress2(), $edit) . '</td></tr>'; // $returnStr .= '<tr><td>City / Zip:</td><td>' . $this->showInputBox('city', $respondentOrHousehold->getCity(), $edit) . '</td><td>' . $this->showInputBox('zip', $respondentOrHousehold->getZip(), $edit) . '</td></tr>'; $returnStr .= '<tr><td colspan=3><hr></td></tr>'; $info2 = $this->defaultDisplayInfo2AddressColumns(); //return array('telephone1_dec' => Language::labelTelephone()); foreach ($info2 as $key => $info) { $returnStr .= '<tr><td>' . $info . ':</td><td colspan=2 style="width:200px">' . $this->showInputBox(rtrim($key, '_dec'), $respondentOrHousehold->getDataByField($key), $edit) . '</td></tr>'; } //SET THIS THROUGH defaultDisplayInfo2AddressColumns // $returnStr .= '<tr><td>Telephone:</td><td colspan=2>' . $this->showInputBox('telephone1', $respondentOrHousehold->getTelephone1(), $edit) . '</td></tr>'; // $returnStr .= '<tr><td>Email:</td><td colspan=2>' . $this->showInputBox('email', $respondentOrHousehold->getEmail(), $edit) . '</td></tr>'; // $returnStr .= '<tr><td>Fax:</td><td colspan=2>' . $this->showInputBox('fax', $respondentOrHousehold->getTelephone2(), $edit) . '</td></tr>'; // $returnStr .= '<tr><td>Email:</td><td colspan=2>' . $this->showInputBox('email', $respondentOrHousehold->getEmail(), $edit) . '</td></tr>'; if (!$edit) { $psu = new Psu($respondentOrHousehold->getPuid()); $returnStr .= '<tr><td>' . Language::labelRespondentPSU() . ':</td><td colspan=2>' . $psu->getNumberAndName() . '</td></tr>'; if ($respondentOrHousehold->getLatitude() != '' && $respondentOrHousehold->getLatitude() != 0) { $gpsLink = ''; $user = new User($_SESSION['URID']); if ($user->getUserType() == USER_SUPERVISOR) { $psu = new Psu($respondentOrHousehold->getPuid()); $gps = new GPS($psu->getCode(), $respondentOrHousehold->getAddress1()); $gpsLink = '<a target="_" href="http://maps.google.com/?q=' . $gps->getLatitude() . ',' . $gps->getLongitude() . '"><span class="glyphicon glyphicon-screenshot"></span></a>'; } $returnStr .= '<tr><td valign=top>' . Language::labelRespondentGPS() . ': ' . $gpsLink . '</td><td colspan=2>'; $returnStr .= 'lat: ' . $respondentOrHousehold->getLatitude() . '<br/>lon:' . $respondentOrHousehold->getLongitude(); $returnStr .= '</td></tr>'; } } $returnStr .= '</table>'; return $returnStr; }
?> <!DOCTYPE html> <html> <head> <title>set GPS coordinates</title> <script type="text/javascript" src="js/socket.io.min.js"></script> </head> <body onload="sendNotification();"> <?php //The Latitude of Prilep is 41.351730000000000000. //The Longitude of Prilep is 21.562140000000000000. if (isset($_GET['device_id']) && isset($_GET['lon']) && isset($_GET['lat']) && $_GET['lon'] != "" && $_GET['lat'] != "" && $_GET['device_id'] != "") { $lon = $_GET['lon']; $lat = $_GET['lat']; $device_id = $_GET['device_id']; $gps = new GPS($lon, $lat, $device_id); $gps->save(); // insert in DB } else { $lat = $lon = 0; } ?> <div id="latitude" style="display: block;"><?php echo $lat; ?> </div> <div id="longitude" style="display: block;"><?php echo $lon; ?> </div>
function to_array($options = array()) { $options['auth'] = isset($options['auth']) ? $options['auth'] : false; $options['in_album'] = isset($options['in_album']) ? $options['in_album'] : false; $exclude = array('storage_url', 'storage_url_midsize', 'deleted', 'featured_order', 'favorite_order', 'old_slug', 'has_exif', 'has_iptc', 'tags_old'); $bools = array('featured', 'favorite'); $dates = array('uploaded_on', 'modified_on', 'captured_on', 'featured_on', 'file_modified_on', 'published_on'); $strings = array('title', 'caption'); list($data, $fields) = $this->prepare_for_output($options, $exclude, $bools, $dates, $strings); $data = Shutter::filter('api.content.before', array($data, $this, $options)); if (!$data['featured']) { unset($data['featured_on']); } if (!$data['favorite']) { unset($data['favorited_on']); } $koken_url_info = $this->config->item('koken_url_info'); if ($this->file_type != 0 && !empty($this->lg_preview)) { $preview_file = array_shift(explode(':', $this->lg_preview)); } if ($options['auth'] || $data['file_type'] != 0 || (int) $data['max_download'] === 1) { $pathinfo = pathinfo($this->filename); $path = 'storage/originals/' . str_replace(DIRECTORY_SEPARATOR, '/', $this->path) . '/' . $pathinfo['basename']; $url = $koken_url_info->base . $path; if (preg_match('/^https?:/', $this->filename)) { $data['original'] = array(); } else { if (!empty($this->storage_url)) { $data['original'] = array('url' => $this->storage_url, 'width' => (int) $this->width, 'height' => (int) $this->height); if (!empty($this->storage_url_midsize)) { $data['original']['midsize'] = $this->storage_url_midsize; } } else { $data['original'] = array('url' => $url, 'relative_url' => '/' . $path, 'width' => (int) $this->width, 'height' => (int) $this->height); } } if (isset($preview_file)) { $path .= '_previews/' . $preview_file; $url = $koken_url_info->base . $path; list($pw, $ph) = getimagesize(FCPATH . $path); $data['original']['preview'] = array('url' => $url, 'relative_url' => '/' . $path, 'width' => $pw, 'height' => $ph); } } if (!$options['auth'] && $data['visibility'] == 0) { unset($data['internal_id']); } if (!preg_match('~https?://~', $this->filename)) { $info = pathinfo($this->filename); $mimes = array('jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png', 'flv' => 'video/x-flv', 'f4v' => 'video/f4v', 'swf' => 'application/x-shockwave-flash', 'mov' => 'video/mp4', 'mp4' => 'video/mp4', 'm4v' => 'video/x-m4v', '3gp' => 'video/3gpp', '3g2' => 'video/3gpp2', 'mp3' => 'audio/mpeg'); if (array_key_exists(strtolower($info['extension']), $mimes)) { $data['mime_type'] = $mimes[strtolower($info['extension'])]; } else { if (function_exists('mime_content_type')) { $data['mime_type'] = mime_content_type($this->path_to_original()); } else { $data['mime_type'] = ''; } } } else { $data['mime_type'] = ''; } $data['__koken__'] = 'content'; if (!isset($options['include_presets']) || $options['include_presets']) { include_once FCPATH . 'app' . DIRECTORY_SEPARATOR . 'koken' . DIRECTORY_SEPARATOR . 'DarkroomUtils.php'; if ($this->file_type > 0 && empty($this->lg_preview)) { $prefix = $koken_url_info->base . 'admin/images/no-thumb,'; $data['cache_path'] = array('prefix' => $prefix, 'extension' => 'png'); $data['presets'] = array(); foreach (DarkroomUtils::$presets as $name => $opts) { $h = $opts['width'] * 2 / 3; $data['presets'][$name] = array('url' => $koken_url_info->base . "admin/images/no-thumb,{$name}.png", 'width' => $opts['width'], 'height' => round($h)); $data['presets'][$name]['cropped'] = array('url' => $koken_url_info->base . "admin/images/no-thumb,{$name}.crop.png", 'width' => $opts['width'], 'height' => $opts['width']); } } else { if ($this->file_type > 0 || !preg_match('~^https?://~', $this->filename)) { if (isset($info['extension'])) { $prefix = preg_replace("/\\.{$info['extension']}\$/", '', basename($this->filename)); } else { $prefix = basename($this->filename); } if (isset($preview_file)) { $info = pathinfo($preview_file); } $cache_base = $koken_url_info->base . (KOKEN_REWRITE ? 'storage/cache/images' : 'i.php?') . '/' . str_replace('\\', '/', $this->cache_path) . '/' . $prefix . ','; $data['cache_path'] = array('prefix' => $cache_base); $data['cache_path']['extension'] = $data['file_modified_on']['timestamp'] . '.' . $info['extension']; $data['presets'] = array(); foreach (DarkroomUtils::$presets as $name => $opts) { $dims = $this->compute_cache_size($opts['width'], $opts['height']); if ($dims) { list($w, $h) = $dims; $data['presets'][$name] = array('url' => $cache_base . "{$name}.{$data['file_modified_on']['timestamp']}.{$info['extension']}", 'hidpi_url' => $cache_base . "{$name}.2x.{$data['file_modified_on']['timestamp']}.{$info['extension']}", 'width' => (int) $w, 'height' => (int) $h); list($cx, $cy) = $this->compute_cache_size($opts['width'], $opts['height'], true); $data['presets'][$name]['cropped'] = array('url' => $cache_base . "{$name}.crop.{$data['file_modified_on']['timestamp']}.{$info['extension']}", 'hidpi_url' => $cache_base . "{$name}.crop.2x.{$data['file_modified_on']['timestamp']}.{$info['extension']}", 'width' => (int) $cx, 'height' => (int) $cy); } } } } } if ($data['file_type'] == 0) { unset($data['duration']); } if (array_key_exists('duration', $data)) { $r = $data['duration']; $data['duration'] = array(); $data['duration']['raw'] = $r; $m = floor($r / 60); $s = str_pad(floor($r % 60), 2, '0', STR_PAD_LEFT); if ($m > 60) { $h = floor($m / 60); $m = str_pad(floor($m % 60), 2, '0', STR_PAD_LEFT); $m = "{$h}:{$m}"; } $data['duration']['clean'] = "{$m}:{$s}"; } $data['iptc'] = $data['iptc_fields'] = $data['exif'] = $data['exif_fields'] = array(); if ($this->has_iptc) { list($data['iptc'], $data['iptc_fields']) = $this->iptc_to_human(); } $data['geolocation'] = false; if ($this->has_exif) { if (!isset($options['exif'])) { $options['exif'] = 'all'; } $exif = $this->_get_exif_data(); if (isset($exif['GPS']['GPSLatitude'])) { include_once FCPATH . 'app' . DIRECTORY_SEPARATOR . 'koken' . DIRECTORY_SEPARATOR . 'gps.php'; $gps = new GPS($exif['GPS']); $data['geolocation'] = array('latitude' => rtrim(sprintf('%.12f', $gps->latitude()), '0'), 'longitude' => rtrim(sprintf('%.12f', $gps->longitude()), '0')); } list($data['exif'], $data['exif_fields']) = $this->exif_to_human($data['exif'], $options['exif']); } if (array_key_exists('file_type', $data)) { switch ($data['file_type']) { // TODO: Make this array and include mime type? Ehhh? case 0: $data['file_type'] = 'image'; break; case 1: $data['file_type'] = 'video'; break; case 2: $data['file_type'] = 'audio'; break; } } if (array_key_exists('visibility', $data)) { switch ($data['visibility']) { case 1: $raw = 'unlisted'; break; case 2: $raw = 'private'; break; default: $raw = 'public'; break; } $data['visibility'] = array('raw' => $raw, 'clean' => ucwords($raw)); $data['public'] = $raw === 'public'; } if (array_key_exists('max_download', $data)) { switch ($data['max_download']) { case 0: $data['max_download'] = 'none'; $clean = 'None'; break; case 1: $data['max_download'] = 'original'; $clean = 'Original'; break; case 2: $data['max_download'] = 'huge'; $clean = 'Huge (2048)'; break; case 3: $data['max_download'] = 'xlarge'; $clean = 'X-Large (1600)'; break; case 4: $data['max_download'] = 'large'; $clean = 'Large (1024)'; break; case 5: $data['max_download'] = 'medium_large'; $clean = 'Medium-Large (800)'; break; case 6: $data['max_download'] = 'medium'; $clean = 'Medium (480)'; break; } $data['max_download'] = array('raw' => $data['max_download'], 'clean' => $clean); } if (array_key_exists('license', $data) && !is_null($data['license'])) { if ($data['license'] == 'all') { $clean = '© All rights reserved'; } else { // Data is stored as commercial,modifications ... (y|n),(y,s,n) // Example: NonCommercial ShareAlike == n,s list($commercial, $mods) = explode(',', $data['license']); $license_url = 'http://creativecommons.org/licenses/by'; if ($commercial == 'y') { $clean = 'Commercial'; } else { $license_url .= '-nc'; $clean = 'NonCommercial'; } switch ($mods) { case 'y': // Nothing to do here, standard license break; case 's': $clean .= '-ShareAlike'; $license_url .= '-sa'; break; case 'n': $clean .= '-NoDerivs'; $license_url .= '-nd'; break; } $license_url .= '/3.0/deed.en_US'; } $data['license'] = array('raw' => $data['license'], 'clean' => $clean); if (isset($license_url)) { $data['license']['url'] = $license_url; } } $data['tags'] = $this->_get_tags_for_output($options); $data['categories'] = array('count' => is_null($this->category_count) ? $this->categories->count() : (int) $this->category_count, 'url' => $koken_url_info->base . 'api.php?/content/' . $data['id'] . '/categories'); $data['albums'] = array('count' => is_null($this->album_count) ? $this->albums->count() : (int) $this->album_count, 'url' => $koken_url_info->base . 'api.php?/content/' . $data['id'] . '/albums'); if (isset($options['order_by']) && in_array($options['order_by'], array('uploaded_on', 'modified_on', 'captured_on'))) { $data['date'] =& $data[$options['order_by']]; } else { $data['date'] =& $data['published_on']; } if ($data['visibility'] === 'private') { $data['url'] = false; } else { $cat = isset($options['category']) ? $options['category'] : (isset($options['context']) && strpos($options['context'], 'category-') === 0 ? str_replace('category-', '', $options['context']) : false); if ($cat) { if (is_numeric($cat)) { foreach ($this->categories->get_iterated() as $c) { if ($c->id == $cat) { $cat = $c->slug; break; } } } } $data['url'] = $this->url(array('date' => $data['published_on'], 'album' => $options['in_album'], 'tag' => isset($options['tags']) ? $options['tags'] : (isset($options['context']) && strpos($options['context'], 'tag-') === 0 ? str_replace('tag-', '', $options['context']) : false), 'category' => $cat, 'favorite' => isset($options['favorite']) || isset($options['context']) && $options['context'] === 'favorites' ? true : false, 'feature' => isset($options['featured']) || isset($options['context']) && $options['context'] === 'features' ? true : false)); if ($data['url']) { list($data['__koken_url'], $data['url']) = $data['url']; $data['canonical_url'] = $data['url']; } } if (!$options['auth'] && $data['visibility'] === 'unlisted') { unset($data['url']); } if (empty($data['source'])) { $data['source'] = false; } else { $data['source'] = array('title' => $data['source'], 'url' => $data['source_url']); } unset($data['source_url']); $final = Shutter::filter('api.content', array($data, $this, $options)); if (!isset($final['html']) || empty($final['html'])) { $final['html'] = false; } return $final; }
<?php include_once dirname(__FILE__) . '/class/Weather.php'; include_once dirname(__FILE__) . '/class/GPS.php'; if (!isset($_GET['device_id'])) { die; } else { $device_id = $_GET['device_id']; $lastPosition = GPS::getLastPosition($device_id); } ?> <!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="css/reset.css" /> <link rel="stylesheet" type="text/css" href="css/style.css" /> <title>M-Future</title> <style type="text/css"> /* Set a size for our map container, the Google Map will take up 100% of this container */ #map { height: 200px; width: 460px; margin-left: 5px; } #placeholder{height: 250px; width: 100%; margin-top: 35px; margin-bottom: 20px; background: #00080D;} </style> <script type="text/javascript" src="js/jquery.js"></script>