/** * 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); }
/** * 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); }
/** * 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); }
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'); }
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); }
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); }
$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; }
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; }
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; } }
public function setEvaluacion() { global $uid; $data['estudiante_id'] = $uid; $data['tutor_id'] = $_POST['tutor_id']; $data['curso_id'] = $_POST['curso_id']; $data['concepto_tutor'] = $_POST['concepto_tutor']; $data['periodo_id'] = CatManUtils::getPeriodoVigente(); $db = new DB(); if (!$db->perform('eval_tutores_estu', $data)) { Elfic::cosRedirect('index2.php?com=evaluacion', 'Error en el registro. Contacte al administrador'); } else { $eval_id = $db->lastInsertedId(); $valores = $_POST['respuesta']; $aLista = array_keys($_POST['respuesta']); foreach ($aLista as $indice) { $val = $valores[$indice]; $sql = "INSERT INTO eval_tutores_resp (eval_id, pregunta_id, respuesta)" . "VALUES ('{$eval_id}', '{$indice}', '{$val}' )"; $db = new DB(); $db->execute($sql); } Elfic::cosRedirect('index2.php?com=evaluacion', 'Los resultados se grabaron satisfactoriamente'); } }
<?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');
/** * @desc Registra datos básicos de un Usuario. Insert o Update * @param string $action "new" para nuevo * @return void */ public function save($action = null) { $db = new DB(); $data = array(); $data['catedra_id'] = $db->sqlInput($_REQUEST['catedra_id'], 'int'); $data['grupo'] = $db->sqlInput($_REQUEST['grupo'], 'text'); $data['tutor_id'] = $db->sqlInput($_REQUEST['tutor_id'], 'int'); $data['periodo_id'] = $db->sqlInput($_REQUEST['periodo_id'], 'int'); $data['dia'] = $db->sqlInput($_REQUEST['dia'], 'int'); $data['hora'] = $db->sqlInput($_REQUEST['hora'], 'text'); $data['estado'] = $db->sqlInput($_REQUEST['estado'], 'int'); if ($action == "new") { $db->perform('cursos', $data); $id = $db->lastInsertedId(); $msg = MSG_CURSO_CREADO; } else { $id = $db->sqlInput($_REQUEST['cid'], 'int'); $db->perform('cursos', $data, 'update', 'id=' . $id); $msg = MSG_CURSO_UPDATE; } $url = "index2.php?com=cursos&do=view&cid=" . $id; Elfic::cosRedirect($url, $msg); var_dump($data); }