*/ if ($_GET['a'] == 'editar' and $_GET['b']) { //EDITAR EMPRESA $result = mysql_query("SELECT ID, url, nombre, user_ID, descripcion, web, cat_ID, time,\r\n(SELECT nombre FROM " . SQL . "cat WHERE ID = " . SQL . "empresas.cat_ID LIMIT 1) AS cat_nom,\r\n(SELECT url FROM " . SQL . "cat WHERE ID = " . SQL . "empresas.cat_ID LIMIT 1) AS cat_url,\r\n(SELECT nick FROM " . SQL_USERS . " WHERE ID = " . SQL . "empresas.user_ID LIMIT 1) AS nick\r\nFROM " . SQL . "empresas\r\nWHERE ID = '" . $_GET['b'] . "' \r\nAND user_ID = '" . $pol['user_ID'] . "'\r\nLIMIT 1", $link); while ($r = mysql_fetch_array($result)) { $txt_title = 'Empresa: ' . $r['nombre'] . ' - Sector: ' . $r['cat_nom']; $txt_nav = array('/empresas' => 'Empresas', '/empresas/' . $r['url'] => $r['cat_nom'], $r['nombre'], 'Editar'); include 'inc-functions-accion.php'; $txt .= '<h1 class="quitar">Editar: ' . $r['nombre'] . '</h1> <form action="/accion.php?a=empresa&b=editar&ID=' . $r['ID'] . '" method="post"> <input type="hidden" name="return" value="' . $r['cat_url'] . '/' . $r['url'] . '/" /> <p class="amarillo">Fundador: <b>' . crear_link($r['nick']) . '</b> el <em>' . explodear(" ", $r['time'], 0) . '</em>, sector: <a href="/empresas/' . $r['cat_url'] . '/">' . $r['cat_nom'] . '</a></p> <p class="amarillo">' . editor_enriquecido('txt', $r['descripcion']) . '</p> <p><input type="submit" value="Guardar" /> <a href="/empresas/"><b>Ver Empresas</b></a></form></p> '; } } elseif ($_GET['a'] == 'crear-empresa') { //CREAR EMPRESA $result = mysql_query("SELECT ID, url, nombre, num\r\nFROM " . SQL . "cat\r\nWHERE tipo = 'empresas'\r\nORDER BY num DESC", $link); while ($r = mysql_fetch_array($result)) { $txt_li .= '<option value="' . $r['ID'] . '">' . $r['nombre'] . '</option>'; } $txt .= '<h1 class="quitar"><a href="/empresas/">Empresas</a>: Crear Empresa</h1> <form action="/accion.php?a=empresa&b=crear" method="post"> <p>Sector: <select name="cat">' . $txt_li . '</select> (No modificable)</p>
include 'inc-functions-accion.php'; $txt .= '<h1><a href="/partidos">' . NOM_PARTIDOS . '</a>: ' . $r['siglas'] . ' (' . $r['nombre'] . ')</h1> <ul id="partido"> <li><form action="/accion.php?a=partido-lista&b=add&ID=' . $r['ID'] . '" method="post"><select name="user_ID">' . $ciudadanos . '</select> <input type="submit" value="Añadir a la lista"' . $disabled . ' /> (afiliados a tu ' . NOM_PARTIDOS . ')</form><br /></li> <li><b>Lista:</b> Candidatos (' . $candidatos_num . ') <ol> ' . $li_listas . ' </ol><br /> </li> <li>Introducción, descripción: <form action="/accion.php?a=partido-lista&b=edit&ID=' . $r['ID'] . '" method="post"> ' . editor_enriquecido('text', $text) . ' <input type="submit" value="Guardar" /><br /><br /></form></li> <li><form action="/accion.php?a=partido-lista&b=del-afiliado&ID=' . $r['ID'] . '" method="post"><select name="user_ID">' . $ciudadanos_full . '</select> <input type="submit" value="Desafiliar" /></form><br /></li> <li><form action="/accion.php?a=partido-lista&b=ceder-presidencia&ID=' . $r['ID'] . '" method="post"><select name="user_ID">' . $ciudadanos_full . '</select> <input type="submit" value="Ceder Presidencia" onClick="if (!confirm(\'¿Estas convencido de que quieres CEDER tu cargo de Presidente de ' . $r['siglas'] . ' para siempre?\')) { return false; }" /> (Cederás el control total a este ciudadano)</form></li> </ul>'; } else { //print listas $num_listas = 0; $result2 = mysql_query("SELECT user_ID,\r\n(SELECT nick FROM users WHERE ID = " . SQL . "partidos_listas.user_ID LIMIT 1) AS nick,\r\n(SELECT voto_confianza FROM users WHERE ID = " . SQL . "partidos_listas.user_ID LIMIT 1) AS confianza,\r\n(SELECT fecha_last FROM users WHERE ID = " . SQL . "partidos_listas.user_ID LIMIT 1) AS fecha_last\r\nFROM " . SQL . "partidos_listas\r\nWHERE ID_partido = '" . $r['ID'] . "'\r\nORDER BY ID ASC", $link); while ($r2 = mysql_fetch_array($result2)) { $li_presi = ''; if (!ASAMBLEA and !$li_listas) {
function polform($action, $pol_form, $submit = 'Enviar', $submit_disable = false) { global $pol, $link; $f .= '<div class="pol_form"> <form action="/accion.php?a=' . $action . '" method="post"> <input type="hidden" name="user_ID" value="' . $pol['user_ID'] . '" /> <ol> '; if ($pol_form) { foreach ($pol_form as $v) { if (!$v['size']) { $v['size'] = '30'; } if (!$v['maxlenght']) { $v['maxlength'] = '255'; } switch ($v['type']) { case 'hidden': $f .= '<input type="hidden" name="' . $v['name'] . '" value="' . $v['value'] . '" />' . "\n"; break; case 'textrico': $f .= '<li><b>' . $v['nombre'] . ':</b><br />'; include 'inc-functions-accion.php'; $f .= editor_enriquecido($v['name']) . '</li>' . "\n"; break; case 'text': $f .= '<li><b>' . $v['nombre'] . ':</b> ' . $v['desc'] . '<br /><input type="' . $v['type'] . '" name="' . $v['name'] . '" size="' . $v['size'] . '" maxlength="' . $v['maxlegth'] . '" /></li>' . "\n"; break; case 'select_partidos': $f .= '<li><b>' . NOM_PARTIDOS . ':</b><br /><select name="partido"><option value="0">Ninguno</option>'; $result = mysql_query("SELECT siglas, ID FROM " . SQL . "partidos WHERE estado = 'ok' ORDER BY siglas ASC", $link); while ($row = mysql_fetch_array($result)) { if ($v['partido'] == strtolower($row['siglas'])) { $selected = ' selected="selected"'; } else { $selected = ''; } $f .= '<option value="' . $row['ID'] . '"' . $selected . '>' . $row['siglas'] . '</option>'; } $f .= '</select></li>' . "\n"; break; case 'select_nivel': $f .= '<li><b>Nivel de acceso:</b> Selecciona el nivel minimo necesario para editar el documento.<br />' . form_select_nivel() . '</li>' . "\n"; break; case 'select_cat': $f .= '<li><b>Categoría:</b><br />' . form_select_cat('docs') . '</li>' . "\n"; break; case 'selectexpire': $f .= '<li><b>Duración:</b> tiempo de expiración de la expulsión.<br /> <select name="expire"> <option value="60">1 minuto</option> <option value="120">2 minutos</option> <option value="300">5 minutos</option> <option value="600">10 minutos</option> <option value="900">15 minutos</option> <option value="1800">30 minutos</option> <option value="3600">1 hora</option> <option value="18000">5 horas</option> <option value="86400">1 día</option> <option value="259200">3 días</option> <option value="518400">6 días</option> <option value="777600">9 días</option> </select></li>' . "\n"; break; } } } if ($submit_disable == true) { $submit_disable = ' disabled="disabled"'; } $f .= '<li><input type="submit" value="' . $submit . '"' . $submit_disable . ' /></li></ol></form></div>'; return $f; }