[ PHPXref.com ] [ Generated: Sun Jul 20 19:53:39 2008 ] [ PHProjekt 5.0.1 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/helpdesk/ -> helpdesk_forms.php (source)

   1  <?php
   2  
   3  // helpdesk_forms.php - PHProjekt Version 5.0

   4  // copyright  ©  2000-2005 Albrecht Guenther  ag@phprojekt.com

   5  // www.phprojekt.com

   6  // Author: Albrecht Guenther, $Author: fgraf $

   7  // $Id: helpdesk_forms.php,v 1.27.2.2 2005/09/07 12:02:58 fgraf Exp $

   8  
   9  // check whether the lib has been included - authentication!

  10  if (!defined("lib_included")) { die("Please use index.php!"); }
  11  
  12  include_once("$lib_path/access_form.inc.php");
  13  
  14  // check role

  15  if (check_role("helpdesk") < 1) { die("You are not allowed to do this!"); }
  16  
  17  // fetch data from record

  18  if ($ID > 0) {
  19    // mark that the user has touched the record

  20    touch_record('rts', $ID);
  21    // fetch values from db

  22    $result = db_query("select ID,contact,email,submit,recorded,name,note,due_date,status,
  23                               assigned,priority,remark,solution,solved,solve_time,acc,div1,div2,proj,
  24                               acc_read, acc_write, von
  25                          from ".DB_PREFIX."rts
  26                         where (acc_read like 'system' or ((von = '$user_ID' or assigned = '$user_ID' or acc_read like 'group' or acc_read like '%\"$user_kurz\"%') and $sql_user_group)) and
  27                                ID = '$ID'") or db_die();
  28    $row = db_fetch_row($result);
  29    if (!$row[0]) { die("You are not privileged to do this!"); }
  30    #printr($row[21]);

  31    // if (($row[9] <> $user_ID and $row[21] <> $user_ID and $row[20] <> 'w') or check_role("helpdesk") < 2 or($row[8]==5)) { $read_o = 1; }

  32    if (($row[9] <> $user_ID and $row[21] <> $user_ID and $row[20] <> 'w') or check_role("helpdesk") < 2) { $read_o = 1; }
  33    else $read_o = 0;
  34  }
  35  
  36  //tabs

  37  $tabs = array();
  38  // form start

  39  $hidden = array();
  40  $buttons = array();
  41  $hidden = array('mode' => 'forms', 'page' => $page,'ID' =>$ID);
  42  if(SID) $hidden[session_name()] = session_id();
  43  $buttons[] = array('type' => 'form_start', 'name' => 'frm', 'hidden' => $hidden, 'onsubmit' => 'return chkForm(\'frm\',\'name\',\''.__('Please insert a name').'\');');
  44  $output=get_buttons($buttons);
  45  $output .= get_tabs_area($tabs);
  46  
  47  // button bar

  48  $buttons = array();
  49  
  50  if (!$read_o){
  51      if (!$ID) {
  52          $buttons[] = array('type' => 'submit', 'name' => 'create_b', 'value' => __('Accept'), 'active' => false);
  53          $buttons[] = array('type' => 'hidden', 'name' => 'anlegen', 'value' => 'neu_anlegen');
  54      } // modify and delete

  55      else {
  56          $buttons[] = array('type' => 'submit', 'name' => 'modify_b', 'value' => __('Accept'), 'active' => false);
  57          // change values

  58          $buttons[] = array('type' => 'hidden', 'name' => 'aendern', 'value' => 'aendern');
  59          // check whether there is no subproject beyond this one. if no -> allow to delete

  60          $result2 = db_query("select ID
  61                                 from ".DB_PREFIX."projekte
  62                                where parent = '$ID'") or db_die();
  63          $row2 = db_fetch_row($result2);
  64          if ($row2[0] == '') {
  65              $buttons[] = array('type' => 'submit', 'name' => 'delete_b', 'value' => __('Delete'), 'active' => false, 'onclick' => 'return confirm(\''.__('Are you sure?').'\');');
  66          }
  67      }
  68  } // end buttons chief only

  69  // history & print

  70  if ($ID > 0) {
  71      $buttons[] = array('type' => 'link', 'href' => $_SERVER['PHP_SELF'].'?mode=view&amp;set_read_flag=1&amp;ID_s='.$ID.$sid, 'text' => __('Mark as read'), 'active' => false);
  72      /* disable

  73      $buttons[] = array('type' => 'link', 'href' => '../misc/history.php?reflink=helpdesk/helpdesk.php&table=rts&mID='.$ID.'&mod='.__('Helpdesk'), 'text' => __('History'), 'active' => false);

  74      */
  75      /* disable print buttons in 5.0

  76      $output.= "<input type='button' onclick='window.open(\"../misc/print.php?ID=$row[0]&module=helpdesk\",\"_blank\")' value='".__('print')."' class='button' />\n";

  77      */
  78  }
  79  // cancel

  80  if ($justform > 0) {
  81      $buttons[] = array('type' => 'button', 'name' => 'close', 'value' => __('Close window'), 'active' => false, 'onclick' => 'window.close();');
  82  }
  83  else {
  84      $buttons[] = array('type' => 'link', 'href' => 'helpdesk.php?type='.$type.'&amp;sort='.$sort.'&amp;mode=view&amp;up='.$up.'&amp;filter='.$filter.'&amp;keyword='.$keyword.'&amp;perpage='.$perpage.'&amp;page='.$page, 'text' => __('Cancel'), 'active' => false);
  85  }
  86  $output .= get_buttons_area($buttons);
  87  $output .= '<div class="hline"></div>';
  88  
  89  /*******************************

  90  *       basic fields

  91  *******************************/
  92  $form_fields = array();
  93  $form_fields[] = array('type' => 'hidden', 'name' => 'ID', 'value' => $ID);
  94  $form_fields[] = array('type' => 'hidden', 'name' => 'mode', 'value' => 'data');
  95  if (SID) $form_fields[] = array('type' => 'hidden', 'name' => session_name(), 'value' => session_id());
  96  foreach($view_param as $key => $value){
  97      $form_fields[] = array('type' => 'hidden', 'name' => $key, 'value' => $value);
  98  }
  99  
 100  $form_fields[] = array('type' => 'parsed_html', 'html' => build_form($fields));
 101  $basic_fields = get_form_content($form_fields);
 102  
 103  /*******************************

 104  *       status fields

 105  *******************************/
 106  $form_fields = array();
 107  // set category

 108  $found_mandatory = false;
 109  $tmp = '
 110  <span class="formk">'.__('Status').':</span>
 111  <div class="formk">
 112  ';
 113  // selected status index

 114  $db_status_ix = -1;
 115  foreach($status_arr as  $status_nr=>$status1){
 116      if($status1[0] == $row[8]){
 117          $db_status_ix = $status_nr;
 118          break;
 119      }
 120  }
 121  foreach ($status_arr as $status_nr=>$status1) {
 122      if ($status1[2] != 2) { // filter active workflow states
 123          $tmp .=  '<input type="radio" name="status" value="'.$status_nr.'"';
 124          // conditions to select them: current status has to be 'earlier' then this status and the person has to be entitled

 125          $allowed_users = array();
 126          foreach ($status1[1] as $db_col) {
 127              $allowed_users[] = $row[$db_col];
 128          }
 129          if (!$found_mandatory and in_array($user_ID, $allowed_users)) {  $tmp .= read_o(0); }
 130          else $tmp .= read_o(1);
 131          // selected?

 132          if ($status1[0] == $row[8]) $tmp .= ' checked="checked"';
 133          $tmp .= " /> ".$status1[3]."<br />\n";
 134          if ($status1[2] == 1 and $status_nr > $db_status_ix) {
 135              $found_mandatory = true;
 136          }
 137      }
 138  }
 139  $form_fields[] = array('type' => 'parsed_html', 'html' => $tmp);
 140  $status_fields = get_form_content($form_fields);
 141  $tmp2 = '
 142  <span class="formk">'.__('Visibility').':</span>
 143  <div class="formk">
 144  ';
 145  /*******************************

 146  *     visibility fields

 147  *******************************/
 148  $form_fields = array();
 149  // selected access

 150  $db_access= $row[15];
 151  foreach($access as  $access_val=>$access_key){
 152       $tmp2 .=  '<input type="radio" name="acc" value="'.$access_val.'"';
 153          if (!$read_o) {  $tmp .= read_o(0); }
 154          else $tmp2 .= read_o(1);
 155          // selected?

 156          if ($access_val == $db_access) $tmp2 .= ' checked="checked"';
 157          $tmp2 .= " /> ".$access_key."<br />\n";
 158         
 159  }
 160  $form_fields[] = array('type' => 'parsed_html', 'html' => $tmp2);
 161  $access_fields = get_form_content($form_fields);
 162  
 163  /*******************************

 164  *      assignment fields

 165  *******************************/
 166  $form_fields = array();
 167  include_once ("../lib/access_form.inc.php");
 168  // acc_read, exclude the user itself, acc_write, no parent possible, write access=yes

 169  $form_fields[] = array('type' => 'parsed_html', 'html' => access_form2($row[19], 1, $row[20], 0, 1,'acc_read'));
 170  $assignment_fields = get_form_content($form_fields);
 171  
 172  $output .= '
 173  <br/>
 174  <div class="inner_content">
 175      <a name="content"></a>
 176      <a name="oben" id="oben"></a>
 177      <div class="boxHeaderLeft">'.__('Basis data').'</div>
 178      <div class="boxHeaderRight"><a class="formBoxHeader" href="#unten">'.__('Links').'</a></div>
 179      <div class="boxContent">'.$basic_fields.'</div></div>
 180      <br style="clear:both"/><br/>
 181  
 182      <div class="boxHeaderLeft">'.__('Ticket status').'</div>
 183      <div class="boxHeaderRight"><a class="formBoxHeader" href="#oben">'.__('Basis data').'</a></div>
 184      <div class="boxContent">'.$status_fields.'</div></div>
 185      <br style="clear:both"/><br/>
 186      
 187      <div class="boxHeaderLeft">'.__('Visibility').'</div>
 188      <div class="boxHeaderRight"><a class="formBoxHeader" href="#oben">'.__('Basis data').'</a></div>
 189      <div class="boxContent">'.$access_fields.'</div></div>
 190      <br style="clear:both"/><br/>
 191  
 192      <a name="unten" id="unten"></a>
 193      <div class="boxHeaderLeft">'.__('Assignment').'</div>
 194      <div class="boxHeaderRight"><a class="formBoxHeader" href="#oben">'.__('Basis data').'</a></div>
 195      <div class="boxContent">'.$assignment_fields.'</div>
 196      <br style="clear:both"/><br/>
 197  </div>
 198      </form>
 199  <br style="clear:both"/><br/>
 200  ';
 201  
 202  echo $output;
 203  
 204  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]