<?php
/**
 * @package linea21.modules
 * @subpackage dashboard
 * @author linea21 <info@linea21.com>
 * @version $id SVN
 * @access public
 * @license http://opensource.org/licenses/gpl-3.0.html
 */

//////////// Check Inclusion de pages ////////////
if (!class_exists('auth')){
  include_once("../lib/lib_common.php");
  ReloadIndex('admin');
}
////////////

$qbx_module=_t('menu','dashboard');

$req_scale5=SQL_getonescale($scale_id);
$resultscale5 = $sql_object -> DBSelect($req_scale5);

if ($todo == 'add' || $todo == 'list') {
  $req_quickbox_list=SQL_getquickbox_list($scale_id);
  $resultqb=$sql_object->DBSelect($req_quickbox_list);
  $qbx_liste='';
  $nb='';

  if($resultqb==0) {
    $qbx_liste.="<li>"._t('divers','nodata')."</li>";
  }
  else {
    if(count($resultqb)>=10) $nb=10; else $nb=count($resultqb);
    for($i=0; $i<count($resultqb); $i++) {
      $qbx_sdi_title=cutText($resultqb[$i]['sdii_name'], 50);
      $qbx_sdi_title=formatText($qbx_sdi_title, '2HTML');
      $qbx_liste.="<li><a href=\"index.php?id=". $resultqb[$i]['sdiv_sdi_info'];
      $qbx_liste.="&amp;rub=$rub&amp;todo=det&amp;scale_id=$scale_id\" title=\"";
      //$qbx_liste.=_t('dashboard','value').": ".$resultqb[$i]['sdiv_value']." ".$resultqb[$i]['sdii_unit']." ";
      //$qbx_liste.=_t('dashboard','date').": ".$resultqb[$i]['date_p']." ";
      //$qbx_liste.=_t('divers','last_modify').": ".$resultqb[$i]['date_m']." ";
      //$qbx_liste.=_t('divers','date_crea').": ".$resultqb[$i]['date_c']." ";
      $qbx_liste.=$qbx_sdi_title ." ";
      $qbx_liste.="\">". $qbx_sdi_title ."</a></li>\n";	}
  }
  $qbx_h1=$nb._t('dashboard','qb_add_title').formatText($resultscale5[0]['scale_denomination'], '2HTML');
}

if ($todo == 'mod' || $todo == 'det' || $todo == 'sup' || $todo == 'rap') {

  $req_quickbox_mod_list=SQL_getquickbox_mod_list($scale_id);
  $resultqb=$sql_object->DBSelect($req_quickbox_mod_list);
  $qbx_liste='';
  $nb='';

  if($resultqb==0) {
    $qbx_liste.="<li>"._t('divers','nodata')."</li>";
  }
  else {
    if(count($resultqb)>=10) $nb=10; else $nb=count($resultqb);
    for($i=0; $i<count($resultqb); $i++) {
      $qbx_sdi_title=cutText($resultqb[$i]['sdii_name'], 50);
      $qbx_sdi_title=formatText($qbx_sdi_title, '2HTML');
      $qbx_liste.="<li><a href=\"index.php?id=". $resultqb[$i]['sdiv_sdi_info'];
      $qbx_liste.="&amp;rub=$rub&amp;todo=det&amp;scale_id=$scale_id\" title=\"";
      //$qbx_liste.=_t('dashboard','value').": ".$resultqb[$i]['sdiv_value']." ".$resultqb[$i]['sdii_unit']." ";
      //$qbx_liste.=_t('dashboard','date').": ".$resultqb[$i]['date_p']." ";
      //$qbx_liste.=_t('divers','last_modify').": ".$resultqb[$i]['date_m']." ";
      //$qbx_liste.=_t('divers','date_crea').": ".$resultqb[$i]['date_c']." ";
      $qbx_liste.=$qbx_sdi_title ." ";
      $qbx_liste.="\">". $qbx_sdi_title ."</a></li>\n";	}
  }
  $qbx_h1=$nb._t('dashboard','qb_mod_title').formatText($resultscale5[0]['scale_denomination'], '2HTML');
}


echo QuickBoxNow($qbx_module, $qbx_h1, $qbx_liste);
echo "</div>\n";

?>