本文整理汇总了PHP中Resource::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Resource::model方法的具体用法?PHP Resource::model怎么用?PHP Resource::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Resource
的用法示例。
在下文中一共展示了Resource::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.
* @param integer $id the ID of the model to be loaded
* @return Resource the loaded model
* @throws CHttpException
*/
public function loadModel($id)
{
$model = Resource::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例2: getResourceObjectFromDatabase
/**
* Function to get Resource Object From Database
**/
public static function getResourceObjectFromDatabase($model, $key)
{
$upload_files = array();
$resources = ObjectResource::model()->findAll(array('condition' => 'object_id = :obj and type = :type', 'order' => 'resource_id ASC', 'limit' => $model->total_number_resource > 0 ? $model->total_number_resource : 1, 'params' => array(':obj' => $model->object_id, ':type' => $key)));
if ($resources & count($resources) > 0) {
foreach ($resources as $res) {
if ($find_resource = Resource::model()->findByPk($res->resource_id)) {
$file = array();
$file['link'] = $find_resource->getFullPath();
$file['resid'] = $find_resource->resource_id;
$file['type'] = $find_resource->resource_type;
$upload_files[] = $file;
}
}
}
return $upload_files;
}
示例3: array
echo $form->labelEx($model, 'name');
?>
<?php
echo $form->textField($model, 'name', array('size' => 50, 'maxlength' => 50));
?>
<?php
echo $form->error($model, 'name');
?>
</div>
<div class="row">
<?php
echo $form->labelEx($model, 'resource_id');
?>
<?php
echo $form->dropDownList($model, 'resource_id', CHtml::listData(Resource::model()->findAll(), 'id', 'name'));
?>
<?php
echo $form->error($model, 'resource_id');
?>
</div>
<div class="row">
<?php
echo $form->labelEx($model, 'speed');
?>
<?php
echo $form->textField($model, 'speed');
?>
<?php
echo $form->error($model, 'speed');