256 lines
8.4 KiB
PHP
256 lines
8.4 KiB
PHP
<?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/>.
|
|
|
|
/**
|
|
* Displays a list of all assignment files for a user and/or course
|
|
*
|
|
* @package report
|
|
* @subpackage traspaso_notas
|
|
* @author Russell England <russell.england@gmail.com>
|
|
* @copyright Russell England <russell.england@gmail.com>
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
*/
|
|
|
|
//require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
|
|
require('../../config.php');
|
|
require_once(dirname(__FILE__) . '/lib.php');
|
|
require_once(dirname(__FILE__) . '/filter_form.php');
|
|
require_once($CFG->libdir . '/adminlib.php');
|
|
global $DB, $USER;
|
|
$filters['cursos'] = optional_param('cursos', 0, PARAM_INT);
|
|
$course = isset($_GET['id']) ? $_GET['id'] : 0;
|
|
require_login();
|
|
|
|
$admins = get_admins();
|
|
$isadmin = false;
|
|
foreach ($admins as $admin)
|
|
{
|
|
if ($USER->id == $admin->id)
|
|
{
|
|
$isadmin = true; break;
|
|
}
|
|
}
|
|
//if ($isadmin) { echo 'Es administrador'; exit; }
|
|
|
|
$sql_count=" Select count(*)
|
|
from m_user mu, m_course mc, m_context mctx, m_role_assignments mra
|
|
where
|
|
MRA.CONTEXTID = MCTX.ID
|
|
and MCTX.INSTANCEID = MC.ID
|
|
and mctx.contextlevel = 50
|
|
and MRA.ROLEID in (3,4,61,101,21)
|
|
and MC.VISIBLE = 1
|
|
and MRA.USERID = mu.id
|
|
and mu.id =".$USER->id;
|
|
$count = $DB->count_records_sql($sql_count);
|
|
// print_r($count);
|
|
if($count == 0 && $isadmin == false){
|
|
$context = context_system::instance();
|
|
$heading = get_string('pluginname', 'report_traspasonotasexam');
|
|
$PAGE->set_context($context);
|
|
$PAGE->set_heading(format_string($heading));
|
|
$PAGE->set_title(format_string($heading));
|
|
$PAGE->set_url('/report/traspasonotasexam/index.php', $filters);
|
|
$PAGE->set_pagelayout('report');
|
|
echo $OUTPUT->header();
|
|
echo $OUTPUT->heading($heading);
|
|
echo '<div id="contenedorizquierdo"><h3>Usuario no autorizado...</h3></div>';
|
|
exit;
|
|
}
|
|
// require_login();
|
|
$context = context_system::instance();
|
|
|
|
$heading = get_string('pluginname', 'report_traspasonotasexam');
|
|
$PAGE->set_context($context);
|
|
$PAGE->set_heading(format_string($heading));
|
|
$PAGE->set_title(format_string($heading));
|
|
$PAGE->set_url('/report/traspasonotasexam/index.php', $filters);
|
|
$PAGE->set_pagelayout('report');
|
|
//admin_externalpage_setup('report_traspaso_notas');
|
|
global $SESSION;
|
|
|
|
echo $OUTPUT->header();
|
|
echo $OUTPUT->heading($heading);
|
|
|
|
$mform = new filter_form();
|
|
|
|
if ($formdata = $mform->get_data()) {
|
|
$filters['cursos'] = $formdata->cursos;
|
|
} else {
|
|
$formdata = new stdClass();
|
|
$formdata->cursos = $filters['cursos'];
|
|
|
|
}
|
|
|
|
$mform->set_data($formdata);
|
|
$mform->display();
|
|
|
|
if ($filters['cursos'] != '0' ) {
|
|
$context = context_course::instance($filters['cursos'], MUST_EXIST);
|
|
$roles = get_user_roles($context, $USER->id, false);
|
|
$role = key($roles);
|
|
$roleid = $roles[$role]->roleid;}
|
|
else{$roleid = '0';}
|
|
|
|
if ($filters['cursos'] != '0' ) {
|
|
|
|
|
|
echo '
|
|
<script language="JavaScript" src="js/jquery.js" type="text/javascript"></script>
|
|
<script type="text/javascript" src="js/bootstrap.js"></script> ';
|
|
echo '<script>
|
|
$(document).ready(function() {
|
|
$("h2").css({"display": "block", "font-size": "1.5em"});
|
|
if($("#view-activities").length == 0 || $("#view-grades-siga").length == 0){
|
|
$("#ok").css("display","none");
|
|
$("#view-resumen").css("display", "none");
|
|
$("#view-tabla").css("display", "none");
|
|
$("#view-detalles").css("display", "none");
|
|
}
|
|
|
|
$("#ok").click(function(){
|
|
var valorAct = $(\'input[name="activ"]:checked\').parents("tr").children(":eq(1)").html();
|
|
var valorCali = $(\'input[name="cali"]:checked\').parents("tr").children(":eq(1)").html();
|
|
if( valorAct == undefined){
|
|
alert("Seleccione Actividad y Calificaci\u00f3n.");
|
|
return false;
|
|
}
|
|
|
|
if( valorCali == undefined){
|
|
alert("Seleccione Actividad y Calificaci\u00f3n.");
|
|
return false;
|
|
}
|
|
});
|
|
|
|
$("#gradesform").submit(function(){
|
|
if (!confirm("Ha Seleccionado Homologar la Actividad " + $(\'input[name="activ"]:checked\').parents("tr").children(":eq(1)").html() + " Con la Calificación " + $(\'input[name="cali"]:checked\').parents("tr").children(":eq(0)").html() + " ¿Desea Continuar?")){ return false;}
|
|
});
|
|
|
|
$("#open").click(function() {
|
|
$(".popup").slideToggle("slow");
|
|
return false;
|
|
});
|
|
|
|
$("a[data-toggle=modal]").click(function()
|
|
{
|
|
var traspaso_id = $(this).attr("id");
|
|
$.ajax({
|
|
cache: false,
|
|
type: "POST",
|
|
url: "detalles.php",
|
|
data: "idtraspaso="+traspaso_id,
|
|
success: function(data)
|
|
{
|
|
$("#myModal").show();
|
|
$(".modal-body").show().html(data);
|
|
}
|
|
});
|
|
});
|
|
|
|
$("input[type=\'button\'][name=\'ftraspaso\']").click(function() {
|
|
var v_idtraspaso = $(this).attr("id");
|
|
var idcursos = $("input[type=\'hidden\'][name=\'idcourse\']").val();
|
|
//alert(v_idtraspaso);
|
|
$.ajax({
|
|
cache: false,
|
|
type: "POST",
|
|
url: "accion.php",
|
|
data: {funcion:\'traspasar_notas\',idtraspaso:v_idtraspaso,curso:idcursos},
|
|
dataType: "html",
|
|
success: function(data)
|
|
{
|
|
alert(data);;
|
|
location.reload();
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
$("input[type=\'button\'][name=\'ftraspasoelim\']").click(function() {
|
|
var v_idtraspaso = $(this).attr("id");
|
|
var idcursos = $("input[type=\'hidden\'][name=\'idcourse\']").val();
|
|
// alert(v_idtraspaso);
|
|
$.ajax({
|
|
cache: false,
|
|
type: "POST",
|
|
url: "accion.php",
|
|
data: {funcion:\'eliminar_notas\',idtraspaso:v_idtraspaso,curso:idcursos},
|
|
dataType: "html",
|
|
success: function(data)
|
|
{
|
|
alert(data);;
|
|
location.reload();
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
</script>';
|
|
$assignments = traspasonotasexam_get_list($filters);
|
|
echo '<form action="'.$CFG->wwwroot.'/report/traspasonotasexam/gradelist.php" method="post" id="gradesform">'."\n";
|
|
echo '<div style="text-align:center;">'."\n";
|
|
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />'."\n";
|
|
echo '<input type="hidden" name="idcourse" value="'.$filters['cursos'].'" />'."\n";
|
|
echo '<div style="font-weight:bold"><h2>'. miCursoexa($filters['cursos']) . '</h2></div>';
|
|
echo traspasonotasexam_display_list($assignments, $filters);
|
|
echo '<div>';
|
|
echo '<br/><input id="ok" style="width: 130px; height: 30px; " type="submit" value="' . get_string('ok', 'report_traspasonotasexam') . '" />'."\n";
|
|
echo '</div>';
|
|
echo '</div>'."\n";
|
|
echo '</form>'."\n";
|
|
$assignments = traspasonotasexam_get_resumen($filters);
|
|
echo ' <p> </p>
|
|
<div id="content" style="text-align:center;">
|
|
<div><a href="#" id="open">Resumen Histórico</a></div>
|
|
<p> </p>
|
|
</div>
|
|
<div id="popup" class="popup">
|
|
<div class="content-popup">
|
|
<div align="center">';
|
|
echo traspasonotasexam_Display_Detalles($assignments, $filters);
|
|
echo ' <div class="detpopup-overlay"></div>';
|
|
echo ' </div>
|
|
</div>
|
|
</div>';
|
|
}
|
|
else
|
|
{
|
|
echo '<br> <strong>Debe seleccionar Asignatura. </strong>';
|
|
}
|
|
echo '<div id="dialog-confirm"></div>';
|
|
echo ' <!-- Modal -->
|
|
<div class="modal" id="myModal" style="display:none">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
<h4 class="modal-title">Detalle Traspaso Notas</h4>
|
|
</div>
|
|
<div class="modal-body">
|
|
|
|
</div>
|
|
<div class="modal-footer">
|
|
<a href="#" class="btn btn-default" data-dismiss="modal">Cerrar</a>
|
|
</div>
|
|
</div><!-- /.modal-content -->
|
|
</div><!-- /.modal-dialog -->
|
|
</div><!-- /.modal -->';
|
|
|
|
$PAGE->requires->js_init_call('M.report_traspasonotasexam.init');
|
|
|
|
|
|
echo $OUTPUT->footer(); |