public function actionLinkurl($id) { $model = Stream::find()->where(['pr_id' => $id])->orderBy('st_cnt')->one(); if (!$model) { return false; } Stream::addCounter($model->st_id); header("Location:" . $model->st_url); //return $model->st_url; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $this->load($params); $query = Stream::find()->where(['pr_id' => $params['id']]); $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(['st_id' => $this->st_id, 'pr_id' => $this->pr_id]); $query->andFilterWhere(['like', 'st_name', $this->st_name]); return $dataProvider; }
public static function addCounter($id) { $model = Stream::findOne(['st_id' => $id]); $model->st_cnt += 1; $model->save(false); }
/** * create stream for current class * @param integer $streamUserId * @param integer $userId * @return boolean of integer */ public function createStream($streamUserId, $userId) { $helper = new \common\helpers\StreamzillaHelper(); //add wowza live stream $streamId = $helper->addWowzaLiveStream($streamUserId, $this->class_name); if ($streamId != -1) { //if success - get info about stream servers $stream = $helper->soapGetBroadCastSettings($streamId); if ($stream) { //store in DB $streamObj = new Stream(); $streamObj->stream_stream_name = $stream->fileid; $streamObj->stream_server = $stream->coreserver; $streamObj->stream_backup = $stream->fallbackserver; $streamObj->stream_stream = $stream->streamname; $streamObj->user_id = $userId; if ($streamObj->save()) { //save id into class table $this->class_stream = $streamObj->stream_id; } } } }
public static function getStreamFilter() { $droptions = Stream::find()->asArray()->all(); return Arrayhelper::map($droptions, 'st_name', 'st_name'); }
/** * Finds the Stream model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Stream the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Stream::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }