2004-10-19 20:58:50 +02:00
< ? php
2005-07-22 14:13:19 +02:00
/* Copyright ( C ) 2003 - 2005 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2013-01-15 15:53:35 +01:00
* Copyright ( C ) 2004 - 2013 Laurent Destailleur < eldy @ users . sourceforge . net >
2012-12-30 15:13:49 +01:00
* Copyright ( C ) 2005 - 2012 Regis Houssin < regis . houssin @ capnetworks . com >
2003-02-13 18:18:18 +01:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2003-02-13 18:18:18 +01:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2011-08-01 00:21:57 +02:00
* along with this program . If not , see < http :// www . gnu . org / licenses />.
2003-02-13 18:18:18 +01:00
*/
2004-08-14 14:47:39 +02:00
2005-02-27 18:57:21 +01:00
/**
2010-03-01 10:20:41 +01:00
* \file htdocs / admin / boxes . php
2010-04-20 20:23:55 +02:00
* \brief Page to setup boxes
2010-03-01 10:20:41 +01:00
*/
2004-08-14 14:47:39 +02:00
2012-08-22 23:24:21 +02:00
require '../main.inc.php' ;
2012-08-23 02:04:35 +02:00
include_once DOL_DOCUMENT_ROOT . '/core/boxes/modules_boxes.php' ;
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php' ;
2012-08-23 02:04:35 +02:00
include_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php' ;
2006-11-05 19:21:28 +01:00
2004-08-29 14:01:58 +02:00
$langs -> load ( " admin " );
2013-01-16 15:54:07 +01:00
$langs -> load ( " boxes " );
2004-08-05 03:44:51 +02:00
2012-07-09 18:09:44 +02:00
if ( ! $user -> admin ) accessforbidden ();
2004-02-15 01:05:21 +01:00
2011-11-02 20:24:51 +01:00
$rowid = GETPOST ( 'rowid' , 'int' );
2012-07-09 18:09:44 +02:00
$action = GETPOST ( 'action' , 'alpha' );
2004-02-15 01:05:21 +01:00
2014-08-01 00:53:29 +02:00
2013-04-23 16:18:26 +02:00
// Define possible position of boxes
2014-08-01 00:53:29 +02:00
$pos_name = InfoBox :: getListOfPagesForBoxes ();
2005-01-18 22:51:04 +01:00
$boxes = array ();
2011-11-02 22:15:59 +01:00
2005-01-18 22:51:04 +01:00
/*
* Actions
*/
2011-11-28 23:11:27 +01:00
2011-11-02 20:24:51 +01:00
if ( $action == 'addconst' )
2011-11-02 22:15:59 +01:00
2008-05-19 03:31:46 +02:00
{
2009-04-27 22:37:50 +02:00
dolibarr_set_const ( $db , " MAIN_BOXES_MAXLINES " , $_POST [ " MAIN_BOXES_MAXLINES " ], '' , 0 , '' , $conf -> entity );
2008-05-19 03:31:46 +02:00
}
2005-02-27 18:57:21 +01:00
2011-11-02 20:24:51 +01:00
if ( $action == 'add' )
2003-02-13 18:18:18 +01:00
{
2012-03-17 21:32:10 +01:00
$error = 0 ;
2010-04-20 20:23:55 +02:00
2012-03-17 21:32:10 +01:00
$db -> begin ();
2014-05-19 00:05:49 +02:00
// Initialize distinct fkuser with all already existing values of fk_user (user that use a personalized view of boxes for page "pos")
2012-03-17 21:32:10 +01:00
$distinctfkuser = array ();
if ( ! $error )
2010-04-19 08:43:15 +02:00
{
2012-03-17 21:32:10 +01:00
$sql = " SELECT fk_user " ;
$sql .= " FROM " . MAIN_DB_PREFIX . " user_param " ;
$sql .= " WHERE param = 'MAIN_BOXES_ " . $db -> escape ( GETPOST ( " pos " , " alpha " )) . " ' AND value = '1' " ;
$sql .= " AND entity = " . $conf -> entity ;
$resql = $db -> query ( $sql );
2014-06-12 11:31:53 +02:00
dol_syslog ( " boxes.php search fk_user to activate box for " , LOG_DEBUG );
2012-03-17 21:32:10 +01:00
if ( $resql )
{
$num = $db -> num_rows ( $resql );
$i = 0 ;
while ( $i < $num )
{
$obj = $db -> fetch_object ( $resql );
$distinctfkuser [ $obj -> fk_user ] = $obj -> fk_user ;
$i ++ ;
}
}
else
2010-04-19 08:43:15 +02:00
{
2014-07-20 01:43:46 +02:00
setEventMessage ( $db -> lasterror (), 'errors' );
2012-03-17 21:32:10 +01:00
$error ++ ;
2007-03-16 19:46:04 +01:00
}
2012-03-17 21:32:10 +01:00
}
2010-04-20 20:23:55 +02:00
2014-05-19 00:05:49 +02:00
$distinctfkuser [ '0' ] = '0' ; // Add entry for fk_user = 0. We must use string as key and val
2012-03-17 21:32:10 +01:00
foreach ( $distinctfkuser as $fk_user )
{
2014-05-19 00:05:49 +02:00
if ( ! $error && $fk_user != '' )
2012-03-17 21:32:10 +01:00
{
2014-05-19 00:05:49 +02:00
$nbboxonleft = $nbboxonright = 0 ;
$sql = " SELECT box_order FROM " . MAIN_DB_PREFIX . " boxes WHERE position = " . GETPOST ( " pos " , " alpha " ) . " AND fk_user = " . $fk_user . " AND entity = " . $conf -> entity ;
2014-06-12 11:31:53 +02:00
dol_syslog ( " boxes.php activate box " , LOG_DEBUG );
2014-05-19 00:05:49 +02:00
$resql = $db -> query ( $sql );
if ( $resql )
{
while ( $obj = $db -> fetch_object ( $resql ))
{
$boxorder = $obj -> box_order ;
if ( preg_match ( '/A/' , $boxorder )) $nbboxonleft ++ ;
if ( preg_match ( '/B/' , $boxorder )) $nbboxonright ++ ;
}
}
else dol_print_error ( $db );
2012-03-17 21:32:10 +01:00
$sql = " INSERT INTO " . MAIN_DB_PREFIX . " boxes ( " ;
2012-09-07 17:16:47 +02:00
$sql .= " box_id, position, box_order, fk_user, entity " ;
2012-03-17 21:32:10 +01:00
$sql .= " ) values ( " ;
2014-05-19 00:05:49 +02:00
$sql .= GETPOST ( " boxid " , " int " ) . " , " . GETPOST ( " pos " , " alpha " ) . " , ' " . (( $nbboxonleft > $nbboxonright ) ? 'B01' : 'A01' ) . " ', " . $fk_user . " , " . $conf -> entity ;
2012-03-17 21:32:10 +01:00
$sql .= " ) " ;
2014-06-12 11:31:53 +02:00
dol_syslog ( " boxes.php activate box " , LOG_DEBUG );
2012-03-17 21:32:10 +01:00
$resql = $db -> query ( $sql );
if ( ! $resql )
{
2014-07-20 01:43:46 +02:00
setEventMessage ( $db -> lasterror (), 'errors' );
2012-03-17 21:32:10 +01:00
$error ++ ;
}
}
}
if ( ! $error )
{
2012-08-31 05:58:38 +02:00
header ( " Location: boxes.php " );
2012-03-17 21:32:10 +01:00
$db -> commit ();
2010-04-19 08:43:15 +02:00
exit ;
2006-11-05 19:21:28 +01:00
}
else
{
2012-03-17 21:32:10 +01:00
$db -> rollback ();
2006-11-05 19:21:28 +01:00
}
2004-02-13 09:45:43 +01:00
}
2011-11-02 20:24:51 +01:00
if ( $action == 'delete' )
2003-02-13 18:18:18 +01:00
{
2012-03-17 14:04:16 +01:00
$sql = " SELECT box_id FROM " . MAIN_DB_PREFIX . " boxes " ;
2011-11-02 20:24:51 +01:00
$sql .= " WHERE rowid= " . $rowid ;
2012-09-07 17:16:47 +02:00
2010-04-19 08:43:15 +02:00
$resql = $db -> query ( $sql );
2012-03-17 14:04:16 +01:00
$obj = $db -> fetch_object ( $resql );
if ( ! empty ( $obj -> box_id ))
{
$db -> begin ();
// Remove all personalized setup when a box is activated or disabled (why removing all ? We removed only removed boxes)
// $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_param";
// $sql.= " WHERE param LIKE 'MAIN_BOXES_%'";
// $resql = $db->query($sql);
$sql = " DELETE FROM " . MAIN_DB_PREFIX . " boxes " ;
2012-09-07 17:16:47 +02:00
$sql .= " WHERE entity = " . $conf -> entity ;
$sql .= " AND box_id= " . $obj -> box_id ;
2012-03-17 14:04:16 +01:00
$resql = $db -> query ( $sql );
$db -> commit ();
}
2003-02-13 18:18:18 +01:00
}
2011-11-02 20:24:51 +01:00
if ( $action == 'switch' )
2005-01-18 22:51:04 +01:00
{
2009-04-27 22:37:50 +02:00
// On permute les valeur du champ box_order des 2 lignes de la table boxes
2010-04-19 08:43:15 +02:00
$db -> begin ();
2010-04-20 20:23:55 +02:00
2010-04-19 08:43:15 +02:00
$objfrom = new ModeleBoxes ( $db );
$objfrom -> fetch ( $_GET [ " switchfrom " ]);
2010-04-20 20:23:55 +02:00
2010-04-19 08:43:15 +02:00
$objto = new ModeleBoxes ( $db );
$objto -> fetch ( $_GET [ " switchto " ]);
2010-04-20 20:23:55 +02:00
2012-03-28 02:57:49 +02:00
$resultupdatefrom = 0 ;
$resultupdateto = 0 ;
2010-04-19 08:43:15 +02:00
if ( is_object ( $objfrom ) && is_object ( $objto ))
{
2012-03-28 02:57:49 +02:00
$newfirst = $objto -> box_order ;
$newsecond = $objfrom -> box_order ;
if ( $newfirst == $newsecond )
{
$newsecondchar = preg_replace ( '/[0-9]+/' , '' , $newsecond );
$newsecondnum = preg_replace ( '/[a-zA-Z]+/' , '' , $newsecond );
$newsecond = sprintf ( " %s%02d " , $newsecondchar ? $newsecondchar : 'A' , $newsecondnum + 1 );
}
2012-09-07 17:16:47 +02:00
$sql = " UPDATE " . MAIN_DB_PREFIX . " boxes SET box_order=' " . $newfirst . " ' WHERE rowid= " . $objfrom -> rowid ;
2012-03-28 02:57:49 +02:00
dol_syslog ( $sql );
2010-04-19 08:43:15 +02:00
$resultupdatefrom = $db -> query ( $sql );
if ( ! $resultupdatefrom ) { dol_print_error ( $db ); }
2012-03-28 02:57:49 +02:00
2012-09-07 17:16:47 +02:00
$sql = " UPDATE " . MAIN_DB_PREFIX . " boxes SET box_order=' " . $newsecond . " ' WHERE rowid= " . $objto -> rowid ;
2012-03-28 02:57:49 +02:00
dol_syslog ( $sql );
2010-04-19 08:43:15 +02:00
$resultupdateto = $db -> query ( $sql );
if ( ! $resultupdateto ) { dol_print_error ( $db ); }
}
2010-04-20 20:23:55 +02:00
2010-04-19 08:43:15 +02:00
if ( $resultupdatefrom && $resultupdateto )
{
$db -> commit ();
}
else
{
$db -> rollback ();
}
2005-01-23 02:51:43 +01:00
}
2003-02-13 18:18:18 +01:00
2005-10-14 23:05:13 +02:00
2011-11-02 22:15:59 +01:00
/*
* View
*/
2012-03-17 14:04:16 +01:00
$form = new Form ( $db );
2011-11-02 22:15:59 +01:00
llxHeader ( '' , $langs -> trans ( " Boxes " ));
2005-10-14 23:05:13 +02:00
2006-08-12 17:32:57 +02:00
print_fiche_titre ( $langs -> trans ( " Boxes " ), '' , 'setup' );
2005-10-14 23:05:13 +02:00
2008-04-19 22:14:18 +02:00
print $langs -> trans ( " BoxesDesc " ) . " " . $langs -> trans ( " OnlyActiveElementsAreShown " ) . " <br> \n " ;
2005-10-14 23:05:13 +02:00
2004-05-08 20:47:17 +02:00
/*
2007-08-03 00:02:58 +02:00
* Recherche des boites actives par defaut pour chaque position possible
* On stocke les boites actives par defaut dans $boxes [ position ][ id_boite ] = 1
2004-05-08 20:47:17 +02:00
*/
2003-02-13 18:18:18 +01:00
2007-08-03 00:02:58 +02:00
$actives = array ();
2008-01-08 20:54:54 +01:00
$sql = " SELECT b.rowid, b.box_id, b.position, b.box_order, " ;
2009-04-27 22:37:50 +02:00
$sql .= " bd.rowid as boxid " ;
$sql .= " FROM " . MAIN_DB_PREFIX . " boxes as b, " . MAIN_DB_PREFIX . " boxes_def as bd " ;
2012-09-07 17:16:47 +02:00
$sql .= " WHERE b.entity = " . $conf -> entity ;
$sql .= " AND b.box_id = bd.rowid " ;
2009-04-27 22:37:50 +02:00
$sql .= " AND b.fk_user=0 " ;
$sql .= " ORDER by b.position, b.box_order " ;
2004-02-15 01:05:21 +01:00
2014-06-12 11:31:53 +02:00
dol_syslog ( " Search available boxes " , LOG_DEBUG );
2005-07-22 14:13:19 +02:00
$resql = $db -> query ( $sql );
if ( $resql )
2003-02-13 18:18:18 +01:00
{
2007-08-03 00:02:58 +02:00
$num = $db -> num_rows ( $resql );
$i = 0 ;
$decalage = 0 ;
2013-01-16 17:09:46 +01:00
$var = false ;
2007-08-03 00:02:58 +02:00
while ( $i < $num )
2005-07-07 12:11:38 +02:00
{
2007-08-03 00:02:58 +02:00
$var = ! $var ;
$obj = $db -> fetch_object ( $resql );
$boxes [ $obj -> position ][ $obj -> box_id ] = 1 ;
$i ++ ;
2010-04-20 20:23:55 +02:00
2007-08-03 00:02:58 +02:00
array_push ( $actives , $obj -> box_id );
if ( $obj -> box_order == '' || $obj -> box_order == '0' || $decalage ) $decalage ++ ;
2010-04-19 08:43:15 +02:00
// On renumerote l'ordre des boites si l'une d'elle est a ''
2008-01-08 20:54:54 +01:00
// This occurs just after an insert.
2007-08-03 00:02:58 +02:00
if ( $decalage )
{
2012-09-07 17:16:47 +02:00
$sql = " UPDATE " . MAIN_DB_PREFIX . " boxes SET box_order=' " . $decalage . " ' WHERE rowid= " . $obj -> rowid ;
2007-08-03 00:02:58 +02:00
$db -> query ( $sql );
}
2005-07-07 12:11:38 +02:00
}
2007-11-12 21:55:14 +01:00
2007-08-03 00:02:58 +02:00
if ( $decalage )
{
2012-03-17 14:04:16 +01:00
// Si on a renumerote, on corrige champ box_order
2008-01-08 20:54:54 +01:00
// This occurs just after an insert.
2007-11-12 21:55:14 +01:00
$sql = " SELECT box_order " ;
$sql .= " FROM " . MAIN_DB_PREFIX . " boxes " ;
2012-09-07 17:16:47 +02:00
$sql .= " WHERE entity = " . $conf -> entity ;
$sql .= " AND LENGTH(box_order) <= 2 " ;
2007-11-12 21:55:14 +01:00
2014-06-12 11:31:53 +02:00
dol_syslog ( " Execute requests to renumber box order " , LOG_DEBUG );
2012-03-17 14:04:16 +01:00
$result = $db -> query ( $sql );
2007-11-12 21:55:14 +01:00
if ( $result )
{
while ( $record = $db -> fetch_array ( $result ))
{
2010-08-24 16:42:18 +02:00
if ( dol_strlen ( $record [ 'box_order' ]) == 1 )
2007-11-12 21:55:14 +01:00
{
2009-10-22 13:13:31 +02:00
if ( preg_match ( " /[13579] { 1}/ " , substr ( $record [ 'box_order' ], - 1 )))
2007-11-12 21:55:14 +01:00
{
2007-11-16 20:30:16 +01:00
$box_order = " A0 " . $record [ 'box_order' ];
2012-09-07 17:16:47 +02:00
$sql = " UPDATE " . MAIN_DB_PREFIX . " boxes SET box_order = ' " . $box_order . " ' WHERE entity = " . $conf -> entity . " AND box_order = ' " . $record [ 'box_order' ] . " ' " ;
2007-11-12 21:55:14 +01:00
$resql = $db -> query ( $sql );
}
2009-10-22 13:13:31 +02:00
else if ( preg_match ( " /[02468] { 1}/ " , substr ( $record [ 'box_order' ], - 1 )))
2007-11-12 21:55:14 +01:00
{
2007-11-16 20:30:16 +01:00
$box_order = " B0 " . $record [ 'box_order' ];
2012-09-07 17:16:47 +02:00
$sql = " UPDATE " . MAIN_DB_PREFIX . " boxes SET box_order = ' " . $box_order . " ' WHERE entity = " . $conf -> entity . " AND box_order = ' " . $record [ 'box_order' ] . " ' " ;
2007-11-12 21:55:14 +01:00
$resql = $db -> query ( $sql );
}
}
2010-08-24 16:42:18 +02:00
else if ( dol_strlen ( $record [ 'box_order' ]) == 2 )
2007-11-12 21:55:14 +01:00
{
2009-10-22 13:13:31 +02:00
if ( preg_match ( " /[13579] { 1}/ " , substr ( $record [ 'box_order' ], - 1 )))
2007-11-12 21:55:14 +01:00
{
2007-11-16 20:30:16 +01:00
$box_order = " A " . $record [ 'box_order' ];
2012-09-07 17:16:47 +02:00
$sql = " UPDATE " . MAIN_DB_PREFIX . " boxes SET box_order = ' " . $box_order . " ' WHERE entity = " . $conf -> entity . " AND box_order = ' " . $record [ 'box_order' ] . " ' " ;
2007-11-12 21:55:14 +01:00
$resql = $db -> query ( $sql );
}
2009-10-22 13:13:31 +02:00
else if ( preg_match ( " /[02468] { 1}/ " , substr ( $record [ 'box_order' ], - 1 )))
2007-11-12 21:55:14 +01:00
{
2007-11-16 20:30:16 +01:00
$box_order = " B " . $record [ 'box_order' ];
2012-09-07 17:16:47 +02:00
$sql = " UPDATE " . MAIN_DB_PREFIX . " boxes SET box_order = ' " . $box_order . " ' WHERE entity = " . $conf -> entity . " AND box_order = ' " . $record [ 'box_order' ] . " ' " ;
2007-11-12 21:55:14 +01:00
$resql = $db -> query ( $sql );
}
}
}
}
2007-08-03 00:02:58 +02:00
}
$db -> free ( $resql );
2003-02-13 18:18:18 +01:00
}
2004-05-08 20:47:17 +02:00
2003-02-13 18:18:18 +01:00
2013-01-16 17:09:46 +01:00
// Available boxes to activate
2013-01-15 11:35:10 +01:00
$boxtoadd = InfoBox :: listBoxes ( $db , 'available' , - 1 , null , $actives );
2011-11-28 23:11:27 +01:00
2004-08-05 03:44:51 +02:00
print " <br> \n " ;
print_titre ( $langs -> trans ( " BoxesAvailable " ));
2004-05-08 20:47:17 +02:00
2005-01-18 22:51:04 +01:00
print '<table class="noborder" width="100%">' ;
2004-05-08 20:47:17 +02:00
print '<tr class="liste_titre">' ;
2006-04-25 01:04:52 +02:00
print '<td width="300">' . $langs -> trans ( " Box " ) . '</td>' ;
2006-06-17 22:53:05 +02:00
print '<td>' . $langs -> trans ( " Note " ) . '/' . $langs -> trans ( " Parameters " ) . '</td>' ;
2004-08-05 03:44:51 +02:00
print '<td>' . $langs -> trans ( " SourceFile " ) . '</td>' ;
2011-02-07 17:46:22 +01:00
print '<td width="160">' . $langs -> trans ( " ActivateOn " ) . '</td>' ;
2004-05-08 20:47:17 +02:00
print " </tr> \n " ;
2011-11-23 18:10:10 +01:00
$var = true ;
2012-03-17 14:04:16 +01:00
foreach ( $boxtoadd as $box )
2004-05-08 20:47:17 +02:00
{
2012-03-17 14:04:16 +01:00
$var =! $var ;
if ( preg_match ( '/^([^@]+)@([^@]+)$/i' , $box -> boximg ))
{
$logo = $box -> boximg ;
}
else
{
$logo = preg_replace ( " /^object_/i " , " " , $box -> boximg );
}
print " \n " . '<!-- Box ' . $box -> boxcode . ' -->' . " \n " ;
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
print '<input type="hidden" name="token" value="' . $_SESSION [ 'newtoken' ] . '">' ;
print '<tr ' . $bc [ $var ] . '>' ;
2013-04-25 13:12:57 +02:00
print '<td>' . img_object ( " " , $logo ) . ' ' . $langs -> transnoentitiesnoconv ( $box -> boxlabel );
2013-06-05 16:24:32 +02:00
if ( ! empty ( $box -> class ) && preg_match ( '/graph_/' , $box -> class )) print ' (' . $langs -> trans ( " Graph " ) . ')' ;
2013-04-25 13:12:57 +02:00
print '</td>' ;
2013-01-15 16:08:16 +01:00
print '<td>' ;
2013-01-16 15:54:07 +01:00
if ( $box -> note == '(WarningUsingThisBoxSlowDown)' )
{
$langs -> load ( " errors " );
print $langs -> trans ( " WarningUsingThisBoxSlowDown " );
2013-01-15 16:08:16 +01:00
}
else print ( $box -> note ? $box -> note : ' ' );
print '</td>' ;
2012-03-17 14:04:16 +01:00
print '<td>' . $box -> sourcefile . '</td>' ;
// Pour chaque position possible, on affiche un lien d'activation si boite non deja active pour cette position
print '<td>' ;
2013-04-23 16:18:26 +02:00
print $form -> selectarray ( " pos " , $pos_name , 0 , 0 , 0 , 0 , '' , 1 );
2012-03-17 14:04:16 +01:00
print '<input type="hidden" name="action" value="add">' ;
print '<input type="hidden" name="boxid" value="' . $box -> box_id . '">' ;
print ' <input type="submit" class="button" name="button" value="' . $langs -> trans ( " Activate " ) . '">' ;
print '</td>' ;
print '</tr>' ;
print '</form>' ;
2004-05-08 20:47:17 +02:00
}
print '</table>' ;
2011-11-28 23:11:27 +01:00
// Activated boxes
2013-01-15 11:35:10 +01:00
$boxactivated = InfoBox :: listBoxes ( $db , 'activated' , - 1 , null );
2004-05-08 20:47:17 +02:00
2004-08-05 03:44:51 +02:00
print " <br> \n \n " ;
print_titre ( $langs -> trans ( " BoxesActivated " ));
2004-05-08 20:47:17 +02:00
2005-01-18 22:51:04 +01:00
print '<table class="noborder" width="100%">' ;
2004-05-08 20:47:17 +02:00
print '<tr class="liste_titre">' ;
2006-04-25 01:04:52 +02:00
print '<td width="300">' . $langs -> trans ( " Box " ) . '</td>' ;
2006-06-17 22:53:05 +02:00
print '<td>' . $langs -> trans ( " Note " ) . '/' . $langs -> trans ( " Parameters " ) . '</td>' ;
2006-04-25 01:04:52 +02:00
print '<td align="center" width="160">' . $langs -> trans ( " ActiveOn " ) . '</td>' ;
2006-11-05 19:21:28 +01:00
print '<td align="center" width="60" colspan="2">' . $langs -> trans ( " PositionByDefault " ) . '</td>' ;
2004-08-05 03:44:51 +02:00
print '<td align="center" width="80">' . $langs -> trans ( " Disable " ) . '</td>' ;
2011-02-07 17:46:22 +01:00
print '</tr>' . " \n " ;
2004-05-08 20:47:17 +02:00
2012-03-17 14:04:16 +01:00
$var = true ;
$box_order = 1 ;
$foundrupture = 1 ;
foreach ( $boxactivated as $key => $box )
2005-07-07 12:11:38 +02:00
{
2012-03-17 14:04:16 +01:00
$var = ! $var ;
2010-04-20 20:23:55 +02:00
2012-03-17 14:04:16 +01:00
if ( preg_match ( '/^([^@]+)@([^@]+)$/i' , $box -> boximg ))
2006-04-25 01:04:52 +02:00
{
2012-03-17 14:04:16 +01:00
$logo = $box -> boximg ;
}
else
{
$logo = preg_replace ( " /^object_/i " , " " , $box -> boximg );
2006-04-25 01:04:52 +02:00
}
2010-04-20 20:23:55 +02:00
2012-03-17 14:04:16 +01:00
print " \n " . '<!-- Box ' . $box -> boxcode . ' -->' . " \n " ;
print '<tr ' . $bc [ $var ] . '>' ;
2013-04-23 16:18:26 +02:00
print '<td>' . img_object ( " " , $logo ) . ' ' . $langs -> transnoentitiesnoconv ( $box -> boxlabel );
2013-04-25 13:12:57 +02:00
if ( ! empty ( $box -> class ) && preg_match ( '/graph_/' , $box -> class )) print ' (' . $langs -> trans ( " Graph " ) . ')' ;
2013-04-23 16:18:26 +02:00
print '</td>' ;
2013-01-15 15:53:35 +01:00
print '<td>' ;
if ( $box -> note == '(WarningUsingThisBoxSlowDown)' )
{
$langs -> load ( " errors " );
print img_warning ( '' , 0 ) . ' ' . $langs -> trans ( " WarningUsingThisBoxSlowDown " );
}
else print ( $box -> note ? $box -> note : ' ' );
print '</td>' ;
2013-04-23 16:18:26 +02:00
print '<td align="center">' . ( empty ( $pos_name [ $box -> position ]) ? '' : $langs -> trans ( $pos_name [ $box -> position ])) . '</td>' ;
2012-03-17 14:04:16 +01:00
$hasnext = ( $key < ( count ( $boxactivated ) - 1 ));
$hasprevious = ( $key != 0 );
print '<td align="center">' . ( $key + 1 ) . '</td>' ;
print '<td align="center">' ;
print ( $hasnext ? '<a href="boxes.php?action=switch&switchfrom=' . $box -> rowid . '&switchto=' . $boxactivated [ $key + 1 ] -> rowid . '">' . img_down () . '</a> ' : '' );
print ( $hasprevious ? '<a href="boxes.php?action=switch&switchfrom=' . $box -> rowid . '&switchto=' . $boxactivated [ $key - 1 ] -> rowid . '">' . img_up () . '</a>' : '' );
print '</td>' ;
print '<td align="center">' ;
print '<a href="boxes.php?rowid=' . $box -> rowid . '&action=delete">' . img_delete () . '</a>' ;
print '</td>' ;
print '</tr>' . " \n " ;
2003-02-13 18:18:18 +01:00
}
2004-05-08 20:47:17 +02:00
2005-01-18 22:51:04 +01:00
print '</table><br>' ;
2008-05-19 03:31:46 +02:00
2011-09-14 23:50:17 +02:00
// Other parameters
2011-11-28 23:11:27 +01:00
2011-01-10 00:29:23 +01:00
print_titre ( $langs -> trans ( " Other " ));
2008-05-19 03:31:46 +02:00
print '<table class="noborder" width="100%">' ;
$var = false ;
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2009-05-17 10:01:54 +02:00
print '<input type="hidden" name="token" value="' . $_SESSION [ 'newtoken' ] . '">' ;
2008-05-19 03:31:46 +02:00
print '<input type="hidden" name="action" value="addconst">' ;
2011-11-28 23:11:27 +01:00
print '<tr class="liste_titre">' ;
print '<td class="liste_titre">' . $langs -> trans ( " Parameter " ) . '</td>' ;
print '<td class="liste_titre">' . $langs -> trans ( " Value " ) . '</td>' ;
print '<td class="liste_titre"></td>' ;
print '</tr>' ;
print '<tr ' . $bc [ $var ] . '>' ;
print '<td>' ;
print $langs -> trans ( " MaxNbOfLinesForBoxes " );
print '</td>' . " \n " ;
2008-05-19 03:31:46 +02:00
print '<td>' ;
print '<input type="text" class="flat" size="6" name="MAIN_BOXES_MAXLINES" value="' . $conf -> global -> MAIN_BOXES_MAXLINES . '">' ;
2011-11-28 23:11:27 +01:00
print '</td>' ;
print '<td align="right">' ;
2011-02-07 17:46:22 +01:00
print '<input type="submit" class="button" value="' . $langs -> trans ( " Save " ) . '" name="Button">' ;
print '</td>' . " \n " ;
2008-05-19 03:31:46 +02:00
print '</tr>' ;
print '</form>' ;
print '</table>' ;
2011-08-27 16:24:16 +02:00
llxFooter ();
2012-03-17 14:04:16 +01:00
$db -> close ();