Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make xls spreadsheet included via composer #137

Merged
merged 6 commits into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"type": "project",
"require": {
"guzzlehttp/guzzle": "^6.3",
"smarty/smarty": "^3.1"
"smarty/smarty": "^3.1",
"pear/ole": "^v1.0.0RC8",
"pear/spreadsheet_excel_writer": "^v0.9.7"
},
"authors": [
{
Expand Down
34 changes: 23 additions & 11 deletions config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,31 @@
require_once 'pdf.inc.php';

/*
* To enable XLS export you can uncomment the following line and edit
* the settings in xls.inc.php. This option requires the additional installation
* of "Spreadsheet OLE" and "Spreadsheet Excel Writer". They have to be accessible
* from the "include_path" which is set inside "php.ini".
* To enable XLS export you can uncomment the following line.
* The required libraries are now included via composer in folders
* vendor/pear/ole and Vendor/pear/spreadsheet_excel_writer
*/
require_once 'xls.inc.php';
/*
* Build your own list, where you define which fields you want and in
* which order they should appear.
*
* Supported fields are:
* title diskid language mediatype runtime year
* custom1 custom2 custom3 custom4 owner lent
* insertdate genres plot
*
* The length of the plot is limited to 253 characters!!!
*
* It's possible to use those fields also as an Excel note. For example if you want
* to see the title of the movie, followed by the diskid and the running time. As
* note you want to see the plot next to the title and the owner next to the diskid.
* For this example the xls_extra_fields list would look like this:
*
* $config['xls_extra_fields'] = 'title (plot), diskid (owner), runtime';
*
* In the Apache Distribution XAMPP it is included by default.
* On gentoo linux systems you can easily add it by typing
* emerge dev-php/PEAR-Spreadsheet_Excel_Writer
*
* Official Website:
* http://pear.php.net/package/Spreadsheet_Excel_Writer/
*/
// require_once 'xls.inc.php';
$config['xls_extra_fields'] = 'title (plot), diskid, genres, language, mediatype, runtime, year, custom1, custom2, custom3, custom4, insertdate, owner, lent';

/*
* To get access to FSK18 rated movies in the german dvdb engine you
Expand Down
11 changes: 6 additions & 5 deletions core/xls.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @package Core
* @link http://pear.php.net/package/Spreadsheet_Excel_Writer
* @author Chinamann <[email protected]>
* @author Andreas G�tz <[email protected]>
* @author Andreas G�tz <[email protected]>
* @version $Id: xls.php,v 1.8 2008/01/05 13:50:29 andig2 Exp $
*/

Expand All @@ -17,7 +17,7 @@
require_once './engines/engines.php';

#error_reporting(E_ALL^E_NOTICE);
require_once 'Spreadsheet/Excel/Writer.php';
require_once 'vendor/autoload.php';

/**
* Export PDF document
Expand Down Expand Up @@ -70,9 +70,9 @@ function xlsexport($WHERE)
$titleFormatLent =& $workbook->addFormat(array('Bold' => 1, 'Pattern' => 1));
$titleFormatLent -> setFgColor(14);

$plotFormatNormal =& $workbook->addFormat();
$plotFormatNormal =& $workbook->addFormat(array('Align' => 'top'));
$plotFormatNormal -> setTextWrap();
$plotFormatLent =& $workbook->addFormat(array('Pattern' => 1));
$plotFormatLent =& $workbook->addFormat(array('Align' => 'top','Pattern' => 1));
$plotFormatLent -> setTextWrap();
$plotFormatLent -> setFgColor(14);

Expand Down Expand Up @@ -147,7 +147,8 @@ function xlsexport($WHERE)
if ($rowindex == 1) $worksheet->setColumn($columnindex, $columnindex, 50);
$imdb = $row['imdbID'];
$link = ($imdb) ? engineGetContentUrl($imdb, engineGetEngine($imdb)) : '';
$worksheet->writeUrl($rowindex, $columnindex, $link, html_entity_decode($title), $format);
if($link <> '') $worksheet->writeUrl($rowindex, $columnindex, $link, html_entity_decode($title), $format);
else $worksheet->writeString($rowindex, $columnindex, leftString(html_entity_decode($row['title']),$text_length), $format);
}
$columnindex++;
}
Expand Down
Loading