本文整理汇总了PHP中People类的典型用法代码示例。如果您正苦于以下问题:PHP People类的具体用法?PHP People怎么用?PHP People使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了People类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionView
public function actionView($id)
{
$model = new People();
$people = $model->findByPk($id);
$data = Yii::app()->db->createCommand()->select('*')->from('People')->where('family_id=:id', array('id' => (int) $people['family_id']))->order('lvl ASC')->queryAll();
$this->render('view', array('peoples' => $data));
}
示例2: testDelete
public function testDelete()
{
$this->_mock = new Mock_Database($this, array(array('many', "SELECT *\nFROM people\nWHERE `id` IN (?, ?)", array(1, 2), null, array('return' => array(array('id' => '1', 'passport_id' => 3), array('id' => '2', 'passport_id' => 4)))), array('execute', "DELETE FROM people\nWHERE `id` IN (?, ?)", array(1, 2)), array('many', "SELECT *\nFROM passports\nWHERE `id` IN (?, ?)", array(3, 4), null, array('return' => array(array('id' => '3'), array('id' => '4')))), array('execute', "DELETE FROM passports\nWHERE `id` IN (?, ?)", array(3, 4))), array('debug' => false));
\Snowfire\Database\Model::database($this->_mock);
$people_model = new People();
$passports_model = new Passports();
$people_model->delete(array('id' => array(1, 2)), array('passports' => $passports_model));
}
示例3: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
$name = $request->input("name");
$age = $request->input("age");
$people = new People();
$people->name = $name;
$people->age = $age;
$people->save();
return "name={{$name}}, age={{$age}}";
}
示例4: registerAction
public function registerAction()
{
echo "RegStart";
$user = new People();
//Store and check for errors
$success = $user->save($this->request->getPost(), array('name', 'email'));
if ($success) {
echo "Thanks for registering!";
} else {
echo "Sorry, the following problems were generated: ";
foreach ($user->getMessages() as $message) {
echo $message->getMessage(), "<br/>";
}
}
$this->view->disable();
}
示例5: actionBirthdays
public function actionBirthdays()
{
$model = new People();
if (isset($_POST['period'])) {
header("Content-Type: application/vnd.ms-excel; charset=utf-8");
header("Content-Disposition: inline; filename=\"birthdays-report.xls\"");
$dt = $_POST['People']['dob'];
$dt = date('Y-m-d', CDateTimeParser::parse($dt, Yii::app()->locale->getDateFormat('short')));
$period = $_POST['period'];
$nxt_bday = "MAKEDATE(YEAR('{$dt}')+IF(DAYOFYEAR(t.dob)<DAYOFYEAR('{$dt}'),1,0),DAYOFYEAR(t.dob))";
$cond = "{$nxt_bday} BETWEEN '{$dt}' AND '{$dt}' + INTERVAL 1 {$period} ORDER BY {$nxt_bday}";
Yii::trace("R.birthdays dt={$dt}, period={$period}, cond={$cond}", 'application.controllers.ReportController');
$crit = new CDbCriteria();
$crit->addCondition($cond);
$dataProvider = new CActiveDataProvider('People', array('criteria' => $crit));
$dataProvider->pagination = false;
$fields = array('id', 'fname', 'lname', 'dob', 'mobile');
$labels = $model->attributeLabels();
$fval = array();
foreach ($fields as $field) {
array_push($fval, $labels[$field]);
}
echo implode("\t", $fval) . "\n";
foreach ($dataProvider->data as $data) {
$fval = array();
foreach ($fields as $field) {
array_push($fval, $data->{$field});
}
echo implode("\t", $fval) . "\n";
}
Yii::app()->end();
return;
}
$this->render('birthdays', array('model' => $model));
}
示例6: getInstance
/**
* Singleton Pattern
*
* Auto Create Object Instance.
*
*/
public static function getInstance()
{
if (null === self::$_objInstance) {
self::$_objInstance = new People();
}
return self::$_objInstance;
}
示例7: configure
public function configure()
{
$this->useFields(array('is_physical', 'family_name', 'activity_date_to', 'activity_date_from'));
$this->addPagerItems();
$this->widgetSchema['family_name'] = new sfWidgetFormInput();
$this->widgetSchema['is_physical'] = new sfWidgetFormInputHidden();
$this->setDefault('is_physical', true);
$yearsKeyVal = range(intval(sfConfig::get('dw_yearRangeMin')), intval(sfConfig::get('dw_yearRangeMax')));
$minDate = new FuzzyDateTime(strval(min($yearsKeyVal) . '/01/01'));
$maxDate = new FuzzyDateTime(strval(max($yearsKeyVal) . '/12/31'));
$dateLowerBound = new FuzzyDateTime(sfConfig::get('dw_dateLowerBound'));
$dateUpperBound = new FuzzyDateTime(sfConfig::get('dw_dateUpperBound'));
$maxDate->setStart(false);
$this->widgetSchema['activity_date_from'] = new widgetFormJQueryFuzzyDate($this->getDateItemOptions(), array('class' => 'from_date'));
$this->widgetSchema['activity_date_to'] = new widgetFormJQueryFuzzyDate($this->getDateItemOptions(), array('class' => 'to_date'));
$this->validatorSchema['activity_date_from'] = new fuzzyDateValidator(array('required' => false, 'from_date' => true, 'min' => $minDate, 'max' => $maxDate, 'empty_value' => $dateLowerBound), array('invalid' => 'Date provided is not valid'));
$this->validatorSchema['activity_date_to'] = new fuzzyDateValidator(array('required' => false, 'from_date' => false, 'min' => $minDate, 'max' => $maxDate, 'empty_value' => $dateUpperBound), array('invalid' => 'Date provided is not valid'));
$people_types = array('' => '');
$types = People::getTypes();
foreach ($types as $flag => $name) {
$people_types[strval($flag)] = $name;
}
$this->widgetSchema['people_type'] = new sfWidgetFormChoice(array('choices' => $people_types));
$this->widgetSchema['people_type']->setLabel('Role');
$this->validatorSchema['people_type'] = new sfValidatorChoice(array('required' => false, 'choices' => array_keys($people_types)));
$this->validatorSchema->setPostValidator(new sfValidatorSchemaCompare('activity_date_from', '<=', 'activity_date_to', array('throw_global_error' => true), array('invalid' => 'The to date cannot be above the "end" date.')));
}
示例8: 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)));
}
示例9: shouldBeAbleToUseLimitQuery
/**
* @test
*/
public function shouldBeAbleToUseLimitQuery()
{
// given
LudoDB::enableSqlLogging();
$this->createPeople();
$people = new People(4330);
$values = $people->getValues(0, 10);
// then
$this->assertEquals(10, count($values));
}
示例10: __construct
/** The constructor
* @access public
* @param array $options
* @return void
*/
public function __construct(array $options = null)
{
$curators = new People();
$assigned = $curators->getValuers();
ZendX_JQuery::enableForm($this);
parent::__construct($options);
$this->setName('provisionalvaluations');
$valuerID = new Zend_Form_Element_Select('valuerID');
$valuerID->setLabel('Valuation provided by: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('StringLength', false, array(1, 25))->addValidator('InArray', false, array(array_keys($assigned)))->addMultiOptions($assigned);
$value = new Zend_Form_Element_Text('value');
$value->setLabel('Estimated market value: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Float');
$comments = new Pas_Form_Element_CKEditor('comments');
$comments->setLabel('Valuation comments: ')->setRequired(false)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars'));
$dateOfValuation = new ZendX_JQuery_Form_Element_DatePicker('dateOfValuation');
$dateOfValuation->setLabel('Valuation provided on: ')->setRequired(true)->setJQueryParam('dateFormat', 'yy-mm-dd')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 20);
$submit = new Zend_Form_Element_Submit('submit');
$this->addElements(array($valuerID, $value, $dateOfValuation, $comments, $submit));
$this->addDisplayGroup(array('valuerID', 'value', 'dateOfValuation', 'comments'), 'details');
$this->addDisplayGroup(array('submit'), 'buttons');
parent::init();
}
示例11: 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));
}
示例12: actionTogglePeople
/**
* 设置、取消用户的实验室成员身份
* @param unknown $id
*/
public function actionTogglePeople($id)
{
$user = $this->loadModel($id);
$people = $user->people;
if ($people) {
if ($people->delete()) {
Yii::app()->user->setFlash('success', '已将用户移除实验室成员!');
}
} else {
$people = new People();
$people->name = $user->name;
$people->userId = $user->id;
$people->email = $user->email;
if ($people->save()) {
Yii::app()->user->setFlash('success', '已将用户设为实验室成员!');
}
}
$this->redirect(array('admin'));
}
示例13: actionWedding
public function actionWedding($id)
{
$model = new People();
$people = $model->findByPk($id);
if (isset($_POST['People'])) {
if (isset($_POST['People']['wedding']) && $_POST['People']['wedding'] == null) {
$model->wedding = 0;
} else {
$model->wedding = $_POST['People']['wedding'];
}
if ($id != $model->wedding) {
$model->isCanWedding($people['family_id']) && $model->wedding($id, $model->wedding, $people['family_id'], $people['lvl']) && $this->redirect(Yii::app()->createUrl('people'));
} else {
$model->addPeopleError('Человек не может быть сам себе парой');
}
}
$people['wedding'] > 0 && $model->addPeopleError('У этого человека уже есть пара');
$this->render('wedding', array('model' => $model, 'wedding' => $people['wedding'], 'fam_id' => $people['family_id']));
}
示例14: upgrade
//.........这里部分代码省略.........
if ($version == "3.0") {
// First apply the schema updates needed.
$results[] = applyupdate("db-3.0-to-3.1.sql");
// Rebuild the config table just in case.
$config->rebuild();
$version = "3.1";
}
if ($version == "3.1") {
// First apply the schema updates needed.
$results[] = applyupdate("db-3.1-to-3.2.sql");
// Rebuild the config table just in case.
$config->rebuild();
$version = "3.2";
}
if ($version == "3.2") {
// First apply the schema updates needed.
$results[] = applyupdate("db-3.2-to-3.3.sql");
// Rebuild the config table just in case.
$config->rebuild();
$version = "3.3";
}
if ($version == "3.3") {
// First apply the schema updates needed.
$results[] = applyupdate("db-3.3-to-4.0.sql");
// Rebuild the config table just in case.
$config->rebuild();
// We added in some new config items and one of them is referenced in misc.
// Reload the config;
$config->Config();
// We have several things to convert this time around.
// Bring up the rest of the classes
require_once "facilities.inc.php";
// People conversion
$p = new People();
$c = new Contact();
$u = new User();
$plist = $p->GetUserList();
// Check if we have an empty fac_People table then merge if that's the case
if (sizeof($plist) == 0) {
$clist = $c->GetContactList();
foreach ($clist as $tmpc) {
foreach ($tmpc as $prop => $val) {
$p->{$prop} = $val;
}
// we're keeping the Contact ID so assign it to the PersonID
$p->PersonID = $tmpc->ContactID;
$u->UserID = $p->UserID;
$u->GetUserRights();
foreach ($u as $prop => $val) {
$p->{$prop} = $val;
}
// This shouldn't be necessary but...
$p->MakeSafe();
$sql = "INSERT INTO fac_People SET PersonID={$p->PersonID}, UserID=\"{$p->UserID}\", \n\t\t\t\t\tAdminOwnDevices={$p->AdminOwnDevices}, ReadAccess={$p->ReadAccess}, \n\t\t\t\t\tWriteAccess={$p->WriteAccess}, DeleteAccess={$p->DeleteAccess}, \n\t\t\t\t\tContactAdmin={$p->ContactAdmin}, RackRequest={$p->RackRequest}, \n\t\t\t\t\tRackAdmin={$p->RackAdmin}, SiteAdmin={$p->SiteAdmin}, Disabled={$p->Disabled}, \n\t\t\t\t\tLastName=\"{$p->LastName}\", FirstName=\"{$p->FirstName}\", \n\t\t\t\t\tPhone1=\"{$p->Phone1}\", Phone2=\"{$p->Phone2}\", Phone3=\"{$p->Phone3}\", \n\t\t\t\t\tEmail=\"{$p->Email}\";";
$dbh->query($sql);
}
$ulist = $u->GetUserList();
foreach ($ulist as $tmpu) {
/* This time around we have to see if the User is already in the fac_People table */
$p->UserID = $tmpu->UserID;
if (!$p->GetPersonByUserID()) {
foreach ($tmpu as $prop => $val) {
$p->{$prop} = $val;
}
// Names have changed formats between the user table and the people table
$p->LastName = $tmpu->Name;
示例15: mysqli_connect
<?php
require 'model/model.php';
require 'dbConnection.php';
$conn = mysqli_connect(SERVER_ADDRESS, USER_NAME, PASSWORD, DATABASE);
$id = $match[1];
$token = $match[2];
$verification = People::verifyEmail($id, $token, $conn);
mysqli_close($conn);
// header('Content-type: application/json');
// echo json_encode($verification);
include 'controller/Verify.html';