예제 #1
0
파일: Gram.php 프로젝트: smbale/eyew
 public function add($moment_id, $username, $link, $created_time, $image_url, $text)
 {
     if (!Gram::find()->where(['moment_id' => $moment_id])->andWhere(['link' => $link])->andWhere(['created_time' => $created_time])->exists()) {
         $i = new Gram();
         $i->moment_id = $moment_id;
         $i->username = $username;
         $i->link = $link;
         $i->created_time = $created_time;
         $i->image_url = $image_url;
         $i->text = $text;
         $i->save();
     }
 }
예제 #2
0
파일: GramSearch.php 프로젝트: smbale/eyew
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Gram::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'moment_id' => $this->moment_id, 'created_time' => $this->created_time, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'link', $this->link])->andFilterWhere(['like', 'image_url', $this->image_url])->andFilterWhere(['like', 'text', $this->text]);
     return $dataProvider;
 }
예제 #3
0
 public function actionBrowse($id)
 {
     // browse instagram results for moment $id
     $dataProvider = new ActiveDataProvider(['query' => Gram::find()->where(['moment_id' => $id])->orderBy('created_time ASC')]);
     return $this->render('browse', ['dataProvider' => $dataProvider, 'moment_id' => $id]);
 }
예제 #4
0
파일: Moment.php 프로젝트: smbale/eyew
 public static function purge($moment_id)
 {
     Gram::deleteAll('moment_id=' . $moment_id);
     Twitter::deleteAll('moment_id=' . $moment_id);
 }
예제 #5
0
파일: Twitter.php 프로젝트: smbale/eyew
 public function getGrams()
 {
     return $this->hasMany(Gram::className(), ['moment_id' => 'id']);
 }
예제 #6
0
 public function actionLookup($id)
 {
     $gram = new Gram();
     $media = $gram->lookup($id);
     print_r($media);
 }