Ich habe mir erlaubt sowas zu basteln. Läuft mit FPDF 1.6 bei mir ganz brauchbar.
Die Implementierung ist ein "kleiner" hack. Es wäre sicher sinnvoll die list_show.php aufzugliedern in list_shop_cvs.php, list_show_html.php und list_show_pdf.php damit alles wieder halbwegs durchblickbar wird.
Exportiert wird im Querformat. Maxmiale Schriftgröße ist 12, minimale 4. Das Script sucht sich eine Schriftgröße aus, mit der sich alle Spalten auf der Seite ausgehen.
Die Ausgabe sollte mit der CSV-Ausgabe übereinstimmen. Bilder usw exportiere ich noch nicht.
Nebenbei habe ich noch ein paar kleinere Änderungen gemacht...
Dates-Plugin entfernt da es nicht mit dabei ist.
Code: Alles auswählen
diff -upNr admidio-2.1.2/adm_themes/modern/my_body_bottom.php admidio-2.1.2_patched/adm_themes/modern/my_body_bottom.php
--- admidio-2.1.2/adm_themes/modern/my_body_bottom.php 2009-04-15 22:49:40.000000000 +0200
+++ admidio-2.1.2_patched/adm_themes/modern/my_body_bottom.php 2009-04-18 16:47:38.000000000 +0200
@@ -21,13 +21,7 @@
include(SERVER_PATH. "/adm_plugins/login_form/login_form.php");
echo '<br />
-
- <h3>Termine</h3>';
-
- include(SERVER_PATH. "/adm_plugins/sidebar_dates/sidebar_dates.php");
-
- echo '<br />
-
+
<h3>Module</h3>
<span class="menu" style="margin-bottom: 10px;"><a href="'. $g_root_path. '/adm_program/index.php"><img
style="vertical-align: middle;" src="'. THEME_PATH. '/icons/home.png" alt="Übersicht" title="Übersicht" /></a>
z.B war es nicht gut als Name (lang) Pfadfindergruppe "St.Georg" Graz 3 einzugeben. Speichern geht zwar gut, aber wenn man wieder auf diese Seite geht fehlt alles hinter Pfadfindergruppe und wenn man dann etwas ändert und speichert ändert man das dann unabsichtlich. Mit htmlentites gehts jetzt.
Code: Alles auswählen
diff -upNr admidio-2.1.2/adm_program/administration/organization/organization.php admidio-2.1.2_patched/adm_program/administration/organization/organization.php
--- admidio-2.1.2/adm_program/administration/organization/organization.php 2009-04-16 17:03:24.000000000 +0200
+++ admidio-2.1.2_patched/adm_program/administration/organization/organization.php 2009-04-18 17:29:07.000000000 +0200
@@ -275,19 +275,19 @@ echo '
<li>
<dl>
<dt><label for="org_shortname">Name (Abk.):</label></dt>
- <dd><input type="text" id="org_shortname" name="org_shortname" readonly="readonly" style="width: 100px;" maxlength="10" value="'. $form_values['org_shortname']. '" /></dd>
+ <dd><input type="text" id="org_shortname" name="org_shortname" readonly="readonly" style="width: 100px;" maxlength="10" value="'. htmlentities($form_values['org_shortname']). '" /></dd>
</dl>
</li>
<li>
<dl>
<dt><label for="org_longname">Name (lang):</label></dt>
- <dd><input type="text" id="org_longname" name="org_longname" style="width: 200px;" maxlength="60" value="'. $form_values['org_longname']. '" /></dd>
+ <dd><input type="text" id="org_longname" name="org_longname" style="width: 200px;" maxlength="60" value="'. htmlentities($form_values['org_longname']). '" /></dd>
</dl>
</li>
<li>
<dl>
<dt><label for="org_homepage">Homepage:</label></dt>
- <dd><input type="text" id="org_homepage" name="org_homepage" style="width: 200px;" maxlength="50" value="'. $form_values['org_homepage']. '" /></dd>
+ <dd><input type="text" id="org_homepage" name="org_homepage" style="width: 200px;" maxlength="50" value="'. htmlentities($form_values['org_homepage']). '" /></dd>
</dl>
</li>
<li>
@@ -323,7 +323,7 @@ echo '
<li>
<dl>
<dt><label for=\"homepage_logout\">Startseite (Besucher):</label></dt>
- <dd><input type=\"text\" id=\"homepage_logout\" name=\"homepage_logout\" style=\"width: 200px;\" maxlength=\"250\" value=\"". $form_values['homepage_logout']. "\" /></dd>
+ <dd><input type=\"text\" id=\"homepage_logout\" name=\"homepage_logout\" style=\"width: 200px;\" maxlength=\"250\" value=\"". htmlentities($form_values['homepage_logout']). "\" /></dd>
</dl>
</li>
<li class=\"smallFontSize\">
@@ -334,7 +334,7 @@ echo '
<li>
<dl>
<dt><label for=\"homepage_login\">Startseite (angemeldete Benutzer):</label></dt>
- <dd><input type=\"text\" id=\"homepage_login\" name=\"homepage_login\" style=\"width: 200px;\" maxlength=\"250\" value=\"". $form_values['homepage_login']. "\" /></dd>
+ <dd><input type=\"text\" id=\"homepage_login\" name=\"homepage_login\" style=\"width: 200px;\" maxlength=\"250\" value=\"". htmlentities($form_values['homepage_login']). "\" /></dd>
</dl>
</li>
<li class=\"smallFontSize\">
@@ -833,7 +833,7 @@ echo '
<dl>
<dt><label for=\"photo_image_text\">Bildtext einblenden:</label></dt>
<dd>
- <input type=\"text\" id=\"photo_image_text\" name=\"photo_image_text\" maxlength=\"60\" value=\"".$form_values['photo_image_text']. "\" />
+ <input type=\"text\" id=\"photo_image_text\" name=\"photo_image_text\" maxlength=\"60\" value=\"".htmlentities($form_values['photo_image_text']). "\" />
</dd>
</dl>
</li>
@@ -1260,7 +1260,7 @@ echo '
<li>
<dl>
<dt><label for="mail_sendmail_address">Absender Mailadresse:</label></dt>
- <dd><input type="text" id="mail_sendmail_address" name="mail_sendmail_address" style="width: 200px;" maxlength="50" value="'. $form_values['mail_sendmail_address'].'" /></dd>
+ <dd><input type="text" id="mail_sendmail_address" name="mail_sendmail_address" style="width: 200px;" maxlength="50" value="'. htmlentities($form_values['mail_sendmail_address']).'" /></dd>
</dl>
</li>
<li class="smallFontSize">
@@ -1308,7 +1308,7 @@ echo '
<li>
<dl>
<dt><label for="email_administrator">Systemmailadresse:</label></dt>
- <dd><input type="text" id="email_administrator" name="email_administrator" style="width: 200px;" maxlength="50" value="'. $form_values['email_administrator'].'" /></dd>
+ <dd><input type="text" id="email_administrator" name="email_administrator" style="width: 200px;" maxlength="50" value="'. htmlentities($form_values['email_administrator']).'" /></dd>
</dl>
</li>
<li class="smallFontSize">
Code: Alles auswählen
diff -upNr admidio-2.1.2/adm_program/modules/lists/lists_show.php admidio-2.1.2_patched/adm_program/modules/lists/lists_show.php
--- admidio-2.1.2/adm_program/modules/lists/lists_show.php 2009-03-11 23:38:31.000000000 +0100
+++ admidio-2.1.2_patched/adm_program/modules/lists/lists_show.php 2009-04-20 13:39:47.000000000 +0200
@@ -24,9 +24,92 @@ require('../../system/common.php');
require('../../system/login_valid.php');
require('../../system/classes/list_configuration.php');
require('../../system/classes/table_roles.php');
+require('../../system/classes/fpdf16/fpdf.php');
+
+class List2PDF extends FPDF
+{
+ var $colNames;
+ var $lineData;
+
+ function setColumns ($cols)
+ {
+ $this->colNames=$cols;
+ $this->lineData=array();
+ }
+
+ function addLine($line)
+ {
+ $this->lineData[] = $line;
+ }
+
+ function makePDF()
+ {
+ $this->AddPage();
+ $this->SetAutoPageBreak(true);
+
+ $fontSize=13;
+
+ //Die benötigte Breite der Spalten errechnen..
+ $colWidth=array();
+
+ do {
+ $colWidth=array();
+ $fontSize--;
+ $this->SetFont('Arial','b',$fontSize);
+
+ $i=0;
+ foreach ($this->colNames as $colName) {
+ $colWidth[$i]=$this->GetStringWidth(mb_convert_encoding($colName, 'ISO-8859-1'),'utf8')+2*$this->cMargin;
+ $i++;
+ }
+
+ $this->SetFont('Arial','',$fontSize);
+ foreach ($this->lineData as $line) {
+ $i=0;
+ foreach ($line as $data) {
+ $width=$this->GetStringWidth(mb_convert_encoding($data, 'ISO-8859-1'),'utf8')+2*$this->cMargin;
+ if ($width>$colWidth[$i])
+ $colWidth[$i]=$width;
+ $i++;
+
+ }
+ }
+
+ $tableWidth=0;
+ foreach ($colWidth as $width) {
+ $tableWidth+=$width;
+ }
+
+ } while (($this->CurPageFormat[1]-$this->lMargin-$this->rMargin)<$tableWidth && $fontSize>4);
+
+ $this->SetFont('Arial','b',$fontSize);
+
+ $i=0;
+ foreach ($this->colNames as $colName) {
+ $this->Cell($colWidth[$i],$this->FontSize+2*$this->cMargin,mb_convert_encoding($colName, 'ISO-8859-1','utf8'),1);
+ $i++;
+ }
+ $this->ln();
+
+ $this->SetFont('Arial','',$fontSize);
+ foreach ($this->lineData as $line) {
+ $i=0;
+ foreach ($line as $data) {
+ $this->Cell($colWidth[$i],$this->FontSize+2*$this->cMargin,mb_convert_encoding($data, 'ISO-8859-1','utf8'),1);
+ $i++;
+ }
+ $this->ln();
+ }
+
+ $this->Output();
+
+ }
+}
+
+$pdfMaker= new List2PDF('l');
// lokale Variablen der Uebergabevariablen initialisieren
-$arr_mode = array('csv-ms', 'csv-ms-2k', 'csv-oo', 'html', 'print');
+$arr_mode = array('csv-ms', 'csv-ms-2k', 'csv-oo', 'html', 'print', 'fpdf');
$req_rol_id = 0;
$req_lst_id = 0;
$req_start = 0;
@@ -184,7 +267,7 @@ if($req_mode == 'html' && $req_start ==
$_SESSION['navigation']->addUrl(CURRENT_URL);
}
-if($req_mode != 'csv')
+if($req_mode != 'csv' && $req_mode!='fpdf')
{
// Html-Kopf wird geschrieben
if($req_mode == 'print')
@@ -333,6 +416,7 @@ if($req_mode != 'csv')
<option value="csv-ms">Microsoft Excel</option>
<option value="csv-ms-2k">Microsoft Excel 97/2000</option>
<option value="csv-oo">CSV-Datei (OpenOffice)</option>
+ <option value="fpdf">PDF-Datei</option>
</select>
</span>
</li>
@@ -340,7 +424,7 @@ if($req_mode != 'csv')
}
}
-if($req_mode != 'csv')
+if($req_mode != 'csv' && $req_mode != 'fpdf')
{
// Tabellenkopf schreiben
echo '<table class="'.$class_table.'" style="width: 95%;" cellspacing="0">
@@ -348,6 +432,8 @@ if($req_mode != 'csv')
}
// Spalten-Ueberschriften
+$colsToPrint=array();
+
for($column_number = 1; $column_number <= $list->countColumns(); $column_number++)
{
$column = $list->getColumnObject($column_number);
@@ -381,7 +467,16 @@ for($column_number = 1; $column_number <
|| $g_current_user->editUsers()
|| $g_current_user->getPropertyById($usf_id, 'usf_hidden') == 0)
{
- if($req_mode == 'csv')
+ if($req_mode == 'fpdf')
+ {
+ if($column_number == 1)
+ {
+ // die Laufende Nummer noch davorsetzen
+ $colsToPrint[]='Nr.';
+ }
+ $colsToPrint[]=$col_name;
+ }
+ else if($req_mode == 'csv')
{
if($column_number == 1)
{
@@ -402,7 +497,9 @@ for($column_number = 1; $column_number <
}
} // End-For
-if($req_mode == 'csv')
+if ($req_mode == 'fpdf')
+ $pdfMaker->setColumns($colsToPrint);
+else if($req_mode == 'csv')
{
$str_csv = $str_csv. "\n";
}
@@ -428,11 +525,13 @@ if(!$g_db->data_seek($result_list, $req_
$g_message->show('invalid');
}
+
for($j = 0; $j < $members_per_page && $j + $req_start < $num_members; $j++)
{
+ $lineValues=array();
if($row = $g_db->fetch_array($result_list))
{
- if($req_mode != 'csv')
+ if($req_mode != 'csv' && $req_mode!='fpdf')
{
// erst einmal pruefen, ob es ein Leiter ist, falls es Leiter in der Gruppe gibt,
// dann muss noch jeweils ein Gruppenkopf eingefuegt werden
@@ -492,7 +591,14 @@ for($j = 0; $j < $members_per_page && $j
|| $g_current_user->editUsers()
|| $g_current_user->getPropertyById($usf_id, 'usf_hidden') == 0)
{
- if($req_mode != 'csv')
+ if($req_mode == 'fpdf')
+ {
+ if($column_number == 1)
+ {
+ $lineValues[] = $irow;
+ }
+ }
+ else if($req_mode != 'csv')
{
$align = 'left';
if($b_user_field == true)
@@ -548,7 +654,7 @@ for($j = 0; $j < $members_per_page && $j
// Geschlecht anzeigen
if($row[$sql_column_number] == 1)
{
- if($req_mode == 'csv' || $req_mode == 'print')
+ if($req_mode == 'fpdf' || $req_mode == 'csv' || $req_mode == 'print')
{
$content = 'männlich';
}
@@ -560,7 +666,7 @@ for($j = 0; $j < $members_per_page && $j
}
elseif($row[$sql_column_number] == 2)
{
- if($req_mode == 'csv' || $req_mode == 'print')
+ if($req_mode == 'fpdf' || $req_mode == 'csv' || $req_mode == 'print')
{
$content = 'weiblich';
}
@@ -572,7 +678,7 @@ for($j = 0; $j < $members_per_page && $j
}
else
{
- if($req_mode != 'csv')
+ if($req_mode != 'csv' && $req_mode != 'fpdf')
{
$content = ' ';
}
@@ -590,7 +696,7 @@ for($j = 0; $j < $members_per_page && $j
}
$content = '<img src="photo_show.php?usr_id='.$row['usr_id'].'" style="vertical-align: middle;" alt="Benutzerfoto" />';
}
- if ($req_mode == 'csv' && $row[$sql_column_number] != NULL)
+ if ( ($req_mode == 'fpdf' || $req_mode == 'csv') && $row[$sql_column_number] != NULL)
{
$content = 'Profilfoto Online';
}
@@ -603,7 +709,7 @@ for($j = 0; $j < $members_per_page && $j
// Checkboxen werden durch ein Bildchen dargestellt
if($row[$sql_column_number] == 1)
{
- if($req_mode == 'csv')
+ if($req_mode == 'fpdf' ||$req_mode == 'csv')
{
$content = 'ja';
}
@@ -614,7 +720,7 @@ for($j = 0; $j < $members_per_page && $j
}
else
{
- if($req_mode == 'csv')
+ if($req_mode == 'fpdf' ||$req_mode == 'csv')
{
$content = 'nein';
}
@@ -674,11 +780,14 @@ for($j = 0; $j < $members_per_page && $j
}
}
- if($req_mode == 'csv')
+ if($req_mode == 'fpdf')
+ {
+ $lineValues[] = $content;
+ }
+ else if($req_mode == 'csv')
{
$str_csv = $str_csv. $separator. $value_quotes. $content. $value_quotes;
}
-
else
{
echo $content. '</td>';
@@ -686,7 +795,11 @@ for($j = 0; $j < $members_per_page && $j
}
}
- if($req_mode == 'csv')
+ if($req_mode == 'fpdf')
+ {
+ $pdfMaker->addLine($lineValues);
+ }
+ else if($req_mode == 'csv')
{
$str_csv = $str_csv. "\n";
}
@@ -694,11 +807,17 @@ for($j = 0; $j < $members_per_page && $j
{
echo '</tr>';
}
+
$irow++;
}
} // End-While (jeder gefundene User)
+if($req_mode == 'fpdf')
+{
+ $pdfMaker->makePDF();
+}
+
if($req_mode == 'csv')
{
// nun die erstellte CSV-Datei an den User schicken