本文整理汇总了PHP中DocumentType::model方法的典型用法代码示例。如果您正苦于以下问题:PHP DocumentType::model方法的具体用法?PHP DocumentType::model怎么用?PHP DocumentType::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocumentType
的用法示例。
在下文中一共展示了DocumentType::model方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
public function actionIndex()
{
if (isset($_GET['id'])) {
$model = Document::model()->findByPk($_GET['id']);
$this->render('detail', array('model' => $model));
} else {
if ($_GET['type_id']) {
$criteria = new CDbCriteria();
$criteria->select = '*';
$criteria->condition = 'status = 1 AND doc_group=\'service\' AND doc_type_id=' . $_GET['type_id'];
$criteria->order = 'sort_order';
$total = Document::model()->count($criteria);
$pages = new CPagination($total);
$pages->setPageSize(20);
$pages->applyLimit($criteria);
$model = Document::model()->findAll($criteria);
$type = DocumentType::model()->findByPk($_GET['type_id']);
$this->render('index', array('model' => $model, 'type' => $type, 'pages' => $pages));
} else {
$criteria = new CDbCriteria();
$criteria->select = '*';
$criteria->condition = 'status = 1 AND doc_group=\'service\'';
$criteria->order = 'sort_order';
$total = Document::model()->count($criteria);
$pages = new CPagination($total);
$pages->setPageSize(20);
$pages->applyLimit($criteria);
$model = Document::model()->findAll($criteria);
$this->render('index', array('model' => $model, 'pages' => $pages));
}
}
}
示例2: actionType
public function actionType($id)
{
$criteria = new CDbCriteria();
$criteria->select = '*';
$criteria->condition = 'status = 1 AND doc_type_id =' . $id;
$criteria->order = 'sort_order ASC ,last_update DESC';
$model = Document::model()->findAll($criteria);
$type = DocumentType::model()->findByPK($id);
$this->render('index', array('model' => $model, 'type' => $type));
}
示例3: CDbCriteria
}
?>
href="<?php
echo Yii::app()->createUrl('information');
?>
"><?php
echo $admission;
?>
</a>
<ul>
<?php
$criteria = new CDbCriteria();
$criteria->condition = 'status=:status AND doc_group=\'service\'';
$criteria->params = array(':status' => 1);
$criteria->order = 'sort_order';
$doc_type = DocumentType::model()->findAll($criteria);
foreach ($doc_type as $type) {
?>
<li><a href="<?php
echo Yii::app()->createUrl('information', array('type_id' => $type->doc_type_id));
?>
"><?php
echo $type->name_th;
?>
</a></li>
<?php
}
?>
<!--li><a href="<?php
echo Yii::app()->createUrl('admission');
?>
示例4: array
<?php
/* @var $this DocumentController */
/* @var $model Document */
$this->breadcrumbs = array('สื่อเผยแพร่/ดาวน์โหลด' => array('index'), 'จัดการข้อมูล');
$this->menu = array(array('label' => 'เพิ่มข้อมูล', 'url' => array('create')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$('#document-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>
<h1>จัดการสื่อเผยแพร่/ดาวน์โหลด</h1>
<?php
echo CHtml::link('ค้นหาแบบละเอียด', '#', array('class' => 'search-button'));
?>
<div class="search-form" style="display:none">
<?php
$this->renderPartial('_search', array('model' => $model, 'doc_type_list' => $doc_type_list));
?>
</div><!-- search-form -->
<?php
$this->widget('zii.widgets.grid.CGridView', array('id' => 'document-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('header' => 'ลำดับ', 'type' => 'raw', 'value' => '$this->grid->dataProvider->pagination->currentPage*$this->grid->dataProvider->pagination->pageSize + $row+1', 'htmlOptions' => array('style' => 'text-align: center;width: 30px;')), array('name' => 'name_th', 'header' => 'สื่อเผยแพร่/ดาวน์โหลด'), array('name' => 'doc_type_id', 'header' => 'ประเภท', 'value' => '$data->documentType->name_th', 'htmlOptions' => array('style' => 'text-align: left;width: 150px;'), 'filter' => CHtml::listData(DocumentType::model()->findAll('status=1'), 'doc_type_id', 'name_th')), array('name' => 'last_update', 'header' => 'วันที่ปรับปรุง', 'value' => 'Controller::getThaiDate($data->last_update,"dmY")', 'htmlOptions' => array('style' => 'text-align: center;width: 80px;')), array('name' => 'status', 'value' => '($data->status)? \'แสดง\' : \'ไม่แสดง\'', 'htmlOptions' => array('style' => 'text-align: center;width: 50px;'), 'filter' => array('1' => 'แสดง', '0' => 'ไม่แสดง')), array('class' => 'CButtonColumn', 'template' => '{update} {delete}', 'headerHtmlOptions' => array('style' => 'width:40px;'), 'htmlOptions' => array('style' => 'width:40px; text-align:center')))));
示例5: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin()
{
if ($this->menu_use[4]) {
$doc_type_list = array();
$criteria = new CDbCriteria();
$criteria->condition = 'status=:status AND doc_group=\'download\'';
$criteria->params = array(':status' => 1);
$criteria->order = 'name_th';
$doc_type = DocumentType::model()->findAll($criteria);
foreach ($doc_type as $type) {
$doc_type_list[$type->doc_type_id] = $type->name_th;
}
$model = new Document('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Document'])) {
$model->attributes = $_GET['Document'];
}
$this->render('admin', array('model' => $model, 'doc_type_list' => $doc_type_list));
} else {
$this->redirect(array('site/index'));
}
}
示例6: actionSitemap
public function actionSitemap()
{
$condition = new CDbCriteria();
$condition->condition = "news_type_id =2 AND status = 1";
$condition->order = "create_date desc,news_id desc";
$condition->offset = 0;
$condition->limit = 6;
$student_news = News::model()->findAll($condition);
$news_criteria = new CDbCriteria();
$news_criteria->condition = "news_type_id =1 AND status = 1";
$news_criteria->order = "create_date desc,news_id desc";
$news_criteria->offset = 0;
$news_criteria->limit = 3;
$news = News::model()->findAll($news_criteria);
$job_criteria = new CDbCriteria();
$job_criteria->condition = "news_type_id =3 AND status = 1";
$job_criteria->order = "create_date desc,news_id desc";
$job_criteria->offset = 0;
$job_criteria->limit = 6;
$job_news = News::model()->findAll($job_criteria);
$pr_criteria = new CDbCriteria();
$pr_criteria->condition = "news_type_id =5 AND status = 1";
$pr_criteria->order = "create_date desc,news_id desc";
$pr_criteria->offset = 0;
$pr_criteria->limit = 3;
$newsInSide = News::model()->findAll($pr_criteria);
$link_criteria = new CDbCriteria();
$link_criteria->condition = "status = 1";
$link_criteria->order = "sort_order";
$links = Link::model()->findAll($link_criteria);
$criteria = new CDbCriteria();
$criteria->condition = "status = 1 AND doc_group ='download'";
$criteria->order = "sort_order";
$doc = DocumentType::model()->findAll($criteria);
$criteria = new CDbCriteria();
$criteria->condition = "status = 1";
$criteria->order = "sort_order";
$org = Organization::model()->findAll($criteria);
$criteria = new CDbCriteria();
$criteria->condition = "status = 1";
$criteria->order = "sort_order";
$report = ReportType::model()->findAll($criteria);
$vdo_criteria = new CDbCriteria();
$vdo_criteria->condition = "page_id = 3 AND status = 1";
$vdo = Page::model()->find($vdo_criteria);
// echo "<br> ===> ";
// echo "<pre>";
// print_r($vdo);
// echo "</pre>";
// exit;
$this->render('sitemap', array('news' => $news, 'newsInSide' => $newsInSide, 'job' => $job_news, 'student_news' => $student_news, 'doc' => $doc, 'org' => $org, 'links' => $links, 'report' => $report, 'vdo' => $vdo));
}
示例7: 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 DocumentType the loaded model
* @throws CHttpException
*/
public function loadModel($id)
{
$model = DocumentType::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}