Location: PHPKode > projects > QuickTicket > quickticket/quickticket/qti_adm_statuses.php
<?php

/*
 * PHP versions 4 and 5
 *
 * LICENSE: This source file is subject to version 3.0 of the PHP license
 * that is available through the world-wide-web at the following URI:
 * http://www.php.net/license. If you did not receive a copy of
 * the PHP License and are unable to obtain it through the web, please
 * send a note to hide@address.com so we can mail you a copy immediately.
 *
 * @category   Troubleticket
 * @package    QuickTicket
 * @author     Philippe Vandenberghe <hide@address.com>
 * @copyright  2008-2012 The PHP Group
 * @license    http://www.php.net/license  PHP License 3.0
 * @version    1.9.0.3 build:20081001
 * @link       http://www.qt-cute.org/doc/package/qti
 * @since      File available since Release 1.0.0
 * @deprecated File deprecated in Release 2.0.0
 *
 */

session_start();
require_once('bin/qti_init.php');
include(Translate('qti_lang_adm.inc'));

if ( $oVIP->role!='A' ) die($L['E_admin']);

// INITIALISE

$oVIP->selfurl = 'qti_adm_statuses.php';
$oVIP->exiturl = 'qti_adm_statuses.php';
$oVIP->selfname = $L['Status_man'];
$oVIP->exitname = $L['Status_man'];

// --------
// SUBMITTED for add
// --------

if ( isset($_POST['ok_add']) )
{
  // check id and name

  $id = strtoupper($_POST['id']);
  if ( !ereg('[B-Y]',$id) ) $qti_error="Id $id ".$L['E_invalid']." (B-Y)";
  $name = trim($_POST['name']); if ( get_magic_quotes_gpc() ) $name = stripslashes($name);
  if ( $name=='' ) $qti_error = $L['Status'].S.$L['E_invalid'];

  // add and exit

  if ( empty($qti_error) )
  {
    $qti_error = cStatus::Add($id,$name,'ico_status0.gif');
  }
  if ( empty($qti_error) )
  {
    $oVIP->exiturl = 'qti_adm_status.php?id='.$id;
    $oVIP->exitname = $L['Status_upd'];
    $oVIP->EndMessage('0');
    exit;
  }
}

// --------
// SUBMITTED for show
// --------

if ( isset($_POST['ok_show']) )
{
    $_SESSION[QT]['show_closed'] = $_POST['show_closed'];
    $oDB->Query('UPDATE '.TABSETTING.' SET setting="'.$_SESSION[QT]['show_closed'].'" WHERE param="show_closed"');
    // exit
    $strInfo = $L['S_save'];
}

// --------
// HTML START
// --------

include('qti_adm_p_header.php');
include('qti_adm_p_title.php');

echo '<form method="post" action="',$oVIP->selfurl,'" onsubmit="return ValidateForm(this);">
<table cellspacing="0" class="ta">
<colgroup span="7"><col width="30"></col><col width="30"></col><col></col><col></col><col></col><col width="75"></col><col></col></colgroup>
<tr class="tr_t">
<th class="th_o">Id</th>
<th class="th_o">&nbsp;</th>
<th class="th_o" style="text-align:left">',$L['Status'],'</th>
<th class="th_o" style="text-align:left">',$L['Description'],'</th>
<th class="th_o">',$L['Email'],'</th>
<th class="th_o">',$L['Status_background'],'</th>
<th class="th_o">',$L['Action'],'</th>
</tr>
';

$arrStatuses = cStatus::GetStatus('*');

foreach ( $arrStatuses as $id=>$arrStatus  )
{
  echo '<tr onmouseover="this.style.backgroundColor=\'#eeeeee\';" onmouseout="this.style.backgroundColor=\'#ffffff\';">',N;
  echo '<td class="td_o td_o_sta">',$id,'</td>',N;
  echo '<td class="td_o td_o_sta">',AsImg($_SESSION[QT]['skin_dir'].'/'.$arrStatus['icon'],'-',$arrStatus['statusname'],'ico ico_status'),'</td>',N;
  echo '<td class="td_o td_o_inf"><a class="bold" href="qti_adm_status.php?id=',$id,'">',$arrStatus['statusname'],'</a></td>',N;
  echo '<td class="td_o td_o_inf"><span class="small">',$arrStatus['statusdesc'],'</span></td>',N;
  echo '<td class="td_o td_o_sta">',($arrStatus['mailto']!='' ? $L['Y'] : '<span class="disabled">'.$L['None'].'</span>'),'</td>',N;
  echo '<td class="td_o td_o_sta" ',( empty($arrStatus['color']) ? '' : 'style="background-color:'.$arrStatus['color'].'"'),'>&nbsp;</td>',N;
  echo '<td class="td_o td_o_sta"><a class="small" href="qti_adm_status.php?id=',$id,'">',$L['Edit'],'</a>&nbsp;&middot;&nbsp;';
  if ( ($id=='A') || ($id=='Z') ) { echo '<span class="disabled">',$L['Delete']; } else { echo '<a class="small" href="qti_adm_cmd.php?a=status_del&amp;v=',$id,'">',$L['Delete'],'</a>'; }
  echo '</td>',N,'</tr>',N;
}
echo '
<tr class="tr">
<td class="td_o_all"><input type="text" name="id" value="" size="1" maxlength="1" class="small"/></td>
<td class="td_o_all">&nbsp;</td>
<td class="td_o_all" colspan="5"><input type="text" name="name" value="" size="20" maxlength="24" class="small"/> <input type="submit" name="ok_add" value="',$L['Add'],'"/></td>
</tr>
</table>
</form>
';

echo '<h2>',$L['Display_options'],'</h2>';

echo '
<form method="post" action="',$oVIP->selfurl,'">
<table cellspacing="0" class="ta">
<tr class="tr_t">
<th class="th_o th_o_first" style="width:150px"><label for="show_closed">',$L['Show_z'],'</label></th>
<td class="td_o"><select id="show_closed" name="show_closed">
<option value="0"',($_SESSION[QT]['show_closed']=='0' ? QSEL : ''),'>',$L['N'],'</option>
<option value="1"',($_SESSION[QT]['show_closed']=='1' ? QSEL : ''),'>',$L['Y'],'</option>
</select> <span class="small">',sprintf($L['H_Show_z'],$arrStatuses['Z']['statusname']),'</span></td>
<td class="td_o"><input type="submit" name="ok_show" value="',$L['Ok'],'"/></td>
</tr>
</table>
</form>
';

// --------
// HTML END
// --------

include('qti_adm_p_footer.php');

?>
Return current item: QuickTicket