<?php

use home\assets\MainAsset;
use home\assets\MenuAsset;
use yii\helpers\Url;
use home\modules\task\models\Category;
use home\modules\task\models\Task;
use common\models\User;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use yii\helpers\StringHelper;
use yii\helpers\Html;
use home\modules\blog\models\Blog;
use home\assets\CalendarAsset;

/* @var $this \yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \home\modules\task\models\Task */

MenuAsset::register($this);

$this->title = (isset($get['type']) && isset($typeTitle[$get['type']])) ? $typeTitle[$get['type']] . '任务' : '全部任务';
$assetUrl = $this->getAssetManager()->getBundle(CalendarAsset::className())->baseUrl;
$this->registerJsFile($assetUrl . '/js/task.leader.js', ['depends' => CalendarAsset::className()]);
?>

<!--container-->
<div class="container manage-project fix">
    <!--mainbody-->
    <div class="mainbody fix">
        <?= $this->render('@home/views/site/_left-menu') ?>
        <div class="manage-right">
            <div class="tab-column">
                <?php if (Yii::$app->session->get('isSuperAdmin') || Yii::$app->user->can('task/task/create')) : ?>
                    <div class="tab-right">

                        <button type="button" title="添加任务" data-title="添加任务" data-url="<?= Url::to(['create', 'from' => Url::to('')]) ?>" data-width="800" data-height="570" class="btn btn-default btn-task open-dialog">
                            <i class="icon-plus"></i>
                        </button>

                    </div>
                <?php endif; ?>
                <p class="caption">
                    <?= $this->title ?>
                </p>
            </div>

            <div class="manage-right-cont fix">
                <div class="mainleft-tree">
                    <div class="labellink fix"> <a href="<?= Url::to([$this->context->id . '/list']) ?>" class="labelfocus" title="查看全部">全部</a>
                    </div>
                    <div class="lefttree" >
                        <ul id="tree"  class="ztree"  ></ul>
                    </div>
                </div>
                <!--manage-left -->

                <div class="manage-right-iframe">
                    <iframe  frameBorder=0  name="main_content" id="main_content" scrolling=yes width="100%" height="790px" src="<?= Url::to(['list-iframe']) ?>"></iframe>
                </div>
                <!--manage-right-->
            </div>
        </div>
        <!--container-->
    </div>
</div>
<script>
    var CSRF = "<?= Yii::$app->request->getCsrfToken() ?>";
    var csrfToken = "<?= Yii::$app->request->getCsrfToken() ?>";
    var getTreeDataUrl = "<?= Url::to(['/task/task/get-treedata', '_csrf' => Yii::$app->request->getCsrfToken()]) ?>";
    var iframeDataUrl = "<?= Url::to([$this->context->id . '/list-iframe']) ?>";
</script>