Exemple #1
0
 public function actionView($id)
 {
     $model = $this->loadModel('app\\models\\Issue', $id);
     $this->view->params['appSettings'] = ['app_name' => $model->project->title];
     if (!\Yii::$app->user->can('viewProject', ['project' => $model->project]) || \Yii::$app->user->isGuest) {
         throw new ForbiddenHttpException('Access denied');
     }
     if (\Yii::$app->request->post('hasEditable') && !\Yii::$app->user->isGuest) {
         $post = \Yii::$app->request->post('Issue');
         if (isset($post['status_id'])) {
             $model->status_id = $post['status_id'];
             $output = StatusEnum::i()->getMap()[$post['status_id']];
             $this->sendMessage($model, ['subject' => \Yii::t('app', 'Issue Status Changed'), 'view' => 'changeStatus']);
         }
         if (isset($post['priority_id'])) {
             $model->priority_id = (int) $post['priority_id'];
             $output = PriorityEnum::i()->getMap()[$post['priority_id']];
         }
         if (isset($post['tracker_id'])) {
             $model->tracker_id = (int) $post['tracker_id'];
             $output = TrackerEnum::i()->getMap()[$post['tracker_id']];
         }
         if (isset($post['assignee_id'])) {
             if ($post['assignee_id']) {
                 $model->assignee_id = (int) $post['assignee_id'];
                 $output = \app\models\Project::getAssigneeOptions($model->project_id)[$post['assignee_id']];
                 $this->sendMessage($model);
             } else {
                 $model->assignee_id = null;
                 $output = '<i>(' . \Yii::t('app', 'not set') . ')</i>';
             }
         }
         if (isset($post['readiness_id'])) {
             $model->readiness_id = (int) $post['readiness_id'];
             $output = Issue::getReadinessOptions()[$post['readiness_id']];
         }
         if (isset($post['deadline'])) {
             $model->deadline = $post['deadline'];
             $output = $post['deadline'];
         }
         if ($model->save()) {
             $out = Json::encode(['output' => $output, 'message' => '']);
             echo $out;
             return;
         }
     }
     if ($post = \Yii::$app->request->post('IssueComment')) {
         $comment = new IssueComment();
         $comment->text = $post['text'];
         $comment->issue_id = $id;
         if ($comment->save()) {
             \Yii::$app->session->setFlash('success', \Yii::t('app', 'Comment successfully added.'));
         }
     }
     return $this->render('view', ['model' => $model]);
 }
Exemple #2
0
            <dt><?php 
echo \Yii::t('app', 'Priority');
?>
</dt>
            <dd>
                <?php 
echo Editable::widget(['model' => $model, 'attribute' => 'priority_id', 'header' => \Yii::t('app', 'Priority'), 'inputType' => Editable::INPUT_DROPDOWN_LIST, 'data' => PriorityEnum::i()->getMap(), 'options' => ['class' => 'form-control'], 'displayValue' => PriorityEnum::i()->getMap()[$model->priority_id]]);
?>
            </dd>
            <dt><?php 
echo \Yii::t('app', 'Tracker');
?>
</dt>
            <dd>
                <?php 
echo Editable::widget(['model' => $model, 'attribute' => 'tracker_id', 'header' => \Yii::t('app', 'Priority'), 'inputType' => Editable::INPUT_DROPDOWN_LIST, 'data' => TrackerEnum::i()->getMap(), 'options' => ['class' => 'form-control'], 'displayValue' => TrackerEnum::i()->getMap()[$model->tracker_id]]);
?>
            </dd>
        </dl>
    </div>
    <div class="col-sm-3">
        <dl class="dl-horizontal">
            <dt><?php 
echo \Yii::t('app', 'Assignee');
?>
</dt>
            <dd>
                <?php 
echo Editable::widget(['model' => $model, 'attribute' => 'assignee_id', 'header' => \Yii::t('app', 'Assignee'), 'inputType' => Editable::INPUT_DROPDOWN_LIST, 'data' => \app\models\Project::getAssigneeOptions($model->project_id), 'options' => ['class' => 'form-control', 'prompt' => ' - '], 'displayValue' => $model->assignee ? $model->assignee->getFullName() : '<i>(' . \Yii::t('app', 'not set') . ')</i>']);
?>
            </dd>
Exemple #3
0
use yii\helpers\Url;
use yii\jui\DatePicker;
/* @var $model app\models\Issue */
$this->title = \Yii::t('app', 'New Issue') . ' - ' . $this->params['appSettings']['app_name'];
?>
    <h1><?php 
echo \Yii::t('app', 'New Issue');
?>
</h1>
<?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>

<?php 
echo $form->field($model, 'project_id')->dropDownList(\app\models\Project::getOptions());
echo $form->field($model, 'tracker_id')->dropDownList(\app\components\enums\TrackerEnum::i()->getMap());
echo $form->field($model, 'subject');
?>
<div class="row">
    <div class="col-sm-6">
        <?php 
echo $form->field($model, 'description')->widget(Widget::classname(), ['settings' => ['lang' => 'ru', 'minHeight' => 200, 'pastePlainText' => true, 'buttonSource' => true, 'plugins' => ['clips', 'fullscreen']]]);
?>
    </div>
    <div class="col-sm-6">
        <div class="form-group">
            <label for="qwe" class="control-label"><?php 
echo \Yii::t('app', 'Checklist');
?>
</label>
            <div class="checklistItems">