Example #1
0
 /**
  * Registra en DB, Asigna un curso a un estudiante
  * @param int $curso_id
  */
 function unsetPrograma($programa_id)
 {
     $db = new DB();
     $sql = "DELETE FROM coordinadores_programas " . "WHERE coordinador_id = {$this->_id} AND programa_id = {$programa_id}";
     $db->execute($sql);
     $url = "index2.php?com=usuarios&do=view&uid=" . $this->_id;
     Elfic::cosRedirect($url);
 }
Example #2
0
 /**
  * Registra en DB, Asigna un curso a un estudiante
  * @param int $curso_id
  */
 function unsetCurso($curso_id)
 {
     $db = new DB();
     $sql = "DELETE FROM estudiantes_cursos " . "WHERE estudiante_id = {$this->_id} AND curso_id = {$curso_id}";
     $db->execute($sql);
     $url = "index2.php?com=usuarios&do=view&uid=" . $this->_id;
     Elfic::cosRedirect($url);
 }
Example #3
0
 /**
  * Exporta consulta a excel y genera descarga
  * @param $export_file
  */
 function createExcel($filename, $arrydata)
 {
     $excelfile = "xlsfile://tmp/" . $filename;
     $fp = fopen($excelfile, "wb");
     if (!is_resource($fp)) {
         die("Error al crear {$excelfile}");
     }
     fwrite($fp, serialize($arrydata));
     fclose($fp);
     Elfic::cosRedirect('export.php?filename=' . $filename);
 }
Example #4
0
 public function setEvent()
 {
     global $uid;
     $e['titulo'] = $_REQUEST['titulo'];
     $e['descrip'] = $_REQUEST['descrip'];
     $e['fechaini'] = $_REQUEST['fechaini'];
     $e['funcionario_id'] = $uid;
     $e['fechafin'] = $_REQUEST['fechafin'];
     $e['tipo'] = $_REQUEST['tipo'];
     $e['lugar'] = $_REQUEST['lugar'];
     $db = new DB();
     $db->perform('eventos', $e);
     Elfic::cosRedirect('index2.php?=agenda');
 }
Example #5
0
 public function getInforme($eid, $tipo = "", $mun = '')
 {
     $db = new DB();
     $preguntas = $this->_getPreguntasEncuesta($eid);
     //$resultado = array();
     $html = "";
     while ($line = $db->fetchNextObject($preguntas)) {
         $opc_resp = $this->_getOpcionesRespuesta($line->id);
         //$resultado[$line->id]['pregunta'] = $line->pregunta;
         $html .= "<table width='100%'>\n";
         $html .= "<tr><th>" . $line->pregunta . "</th>\n";
         $html .= "<th with='80'>Total</th>\n";
         //$html .= "<th with='80'>%</th></tr>\n";
         $datos = array();
         $textos = array();
         while ($row = $db->fetchNextObject($opc_resp)) {
             $html .= "<tr>\n";
             $html .= "<td>" . $row->respuesta . "</td>";
             $html .= "<td>" . $this->getResultsPregunta($line->id, $row->id, $mun) . "</td>";
             //$html .= "<td>".
             $this->porcentaje($this->getResultsPregunta($line->id, $row->id), $this->_total_resp) . "%</td>";
             $html .= "</tr>\n";
             array_push($datos, $this->getResultsPregunta($line->id, $row->id));
             array_push($textos, $this->truncate($row->respuesta, 40));
         }
         //$html .= "<tr><td colspan='3'><img src='".$this->_getTorta($datos, $textos)."'></td></tr>";
         $d = serialize($datos);
         $t = serialize($textos);
         $cd = urlencode($d);
         $ct = urlencode($t);
         $titulo = $this->truncate($line->pregunta, 60);
         $html .= "<tr><td colspan='3'><img src='torta.php?datos={$cd}&textos={$ct}&titulo={$titulo}'></td></tr>";
         $html .= "</table><br>";
     }
     $tpl = new Elfic_Smarty();
     $usuario = $this->_usuarios_id;
     $tpl->assign('titulo', $this->_titulo);
     $tpl->assign('fecha', $this->_fecha);
     $tpl->assign('total_resp', $this->_total_resp);
     $tpl->assign('usuario', Elfic::getNombreUsuario($this->_usuarios_id));
     $tpl->assign('data_res', $html);
     if ($tipo == 'print') {
         $tpl->display('reportes/encuestasBasicReportPrint.tpl');
     } else {
         $tpl->display('encuestas/encuestasBasicReport.tpl');
     }
 }
Example #6
0
 public function registrarAgenda()
 {
     $data = array();
     $data['curso_id'] = isset($_REQUEST['curso_id']) ? $_REQUEST['curso_id'] : null;
     $data['tutor_id'] = isset($_REQUEST['tutor_id']) ? $_REQUEST['tutor_id'] : null;
     $data['comentarios'] = isset($_REQUEST['comentarios']) ? $_REQUEST['comentarios'] : null;
     $data['fecha'] = Elfic::now();
     $db = new DB();
     $up = $this->upload($data['curso_id']);
     if ($up == 1) {
         $db = new DB();
         $db->perform('agendas', $data);
         $msg = MSG_AGENDA_REG_OK;
     } else {
         Elfic::cosRedirect('index2.php?com=cursos', $up);
     }
     Elfic::cosRedirect('index2.php?com=cursos', $msg);
 }
Example #7
0
            Elfic::cosRedirect('index2.php?com=cursos', MSG_NOPERM_ACC);
        } else {
            if ($uperms['superusuario'] || Cursos::getTutor($_cid) == $uid) {
                $a = new Agendas();
                $a->borrarAgenda($_cid);
                Elfic::cosRedirect('index2.php?com=cursos&do=view&cid=' . $_cid);
            } else {
                Elfic::cosRedirect('index2.php?com=cursos', MSG_NOPERM_ACC);
            }
        }
        break;
    case 'view':
        $smarty->assign('id', $_cid);
        $smarty->display('cursos/cursos_menubar.tpl');
        $smarty->display('end_menubar.tpl');
        if (!$uperms['cursos_w']) {
            Elfic::cosRedirect('index2.php?com=cursos', MSG_NOPERM_ACC);
        } else {
            if (isset($do_edit) && $do_edit == "do") {
                $c = new Cursos($_cid);
                $c->save();
            } else {
                $c = new Cursos($_cid);
                $c->edit();
            }
        }
        break;
    case 'ajax':
        include 'cursos.ajax.php';
        break;
}
Example #8
0
 public function getCursosTutor($tutor)
 {
     $sql = "SELECT c.id, c.grupo, c.dia, ct.nombre, ct.semestre, " . "CONCAT(p.anio,'-',p.semestre) as periodo " . "FROM cursos c " . "INNER JOIN catedra ct ON c.catedra_id = ct.id " . "INNER JOIN periodos p ON c.periodo_id = p.id " . "WHERE c.tutor_id = '{$tutor}'";
     $db = new DB();
     $res = $db->query($sql);
     $output = "Curso: <select name=\"catedra\" id=\"catedra\" >" . "    <option value=\"\">--</option>";
     while ($line = $db->fetchNextObject($res)) {
         $output .= "<option value='" . $line->id . "'>" . $line->nombre . " ({$line->semestre}) " . " {$line->grupo} - " . Elfic::getDiaNombre($line->dia) . " | " . " (" . $line->periodo . ")</option>";
     }
     $output .= "</select>";
     echo $output;
 }
Example #9
0
 function prepare($id = "")
 {
     $username = $_REQUEST['login'];
     $email = $_REQUEST['email'];
     $error = null;
     if (usuarios::chkUser($username, $id)) {
         $error = "El nombre de usuario ya existe en el sistema.";
     }
     if (Usuarios::chkEmail($email, $id)) {
         $error .= " El Email ya existe en el sistema";
     }
     if (isset($error)) {
         if ($id != "") {
             Elfic::cosRedirect('index2.php?com=usuarios&&do=view&uid=' . $id, $error);
         } else {
             Elfic::cosRedirect('index2.php?com=usuarios&do=new', $error);
         }
     } else {
         return false;
     }
 }
Example #10
0
 /**
  * @desc Hace un password encriptado de un password en texto plano
  * @param strin $plain
  * @return string md5
  */
 function encrypt_password($plain)
 {
     $password = '';
     for ($i = 0; $i < 10; $i++) {
         $password .= Elfic::Rand();
     }
     $salt = substr(md5($password), 0, 2);
     $password = md5($salt . $plain) . ':' . $salt;
     return $password;
 }
Example #11
0
 public function viewEvaluacion()
 {
     $r = $this->_getResultadosEvaluacion();
     $tpl = new Elfic_Smarty();
     $tpl->assign('estudiante', Elfic::getNombreUsuario($this->estudiante_id));
     $tpl->assign('curso', $this->curso);
     $tpl->assign('tutor', Elfic::getNombreUsuario($this->tutor_id));
     $tpl->assign('concepto', $this->concepto_tutor);
     $tpl->assign('data', $this->_getResultadosEvaluacion());
     $tpl->display('evaluacion' . DS . 'evaluacionView.tpl');
 }
Example #12
0
<?php

define('APP_PATH', dirname(__FILE__));
define('DS', '/');
include 'includes/elfic.ini.php';
$row = 1;
$f = fopen("usuarios.csv", "r");
$i = 1;
while ($data = fgetcsv($f, 1000, ";")) {
    $p['nombres'] = $data[0];
    $p['apellidos'] = $data[1];
    $p['login'] = $data[2];
    $p['password'] = Elfic::getCryptedPassword($data[2]);
    $p['email'] = $data[3];
    $p['creado'] = Elfic::now();
    $p['modificado'] = Elfic::now();
    $p['ultimoingreso'] = "";
    $p['activo'] = "1";
    $p['esadmin'] = "0";
    $db = new DB();
    if (!$db->perform('usuarios', $p)) {
        echo "Error creando usuario " . $p['nombres'] . " " . $p['apellidos'];
        echo "\n<br>";
    } else {
        echo "Se creĆ³ el usuario " . $p['nombres'] . " " . $p['apellidos'];
        $id = $db->lastInsertedId();
        $db2 = new DB();
        $up['usuario_id'] = $id;
        $up['usuarios_grupo_id'] = 4;
        $db2->perform('usuarios_grupos_links', $up);
        echo " - ";
Example #13
0
<?php

$auth = new AuthUser();
//user id como globlal
$uid = $_SESSION['uid'];
//login como global
$login = $_SESSION['login'];
if (!$auth->isLoggedIn()) {
    Elfic::cosRedirect('index.php?action=login');
}
$uperms['usuarios_r'] = $auth->checkRight('USUARIOS_R');
$uperms['usuarios_w'] = $auth->checkRight('USUARIOS_W');
$uperms['agenda_r'] = $auth->checkRight('AGENDA_R');
$uperms['agenda_w'] = $auth->checkRight('AGENDA_W');
$uperms['asistencia_r'] = $auth->checkRight('ASISTENCIA_R');
$uperms['asistencia_w'] = $auth->checkRight('ASISTENCIA_W');
$uperms['cursos_r'] = $auth->checkRight('CURSOS_R');
$uperms['cursos_w'] = $auth->checkRight('CURSOS_W');
$uperms['evaluacion_r'] = $auth->checkRight('EVALUACION_R');
$uperms['evaluacion_w'] = $auth->checkRight('EVALUACION_W');
$uperms['reportes'] = $auth->checkRight('REPORTES');
$uperms['superusuario'] = $auth->checkRight('superusuario');
Example #14
0
function doCpanel()
{
    global $uid, $uperms;
    $tpl = new Elfic_Smarty();
    $tpl->assign('usuario', Elfic::getNombreUsuario($uid));
    $tpl->assign('usuarios', $uperms['usuarios_r']);
    $tpl->assign('agenda', $uperms['agenda_r']);
    $tpl->assign('asistencia', $uperms['asistencia_r']);
    $tpl->assign('cursos', $uperms['cursos_r']);
    $tpl->assign('evaluacion', $uperms['evaluacion_r']);
    $tpl->assign('reportes', $uperms['reportes']);
    $tpl->display('featCpanel.tpl');
    //$home = new Home();
}
Example #15
0
            $a->listAsistenciaTutores($_tutor, $_catedra, $_fini, $_ffin);
        }
        break;
    case 'list_fun':
        $smarty->display('asistencia' . DS . 'asistencia_menubar.tpl');
        $smarty->display('end_menubar.tpl');
        if (!$uperms['asistencia_r']) {
            Elfic::cosRedirect('index2.php', MSG_NOPERM_COM);
        } else {
            $a = new Asistencia();
            $a->listAsistenciaFuncionarios($_funcionario);
        }
        break;
    case 'setInTutor':
        $smarty->display('asistencia' . DS . 'asistencia_menubar.tpl');
        $smarty->display('end_menubar.tpl');
        if (!$uperms['asistencia_r']) {
            Elfic::cosRedirect('index2.php', MSG_NOPERM_COM);
        } else {
            $a = new Asistencia();
            $a->setAsistenciaTutor();
        }
        break;
    case 'ajax':
        if (!$uperms['asistencia_r']) {
            Elfic::cosRedirect('index2.php', MSG_NOPERM_COM);
        } else {
            include 'asistencia.ajax.php';
        }
        break;
}
Example #16
0
 public function setUpdateEncuesta($id)
 {
     global $uid;
     $data['titulo'] = $_POST['titulo'];
     $data['observaciones'] = $_POST['observaciones'];
     if ($this->cuentaPreguntas($id) > 0) {
         $data['publicado'] = $_POST['publicado'];
     }
     $db = new DB();
     $db->perform('encuestas', $data, 'update', 'id=' . $id);
     Elfic::cosRedirect('index2.php?com=encuestas&do=edit&eid=' . $id);
 }
Example #17
0
 private function getTipoRegistro($usuario, $curso = "")
 {
     $db = new DB();
     $iniHoy = date("Y-m-d") . " 00:00:00";
     $finHoy = date("Y-m-d") . " 23:59:59";
     $now = Elfic::now();
     $sql = "SELECT tipo_registro FROM " . TBL_ASIST_TUT . " WHERE usuario_id = {$usuario} AND fecha_hora > '{$iniHoy}' " . " AND curso_id = {$curso} ORDER BY id DESC ";
     $res = $db->queryUniqueObject($sql);
     if (!$res->tipo_registro || $res->tipo_registro == 's') {
         return 'e';
     } else {
         return 's';
     }
     return 'e';
 }