rhosocial/yii2-organization

View on GitHub
widgets/views/organization-children-list.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

/**
 *  _   __ __ _____ _____ ___  ____  _____
 * | | / // // ___//_  _//   ||  __||_   _|
 * | |/ // /(__  )  / / / /| || |     | |
 * |___//_//____/  /_/ /_/ |_||_|     |_|
 * @link https://vistart.me/
 * @copyright Copyright (c) 2016 - 2017 vistart
 * @license https://vistart.me/license/
 */

use rhosocial\organization\Organization;
use rhosocial\organization\widgets\OrganizationListWidget;
use yii\base\View;
use yii\data\ActiveDataProvider;
use yii\widgets\Pjax;

/* @var $this View */
/* @var $organization Organization */
Pjax::begin([
    'id' => 'organization-children-pjax-' . $organization->getID(),
]);
echo OrganizationListWidget::widget([
    'dataProvider' => new ActiveDataProvider([
        'query' => $organization->getChildren(),
        'sort' => [
            'sortParam' => 'organization-children-sort-' . $organization->getID(),
        ],
        'pagination' => [
            'defaultPageSize' => 20,
            'pageParam' => 'organization-children-page-' . $organization->getID(),
            'pageSizeParam' => 'organization-children-per-page-' . $organization->getID(),
        ],
    ]),
    'gridCaption' => $organization->isOrganization() ? Yii::t('organization', 'All subordinates of the current organization:') : Yii::t('organization', 'All subordinates of the current department:'),
    'showParent' => false,
    'showChildren' => false,
    'showCreator' => false,
    'showAdmin' => false,
    'showMember' => false,
    'showType' => false,
    'actionColumn' => null,
    'tips' => false,
]);
Pjax::end();