Reportico:yii2如何嵌入Links?

时间:2016-12-24 17:40:16

标签: php yii2 yii2-advanced-app reportico

我创建了一个名为“atom”的Reportico项目和一个名为“Receipts”的报告,然后我在ReportController中创建了action = receipts。 This是我遵循的教程:

控制器代码:

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

2 个答案:

答案 0 :(得分:0)

您可以使用网址助手

for (BeanPropertyDefinition bpd : beanPropertyDefinitions) {
    AnnotatedMember annotatedMember = bpd.getAccessor();
    Member member = annotatedMember.getMember();
    if (member instanceof Method) {
        Method getterMethod = (Method) member;
        System.out.println(getterMethod.getName());
    }
}

可能是你应该设置相关的动作

use yii\helpers\Url;


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

答案 1 :(得分:0)

首先,如果您不想提示输入密码,请从config.php文件中取出密码或使用项目配置选项将其删除。如果您想保留密码,请添加到代码中(执行前)调用)

$engine->initial_project_password = "1234";

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