Example #1
0
function handle_vote_claim($type, $from, $data, $res)
{
    global $connection;
    $from->need_level("member");
    validate_required($data, 'claim_id', 'vote');
    $claim_id = $data['claim_id'];
    $vote = intval($data['vote']);
    $textvote = $vote > 0 ? 'pro' : ($vote < 0 ? 'contra' : 'neutrally');
    $result = pg_query($connection, 'SELECT author, piece, pieces.index, users.nick FROM claims JOIN pieces ON pieces.id = claims.piece JOIN users ON users.id = author WHERE claims.id = ' . $claim_id);
    $num = pg_num_rows($result);
    if ($num == 0) {
        throw new Exception("Not found such claim.");
    }
    $claim = pg_fetch_assoc($result);
    // Protection from self-voting
    if (intval($claim['author']) == intval($from->user_id())) {
        throw new Exception("Not vote for yourself.");
    }
    $result = pg_query($connection, 'SELECT COUNT(*) FROM votes WHERE claim = ' . $claim_id . ' AND author = ' . $from->user_id());
    $num = intval(pg_fetch_result($result, 0, 0));
    if ($num == 0) {
        pg_query($connection, 'INSERT INTO votes VALUES(' . $claim_id . ',' . $from->user_id() . ',' . $vote . ')');
        $res->to_sender(info_msg('You voted „' . $textvote . '“.'));
    } else {
        pg_query($connection, 'UPDATE votes SET value = ' . $vote . ' WHERE claim = ' . $claim_id . ' AND author = ' . $from->user_id());
        $res->to_sender(info_msg('You changed vote to „' . $textvote . '“.'));
    }
    // Recalcing score (vote_balance)
    $result = pg_query($connection, 'SELECT sum(value) AS score FROM votes WHERE claim = ' . $claim_id);
    $score = intval(pg_fetch_result($result, 0, 0));
    if ($score > 2) {
        // Getting old owner from db
        $result = pg_query($connection, 'SELECT owner, users.nick FROM pieces JOIN users ON users.id = pieces.owner WHERE pieces.id = ' . $claim['piece']);
        $old_owner = pg_fetch_assoc($result);
        // Updating piece in db
        pg_query($connection, 'UPDATE pieces SET owner = ' . $claim['author'] . ' WHERE id = ' . $claim['piece']);
        $res->to_pie($from, array('piece_owner', array('piece_index' => $claim['index'], 'owner' => $claim['nick'])));
        // Removing claim
        pg_query($connection, 'DELETE FROM claims WHERE id = ' . $claim_id);
        $res->to_pie($from, array('claim_remove', array('claim_id' => $claim_id)));
        $res->to_pie($from, info_msg('Claim by ' . $claim['nick'] . ' for piece #' . $claim['index'] . ' is accepted.'));
        update_kml($from->pieid);
        _update_user_reserved($res, $from, $claim['author'], $claim['nick']);
        _update_user_reserved($res, $from, $old_owner['owner'], $old_owner['nick']);
    } else {
        if ($score < -2) {
            pg_query($connection, 'DELETE FROM claims WHERE id = ' . $claim_id);
            $msg = array('claim_remove', array('claim_id' => $claim_id));
            $res->to_pie($from, $msg);
            $res->to_pie($from, error_msg('Claim by ' . $claim['nick'] . ' for piece #' . $claim['index'] . ' is dismissed.'));
        } else {
            pg_query($connection, 'UPDATE claims SET score = ' . $score . ' WHERE id = ' . $claim_id);
            $msg = array('claim_update', array('claim_id' => $claim_id, 'vote_balance' => $score));
            $res->to_pie($from, $msg);
        }
    }
}
Example #2
0
function handle_session_act_logout($type, $from, $data, $res)
{
    // Make sure that we was registered
    $user_id = _find_member_user_id($from->pieid, $from->sesid);
    if ($user_id == 0) {
        throw new Exception("Logout called but the session was already logged out");
    }
    // Make sure that we are actually anonymous
    if ($from->user_id() != 0) {
        throw new Exception("Logout called for session that is registered yet");
    }
    _increase_anons($res, $from);
    _remove_chat_member($res, $from, $user_id);
    _youare($res, $from);
    $user = _get_user_info($user_id);
    $nick = $user['nick'];
    $msg = info_msg('%s has logged out, he is %s now', $nick, $from->anon_nick());
    $res->to_pie($from, $msg);
}
<?php

echo info_msg('<h3>Generar una Nueva Propuesta de Tesis</h3>');
echo '<br>';
echo Open('form', array('action' => base_url('propuestas/crt_propuestas/ingresa_tema'), 'method' => 'post'));
$a = '<font color=red size= 3>*</font>';
echo '<font color=brown>Llene la Ficha con la  Informacion Requeridad</font><br><h5>Campos Obligatorios marcados por un asterisco ' . '(' . $a . ')' . '</h5>';
echo '<br>';
echo warning_msg('Detalles Particulares');
echo Open('div', array('class' => 'col-md-12'));
echo Open('div', array('class' => 'col-md-4 form-group'));
echo Open('div', array('class' => 'input-group'));
echo tagcontent('span', $a . '  Identificacion. : ', array('class' => 'input-group-addon'));
echo input(array('type' => 'text', 'name' => 'emp_id', 'id' => 'emp_id', 'placeholder' => 'Escriba su identificacion', 'class' => 'form-control'));
echo Close('div');
echo Close('div');
echo Open('div', array('class' => 'col-md-4 form-group'));
echo Open('div', array('class' => 'input-group'));
echo tagcontent('span', $a . ' Fecha Publicacion: ', array('class' => 'input-group-addon'));
echo input(array('name' => "fechaIn", 'id' => "fechaIn", 'type' => "text", 'class' => "form-control datepicker", 'placeholder' => "Fecha Publicacion"));
echo Close('div');
echo Close('div');
$tiposdepar_combo = combobox($depar, array('label' => 'nombre_depart', 'value' => 'id_dep'), array('name' => 'id_dep', 'class' => 'form-control'), true);
echo Open('div', array('class' => 'col-md-4 form-group'));
echo Open('div', array('class' => 'input-group'));
echo tagcontent('span', '<b>Departamento:</b> ', array('class' => 'input-group-addon'));
echo $tiposdepar_combo;
echo Close('div');
echo Close('div');
$periodos_combo = combobox($periodo, array('label' => 'siglas', 'value' => 'id_per'), array('name' => 'id_periodo', 'class' => 'form-control'), true);
echo Open('div', array('class' => 'col-md-4 form-group'));
Example #4
0
 public function update_mesa()
 {
     $data['mesa_id'] = $this->input->post('mesa_id');
     $data['mesa_nro'] = $this->input->post('mesa_nro');
     $data['mesa_capacidad'] = $this->input->post('mesa_capacidad');
     $data['mesa_estado'] = $this->input->post('estado_id');
     $res = $this->objMesa->update_mesa($data);
     if ($res) {
         echo info_msg('Datos actualizados correctamente', '18px');
     } else {
         echo info_msg('No se actualizaron los datos', '18px');
     }
 }
<?php 
//$this->load->view('dasboard/head_simple');
echo LineBreak(3);
echo info_msg('Modulo de Departamentos Academicos ');
echo '<ul>' . '<li>Nuevos  Departamentos Academicos</li>' . '<li>Eliminar  Departamentos Academicos</li>' . '<li>Modificar  Departamentos Academicos</li>' . '</ul>';
Example #6
0
<?php 
//$this->load->view('dasboard/head_simple');
echo LineBreak(3);
echo info_msg('Modulo de Complementos Academicos ');
echo '<ul>' . '<li>Nuevos  Complementos Academicos</li>' . '<li>Eliminar  Complementos Academicos</li>' . '<li>Modificar  Complementos Academicos</li>' . '</ul>';
<?php 
//$this->load->view('dasboard/head_simple');
echo LineBreak(3);
echo info_msg('Modulo de Matriculacion de Usuarios ');
echo '<ul>' . '<li>Nuevas  Matriculas a Usuarios</li>' . '<li>Eliminar  Matriculas de Usuarios</li>' . '<li>Modificar  Matriculas de Usuarios</li>' . '</ul>';
<?php 
echo info_msg('Listar Expedientes Academicos');
echo Open('form', array('action' => base_url('expedientes/crt_expediente/get_crud_expe'), 'method' => 'post'));
echo tagcontent('button', 'Cargar', array('name' => 'btnreportes', 'class' => 'btn btn-info  col-md-1', 'id' => 'ajaxformbtn', 'type' => 'submit', 'data-target' => 'container-fluid'));
echo Close('form');
echo tagcontent('div', '', array('id' => 'container-fluid', 'class' => 'col-md-12'));
<?php 
echo info_msg('Lista de Estudiante');
echo Open('form', array('action' => base_url('estudiante/crt_estudiante/get_crud_emp'), 'method' => 'post'));
echo tagcontent('button', 'Cargar', array('name' => 'btnreportes', 'class' => 'btn btn-danger  col-md-1', 'id' => 'ajaxformbtn', 'type' => 'submit', 'data-target' => 'container-fluid'));
echo Close('form');
echo tagcontent('div', '', array('id' => 'container-fluid', 'class' => 'col-md-12'));
Example #10
0
<?php 
//$this->load->view('dasboard/head_simple');
echo LineBreak(3);
echo info_msg('Modulo de Modulos  ');
echo '<ul>' . '<li>Nuevos  Modulos</li>' . '<li>Eliminar  Modulos</li>' . '<li>Modificar  Modulos</li>' . '</ul>';
<?php 
echo info_msg('Listar  Matriculaciones de Usuarios ');
echo Open('form', array('action' => base_url('matriculacion/crt_matricula/get_crud_matricula'), 'method' => 'post'));
echo tagcontent('button', 'Cargar', array('name' => 'btnreportes', 'class' => 'btn btn-info  col-md-1', 'id' => 'ajaxformbtn', 'type' => 'submit', 'data-target' => 'container-fluid'));
echo Close('form');
echo tagcontent('div', '', array('id' => 'container-fluid', 'class' => 'col-md-12'));
Example #12
0
function handle_piece_comment($type, $from, $data, $res)
{
    global $connection;
    $from->need_level('member');
    validate_required($data, 'piece_index', 'comment');
    $piece_index = $data['piece_index'];
    $piece_id = _find_piece_id($from, $piece_index);
    $comment = htmlspecialchars(trim(preg_replace('/\\s+/', ' ', $data['comment'])));
    $result = pg_query($connection, 'INSERT INTO pieces_comments VALUES(DEFAULT,' . $piece_id . ',' . $from->user_id() . ',\'' . pg_escape_string($comment) . '\',DEFAULT, \'comment\') RETURNING timestamp');
    $timestamp = pg_fetch_result($result, 0, 0);
    $res->to_sender(info_msg('Comment added to piece #' . $piece_id . '.', $from->nick()));
    $res->to_pie($from, array('piece_comment', array('piece_index' => $piece_index, 'author' => $from->nick(), 'message' => $comment, 'type' => 'comment', 'date' => $timestamp)));
    _update_pie_timestamp($from, $connection);
}
<?php 
//$this->load->view('dasboard/head_simple');
echo LineBreak(3);
echo info_msg('En este modulo ud podra poner su tema de TESIS, <br> una vez realizada la propuesta ' . 'habra un grupo de docentes que evaluaran su propuesta, <br> al momento que ud realiza la propuesta' . 'llegar un correo al grupo de docentes, con este se notifica que un estudiante o docente, <br> ha realizado' . 'una nueva propuesta');
Example #14
0
<?php 
echo info_msg('Listar Modulos Academicos');
echo Open('form', array('action' => base_url('modulos/crt_modulo/get_crud_mod'), 'method' => 'post'));
echo tagcontent('button', 'Cargar', array('name' => 'btnreportes', 'class' => 'btn btn-success  col-md-1', 'id' => 'ajaxformbtn', 'type' => 'submit', 'data-target' => 'container-fluid'));
echo Close('form');
echo tagcontent('div', '', array('id' => 'container-fluid', 'class' => 'col-md-12'));
<?php 
//$this->load->view('dasboard/head_simple');
echo LineBreak(3);
echo info_msg('Modulo de Periodos Academicos ');
echo '<ul>' . '<li>Nuevos  Periodos Academicos</li>' . '<li>Eliminar  Periodos Academicos</li>' . '<li>Modificar  Periodos Academicos</li>' . '</ul>';
<?php 
//$this->load->view('dasboard/head_simple');
echo LineBreak(3);
echo info_msg('Modulo de Expedientes Academicos ');
echo '<ul>' . '<li>Nuevos  Expedientes Academicos</li>' . '<li>Eliminar  Expedientes Academicos</li>' . '<li>Modificar  Expedientes Academicos</li>' . '</ul>';
<?php 
echo info_msg('Listar Periodos Academicos');
echo Open('form', array('action' => base_url('periodosacad/crt_periodo/get_crud_emp'), 'method' => 'post'));
echo tagcontent('button', 'Cargar', array('name' => 'btnreportes', 'class' => 'btn btn-info  col-md-1', 'id' => 'ajaxformbtn', 'type' => 'submit', 'data-target' => 'container-fluid'));
echo Close('form');
echo tagcontent('div', '', array('id' => 'container-fluid', 'class' => 'col-md-12'));
Example #18
0
function handle_get_cat($type, $from, $data, $res)
{
    $res->to_pie($from, info_msg("%s has got the cat!", $from->nick()));
}
<?php 
echo info_msg('Agregar Modulos a Usuarios');
echo Open('form', array('action' => base_url('estudiante/crt_estudiante/get_crud_add_mod_usuarios'), 'method' => 'post'));
echo tagcontent('button', 'Cargar', array('name' => 'btnreportes', 'class' => 'btn btn-primary  col-md-1', 'id' => 'ajaxformbtn', 'type' => 'submit', 'data-target' => 'container-fluid'));
echo Close('form');
echo tagcontent('div', '', array('id' => 'container-fluid', 'class' => 'col-md-12'));
<?php 
echo info_msg('Listar Complementos Academicos');
echo Open('form', array('action' => base_url('materias/crt_materias/get_crud_mat'), 'method' => 'post'));
echo tagcontent('button', 'Cargar', array('name' => 'btnreportes', 'class' => 'btn btn-info  col-md-1', 'id' => 'ajaxformbtn', 'type' => 'submit', 'data-target' => 'container-fluid'));
echo Close('form');
echo tagcontent('div', '', array('id' => 'container-fluid', 'class' => 'col-md-12'));
    foreach ($historial as $row) {
        echo Open('tr');
        $id_propuesta = $row->id_p;
        $nom = $row->nombres;
        $ape = $row->apellidos;
        $email = $row->email;
        $titulo = $row->titulo;
        $contenido = $row->contenido;
        $estado = $row->valor;
        $fecha = $row->fecha_post;
        $depar = $row->nombre_depart;
        echo Close('tr');
    }
}
echo Close('table');
echo info_msg('Historial de Propuesta');
echo '<h5><font class="text-info">' . $nom . ' ' . $ape . '</font></h5>';
echo Close('table');
echo Open('table', array('class' => "table table-striped table-condensed"));
$thead = array('Propuesta Realizada');
echo tablethead($thead);
echo Open('tr');
echo Open('td');
echo '<h5><font class="text-success">TITULO</font></h5>';
echo Close('td');
echo Open('td');
echo $titulo;
echo Close('td');
echo Close('tr');
echo Open('tr');
echo Open('td');
Example #22
0
<?php

echo Open('table', array('class' => "table table-striped table-condensed"));
if (!empty($persona)) {
    foreach ($persona as $row) {
        echo Open('tr');
        $nom = $row->nombres;
        $ape = $row->apellidos;
        echo Close('tr');
    }
}
echo Close('table');
echo info_msg('Agregar Tutor');
echo '<h3><font class="text-info">' . $nom . ' ' . $ape . '</font></h3>';
echo Close('table');
echo Open('form', array('action' => base_url('propuestas/crt_propuestas/save_tutor'), 'method' => 'post'));
echo input(array('type' => 'hidden', 'name' => 'id_pro', 'id' => 'id_pro', 'value' => $id_propuesta));
echo Open('table', array('class' => "table table-striped table-condensed"));
$thead = array('Usuario', 'Tipo Usuario', 'Departamento', 'Op');
echo tablethead($thead);
echo '<br>';
if (!empty($persona)) {
    foreach ($persona as $row) {
        foreach ($tipo_persona as $val) {
            foreach ($depar as $value) {
                if ($row->id_tipopersona == $val->id_typ and $val->id_typ == 4) {
                    if ($row->id_departamento == $value->id_dep) {
                        echo Open('tr');
                        echo tagcontent('td', $row->nombres);
                        echo tagcontent('td', $val->typo_persona);
                        echo tagcontent('td', $value->nombre_depart);
<?php 
echo info_msg('Listar Departamentos Academicos');
echo Open('form', array('action' => base_url('departamentos/crt_departamento/get_crud_dep'), 'method' => 'post'));
echo tagcontent('button', 'Cargar', array('name' => 'btnreportes', 'class' => 'btn btn-info  col-md-1', 'id' => 'ajaxformbtn', 'type' => 'submit', 'data-target' => 'container-fluid'));
echo Close('form');
echo tagcontent('div', '', array('id' => 'container-fluid', 'class' => 'col-md-12'));
Example #24
0
        echo Open('tr');
        $periodo = $row->siglas;
        $id_perio = $row->id_perido;
        echo Close('tr');
    }
}
if ($propuesta) {
    foreach ($propuesta as $row) {
        if ($row->valor == 'pendiente') {
            $estado = $row->id_estado;
            $estado_view = $row->valor;
        }
    }
}
echo lineBreak2(2);
echo info_msg('Visualizacion de la Propuesta publicada');
echo Open('table', array('class' => "table table-striped table-condensed"));
if ($datos_emp) {
    foreach ($datos_emp as $row) {
        echo Open('tr');
        $nom = $row->nombres;
        $ape = $row->apellidos;
        $id_usu = $row->id;
        $email = $row->email;
        echo Close('tr');
    }
}
echo Close('table');
echo '<h4><font class="text-danger">' . $tipo_usu . ': </font><font class="text-info">' . $nom . ' ' . $ape . '</font></h4>';
echo Open('form', array('action' => base_url('propuestas/crt_propuestas/save_tesis_usu'), 'method' => 'post'));
echo input(array('type' => 'hidden', 'name' => 'id_usu', 'id' => 'id_usu', 'value' => $id_usu));
<?php 
//$this->load->view('dasboard/head_simple');
echo LineBreak(3);
echo info_msg('Modulo de Usuarios ');
echo '<ul>' . '<li>Nuevos  Usuarios</li>' . '<li>Eliminar  Usuarios</li>' . '<li>Modificar  Usuarios</li>' . '<li>Permisos a  Usuarios</li>' . '<li>Agregar Modulos a  Usuarios</li>' . '</ul>';
<?php 
echo info_msg('Lista Propuestas de Tesis');
echo Open('form', array('action' => base_url('propuestas/crt_propuestas/get_crud_propuesta'), 'method' => 'post'));
echo tagcontent('button', 'Cargar', array('name' => 'btnreportes', 'class' => 'btn btn-warning  col-md-1', 'id' => 'ajaxformbtn', 'type' => 'submit', 'data-target' => 'container-fluid'));
echo Close('form');
echo tagcontent('div', '', array('id' => 'container-fluid', 'class' => 'col-md-12'));