Пример #1
1
echo Html::a("<i class='fa fa-hashtag'></i>", ['@ticket/view', 'id' => $model->id, '#' => $answerId], ['class' => 'name']);
?>
    <?php 
if ($answer->spent) {
    ?>
        <?php 
    echo Html::tag('span', Yii::t('hipanel:ticket', 'Time spent: {n}', ['n' => Yii::$app->formatter->asDuration($answer->spent * 60)]), ['class' => 'spent-time pull-right label label-info']);
    ?>
    <?php 
}
?>
</div>
<div class="clearfix"></div>

<?php 
echo Html::tag('span', Thread::parseMessage($answer->message), ['class' => 'body']);
?>

<?php 
if (!empty($answer->files)) {
    echo $this->render('_attachments', ['model' => $answer]);
}
?>

<?php 
echo Html::endTag('div');
?>

<?php 
echo Html::beginTag('div', ['class' => 'comment-footer']);
?>
Пример #2
0
 public function attributeLabels()
 {
     return array_merge(parent::attributeLabels(), ['anytext_like' => Yii::t('hipanel:ticket', 'Subject or message')]);
 }
 public function actionGetNewAnswers($id, $answer_id)
 {
     Yii::$app->response->format = Response::FORMAT_JSON;
     $result = ['id' => $id, 'answer_id' => $answer_id];
     try {
         $data = Thread::perform('GetLastAnswerId', ['id' => $id, 'answer_id' => $answer_id]);
         $result['answer_id'] = $data['answer_id'];
         if ($data['answer_id'] > $answer_id) {
             $dataProvider = (new ThreadSearch())->search([]);
             $dataProvider->query->joinWith('answers');
             $dataProvider->query->andWhere(['id' => $id]);
             $dataProvider->query->andWhere($this->getSearchOptions());
             $models = $dataProvider->getModels();
             $result['html'] = $this->renderPartial('_comments', ['model' => reset($models)]);
         }
     } catch (ErrorResponseException $e) {
     }
     return $result;
 }
 public function actionIndex()
 {
     $options = ['model' => ClientController::findModel(['id' => Yii::$app->user->identity->id, 'with_tickets_count' => true, 'with_domains_count' => Yii::getAlias('@domain', false) ? true : false, 'with_servers_count' => true, 'with_hosting_count' => true, 'with_contacts_count' => true]), 'totalCount' => []];
     if (Yii::$app->user->can('manage')) {
         if (Yii::getAlias('@domain', false)) {
             $options['totalCount']['domains'] = Domain::find()->count();
         }
         if (Yii::getAlias('@server', false)) {
             $options['totalCount']['servers'] = Server::find()->count();
         }
         if (Yii::getAlias('@ticket', false)) {
             $options['totalCount']['tickets'] = Thread::find()->count();
         }
     }
     return $this->render('index', $options);
 }