本文整理汇总了PHP中Stream::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Stream::save方法的具体用法?PHP Stream::save怎么用?PHP Stream::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stream
的用法示例。
在下文中一共展示了Stream::save方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeAddWallpost
public function executeAddWallpost(sfWebRequest $request)
{
$message = $request->getPostParameter('message');
$source_id = $this->getUser()->getAttribute('viewing_profile_id');
$actor_id = $this->getUser()->getAttribute('id');
$stream = new Stream();
$stream->message = $message;
$stream->actor_id = $actor_id;
$stream->source_id = $source_id;
$stream->save();
$this->redirect('profile/index?uid=' . $source_id);
}
示例2: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Playlists();
$model->type = 0;
// for radioButtonList default value
$stream = new Stream();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Playlists'])) {
$model->attributes = $_POST['Playlists'];
if ($model->save()) {
if (isset($_POST['Stream']['url']) && $_POST['Playlists']['type'] == 2) {
//2 - stream
$stream->attributes = array('playlist_id' => $model->id, 'url' => $_POST['Stream']['url']);
$stream->save();
$this->redirect(array('view', 'id' => $model->id));
}
$this->redirect(array('update', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model, 'stream' => $stream));
}
示例3: Stream
$stream = new Stream();
if (isset($splitline[1])) {
$stream->name = $splitline[1];
$stream->cat_id = $_POST['category'];
$stream->trans_id = $_POST['transcode'];
$stream->restream = 0;
if (isset($_POST['restream'])) {
$stream->restream = 1;
}
$stream->bitstreamfilter = 0;
if (isset($_POST['bitstreamfilter'])) {
$stream->bitstreamfilter = 1;
}
$stream->streamurl = $lines[$key + 1];
if ($splitline[1] != null || $lines[$key + 1] != null) {
$stream->save();
}
$stream->name = $splitline[1];
$stream->cat_id = $_POST['category'];
$stream->trans_id = $_POST['transcode'];
$stream->restream = 0;
if (isset($_POST['restream'])) {
$stream->restream = 1;
}
$stream->bitstreamfilter = 0;
if (isset($_POST['bitstreamfilter'])) {
$stream->bitstreamfilter = 1;
}
$stream->streamurl = $lines[$key + 1];
if ($splitline[1] != null || $lines[$key + 1] != null) {
$stream->save();
示例4: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$event = ep\Event::find($id);
// Fetch all request data.
$data = Input::only('title', 'event_icon', 'lan', 'games', 'website', 'brackets', 'ticket_store', 'vod', 'start_date', 'finish_date', 'prizepool', 'location', 'about', 'tags', 'public_state', 'streams');
// Build the validation constraint set.
$rules = array('title' => array('required', 'min:3'), 'event_icon' => array('required', 'alpha_dash'), 'lan' => array('integer'), 'games' => array('required'), 'website' => array('url'), 'brackets' => array('url'), 'ticket_store' => array('url'), 'vod' => array('url'), 'start_date' => array('required', 'date', 'before:' . Input::get('finish_date')), 'finish_date' => array('required', 'date'), 'prizepool' => array('max:20'), 'location' => array('required_if:lan,true', 'max:25'), 'about' => array('max:21800'), 'public_state' => array('integer'), 'streams' => array('requiredOrArray', 'alpha_dashOrArray'));
// Create a new validator instance.
$validator = Validator::make($data, $rules);
if ($validator->passes()) {
$title = Input::get('title');
if ($event->title !== $title) {
$uniqid = str_shuffle(uniqid());
$event->slug = Str::slug($title, '-') . '-' . $uniqid;
$event->title = $title;
}
$event->event_icon = Input::get('event_icon');
$event->website = Input::get('website');
$event->brackets = Input::get('brackets');
$event->ticket_store = Input::get('ticket_store');
$event->vod = Input::get('vod');
$event->start_date = new DateTime(Input::get('start_date'));
$event->finish_date = new DateTime(Input::get('finish_date'));
$event->prizepool = Input::get('prizepool');
$event->about = Input::get('about');
$event->tags = Input::get('tags');
$event->lan = Input::get('lan') ? 1 : 0;
if (Input::get('lan') == true) {
$event->location = Input::get('location');
$event->latitude = Input::get('latitude');
$event->longitude = Input::get('longitude');
} else {
$event->location = 'Online';
$event->latitude = '';
$event->longitude = '';
}
$event->public_state = Input::get('public_state') ? 1 : 0;
$event->save();
$event_games = $event->eventGame()->get();
$games = Input::get('games');
foreach ($event_games as $event_game) {
if (!in_array($event_game->id, $games)) {
$event->eventGame($event_game)->detach();
}
}
foreach ($games as $game) {
$game_attach = Game::find($game);
if (!$event->eventGame()->where('game_id', '=', $game_attach->id)->first()) {
$event->eventGame()->attach($game_attach);
}
}
$event_streams = $event->eventStream()->get();
$stream_urls = Input::get('streams');
foreach ($event_streams as $event_stream) {
if (!in_array($event_stream->stream_url, $stream_urls)) {
$event->eventStream($event_stream)->detach();
}
}
foreach ($stream_urls as $stream_url) {
$stream_old = Stream::where('stream_url', '=', $stream_url)->first();
if ($stream_old == false && $stream_url) {
$stream = new Stream();
$stream->stream_url = $stream_url;
$stream->save();
$stream->streamEvent()->attach($event);
} else {
if (!$event->eventStream()->where('stream_id', '=', $stream_old->id)->first()) {
$stream_old->streamEvent()->attach($event);
}
}
}
return Redirect::to('/')->with('global_success', 'Event submitted successfuly!');
}
return Redirect::to('/event/edit/' . $event->id)->withInput()->withErrors($validator)->with('message', 'Validation Errors!');
}
示例5: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$show = Show::find($id);
$data = Input::only('title', 'show_icon', 'games', 'stream', 'people', 'vods', 'start_date', 'about', 'tags');
// Build the validation constraint set.
$rules = array('title' => array('required', 'min:3'), 'show_icon' => array('required', 'alpha_dash'), 'games' => array('required'), 'start_date' => array('required', 'date'), 'people' => array('required'), 'about' => array('max:21800'), 'stream' => array('alpha_dash'), 'vods' => array('max:21800'));
// Create a new validator instance.
$validator = Validator::make($data, $rules);
if ($validator->passes()) {
$title = Input::get('title');
if ($show->title !== $title) {
$uniqid = str_shuffle(uniqid());
$show->slug = Str::slug($title, '-') . '-' . $uniqid;
$show->title = $title;
}
$show->show_icon = Input::get('show_icon');
$show->air_date = new DateTime(Input::get('start_date'));
$show->people = Input::get('people');
$show->about = Input::get('about');
$show->tags = Input::get('tags');
$show->vods = Input::get('vods');
$show->save();
$show_games = $show->showGame()->get();
$games = Input::get('games');
foreach ($show_games as $show_game) {
if (!in_array($show_game->id, $games)) {
$show->showGame($show_game)->detach();
}
}
foreach ($games as $game) {
$game_attach = Game::find($game);
if (!$show->showGame()->where('game_id', '=', $game_attach->id)->first()) {
$show->showGame()->attach($game_attach);
}
}
$show_stream = $show->showStream()->first();
$stream_url = trim(Input::get('stream'));
if ($show_stream && $show_stream->stream_url !== $stream_url) {
$show->showStream($show_stream)->detach();
} elseif ($show_stream && $stream_url == false) {
$show->showStream($show_stream)->detach();
}
if ($stream_url) {
$stream_old = Stream::where('stream_url', '=', $stream_url)->first();
if ($stream_old == false && $stream_url) {
$stream = new Stream();
$stream->stream_url = $stream_url;
$stream->save();
$stream->streamShow()->attach($show);
} else {
if (!$show->showStream()->where('stream_id', '=', $stream_old->id)->first()) {
$stream_old->streamShow()->attach($show);
}
}
}
return Redirect::to('/')->with('global_success', 'Show submitted successfuly!');
}
return Redirect::to('/show/edit/' . $show->id)->withInput()->withErrors($validator)->with('message', 'Validation Errors!');
}
示例6: Stream
placeholder="any other information"></textarea>
</div>
</fieldset>
<fieldset class="buttons">
<button type="reset">RESET</button>
<button type="submit"
name="stage"
value="2">submit</button>
</fieldset>
</form>
</div>';
break;
case "2":
$stream = new Stream("00000", $_POST["name"], $_POST["description"], $_POST["startYear"], $_POST["stopYear"]);
if ($stream->validate()) {
if ($stream->save()) {
$pageBody .= '<div class="dialog">stream successfully saved</div>';
}
}
break;
}
break;
case "view":
if (isset($_REQUEST["target"])) {
$target = $_REQUEST["target"];
$stream = new Stream($target);
$pageBody .= '
<table class="pretty">
<tbody>
<tr>
<th>name</th>