<?php
////////////////////////////////////////////////// opciones para tickets
include("postget.php");
include_once("common.php");
$pagetitle = _SUPPORT_TICKETS;

checklevel(4,$_REQUEST['clientid']);
if ($config[56][1]==1){
	$disabled=" disabled ";
	$mensaje= " "._CHANGE_NOT_ALLOWED_IN_DEMO_MODE;
}else{
	$disabled=" ";
	$mensaje= "";
}


//////////////////////////////////////////////////////////////// si se envi� el formulario, cargar los errores
if ($_REQUEST[sendclick]==""._SEND."") {
	$estiloerror = "class='formfielderror'";
	$errors = '';
	if ($_POST['new9']=='') {$errors.= "<br>".ucfirst(_ATTACHMENTS." "._ALLOWED_FILE_TYPES).": "._NOT_SPECIFIED.""; $estilonew9=$estiloerror;}
	if ($_POST['new4']=='') {$errors.= "<br>".ucfirst(_TICKET_SEPARATOR).": "._NOT_SPECIFIED.""; $estilonew4=$estiloerror;}
	if ($_POST['new10']<1) {$errors.= "<br>".ucfirst(_DAYS_TO_CLOSE_TICKETS_ALREADY_ANSWERED).": "._NOT_SPECIFIED.""; $estilonew10=$estiloerror;}
	if ($_POST['new53']<1) {$errors.= "<br>".ucfirst(_REFRESH_THE_TICKETS_PANEL_EVERY).": "._NOT_SPECIFIED.""; $estilonew53=$estiloerror;}
}

//////////////////////////////////////////////////////////////// si no hay errores y se presion� SEND
if($errors=='' AND $_REQUEST[sendclick] ==""._SEND."") {
	if($new80=="on"){$new80=1;}else{$new80=0;}
//	if($new109=="on"){$new109=1;}else{$new109=0;}
	if($new110=="on"){$new110=1;}else{$new110=0;}

	mysql_query("UPDATE hd_config SET valor='$new9' WHERE ref='9'",$db_link);
	mysql_query("UPDATE hd_config SET valor='$new10' WHERE ref='10'",$db_link);
	mysql_query("UPDATE hd_config SET valor='$new53' WHERE ref='53'",$db_link);
	mysql_query("UPDATE hd_config SET valor='$new4' WHERE ref='4'",$db_link);
	mysql_query("UPDATE hd_config SET valor='$new80' WHERE ref='80'",$db_link);
	mysql_query("UPDATE hd_config SET valor='$new100' WHERE ref='100'",$db_link);
//	mysql_query("UPDATE hd_config SET valor='$new109' WHERE ref='109'",$db_link);
	mysql_query("UPDATE hd_config SET valor='$new110' WHERE ref='110'",$db_link);
	messagetop(_THE_CHANGES_WHERE_MADE_SUCCESSFULLY,'','preferences14.php',1);

}else{


	$query="SELECT * FROM hd_config ORDER BY ref";
	$result=mysql_query($query,$db_link);
	$fila=0;
	while($row=mysql_fetch_array($result)) 	{
		$Config[$fila][0]=$row["variable"] ;
		$Config[$fila][1]="'".$row["valor"]."'";
		//	$Config[$fila][1]=$row["valor"];
		$fila++ ;

	}

	include("head_template.php");
	echo '
<div class="container">
	<div class="row">
';

	print errors($errors); $errors = '';


	print("<form method='POST'>");
echo '<table class="table table-bordered">';

	print("<tr><td>".ucfirst(_ATTACHMENTS).": "._ALLOWED_FILE_TYPES.": </td><td>");
	print("<input $estilonew9 name=new9 value=".$Config[9][1]." size='60'> ("._SEPARATED_BY_SPACES.")</td></tr>");

	print("<tr><td>".ucfirst(_TICKET_SEPARATOR)." </td><td>");
	print("<input $estilonew4 name=new4 value='".$config[4][1]."' size='60'></td></tr>");

	print("<tr><td>".ucfirst(_DAYS_TO_CLOSE_TICKETS_ALREADY_ANSWERED).": </td><td>");
	print("<input $estilonew10 name=new10 value=".$Config[10][1]."></td></tr>");

	print("<tr><td>".ucfirst(_REFRESH_THE_TICKETS_PANEL_EVERY)." </td><td>");
	print("<input $estilonew53 name=new53 value=".$Config[53][1]."> ".strtolower(_SECONDS)."</td></tr>");

	print("<tr><td>".ucfirst(_SHOW_TIME_DIFFERENCE_BETWEEN_THE_RESPONSES).": </td><td>");
	print("<input type='checkbox' name=new80");
	if ($config[80][1]=='1'){print(" checked");};
	print("></td></tr>");

	print("<tr><td>".ucfirst(_HIGHLIGHT_THE_TIME_WITHOUT_REPLY_IN_MINUTES_OR_HOURS).": </td><td>");
	print("
        <label class='radio'>
        <input type='radio' name=new100 value='1'");
	if ($config[100][1]=='1'){print(" checked");}
	print("><span class='metro-radio'>"._MINUTES."</span></label> &nbsp;&nbsp;");
	print("
        <label class='radio'>
        <input type='radio' name=new100 value='2'");
	if ($config[100][1]=='2'){print(" checked");}
	print("><span class='metro-radio'>"._HOURS."</span></label> &nbsp;&nbsp;");
	print("</td></tr>");

//	print("<tr><td>".ucfirst(_ENABLE_TRANSLATION).": </td><td>");
//	print("<input type='checkbox' name=new109");
//	if ($config[109][1]=='1'){print(" checked");};
//	print('><strong>Important:</strong> Google Translate API requires billing information for all accounts before you can start using the service. To sign up for billing, sign in to the <a href="https://code.google.com/apis/console" target="_blank">Google APIs console</a> and click the <strong>Billing</strong> tab.</td></tr>');

	print("<tr><td>".ucfirst(_SHOW_USER_ICON_IN_EACH_MESSAGE).": </td><td>");
	print("<input type='checkbox' name=new110");
	if ($config[110][1]=='1'){print(" checked");};
	print("></td></tr>");

	print("</table>");
	print("<input type=submit name=sendclick value="._SEND." $disabled>$mensaje<input type=hidden name=sendclick value="._SEND."></form>");

echo '
</div>
</div>
';
	include("foot_template.php");
}
?>