<?php
/**
 * Project module
 * 
 * Provide information regarding latest administration tasks
 * 
 * @package linea21\modules\project
 * @author $Author$ - linea21 <info@linea21.com>
 * @version $Id$ 
 * @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');
}
////////////

//////////// Check Droits utilisateur ////////////
if (!$l21auth->hasRight('project')) ReloadIndex('admin');
////////////

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

if ($todo == 'add') {
  $result=$sql_object->DBSelect($req_quickbox_add);
  $qbx_liste='';
  $nb='';
  if($result==0) {
    $qbx_liste.="<li class=\"no-data\">"._t('divers','nodata')."</li>";
  } else {
    if(count($result)>=10) $nb=10; else $nb=count($result);
    for($i=0; $i<count($result); $i++) {
      $qbx_project_name=formatText(cutText($result[$i]['project_name'], 47), '2HTML');
      $qbx_liste.="<li><a href=\"index.php?id=". $result[$i]['project_id'] ."&amp;rub=".$rub."&amp;todo=det\" title=\""._t('divers','date_crea').": ".$result[$i]['project_date_crea_display']." \">". $qbx_project_name ."</a></li>\n";
    }
  }
  $qbx_h1=$nb._t('project','qb_titleadd');
}

if ($todo == 'mod' || $todo == 'det' || $todo == 'report') {
  $result=$sql_object->DBSelect($req_quickbox_mod);
  $qbx_liste='';
  $nb='';
  if($result==0) {
    $qbx_liste.="<li class=\"no-data\">"._t('divers','nodata')."</li>";
  } else {
    if(count($result)>=10) $nb=10; else $nb=count($result);
    for($i=0; $i<count($result); $i++) {
      $qbx_project_name=formatText(cutText($result[$i]['project_name'], 47), '2HTML');
      $qbx_liste.="<li><a href=\"index.php?id=". $result[$i]['project_id'] ."&amp;rub=".$rub."&amp;todo=det\" title=\""._t('divers','last_modify')." ".$result[$i]['project_last_modify_display']." - ("._t('divers','date_crea').": ".$result[$i]['project_date_crea_display'].") \">". $qbx_project_name ."</a></li>\n";
    }
  }
  $qbx_h1=$nb._t('project','qb_titlemod');
}
if ($todo == 'sup') {
  $result=$sql_object->DBSelect($req_quickbox_sup);
  $qbx_liste='';
  $nb='';
  if($result==0) {
    $qbx_liste.="<li class=\"no-data\">"._t('divers','nodata')."</li>";
  } else {
    if(count($result)>=10) $nb=10; else $nb=count($result);
    for($i=0; $i<count($result); $i++) {
      $qbx_project_name=formatText(cutText($result[$i]['project_name'], 47), '2HTML');
      $qbx_liste.="<li><a href=\"#\" title=\""._t('divers','date_sup')." ".$result[$i]['project_last_modify_display']." - ("._t('divers','date_crea').": ".$result[$i]['project_date_crea_display'].") \">". $qbx_project_name ."</a></li>\n";
    }
  }
  $qbx_h1=$nb._t('project','qb_titlesup');
}
if ($todo == 'list') {
  $result=$sql_object->DBSelect($req_quickbox_list);
  $qbx_liste='';
  $nb='';
  if($result==0) {
    $qbx_liste.="<li class=\"no-data\">"._t('divers','nodata')."</li>";
  } else {
    if(count($result)>=10) $nb=10; else $nb=count($result);
    for($i=0; $i<count($result); $i++) {
      $qbx_project_name=formatText(cutText($result[$i]['project_name'], 47), '2HTML');
      $qbx_liste.="<li><a href=\"index.php?id=". $result[$i]['project_id'] ."&amp;rub=".$rub."&amp;todo=det\" title=\""._t('divers','date_publi')." ".$result[$i]['project_published_date_display']." - ("._t('divers','date_crea').": ".$result[$i]['project_date_crea_display'].") \">". $qbx_project_name ."</a></li>\n";
    }
  }
  $qbx_h1=$nb._t('project','qb_titlepubli');
}

echo QuickBoxNow($qbx_module, $qbx_h1, $qbx_liste);
?>