本文整理汇总了PHP中BaseModel::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseModel::getAll方法的具体用法?PHP BaseModel::getAll怎么用?PHP BaseModel::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseModel
的用法示例。
在下文中一共展示了BaseModel::getAll方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
public function actionIndex()
{
$users = new Users('search');
$users->unsetAttributes();
$solicitors = new Solicitor('search');
$solicitors->unsetAttributes();
$donations = new Donation('search');
$donations->unsetAttributes();
$payments = new SolicitorCredit('search');
$payments->unsetAttributes();
$user = Users::model()->count();
$solicitor = Solicitor::model()->count();
$donation = BaseModel::getAll("Donation");
$t_donation = 0;
foreach($donation as $d){
$t_donation = $t_donation + $d->amount;
}
$debit = BaseModel::getAll("SolicitorCredit");
$t_debit = 0;
foreach ($debit as $d) {
$t_debit = $t_debit + $d->amount;
}
$this->render('index',array(
'users'=>$users,
'solicitors'=>$solicitors,
'donations'=>$donations,
'payments'=>$payments,
'user' => $user,
'solicitor' => $solicitor,
't_donation' => $t_donation,
't_debit' => $t_debit
));
}
示例2: actionManage
/**
* Manages all models.
*/
public function actionManage()
{
$users_lists = BaseModel::getAll('Users');
$users = array();
foreach($users_lists as $user){
$users[$user->id] = $user->first_name.' '.$user->last_name.'('.$user->username.')';
}
$os_list = Log::model()->getOs();
$os = array();
foreach($os_list as $o){
$os[$o['os']] = ucfirst($o['os']);
}
$browser_list = Log::model()->getBrowsers();
$browsers = array();
foreach($browser_list as $browser){
$browsers[$browser['browser']] = ucfirst($browser['browser']);
}
$model=new Log('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Log']))
$model->attributes=$_GET['Log'];
$this->render('admin',array(
'model'=>$model,
'users' => $users,
'browsers' => $browsers,
'os' => $os
));
}
示例3: actionLoadvisits
public function actionLoadvisits()
{
$solicitor = $_POST['solicitor'];
$visits = BaseModel::getAll("Visits", array("condition" => "solicitor_id = '{$solicitor}'"));
// pre($visits,true);
echo "<option value=''>Select Visit</option>";
foreach ($visits as $visit) {
echo CHtml::tag('option', array('value' => $visit->id), CHtml::encode($visit->visit_code), true);
}
}
示例4: actionManage
/**
* Manages all models.
*/
public function actionManage()
{
$model=new Visits('search');
$lists = BaseModel::getAll('Solicitor');
$solicitors = array();
foreach($lists as $list){
$solicitors[$list->id] = $list->first_name.' '.$list->last_name.'('.$list->solicitor_code.')';
}
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Visits']))
$model->attributes=$_GET['Visits'];
$this->render('admin',array(
'model'=>$model,
'solicitors' => $solicitors
));
}
示例5: actionUpdate
/**
* Updates a particular model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id the ID of the model to be updated
*/
public function actionUpdate($id) {
$model = $this->loadModel($id);
$users = CHtml::listData(BaseModel::getAll('Users', array("condition" => "is_admin = 0 ")), 'id', 'username');
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['UserCredit'])) {
$model->attributes = $_POST['UserCredit'];
if ($model->save()){
$trans = UserTrans::model()->find(array("condition" => "credit_id = '$model->id'"));
if($trans === null && $model->payment_status == 'a'){
$trans_model = new UserTrans;
$trans_model->tran_type = 'PAYMENT_RECEIVED';
$trans_model->user_id = $model->user_id;
$trans_model->credit = $model->amount;
$trans_model->credit_id = $model->id;
$trans_model->save();
} else {
$trans->credit = $model->amount;
$trans->save();
}
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('update', array(
'model' => $model,
'users' => $users
));
}
示例6: actionManage
/**
* Manages all models.
*/
public function actionManage()
{
$model = new UserCredit('search');
$model->unsetAttributes();
// clear any default values
$users_lists = BaseModel::getAll('Users');
$users = array();
foreach ($users_lists as $user) {
$users[$user->id] = $user->first_name . ' ' . $user->last_name . '(' . $user->username . ')';
}
if (isset($_GET['UserCredit'])) {
$model->attributes = $_GET['UserCredit'];
}
$this->render('admin', array('model' => $model, 'users' => $users));
}
示例7: countryList
function countryList()
{
return CHtml::listData(BaseModel::getAll('Country'), 'id', 'name');
}