Created
December 13, 2016 15:55
-
-
Save jorgedison/67fee848582b1e5279ba0590b57c6954 to your computer and use it in GitHub Desktop.
test
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
<?php | |
function getSubString($string, $length=NULL) | |
{ | |
//Si no se especifica la longitud por defecto es 50 | |
if ($length == NULL) | |
$length = 65; | |
//Primero eliminamos las etiquetas html y luego cortamos el string | |
$stringDisplay = substr(strip_tags($string), 0, $length); | |
//Si el texto es mayor que la longitud se agrega puntos suspensivos | |
if (strlen(strip_tags($string)) > $length) | |
$stringDisplay .= ' ...'; | |
return $stringDisplay; | |
} | |
$empresaid = $_SESSION["empresaid"]; | |
/*--------------------------------------------------------------------------------------------*/ | |
require_once('../course/validar.php'); | |
if($estado_usuario == 'G'){ | |
echo " | |
<script> | |
$( document ).ready(function() { | |
}); | |
</script> | |
<style> | |
#block-region-side-pre{ | |
display:none !important; | |
} | |
#region-main { | |
width: 100% !important; | |
} | |
</style> | |
"; | |
} | |
/*--------------------------------------------------------------------------------------------*/ | |
?> | |
<!-- Alertas Personalizadas --> | |
<script src="../alerts/sweetalert.min.js"></script> | |
<link rel="stylesheet" type="text/css" href="../alerts/sweetalert.css"> | |
<div class="" id="cuenta-panel-guru"> | |
<div class=""> | |
<div class="col-sm-3"> | |
<ul class="nav nav-pills nav-stacked admin-menu"> | |
<li><a href="#" data-target-id="cursos" id="menu-mis-cursos"><i class="glyphicon glyphicon-th-large"></i> Mis Cursos</a></li> | |
<li><a href="#" data-target-id="pagos" id="menu-mis-pagos"><i class="glyphicon glyphicon-shopping-cart"></i> Mis Pagos</a></li> | |
<li><a href="#" data-target-id="diplomas" id="menu-mis-diplomas"><i class="glyphicon glyphicon-education"></i> Mis Diplomas</a></li> | |
<?php | |
if($estado_guru == 'P'){ ?> | |
<li id="li_guru"><a href="#" data-target-id="guru" id="menu-ser-guru"><i class="glyphicon glyphicon-user"></i> Ser Gurú</a></li> | |
<?php }else{ ?> | |
<li id="li_guru"><a href="#" data-target-id="guru" id="menu-ser-guru"><i class="glyphicon glyphicon-user"></i> Gurú</a></li> | |
<?php } ?> | |
</ul> | |
</div> | |
<div class="col-sm-9 well content-0" id="frontpage-course-list-student"> | |
<?php require_once('../course/course_form.php'); ?> | |
</div> | |
<div class="col-sm-3 pull-right" id="block-course-category"> | |
<h4><a href="#page" id="category_course_student" class="pull-right">Ordenar por Categoría </a></h4><br> | |
<h4><a href="#page" id="course_student" class="pull-right"> Ordenar por Curso</a></h4> | |
</div> | |
<div class="col-md-9 well admin-content" id="cursos"> | |
<?php | |
/*$sql = "select distinct | |
cur.shortname as nombre_curso, cur.pricecourse as precio, | |
cur.*, | |
(select estado from mdl_enrollment where alumnoid = alu.id and cursoid = cur.id order by fecha_pago desc limit 1) as estado | |
from mdl_enrollment enr | |
inner join mdl_user alu on alu.id = enr.alumnoid | |
inner join mdl_course cur on cur.id = enr.cursoid | |
where alu.id = ".$USER->id ."";*/ | |
$sql = "select distinct | |
cur.shortname as nombre_curso, cur.pricecourse as precio, | |
cur.*, | |
(select estado from mdl_enrollment where alumnoid = alu.id and cursoid = cur.id order by id desc limit 1) as estado, | |
(select | |
(case when estado = 'A' then 0 when estado = 'P' then 1 when estado = 'C' then 2 when estado = 'T' then 3 end) | |
from mdl_enrollment where alumnoid = alu.id and cursoid = cur.id order by id desc limit 1) as orden | |
from mdl_enrollment enr | |
inner join mdl_user alu on alu.id = enr.alumnoid | |
inner join mdl_course cur on cur.id = enr.cursoid | |
where alu.id = ".$USER->id ." | |
order by orden,nombre_curso"; | |
$courses = $DB->get_records_sql($sql); | |
$cantidad = count($courses); | |
if($cantidad == 0){ | |
echo "<div class='alert alert-success'>No esta matriculado en ningun curso.</div>"; | |
} | |
?> | |
<div id="frontpage-course-list"> | |
<?php if($cantidad > 0){ ?> | |
<h2 class="all">Mis Cursos</h2> | |
<?php } ?> | |
<div class="courses frontpage-course-list-all clearfix"> | |
<div class="shadow-frontpage-course-list-all"> | |
<?php | |
foreach ($courses as $cour) | |
{ | |
$bandera = false; | |
if($cour->estado == 'P'){ | |
$color = '<span class="label label-warning">Pendiente de Pago</span>'; | |
}else if($cour->estado == 'C'){ | |
$color = '<span class="label label-info">En proceso</span>'; | |
}else if($cour->estado == 'T'){ | |
$color = '<span class="label label-success">Terminado</span>'; | |
}else if($cour->estado == 'A'){ | |
$color = '<span class="label label-success">Disponible</span>'; | |
$bandera = true; | |
} | |
$class = "content-column content-column-".$can; | |
//$url_curso = $CFG->wwwroot."/course/view.php?id=".$cour->id.'&sesskey='.sesskey().'&edit=off'; | |
$url_curso = $CFG->wwwroot."/course/session.php?course=".$cour->id.'&session=1'; | |
$sql = "select fi.id,fi.filename,fi.contextid,cu.shortname | |
from mdl_files fi | |
inner join mdl_context co on co.id = fi.contextid | |
inner join mdl_course cu on cu.id = co.instanceid | |
where co.instanceid = ".$cour->id." and co.contextlevel = 50 | |
and fi.filesize > 0 and (mimetype = 'image/png' or mimetype = 'image/jpeg') | |
order by 1 desc limit 1"; | |
$imagen = $DB->get_records_sql($sql, array(13)); | |
$url_imagen = ''; | |
foreach ($imagen as $img) { | |
//$url_imagen = 'pluginfile.php/'.$img->contextid.'/course/overviewfiles/'.$img->filename; | |
$url_imagen = $CFG->wwwroot.'/pluginfile.php?file=%2F'.$img->contextid.'%2Fcourse%2Foverviewfiles%2F'.$img->filename; | |
$nombre_curso = $img->shortname; | |
} | |
?> | |
<div class="<?php echo $class; ?>"> | |
<div class="coursebox clearfix odd first" data-courseid="3" data-type="1"> | |
<div class="content"> | |
<?php | |
if($bandera){ | |
?> | |
<a class="link-principal link-secundario" href="<?php echo $url_curso ?>"> | |
<?php | |
}else{ | |
?> | |
<a> | |
<?php | |
} | |
?> | |
<div class="imagebox" style="background-image:url('<?php echo $url_imagen ?>');height:150px;background-size:cover;background-position:center;"> | |
<!--<a href="<?php echo $url_curso ?>"> | |
<img src="<?php echo $url_imagen ?>" | |
alt="<?php echo $nombre_curso ?>" class="courseimage"> | |
</a>--> | |
</div></a> | |
<!-- | |
<p>Al<br> | |
</p> | |
<ul class="teachers"> | |
<li>Profesor: | |
<a href="<?php echo $url_profesor ?>">Profesor profesor</a> | |
</li> | |
</ul> | |
--> | |
</div> | |
<div class="info"> | |
<h3 class="coursename"> | |
<?php | |
if($bandera){ | |
?> | |
<a class="link-principal link-secundario" href="<?php echo $url_curso ?>" > <?php echo $cour->shortname ?> </a> | |
<?php | |
}else{ | |
?> | |
<a class="link-principal link-secundario" > <?php echo $cour->shortname ?> </a> | |
<?php | |
} | |
?> | |
</h3> | |
</div> | |
<div class="course-description"> | |
<?php | |
echo "<small>".getSubStringCourse($cour->summary)."</small>"; | |
?> | |
</div> | |
<?php | |
$select = "select count(*) as cantidad | |
from mdl_role_assignments ra | |
inner join mdl_context co on co.id = ra.contextid | |
where ra.roleid <> 5 and co.instanceid = ".$cour->id; | |
//where ra.roleid = 3 and co.instanceid = ".$cour->id; | |
$docente = $DB->get_records_sql($select); | |
$select = "select ra.userid,firstname as nombre_docente | |
from mdl_role_assignments ra | |
inner join mdl_context co on co.id = ra.contextid | |
inner join mdl_user us on us.id = ra.userid | |
where ra.roleid <>5 and co.instanceid = ".$cour->id; | |
//where ra.roleid = 3 and co.instanceid = ".$cour->id; | |
$docente2 = $DB->get_records_sql($select); | |
$nombre_docente = ''; | |
foreach ($docente2 as $doc) { | |
$nombre_docente = $doc->nombre_docente; | |
$url_profesor = $CFG->wwwroot."/user/view.php?id=".$doc->userid."&course=".$cour->id; | |
} | |
foreach ($docente as $doc) { | |
if ($doc->cantidad > 0) { | |
?> | |
<ul class="teachers"> | |
<li><b>Profesor:</b> | |
<?php | |
if($bandera){ | |
?> | |
<a href="<?php echo $url_profesor ?>"> <?php echo $nombre_docente;?> </a> | |
<?php | |
}else{ | |
?> | |
<a> <?php echo $nombre_docente;?> </a> | |
<?php | |
} | |
?> | |
</li> | |
<li> | |
<?php | |
//if($bandera == false){ | |
echo $color; | |
//} | |
?> | |
</li> | |
</ul> | |
<?php | |
} | |
} | |
?> | |
<?php | |
$precio = ($cour->pricecourse > 0) ? 'S/. '.number_format( $cour->pricecourse, 2, '.', '') : 'Gratuito'; | |
?> | |
<div class="course-price"> | |
<p><b>Valor:</b> <?php echo $precio; ?> </p> | |
</div> | |
</div> | |
</div> | |
<?php | |
$can++; | |
} | |
?> | |
</div> | |
</div> | |
</div> | |
</div> | |
<div class="col-md-9 well admin-content " id="pagos"> | |
<?php | |
$sql = "select | |
enr.id,cur.id as cursoid, cur.shortname as curso, cur.pricecourse as precio, | |
alu.firstname as estudiante,doc.firstname as docente, | |
to_char(enr.fecha_registro, 'DD/MM/YYYY') as fecha, enr.estado as estado_abr, | |
(case when enr.estado = 'P' then 'Pendiente de Pago' | |
when enr.estado = 'C' then 'En proceso' | |
when enr.estado = 'A' then 'Pagado' | |
else 'Terminado' end) as estado | |
from mdl_enrollment enr | |
inner join mdl_user alu on alu.id = enr.alumnoid | |
inner join mdl_user doc on doc.id = enr.docenteid | |
inner join mdl_course cur on cur.id = enr.cursoid | |
where alu.id = ".$USER->id." | |
order by 1 desc"; | |
$data = $DB->get_records_sql($sql); | |
$cantidad = count($data); | |
if($cantidad == 0){ | |
echo "<div class='alert alert-success'>No se tiene ningun pago procesado.</div>"; | |
}else{ | |
$can = 1; | |
?> | |
<div class="panel panel-default"> <div class="panel-heading" style="padding-top:10px;padding-bottom:10px;">Mis pagos</div> | |
<table class="table"> | |
<thead> | |
<tr> | |
<th>#</th> | |
<th>Curso</th> | |
<th>Precio</th> | |
<th>Fecha</th> | |
<th>Estado</th></tr> | |
</thead> | |
<tbody> | |
<?php | |
foreach($data as $datas) { | |
if($datas->estado_abr == 'P'){ | |
$clases = "label label-warning"; | |
$pagar = " | |
<a class='btn btn-success btn-sm link-principal link-secundario' href='#' data-toggle='modal' data-target='#modalPagar' | |
onclick='modalPagar(".$datas->cursoid.",".$datas->id.")'> | |
Ingresar Voucher</a> | |
"; | |
}else if($datas->estado_abr == 'C'){ | |
$clases = "label label-info"; | |
$pagar = ''; | |
}else if($datas->estado_abr == 'A'){ | |
$clases = "label label-success"; | |
$pagar = ''; | |
}elseif($datas->estado_abr == 'T'){ | |
$clases = "label label-success"; | |
$pagar = ''; | |
} | |
?> | |
<tr> | |
<th scope="row"> <?php echo $can;?> </th> | |
<td> <?php echo $datas->curso;?> </td> | |
<td><?php echo ($datas->precio > 0) ? 'S/. '.number_format($datas->precio, 2, '.', ',') : 'Gratuito'; ?> </td> | |
<td><?php echo $datas->fecha;?></td> | |
<td><span class="<?php echo $clases;?>"><?php echo $datas->estado;?></span></td> | |
<td class="text-center"> | |
<?php echo $pagar;?> | |
</td> | |
</tr> | |
<?php | |
$can = $can + 1; | |
} | |
} | |
?> | |
</tbody> | |
</table> | |
</div> | |
</div> | |
<div class="col-md-9 well admin-content" id="diplomas"> | |
<?php | |
$sql = "select enr.id,enr.alumnoid,enr.docenteid,enr.cursoid, | |
to_char(enr.fecha_registro, 'DD/MM/YYYY') as fecha, | |
cur.shortname as curso, alu.firstname as estudiante,doc.firstname as docente | |
from mdl_diploma enr | |
inner join mdl_user alu on alu.id = enr.alumnoid | |
inner join mdl_user doc on doc.id = enr.docenteid | |
inner join mdl_course cur on cur.id = enr.cursoid | |
where alumnoid = ".$USER->id; | |
$data = $DB->get_records_sql($sql); | |
$cantidad = count($data); | |
if($cantidad == 0){ | |
echo "<div class='alert alert-success'>No tiene diplomas.</div>"; | |
}else{ | |
$can = 1; | |
?> | |
<div class="panel panel-default"> <div class="panel-heading" style="padding-top:10px;padding-bottom:10px;">Mis diplomas</div> | |
<table class="table"> | |
<thead> | |
<tr> | |
<th>#</th> <th>Curso</th> <th>Profesor</th> <th>Fecha de emisión</th> <th>Ver</th></tr> | |
</thead> | |
<tbody> | |
<?php | |
foreach($data as $datas) { | |
?> | |
<tr> | |
<th scope="row"><?php echo $can;?></th> | |
<td><?php echo $datas->curso;?></td> | |
<td><?php echo $datas->docente;?></td> | |
<td><?php echo $datas->fecha;?></td> | |
<td> | |
<a class="btn btn-danger btn-sm" href="#" data-toggle="modal" data-target="#modal-diploma" | |
onclick="valorData(<?php echo $datas->id;?>,<?php echo $datas->alumnoid;?>, | |
<?php echo $datas->docenteid;?>,<?php echo $datas->cursoid;?>)">PDF</a> | |
</td> | |
</tr> | |
<?php | |
$can = $can + 1; | |
} | |
} | |
?> | |
</tbody> | |
</table> | |
</div> | |
</div> | |
<div class="col-md-9 well admin-content" id="guru"> | |
<h3>Panel Gurú</h3> | |
<div class="bs-example bs-example-tabs" data-example-id="togglable-tabs"> | |
<ul class="nav nav-tabs" id="myTabs" role="tablist"> | |
<li role="presentation" class="active" id="tab_1"> | |
<a class="link-principal link-secundario"href="#datos-guru" id="home-tab" role="tab" data-toggle="tab" aria-controls="home" aria-expanded="true">Datos Personales</a> | |
</li> | |
<li role="presentation" class="" id="tab_2"> | |
<a href="#curso-guru " role="tab" id="profile-tab" data-toggle="tab" aria-controls="profile" aria-expanded="false">Cursos Gurú</a> | |
</li> | |
</ul> | |
<div class="tab-content" id="myTabContent"> | |
<?php | |
?> | |
<div class="tab-pane fade active in" role="tabpanel" id="datos-guru" aria-labelledby="home-tab"> | |
<br><br> | |
<form class="form-horizontal col-sm-12"> | |
<div class="form-group"> | |
<label class="col-sm-3 control-label">Dirección</label> | |
<div class="col-sm-9"> | |
<input type="text" class="form-control" placeholder="Dirección" id="txtdireccionguru" required="required"> | |
</div> | |
<!--<label class="error" id="erro_direccion" style="display: none;">Ingresar dirección</label>--> | |
</div> | |
<div class="form-group"> | |
<label class=" col-sm-3 control-label">Cuenta Interbancaria</label> | |
<div class="col-sm-9"> | |
<input type="text" class="form-control" placeholder="Cuenta Interbancaria" id="txtcuentaguru" maxlength="20" required="required"> | |
</div> | |
<!--<label class="error" id="erro_cuenta" style="display: none;">Ingresar Cuenta Interbancaria</label>--> | |
</div> | |
<div class="form-group"> | |
<label class=" col-sm-3 control-label">Teléfono</label> | |
<div class="col-sm-9"> | |
<input type="text" class="form-control" placeholder="Teléfono" id="txtelefonoguru" maxlength="20" required="required"> | |
</div> | |
<!--<label class="error" id="erro_telefono" style="display: none;">Ingresar Teléfono</label>--> | |
</div> | |
<hr> | |
<div class="form-group text-center"> | |
<input type="button" class="btn btn-success" id="btnguardarguru" onclick="guardarGuru()" value="Guardar"> | |
</div> | |
<h3 id="sms_solicitud" class="text-center" style="display: none;">Procesando Solicitud</h3> | |
</form> | |
</div> | |
<div class="tab-pane fade" role="tabpanel" id="curso-guru" aria-labelledby="profile-tab"> | |
<input type="button" class="btn btn-success" id="" onclick="crearCurso()" value="Nuevo Curso"> | |
<?php | |
require_once('guru.php'); | |
?> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<!-- Ventanas Modales --> | |
<div class="modal fade" id="modalPagar" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | |
<div class="modal-dialog" role="document"> | |
<div class="modal-content"> | |
<div id="capa3"> | |
<label> | |
<img src="../pix/loading.gif" alt="Loading" align="middle" id="imgloading"> | |
</label> | |
</div> | |
<div id="capa2"></div> | |
<div id="capa1"> | |
<div class="modal-header"> | |
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | |
<div class="modal-image"><img class="principal-logo" src="../pix/educapolis.png" alt="educapolis"></div> | |
</div> | |
<div class="modal-body"> | |
<center><h3>Pagar Curso</h3></center> | |
<div class="col-sm-12"> | |
<p> | |
Curso: <b id="lblnombrecurso">Excel Básico</b><br> | |
Gurú: <b id="lblnombredocente">Juan Pérez</b><br> | |
Valor: <b id="lblprecio">S/.55.00</b> | |
</p> | |
</div> | |
<form accept-charset="UTF-8" role="form"> | |
<input type="hidden" id="txtid"> | |
<div class="col-sm-4"> | |
<select class="form-control" id="txtbanco"> | |
<?php | |
$sql = "select id,nombre,caracter from mdl_bank;"; | |
$data = $DB->get_records_sql($sql); | |
foreach($data as $datas) { | |
?> | |
<option value="<?php echo $datas->id;?>"> <?php echo $datas->nombre;?> </option> | |
<?php | |
} | |
?> | |
</select> | |
</div> | |
<div class="col-sm-4"> | |
<input class="form-control" type="text" id="txtvoucher" name="name" value="" size="15" placeholder="Voucher" required> | |
<!--<label id="error_voucher" style="display: none;">Ingresar Voucher</label>--> | |
<label id="error_voucher_existente" class="alert alert-danger" style="display: none;padding-top: 5px;padding-bottom: 5px;margin-bottom: 0;">Voucher existente</label> | |
</div> | |
<div class="col-sm-4"> | |
<input class="form-control" type="text" id="txtfecha" name="date" value="" size="15" placeholder="Fecha" required> | |
<!--<label id="error_fecha" style="display: none;">Ingresar Fecha</label>--> | |
</div> | |
<div class="col-sm-12"> | |
<hr> | |
</div> | |
<div class="col-sm-4 col-sm-offset-4"> | |
<input class="btn btn-lg btn-success btn-block" type="button" value="Pagar" onclick="validarDatos()"> | |
</div> | |
</form> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<div class="modal fade" id="modal-diploma" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | |
<div class="modal-dialog" role="document"> | |
<div class="modal-content"> | |
<div id="capa3_D"> | |
<label> | |
<img src="../pix/loading.gif" alt="Loading" align="middle" id="imgloading"> | |
</label> | |
</div> | |
<div id="capa2_D"></div> | |
<div id="capa1_D"> | |
<div class="modal-header"> | |
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | |
<div class="modal-image"><img class="principal-logo" src="../pix/educapolis.png" alt="educapolis"></div> | |
</div> | |
<div class="modal-body"> | |
<input type="hidden" id="txtid"> | |
<input type="hidden" id="txtalumnoid"> | |
<input type="hidden" id="txtdocenteid"> | |
<input type="hidden" id="txtcursoid"> | |
<input type="hidden" id="txtestado"> | |
<center><h3 id="curso_h3"></h3></center> | |
<div class="vista-diploma" id="div_diploma"> | |
<img id="codigo_di" style="width: 60px;height: 60px;float: right;"> | |
<div class="content-logo"> | |
<img class="principal-logo" src="../pix/educapolis.png" alt="logo-educapolis" /> | |
</div> | |
<div class="content-diploma"> | |
<center><h1>DIPLOMA</h1></center> | |
<!--<h5 id="codigo_di"> | |
</h5>--> | |
<h2 style="text-align: justify;"> | |
Por medio del presente diploma, se deja constancia que el alumno | |
<b id="estudiante_di"></b> aprobó con <span id="puntaje_di"> | |
</span> el curso <b id="curso_di"></b>, desarrollado en nuestra plataforma virtual. | |
</h2> | |
<div class="content-firma"> | |
<img src="../pix/firma-guru.png"> | |
<h3><b id="docente_di"></b></h3> | |
<span>Gurú Educapolis</span> | |
</div> | |
<h2 class="content-fecha">Lima, <span id="fecha_di"></h2> | |
</div> | |
</div> | |
<div class="vista-certificado" id="div_certificado"> | |
<img id="codigo_ce" style="width: 60px;height: 60px;float: right;"> | |
<div class="content-logo"> | |
<img class="principal-logo" src="../pix/educapolis.png" alt="logo-educapolis" /> | |
</div> | |
<div class="content-diploma"> | |
<center><h1>CERTIFICADO</h1></center> | |
<!--<h5 id="codigo_ce"></h5>--> | |
<h2 style="text-align: justify;"> | |
Por medio del presente certificado, se deja constancia que el alumno | |
<b id="estudiante_ce"></b> asistió al curso <b id="curso_ce"> | |
</b>, desarrollado en nuestra plataforma virtual. | |
</h2> | |
<h2 class="content-fecha">Lima, <span id="fecha_ce"></h2> | |
</div> | |
</div> | |
<style media="screen"> | |
.vista-diploma{ | |
padding: 20px; | |
border: 1px solid #BDBDBD; | |
display: inline-block; | |
margin: 10px; | |
height: 290px; | |
width: auto; | |
box-shadow: 2px 5px 5px #BDBDBD; | |
} | |
.vista-certificado{ | |
padding: 20px; | |
border: 1px solid #BDBDBD; | |
display: inline-block; | |
margin: 10px; | |
height: 200px; | |
width: auto; | |
box-shadow: 2px 5px 5px #BDBDBD; | |
} | |
.content-diploma{ | |
width: 100%; | |
display: inline-block; | |
float: left; | |
} | |
.content-logo{ | |
width: 20%; | |
display: inline-block; | |
float: left; | |
} | |
.content-logo img{ | |
width: 100%; | |
} | |
.content-diploma h2{ | |
font-weight: normal; | |
} | |
.content-fecha{ | |
float: right; | |
} | |
.content-diploma h1{ | |
font-size: 15px; | |
font-weight: bold; | |
margin-top: 0px; | |
} | |
.content-diploma h2{ | |
font-size: 13px; | |
} | |
.content-firma img{ | |
width: 100px; | |
height: 50px; | |
} | |
.content-firma span, | |
.content-firma h3{ | |
font-size: 11px; | |
margin-top: 0px; | |
margin-bottom: 0px; | |
} | |
</style> | |
<hr> | |
<input id="descargar" class="form-control btn btn-danger" type="button" value="Descargar"> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<script type="text/javascript"> | |
function valorInicio() { | |
//console.log( "window loaded 63" ); | |
} | |
function validarDatos() { | |
var voucher = $("#txtvoucher").val(); | |
var fecha = $("#txtfecha").val(); | |
var id = $("#txtid").val(); | |
var bancoid = $("#txtbanco").val(); | |
//limpiarError(); | |
if(voucher == "") | |
{ | |
//$("#txtvoucher").focus(); | |
//$("#error_voucher").css("display","block"); | |
} | |
else if(fecha == "") | |
{ | |
//$("#txtfecha").focus(); | |
//$("#error_fecha").css("display","block"); | |
} | |
else | |
{ | |
pagar(id,voucher,fecha,bancoid) | |
} | |
} | |
function pagar(id,voucher,fecha,bancoid){ | |
fecha = fecha.split("/").reverse().join("-"); | |
var estado = "C"; | |
var dataString = 'id='+id+ | |
'&fecha='+fecha+ | |
'&voucher='+voucher+ | |
'&bancoid='+bancoid+ | |
'&estado='+estado; | |
console.log(dataString); | |
$.ajax({ | |
type: "POST", | |
url: "../webservice/pendiente_conciliacion.php", | |
data: dataString, | |
success: function(data){ | |
console.log(data); | |
if(data == "true"){ | |
$("#modalPagar").hide(); | |
swal({ | |
title: "Registro de voucher correcto", | |
//text: "¡Registro correcto!", | |
text: " ", | |
type: "success", | |
confirmButtonColor: "#A5DCA7", | |
confirmButtonText: "Aceptar", | |
closeOnConfirm: false | |
}, | |
function(){ | |
location.reload(); | |
}); | |
}else{ | |
$("#error_voucher_existente").css("display","block"); | |
} | |
}, | |
error: function (err) { | |
console.log("AJAX error in request: " + JSON.stringify(err, null, 2)); | |
} | |
}).complete(function() { | |
}); | |
} | |
/* function limpiarError(){ | |
$("#error_voucher").css("display","none"); | |
$("#error_fecha").css("display","none"); | |
$("#error_voucher_existente").css("display","none"); | |
}*/ | |
function getGET(){ | |
var loc = document.location.href; | |
var getString = loc.split('#')[1]; | |
if(getString == "guru"){ | |
$("#li_guru").addClass("active"); | |
$("#frontpage-course-list-student").css("display", 'none'); | |
$("#block-course-category").css("display", 'none'); | |
$("#guru").css("display", 'block'); | |
$("#tab_1").removeClass("active"); | |
$("#datos-guru").removeClass("active in"); | |
$("#tab_2").addClass("active"); | |
$("#curso-guru").addClass("active in"); | |
} | |
else if(getString == "new"){ | |
$("#li_guru").addClass("active"); | |
$("#frontpage-course-list-student").css("display", 'none'); | |
$("#block-course-category").css("display", 'none'); | |
$("#guru").css("display", 'block'); | |
} | |
} | |
function modalPagar(cursoid, id){ | |
$("#capa2").css("display","flex"); | |
$("#capa3").css("display","flex"); | |
$("#txtid").val(id); | |
var dataString = 'id='+cursoid; | |
$.ajax({ | |
type: "POST", | |
url: "../webservice/datos_pago.php", | |
dataType: "json", | |
data: dataString, | |
success: function(data){ | |
console.log(data) | |
$("#txtvoucher").val(""); | |
$("#txtfecha").val(""); | |
$("#lblnombrecurso").html(data.nombre_curso); | |
$("#lblnombredocente").html(data.nombre_docente); | |
var precio = (data.precio > 0) ? "S/. " + data.precio : 'Gratuito'; | |
$("#lblprecio").html(precio); | |
}, | |
error: function (err) { | |
console.log("AJAX error in request: " + JSON.stringify(err, null, 2)); | |
} | |
}).complete(function() { | |
$("#capa2").css("display","none"); | |
$("#capa3").css("display","none"); | |
}); | |
} | |
$(document).ready(function() | |
{ | |
valorInicio(); | |
var navItems = $('.admin-menu li > a'); | |
var navListItems = $('.admin-menu li'); | |
var allWells = $('.admin-content'); | |
var allWellsExcept0= $('.content-0'); | |
allWells.hide(); | |
navItems.click(function(e) | |
{ | |
allWellsExcept0.hide(); | |
e.preventDefault(); | |
navListItems.removeClass('active'); | |
$(this).closest('li').addClass('active'); | |
allWells.hide(); | |
var target = $(this).attr('data-target-id'); | |
$('#' + target).show(); | |
}); | |
getGET(); | |
$( "#descargar" ).click(function() { | |
descargar(); | |
}); | |
/*$('#modalPagar').on('shown.bs.modal', function () { | |
$("#txtvoucher").val(""); | |
$("#txtfecha").val(""); | |
$('body').addClass('modal-open'); | |
$('#modalMatricular').modal('show'); | |
}); | |
$('#modalPagar').on('hide.bs.modal', function () { | |
$('body').removeClass('modal-open'); | |
$('.modal-backdrop').remove(); | |
});*/ | |
var estado_usuario = "<?php echo $estado_usuario; ?>"; | |
var estado_guru = "<?php echo $estado_guru; ?>"; | |
var phone1 = "<?php echo $phone1; ?>"; | |
if(estado_usuario == 'G'){ | |
var address = "<?php echo $address; ?>"; | |
var accountinterbancari = "<?php echo $accountinterbancari; ?>"; | |
$("#txtdireccionguru").val(address); | |
$("#txtcuentaguru").val(accountinterbancari); | |
$("#txtelefonoguru").val(phone1); | |
if(estado_guru == 'P'){ | |
$("#tab_2").css("display","none"); | |
$("#sms_solicitud").css("display","block"); | |
$("#btnguardarguru").attr('disabled','disabled'); | |
$("#btnguardarguru").attr('data-target','#'); | |
} | |
}else{ | |
$("#tab_2").css("display","none"); | |
} | |
$('#txtcuentaguru').keypress(function(e) { | |
soloNumeros(); | |
}); | |
}); | |
function valorData(id,alumnoid,docenteid,cursoid){ | |
$("#capa2_D").css("display","flex"); | |
$("#capa3_D").css("display","flex"); | |
$("#txtalumnoid").val(alumnoid); | |
$("#txtdocenteid").val(docenteid); | |
$("#txtcursoid").val(cursoid); | |
$("#txtid").val(id); | |
$("#div_certificado").css("display","none"); | |
$("#div_diploma").css("display","none"); | |
var dataString = 'id='+id; | |
/*'&alumnoid='+alumnoid+ | |
'&docenteid='+docenteid+ | |
'&cursoid='+cursoid*/; | |
$.ajax({ | |
type: "POST", | |
url: "../webservice/datos_diploma.php", | |
dataType: "json", | |
data: dataString, | |
success: function(data){ | |
$("#curso_h3").html(data.curso); | |
$("#txtestado").val(data.estado); | |
if(data.estado == "A") | |
{ | |
var url_qr = "<?php echo $CFG->wwwroot.'/pix/QR/'; ?>"; | |
$('#codigo_di').attr('src', url_qr + data.codigo +'.png'); | |
$("#div_diploma").css("display","block"); | |
$("#div_certificado").css("display","none"); | |
$("#estudiante_di").html(data.estudiante); | |
$("#curso_di").html(data.curso); | |
$("#puntaje_di").html(data.puntaje); | |
$("#fecha_di").html(data.fecha); | |
$("#docente_di").html(data.docente); | |
//$("#codigo_di").html(data.codigo); | |
console.log(data.codigo); | |
console.log(url_qr + data.codigo); | |
} | |
else | |
{ | |
var url_qr = "<?php echo $CFG->wwwroot.'/pix/QR/'; ?>"; | |
$('#codigo_ce').attr('src', url_qr + data.codigo +'.png'); | |
$("#div_diploma").css("display","none"); | |
$("#div_certificado").css("display","block"); | |
$("#estudiante_ce").html(data.estudiante); | |
$("#curso_ce").html(data.curso); | |
$("#fecha_ce").html(data.fecha); | |
//$("#codigo_ce").html(data.codigo); | |
console.log(data.codigo); | |
console.log(url_qr + data.codigo); | |
} | |
}, | |
error: function (err) { | |
console.log("AJAX error in request: " + JSON.stringify(err, null, 2)); | |
} | |
}).complete(function() { | |
$("#capa2_D").css("display","none"); | |
$("#capa3_D").css("display","none"); | |
}); | |
} | |
function descargar(){ | |
var alumnoid = $("#txtalumnoid").val(); | |
var docenteid = $("#txtdocenteid").val(); | |
var cursoid = $("#txtcursoid").val(); | |
var estado = $("#txtestado").val(); | |
var id = $("#txtid").val(); | |
var dataString = 'id='+id; | |
/*'&alumnoid='+alumnoid+ | |
'&docenteid='+docenteid+ | |
'&cursoid='+cursoid*/; | |
$.ajax({ | |
type: "POST", | |
url: "../webservice/datos_diploma.php", | |
dataType: "json", | |
data: dataString, | |
success: function(data){ | |
var estudiante = data.estudiante; | |
var docente = data.docente; | |
var curso = data.curso; | |
var puntaje = data.puntaje; | |
var fecha = data.fecha; | |
var codigo = data.codigo; | |
var empresaid = "<?php echo $empresaid; ?>"; | |
location.href = "output.php?es="+estudiante+"&cu="+curso+"&pu="+puntaje+"&do="+docente+"&fe="+fecha+"&estado="+estado+"&codigo="+codigo+"&empresaid="+empresaid; | |
}, | |
error: function (err) { | |
console.log("AJAX error in request: " + JSON.stringify(err, null, 2)); | |
} | |
}).complete(function() { | |
}); | |
} | |
function guardarGuru(){ | |
var direccion = $("#txtdireccionguru").val(); | |
var cuenta = $("#txtcuentaguru").val(); | |
var telefono = $("#txtelefonoguru").val(); | |
var usuarioid = "<?php echo $USER->id; ?>"; | |
var estado_usuario = "<?php echo $estado_usuario; ?>"; | |
if(validarGuru(direccion,cuenta,telefono)){ | |
/*var dataString = 'direccion='+direccion+ | |
'&cuenta='+cuenta+ | |
'&usuarioid='+usuarioid+ | |
'&estado_usuario='+estado_usuario;*/ | |
var dataString = {direccion:direccion, cuenta:cuenta, usuarioid:usuarioid, estado_usuario:estado_usuario, telefono:telefono}; | |
var texto = (estado_usuario == 'E') ? "¡Registro correcto!" : "¡Modificación correcta!"; | |
$.ajax({ | |
type: "POST", | |
url: "../webservice/registrar_guru.php", | |
data: dataString, | |
success: function(data){ | |
console.log(data); | |
if(data == 'true') | |
{ | |
swal({ | |
title: "Datos modificados correctamente", | |
text: " ", | |
type: "success", | |
confirmButtonColor: "#A5DCA7", | |
confirmButtonText: "Aceptar", | |
closeOnConfirm: false | |
}, | |
function(){ | |
location.reload(); | |
}); | |
} | |
else | |
{ | |
swal({ | |
title: "Registro de Gurú realizado", | |
text: " ", | |
type: "success", | |
confirmButtonColor: "#A5DCA7", | |
confirmButtonText: "Aceptar", | |
closeOnConfirm: false | |
}, | |
function(){ | |
location.reload(); | |
}); | |
} | |
}, | |
error: function (err) { | |
console.log("AJAX error in request: " + JSON.stringify(err, null, 2)); | |
} | |
}); | |
} | |
} | |
function validarGuru(direccion,cuenta,telefono){ | |
var retorno = false; | |
$("#erro_direccion").css("display","none"); | |
$("#erro_cuenta").css("display","none"); | |
$("#erro_telefono").css("display","none"); | |
if(direccion == ''){ | |
$("#erro_direccion").css("display","block"); | |
$("#txtdireccionguru").focus(); | |
}else if(cuenta == ''){ | |
$("#erro_cuenta").css("display","block"); | |
$("#txtcuentaguru").focus(); | |
}else if(telefono == ''){ | |
$("#erro_telefono").css("display","block"); | |
$("#txtelefonoguru").focus(); | |
}else{ | |
retorno = true; | |
} | |
return retorno; | |
} | |
function crearCurso(){ | |
//location.href = "../course/edit.php?category=4&returnto=catmanage"; | |
location.href = "../course/edit.php?category=7&returnto=catmanage"; | |
} | |
function soloNumeros(){ | |
if ((event.keyCode < 48) || (event.keyCode > 57)) | |
event.returnValue = false; | |
} | |
function limpiarError(){ | |
} | |
</script> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
'<?php $str= date("d M Y"); ?>' | |
var fin_dia = '<?php echo date("d/m/Y", strtotime($str)); ?>'; | |
//console.log("fecha:" + fin_dia); | |
var date_input=$('#txtfecha'); //our date input has the name "date" | |
var container=$('.bootstrap-iso form').length>0 ? $('.bootstrap-iso form').parent() : "body"; | |
var options={ | |
endDate: fin_dia, | |
format: 'dd/mm/yyyy', | |
container: container, | |
todayHighlight: true, | |
autoclose: true, | |
language: "es", | |
todayHighlight: true | |
}; | |
date_input.datepicker(options); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment