Exemplo n.º 1
0
$userid = GETPOST('userid');
$zone = GETPOST('zone', 'int');
$userid = GETPOST('userid', 'int');
/*
 * View
 */
// Ajout directives pour resoudre bug IE
//header('Cache-Control: Public, must-revalidate');
//header('Pragma: public');
//top_htmlhead("", "", 1);  // Replaced with top_httphead. An ajax page does not need html header.
top_httphead();
print '<!-- Ajax page called with url ' . $_SERVER["PHP_SELF"] . '?' . $_SERVER["QUERY_STRING"] . ' -->' . "\n";
// Add a box
if ($boxid > 0 && $zone != '' && $userid > 0) {
    $tmp = explode('-', $boxorder);
    $nbboxonleft = substr_count($tmp[0], ',');
    $nbboxonright = substr_count($tmp[1], ',');
    print $nbboxonleft . '-' . $nbboxonright;
    if ($nbboxonleft > $nbboxonright) {
        $boxorder = preg_replace('/B:/', 'B:' . $boxid . ',', $boxorder);
    } else {
        $boxorder = preg_replace('/^A:/', 'A:' . $boxid . ',', $boxorder);
    }
    // Insert id of new box into list
}
// Registering the location of boxes after a move
if ($boxorder && $zone != '' && $userid > 0) {
    // boxorder value is the target order: "A:idboxA1,idboxA2,A-B:idboxB1,idboxB2,B"
    dol_syslog("AjaxBox boxorder=" . $boxorder . " zone=" . $zone . " userid=" . $userid, LOG_DEBUG);
    $result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
}
Exemplo n.º 2
0
if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN','1');

require('../main.inc.php');
require_once(DOL_DOCUMENT_ROOT."/boxes.php");


/*
 * View
 */

// Ajout directives pour resoudre bug IE
//header('Cache-Control: Public, must-revalidate');
//header('Pragma: public');

//top_htmlhead("", "", 1);  // Replaced with top_httphead. An ajax page does not need html header.
top_httphead();

print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";

// Registering the location of boxes
if((isset($_GET['boxorder']) && !empty($_GET['boxorder'])) && (isset($_GET['userid']) && !empty($_GET['userid'])))
{
	// boxorder value is the target order: "A:idboxA1,idboxA2,A-B:idboxB1,idboxB2,B"
	dol_syslog("AjaxBox boxorder=".$_GET['boxorder']." userid=".$_GET['userid'], LOG_DEBUG);

	$infobox=new InfoBox($db);
	$result=$infobox->saveboxorder("0",$_GET['boxorder'],$_GET['userid']);
}

?>