本文整理汇总了PHP中Type::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Type::model方法的具体用法?PHP Type::model怎么用?PHP Type::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Type
的用法示例。
在下文中一共展示了Type::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
/**
* This is the default 'index' action that is invoked
* when an action is not explicitly requested by users.
*/
public function actionIndex()
{
#if (Yii::app()->user->isGuest) {
# $this->render('index');
#} else {
# if (Yii::app()->user->checkAccess('admin')) {
# $this->redirect(array('admin/index'));
# } else {
# $this->redirect(array('user/accountBalance', 'id'=>Yii::app()->user->_id));
# }
#}
$form = new SearchForm();
// Use for Form
$dataset = new Dataset();
// Use for auto suggestion
$datasetModel = $this->getDatasetByType(0);
// Use for image slider content
$publicIds = Yii::app()->db->createCommand()->select("id")->from("dataset")->where("upload_status = 'Published'")->queryAll();
$datasettypes_hints = Type::model()->findAll(array('order' => 'name ASC'));
$news = News::model()->findAll("start_date<=current_date AND end_date>=current_date");
$criteria = new CDbCriteria();
$criteria->limit = 10;
$criteria->condition = "upload_status = 'Published'";
#$criteria->order = "id DESC";
$criteria->order = 'publication_date DESC';
$latest_datasets = Dataset::model()->findAll($criteria);
$criteria->condition = null;
$criteria->order = 'publication_date DESC';
$latest_messages = RssMessage::model()->findAll($criteria);
$rss_arr = array_merge($latest_datasets, $latest_messages);
$this->sortRssArray($rss_arr);
$this->render('index', array('datasets' => $datasetModel, 'form' => $form, 'dataset' => $dataset, 'news' => $news, 'dataset_hint' => $datasettypes_hints, 'rss_arr' => $rss_arr, 'count' => count($publicIds), 'latest_datasets' => $latest_datasets));
}
示例2: loadModel
/**
* @param $id
* @return Type
* @throws CHttpException
*/
public function loadModel($id)
{
$model = Type::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, Yii::t('StoreModule.store', 'Page not found!'));
}
return $model;
}
示例3: getFormattedList
public function getFormattedList()
{
$types = Type::model()->findAll();
$list = [];
foreach ($types as $key => $type) {
$list[$type->id] = $type->name;
}
return $list;
}
示例4: run
public function run()
{
/*Top nxb*/
$criteria = new CDbCriteria ();
$list = Type::model()->findAll($criteria);
$this->render('category', array(
'list'=>$list,
));
}
示例5: getListTypes
public static function getListTypes()
{
$models = Type::model()->findAll();
$list = array();
foreach ($models as $key => $model) {
$list[$model->id] = $model->name;
}
return $list;
}
示例6: selectAll
public function selectAll()
{
$criteria = new CDbCriteria();
$criteria->select = 'id,name';
$result = Type::model()->findAll($criteria);
foreach ($result as $value) {
$data[$value->id]['name'] = $value->name;
}
$data['subject'] = array('name');
return $data;
}
示例7: actionUpdate
/**
* @param $id
* @throws CHttpException
*/
public function actionUpdate($id)
{
$model = $this->loadModel($id);
if (($data = Yii::app()->getRequest()->getPost('Attribute')) !== null) {
$currentType = $model->type;
$model->setAttributes(Yii::app()->getRequest()->getPost('Attribute'));
if ($model->save() && $model->changeType($currentType, $model->type) && $model->setTypes(Yii::app()->getRequest()->getPost('types', []))) {
Yii::app()->getUser()->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('StoreModule.store', 'Attribute updated'));
$this->redirect((array) Yii::app()->getRequest()->getPost('submit-type', ['update', 'id' => $model->id]));
}
}
$this->render('update', ['model' => $model, 'types' => Type::model()->findAll()]);
}
示例8: actionPortfolio
public function actionPortfolio()
{
$type = Type::model()->findAll();
$criteria = new CDbCriteria();
$criteria->select = '*';
$criteria->order = 'id_portfolio DESC';
$total = Portfolio::model()->count();
$pages = new CPagination($total);
$pages->pageSize = $total;
$pages->applyLimit($criteria);
$port = Portfolio::model()->findAll($criteria);
$this->render('portfolio', array('type' => $type, 'port' => $port, 'pages' => $pages));
}
示例9: actionDeleteattrgr
public function actionDeleteattrgr($id)
{
$gr = Type::model()->findByPk($id);
if (!empty($gr)) {
try {
$gr->delete();
} catch (CDbException $e) {
$this->redirect($this->createUrl('install/index', array('msg' => $e->getMessage(), 'msgtype' => 'error')));
}
$this->redirect($this->createUrl('install/index', array('msg' => '[!] Группа аттрибутов успешно удалена', 'msgtype' => 'success')));
} else {
$this->redirect($this->createUrl('install/index', array('msg' => '[!] Ошибка: нет такой группы атрибутов', 'msgtype' => 'error')));
}
}
示例10: actionIndex
public function actionIndex()
{
$type = Type::model()->findAll();
$skill = Skill::model()->findAll();
$usr = User::model()->findbyPk(1);
$criteria = new CDbCriteria();
$criteria->select = '*';
$criteria->order = 'rand()';
$total = Portfolio::model()->count();
$pages = new CPagination($total);
$pages->pageSize = 10;
$pages->applyLimit($criteria);
$port = Portfolio::model()->findAll($criteria);
$this->render('index', array('type' => $type, 'port' => $port, 'pages' => $pages, 'skill' => $skill, 'usr' => $usr));
}
示例11: actionIndex
function actionIndex()
{
//首页幻灯片展示,读取最新4条
$ppt = Article::model()->findAll(array('order' => 'create_time desc', 'limit' => 4));
//首页最新微语展示
$wei = Weiyu::model()->findAll(array('order' => 'create_time desc'));
// 首页点击率思想展示
$sixiang = Article::model()->findAll(array('order' => 'click desc', 'limit' => 8));
// 首页得瑟会员、小丫丫展示
$jiaoya = User::model()->findAll(array('order' => 'regtime desc', 'limit' => 5));
//首页展示标签
$pictag = Albumcate::model()->findAll();
$articletag = Type::model()->findAll();
//首页展示新的图
$likepic = Album::model()->findAll(array('order' => 'create_time desc', 'limit' => 9));
$data = array('quote' => $this->getRandomQuote(), 'ppt' => $ppt, 'wei' => $wei, 'sixiang' => $sixiang, 'jiaoya' => $jiaoya, 'pictag' => $pictag, 'likepic' => $likepic, 'articletag' => $articletag);
$this->render('index', $data);
}
示例12: actionTypeAttributes
public function actionTypeAttributes($id)
{
$type = Type::model()->findByPk($id);
if (null === $type) {
throw new CHttpException(404);
}
$out = [];
foreach ($type->typeAttributes as $attr) {
if ($attr->type == Attribute::TYPE_DROPDOWN) {
$out[] = array_merge($attr->attributes, ['options' => $attr->options]);
} else {
if (in_array($attr->type, [Attribute::TYPE_CHECKBOX, Attribute::TYPE_SHORT_TEXT])) {
$out[] = array_merge($attr->attributes, ['options' => []]);
}
}
}
Yii::app()->ajax->rawText(CJSON::encode($out));
}
示例13: getFormattedList
/**
* @return array
*/
public function getFormattedList()
{
return CHtml::listData(Type::model()->findAll(), 'id', 'name');
}
示例14:
echo Yii::t('ListnerModule.listner', 'Поля, отмеченные');
?>
<span class="required">*</span>
<?php
echo Yii::t('ListnerModule.listner', 'обязательны.');
?>
</div>
<?php
echo $form->errorSummary($model);
?>
<div class="row">
<div class="col-sm-7">
<?php
echo $form->dropDownListGroup($model, 'type_id', ['widgetOptions' => ['data' => CHtml::listData(Type::model()->findAll(), 'id', 'name')]]);
?>
</div>
</div>
<div class="row">
<div class="col-sm-7">
<?php
echo $form->textFieldGroup($model, 'name', ['widgetOptions' => ['htmlOptions' => ['class' => 'popover-help', 'data-original-title' => $model->getAttributeLabel('name'), 'data-content' => $model->getAttributeDescription('name')]]]);
?>
</div>
</div>
<div class="row">
<div class="col-sm-7">
<?php
echo $form->textFieldGroup($model, 'description', ['widgetOptions' => ['htmlOptions' => ['class' => 'popover-help', 'data-original-title' => $model->getAttributeLabel('description'), 'data-content' => $model->getAttributeDescription('description')]]]);
?>
示例15: 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 Type the loaded model
* @throws CHttpException
*/
public function loadModel($id)
{
$model = Type::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}