<?php
	include_once("../../core.php");
	include_once($docroot."/config.inc.php");
	include_once($docroot."/lib/user_check.php");
	include_once($docroot."/lib/permissions_check.php");
	
	switch( $html->form('op', 'post') ){
		case "update":
			if( $permessi[$module_name] == 'rw' ){
				
				$id_newmodule = $html->form('id_newmodule', 'post');
				$location = $html->form('location', 'post');
				$nome = $html->form('name', 'post');
				$class = $html->form('class', 'post');
				$colore = $html->form('colore', 'post');
				$icon = $html->form('icon', 'post');
				( $_POST['enabled'] == 'on' ) ? $enabled=1 : $enabled=0;
				
				
				$query = "UPDATE zz_widget_modules SET name=\"".$nome."\", icon=\"".$icon."\" , class=\"".$class."\" , id_module=\"".$id_newmodule."\" , enabled=\"".$enabled."\" , location=\"".$location."\" , bgcolor=\"".$colore."\" WHERE id=\"".$id_record."\" ";
				$rs = $dbo->query( $query );
				array_push( $_SESSION['infos'], "Informazioni salvate correttamente!" );
				
			}
			break;

		case "add":
			if( $permessi[$module_name] == 'rw' ){
				
			}
			break;

		
	}
?>
