Reportico : yii2 How to embed Links?

浪子不回头ぞ 提交于 2020-01-17 07:37:58

问题


I have created a Reportico Project named "atom" and a Report called "Receipts" and then I created action=receipts in ReportController. This is the tutorial I followed:

Controller code :

public function actionReceipts()
{
  return $this->render('receipts');
}

I created receipts.php

<?php

use yii\helpers\Html;
use yii\helpers\Url;

$this->title = Yii::t('app', 'Reports');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="report-index">



<div class="container">
<div class="row">
     <div class="col-sm-1">
     </div>
    <div class="col-sm-11">


     <?php 
       $reportico = \Yii::$app->getModule('reportico');
    $engine = $reportico->getReporticoEngine();        // Fetches reportico engine
    $engine->access_mode = "ONEREPORT";                // Allows access to single specified report
    $engine->initial_execute_mode = "PREPARE";         // Starts user in report criteria selection mode
    $engine->initial_project = "atom";            // Name of report project folder
    $engine->initial_report = "receipts";           // Name of report to run
    $engine->bootstrap_styles = "3";                   // Set to "3" for bootstrap v3, "2" for V2 or false for no bootstrap
    $engine->force_reportico_mini_maintains = true;    // Often required
    $engine->bootstrap_preloaded = true;               // true if you dont need Reportico to load its own bootstrap
    $engine->clear_reportico_session = true;           // Normally required
    $engine->execute();  
    ?>
    </div>

</div>

</div>
</div>

my code should open

http://localhost/Atom/backend/web/index.php?r=report%2Freceipts 

when i try it i got like the pic i attached

when i type the password that in config.php define('SW_ADMIN_PASSWORD','1234'); nothing showing .

i don't need to force user to type a password !

and i need to embed the report in Criteria Entry Mode .


回答1:


Firstly if you dont want to prompt for a password, then take out the password from the config.php file or use the project configuration option to blank it.If you want to keep it then add into the code (before the execute call)

$engine->initial_project_password = "1234";

Secondly i think this wont help as you are seeing blank... can you try one of the above options to get rid of the password prompt and then see if it works. If you still get blanks then we need to investigate the ajax calls. Are yo unable to go into your web browser debug network tab and on pressing something, note the link sent to server and see response?




回答2:


You could use the url helper

use yii\helpers\Url;


echo '<a href="' . Url:to(['/report/receipts']) . 
               '" type="button" class="btn  btn-block btn-default">Receipts</a>';

could be you should set the action related

 $engine->initial_report = Url:to(['/report/receipts']);        // Name of report to run


来源:https://stackoverflow.com/questions/41315552/reportico-yii2-how-to-embed-links

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!