<?php

if (empty($CFG)) {
    die;
}
// Common login form
$table_data = array();
$table_data[] = array(__('Nombre de Usuario:'), do_get_output('do_input', array('S_login', 'text', $login, 'size="15"')));
$table_data[] = array(__('Contraseña:'), do_get_output('do_input', array('S_passwd', 'password', '', 'size="15"')));
?>

<form method="POST" action="">

<?php 
do_table_input($table_data);
?>

<p class="notice center"><?php 
echo __('Las cookies deben estar habilitadas para pasar este punto.');
?>
<br /><?php 
echo __('Su sesión caducará despues de 1 hora de inactividad.');
?>
</p>

<?php 
do_submit_cancel(__('Iniciar'), __('Cancelar'), get_url());
?>

</form>
<?php

// dummy way to check if this file is loaded by the system
if (empty($CFG) || Context != 'admin') {
    die;
}
// build data table
$table_data = array();
$year = substr($date->fecha, 0, 4);
$month = substr($date->fecha, 5, 2);
$day = substr($date->fecha, 8, 2);
$startyear = (int) strftime('%Y');
// date name
$input_data = do_get_output('do_input_date_select', array('I_e_day', 'I_e_month', 'I_e_year', $day, $month, $year, $startyear, $startyear + 2));
$table_data[] = array(__('Fecha de evento:') . ' *', $input_data);
// date description
$input_data = do_get_output('do_input', array('S_descr', 'text', $date->descr, 'size="30"'));
$table_data[] = array(__('Descripción:') . ' &nbsp;', $input_data);
// show tdata
do_table_input($table_data);
    } elseif (Action == 'listdeletedproposals') {
        $speakers = get_records_sql('SELECT SP.id, SP.login AS descr FROM ' . $CFG->prefix . 'ponente SP
                            JOIN ' . $CFG->prefix . 'propuesta P ON P.id_ponente = SP.id
                            WHERE P.id_status=7');
        $speakers_input = do_get_output('do_input_select', array('filter_id_ponente', $speakers, $id_ponente, true, '', 0, $onChange));
        $table_data[] = array('', __('Modificado por:'), __('Tipo:'), __('Ponente:'));
        $table_data[] = array(__('Filtro:'), $admins_input, $prop_type_input, $speakers_input);
    } elseif (Action == 'scheduleevent' || Action == 'addschedule') {
        // acepted proposals
        $prop_type = get_records_sql('SELECT PT.* FROM ' . $CFG->prefix . 'prop_tipo PT
                                JOIN ' . $CFG->prefix . 'propuesta P ON P.id_prop_tipo=PT.id
                                WHERE P.id_status=5');
        $prop_type_input = do_get_output('do_input_select', array('filter_id_prop_tipo', $prop_type, $id_prop_tipo, true, '', 0, $onChange));
        $track = get_records_sql('SELECT O.* FROM ' . $CFG->prefix . 'orientacion O
                            JOIN ' . $CFG->prefix . 'propuesta P ON P.id_orientacion=O.id
                            WHERE P.id_status=5');
        $track_input = do_get_output('do_input_select', array('filter_id_orientacion', $track, $id_orientacion, true, '', 0, $onChange));
        $table_data[] = array('', __('Tipo:'), __('Orientación:'));
        $table_data[] = array(__('Filtro:'), $prop_type_input, $track_input);
    }
} else {
    // get all tracks
    //$tracks = get_records('orientacion');
    $tracks = get_records_sql('SELECT O.* FROM ' . $CFG->prefix . 'orientacion O
                        JOIN ' . $CFG->prefix . 'propuesta P ON P.id_orientacion=O.id');
    $tracks_input = do_get_output('do_input_select', array('filter_id_orientacion', $tracks, $id_orientacion, true, '', 0, $onChange));
    //headers
    $table_data[] = array('', __('Tipo:'), __('Orientación:'), __('Estado:'));
    $table_data[] = array(__('Filtro:'), $prop_type_input, $tracks_input, $status_input);
}
do_table($table_data, 'prop-filter wide');
}
$input = do_get_output('do_input_yes_no', array('clean_url', $config->value, __('Si'), __('No'), $disabled));
$values[$desc] = $input;
// external authentification
$desc = __('Autentificación');
$config = get_config('auth');
$options = array();
$auths = user_auth_available();
foreach ($auths as $auth) {
    $option = new StdClass();
    $option->id = $auth;
    $option->descr = $auth;
    $options[] = $option;
}
$input = do_get_output('do_input_select', array('auth', $options, $config->value, true, __('Interna'), '', 'style=\'width:100px;\''));
$values[$desc] = $input;
// language selection
$desc = __('Lenguaje por defecto');
$config = get_config('locale');
$options = array();
$langs = languages_available();
foreach ($langs as $lang) {
    $option = new StdClass();
    $option->id = $lang;
    $option->descr = $lang;
    $options[] = $option;
}
$input = do_get_output('do_input_select', array('locale', $options, $config->value, true, 'es_BO', '', 'style=\'width:50px;\''));
$values[$desc] = $input;
//show table input
do_table_values($values, 'narrow');
<?php

if ($USER->id_tadmin != 1 || empty($catalog)) {
    die;
}
$table_data = array();
$datas = get_records($catalog);
if (!empty($datas)) {
    foreach ($datas as $data) {
        if ($catalog == 'tadmin') {
            $input_tareas = do_get_output('do_input', array($catalog . $data->id, 'text', $data->tareas, 'size="50"'));
            $table_data[] = array($data->id, $data->descr, $input_tareas);
        } else {
            $input_descr = do_get_output('do_input', array($catalog . $data->id, 'text', $data->descr, 'size="50"'));
            $table_data[] = array($data->id, $input_descr);
        }
    }
    if (in_array($catalog, $catalogs_addremove_field)) {
        // add input for new option
        $input_descr = do_get_output('do_input', array($catalog . '-new', 'text', '', 'size="50"'));
        $table_data[] = array('+', $input_descr);
    }
    do_table($table_data, 'catalog');
}
if (Context == 'asistente' || Action == 'newperson') {
    // tipo asistente
    if (Context == 'admin') {
        $options = get_records('tasistente');
    } else {
        $options = get_records_select('tasistente', 'id < 100');
    }
    $input_data = do_get_output('do_input_select', array('I_id_tasistente', $options, $user->id_tasistente));
    $table_data[] = array(__('Tipo de Asistente:') . ' *', $input_data, '');
}
if (Context == 'ponente' || Context == 'asistente' || Action == 'newspeaker' || Action == 'newperson') {
    // ciudad
    $input_data = do_get_output('do_input', array('S_ciudad', 'text', $user->ciudad, 'size="15"'));
    $table_data[] = array(__('Ciudad:') . ' &nbsp;', $input_data, '');
    // departamento
    $options = get_records('estado');
    $input_data = do_get_output('do_input_select', array('I_id_estado', $options, $user->id_estado));
    $table_data[] = array(__('Departamento:') . ' *', $input_data, '');
    // fecha de nacimiento
    $input_data = do_get_output('do_input_birth_select', array('I_b_day', 'I_b_month', 'I_b_year', $user->b_day, $user->b_month, $user->b_year));
    $table_data[] = array(__('Fecha de Nacimiento:') . ' &nbsp;', $input_data, '');
}
if (Context == 'ponente' || Action == 'newspeaker') {
    // resumen curricular
    $input_data = <<<END
        <textarea name="S_resume" cols="60" rows="15">{$user->resume}</textarea>
END;
    $table_data[] = array(__('Resumen Curricular:') . ' &nbsp;', $input_data, '');
}
// show tdata
do_table_input($table_data);
<?php

// dummy way to check if this file is loaded by the system
if (empty($CFG) || Context != 'admin') {
    die;
}
// build data table
$table_data = array();
// room name
$input_data = do_get_output('do_input', array('S_nombre_lug', 'text', $room->nombre_lug, 'size="30"'));
$table_data[] = array(__('Nombre:') . ' *', $input_data);
// room description
$input_data = do_get_output('do_input', array('S_ubicacion', 'text', $room->ubicacion, 'size="30"'));
$table_data[] = array(__('Ubicación:') . ' *', $input_data);
// room size
$input_data = do_get_output('do_input_number_select', array('I_cupo', $CFG->limite, 5, $room->cupo));
$info = '<span class="littleinfo">' . __('Vacío si es lugar para conferencias') . '</span>';
$table_data[] = array(__('Capacidad:') . ' &nbsp;', $input_data . $info);
// show tdata
do_table_input($table_data);
<?php

// state/departamento
//$state = get_records('estado');
$onChange = 'onChange=\'form.submit()\'';
$state = get_records_sql('SELECT D.* FROM ' . $CFG->prefix . 'estado D
                       JOIN ' . $CFG->prefix . 'ponente SP ON SP.id_estado=D.id');
$state_input = do_get_output('do_input_select', array('filter_id_estado', $state, $id_estado, true, '', 0, $onChange));
//search box
$search_input = do_get_output('do_input', array('filter_search_lastname', 'text', $search_lastname));
$table_data = array();
if (Action == 'controlpersons') {
    // person type
    $person_type = get_records_sql('SELECT TA.* FROM ' . $CFG->prefix . 'tasistente TA
                                JOIN ' . $CFG->prefix . 'asistente A ON A.id_tasistente = TA.id');
    $person_type_input = do_get_output('do_input_select', array('filter_id_tasistente', $person_type, $id_tasistente, true, '', 0, $onChange));
    $table_data[] = array('', __('Apellidos:'), __('Departamento:'), __('Tipo de asistente:'));
    $table_data[] = array(__('Filtro:'), $search_input, $state_input, $person_type_input);
} else {
    //$education = get_records('estudios');
    $education = get_records_sql('SELECT ST.* FROM ' . $CFG->prefix . 'estudios ST
                            JOIN ' . $CFG->prefix . 'ponente SP ON SP.id_estudios=ST.id');
    $education_input = do_get_output('do_input_select', array('filter_id_estudios', $education, $id_estudios, true, '', 0, $onChange));
    $table_data[] = array('', __('Apellidos:'), __('Departamento:'), __('Estudios:'));
    $table_data[] = array(__('Filtro:'), $search_input, $state_input, $education_input);
}
do_table($table_data, 'prop-filter wide');
<?php

// dummy way to check if this file is loaded by the system
if (empty($CFG)) {
    die;
}
// build data table
$table_data = array();
//file title
$input_data = do_get_output('do_input', array('S_title', 'text', $file->title, 'size="20" maxlength="50"'));
$table_data[] = array(__('Título:') . ' *', $input_data);
//description
$input_data = <<<END
<textarea name="S_descr" cols="50" rows="2">{$file->descr}</textarea>
END;
$table_data[] = array(__('Descripción:') . ' *', $input_data);
// public?
$input_data = do_get_output('do_input_yes_no', array('I_public', $file->public));
$table_data[] = array(__('Público:') . ' *', $input_data);
// file!
if (Action == 'editfile') {
    $input_data = $file->name;
} else {
    $input_data = do_get_output('do_input', array('S_filename', 'file', '', 'id=\'S_filename\''));
    $input_data .= '<br /><span class="littleinfo">' . __('El tamaño máximo de subida es de <strong>2 Mb</strong>, si tu archivo supera el límite<br /> por favor envíalo a') . ' <a href="mailto:' . $CFG->adminmail . '">' . $CFG->adminmail . '</a>';
}
$table_data[] = array(__('Archivo:') . ' *', $input_data);
// show tdata
do_table_input($table_data, 'narrow-form');
$input_data = do_get_output('do_input_select', array('I_id_orientacion', $options, $proposal->id_orientacion));
$table_data[] = array(__('Orientación:') . ' *', $input_data);
// nivel
$options = get_records('prop_nivel');
$input_data = do_get_output('do_input_select', array('I_id_nivel', $options, $proposal->id_nivel));
$table_data[] = array(__('Nivel:') . ' *', $input_data);
// tipo propuesta
if (Context == 'admin') {
    $options = get_records('prop_tipo');
} else {
    $options = get_records_select('prop_tipo', 'id < 100');
}
$input_data = do_get_output('do_input_select', array('I_id_tipo', $options, $proposal->id_prop_tipo));
$table_data[] = array(__('Tipo de Propuesta:') . ' *', $input_data);
// duracion
$input_data = do_get_output('do_input_number_select', array('I_duracion', 1, 4, $proposal->duracion, true, '', 0, true));
$table_data[] = array(__('Duración:') . ' *', $input_data);
// resumen
$input_data = <<<END
<textarea name="S_resumen" cols="60" rows="15">{$proposal->resumen}</textarea>
END;
$table_data[] = array(__('Resumen:') . ' *', $input_data);
// requisitos tecnicos
$input_name = '' . __('Requisitos técnicos de la ponencia:') . '&nbsp;<br /><small>' . __('(Estos son los requisitos necesarios para impartir la ponencia)') . '</small>';
$input_data = <<<END
<textarea name="S_reqtecnicos" cols="60" rows="5">{$proposal->reqtecnicos}</textarea>
END;
$table_data[] = array($input_name, $input_data);
// requisitos para el asistente
$input_data = <<<END
<textarea name="S_reqasistente" cols="60" rows="5">{$proposal->reqasistente}</textarea>
<?php

// name of the conference
$config = get_config('conference_name');
$configs = array('conference_name', 'conference_link', 'adminmail', 'general_mail', 'wwwroot');
foreach ($configs as $config) {
    $cfg = get_config($config);
    if (empty($cfg->value)) {
        $cfg->value = $CFG->{$config};
    }
    ${$config} = do_get_output('do_input', array($config, 'text', $cfg->value, 'size="30"'));
}
$values = array(__('Nombre del Evento') => $conference_name, __('URL del Evento') => $conference_link, __('Email de Contacto') => $adminmail, __('Email automático') => $general_mail, __('URL del Sistema') => $wwwroot);
do_table_values($values, 'narrow');
?>

$default_lugar = '';
//organizational events can assign to no room
if (Action == 'newevent' || $proposal->id_prop_tipo > 100) {
    //    $default_lugar = 'Exteriores';
}
if (!empty($rooms)) {
    $input_data = do_get_output('do_input_select', array('I_id_lugar', $rooms, $event->id_lugar, true, $default_lugar));
} else {
    $input_data = '<em>' . __('No se encuentra ningún lugar registrado') . '</em>';
}
$table_data[] = array(__('Lugar de evento:') . ' *', $input_data);
// hour
//$input_data = do_get_output('do_input_number_select', array('I_hora', $CFG->def_hora_ini, $CFG->def_hora_fin-1, $event->hora));
$input_data = do_get_output('do_input_time_slot', array('I_hora', $CFG->def_hora_ini, $CFG->def_hora_fin - 1, $event->hora, $proposal->duracion));
$table_data[] = array(__('Hora:') . ' *', $input_data);
if (Action == 'newevent') {
    // duracion
    $input_data = do_get_output('do_input_number_select', array('I_duracion', 1, 4, $proposal->duracion, true, '', 0, true));
    $table_data[] = array(__('Duración:') . ' *', $input_data);
}
// show extraordinary option to magistral conference and organizational events
// DISABLED
if (false && (Action == 'newevent' || $proposal->id_prop_tipo >= 100)) {
    // extraordinario
    $selected = empty($extraordinario) ? 0 : 1;
    $input_data = do_get_output('do_input_yes_no', array('I_extraordinario', $selected));
    $desc = '<span class="littleinfo">' . __('Selecciona "Si" para reservar la hora en todos los lugares.') . '</span>';
    $table_data[] = array(__('Evento extraordinario:') . ' *', $input_data . $desc);
}
// show tdata
do_table_input($table_data, 'left');
<?php

$onChange = 'onChange=\'form.submit()\'';
// only filter by tadmin
$admin_types = get_records('tadmin');
$admin_input = do_get_output('do_input_select', array('filter_id_tadmin', $admin_types, $id_tadmin, true, '', 0, $onChange));
$table_data = array();
$table_data[] = array('', __('Tipo:'));
$table_data[] = array(__('Filtro:'), $admin_input);
do_table($table_data, 'prop-filter wide');
?>