dolibarr  9.0.0
block-info.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
26 // This script is called with a POST method.
27 // Directory to scan (full path) is inside POST['dir'].
28 
29 if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal
30 if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
31 if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
32 
33 
34 require '../../main.inc.php';
35 require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
36 
37 $id = GETPOST('id','int');
38 $block = new BlockedLog($db);
39 
40 if ((! $user->admin && ! $user->rights->blockedlog->read) || empty($conf->blockedlog->enabled)) accessforbidden();
41 
42 
43 /*
44  * View
45  */
46 
47 print '<div id="pop-info"><table width="100%" height="80%" class="border"><thead><th width="50%" class="left">'.$langs->trans('Field').'</th><th class="left">'.$langs->trans('Value').'</th></thead>';
48 print '<tbody>';
49 
50 if ($block->fetch($id) > 0)
51 {
52  $objtoshow = $block->object_data;
53  print formatObject($objtoshow, '');
54 }
55 else {
56  print 'Error, failed to get unalterable log with id '.$id;
57 }
58 
59 print '</tbody>';
60 print '</table></div>';
61 
62 
63 $db->close();
64 
65 
73 function formatObject($objtoshow, $prefix)
74 {
75  $s = '';
76 
77  $newobjtoshow = $objtoshow;
78 
79  if (is_object($newobjtoshow) || is_array($newobjtoshow))
80  {
81  //var_dump($newobjtoshow);
82  foreach($newobjtoshow as $key => $val)
83  {
84  if (! is_object($val) && ! is_array($val))
85  {
86  // TODO $val can be '__PHP_Incomplete_Class', the is_object return false
87  $s.='<tr><td>'.($prefix?$prefix.' > ':'').$key.'</td>';
88  $s.='<td>';
89  if (in_array($key, array('date','datef','dateh','datec','datem','datep')))
90  {
91  /*var_dump(is_object($val));
92  var_dump(is_array($val));
93  var_dump(is_array($val));
94  var_dump(@get_class($val));
95  var_dump($val);*/
96  $s.=dol_print_date($val, 'dayhour');
97  }
98  else
99  {
100  $s.=$val;
101  }
102  $s.='</td></tr>';
103  }
104  elseif (is_array($val))
105  {
106  $s.=formatObject($val, ($prefix?$prefix.' > ':'').$key);
107  }
108  elseif (is_object($val))
109  {
110  $s.=formatObject($val, ($prefix?$prefix.' > ':'').$key);
111  }
112  }
113  }
114 
115  return $s;
116 }
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
Definition: index.php:91
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Class to manage Blocked Log.
if(GETPOST('cancel', 'alpha')) if(! GETPOST( 'confirmmassaction', 'alpha') &&$massaction !='presend' &&$massaction !='confirm_presend')
Draft customers invoices.
Definition: list.php:156
dol_print_date($time, $format='', $tzoutput='tzserver', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).