dolibarr  7.0.0-beta
box.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
3  * Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
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 
24 if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
25 if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
26 if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
27 if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
28 if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
29 //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
30 if (! defined('NOREQUIREHOOK')) define('NOREQUIREHOOK','1');
31 
32 require '../../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
34 
35 $boxid=GETPOST('boxid','int');
36 $boxorder=GETPOST('boxorder');
37 $userid=GETPOST('userid');
38 $zone=GETPOST('zone','int');
39 $userid=GETPOST('userid','int');
40 
41 
42 /*
43  * View
44  */
45 
46 // Ajout directives pour resoudre bug IE
47 //header('Cache-Control: Public, must-revalidate');
48 //header('Pragma: public');
49 
50 //top_htmlhead("", "", 1); // Replaced with top_httphead. An ajax page does not need html header.
51 top_httphead();
52 
53 print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
54 
55 // Add a box
56 if ($boxid > 0 && $zone !='' && $userid > 0)
57 {
58  $tmp=explode('-',$boxorder);
59  $nbboxonleft=substr_count($tmp[0],',');
60  $nbboxonright=substr_count($tmp[1],',');
61  print $nbboxonleft.'-'.$nbboxonright;
62  if ($nbboxonleft > $nbboxonright) $boxorder=preg_replace('/B:/','B:'.$boxid.',',$boxorder); // Insert id of new box into list
63  else $boxorder=preg_replace('/^A:/','A:'.$boxid.',',$boxorder); // Insert id of new box into list
64 }
65 
66 // Registering the location of boxes after a move
67 if ($boxorder && $zone != '' && $userid > 0)
68 {
69  // boxorder value is the target order: "A:idboxA1,idboxA2,A-B:idboxB1,idboxB2,B"
70  dol_syslog("AjaxBox boxorder=".$boxorder." zone=".$zone." userid=".$userid, LOG_DEBUG);
71 
72  $result=InfoBox::saveboxorder($db,$zone,$boxorder,$userid);
73  if ($result > 0)
74  {
75  $langs->load("boxes");
76  if (! GETPOST('closing'))
77  {
78  setEventMessages($langs->trans("BoxAdded"), null);
79  }
80  }
81 }
82 
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...
static saveboxorder($db, $zone, $boxorder, $userid=0)
Save order of boxes for area and user.
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
print
Draft customers invoices.
Definition: index.php:91
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html')
Show HTTP header.
Definition: main.inc.php:1052