Print student profile (pdf) nicely

Hello there.
In gibbon there is option view & print student application. looks very good.
But when you print student profile it does not look good.
By law in our country we are required to keep paper file of student info.
How to print student profile (pdf) nicely ?
How difficult would be to implement that?
Any idea please
Thanks

1 Like

Hello there
I hope someone will help me please or at list point me some directions
Like i explained in previous comment i need to print student profiles.
I am trying to add code in student_view_details.php

When i access student profile in direct link it show print view.

report.php?q=/modules/Students/student_view_details.php&gibbonPersonID=0000000265&format=print

I am trying to add code in student_view_details.php

$table->addHeaderAction(‘print’, __(‘Print’))
->setURL(‘/report.php’)
->addParam(‘q’, ‘/modules/students/student_view_details.php’)
->addParam(‘gibbonPersonID’, $gibbonPersonID)
->addParam(‘format’, ‘print’)
->setIcon(‘print’)
->setTarget(‘_blank’)
->directLink()
->displayLabel();

It show a print link and icon in student view page.

But when i try to print it show just blank page with this error and this link.

report.php?q=%2Fmodules%2Fstudents%2Fstudent_view_details.php&gibbonPersonID=0000000265

You have not specified one or more required parameters.

What parameters i need to add more please?
Thanks

Update

Some how i was able to setup printer friendly page for Overview, Personal and Medical.

But for Family and Emergency Contact i am having problem.

For Overview i add code on line 308

$table->addHeaderAction(‘print’, __(‘Print’))
->setURL(‘/report.php’)
->addParam(‘q’, ‘/modules/Students/student_view_details.php’)
->addParam(‘gibbonPersonID’, $gibbonPersonID)
->addParam(‘subpage’, ‘Overview’)
->addParam(‘format’, ‘print’)
->setIcon(‘print’)
->setTarget(‘_blank’)
->directLink()
->displayLabel();

For Personal i add code on line 681

$table->addHeaderAction(‘print’, __(‘Print’))
->setURL(‘/report.php’)
->addParam(‘q’, ‘/modules/Students/student_view_details.php’)
->addParam(‘gibbonPersonID’, $gibbonPersonID)
->addParam(‘subpage’, ‘Personal’)
->addParam(‘format’, ‘print’)
->setIcon(‘print’)
->setTarget(‘_blank’)
->directLink()
->displayLabel();

For Medical i add code on line 1295

$table->addHeaderAction(‘print’, __(‘Print’))
->setURL(‘/report.php’)
->addParam(‘q’, ‘/modules/Students/student_view_details.php’)
->addParam(‘gibbonPersonID’, $gibbonPersonID)
->addParam(‘subpage’, ‘Medical’)
->setIcon(‘print’)
->setTarget(‘_blank’)
->directLink()
->displayLabel();

For Family i can use code.

I tried to put on line 830 but just give an error.

But if i put this code anywhere else example on personal or Medical section it will work.

$table->addHeaderAction(‘print’, __(‘Print’))
->setURL(‘/report.php’)
->addParam(‘q’, ‘/modules/Students/student_view_details.php’)
->addParam(‘gibbonPersonID’, $gibbonPersonID)
->addParam(‘subpage’, ‘Family’)
->addParam(‘format’, ‘print’)
->setIcon(‘print’)
->setTarget(‘_blank’)
->directLink()
->displayLabel();

For Emergency contact i use code on 1097 but just give me an error.
But if i put this code anywhere else example on personal or Medical section it will work.

$table->addHeaderAction(‘print’, __(‘Print’))
->setURL(‘/report.php’)
->addParam(‘q’, ‘/modules/Students/student_view_details.php’)
->addParam(‘gibbonPersonID’, $gibbonPersonID)
->addParam(‘subpage’, ‘Emergency Contacts’)
->addParam(‘format’, ‘print’)
->setIcon(‘print’)
->setTarget(‘_blank’)
->directLink()
->displayLabel();

Any idea, suggestion how to do this please.
Btw. My student_view_details.php is edited. Lines may be little different.

Thank you.

Hi @calx, great work on your code, it sounds like you’re very close, and the student_view_details.php script is a beast. Its hard to say what could be causing the inconsistency in the link working, it might be based on variables or permissions in the code.

You may be able to add this using a global action with the following code on line 259, right after the $subpage = 'Overview'; if statement. This will add the print page to all subpages:

$page->navigator->addHeaderAction('print', __('Print'))
    ->setURL('/report.php')
    ->addParam('q', '/modules/Students/student_view_details.php')
    ->addParam('gibbonPersonID', $gibbonPersonID)
    ->addParam('subpage', $subpage)
    ->addParam('format', 'print')
    ->setIcon('print')
    ->setTarget('_blank')
    ->directLink()
    ->displayLabel();

Hope this helps! Many areas of Gibbon do aim to reduce paper, which is why there are not print options for every page, but I can see that it’s tricky if it’s a government requirement.

Hi Sandra
I couldn’t have done it without your help.
Thank you very much.
It worked like charm.
There is one thing i would like to change on print page.
In print page on top there is a tab View Status Log and Edit. Is it possible to hide that on print page and add icon print.
Please see image.

Thank you very much.

Hi @calx Great to hear it’s working. Yes, there is a line (around 293) where the action is checked before these buttons are added. You could try adding a formate check here, such as:

if ( (empty($_GET['format']) || $_GET['format'] != 'print') && isActionAccessible($guid, $connection2, '/modules/User Admin/user_manage.php') == true) {

Hi Sandra.
It worked like charm. I was able to add code for each subpage. View Status Log and Edit links are hidden.
Is it possible to add print button where View Status Log and Edit links used to be? Please see attached screenshot
Thank you very much


I think you could do this with an else statement as part of the if you just modified. Try something like:

} else {
    $page->navigator->addHeaderAction('print', __('Print'))
        ->onClick('javascript:window.print(); return false;')
        ->displayLabel();
}

Keep in mind, that modifying the core in this way will make it difficult to do updates in the future, since updates will replace these modified files. You’d need to back up your changes and apply them again after new versions.

Hi Sandra
Thanks for your replay.

I tried to use on few spots but it did not show print link.
I tired to use on line 258 it did not show. (please see attached image)

I tried to use on line 320 it did not show. Please see attached image

Could you please tell me on what line i use this code?
Thank you