ÿØÿà JFIF    ÿÛ „  ( %!1"%)+...383-7(-.+  -%%--------+------------/----------------------------ÿÀ  ¶" ÿÄ     ÿÄ @    !1AQaq‘¡"±ÁÑð2’BRráS‚ñ3b¢CT²Ò #cÿÄ    ÿÄ '   1!AQ2a"‘±#ÿÚ   ? ò(/p‘—–¢·,M|¯G»R£üešT. ôŸEoCFñ‡ 4ÔkåóxR|µÁ¨ÓDà!Ç´µ˜‡p ÍQ‹§!þž^õWsŒy  åÁ§$á«%ºq˜™JyyË0y«^Ϗ -3ÃÏËÈ£Æ\P’ä„s&•‹Üs üô'àWt¹pñCp$bÚF`·7.^)¾!)ÒÙ˜–ÅÏš^h¾ø³·ìe±ŒaeÖ—Í,e=B}Jéߦ$$½—šÙÜCC¯¶è8β–Åkèwx LÉngT±æ¹£Ócœ¿Í/©Éÿ ‰ÚCÒ­mq;Tt¶–}0"zÖPcd1š­¤tˆ„ÐÓâqú[™öUCŠ2޿د­É(¸ßúçšmW,Ò ºf‹Ån™ÄLêÁ8üÁkÁ€L¥ÍuJ1œôrÂSŒÓöt!7EUíïb)AËi¬â-ÙHk8òÁiXYwÅ)O^"ÇØriÛô{»wRUKÙÏÚlÓ¬€‚’שT ] ªb—ÊîKC^×M“xùäñz¬zJ× {4[¹M'IÆeH1LCWÕ]œûº WDæà°OÅ‚¹c²ÞuA–rL`HšpCez‡V’— Ž‚Ë„–ñ­'µR0ÕÖ=À:±G»C\nÆÉ5*¢ †3šhQ4ýÒi$Õ1"Ü]¢p-q3zcQ$ªö¨¥æf›‘»´ÝÚHá„e²JÇ–iÊ:·à¬Øc5Åk»Laª*wi [0Ówk ¦a¦0Õ²ÅÅ‚T¸’³q:Æ<¹ú Ò˜Æ}2VE•Ѐp¡Ô3Úº …h³^LJºçì¥Ánó|˜ÖˆÎˆ+« ¦dø‘Mº–d\ªDðÛ„Ì×LÝ——Ð9Ç|•FèçVm™¨€™3õS–9Äå¢<̉Ìm¢±`·º˜&Z²ž Ë®D«¶»6™‰©­HÈ Àá«h­i³04æ’hxœi3ï¨(ÓL·†‹¶ËpŒ ƒÜÒ? :õdsÀ –3æÓ·Üjâ¬9—]8n¼&]I F£¼…ì–—Œ0v°LǐÅfÛ2TÖ’aµ˜N@ÖBSÏ^à´4-±°b×nÈÈœÆD=KdŒø…ÄÈK,›ÖR§fjü$^ÔÎ!„6^ s:Üun\ôkCÞò÷<—Lúl Í›G¹ÀPá¼Nc¡šÒ…ÙWͳœ±vÊáЄ×9‹P‰cEØ‘™›µŸP<×g1 º©Ø¬wiÁ^l5× I/';Ë+´Z‡ÓÄFÕp[Èð’ HÄ ó 9¬Dl4“é±Ï”V=^Hð;žLädÉa‚°Ë,#/Ž~²BÔÛ QãñQtIeórVB,ÏÂf‹4#Μc‹É3ZIÖ Œ¢¥·üxa‡Ãçè„jŠ[5 Ä!U?,3žÎ×…ðdÓ÷háŠA‰ìÄ4÷ÃÜZÃE{‰®+W\ZÍE[‰»µk»MÝ­`¢©†˜ÃV‹-f¢¡†¢a«eŠ%«Y¨©q%jâd,Ôq`) ¤¦…šˆ ¦E>0Ùb²t–Ÿ  ÷jsςҒKÈcø(é›;k(’#ôŒQ ™C> õ³M9óºÆµ¤çâ;uÀ)5>RÔ¸fÓ~Ȧ—’-$fe«"FâUˆÊwµPÏu w+"åÉó¨6s™Û9(À¨ù©hE°½†n`m~“@©›p!Vkhµ Á1šbEqqÊ@ºèl›2 –Yã%‘‚hÛ{a¶‡ÅÞM²¬çL34®Çl]®‹ŽØŒm'RÜe35æöˆ­Á­ cP9šeÁköo´L³Ì=p8]”‡B¶,šº|ɏdzXˆØk*ÇÚ{#ñ‰pã(€¶‡9ý'šÜ³½¯kƒ†Â’ëSOƒ•Å®H6+a¢µˆ‹Y¨b˜b+XˆÖ!°u!¢"µˆˆn2ˆ Å0Ä`Å Ô®c(ÓÜGº•Ä»Œ âWî%q.áÐÄ÷î%umÍ£+ÜQ,Vn¦-GphU¸¢X­&,Gt ·K¢ÅÅ·¥RÄÊÉbKn N­R2g$VµÕó Qr#–ÓZUÏð0ÎtÙÀœz ëöo“Îk¯n„T°"SÞ+³/…€½"ižãO%Í%&Δâ‘ËØ´IˆÓ°Ë‰ÞM3.™yçÁzit›`4C`k¢¼á!álÄï sÂ[×!¤l¾æo"ƒIÔ'@ªu)3›ô®“@Z à¾] üœ'‡4¸PÞkÁ-qÄH‰ÓÍBd´ÿ —¹°ÄA&ÊUC„öz‚‚RæŠtf¬>˜ÑidšEçÑL÷áý¡V±h§­c¿¥¨ƒ@g¼…Ýö^ÞËc.ž„æ“I[ ª+·zÐÒÚ,½Ð»¶€C›7jk$๖€Ž¾ÅÙpp¶ÍþéΤ ½ØÎŒq ñpæžÅ¥#Øâ49ÃÂK^MYV“,¶Éz_òæ:…;Õ«¦I3âJ£¤û5$7Èxün\â]Êe¯(Ÿ&Ž‹¶2<6Ćf× æ¢ƱqWı[(ÙÂŽç‚T7¨@ÈÉÍß‚ïÙ"&3TYlGށ†)†#5ŠA©^T2ÆÁ†)©†©†¤yGXÁ†©"†)©¼ÅV WS†#©]R–r‹q5ÕbâWþBh¯u+ªÅÄ×ü„nÑ^êkªÁj‰jeœWˆÕÕ`µDµ2Ì+Ä µDµµ5Ô{¤Þ0RF’H÷AÛ<ÊÁ§ ƈæ0Ñ£ê4 öÚµ[¬/1²€â<-¬šö²r×0o×w ´xÐÒË„ g01¬„åEM蛇Ã\6µE›‘fÙO k÷CºnÓ1`iîÒ² áÂ!ÑLÄÿ ³¬\õ*:M=Ç»c‹2[‰ØsÕLò\ŒK L^™üÄN\¶#» Ç\……ßïIœÉ$¸ÎñÍ®ÔHÇ Ûí/´>Li”„†g^$ 7NÍÑÑ2M2ªNg=k½Ð}Ÿl6‡ —JWˆ”ÞéT·+µ¦üÂFè¢Vs6ýÆ4»2+2IÝ9ô9®ÇGÙÇ1+Ä8;*Õ§ž½D*îÑWÚçá3Ma¤·ˆ¥t}š²Ü…Q+Æüµ8HíS”üxGéÁˆ¦Ël„éÈ 5 µÄƒ6äÜ(kIš¯S†fÖ&¸®×v|Äyˆ*禌Éù@7-®Ä[]ÎÖ¿ê`º…=:…žJVnݳvðÖKE¼‚ »mà ÷f®:Ë ™–4rð¡4` ܹçž~‹C=œ…¾Ïj|VDtK.ƒ"9 Ï ­–éXá³6WÒïIL-Ї Ç PK*\]lang/en/datafield_latlong.phpnu[. /** * Strings for component 'datafield_latlong', language 'en', branch 'master' * * @package datafield * @subpackage latlong * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ $string['pluginname'] = 'Coordinates'; $string['fieldtypelabel'] = 'Coordinates'; $string['privacy:metadata'] = 'The Coordinates field component doesn\'t store any personal data; it uses tables defined in mod_data.'; PK*\ҚEE pix/icon.svgnu[ PK*\wxYxx version.phpnu[. /** * @package datafield * @subpackage latlong * @copyright 2006 Dan Stowell * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $plugin->version = 2025041400; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2025040800; // Requires this Moodle version. $plugin->component = 'datafield_latlong'; // Full name of the plugin (used for diagnostics) PK*\@d classes/privacy/provider.phpnu[. /** * Privacy Subsystem implementation for datafield_latlong. * * @package datafield_latlong * @copyright 2018 Carlos Escobedo * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace datafield_latlong\privacy; use core_privacy\local\request\writer; use mod_data\privacy\datafield_provider; defined('MOODLE_INTERNAL') || die(); /** * Privacy Subsystem for datafield_latlong implementing null_provider. * * @copyright 2018 Carlos Escobedo * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class provider implements \core_privacy\local\metadata\null_provider, datafield_provider { /** * Get the language string identifier with the component's language * file to explain why this plugin stores no data. * * @return string */ public static function get_reason(): string { return 'privacy:metadata'; } /** * Exports data about one record in {data_content} table. * * @param \context_module $context * @param \stdClass $recordobj record from DB table {data_records} * @param \stdClass $fieldobj record from DB table {data_fields} * @param \stdClass $contentobj record from DB table {data_content} * @param \stdClass $defaultvalue pre-populated default value that most of plugins will use */ public static function export_data_content($context, $recordobj, $fieldobj, $contentobj, $defaultvalue) { $defaultvalue->field['services'] = explode(',', $fieldobj->param1); if ($fieldobj->param2 > 0) { $defaultvalue->field['label'] = 'Content of field '.$fieldobj->param2; } else if ($fieldobj->param2 == -2) { $defaultvalue->field['label'] = 'lattitude/longitude'; } else { $defaultvalue->field['label'] = 'item #'; } $defaultvalue->lattitude = $contentobj->content; $defaultvalue->longitude = $contentobj->content1; unset($defaultvalue->content); unset($defaultvalue->content1); writer::with_context($context)->export_data([$recordobj->id, $contentobj->id], $defaultvalue); } /** * Allows plugins to delete locally stored data. * * @param \context_module $context * @param \stdClass $recordobj record from DB table {data_records} * @param \stdClass $fieldobj record from DB table {data_fields} * @param \stdClass $contentobj record from DB table {data_content} */ public static function delete_data_content($context, $recordobj, $fieldobj, $contentobj) { } }PK*\&Fzztemplates/latlong.mustachenu[{{! This file is part of Moodle - http://moodle.org/ Moodle is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Moodle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Moodle. If not, see . }} {{! @template datafield_latlong/latlong The purpose of this template is to enable the user to define a latlong field. Classes required for JS: * none Data attributes required for JS: * none Context variables required for this template: * name string The field's name. * description string The field's description. * required bool The field's requiredness. * latlonglinkservices array The field's Link out services. * otherfields array The field's Other fields. * otherfieldsoptgroups array The field's Other fields optgroups. * dataid int The field's dataid. * fieldid int The field's fieldid. Example context (json): { "name": "A name", "description": "A description", "required": true, "latlonglinkservices": [ { "name": "Google Maps", "selected": true }, { "name": "Google Earth", "selected": false } ], "latlonglinkservicessize": 2, "otherfields": [ { "name": "Entry #", "value": "-1", "selected": false }, { "name": "Latitude/Longitude", "value": "-2", "selected": false } ], "otherfieldsoptgroups": [ { "label": "Other fields:", "options": [ { "name": "Field A", "value": "6", "selected": false }, { "name": "Field B", "value": "7", "selected": true } ] } ], "dataid": 6, "fieldid": 0 } }}
{{> mod_data/fields/basicfields }} {{> mod_data/fields/requiredfield }}
{{#fieldid}} {{/fieldid}}
PK*\ݻ~UAAfield.class.phpnu[ "http://maps.google.com/maps?q=@lat@,+@long@&iwloc=A&hl=en", "Google Earth" => "@wwwroot@/mod/data/field/latlong/kml.php?d=@dataid@&fieldid=@fieldid@&rid=@recordid@", "Geabios" => "http://www.geabios.com/html/services/maps/PublicMap.htm?lat=@lat@&lon=@long@&fov=0.3&title=Moodle%20data%20item", "OpenStreetMap" => "http://www.openstreetmap.org/index.html?lat=@lat@&lon=@long@&zoom=11", "Multimap" => "http://www.multimap.com/map/browse.cgi?scale=200000&lon=@long@&lat=@lat@&icon=x" ); // Other map sources listed at http://kvaleberg.com/extensions/mapsources/index.php?params=51_30.4167_N_0_7.65_W_region:earth public function supports_preview(): bool { return true; } public function get_data_content_preview(int $recordid): stdClass { return (object)[ 'id' => 0, 'fieldid' => $this->field->id, 'recordid' => $recordid, 'content' => 41.391205, 'content1' => 2.163873, 'content2' => null, 'content3' => null, 'content4' => null, ]; } function display_add_field($recordid = 0, $formdata = null) { global $CFG, $DB, $OUTPUT; $lat = ''; $long = ''; if ($formdata) { $fieldname = 'field_' . $this->field->id . '_0'; $lat = $formdata->$fieldname; $fieldname = 'field_' . $this->field->id . '_1'; $long = $formdata->$fieldname; } else if ($recordid) { if ($content = $DB->get_record('data_content', array('fieldid'=>$this->field->id, 'recordid'=>$recordid))) { $lat = $content->content; $long = $content->content1; } } $str = '
'; $str .= '
'.s($this->field->name).''; $str .= ''; $classes = 'mod-data-input form-control-static'; $str .= ''; $str .= ''; $str .= '
'; $classes = 'mod-data-input form-control-static'; $str .= ''; $str .= 'field->id.'_0" value="'; $str .= s($lat).'" size="10" />°N
field->id.'_1" id="field_'.$this->field->id.'_1" value="'; $str .= s($long).'" size="10" />°E
'; $str .= '
'; $str .= '
'; return $str; } function display_search_field($value = '') { global $CFG, $DB; $varcharlat = $DB->sql_compare_text('content'); $varcharlong= $DB->sql_compare_text('content1'); $latlongsrs = $DB->get_recordset_sql( "SELECT DISTINCT $varcharlat AS la, $varcharlong AS lo FROM {data_content} WHERE fieldid = ? ORDER BY $varcharlat, $varcharlong", array($this->field->id)); $options = array(); foreach ($latlongsrs as $latlong) { $latitude = format_float($latlong->la, 4); $longitude = format_float($latlong->lo, 4); if ($latitude && $longitude) { $options[$latlong->la . ',' . $latlong->lo] = $latitude . ' ' . $longitude; } } $latlongsrs->close(); $classes = array('class' => 'accesshide'); $return = html_writer::label(get_string('latlong', 'data'), 'menuf_'.$this->field->id, false, $classes); $classes = ['class' => 'form-select']; $return .= html_writer::select($options, 'f_'.$this->field->id, $value, array('' => get_string('menuchoose', 'data')), $classes); return $return; } public function parse_search_field($defaults = null) { $param = 'f_'.$this->field->id; if (empty($defaults[$param])) { $defaults = array($param => ''); } return optional_param($param, $defaults[$param], PARAM_NOTAGS); } function generate_sql($tablealias, $value) { global $DB; static $i=0; $i++; $name1 = "df_latlong1_$i"; $name2 = "df_latlong2_$i"; $varcharlat = $DB->sql_compare_text("{$tablealias}.content"); $varcharlong= $DB->sql_compare_text("{$tablealias}.content1"); $latlong[0] = ''; $latlong[1] = ''; $latlong = explode (',', $value, 2); return array(" ({$tablealias}.fieldid = {$this->field->id} AND $varcharlat = :$name1 AND $varcharlong = :$name2) ", array($name1=>$latlong[0], $name2=>$latlong[1])); } function display_browse_field($recordid, $template) { global $CFG; $content = $this->get_data_content($recordid); if (!$content) { return ''; } $lat = $content->content; if (strlen($lat ?? '') < 1) { return ''; } $long = $content->content1; if (strlen($long ?? '') < 1) { return ''; } // We use format_float to display in the regional format. if ($lat < 0) { $compasslat = format_float(-$lat, 4) . '°S'; } else { $compasslat = format_float($lat, 4) . '°N'; } if ($long < 0) { $compasslong = format_float(-$long, 4) . '°W'; } else { $compasslong = format_float($long, 4) . '°E'; } // Now let's create the jump-to-services link. $servicesshown = explode(',', $this->field->param1); // These are the different things that can be magically inserted into URL schemes. $urlreplacements = array( '@lat@' => $lat, '@long@' => $long, '@wwwroot@' => $CFG->wwwroot, '@contentid@' => $content->id, '@dataid@' => $this->data->id, '@courseid@' => $this->data->course, '@fieldid@' => $content->fieldid, '@recordid@' => $content->recordid, ); if (count($servicesshown) == 1 && $servicesshown[0]) { $str = " $compasslat $compasslong"; } else if (count($servicesshown) > 1) { $str = '
'; $str .= "$compasslat, $compasslong\n"; $str .= ""; $str .= ''; $str .= '
'; } else { $str = "$compasslat, $compasslong"; } return $str; } function update_content_import($recordid, $value, $name='') { $values = explode(" ", $value, 2); foreach ($values as $index => $value) { $this->update_content($recordid, $value, $name . '_' . $index); } } function update_content($recordid, $value, $name='') { global $DB; $content = new stdClass(); $content->fieldid = $this->field->id; $content->recordid = $recordid; // When updating these values (which might be region formatted) we should format // the float to allow for a consistent float format in the database. $value = unformat_float($value); $value = trim($value ?? ''); if (strlen($value) > 0) { $value = floatval($value); } else { $value = null; } $names = explode('_', $name); switch ($names[2]) { case 0: // update lat $content->content = $value; break; case 1: // update long $content->content1 = $value; break; default: break; } if ($oldcontent = $DB->get_record('data_content', array('fieldid'=>$this->field->id, 'recordid'=>$recordid))) { $content->id = $oldcontent->id; return $DB->update_record('data_content', $content); } else { return $DB->insert_record('data_content', $content); } } function get_sort_sql($fieldname) { global $DB; return $DB->sql_cast_char2real($fieldname, true); } function export_text_value($record) { // The content here is from the database and does not require location formating. return sprintf('%01.4f', $record->content) . ' ' . sprintf('%01.4f', $record->content1); } /** * Check if a field from an add form is empty * * @param mixed $value * @param mixed $name * @return bool */ function notemptyfield($value, $name) { return isset($value) && !($value == ''); } /** * Validate values for this field. * Both the Latitude and the Longitude fields need to be filled in. * * @param array $values The entered values for the lat. and long. * @return string|bool Error message or false. */ public function field_validation($values) { $valuecount = 0; // The lat long class has two values that need to be checked. foreach ($values as $value) { if (isset($value->value) && !($value->value == '')) { $valuecount++; } } // If we have nothing filled in or both filled in then everything is okay. if ($valuecount == 0 || $valuecount == 2) { return false; } // If we get here then only one field has been filled in. return get_string('latlongboth', 'data'); } /** * Return the plugin configs for external functions. * * @return array the list of config parameters * @since Moodle 3.3 */ public function get_config_for_external() { // Return all the config parameters. $configs = []; for ($i = 1; $i <= 10; $i++) { $configs["param$i"] = $this->field->{"param$i"}; } return $configs; } public function get_field_params(): array { global $DB; $data = parent::get_field_params(); $data['dataid'] = $this->data->id; if (isset($this->field->param1)) { $data["param1"] = $this->field->param1; if (isset($this->linkoutservices)) { $serviceschosen = explode(',', htmlspecialchars($this->field->param1)); foreach ($this->linkoutservices as $servicename => $serviceurl) { $servicename = htmlspecialchars($servicename); $data['latlonglinkservices'][] = [ 'name' => $servicename, 'selected' => in_array($servicename, $serviceschosen), ]; unset($serviceschosen[$servicename]); } $data['latlonglinkservicessize'] = count($this->linkoutservices); } } $data["otherfields"][] = [ 'value' => -1, 'name' => get_string('entry', 'data') . " #", 'selected' => $this->field->param2 == -1, ]; $data['otherfields'][] = [ 'value' => -2, 'name' => get_string('latitude', 'data') . "/" . get_string('longitude', 'data'), 'selected' => $this->field->param2 == -2, ]; // Fetch all "suitable" other fields that exist for this database. $textfields = $DB->get_records('data_fields', ['dataid' => $this->data->id, 'type' => 'text']); if (count($textfields) > 0) { $data['otherfieldsoptgroups']['label'] = get_string('latlongotherfields', 'data') . ":"; foreach ($textfields as $textfield) { $data['otherfieldsoptgroups']['options'][] = [ 'value' => $textfield->id, 'name' => $textfield->name, 'selected' => $this->field->param2 == $textfield->id, ]; } } if (isset($data['otherfieldsoptgroups'])) { $data['otherfields'][] = $data['otherfieldsoptgroups']; } if (isset($this->field->id)) { $data['fieldid'] = $this->field->id; } return $data; } } PK*\ YYkml.phpnu[. // A lot of this initial stuff is copied from mod/data/view.php require_once('../../../../config.php'); require_once('../../lib.php'); // Optional params: row id "rid" - if set then export just one, otherwise export all $d = required_param('d', PARAM_INT); // database id $fieldid = required_param('fieldid', PARAM_INT); // field id $rid = optional_param('rid', 0, PARAM_INT); //record id $url = new moodle_url('/mod/data/field/latlong/kml.php', array('d'=>$d, 'fieldid'=>$fieldid)); if ($rid !== 0) { $url->param('rid', $rid); } $PAGE->set_url($url); if ($rid) { if (! $record = $DB->get_record('data_records', array('id'=>$rid))) { throw new \moodle_exception('invalidrecord', 'data'); } if (! $data = $DB->get_record('data', array('id'=>$record->dataid))) { throw new \moodle_exception('invalidid', 'data'); } if (! $course = $DB->get_record('course', array('id'=>$data->course))) { throw new \moodle_exception('coursemisconf'); } if (! $cm = get_coursemodule_from_instance('data', $data->id, $course->id)) { throw new \moodle_exception('invalidcoursemodule'); } if (! $field = $DB->get_record('data_fields', array('id'=>$fieldid))) { throw new \moodle_exception('invalidfieldid', 'data'); } if (! $field->type == 'latlong') { // Make sure we're looking at a latlong data type! throw new \moodle_exception('invalidfieldtype', 'data'); } if (! $content = $DB->get_record('data_content', array('fieldid'=>$fieldid, 'recordid'=>$rid))) { throw new \moodle_exception('nofieldcontent', 'data'); } } else { // We must have $d if (! $data = $DB->get_record('data', array('id'=>$d))) { throw new \moodle_exception('invalidid', 'data'); } if (! $course = $DB->get_record('course', array('id'=>$data->course))) { throw new \moodle_exception('coursemisconf'); } if (! $cm = get_coursemodule_from_instance('data', $data->id, $course->id)) { throw new \moodle_exception('invalidcoursemodule'); } if (! $field = $DB->get_record('data_fields', array('id'=>$fieldid))) { throw new \moodle_exception('invalidfieldid', 'data'); } if (! $field->type == 'latlong') { // Make sure we're looking at a latlong data type! throw new \moodle_exception('invalidfieldtype', 'data'); } $record = NULL; } require_course_login($course, true, $cm); $context = context_module::instance($cm->id); // If we have an empty Database then redirect because this page is useless without data. if (has_capability('mod/data:managetemplates', $context)) { if (!$DB->record_exists('data_fields', array('dataid'=>$data->id))) { // Brand new database! redirect($CFG->wwwroot.'/mod/data/field.php?d='.$data->id); // Redirect to field entry } } //header('Content-type: text/plain'); // This is handy for debug purposes to look at the KML in the browser header('Content-type: application/vnd.google-earth.kml+xml kml'); header('Content-Disposition: attachment; filename="moodleearth-'.$d.'-'.$rid.'-'.$fieldid.'.kml"'); echo data_latlong_kml_top(); if($rid) { // List one single item $pm = new stdClass(); $pm->name = data_latlong_kml_get_item_name($content, $field); $pm->description = "<a href='$CFG->wwwroot/mod/data/view.php?d=$d&rid=$rid'>Item #$rid</a> in Moodle data activity"; $pm->long = $content->content1; $pm->lat = $content->content; echo data_latlong_kml_placemark($pm); } else { // List all items in turn $contents = $DB->get_records('data_content', array('fieldid'=>$fieldid)); echo ''; foreach($contents as $content) { $pm->name = data_latlong_kml_get_item_name($content, $field); $pm->description = "<a href='$CFG->wwwroot/mod/data/view.php?d=$d&rid=$content->recordid'>Item #$content->recordid</a> in Moodle data activity"; $pm->long = $content->content1; $pm->lat = $content->content; echo data_latlong_kml_placemark($pm); } echo ''; } echo data_latlong_kml_bottom(); function data_latlong_kml_top() { return ' '; } function data_latlong_kml_placemark($pm) { return ' '.$pm->description.' '.$pm->name.' '.$pm->long.' '.$pm->lat.' 30500.8880792294568 46.72425699662645 0.0 0 1 relativeToGround '.$pm->long.','.$pm->lat.',50 '; } function data_latlong_kml_bottom() { return ''; } function data_latlong_kml_get_item_name($content, $field) { global $DB; // $field->param2 contains the user-specified labelling method $name = ''; if($field->param2 > 0) { $name = htmlspecialchars($DB->get_field('data_content', 'content', array('fieldid'=>$field->param2, 'recordid'=>$content->recordid)), ENT_COMPAT); }elseif($field->param2 == -2) { $name = $content->content . ', ' . $content->content1; } if($name=='') { // Done this way so that "item #" is the default that catches any problems $name = get_string('entry', 'data') . " #$content->recordid"; } return $name; } PK*\]lang/en/datafield_latlong.phpnu[PK*\ҚEE pix/icon.svgnu[PK*\wxYxx z version.phpnu[PK*\@d -classes/privacy/provider.phpnu[PK*\&Fzzltemplates/latlong.mustachenu[PK*\ݻ~UAA0+field.class.phpnu[PK*\ YYUmkml.phpnu[PK@