本文整理汇总了PHP中People::model方法的典型用法代码示例。如果您正苦于以下问题:PHP People::model方法的具体用法?PHP People::model怎么用?PHP People::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类People
的用法示例。
在下文中一共展示了People::model方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionProfile
public function actionProfile()
{
$fams = Families::model()->findAll();
$ppl = People::model()->findAll();
$baptised = People::model()->getBaptised();
$confirmed = People::model()->getConfirmed();
$married = People::model()->getMarried();
$this->render('profile', array('families' => count($fams), 'members' => count($ppl), 'baptised' => count($baptised), 'confirmed' => count($confirmed), 'married' => count($married)));
}
示例2: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate($id)
{
$model = new MembershipCertificate();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['MembershipCertificate'])) {
$model->attributes = $_POST['MembershipCertificate'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
$rec = People::model()->findByPk($id);
$model->cert_dt = Yii::app()->dateFormatter->formatDateTime(time(), 'short', null);
$this->render('create', array('model' => $model, 'member' => $rec));
}
示例3: actionParishProfile
public function actionParishProfile()
{
$fams = Families::model()->findAll();
$ppl = People::model()->findAll();
$baptised1 = BaptismRecord::model()->findAll('baptism_dt > NOW() - INTERVAL 1 YEAR AND dob > NOW() - INTERVAL 1 YEAR');
$baptised7 = BaptismRecord::model()->findAll('baptism_dt > NOW() - INTERVAL 1 YEAR AND dob BETWEEN NOW() - INTERVAL 7 YEAR AND NOW() - INTERVAL 1 YEAR');
$baptised7p = BaptismRecord::model()->findAll('baptism_dt > NOW() - INTERVAL 1 YEAR AND dob < NOW() - INTERVAL 7 YEAR');
$baptised = BaptismRecord::model()->findAll();
$confirmed = ConfirmationRecord::model()->findAll('confirmation_dt > NOW() - INTERVAL 1 YEAR ');
$firstComm = FirstCommunionRecord::model()->findAll('communion_dt > NOW() - INTERVAL 1 YEAR ');
$married = MarriageRecord::model()->findAll('marriage_dt > NOW() - INTERVAL 1 YEAR');
$married_cath = MarriageRecord::model()->findAll('marriage_dt > NOW() - INTERVAL 1 YEAR AND marriage_type <= 2');
$married_nc = MarriageRecord::model()->findAll('marriage_dt > NOW() - INTERVAL 1 YEAR AND marriage_type > 2');
$schedule = MassSchedule::model()->findAll(array('order' => 'day, time'));
$pp = Pastors::model()->find('role = 1');
$apps = Pastors::model()->findAll('role != 1');
$this->render('parish-profile', array('families' => count($fams), 'members' => count($ppl), 'baptised' => count($baptised), 'baptised1' => count($baptised1), 'baptised7' => count($baptised7), 'baptised7p' => count($baptised7p), 'confirmed' => count($confirmed), 'firstComm' => count($firstComm), 'married' => count($married), 'married_nc' => count($married_nc), 'married_cath' => count($married_cath), 'pp' => $pp, 'apps' => $apps, 'schedule' => $schedule));
}
示例4: actionIndex
public function actionIndex()
{
$peoples = People::model()->findAll();
$this->render('index', array('peoples' => $peoples));
}
示例5: actionDependents
public function actionDependents($id)
{
$model = $this->loadModel($id);
if (isset($_POST['People']['dependent'])) {
for ($i = 0; $i < 10; ++$i) {
if (isset($_POST['People']['dependent'][$i])) {
if ($pid = $_POST['People']['dependent'][$i]['id']) {
$p = People::model()->findByPk($pid);
} else {
$p = new People();
}
$p->attributes = $_POST['People']['dependent'][$i];
$p->family_id = $model->id;
$p->role = 'dependent';
$p->save();
}
}
}
$ppl_ac = People::getAutoCompleteFields();
$this->render('dependents', array('model' => $model, 'ppl_ac' => $ppl_ac));
}
示例6: define
if ($wedding == 0) {
define('FAM_ID', $fam_id);
?>
<div class="form">
<?php
$form = $this->beginWidget('CActiveForm', array('id' => 'create-wedding'));
?>
<?php
echo $form->labelEx($model, 'wedding');
?>
<?php
echo $form->dropDownList($model, 'wedding', CHtml::listData(People::model()->findAll(), 'id', function ($data) {
$name = $data['f_name'] . ' ' . $data['l_name'];
$data['wedding'] > 0 ? $name .= ' (в браке)' : '';
$data['family_id'] == FAM_ID ? $name .= ' (в одной семье)' : ($name .= ' (разные семьи)');
return $name;
}), array('empty' => 'Выберите пару'));
?>
<?php
echo $form->error($model, 'wedding');
?>
<div class="clearfix"></div>
<div class="btn-group">
示例7: getAutoCompleteFields
public static function getAutoCompleteFields()
{
$people = People::model()->findAll();
$specialSkills = array();
$professions = array();
$occupations = array();
$churches = array();
$baptism_places = array();
$cemetery_churches = array();
foreach ($people as $p) {
if (!isset($specialSkills[$p->special_skill])) {
$specialSkills[$p->special_skill] = 1;
}
if (!isset($professions[$p->profession])) {
$professions[$p->profession] = 1;
}
if (!isset($occupations[$p->occupation])) {
$occupations[$p->occupation] = 1;
}
if (!isset($baptism_churches[$p->baptism_church])) {
$churches[$p->baptism_church] = 1;
}
if (!isset($baptism_places[$p->baptism_place])) {
$baptism_places[$p->baptism_place] = 1;
}
if (!isset($cemetery_churches[$p->cemetery_church])) {
$cemetery_churches[$p->cemetery_church] = 1;
}
}
$families = Families::model()->findAll();
foreach ($families as $fam) {
if (!isset($churches[$fam->marriage_church])) {
$churches[$fam->marriage_church] = 1;
}
}
return array('special_skills' => array_keys($specialSkills), 'professions' => array_keys($professions), 'occupations' => array_keys($occupations), 'churches' => array_keys($churches), 'baptism_places' => array_keys($baptism_places), 'cemetery_churches' => array_keys($cemetery_churches));
}
示例8: 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 People the loaded model
* @throws CHttpException
*/
public function loadModel($id)
{
$model = People::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例9: bride
public function bride()
{
$bp = $this->bride_parish;
if (ctype_digit($bp)) {
return People::model()->findByPk($bp);
} else {
return null;
}
}
示例10: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new BannsRecord();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['BannsRecord'])) {
$model->attributes = $_POST['BannsRecord'];
if ($model->save()) {
if (Yii::app()->getUser()->hasState('local')) {
Yii::app()->getUser()->setState('local', null);
}
$this->redirect(array('view', 'id' => $model->id));
}
} elseif (isset($_GET['local'])) {
$local = $_GET['local'];
if (!Yii::app()->getUser()->hasState('local')) {
Yii::trace('Setting session var local', 'application.controllers.BannsRecordsController');
Yii::app()->getUser()->setState('local', $local);
}
$sex = 'bride' == $local ? 2 : 1;
if (isset($_POST['member'])) {
$mid = $_POST['member'];
Yii::trace("Got member {$mid}", 'application.controllers.BannsRecordsController');
if ('both' == Yii::app()->getUser()->getState('local')) {
if ('both' == $local) {
Yii::app()->getUser()->setState('groom', $mid);
Yii::trace("local = {$local}. Going to redirect", 'application.controllers.BannsRecordsController');
$this->redirect(array('create', 'local' => 'bride'));
} else {
$gid = Yii::app()->getUser()->getState('groom');
$groom = People::model()->findByPk($gid);
$bride = People::model()->findByPk($mid);
$this->render('create', array('model' => $model, 'local' => 'both', 'groom' => $groom, 'bride' => $bride));
}
} else {
$member = People::model()->findByPk($mid);
$this->render('create', array('model' => $model, 'local' => $local, $local => $member));
}
} else {
$members = new CActiveDataProvider('People', array('criteria' => array('condition' => "sex = {$sex} and role != 'husband' and role != 'wife'")));
$this->render('create', array('model' => $model, 'members' => $members));
}
return;
} else {
Yii::app()->getUser()->setState('local', null);
}
$this->render('create', array('model' => $model));
}
示例11: getAutoCompleteFields
public static function getAutoCompleteFields()
{
$families = Families::model()->findAll();
$areas = array();
$pincodes = array();
foreach ($families as $fam) {
if (!isset($areas[$fam->addr_area])) {
$areas[$fam->addr_area] = 1;
}
if (!isset($pincodes[$fam->addr_pin])) {
$pincodes[$fam->addr_pin] = 1;
}
}
$people = People::model()->findAll();
$pincodekeys = array_keys($pincodes);
return array('areas' => array_keys($areas), 'pincodes' => array_map('strval', array_keys($pincodes)));
}