Example #1
0
    <title><?php 
echo Html::encode($this->title);
?>
</title>
    <?php 
$this->head();
?>
</head>
<body>
<?php 
$this->beginBody();
?>

<div class="wrap">
    <?php 
NavBar::begin(['brandLabel' => \common\helpers\ConfigHelper::getAppConfig('name'), 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
$menuItems = [['label' => 'Home', 'url' => ['/site/index']], ['label' => 'About', 'url' => ['/site/about']], ['label' => 'Contact', 'url' => ['/site/contact']]];
if (Yii::$app->user->isGuest) {
    $menuItems[] = ['label' => 'Signup', 'url' => ['/site/signup']];
    $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
} else {
    $menuItems[] = ['label' => 'Logout (' . Yii::$app->user->identity->username . ')', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']];
}
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => $menuItems]);
NavBar::end();
?>

    <div class="container">
        <?php 
echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
?>
Example #2
0
<?php

error_reporting(E_ALL & ~E_STRICT);
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
require __DIR__ . '/../../vendor/autoload.php';
require __DIR__ . '/../../vendor/yiisoft/yii2/Yii.php';
require __DIR__ . '/../../common/config/bootstrap.php';
require __DIR__ . '/../config/bootstrap.php';
require __DIR__ . '/../../common/config/aliases.php';
$config = yii\helpers\ArrayHelper::merge(require __DIR__ . '/../../common/config/main.php', require __DIR__ . '/../../common/config/main-local.php', require __DIR__ . '/../config/main.php', require __DIR__ . '/../config/main-local.php', \common\helpers\ConfigHelper::getModulesConfigs($params["enabledModules"]));
$application = new yii\web\Application($config);
$application->run();
Example #3
0
<?php

/**
 * Application configuration for app unit tests
 */
return yii\helpers\ArrayHelper::merge(require YII_APP_BASE_PATH . '/common/config/main.php', require YII_APP_BASE_PATH . '/common/config/main-local.php', require YII_APP_BASE_PATH . '/app/config/main.php', require YII_APP_BASE_PATH . '/app/config/main-local.php', \common\helpers\ConfigHelper::getModulesConfigs($params["enabledModules"]), require dirname(__DIR__) . '/config.php', require dirname(__DIR__) . '/unit.php', require __DIR__ . '/config.php', []);
 /**
  * Lists all AccessApp models.
  * @return mixed
  */
 public function actionPreviewTpl($contr_id = '1')
 {
     /**
      * @var Pdf $pdf
      * @var Contract $ec
      * @var Group $group
      * @var Organization $provider
      * @var Traveller $assigned
      * @var Other $other
      */
     $this->layout = 'main_outer.php';
     $ec = Contract::findOne($contr_id);
     if (empty($ec)) {
         throw new Exception('合同不存在');
     }
     $version = ContractVersion::findOne($ec->vercode);
     if (empty($version)) {
         throw new Exception('合同版本不存在');
     }
     $travellers = Traveller::find()->andWhere('contr_id=:contr_id', [':contr_id' => $ec->contr_id])->all();
     $provider = Organization::findOne(1);
     $assigned = Traveller::find()->andWhere('contr_id=:contr_id and is_leader=:is_leader', [':contr_id' => $ec->contr_id, ':is_leader' => '1'])->one();
     $group = Group::find()->andWhere('contr_id=:contr_id', [':contr_id' => $ec->contr_id])->one();
     $other = Other::findOne($contr_id);
     $pay = json_decode($other->pay, true);
     $insurance = json_decode($other->insurance, true);
     $groupcorp = json_decode($other->groupcorp, true);
     $otherGroup = json_decode($other->group, true);
     $effect = json_decode($other->effect, true);
     $routes = Routes::find()->andWhere('contr_id=:contr_id and parentid=:parentid', [':contr_id' => $ec->contr_id, ':parentid' => 0])->all();
     //自愿购物活动补充协议
     $shops = ShopAgreement::find()->where("contr_id='{$ec->contr_id}'")->orderBy('index asc')->all();
     //自愿参加另行付费旅游项目补充协议
     $chargeables = Chargeable::find()->where("contr_id='{$ec->contr_id}'")->orderBy('index asc')->all();
     $data = ['contract' => $ec, 'version' => $version, 'provider' => $provider, 'group' => $group, 'assigned' => $assigned, 'travellers' => $travellers, 'routes' => $routes, 'shops' => $shops, 'chargeables' => $chargeables, 'other' => $other, 'pay' => $pay, 'insurance' => $insurance, 'groupcorp' => $groupcorp, 'otherGroup' => $otherGroup, 'effect' => $effect, 'app' => ConfigHelper::getParamsConfigArray('app'), 'company' => ConfigHelper::getParamsConfigArray('company'), 'year' => date('Y'), 'PAGE_BREAK' => PdfHelper::PAGE_BREAK];
     //pdf
     $css = Yii::$app->basePath . "/web/css/ec.css";
     $css = file_get_contents($css);
     $htmlContent = $this->renderPartial('inside.tpl', $data);
     //file_get_contents("D:/template/t2.htm");
     $pdf = Yii::$app->pdf;
     $pdf->cssInline .= $css;
     $pdf->content = $htmlContent;
     $pdf->filename = "电子合同-{$ec->contr_no}.pdf";
     //methods
     $pdf->methods['SetHeader'] = "合同编号<span class=\"color-tno\">{$ec->contr_no}</span>";
     $pdf->methods['SetTitle'] = ConfigHelper::getAppConfig('down');
     $pdf->methods['SetAuthor'] = ConfigHelper::getAppConfig('author');
     $pdf->methods['SetCreator'] = ConfigHelper::getAppConfig('creator');
     $pdf->methods['SetSubject'] = ConfigHelper::getAppConfig('subject');
     //$pdf->output($htmlContent);
     return $pdf->render();
     //return $this->render('inside.tpl',$data);
     //echo $htmlContent;
 }