Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Document::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     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(['DocumentId' => $this->DocumentId, 'TopicId' => $this->TopicId, 'DocumentTypeId' => $this->DocumentTypeId, 'ParentDocumentId' => $this->ParentDocumentId, 'Year' => $this->Year, 'Date' => $this->Date, 'EditionNumber' => $this->EditionNumber, 'DocumentOrder' => $this->DocumentOrder, 'OldId' => $this->OldId, 'IndexId' => $this->IndexId]);
     $query->andFilterWhere(['like', 'Note', $this->Note])->andFilterWhere(['like', 'Publication', $this->Publication])->andFilterWhere(['like', 'Intro', $this->Intro])->andFilterWhere(['like', 'Summary', $this->Summary])->andFilterWhere(['like', 'Text', $this->Text])->andFilterWhere(['like', 'Title', $this->Title])->andFilterWhere(['like', 'Number', $this->Number])->andFilterWhere(['like', 'HTML', $this->HTML]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
 public function actionDocument($id)
 {
     $connection = \Yii::$app->db;
     $data = Document::find()->where("documentid=" . $id)->one();
     $sql = $connection->createCommand('SELECT documenttype.name
                                        FROM document, documenttype
                                        WHERE documenttype.documenttypeid = document.documenttypeid
                                        AND document.documentid =' . $id);
     $documentTypeName = $sql->queryAll();
     $documentItem = Documentitem::find()->where("documentid=" . $id)->all();
     return $this->render('document', array('document' => $data, 'documentitem' => $documentItem, 'documentTypeName' => $documentTypeName));
 }