getModels() публичный Метод

Returns the data models in the current page.
public getModels ( ) : array
Результат array the list of data models in the current page.
 /**
  * @inheritdoc
  */
 public function run()
 {
     /* @var $formatter Formatter */
     $formatter = Yii::$app->formatter;
     $prepodavatel = $formatter->asFizLico($this->zanyatie->prepodavatel_rel);
     $date = $formatter->asDate($this->zanyatie->data);
     $interval = $formatter->asZanyatieTimeInterval($this->zanyatie->nomer, Formatter::ZANYATIE_TIME_INTERVAL_FORMAT_FROM_TO);
     return Html::tag('p', "{$date} {$interval} преподаватель {$prepodavatel} занят в:") . "\n" . $this->renderKursy($this->dataProvider->getModels());
 }
Пример #2
0
 /**
  * Serializes a data provider.
  * @param DataProviderInterface $dataProvider
  * @return array the array representation of the data provider.
  */
 protected function serializeDataProvider($dataProvider)
 {
     $models = $this->serializeModels($dataProvider->getModels());
     if ($dataProvider->getPagination() === false) {
         return $models;
     } else {
         return ['total' => $dataProvider->getTotalCount(), 'rows' => $models];
     }
 }
Пример #3
0
 /**
  * Serializes a data provider.
  * @param DataProviderInterface $dataProvider
  * @return array the array representation of the data provider.
  */
 protected function serializeDataProvider($dataProvider)
 {
     $models = $this->serializeModels($dataProvider->getModels());
     if (($pagination = $dataProvider->getPagination()) !== false) {
         $this->addPaginationHeaders($pagination);
     }
     if ($this->request->getIsHead()) {
         return null;
     } elseif ($this->collectionEnvelope === null) {
         return $models;
     } else {
         $result = [$this->collectionEnvelope => $models];
         if ($pagination !== false) {
             return array_merge($result, $this->serializePagination($pagination));
         } else {
             return $result;
         }
     }
 }
Пример #4
0
 /**
  * Get items from data provider.
  *
  * @return array
  */
 protected function getItems()
 {
     return $this->dataProvider->getModels();
 }
Пример #5
0
 /**
  * Serializes a data provider.
  * @param DataProviderInterface $dataProvider
  * @return array the array representation of the data provider.
  */
 protected function serializeDataProvider($dataProvider)
 {
     $models = $this->serializeModels($dataProvider->getModels());
     if (($pagination = $dataProvider->getPagination()) !== false) {
         $this->addPaginationHeaders($pagination);
     }
     if ($this->request->getIsHead()) {
         return null;
     } elseif ($this->collectionEnvelope === null) {
         return $models;
     } else {
         $result = ['success' => 1, 'message' => \Yii::$app->response->statusText, 'status' => \Yii::$app->response->getStatusCode(), $this->collectionEnvelope => $models];
         if ($pagination !== false) {
             return array_merge($result, $this->serializePagination($pagination));
         } else {
             return $result;
         }
     }
 }
Пример #6
0
 /**
  * Serializes a data provider.
  * @param DataProviderInterface $dataProvider
  * @return array the array representation of the data provider.
  */
 protected function serializeDataProvider($dataProvider)
 {
     if ($this->request->getIsHead()) {
         return null;
     } else {
         $models = [];
         $includedModels = [];
         foreach ($dataProvider->getModels() as $model) {
             if ($model instanceof ResourceInterface) {
                 $models[] = $this->serializeModel($model);
                 $included = $this->serializeIncluded($model);
                 foreach ($included as $document) {
                     $includedModels[] = $document;
                 }
             }
         }
         $result = ['data' => $models];
         if (!empty($includedModels)) {
             $result['included'] = $includedModels;
         }
         if (($pagination = $dataProvider->getPagination()) !== false) {
             return array_merge($result, $this->serializePagination($pagination));
         }
         return $result;
     }
 }