Ejemplo n.º 1
0
}
EOT;
$this->registerCss($sCss);
/* @var $this yii\web\View */
/* @var $model app\models\Doclad */
/* @var $form yii\widgets\ActiveForm */
// <div class="doclad-form">
// </div>
?>

    <?php 
$form = ActiveForm::begin(['id' => 'doclad-form', 'options' => ['class' => 'form-horizontal', 'enctype' => 'multipart/form-data'], 'fieldConfig' => ['template' => '{label}{input}{error}', 'options' => ['class' => '']], 'enableAjaxValidation' => true, 'enableClientValidation' => false, 'validateOnBlur' => false, 'validateOnChange' => false, 'validateOnType' => false, 'validateOnSubmit' => true]);
?>

<?php 
$aStatus = Doclad::getAllStatuses();
$sIdState = Html::getInputId($model, 'doc_state');
$aButtons = [];
foreach ($aStatus as $k => $v) {
    if ($k == 0) {
        continue;
    }
    $aButtons[] = Html::button($v, ['class' => 'btn ' . ($model->doc_state == $k ? 'btn-success' : 'btn-default') . ' buttonstatus', 'data-statusval' => $k, 'data-showcomment' => $k != Doclad::DOC_STATUS_APPROVE ? 1 : 0]);
}
$sJs = <<<EOT
var aStatusButtons = jQuery(".buttonstatus"),
    oComment = jQuery(".commentarea"),
    oState = jQuery("#{$sIdState}"),
    nState = oState.val();

oComment.hide();
Ejemplo n.º 2
0
    return $model->section !== null ? Html::encode($model->section->conference->cnf_title) . '<br />' . Html::encode($model->section->sec_title) : '';
}], ['class' => 'yii\\grid\\DataColumn', 'attribute' => 'doc_subject', 'format' => 'raw', 'value' => function ($model, $key, $index, $column) {
    $sFiles = '';
    $aFiles = $model->files;
    if (count($aFiles) > 0) {
        $sFiles = array_reduce($aFiles, function ($sRes, $item) {
            /** @var File $item */
            return '<br />' . Html::a($item->file_orig_name, str_replace(DIRECTORY_SEPARATOR, '/', $item->file_name)) . $sRes;
        }, '');
    }
    /** @var $model app\models\Doclad */
    return Html::encode($model->doc_subject) . (Yii::$app->user->identity->isMainModerator($model) ? ' <span class="glyphicon glyphicon-star"></span>' : '') . ($sFiles != '' ? '<br />' : '') . $sFiles . '<br />' . '<br />' . $model->getFullState();
}], ['class' => 'yii\\grid\\DataColumn', 'attribute' => 'doc_type', 'filter' => Doclad::getAllTypes(), 'format' => 'raw', 'value' => function ($model, $key, $index, $column) {
    /** @var $model app\models\Doclad */
    return Html::encode($model->typeTitle()) . ($model->doc_format != Doclad::DOC_FORMAT_NOFORMAT ? '<br />' . Html::encode($model->getFormat()) : '');
}], ['class' => 'yii\\grid\\DataColumn', 'attribute' => 'doc_state', 'filter' => Doclad::getAllStatuses(), 'format' => 'raw', 'value' => function ($model, $key, $index, $column) {
    /** @var $model app\models\Doclad */
    $a = [Doclad::DOC_STATUS_NEW => '', Doclad::DOC_STATUS_APPROVE => 'ok', Doclad::DOC_STATUS_NOT_APPROVE => 'remove', Doclad::DOC_STATUS_REVISION => 'refresh'];
    return $a[$model->doc_state] != '' ? '<span class="glyphicon glyphicon-' . $a[$model->doc_state] . '"></span>' : '';
}], ['class' => 'yii\\grid\\DataColumn', 'attribute' => 'doc_lider_fam', 'format' => 'raw', 'value' => function ($model, $key, $index, $column) {
    /** @var $model app\models\Doclad */
    return Html::encode($model->getLeadername(false)) . '<br />' . Yii::$app->formatter->asEmail($model->doc_lider_email) . ', ' . Html::a(str_replace(['(', ')'], [' (', ') '], $model->doc_lider_phone), 'tel:+' . preg_replace('|[^\\d]|', '', $model->doc_lider_phone));
}], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view} {filedownload}', 'buttons' => ['view' => function ($url, $model, $key) {
    /** @var Doclad $model */
    $options = [];
    $sIcon = 'pencil';
    if ($model->doc_state == Doclad::DOC_STATUS_APPROVE) {
        $sIcon = 'eye-open';
        if (count($model->files) > 0 && $model->doc_format == Doclad::DOC_FORMAT_NOFORMAT) {
            $sIcon = 'info-sign';
        }