Ajoute page listant tous les mailings
This commit is contained in:
parent
ef3b5cd410
commit
b2a37be5e7
132
htdocs/comm/mailing/liste.php
Normal file
132
htdocs/comm/mailing/liste.php
Normal file
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/comm/mailing/liste.php
|
||||
\ingroup mailing
|
||||
\brief Liste des mailings
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
if (!$user->rights->mailing->lire) accessforbidden();
|
||||
|
||||
// Sécurité accés client
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socidp = $user->societe_id;
|
||||
}
|
||||
|
||||
$page=$_GET["page"];
|
||||
$sortorder=$_GET["sortorder"];
|
||||
$sortfield=$_GET["sortfield"];
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$offset = $conf->liste_limit * $_GET["page"] ;
|
||||
$pageprev = $_GET["page"] - 1;
|
||||
$pagenext = $_GET["page"] + 1;
|
||||
|
||||
$sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"];
|
||||
$sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"];
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
|
||||
$sql = "SELECT m.rowid, m.titre, m.nbemail, m.statut, m.date_creat as datec";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."mailing as m";
|
||||
$sql.= " WHERE 1=1";
|
||||
if ($sref) $sql.= " AND m.rowid = '".$sref."'";
|
||||
if ($sall) $sql.= " AND (m.titre like '%".$sall."%' OR m.sujet like '%".$sall."%' OR m.body like '%".$sall."%')";
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="m.titre";
|
||||
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit +1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
print_barre_liste($langs->trans("ListOfEMailings"), $page, "liste.php","",$sortfield,$sortorder,"",$num);
|
||||
|
||||
$i = 0;
|
||||
|
||||
$addu = "&sall=".$sall;
|
||||
print '<table class="liste">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"),"liste.php","m.rowid",$addu,"","",$sortfield);
|
||||
print_liste_field_titre($langs->trans("Title"),"liste.php","m.titre",$addu,"","",$sortfield);
|
||||
print_liste_field_titre($langs->trans("DateCreation"),"liste.php","m.date_creat",$addu,"",'align="center"',$sortfield);
|
||||
print_liste_field_titre($langs->trans("NbOfEMails"),"liste.php","m.nbemail",$addu,"",'align="center"',$sortfield);
|
||||
print_liste_field_titre($langs->trans("Status"),"liste.php","m.statut",$addu,"",'align="center"',$sortfield);
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<form method="get" action="clients.php">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" valign="right">';
|
||||
print '<input type="text" class="flat" name="sref" value="'.$sref.'" size="6">';
|
||||
print '</td><td class="liste_titre" valign="right">';
|
||||
print '<input type="text" class="flat" name="sall" value="'.$sall.'" size="40">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="center"><input class="liste_titre" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
print '</form>';
|
||||
|
||||
$var=True;
|
||||
|
||||
$email=new Mailing($db);
|
||||
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/mailing/fiche.php?id='.$obj->rowid.'">';
|
||||
print img_object($langs->trans("ShowEMail"),"email").' '.stripslashes($obj->rowid).'</a></td>';
|
||||
print '<td>'.$obj->titre.'</td>';
|
||||
print '<td align="center">'.dolibarr_print_date($obj->datec).'</td>';
|
||||
print '<td align="center">'.$obj->nbemail.'</td>';
|
||||
print '<td align="center">'.$email->statuts[$obj->statut].($obj->statut==2?' '.img_warning():'').'</td>';
|
||||
print '<td align="center"> </td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
@ -18,7 +18,6 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -36,24 +35,30 @@ $langs->load("companies");
|
||||
$langs->load("mails");
|
||||
|
||||
|
||||
function llxHeader($head = "", $title = "") {
|
||||
global $user, $conf, $langs;
|
||||
|
||||
top_menu($head, $title);
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
if ($user->rights->mailing->lire) {
|
||||
$menu->add(DOL_URL_ROOT."/comm/mailing/index.php", $langs->trans("Mailings"));
|
||||
}
|
||||
|
||||
if ($user->rights->mailing->creer) {
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/mailing/fiche.php?action=create", $langs->trans("NewMailing"));
|
||||
}
|
||||
|
||||
left_menu($menu->liste);
|
||||
|
||||
function llxHeader($head = "", $title = "")
|
||||
{
|
||||
global $user, $conf, $langs;
|
||||
|
||||
top_menu($head, $title);
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
if ($user->rights->mailing->lire)
|
||||
{
|
||||
$menu->add(DOL_URL_ROOT."/comm/mailing/index.php", $langs->trans("Mailings"));
|
||||
}
|
||||
|
||||
if ($user->rights->mailing->creer)
|
||||
{
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/mailing/fiche.php?action=create", $langs->trans("NewMailing"));
|
||||
}
|
||||
|
||||
if ($user->rights->mailing->lire)
|
||||
{
|
||||
$menu->add_submenu(DOL_URL_ROOT."/comm/mailing/liste.php", $langs->trans("List"));
|
||||
}
|
||||
|
||||
left_menu($menu->liste);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -458,7 +457,8 @@ class MenuLeft {
|
||||
/*
|
||||
* Menu FOURNISSEURS
|
||||
*/
|
||||
if ($mainmenu == 'suppliers') {
|
||||
if ($mainmenu == 'suppliers')
|
||||
{
|
||||
|
||||
$langs->load("suppliers");
|
||||
|
||||
@ -501,7 +501,8 @@ class MenuLeft {
|
||||
/*
|
||||
* Menu OUTILS
|
||||
*/
|
||||
if ($mainmenu == 'tools') {
|
||||
if ($mainmenu == 'tools')
|
||||
{
|
||||
|
||||
if ($conf->mailing->enabled)
|
||||
{
|
||||
@ -510,6 +511,7 @@ class MenuLeft {
|
||||
|
||||
$newmenu->add(DOL_URL_ROOT."/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->rights->mailing->lire);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/comm/mailing/fiche.php?leftmenu=mailing&action=create", $langs->trans("NewMailing"), 1, $user->rights->mailing->creer);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/comm/mailing/liste.php?leftmenu=mailing", $langs->trans("List"), 1, $user->rights->mailing->lire);
|
||||
}
|
||||
|
||||
if ($conf->projet->enabled)
|
||||
@ -517,6 +519,7 @@ class MenuLeft {
|
||||
$langs->load("projects");
|
||||
$newmenu->add(DOL_URL_ROOT."/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/comm/clients.php?leftmenu=projects", $langs->trans("NewProject"), 1, $user->rights->projet->creer);
|
||||
$newmenu->add_submenu(DOL_URL_ROOT."/projet/liste.php?leftmenu=projects", $langs->trans("List"), 1, $user->rights->projet->lire);
|
||||
}
|
||||
|
||||
$langs->load("other");
|
||||
@ -528,7 +531,8 @@ class MenuLeft {
|
||||
/*
|
||||
* Menu MEMBERS
|
||||
*/
|
||||
if ($mainmenu == 'members') {
|
||||
if ($mainmenu == 'members')
|
||||
{
|
||||
|
||||
if ($conf->adherent->enabled)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user