本文整理汇总了PHP中Family类的典型用法代码示例。如果您正苦于以下问题:PHP Family类的具体用法?PHP Family怎么用?PHP Family使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Family类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testExportInsideValidateMethod_ComposedClass
public function testExportInsideValidateMethod_ComposedClass()
{
$f = new Family();
$f->setFather(new Person("Pa", 46));
$f->setMother(new Person("Ma", 40));
$out = $this->familyValidator->validate($f);
$this->assertEquals("Pa-Ma", $out);
}
示例2: actionCreate
public function actionCreate()
{
$model = new Family();
if (isset($_POST['Family'])) {
$model->attributes = $_POST['Family'];
$model->validate($model) && $model->save() && $this->redirect(Yii::app()->createUrl('family'));
}
$this->render('create', array('model' => $model));
}
示例3: setUp
public function setUp()
{
$this->person = new Person("fabs", 35);
$this->localizedPerson = new LocalizedPerson("fabs", 35, "Rue De La Roquette");
$this->noGetEntity = new NoGetters("laurent");
$family = new Family();
$family->setFather(new Person("Pa", 50));
$family->setMother(new Person("Ma", 48));
$this->family = $family;
}
示例4: run
function run()
{
$fp = fopen('php://output', 'w');
header('Content-type: application/force-download');
header("Content-Type: application/download");
header('Content-type: text/csv');
header('Content-Disposition: attachment; filename="jethro_' . date('Y-m-d_h:i') . '.csv"');
$GLOBALS['system']->includeDBClass('family');
$GLOBALS['system']->includeDBClass('person');
switch (array_get($_REQUEST, 'merge_type')) {
case 'family':
$merge_data = Family::getFamilyDataByMemberIDs($_POST['personid']);
$dummy = new Family();
$dummy_family = NULL;
break;
case 'person':
default:
$merge_data = $GLOBALS['system']->getDBObjectData('person', array('id' => (array) $_POST['personid']));
$dummy = new Person();
$dummy_family = new Family();
break;
}
$headerrow = array('ID');
foreach (array_keys(reset($merge_data)) as $header) {
if ($header == 'familyid') {
continue;
}
$headerrow[] = strtoupper($dummy->getFieldLabel($header));
}
fputcsv($fp, $headerrow);
foreach ($merge_data as $id => $row) {
@$dummy->populate($id, $row);
$outputrow = array($id);
foreach ($row as $k => $v) {
if ($k == 'history') {
continue;
}
if ($k == 'familyid') {
continue;
}
if ($dummy->hasField($k)) {
$outputrow[] = $dummy->getFormattedValue($k, $v);
// pass value to work around read-only fields
} else {
if ($dummy_family && $dummy_family->hasField($k)) {
$outputrow[] = $dummy_family->getFormattedValue($k, $v);
} else {
$outputrow[] = $v;
}
}
}
fputcsv($fp, $outputrow);
}
fclose($fp);
}
示例5: __construct
/**
* This is construct base of the class.
*
* A public constructor; initializes the variable $instanceDataBase.
*
*/
public function __construct($instanceDataBase)
{
parent::__construct($instanceDataBase);
Family::setDataOperationBusiness($instanceDataBase);
Family::getBusiness();
Family::getDescriptionBusiness();
}
示例6: Results
public function Results()
{
$list = Family::get()->leftJoin('House', '"Family"."ID" = "House"."FamilyID"');
$status = Convert::raw2sql($this->request->getVar('Status'));
$holdsRationCard = Convert::raw2sql($this->request->getVar('HoldsRationCard'));
$cardType = Convert::raw2sql($this->request->getVar('CardType'));
$houseType = Convert::raw2sql($this->request->getVar('Type'));
$parishID = Convert::raw2sql($this->request->getVar('ParishID'));
if ($parishID) {
$list = $list->filter(array('ParishID' => $parishID));
}
if ($status) {
$list = $list->filter(array('House.Status' => $status));
}
if ($holdsRationCard != '') {
$list = $list->filter(array('House.HoldsRationCard' => $holdsRationCard));
}
if ($holdsRationCard && $cardType) {
$list = $list->filter(array('House.CardType' => $cardType));
}
if ($houseType) {
$list = $list->filter(array('House.Type' => $houseType));
}
//$list = $list->leftJoin('Contact', "\"Contact\".\"FamilyID\" = \"Family\".\"ID\"");
//Debug::show($list);
return $list;
}
示例7: readPageXml
function readPageXml($title)
{
$page = null;
$xml = null;
$titleString = $title->getText();
if ($title->getNamespace() == NS_PERSON) {
$page = new Person($titleString);
} else {
$page = new Family($titleString);
}
if ($page) {
$page->loadPage();
$xml = $page->getPageXml();
}
return $xml;
}
示例8: Results
public function Results()
{
$list = Family::get();
$blockNo = Convert::raw2sql($this->request->getVar('BlockNo'));
$unitNo = Convert::raw2sql($this->request->getVar('UnitNo'));
$parishID = Convert::raw2sql($this->request->getVar('ParishID'));
$pincode = Convert::raw2sql($this->request->getVar('Pincode'));
$isPanchayat = Convert::raw2sql($this->request->getVar('IsPanchayat'));
$isMunicipality = Convert::raw2sql($this->request->getVar('IsMunicipality'));
$isCorporation = Convert::raw2sql($this->request->getVar('IsCorporation'));
if ($parishID) {
$list = $list->filter(array('ParishID' => $parishID));
}
if ($blockNo) {
$list = $list->filter(array('BlockNo' => $blockNo));
}
if ($unitNo) {
$list = $list->filter(array('UnitNo' => $unitNo));
}
if ($pincode) {
$list = $list->filter(array('Pincode' => $pincode));
}
if ($isPanchayat) {
$list = $list->filter(array('IsPanchayat' => $isPanchayat));
}
if ($isMunicipality) {
$list = $list->filter(array('IsMunicipality' => $isMunicipality));
}
if ($isCorporation) {
$list = $list->filter(array('IsCorporation' => $isCorporation));
}
//$list = $list->leftJoin('Contact', "\"Contact\".\"FamilyID\" = \"Family\".\"ID\"");
//Debug::show($list);
return $list;
}
示例9: _getFields
function _getFields()
{
$memberFields = array('first_name', 'last_name', 'gender', 'age_bracket', 'congregationid', 'email', 'mobile_tel', 'work_tel', 'familyid', 'family_name', 'address_street', 'address_suburb', 'address_state', 'address_postcode', 'home_tel');
$p = new Person();
foreach ($p->_getFields() as $k => $v) {
if (in_array($k, $memberFields)) {
$res[$k] = $v;
}
}
$f = new Family();
foreach ($f->_getFields() as $k => $v) {
if (in_array($k, $memberFields)) {
$res[$k] = $v;
}
}
return $res;
}
示例10: ConvertSEO
public static function ConvertSEO()
{
$arrFamilies = Family::model()->findAll();
foreach ($arrFamilies as $objFamily) {
$objFamily->request_url = _xls_seo_url($objFamily->family);
$objFamily->save();
}
}
示例11: loadModel
private function loadModel($id)
{
$model = Family::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例12: actionCreate
/**
* 录入
*
*/
public function actionCreate()
{
parent::_acl();
$model = new Family();
$imageList = $this->_gets->getPost('imageList');
$imageListSerialize = XUtils::imageListSerialize($imageList);
if (isset($_POST['Family'])) {
$acl = $this->_gets->getPost('acl');
$model->attributes = $_POST['Family'];
$model->actual_people = 0;
$model->pic_other = $imageListSerialize['dataSerialize'];
if ($model->save()) {
AdminLogger::_create(array('catalog' => 'create', 'intro' => '录入内容,ID:' . $model->id));
$this->redirect(array('index'));
}
}
$this->render('family_create', array('model' => $model, 'imageList' => $imageListSerialize['data']));
}
示例13: findFamily
public static function findFamily($user)
{
$families = \Family::all(["user_id = ?" => $user->id], ["member_id", "relation"]);
$fs = array();
foreach ($families as $f) {
$u = \User::first(["id = ?" => $f->member_id], ["name"]);
$fs[(int) $f->member_id] = ArrayMethods::toObject(["name" => $u->name, "user_id" => $f->member_id, "relation" => $f->relation]);
}
return $fs;
}
示例14: getRecipients
private function getRecipients()
{
$recips = $archived = $blanks = array();
if (!empty($_REQUEST['queryid'])) {
$query = $GLOBALS['system']->getDBObject('person_query', (int) $_REQUEST['queryid']);
$personids = $query->getResultPersonIDs();
$recips = $GLOBALS['system']->getDBObjectData('person', array('(id' => $personids, '!mobile_tel' => '', '!status' => 'archived'), 'AND');
$blanks = $GLOBALS['system']->getDBObjectData('person', array('(id' => $personids, 'mobile_tel' => '', '!status' => 'archived'), 'AND');
$archived = $GLOBALS['system']->getDBObjectData('person', array('(id' => $personids, 'status' => 'archived'), 'AND');
} else {
if (!empty($_REQUEST['groupid'])) {
$group = $GLOBALS['system']->getDBObject('person_group', (int) $_REQUEST['groupid']);
$personids = array_keys($group->getMembers());
$recips = $GLOBALS['system']->getDBObjectData('person', array('(id' => $personids, '!mobile_tel' => '', '!status' => 'archived'), 'AND');
$blanks = $GLOBALS['system']->getDBObjectData('person', array('(id' => $personids, 'mobile_tel' => '', '!status' => 'archived'), 'AND');
$archived = $GLOBALS['system']->getDBObjectData('person', array('(id' => $personids, 'status' => 'archived'), 'AND');
} else {
if (!empty($_REQUEST['roster_view'])) {
$view = $GLOBALS['system']->getDBObject('roster_view', (int) $_REQUEST['roster_view']);
$recips = $view->getAssignees($_REQUEST['start_date'], $_REQUEST['end_date']);
foreach ($recips as $i => $details) {
if ($details['status'] == 'archived') {
$archived[$i] = $details;
unset($recips[$i]);
} else {
if (empty($details['mobile_tel'])) {
$blanks[$i] = $details;
unset($recips[$i]);
}
}
}
} else {
switch (array_get($_REQUEST, 'sms_type')) {
case 'family':
$GLOBALS['system']->includeDBClass('family');
$families = Family::getFamilyDataByMemberIDs($_POST['personid']);
$recips = $GLOBALS['system']->getDBObjectData('person', array('age_bracket' => '0', '(familyid' => array_keys($families), '!mobile_tel' => '', '!status' => 'archived'), 'AND');
$blanks = $GLOBALS['system']->getDBObjectData('person', array('age_bracket' => '0', '(familyid' => array_keys($families), 'mobile_tel' => '', '!status' => 'archived'), 'AND');
$archived = $GLOBALS['system']->getDBObjectData('person', array('age_bracket' => '0', '(familyid' => array_keys($families), 'status' => 'archived'), 'AND');
break;
case 'person':
default:
if (!empty($_POST['personid'])) {
$recips = $GLOBALS['system']->getDBObjectData('person', array('id' => $_POST['personid'], '!mobile_tel' => '', '!status' => 'archived'), 'AND');
$blanks = $GLOBALS['system']->getDBObjectData('person', array('id' => $_POST['personid'], 'mobile_tel' => '', '!status' => 'archived'), 'AND');
$archived = $GLOBALS['system']->getDBObjectData('person', array('id' => $_POST['personid'], 'status' => 'archived'), 'AND');
$GLOBALS['system']->includeDBClass('person');
}
break;
}
}
}
}
return array($recips, $blanks, $archived);
}
示例15: run
function run()
{
// Ref: http://en.wikipedia.org/wiki/VCard
header('Content-type: text/vcf');
header('Content-Disposition: attachment; filename="contacts_' . date('Y-m-d_h:i') . '.vcf"');
$GLOBALS['system']->includeDBClass('person');
$GLOBALS['system']->includeDBClass('family');
$merge_data = $GLOBALS['system']->getDBObjectData('person', array('id' => $_REQUEST['personid']));
$dummy = new Person();
$family = new Family();
foreach ($merge_data as $id => $row) {
$dummy->populate($id, $row);
$family->setvalue('home_tel', $row['home_tel']);
echo "BEGIN:VCARD\n";
echo "VERSION:3.0\n";
echo "N:" . $row['last_name'] . ";" . $row['first_name'] . ";;;\n";
echo "FN:" . $row['first_name'] . " " . $row['last_name'] . "\n";
echo "EMAIL;type=INTERNET;type=HOME:" . $row['email'] . "\n";
echo "ADR;type=HOME:;;" . $row['address_street'] . ";" . $row['address_suburb'] . ";" . $row['address_state'] . ";" . $row['address_postcode'] . ";\n";
echo "TEL;type=HOME:" . $family->getFormattedValue('home_tel') . "\n";
echo "TEL;type=WORK:" . $dummy->getFormattedValue('work_tel') . "\n";
echo "TEL;type=MOBILE:" . $dummy->getFormattedValue('mobile_tel') . "\n";
echo "TEL;type=CELL:" . $dummy->getFormattedValue('mobile_tel') . "\n";
if ($g = $dummy->getValue('Gender')) {
echo "GENDER:" . strtoupper($g[0]) . "\n";
}
echo "CATEGORIES:" . $row['congregation'] . "\n";
echo "ORG:" . $dummy->getFormattedValue('congregationid') . "\n";
echo "NOTES:" . $dummy->getFormattedValue('congregationid') . "\n";
echo "ROLE:" . $dummy->getFormattedValue('status') . "\n";
echo "TITLE:" . $dummy->getFormattedValue('status') . "\n";
echo "SOURCE:" . build_url(array('personid' => array($id))) . "\n";
// where to get vcard from
echo "URL:" . build_url(array('call' => NULL, 'view' => 'persons', 'personid' => $id)) . "\n";
// definitive location for full details
echo "UID:" . build_url(array('call' => NULL, 'view' => 'persons', 'personid' => $id)) . "\n";
echo "END:VCARD\n\n";
}
}