-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1803 from sistemasases/develop
Develop
- Loading branch information
Showing
25 changed files
with
3,472 additions
and
100 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,221 @@ | ||
// Standard license block omitted. | ||
/* | ||
* @package block_ases | ||
* @copyright ASES | ||
* @author Joan Manuel Tovar Guzman | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
/** | ||
* @module block_ases/ases_geographic_reports | ||
*/ | ||
define(['jquery', | ||
'block_ases/jszip' | ||
], | ||
|
||
function ($, jszip) { | ||
|
||
return { | ||
init: function () { | ||
window.JSZip = jszip; | ||
getDataMap(); | ||
|
||
//Evento para controlar el checkbox de mapa de calor | ||
$('#heat_map').on('change', function () { | ||
|
||
if (window.heatmap){ | ||
window.heatmap.setMap(heatmap.getMap() ? null : window.map); | ||
}else{ | ||
mapaCalor(); | ||
} | ||
}); | ||
|
||
//Evento para controlar el checkbox de mapa de marcadores | ||
$('#markers_map').on('change', function () { | ||
|
||
if (window.markers){ | ||
for (var x in window.markers){ | ||
window.markers[x].setMap(window.markers[x].getMap() ? null : window.map); | ||
} | ||
}else{ | ||
marcadoresMapa(); | ||
} | ||
|
||
}); | ||
|
||
//Evento para actualizar el mapa cuando cambie la seleccion de cohorte | ||
$('#conditions').on('change', function () { | ||
getDataMap(); | ||
}); | ||
} | ||
} | ||
|
||
|
||
/** | ||
* Funcion getDataMap | ||
* | ||
* Funcion que se encarga de hacer el llamado para obtener los datos de las coordenadas en la base de datos | ||
*/ | ||
|
||
function getDataMap(){ | ||
|
||
$.ajax({ | ||
|
||
type: "POST", | ||
data: { type: 'mapa', cohort: $('#conditions').val(), instance_id: getIdinstancia() }, | ||
url: "../managers/ases_report/asesreport_graphics_processing.php", | ||
success: function (msg) { | ||
crearActualizarMapa(msg); | ||
}, | ||
dataType: "json", | ||
cache: false, | ||
async: true, | ||
|
||
failure: function (msg) { } | ||
}); | ||
} | ||
|
||
/** | ||
* Funcion crearActualizarMapa | ||
* | ||
* Funcion que recibe la informacion de las coordenadas y se encarga de crear o actualizar el mapa, segun corresponda | ||
* | ||
* @param data | ||
*/ | ||
|
||
function crearActualizarMapa(data) { | ||
|
||
//Si no existe el mapa, se crea desde cero | ||
if(!window.map){ | ||
var latLng_Cali = new google.maps.LatLng(3.4247198, -76.5259052); | ||
|
||
window.map = new google.maps.Map(document.getElementById('map-canvas'), { | ||
center: latLng_Cali, | ||
zoom: 12 | ||
}); | ||
} | ||
|
||
//Se prepara la informacion de las coordenadas | ||
|
||
var puntosMapa = [], cohortes = []; | ||
var latitud, longitud; | ||
|
||
for (var x in data){ | ||
latitud = Number(data[x].latitude); | ||
longitud = Number(data[x].longitude); | ||
puntosMapa.push(new google.maps.LatLng(latitud,longitud)); | ||
cohortes.push(data[x].cohorte); | ||
}; | ||
|
||
//Se asignan los atributos pertenecientes al mapa | ||
|
||
window.puntosMapa = puntosMapa; | ||
window.cohortes = cohortes; | ||
|
||
mapaCalor(puntosMapa); | ||
marcadoresMapa(puntosMapa); | ||
|
||
}; | ||
|
||
|
||
/** | ||
* Funcion mapaCalor | ||
* | ||
* Funcion que se encarga de superponer el mapa de calor sobre el mapa existente | ||
* | ||
*/ | ||
|
||
function mapaCalor(){ | ||
|
||
if(window.heatmap){ | ||
window.heatmap.setMap(null); | ||
} | ||
|
||
if($("#heat_map").is(":checked")){ | ||
|
||
window.heatmap = new google.maps.visualization.HeatmapLayer({ | ||
data: window.puntosMapa, | ||
map: map, | ||
opacity: 1, | ||
maxIntensity: 10 | ||
}); | ||
} | ||
|
||
}; | ||
|
||
/** | ||
* Funcion marcadoresMapa | ||
* | ||
* Funcion que se encarga de dibujar los marcadores en el mapa existente segun las coordenadas | ||
*/ | ||
|
||
|
||
function marcadoresMapa(){ | ||
|
||
if (window.markers){ | ||
for (var x in window.markers){ | ||
window.markers[x].setMap(null); | ||
} | ||
} | ||
|
||
if($("#markers_map").is(":checked")) { | ||
|
||
window.markers = []; | ||
var icon, color; | ||
|
||
for (var x in window.puntosMapa) { | ||
|
||
switch (window.cohortes[x]) { | ||
|
||
case 'SPP': | ||
color = 'blue'; | ||
break; | ||
case 'SPE': | ||
color = 'green'; | ||
break; | ||
case 'SPT': | ||
color = 'red'; | ||
break; | ||
case '3740': | ||
color = 'purple'; | ||
break; | ||
case 'Otros': | ||
color = 'orange'; | ||
break; | ||
}; | ||
|
||
|
||
icon = { | ||
url: "https://raw.githubusercontent.com/Concept211/Google-Maps-Markers/master/images/marker_"+ color +".png", // url | ||
scaledSize: new google.maps.Size(11, 20) // scaled size | ||
}; | ||
|
||
window.markers.push(new google.maps.Marker({ | ||
position: window.puntosMapa[x], | ||
map: map, | ||
icon: icon, | ||
title: window.cohortes[x] | ||
})); | ||
} | ||
} | ||
|
||
}; | ||
|
||
/** | ||
* Funcion getIdInstancia | ||
* | ||
* Funcion que retorna la instancia actual | ||
* @returns {*} | ||
*/ | ||
|
||
function getIdinstancia() { | ||
var urlParameters = location.search.split('&'); | ||
|
||
for (x in urlParameters) { | ||
if (urlParameters[x].indexOf('instanceid') >= 0) { | ||
var intanceparameter = urlParameters[x].split('='); | ||
return intanceparameter[1]; | ||
} | ||
} | ||
return 0; | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
// 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 <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Estrategia ASES | ||
* | ||
* @author Joan Manuel Tovar Guzmán | ||
* @package block_ases | ||
* @copyright 2018 Joan Manuel Tovar Guzmán <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
// Standard GPL and phpdocs | ||
namespace block_ases\output; | ||
|
||
use renderable; | ||
use renderer_base; | ||
use templatable; | ||
use stdClass; | ||
|
||
class ases_geographic_reports_page implements renderable, templatable { | ||
/** @var string $data Some text to show how to pass data to a template. */ | ||
var $data = null; | ||
|
||
public function __construct($data) { | ||
$this->data = $data; | ||
} | ||
/** | ||
* Export this data so it can be used as the context for a mustache template. | ||
* | ||
* @return stdClass | ||
*/ | ||
public function export_for_template(renderer_base $output) { | ||
$data = new stdClass(); | ||
$data->data = $this->data; | ||
return $data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
/** | ||
* @package block_ases | ||
* @subpackage core.dphpforms | ||
* @author Jeison Cardona Gómez | ||
* @copyright (C) 2019 Jeison Cardona Gómez <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
const VERSION = 1; //Current version. | ||
|
||
require_once( __DIR__ . "/../../../../config.php"); | ||
require_once( __DIR__ . "/../module_loader.php"); | ||
|
||
|
||
require_once( __DIR__ . "/v" . VERSION . "/entrypoint.php"); | ||
|
||
|
||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
error_reporting(E_ALL); | ||
ini_set('display_errors', 1); | ||
|
||
require_once( __DIR__ . "/../module_loader.php"); | ||
module_loader("dphpforms"); | ||
|
||
/*global $DB; | ||
$query = "CREATE TABLE abd( | ||
ID serial NOT NULL PRIMARY KEY, | ||
info json NOT NULL | ||
)"; | ||
$DB->execute($query); | ||
die();*/ | ||
|
||
$initial_config = '{ | ||
"allow_register":true, | ||
"allow_update":true, | ||
"allow_delete":true, | ||
"allow_reset":true, | ||
"aditional_form_classes" : ["ases-col-xs-12", "ases-col-sm-12", "dphpforms"], | ||
"initial_values" : [ | ||
{ | ||
"alias" : "lugar", | ||
"default_value" : "Lugar de prueba" | ||
}, | ||
{ | ||
"alias" : "objetivos", | ||
"default_value" : "Objetivos de prueba" | ||
},{ | ||
"alias" : "id_instancia", | ||
"default_value" : "450299" | ||
} | ||
], | ||
"aditional_buttons" : [ | ||
{ | ||
"alias" : "extra_button", | ||
"text" : "Extra Button", | ||
"classes" : ["e-class", "e-class-2"] | ||
} | ||
] | ||
}'; | ||
|
||
$initial_config = json_decode( $initial_config ); | ||
|
||
echo dphpformsV2_generate_html_recorder( 'seguimiento_pares', "sistemas", $initial_config, false ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
error_reporting(E_ALL); | ||
ini_set('display_errors', 1); | ||
|
||
require( "/usr/local/www/apache24/data/moodle35/blocks/ases/managers/dphpforms/dphpforms_response_recorder.php" ); | ||
|
||
echo dphpforms_generate_html_recorder( 'seguimiento_pares', "sistemas", -1, -1 ); |
Oops, something went wrong.