/**
  * Creates data provider instance with search query applied
  *
  * @return ActiveDataProvider
  */
 public function search()
 {
     $query = Participant::find()->with('company');
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'shortName', $this->shortName])->andFilterWhere(['companyId' => $this->companyId])->andFilterWhere(['like', 'ipAddress', $this->ipAddress])->andFilterWhere(['like', 'note', $this->note]);
     return $dataProvider;
 }
Example #2
0
 public function init()
 {
     parent::init();
     $this->on(self::EVENT_STATUS_CHANGED, function (RoomStatusChangedEvent $event) {
         if ($event->roomStatus === self::STATUS_CONSIDIRATION) {
             (new Mailer())->send($event);
         } else {
             $request = $event->request;
             $count = Participant::find()->where(['log' => ['$elemMatch' => ['requestId' => $request->_id, 'status' => self::STATUS_CONSIDIRATION]]])->count();
             if ($count === 0) {
                 $request->status = Request::STATUS_OSKR_CONSIDERATION;
                 $request->save(false);
                 $request->trigger(Request::EVENT_STATUS_CHANGED, new RequestStatusChangedEvent(['request' => $request]));
             }
         }
     });
 }
 public function __construct(Request $request)
 {
     parent::__construct($request);
     $this->_notifyParticipants = Participant::find()->with('company')->where(['_id' => ['$in' => $this->_request->participantsId], 'supportEmails' => ['$exists' => 1]])->all();
 }
Example #4
0
 /**
  * @return Participant[]
  */
 public function getParticipants()
 {
     if (!$this->_participants) {
         $this->_participants = is_array($this->participantsId) ? Participant::find()->with('company')->where(['_id' => ['$in' => $this->participantsId]])->all() : [];
     }
     return $this->_participants;
 }
Example #5
0
        <div id="vks-view-container"></div>

        <?php 
Modal::end();
?>

        <?php 
$form = ActiveForm::begin(['id' => 'vks-search-form', 'action' => ['vks-request/index'], 'method' => 'get', 'options' => ['class' => 'form-inline'], 'enableClientValidation' => false, 'formConfig' => ['showLabels' => false]]);
?>

        <?php 
echo $form->field($model, 'dateInput')->widget(DatePicker::className(), ['type' => DatePicker::TYPE_BUTTON, 'pluginOptions' => ['autoclose' => true, 'todayHighlight' => true, 'format' => 'dd.mm.yyyy']]);
?>

        <?php 
$query = Participant::find()->select(['_id', 'name', 'companyId'])->with('company');
$participants = ArrayHelper::toArray($query->all(), [Participant::className() => ['id' => function ($item) {
    return (string) $item->primaryKey;
}, 'name', 'company' => 'company.name']]);
$participantsIdData = ArrayHelper::map($participants, 'id', 'name', 'company');
?>

        <?php 
echo $form->field($model, 'participantsId')->widget(Select2::className(), ['data' => $participantsIdData, 'showToggleAll' => false, 'options' => ['placeholder' => 'Фильтр по участникам', 'multiple' => true], 'pluginOptions' => ['width' => '600px']]);
?>

        <?php 
echo Html::resetButton('Сброс', ['class' => 'btn btn-primary']);
?>

        <?php