2016-12-24 77 views
0

我创建了一个名为“atom”的Reportico项目和一个名为“Receipts”的报告,然后在ReportController中创建了action = receipt。 This是我跟着教程:Reportico:yii2如何嵌入链接?

控制器代码:

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

我创建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> 

我的代码应该打开

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

当我尝试它,我得到了像我附上的图片

enter image description here

当我输入在config.php define('SW_ADMIN_PASSWORD','1234');没有显示的密码。

我不需要强制用户输入密码!

我需要将报告嵌入到条件输入模式中。 enter image description here

回答

0

首先,如果你不想提示输入密码的动作,然后取出密码从config.php文件或使用项目配置选项将其空白。如果您想保留它,然后添加到代码中(在执行调用之前)

$engine->initial_project_password = "1234";

其次,我认为这不会帮助,因为你看到空白...你可以尝试上述选项之一来摆脱密码提示,然后看看它是否工作。如果你仍然空白,那么我们需要调查ajax调用。您是否无法进入您的网络浏览器调试网络选项卡并按下按钮,请注意发送到服务器的链接并查看响应?

+0

我从config.php中删除它,但仍然有空白页!并仍然要求输入密码。 –

+0

顺便说一句,当我打开'http://localhost/Atom/backend/web/index.php?r = reportico'时,密码消失了。它没有密码打开仪表板。 –

+0

我得到了解决方案:它是在配置项目..我忘了添加主机名。或IP。 –

0

您可以使用网址帮手

use yii\helpers\Url; 


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

可能是你应该设置相关

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

是的,我做的和链接工作正常..但网页不能正常工作..报告我创建工作,但链接不工作..我会添加更多的图片。 –

+0

请更好地解释你的评论..你是什么意思,“他报告我创造了工作,但链接没有工作。”用相关的代码和适当的信息更新问题 – scaisEdge

+0

安装后Repotico有一些东西像仪表板,你可以创建一个项目和报告,你可以测试他们我创建了一个项目和报告,我测试它和它的工作在仪表板..之后有嵌入报告,这是我做的..然后有嵌入链接报告这是我的问题,我什么都没有。 –