简体   繁体   English

Reportico:yii2如何嵌入链接?

[英]Reportico : yii2 How to embed Links?

I have created a Reportico Project named "atom" and a Report called "Receipts" and then I created action=receipts in ReportController. 我创建了一个名为“ atom”的Reportico Project和一个名为“ Receipts”的报表,然后在ReportController中创建了action = receipts。 This is the tutorial I followed: 是我遵循的教程:

Controller code : 控制器代码:

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

I created receipts.php 我创建了receives.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'); 当我输入config.php中define('SW_ADMIN_PASSWORD','1234');的密码时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 . 我需要将报表嵌入“标准输入模式”中。 在此处输入图片说明

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

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) 首先,如果您不想输入密码,请从config.php文件中取出密码或使用项目配置选项将其清空。如果要保留密码,则将其添加到代码中(在执行调用之前)

$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. 如果您仍然空白,那么我们需要调查ajax调用。 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? 您是否无法进入Web浏览器的“调试网络”选项卡,并且在按下某些按钮时,记下发送到服务器的链接并查看响应?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM