本文整理匯總了PHP中Playlist::model方法的典型用法代碼示例。如果您正苦於以下問題:PHP Playlist::model方法的具體用法?PHP Playlist::model怎麽用?PHP Playlist::model使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Playlist
的用法示例。
在下文中一共展示了Playlist::model方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: loadModel
/**
* Returns the data model based on the primary key given in the GET variable.
* If the data model is not found, an HTTP exception will be raised.
*/
public function loadModel()
{
if ($this->_model === null) {
if (isset($_GET['id'])) {
$this->_model = Playlist::model()->findbyPk($_GET['id']);
}
if ($this->_model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
}
return $this->_model;
}
示例2: array
<?php
if (Playlist::model()->find('uid=' . Yii::app()->user->id)) {
?>
<h3>請選擇要添加歌曲的播放列表</h3>
<p>立即移動這些歌曲到:</p>
<div class="form">
<?php
$form = $this->beginWidget('CActiveForm', array('id' => 'playlist-form', 'enableAjaxValidation' => false));
echo '<pre>';
var_dump($_POST);
echo '</pre>';
echo $form->dropDownList($model, 'playlist_id', Playlist::getAllofCurrentUser());
?>
<input type="hidden" name="id" value="<?php
echo $id;
?>
" />
<div class="row buttons">
<?php
echo CHtml::submitButton('保存');
?>
</div>
<?php
$this->endWidget();
?>
</div>
<?php
} else {
echo '你還沒有播放列表,請先<a href="index.php?r=playlist/create">創建</a>。';
示例3: loadPlaylistModel
public function loadPlaylistModel($id)
{
$model = Playlist::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}