Like it on Facebook, Tweet it or share this topic on other bookmarking websites.
  • Re: Print Button Option for Answer Report

    by » 6 months ago


    Sure. If your users are registered users, add below code above the first div block or wherever you need.

    <?php if(!JFactory::getApplication()->input->getInt('print')):?>
    <a class="btn btn-default" href="/<?php echo JRoute::_(CommunityQuizHelperRoute::getMyResponseRoute($item->id, $displayData ['rid']).'&tmpl=component&print=1')?>" target="_blank">
        <i class="fa fa-print"></i> <?php echo JText::_('COM_COMMUNITYQUIZ_PRINT');?>
    </a>
    <?php else: ?>
    <script type="text/javascript">
    window.print();
    </script>
    <?php endif;?>

    If your users are guest users, then you need to print the same page as the user cannot see his report if redirected to another page. in that case, use the following code.

    <a class="btn btn-default" href="#" onclick="window.print();return false;">
        <i class="fa fa-print"></i> <?php echo JText::_('COM_COMMUNITYQUIZ_PRINT');?>
    </a>
    

     


    Follow me on twitter: https://twitter.com/corejoomla
    If you use our extensions, please post a rating and a review at the Joomla! Extensions Directory.
    Sociable | Surveys | 
    CjForum | Polls | Answers | Quizzes | Quotes | GPS ToolsCjFit | CjBlog


    Thank you said by: 9128742

  • Re: Print Button Option for Answer Report

    by » 6 months ago


    hi maverick

    Thanks for the above code, hopefully I can follow the logic and have an example to learn from, understand and apply for future reference.

    Will I need to add this coding when there is release update, or will the next release incorporate the print browser function to assist with the tcpdf issue of larger files.

    Also, all users for these quizzes are registered users.

    I will let you know how I went with the above code

    Thanks again

    Steve - Adelaide, South Australia


  • Re: Print Button Option for Answer Report

    by » 6 months ago


    hi maverick

    Able to display the print button, but received an error message Call to a member function getParent() on null with the following url:

    https://index.php/training-resources/assess1?view=myresponse&id=1&rid=276&tmpl=component&print=1

    Thanks

    Steve


  • Re: Print Button Option for Answer Report

    by » 6 months ago


    I am not sure why that error occurred, but the issue was caused by a code that is deprecated/unused for this type of URL. So delete that code for a quick fix as it is anyway gets deleted in future versions.

    Edit components/com_communityquiz/views/myresponse/view.html.php and delete the "if" block starting from line 167 to 184 i.e. the code between

    $id = (int) @$menu->query['id'];

    and

    $this->addFeed();

    Follow me on twitter: https://twitter.com/corejoomla
    If you use our extensions, please post a rating and a review at the Joomla! Extensions Directory.
    Sociable | Surveys | 
    CjForum | Polls | Answers | Quizzes | Quotes | GPS ToolsCjFit | CjBlog


  • Re: Print Button Option for Answer Report

    by » 6 months ago


    hi maverick

    when you say delete that code for a quick fix, are you referring to all of this code that we added?

    ?php if(!JFactory::getApplication()->input->getInt('print')):?>
    <a class="btn btn-default" href="/<?php echo JRoute::_(CommunityQuizHelperRoute::getMyResponseRoute($item->id, $displayData ['rid']).'&tmpl=component&print=1')?>" target="_blank">
        <i class="fa fa-print"></i> <?php echo JText::_('COM_COMMUNITYQUIZ_PRINT');?>
    </a>
    <?php else: ?>
    <script type="text/javascript">
    window.print();
    </script>
    <?php endif;?>

    Thanks

    Steve


  • Re: Print Button Option for Answer Report

    by » 6 months ago


    No. Please read my post above

    Edit components/com_communityquiz/views/myresponse/view.html.php and delete the "if" block starting from line 167 to 184 i.e. the code between


    Follow me on twitter: https://twitter.com/corejoomla
    If you use our extensions, please post a rating and a review at the Joomla! Extensions Directory.
    Sociable | Surveys | 
    CjForum | Polls | Answers | Quizzes | Quotes | GPS ToolsCjFit | CjBlog


  • Re: Print Button Option for Answer Report

    by » 6 months ago


    hi maverick

    Wasn't exactly sure what you meant by the comment "so delete that code..." in you post
    "I am not sure why that error occurred, but the issue was caused by a code that is deprecated/unused for this type of URL. So delete that code for a quick fix as it is anyway gets deleted in future versions."
     
    I have changed these files and getting the error message, can't reach this page (see the url itd trying to reach below
    1. Have deleted the "if" block from the view.html.php file, lines 167 to 184
    2. Inserted the coding (users) to the score.php file, to appear in the report heading

     

    Steve - Adelaide, South Australia

     

     

  • Re: Print Button Option for Answer Report

    by » 6 months ago


    hi maverick

    Wasn't exactly sure what you meant by the comment "so delete that code..." in you post
    "I am not sure why that error occurred, but the issue was caused by a code that is deprecated/unused for this type of URL. So delete that code for a quick fix as it is anyway gets deleted in future versions."
     
    I have changed these files and getting the error message, can't reach this page (see the url itd trying to reach below
    1. Have deleted the "if" block from the view.html.php file, lines 167 to 184
    2. Inserted the coding (users) to the score.php file, to appear in the report heading

     

    Thanks 

    Steve - Adelaide, South Australia

     

     
    33189_2_Print button.PNG (You do not have access to download this file.)

  • Re: Print Button Option for Answer Report

    by » 6 months ago


    To avoid confusion, I sent you the modified view.html.php file in your email, please use it.

    Please do not make any changes to score.php except what instructed to add the print button.


    Follow me on twitter: https://twitter.com/corejoomla
    If you use our extensions, please post a rating and a review at the Joomla! Extensions Directory.
    Sociable | Surveys | 
    CjForum | Polls | Answers | Quizzes | Quotes | GPS ToolsCjFit | CjBlog


  • Re: Print Button Option for Answer Report

    by » 6 months ago


    hi maverick

    Have uploaded the viewhtml.php file. Howver, still get the error message when the following code is used for the Print Button in the score.php file for registered users.

    <a class="btn btn-default" href="/<?php echo JRoute::_(CommunityQuizHelperRoute::getMyResponseRoute($item->id, $displayData ['rid']).'&tmpl=component&print=1')?>" target="_blank"><i class="fa fa-print"></i> <?php echo JText::_('COM_COMMUNITYQUIZ_PRINT');?> </a>

    When the following guest code is used for the Print Button in the score.php file, registered users can print the report and answers. (the print-out is just not as clean as the report itself)

    <a class="btn btn-default" href="#" onclick="window.print();return false;"> <i class="fa fa-print"></i> <?php echo JText::_('COM_COMMUNITYQUIZ_PRINT');?> </a>

    Thanks again for your time

    Steve – Adelaide, South Australia

     


You do not have permissions to reply to this topic.

Powered by CjForum

Trending Topics

Strange behavior when trying to do the same survey from two sides at the same time
  • 8 replies
Hello, I'm trying to do an anonymous survey, but I found a strange...

Survey Results show when I take the same survey again
  • 5 replies
Hi, I have an issue that when I take the same survey for a second...

Registration Page
  • 1 reply
Hi,   my Config: Joomla 3.9.23, Sociable 1.1.0, Template...

Start New Survey Option For User
  • 8 replies
Currently i have survey which required user to submit their feedback...

Smart Search plugin for CJF?
  • 2 replies
Looking to remove the legacy Search from my joomla site...