* * 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."/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"]:''; $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->societe->enabled) { $rowspan++; $sectionauto[]=array('test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); } if ($conf->propal->enabled) { $rowspan++; $sectionauto[]=array('test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsByProposals")); } if ($conf->commande->enabled) { $rowspan++; $sectionauto[]=array('test'=>$conf->commande->enabled,'label'=>$langs->trans("Orders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } if ($conf->contrat->enabled) { $rowspan++; $sectionauto[]=array('test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); } if ($conf->facture->enabled) { $rowspan++; $sectionauto[]=array('test'=>$conf->facture->enabled, 'label'=>$langs->trans("Invoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } if ($conf->produit->enabled) { $rowspan++; $sectionauto[]=array('test'=>$conf->produit->enabled, 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } //*********************** // List //*********************** print_fiche_titre($langs->trans("ECMArea")); print $langs->trans("ECMAreaDesc")."
"; print $langs->trans("ECMAreaDesc2")."
"; print "
\n"; print ''; print '
'; //print_fiche_titre($langs->trans("ECMManualOrg")); print '
'; print ''; print ""; print ''; print "'; print ''; print "'; print ''; print "
'.$langs->trans("ECMSearchByKeywords").'
".$langs->trans("Title").':
".$langs->trans("Keyword").':

"; //print $langs->trans("ECMManualOrgDesc"); print '
'; //print_fiche_titre($langs->trans("ECMAutoOrg")); print '
'; print ''; print ""; print ''; $buthtml=''; $butshown=0; if ($conf->societe->enabled) { print "'.($butshown?'':$buthtml).''; $butshown++; } if ($conf->contrat->enabled) { print "'.($butshown?'':$buthtml).''; $butshown++; } if ($conf->propal->enabled) { print "'.($butshown?'':$buthtml).''; $butshown++; } if ($conf->commande->enabled) { print "'.($butshown?'':$buthtml).''; $butshown++; } if ($conf->facture->enabled) { print "'.($butshown?'':$buthtml).''; $butshown++; } if ($conf->produit->enabled) { print "'.($butshown?'':$buthtml).''; $butshown++; } print "
'.$langs->trans("ECMSearchByEntity").'
".$langs->trans("ThirdParty").':
".$langs->trans("Contrat").':
".$langs->trans("Proposal").':
".$langs->trans("Order").':
".$langs->trans("Invoice").':
".$langs->trans("ProductsAndServices").':

"; //print $langs->trans("ECMAutoOrgDesc"); print '
'; //*********************** // Files //*********************** print_fiche_titre($langs->trans("ECMSectionOfDocuments")); //print '
'; // 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 ''; if (sizeof($sectionauto)) { // Automatic sections print ''; print ''; print ''; print ''; print ''; print ''; $sectionauto=dol_sort_array($sectionauto,'label',$sortorder,true,false); $var=true; foreach ($sectionauto as $key => $val) { if ($val['test']) { $var=! $var; print ''; // Section print '\n"; // Description print ''; print ''; print ''; print "\n"; } } } // Manual sections print ''; $param='&socid='.$socid; print ''; print ''; print ''; print ''; print ''; $ecmdirstatic = new ECMDirectory($db); $rub=$ecmdirstatic->get_full_arbo(); $userstatic = new User($db); $nbofentries=0; $var=true; foreach($rub as $key => $val) { $var=!$var; $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"; // Description print ''; // Nb of docs //print ''; print ''; print '\n"; $nbofentries++; } // If nothing to show if ($nbofentries == 0) { print ''; } print "
'.$langs->trans("ECMSectionAuto").''.$langs->trans("Description").''.$langs->trans("ECMNbOfDocsSmall").''; print ' '; print '
'; print img_picto('','object_dir').' '; print ''; print $val['label']; print ''; print "'.$val['desc'].'?'; $htmltooltip=''.$langs->trans("ECMSection").': '.$val['label'].'
'; $htmltooltip=''.$langs->trans("Type").': '.$langs->trans("ECMAutoOrg").'
'; $htmltooltip.=''.$langs->trans("ECMCreationUser").': '.$langs->trans("ECMTypeAuto"); print $form->textwithhelp('',$htmltooltip,1,0); print '
'.$langs->trans("ECMSectionManual").''.$langs->trans("Description").''.$langs->trans("ECMNbOfDocsSmall"); print ''.img_picto($langs->trans("Refresh"),'refresh').''; print ''; if ($user->rights->ecm->setup) { print ''.img_picto($langs->trans("ECMNewSection"),'edit_add').''; } else { print ' '; } print '
'; print str_repeat('     ',$val['level']-1); print $ecmdirstatic->getNomUrl(1); print "'.dolibarr_trunc($val['description'],32).''.$obj->cachenbofdoc.''.$val['cachenbofdoc'].''; $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"); 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 '
'; // End of page $db->close(); llxFooter('$Date$ - $Revision$'); ?>