* * 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 * the Free Software Foundation; either version 2 of the License, or * (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 * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** \file htdoc/ecm/index.php \ingroup ecm \brief Main page for ECM section area \version $Id$ \author Laurent Destailleur */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/ecm.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/treeview.lib.php"); require_once(DOL_DOCUMENT_ROOT."/ecm/ecmdirectory.class.php"); // Load traductions files $langs->load("ecm"); $langs->load("companies"); $langs->load("other"); $langs->load("users"); $langs->load("orders"); $langs->load("propal"); $langs->load("bills"); $langs->load("contracts"); // Load permissions $user->getrights('ecm'); // Get parameters $socid = isset($_GET["socid"])?$_GET["socid"]:''; $action = isset($_GET["action"])?$_GET["action"]:$_POST['action']; $section=$_GET["section"]; if (! $section) $section='misc'; $upload_dir = $conf->ecm->dir_output.'/'.$section; $page=$_GET["page"]; $sortorder=$_GET["sortorder"]; $sortfield=$_GET["sortfield"]; $limit = $conf->liste_limit; $offset = $limit * $page ; if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="label"; $ecmdir = new ECMDirectory($db); if (! empty($_REQUEST["section"])) { $result=$ecmdir->fetch($_REQUEST["section"]); if (! $result > 0) { dolibarr_print_error($db,$ecmdir->error); exit; } } /******************************************************************* * ACTIONS * * Put here all code to do according to value of "action" parameter ********************************************************************/ // Action ajout d'un produit ou service if ($_POST["action"] == 'add' && $user->rights->ecm->setup) { $ecmdir->ref = $_POST["ref"]; $ecmdir->label = $_POST["label"]; $ecmdir->description = $_POST["desc"]; $id = $ecmdir->create($user); if ($id > 0) { Header("Location: ".$_SERVER["PHP_SELF"]); exit; } else { $mesg='
Error '.$langs->trans($ecmdir->error).'
'; $_GET["action"] = "create"; } } // Suppression fichier if ($_POST['action'] == 'confirm_deletesection' && $_POST['confirm'] == 'yes') { $result=$ecmdir->delete($user); $mesg = '
'.$langs->trans("ECMSectionWasRemoved", $ecmdir->label).'
'; } /******************************************************************* * PAGE * * Put here all code to do according to value of "action" parameter ********************************************************************/ llxHeader(); $form=new Form($db); $ecmdirstatic = new ECMDirectory($db); $userstatic = new User($db); // Ajout rubriques automatiques $rowspan=0; $sectionauto=array(); if ($conf->produit->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'product', 'test'=>$conf->produit->enabled, 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } if ($conf->societe->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); } if ($conf->propal->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Prop"), 'desc'=>$langs->trans("ECMDocsByProposals")); } if ($conf->contrat->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'contract','test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); } if ($conf->commande->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled,'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } if ($conf->fournisseur->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'supplier_order', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByOrders")); } if ($conf->facture->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } if ($conf->fournisseur->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'supplier_invoice', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } //*********************** // List //*********************** print_fiche_titre($langs->trans("ECMArea")); print $langs->trans("ECMAreaDesc")."
"; print $langs->trans("ECMAreaDesc2")."
"; print "
\n"; print '
'; // Left area // Tool bar $selected='file_manager'; if (eregi('search',$action)) $selected='search_form'; $head = ecm_prepare_head_fm($fac); dolibarr_fiche_head($head, $selected, '', 1); print '
'; if (eregi('search',$action)) { //print_fiche_titre($langs->trans("ECMManualOrg")); print '
'; print ''; print ""; print ''; print "'; print ''; print "'; print "'; print "
'.$langs->trans("ECMSearchByKeywords").'
".$langs->trans("Ref").':
".$langs->trans("Title").':
".$langs->trans("Keyword").':
"; //print $langs->trans("ECMManualOrgDesc"); //print_fiche_titre($langs->trans("ECMAutoOrg")); print '
'; print ''; print ""; print ''; $buthtml=''; $butshown=0; foreach($sectionauto as $section) { if (! $section['test']) continue; if ($butshown % 2 == 0) print ''; print "'; print ''; print ''; print ''; if ($butshown % 2 == 1) print ''; $butshown++; } if ($butshown % 2 == 1) print ''; print ''; print "
'.$langs->trans("ECMSearchByEntity").'
".$section['label'].':
  
"; //print $langs->trans("ECMAutoOrgDesc"); } if (empty($action) || $action == 'file_manager' || eregi('refresh',$action)) { // Confirmation de la suppression d'une ligne categorie if ($_GET['action'] == 'delete_section') { $form->form_confirm($_SERVER["PHP_SELF"].'?section='.urldecode($_GET["section"]), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection'); print '
'; } if ($mesg) { print $mesg."
"; } // Construit liste des répertoires print ''; print ''; print ''; print ''; if (sizeof($sectionauto)) { // Automatic sections title line print ''; print ''; print ''; print ''; print ''; //print ''; print ''; $sectionauto=dol_sort_array($sectionauto,'label',$sortorder,true,false); $nbofentries=0; $oldvallevel=0; foreach ($sectionauto as $key => $val) { if ($val['test']) { $var=false; print ''; // Section print '\n"; // Nb of doc print ''; // Edit link print ''; // Add link print ''; // Info print ''; print "\n"; $oldvallevel=$val['level']; $nbofentries++; } } } // Manual sections title line print ''; print ''; print ''; print ''; print ''; print ''; $ecmdirstatic = new ECMDirectory($db); $rub=$ecmdirstatic->get_full_arbo(); $userstatic = new User($db); $nbofentries=0; $oldvallevel=0; $var=true; foreach($rub as $key => $val) { $var=false; $ecmdirstatic->id=$val['id']; $ecmdirstatic->ref=$val['label']; // Refresh cache if ($_GET['action'] == 'refreshauto') { $result=$ecmdirstatic->fetch($val['id']); $ecmdirstatic->ref=$ecmdirstatic->label; $result=$ecmdirstatic->refreshcachenboffile(); $val['cachenbofdoc']=$result; } print ''; // Section print '\n"; // Nb of docs print ''; // Edit link print ''; // Add link print ''; // Info print '"; print "\n"; $oldvallevel=$val['level']; $nbofentries++; } // If nothing to show if ($nbofentries == 0) { print ''; } print "
'; print ''.$langs->trans("Refresh").' '.img_picto($langs->trans("Refresh"),'refresh').''; print '
'; print ''; print ''; print '
'; print img_picto_common('','treemenu/base.gif'); print ''.$langs->trans("ECMRoot").' ('.$langs->trans("ECMSectionAuto").')'; print '
   '; $htmltooltip=$langs->trans("ECMAreaDesc2"); print $form->textwithhelp('',$htmltooltip,1,0); print ''.$langs->trans("ECMNbOfDocsSmall").' '.img_picto($langs->trans("Refresh"),'refresh').'
'; print '
'; print tree_showpad($sectionauto,$key); print ''; print img_picto('','object_dir'); print ''; print '  '; print $val['label']; print '
'; print "
   '; $htmltooltip=''.$langs->trans("ECMSection").': '.$val['label'].'
'; $htmltooltip=''.$langs->trans("Type").': '.$langs->trans("ECMAutoOrg").'
'; $htmltooltip.=''.$langs->trans("ECMCreationUser").': '.$langs->trans("ECMTypeAuto").'
'; $htmltooltip.=''.$langs->trans("Description").': '.$val['desc']; print $form->textwithhelp('',$htmltooltip,1,0); print '
'; print ''; print ''; print '
'; print img_picto_common('','treemenu/base.gif'); print ''.$langs->trans("ECMRoot").' ('.$langs->trans("ECMSectionManual").')'; print '
'; print ' '.img_edit_add().''; $htmltooltip=$langs->trans("ECMAreaDesc2"); print $form->textwithhelp('',$htmltooltip,1,0); print '
'; print '
'; print tree_showpad($rub,$key); print ''; print $ecmdirstatic->getNomUrl(1,'index'); print ''; print ' 
'; print "
'.$val['cachenbofdoc'].''.img_edit().''.img_edit_add().''; $userstatic->id=$val['fk_user_c']; $userstatic->nom=$val['login_c']; $htmltooltip=''.$langs->trans("ECMSection").': '.$val['label'].'
'; $htmltooltip=''.$langs->trans("Type").': '.$langs->trans("ECMManualOrg").'
'; $htmltooltip.=''.$langs->trans("ECMCreationUser").': '.$userstatic->getNomUrl(1).'
'; $htmltooltip.=''.$langs->trans("ECMCreationDate").': '.dolibarr_print_date($val['date_c'],"dayhour").'
'; $htmltooltip.=''.$langs->trans("Description").': '.$val['description']; print $form->textwithhelp('',$htmltooltip,1,0); print "
'.$langs->trans("ECMNoDirecotyYet").'
"; // Fin de zone Ajax // Actions buttons print '
'; if ($user->rights->ecm->setup) { print ''.$langs->trans('ECMAddSection').''; } else { print ''.$langs->trans('ECMAddSection').''; } print '
'; } print '
'; print '
'; // Right area print '
'; print '
'; // End of page $db->close(); llxFooter('$Date$ - $Revision$'); ?>