本文整理汇总了PHP中Unit::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Unit::model方法的具体用法?PHP Unit::model怎么用?PHP Unit::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Unit
的用法示例。
在下文中一共展示了Unit::model方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
/**
* Lists all models.
*/
public function actionIndex()
{
$unit_model = Unit::model();
$dataProvider = array();
foreach ($unit_model->findAll() as $value) {
$dataProvider[$value->id] = new CActiveDataProvider('Accounts', array('criteria' => array('condition' => "sid={$value->id}"), 'pagination' => array('pageSize' => 100)));
}
if (isset($_POST['yt0'])) {
if (isset($_POST['group'])) {
$_SESSION['data'] = $_POST['group'];
}
$_SESSION['title'] = $_POST['team_title'];
$table_model = Accounts::model();
$table_model->create_table();
// foreach ( $_REQUEST['group'] as $key => $g )
// {
// $criteria = new CDbCriteria;
// $criteria->addInCondition( 'id' , $g );
// $data[$key] = new CActiveDataProvider( 'Accounts' , array(
// 'criteria' => $criteria ,
// 'pagination' => false ,
// ) );
// }
// $this->layout = '//layouts/';
// $this->render( 'create_table' , array(
// 'title' => $_REQUEST['team_title'] ,
// 'data' => $data ,
// 'model' => $table_model ,
// ) );
Yii::app()->end();
}
$this->render('index', array('dataProvider' => $dataProvider, 'unit' => $unit_model));
}
示例2: actionIndex
/**
* Lists all models.
*/
public function actionIndex()
{
$unit_model = Unit::model();
$dataProvider[0] = new CActiveDataProvider('Accounts', array('pagination' => array('pageSize' => 30)));
foreach ($unit_model->findAll() as $value) {
$dataProvider[$value->id] = new CActiveDataProvider('Accounts', array('criteria' => array('condition' => "sid={$value->id}"), 'pagination' => array('pageSize' => 10)));
}
// print_r($dataProvider[0]->getData());exit;
$this->render('index', array('dataProvider' => $dataProvider));
}
示例3: getUsercount
public function getUsercount()
{
$unit_model = Unit::model();
$acc_model = Accounts::model();
$data = array();
foreach ($unit_model->findAll() as $value) {
$temp = $acc_model->findAll("sid=:sid", array(":sid" => $value->id));
$unit_tmp = $unit_model->find("id=:id", array(":id" => $value->id));
$data[] = array($unit_tmp->name, count($temp));
}
return $data;
}
示例4: 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 Unit the loaded model
* @throws CHttpException
*/
public function loadModel($id)
{
$model = Unit::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例5: array
<?php
$sid_option = Unit::model()->findAll();
?>
<div id="content-header">
<div id="breadcrumb">
<a href="index.php" class="tip-bottom"><i class="icon-home"></i>首页</a>
<a href="index.php?r=accounts" class="current"><i></i>成员列表</a>
<a href="#" class="current"><?php
echo $model->isNewRecord ? '添加新成员' : '修改 ' . $model->name;
?>
</a>
</div>
</div>
<div class="container-fluid">
<div class="widget-box">
<div class="widget-title">
<span class="icon">
<i class="icon-th"></i>
</span>
<h5><?php
echo $model->isNewRecord ? '添加新成员' : '修改 ' . $model->name;
?>
</h5>
</div>
<div class="widget-content nopadding">
<?php
$form = $this->beginWidget('CActiveForm', array('id' => 'accounts', 'enableAjaxValidation' => false, 'htmlOptions' => array('class' => "form-horizontal")));
?>
<div class="control-group">
示例6:
</div>
<div class="container-fluid">
<div class="widget-box">
<div class="widget-title">
<span class="icon">
<i class="icon-th"></i>
</span>
<h5>成员列表</h5>
<div id="options">
<a class="btn btn-success btn-mini" href="index.php?r=accounts/create">添加新成员</a>
</div>
</div>
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#tab0">所有成员</a></li>
<?php
$unit = Unit::model()->findAll();
?>
<?php
foreach ($unit as $b) {
?>
<li><a data-toggle="tab" href="#tab<?php
echo $b['id'];
?>
"><?php
echo $b['name'];
?>
</a></li>
<?php
}
?>
</ul>
示例7: array
<?php
if (!$model->isNewRecord) {
?>
<div class="control-group">
<a href="#" role="button" class="btn btn-attr">New Attribute </a>
<br/>
<div class="js-new-attr" style="display:none;">
<?php
echo CHtml::activeDropDownList($attribute, 'attribute_id', CHtml::listData(Attribute::model()->findAll(), 'id', 'attribute_name'), array('class' => 'attr-form', 'empty' => 'Select name'));
?>
<?php
echo $form->textField($attribute, 'value', array('class' => 'attr-form'));
?>
<?php
echo CHtml::activeDropDownList($attribute, 'unit_id', CHtml::listData(Unit::model()->findAll(), 'id', 'name'), array('class' => 'attr-form', 'empty' => 'Select unit'));
?>
<input type="submit" class="btn" name="submit_attr" value="Add"/>
</div>
<br/>
<?php
if ($model->fileAttributes) {
?>
<table class="table">
<thead>
<tr>
<th>Attribute Name</th>
<th>Value</th>
<th>Unit</th>
<th></th>
</tr>
示例8: array
'minLength' => '3',
),
'htmlOptions' => array(
'placeholder' => 'Attribute name',
'size' => 'auto',
'id'=>'js-sample-attr-attr-'.$ds->sample->id,
'style'=>'width:150px'
),
));
?>
</td>
<td>
<input id="js-sample-attr-value-<?=$ds->sample->id?>" type="text" placeholder="Attribute Value" style="width:150px">
</td>
<td>
<?= CHtml::dropDownList('sampleAttr-unit', null, CHtml::listData(Unit::model()->findAll(array('order'=>'name asc')), 'id', 'name'),array('empty'=>'','id'=>'js-sample-attr-unit-'.$ds->sample->id,'style'=>'width:70px')); ?>
</td>
<td>
<a sample-id="<?=$ds->sample->id?>" class="btn js-add-sample-attr"/>Add</a>
</td>
</tr>
</tr>
<? } ?>
<? } else { ?>
<tr>
<td colspan="4">
<span class="empty">No results found.</span>
</td>
</tr>
<? } ?>
<tr>