Esempio n. 1
0
 | or comments regarding this code should be directed to:                  |
 | - iberry@raxnet.net                                                     |
 +-------------------------------------------------------------------------+
 | - raXnet - http://www.raxnet.net/                                       |
 +-------------------------------------------------------------------------+
*/

include("./include/auth.php");
include_once("./lib/utility.php");

/* set default action */
if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; }

switch ($_REQUEST["action"]) {
	case 'save':
		form_save();

		break;
	case 'item_remove':
		item_remove();

		header("Location: graphs.php?action=graph_edit&id=" . $_GET["local_graph_id"]);
		break;
	case 'item_edit':
		include_once("./include/top_header.php");

		item_edit();

		include_once("./include/bottom_footer.php");
		break;
	case 'item_movedown':
Esempio n. 2
0
    function form_edit($obj)
    {
        $dd = array($obj->id);
        $saved = 0;
        /* recupera post */
        $CI =& get_instance();
        $post = $CI->input->post();
        $cp = $obj->cp;
        /* Recupera dados do banco */
        $recupera = 0;
        /* recupera ACAO do post */
        $acao = '';
        if (!isset($post['acao'])) {
            $recupera = 1;
        }
        /* Save in table */
        if ($recupera == 0) {
            /* Valida */
            $saved = valida_post($cp);
            if ($saved > 0) {
                form_save($obj);
            }
        }
        $tela = '';
        $tela .= '
			<table class="form_tabela" width="100%" border=0 >
			<tr>
				<td>' . form_open() . '</td>
			</tr>
			';
        if ($recupera == 1) {
            /* recupera dados do banco */
            if (strlen($obj->tabela) > 0) {
                $data = le_dados($obj);
            } else {
                $recupera = 0;
            }
        } else {
            $data = array();
        }
        //$tela .= 'Recupera = ' . $recupera;
        for ($r = 0; $r < count($cp); $r++) {
            /* Recupera dados */
            $vlr = '';
            if ($recupera == 1) {
                /* banco de dados */
                $fld = $cp[$r][1];
                if (isset($data->{$fld})) {
                    $vlr = $data->{$fld};
                }
            } else {
                if (isset($post['dd' . $r])) {
                    $vlr = $post['dd' . $r];
                }
            }
            $tela .= form_field($cp[$r], $vlr);
        }
        $tela .= '</table>';
        $tela .= "\n\t\t<script>\n\t\t\t\$(document).ready(function(){\n  \t\t\t\t\$('.date').mask('00/00/0000');\n  \t\t\t\t\$('.money').mask('000.000.000.000.000,00', {reverse: true});\n\t\t\t});\n\t\t</script>\n\t\t";
        $tela .= form_close();
        $data = array('tela' => $tela, 'saved' => $saved);
        return $data;
    }