<?php
//Copyright (c) Florian Grannemann
//Last change in version: 2.1 Alpha 3
/*
******************************************************************************
ADbNewsSender 2
Copyright (C) 2010 Florian Grannemann (hide@address.com)
Website: http://adbnewssender.sf.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 3 of the License, or
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, see http://www.gnu.org/licenses/
******************************************************************************
*/
//Do not edit anything unless you realy REALY know what you are doing!
include "$path_to_languagefolder/lang_admin_NLarchive.php.inc";
//########################################################################
print "<h2>$TXT_PageTitle</h2>";
if($MyCFG->NL_exists($MySessionHandler->getNLID()))
{
$MyArchive =new priv_Archive($MySessionHandler->getNLID(), $MyDB);
$deleteARRsize=$MyRequestHandler->getNLModuleKeyValue("deleteARRsize");
if($MyRequestHandler->getNLModuleKeyValue("DeleteOption")=="yes")
{
$i=0;
$deleteArray=$MyRequestHandler->getNLModuleKeyValue("Deletelist");
while($i <$deleteARRsize)
{
if($deleteArray[$i])
{
if($MyArchive->delete_entry(intval($deleteArray[$i])))
{
print preg_replace("/<-ID->/",$deleteArray[$i],$MSG_ENTRY_DELETED)."<br>";
}
}
$i++;
}
}
$ViewMonth=intval($MyRequestHandler->getNLModuleKeyValue("ViewMonth"));
$ChangeYear=intval($MyRequestHandler->getNLModuleKeyValue("ChangeYear"));
if(!$ChangeYear || $ChangeYear < $MyArchive->get_earliest_year() || $ChangeYear >date("Y"))
{
$ChangeYear=date("Y");
$ViewMonth=date("n");
}
if(!$ViewMonth || $ViewMonth < 1 || $ViewMonth >12)
{
if ($ChangeYear==date("Y"))
{
$ViewMonth=date("n");
}
else
{
$ViewMonth=12;
}
}
if($ChangeYear ==date("Y") && $ViewMonth >date("n"))
{
$ViewMonth=date("n");
}
//preparing month list
if($ChangeYear ==date("Y"))
{
$endmonth=date("n");
}
else
{
$endmonth=12;
}
$monthlist="";
$i=$endmonth;
//month list:
while ($i >=1)
{
$addToMonthlist= "<a href=\"".$_SERVER["PHP_SELF"]."?".$MyRequestHandler->getNLModuleKeyName("ViewMonth")."=$i&".$MyRequestHandler->getNLModuleKeyName("ChangeYear")."=$ChangeYear\">".$Month[$i-1]."</a>";
if($i ==$ViewMonth)
{
$addToMonthlist="<font size=2><b>".$addToMonthlist."</b></font>";
}
$monthlist=$monthlist." <b>$addToMonthlist</b> ";
if($i >1)
{
$monthlist=$monthlist."|";
}
$i--;
}
$monthlist=$monthlist;
//preparing yearlist
$earliestYear=$MyArchive->get_earliest_year();
$i=date("Y");
$yearlist="";
while($i >=$earliestYear)
{
$addtoYearlist="<option value=\"$i\"";
if($i ==$ChangeYear)
{
$addtoYearlist=$addtoYearlist." selected";
}
$addtoYearlist=$addtoYearlist.">$i</option>\n";
$yearlist=$yearlist.$addtoYearlist;
$i--;
}
//fetching entries:
$entries=array();
$Deletelist=$MyRequestHandler->getNLModuleKeyName("Deletelist");
$entries=$MyArchive->get_entries_of_month($ViewMonth,$ChangeYear);
print "<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"post\"><font size=\"1\">$monthlist</font><select name=\"".$MyRequestHandler->getNLModuleKeyName("ChangeYear")."\" STYLE=\"font-size:8pt\">$yearlist</select><INPUT type=\"submit\" value=\"$TXT_ChangeYEAR\" STYLE=\"font-size:8pt\"></form>";
print "<hr width=\"100%\"><form action=\"".$_SERVER["PHP_SELF"]."\" method=\"post\"><br>";
$i=0;
if(count($entries) <1)
{
print $ERR_Headline_NoNLAvailable_in_Month."<br>";
}
else
{ $i=0;
while($i <count($entries))
{
$EntryURL=$MyCFG->get_config_value("ArchiveURL")."?NewsletterID=".$MySessionHandler->getNLID()."&EntryID=".$entries[$i]["id"];
print "<input type=\"checkbox\" name=\"".$Deletelist."[$i]\" value=\"".$entries[$i]["id"]."\">";
print "<a href=\"$EntryURL\" target=\"_blank\">".$entries[$i]["subject"]."</a>";
print ", ".date($DateformatHeadline,$entries[$i]["date"])." (".$MyCFG->get_timezone().")<br>";
$i++;
}
}
print "<hr width=\"100%\"><br><br>";
print "<input type=\"hidden\" name=\"".$MyRequestHandler->getNLModuleKeyName("DeleteOption")."\" value=\"yes\"><input type=\"hidden\" name=\"".$MyRequestHandler->getNLModuleKeyName("deleteARRsize")."\" value=\"$i\">";
print "<input type=\"hidden\" name=\"".$MyRequestHandler->getNLModuleKeyName("ViewMonth")."\" value=\"$ViewMonth\"><input type=\"hidden\" name=\"".$MyRequestHandler->getNLModuleKeyName("ChangeYear")."\" value=\"$ChangeYear\">";
print "<input type=\"submit\" value=\"$TXT_Delete_selected\"></form>";
}
else
{
print $ErrorNLdoesnotExist;
}
?>