本文整理汇总了PHP中Person::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Person::load方法的具体用法?PHP Person::load怎么用?PHP Person::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Person
的用法示例。
在下文中一共展示了Person::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: score_entry_display
function score_entry_display()
{
global $dbh;
$sth = $dbh->prepare('SELECT * FROM score_entry WHERE team_id = ? AND game_id = ?');
$sth->execute(array($this->game->home_team, $this->game->game_id));
$home = $sth->fetch();
if (!$home) {
$home = array('score_for' => 'not entered', 'score_against' => 'not entered', 'defaulted' => 'no');
} else {
$entry_person = Person::load(array('user_id' => $home['entered_by']));
$home['entered_by'] = l($entry_person->fullname, "person/view/{$entry_person->user_id}");
}
$sth->execute(array($this->game->away_team, $this->game->game_id));
$away = $sth->fetch();
if (!$away) {
$away = array('score_for' => 'not entered', 'score_against' => 'not entered', 'defaulted' => 'no');
} else {
$entry_person = Person::load(array('user_id' => $away['entered_by']));
$away['entered_by'] = l($entry_person->fullname, "person/view/{$entry_person->user_id}");
}
$header = array(" ", $this->game->home_name . ' (home)', $this->game->away_name . ' (away)');
$rows = array();
$rows[] = array("Home Score:", $home['score_for'], $away['score_against']);
$rows[] = array("Away Score:", $home['score_against'], $away['score_for']);
$rows[] = array("Defaulted?", $home['defaulted'], $away['defaulted']);
$rows[] = array("Entered By:", $home['entered_by'], $away['entered_by']);
$rows[] = array("Entry time:", $home['entry_time'], $away['entry_time']);
return '<div class="listtable">' . table($header, $rows) . "</div>";
}
示例2: _new
public function _new()
{
parent::_new();
$this->setTemplateName('calls_new');
$projects = $opportunities = $activities = null;
if (isset($this->_data['person_id'])) {
$person = new Person();
$person->load($this->_data['person_id']);
$this->_data['company_id'] = $person->company_id;
$projects = $person->projects;
$opportunities = $person->opportunities;
$activities = $person->activities;
$this->view->set('person', $person->fullname);
}
if (isset($this->_data['company_id'])) {
$company = new Company();
$company->load($this->_data['company_id']);
$projects = DataObjectCollection::Merge($company->projects, $projects);
$opportunities = DataObjectCollection::Merge($company->opportunities, $opportunities);
$activities = DataObjectCollection::Merge($company->activities, $activities);
$this->view->set('company', $company->name);
}
if (isset($this->_data['project_id'])) {
$project = new Project();
$project->load($this->_data['project_id']);
$this->_data['company_id'] = $project->company_id;
}
$this->view->set('projects', $projects);
$this->view->set('opportunities', $opportunities);
$this->view->set('activities', $activities);
}
示例3: load
function load()
{
global $dbh;
$returnValue = false;
if (parent::load()) {
$query = '
SELECT
`IDNumber`
, `KRAPIN`
, `dateOfEmployment`
FROM
`employeeDetails`
WHERE
`uniqueID` = "' . mysql_escape_string($this->getUniqueID()) . '"
';
try {
$statement = $dbh->prepare($query);
$statement->execute();
$row = $statement->fetch();
$this->setIDNumber(mysql_escape_string($row["IDNumber"]));
$this->setKRAPIN(mysql_escape_string($row["KRAPIN"]));
$this->setDateOfEmployment(mysql_escape_string($row["dateOfEmployment"]));
$returnValue = true;
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die;
}
$returnValue = true;
}
return $returnValue;
}
示例4: GetRecipients
public static function GetRecipients($ticket)
{
$recipients = array();
if ($ticket->originator_person_id != null) {
// If this ticket has a person, attempt to send mail to them
$person = new Person();
$person->load($ticket->originator_person_id);
$contact = $person->email->contactmethod;
if (!empty($contact)) {
$recipients[] = $contact;
} else {
// If no contact found then reiterate but for company contacts this time
if ($ticket->originator_company_id != null) {
$contact = $ticket->getCompanyEmail($ticket->originator_company_id);
if (!empty($contact)) {
$recipients[] = $contact;
}
}
}
}
// Last ditch effort.
if (count($recipients) == 0) {
if (!is_null($ticket->originator_email_address)) {
$recipients[] = $ticket->originator_email_address;
}
}
return $recipients;
}
示例5: user
function user()
{
if (!$this->user_id) {
return null;
}
return Person::load(array('user_id' => $this->user_id));
}
示例6: perform
function perform($edit = array())
{
$fields = array();
if (validate_nonblank($edit['username'])) {
$fields['username'] = $edit['username'];
}
if (validate_nonblank($edit['email'])) {
$fields['email'] = $edit['email'];
}
if (count($fields) < 1) {
error_exit("You must supply at least one of username or email address");
}
/* Now, try and find the user */
$user = Person::load($fields);
/* Now, we either have one or zero users. Regardless, we'll present
* the user with the same output; that prevents them from using this
* to guess valid usernames.
*/
if ($user) {
/* Generate a password */
$pass = generate_password();
$user->set_password($pass);
if (!$user->save()) {
error_exit("Error setting password");
}
/* And fire off an email */
$rc = send_mail($user, false, false, _person_mail_text('password_reset_subject', array('%site' => variable_get('app_name', 'Leaguerunner'))), _person_mail_text('password_reset_body', array('%fullname' => "{$user->firstname} {$user->lastname}", '%username' => $user->username, '%password' => $pass, '%site' => variable_get('app_name', 'Leaguerunner'))));
if ($rc == false) {
error_exit("System was unable to send email to that user. Please contact system administrator.");
}
}
}
示例7: systemCompany
public function systemCompany(&$do, &$errors)
{
$user = getCurrentUser();
$person = new Person();
$person->load($user->person_id);
$format = new xmlrpcmsg('elgg.user.newCommunity', array(new xmlrpcval($person->firstname . ' ' . $person->surname, "string"), new xmlrpcval($person->email, "string"), new xmlrpcval($do->company, "string")));
$client = new xmlrpc_client("_rpc/RPC2.php", "tech2.severndelta.co.uk", 8091);
$request = $client->send($format);
if (!$request->faultCode()) {
$response = $request->value();
if ($response->structmemexists('owner') && $response->structmemexists('community')) {
$person->published_username = $response->structmem('owner')->scalarval();
$person->save();
$do->published = true;
$do->published_username = $response->structmem('community')->scalarval();
$do->published_owner_id = $person->id;
$do->save();
} else {
$errors[] = 'Failed to publish company';
}
} else {
$errors[] = "Code: " . $request->faultCode() . " Reason '" . $request->faultString();
return false;
}
return true;
}
示例8: viewperson
public function viewperson()
{
$view = new Newsletterview();
$view->load($this->_data['id']) or sendBack();
$person = new Person();
$person->load($view->person_id);
sendTo('persons', 'view', 'contacts', array('id' => $person->id));
}
示例9: __construct
function __construct($id, $player_id = null)
{
parent::__construct($id);
if ($player_id) {
$this->player = Person::load(array('user_id' => $player_id));
}
$this->template_name = 'pages/team/roster.tpl';
}
示例10: __construct
function __construct($id)
{
$this->person = Person::load(array('user_id' => $id));
if (!$this->person) {
error_exit("That user does not exist");
}
person_add_to_menu($this->person);
}
示例11: __construct
function __construct($id)
{
global $lr_session;
if ($id) {
$this->person = Person::load(array('user_id' => $id));
}
if (!$this->person) {
$this->person =& $lr_session->user;
}
}
示例12: __construct
function __construct($event_id, $registrant_id = null)
{
global $lr_session;
if ($lr_session->is_admin() && !is_null($registrant_id)) {
$this->registrant_id = $registrant_id;
if ($this->registrant_id != 'choose') {
$this->registrant = Person::load(array('user_id' => $registrant_id));
}
} else {
$this->registrant_id = $lr_session->user->user_id;
$this->registrant = $lr_session->user;
}
parent::__construct($event_id, $this->registrant);
}
示例13: check_input_errors
function check_input_errors($edit = array())
{
$errors = parent::check_input_errors($edit);
if (!validate_name_input($edit['username'])) {
$errors[] = "You can only use letters, numbers, spaces, and the characters - ' and . in usernames";
}
$existing_user = Person::load(array('username' => $edit['username']));
if ($existing_user) {
$errors[] = "A user with that username already exists; please choose another";
}
if ($edit['password_once'] != $edit['password_twice']) {
$errors[] = error_exit("First and second entries of password do not match");
}
return $errors;
}
示例14: load
function load($id)
{
$res = parent::load($id);
// Load restrictions
$sql = 'SELECT congregationid, NULL as groupid
FROM account_congregation_restriction
WHERE personid = ' . (int) $id . '
UNION
SELECT NULL as congregationid, groupid
FROM account_group_restriction
WHERE personid = ' . (int) $id;
$res = $GLOBALS['db']->queryAll($sql);
check_db_result($res);
foreach ($res as $row) {
$type = empty($row['congregationid']) ? 'group' : 'congregation';
$this->_restrictions[$type][] = $row[$type . 'id'];
}
return $res;
}
示例15: process
function process()
{
global $lr_session;
$this->title = "{$this->league->fullname} » Member Status";
if (!$this->player_id) {
$new_handler = new person_search();
$new_handler->smarty =& $this->smarty;
$new_handler->initialize();
$new_handler->ops['Add to ' . $this->league->fullname] = 'league/member/' . $this->league->league_id;
$new_handler->extra_where = "(class = 'administrator' OR class = 'volunteer')";
$new_handler->process();
$this->template_name = $new_handler->template_name;
return true;
}
if (!$lr_session->is_admin() && $this->player_id == $lr_session->attr_get('user_id')) {
error_exit("You cannot add or remove yourself as league coordinator");
}
$player = Person::load(array('user_id' => $this->player_id));
switch ($_GET['edit']['status']) {
case 'remove':
if (!$this->league->remove_coordinator($player)) {
error_exit("Failed attempting to remove coordinator from league");
}
break;
default:
if ($player->class != 'administrator' && $player->class != 'volunteer') {
error_exit("Only volunteer-class players can be made coordinator");
}
if (!$this->league->add_coordinator($player)) {
error_exit("Failed attempting to add coordinator to league");
}
break;
}
if (!$this->league->save()) {
error_exit("Failed attempting to modify coordinators for league");
}
local_redirect(url("league/view/" . $this->league->league_id));
}