Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Transaction Patterns » Output2 - Options / 90° cell rotation
Output2 - Options / 90° cell rotation [message #7361] Mon, 30 September 2019 09:55 Go to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
Can I rotate the cell values? I try to explain it with the next lines:

........| | | | | |
Line 1 x x x o x o
Line 2 x o x x x o
...

The pipes are the headings 90° rotated. So I could generate my (Pivot-table) report on one page.

[Updated on: Mon, 30 September 2019 09:55]

Report message to a moderator

Re: Output2 - Options / 90° cell rotation [message #7362 is a reply to message #7361] Tue, 01 October 2019 04:42 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
Not at present, but I will look into it.

Re: Output2 - Options / 90° cell rotation [message #7364 is a reply to message #7362] Tue, 01 October 2019 09:49 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
I cannot see any option for this is the TCPDF library, so I'm afraid that you are out of luck.

Re: Output2 - Options / 90° cell rotation [message #7365 is a reply to message #7364] Wed, 02 October 2019 05:33 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
What a pity. Thank you for looking for an option. Do you have any idea how I could solve this problem in a different way?
Re: Output2 - Options / 90° cell rotation [message #7366 is a reply to message #7365] Thu, 03 October 2019 05:26 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
If you look at https://www.tonymarston.net/php-mysql/output-to-pdf.html#col umn.widths.list you will see that it is possible for column labels to overflow onto the next line if the text is too wide for the cell width. It is also possible to insert the "\n" (newline) character between each letter to force it to overflow. Unfortunately I cannot see a way to rotate the text through 90 degrees, so you will still read it vertically.

Re: Output2 - Options / 90° cell rotation [message #7369 is a reply to message #7366] Fri, 04 October 2019 05:11 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
Thank you. I will try this out.
Re: Output2 - Options / 90° cell rotation [message #7370 is a reply to message #7369] Sat, 05 October 2019 11:51 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
In which method can I place best my code to modify the output? I want to show a 'x' for true and an '' for false. So I can see which player was present at a match.
In my pdf the 0 is always the presence of the first player in the first match. I think that I have to correct my SQL query in the controller script. Where can I dump the query result best?
Re: Output2 - Options / 90° cell rotation [message #7371 is a reply to message #7370] Sun, 06 October 2019 03:51 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
You can use the _cm_formatData() method which is the last method to be called before the data is passed to the PDF processor.

Re: Output2 - Options / 90° cell rotation [message #7377 is a reply to message #7371] Fri, 18 October 2019 12:38 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
At the moment I think I have found a way to generate my Pivot table but I need some further information from you.

1. In the _cm_initialise() method I query my table to find all relevant players and insert these as an array in $GLOBALS['']
2. In the _cm_formatData() method I now can investigate if the player was present or not present at the match. I do this with x or blank.

What I do not know is where to place best the code for the 90° heading variables as you told me with the "\n" character. I have seen that I can create the headings with variables like $structure['body']['fields'][] = array('spiele_anwesenheit_status_ausgabe' => $GLOBALS['Spielername01']);

The problem is that obviously the report structure file is called before the _cm_initialise() method so that the variable $GLOBALS['Spielername01'] is empty. The UML diagrams don't show the output pattern sequences. Can you tell me how I can solve this problem?
Re: Output2 - Options / 90° cell rotation [message #7378 is a reply to message #7377] Sat, 19 October 2019 04:21 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
Are these labels static or dynamic? If they are static you can define them with "\n" characters in the report.inc file. If they are dynamic then they need to be defined as fields instead of labels so that the contents of each field can be set in your code and not in the report.inc file. This is explained in https://www.tonymarston.net/php-mysql/output-to-pdf.html#tit le.contents - scroll down until you see you see the keyword "<text>" and the option for "%%<text>".

Re: Output2 - Options / 90° cell rotation [message #7379 is a reply to message #7378] Sat, 19 October 2019 08:21 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
The labels are dynamic. The number of colums can be different. But I think I have found a solution.

In my controller script I first call a method in one of my library inc files and there I run the query to get the number of colums and there I can create the labels. All this data I write to §GLOBALS so that I can read in the values in the report structure file.
Re: Output2 - Options / 90° cell rotation [message #7381 is a reply to message #7379] Sun, 20 October 2019 05:02 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
I'm glad you found a solution.

Re: Output2 - Options / 90° cell rotation [message #7382 is a reply to message #7381] Mon, 21 October 2019 04:53 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
There is one problem left. When will the report structure file be initialised? If I call my method at the begin of the controller script I do not have the values (in $GLOBALS) for querying the table. If I want to do this in the _cm_initialise() method of the class, the report structure file and the field labels are already "initialised" and I can't change them anymore.
Do you have a documentation about the sequences of the methods?
Re: Output2 - Options / 90° cell rotation [message #7383 is a reply to message #7382] Tue, 22 October 2019 07:14 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
This is the sequence of events in the OUTPUT2 pattern:
1) The report structure file is read into memory during execution of the initsession() function.
2) The following methods are called: $dbobject->initialise(), $dbobject->getExtraData(), $dbobject->getData_serial().
3) The PDF object is instantiated and the $pdf->outputPDF_ListView() method is called which has the following steps:
3.1) Call the $dbobject->_cm_pre_output() method.
3.2) Call the $pdf->listView() method which has the following steps:
3.2.1) Call $dbobject->fetchRow().
3.2.2) Call $dbobject->_cm_post_fetchRow().
3.3.3) Call $pdf->listView_print().
3.3.4) Call $dbobject->_cm_formatData().
3.3.5) Call $pdf->listView_assemble_row() for each column.
3.3.6) Call $pdf->printRow() to output the row to the PDF document, which calls the following at the start of each page:
3.3.6.1) Call $dbobject->_cm_ListView_header()
3.3.6.2) Call $pdf->Header() to print the page heading.
3.3.6.3) Output the column labels.

While testing this I discovered that the ability to use dynamic column labels was not available, so I have amended std.pdf_list.class.inc (which is attached) to add this ability. To use this feature you need to do the following:
a) In your report structure file change the column label from a literal to '%%id' where 'id' is the label identity.
b) In your object's _cm_ListView_header() method (see step 3.3.6.1 above) insert code similar to the following:
$this->dynamic_column_headings = array('id' => 'whatever');

This will then enable the step at 3.3.6.3 (which I have amended) to replace '%%id' with 'whatever'.

Try it and see.


Re: Output2 - Options / 90° cell rotation [message #7384 is a reply to message #7383] Wed, 23 October 2019 16:53 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
Thank you very much for the detailed documentation and the Explanation. I think, tomorrow I will have time to get on work again at my problem. But I can't download the std.pdf_list.class.inc. There is always an http 403 error. Do I have to do something else?
Re: Output2 - Options / 90° cell rotation [message #7385 is a reply to message #7384] Fri, 25 October 2019 04:37 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
Try this zip file instead.

Re: Output2 - Options / 90° cell rotation [message #7386 is a reply to message #7385] Fri, 25 October 2019 07:49 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
The same problem. I see a white screen and this: http://forum.radicore.org/index.php?t=getfile&id=558& ;
Re: Output2 - Options / 90° cell rotation [message #7387 is a reply to message #7386] Sat, 26 October 2019 04:45 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
Strange, that's never happened before. I will send you a copy in a private message.

Re: Output2 - Options / 90° cell rotation [message #7394 is a reply to message #7383] Sat, 14 December 2019 07:23 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
At the moment I can create the report header as I wanted as you can see in the attached screen shot.
My problem now is that I have the same value in all coloumns.
In the cm_formatData() method I can collect the data for the row by an array. But how to send them to the report? Is there a possibility such as for the header columns like "$this->dynamic_column_headings = array('id' => 'whatever');"?

But I think I do not know how it definitely works. In my report body there is always the same field specified. So it should be always the same value....

$structure['body']['fields'][] = array('spiele_anwesenheit_status' => '%%2');
$structure['body']['fields'][] = array('spiele_anwesenheit_status' => '%%3');
$structure['body']['fields'][] = array('spiele_anwesenheit_status' => '%%4');
$structure['body']['fields'][] = array('spiele_anwesenheit_status' => '%%5');

[Updated on: Sat, 14 December 2019 09:59]

Report message to a moderator

Re: Output2 - Options / 90° cell rotation [message #7395 is a reply to message #7394] Sun, 15 December 2019 04:03 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
That screenshot shows that you have modified the report headings OK, but when it comes to the data which is shown in each column it is the contents of $fieldarray which counts. The _cm_formatData() method deals with one row at a time which means that $fieldarray is an associative array of $fieldname => $fieldvalue pairs. All you need to do is insert the right $fieldvalue for each $fieldname.

Re: Output2 - Options / 90° cell rotation [message #7396 is a reply to message #7395] Tue, 31 December 2019 12:23 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
I finally got the result that I want. I attached a report. Now there is one thing left which I want to correct. If I generate the names for the heading with "\n" I have problems with the sequence ma. It seems that m . "\n" will cause an empty row as you can see in the report. The other problem are the german characters ä, ö, ü. Can you give me a hint how I can deal with this?

I actually have this code:

for ($sp=0; $sp<$stringlaenge; $sp++)
{
$spielernameoutput = $spielernameoutput . substr($spielername, 0, 1) . "\n";
$spielername = substr($spielername, 1, $stringlaenge - $sp);
}

[Updated on: Tue, 31 December 2019 12:30]

Report message to a moderator

Re: Output2 - Options / 90° cell rotation [message #7397 is a reply to message #7396] Thu, 02 January 2020 02:02 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
I have tried this on my system and the letter "m" followed by "\n" does not output an empty row.

What font are you using for the column headings?


Re: Output2 - Options / 90° cell rotation [message #7398 is a reply to message #7397] Thu, 02 January 2020 03:50 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
I use Times for the column headings.

Here is the pdf.styles.inc entry:

$style['hdg_anwesenheit']['font'] = array('family' => 'Times', // Courier, Helvetica, Times
'style' => '', // blank=Regular, B=Bold, I=Italic, U=Underline
'size' => 9, // size in points
'height' => 3.9, // line height in units
'draw' => .3, // width of drawn lines
'overflow' => y, // overflow
'border' => '1', // position of border lines
'halign' => 'left'); // horizontal text alignment (left, right, center)
Re: Output2 - Options / 90° cell rotation [message #7399 is a reply to message #7361] Thu, 02 January 2020 05:47 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
The letter "m" followed by "\n" does not output an empty row. That is right. It was my fault. The column width was too small! The minimum width must be 7.6 point!

The only problem are now the german special characters as ä, ö and ü.

[Updated on: Thu, 02 January 2020 05:49]

Report message to a moderator

Re: Output2 - Options / 90° cell rotation [message #7400 is a reply to message #7399] Tue, 07 January 2020 06:01 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
What version of Radicore are you using?

Re: Output2 - Options / 90° cell rotation [message #7401 is a reply to message #7399] Wed, 08 January 2020 11:52 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
I have updated the version of TCPDF to 6.2.26 and cleared all the deprecations in PHP 7.4. I have tested this on my PC and it correctly deals with accented characters in the column headings. All the changed scripts are in the attached zip file. Try it out and see if it fixes your problem.
  • Attachment: tcpdf.zip
    (Size: 285.91KB, Downloaded 357 times)


Re: Output2 - Options / 90° cell rotation [message #7402 is a reply to message #7401] Wed, 08 January 2020 16:29 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
I have the same problem with downloading the zip file as the last time. Could you pleas send the zip file via eMail?
Re: Output2 - Options / 90° cell rotation [message #7403 is a reply to message #7402] Thu, 09 January 2020 04:56 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
I have discovered what the problem is when trying to download a file from a hyperlink. There is a bug in the FudForum code which appends an extra '&' at the end of the URL. Simply delete this duff character and try again.

Re: Output2 - Options / 90° cell rotation [message #7405 is a reply to message #7403] Fri, 10 January 2020 12:17 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
I could download the zip file and replaced the files. The result is the same.

But now I cannot access the radicore application anymore. I get the following error message:

Fatal Error: No value has been defined for 'https_server' (# 256)
Error in line 1346 of file '/var/www/vhosts/mgh-saar.de/includes/include.session.inc'.

Do I have to change something in config.inc?

My local application in xampp works fine.
Re: Output2 - Options / 90° cell rotation [message #7406 is a reply to message #7405] Fri, 10 January 2020 12:59 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
I downloaded version 2.14.0 and installed it. The same result. But you have your config.inc in the zip file.
Re: Output2 - Options / 90° cell rotation [message #7407 is a reply to message #7406] Sat, 11 January 2020 05:46 Go to previous message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
I have removed my config.inc from the zip file. I cannot understand why you cannot see accented characters in the report heading as I changed task mnu_pattern(pdf) to replace the text "Pattern Name" with "äëîöü". You can run this yourself from the demonstration on https://www.radicore.org/demo/menu/logon.php

Previous Topic: Output2 - SQL
Next Topic: Filepicker - getDir()
Goto Forum:
  


Current Time: Mon Nov 18 02:32:54 EST 2024

Total time taken to generate the page: 0.01936 seconds