本文整理汇总了PHP中person类的典型用法代码示例。如果您正苦于以下问题:PHP person类的具体用法?PHP person怎么用?PHP person使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了person类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_overdue
function show_overdue($template_name)
{
global $db;
global $TPL;
$current_user =& singleton("current_user");
$db = new db_alloc();
$temp = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
$today = date("Y", $temp) . "-" . date("m", $temp) . "-" . date("d", $temp);
$q = prepare("SELECT itemName,itemType,item.itemID,dateBorrowed,dateToBeReturned,loan.personID \n FROM loan,item \n WHERE dateToBeReturned < '%s' \n\t\t\t\t\t AND dateReturned = '0000-00-00' \n\t\t\t\t\t AND item.itemID = loan.itemID\n ", $today);
if (!have_entity_perm("loan", PERM_READ, $current_user, false)) {
$q .= prepare("AND loan.personID = %d", $current_user->get_id());
}
$db->query($q);
while ($db->next_record()) {
$i++;
$item = new item();
$loan = new loan();
$item->read_db_record($db);
$loan->read_db_record($db);
$item->set_values();
$loan->set_values();
$person = new person();
$person->set_id($loan->get_value("personID"));
$person->select();
$TPL["person"] = $person->get_name();
$TPL["overdue"] = "<a href=\"" . $TPL["url_alloc_item"] . "itemID=" . $item->get_id() . "&return=true\">Overdue!</a>";
include_template($template_name);
}
}
示例2: get_recipients
function get_recipients()
{
$db = new db_alloc();
$type = $this->get_value('reminderType');
if ($type == "project") {
$query = prepare("SELECT * \n FROM projectPerson \n LEFT JOIN person ON projectPerson.personID=person.personID \n WHERE projectPerson.projectID = %d \n ORDER BY person.username", $this->get_value('reminderLinkID'));
} else {
if ($type == "task") {
// Modified query option: to send to all people on the project that this task is from.
$recipients = array("-3" => "Task Manager", "-2" => "Task Assignee");
$db->query("SELECT projectID FROM task WHERE taskID = %d", $this->get_value('reminderLinkID'));
$db->next_record();
if ($db->f('projectID')) {
$query = prepare("SELECT * \n FROM projectPerson \n LEFT JOIN person ON projectPerson.personID=person.personID \n WHERE projectPerson.projectID = %d \n ORDER BY person.username", $db->f('projectID'));
} else {
$query = "SELECT * FROM person WHERE personActive = 1 ORDER BY username";
}
} else {
$query = "SELECT * FROM person WHERE personActive = 1 ORDER BY username";
}
}
$db->query($query);
while ($db->next_record()) {
$person = new person();
$person->read_db_record($db);
$recipients[$person->get_id()] = $person->get_name();
}
return $recipients;
}
示例3: add
/**
* clone a phone object in under a person object
*
* @param person $person http://www.test.com/info (comment)
* @param phone $phone http://www.test.com/info (comment)
* @return person http://www.test.com/info (comment)
*/
function add($person, $phone)
{
$new_phone = $person->createDataObject('phone');
foreach ($phone as $prop => $val) {
$new_phone[$prop] = $val;
}
return $person;
}
示例4: get_current_user
private function get_current_user($sessID)
{
$sess = new session($sessID);
if ($sess->Started()) {
$person = new person();
$person->load_current_user($sess->Get("personID"));
// update session_started, which affects session lifetime
$sess->Save();
return $person;
}
}
示例5: fix_this_comment
function fix_this_comment($r, $num, $from, $messageid)
{
global $db;
global $alloc_from_addresses2;
if ($r["commentEmailUIDORIG"] != $num) {
unset($projectID);
if ($r["commentMaster"] == "task" && $r["commentMasterID"]) {
$q = prepare("select projectID from task where taskID = %d", $r["commentMasterID"]);
$db->query($q);
$task_row = $db->row();
$projectID = $task_row["projectID"];
}
// Try figure out and populate the commentCreatedUser/commentCreatedUserClientContactID fields
list($from_address, $from_name) = parse_email_address($from);
$person = new person();
$personID = $person->find_by_email($from_address);
$personID or $personID = $person->find_by_name($from_name);
$sql = array();
$sql[] = prepare("commentEmailUID = '%s'", trim($num));
if ($personID) {
$sql[] = prepare("commentCreatedUser = %d", $personID);
$sql[] = "commentCreatedUserClientContactID = NULL";
} else {
$sql[] = "commentCreatedUser = NULL";
$cc = new clientContact();
$clientContactID = $cc->find_by_email($from_address, $projectID);
$clientContactID or $clientContactID = $cc->find_by_name($from_name, $projectID);
$clientContactID and $sql[] = prepare("commentCreatedUserClientContactID = %d", $clientContactID);
}
$sql[] = prepare("commentCreatedUserText = '%s'", trim($from));
$sql[] = prepare("commentEmailMessageID = '%s'", trim($messageid));
if (!in_array($from_address, $alloc_from_addresses2)) {
// don't update items that are from alloc
$q = prepare("UPDATE comment SET " . implode(",", $sql) . " WHERE commentID = %d", $r["commentID"]);
$db->query($q);
printorlog("FIXED: " . $q . " (old uid: " . $r["commentEmailUIDORIG"] . ")", "blue");
}
} else {
// Try figure out and populate the commentCreatedUser/commentCreatedUserClientContactID fields
list($from_address, $from_name) = parse_email_address($from);
if (!in_array($from_address, $alloc_from_addresses2)) {
// don't update items that are from alloc
$sql = array();
$sql[] = prepare("commentEmailUID = '%s'", trim($num));
$sql[] = prepare("commentEmailMessageID = '%s'", trim($messageid));
$q = prepare("UPDATE comment SET " . implode(",", $sql) . " WHERE commentID = %d", $r["commentID"]);
$db->query($q);
printorlog("GOOD: " . $q, "green");
}
}
}
示例6: show_people
function show_people($template_name)
{
global $person_query;
global $project;
global $TPL;
$db = new db_alloc();
$db->query($person_query);
while ($db->next_record()) {
$person = new person();
$person->read_db_record($db);
$person->set_values("person_");
$TPL["graphTitle"] = urlencode($person->get_name());
include_template($template_name);
}
}
示例7: load_filter
function load_filter($defaults)
{
$current_user =& singleton("current_user");
// display the list of project name.
$db = new db_alloc();
$page_vars = array_keys(timeSheetGraph::get_list_vars());
$_FORM = get_all_form_data($page_vars, $defaults);
if ($_FORM["applyFilter"] && is_object($current_user)) {
// we have a new filter configuration from the user, and must save it
if (!$_FORM["dontSave"]) {
$url = $_FORM["url_form_action"];
unset($_FORM["url_form_action"]);
$current_user->prefs[$_FORM["form_name"]] = $_FORM;
$_FORM["url_form_action"] = $url;
}
} else {
// we haven't been given a filter configuration, so load it from user preferences
$_FORM = $current_user->prefs[$_FORM["form_name"]];
}
$rtn["personOptions"] = page::select_options(person::get_username_list($_FORM["personID"]), $_FORM["personID"]);
$rtn["dateFrom"] = $_FORM["dateFrom"];
$rtn["dateTo"] = $_FORM["dateTo"];
$rtn["personID"] = $_FORM["personID"];
$rtn["groupBy"] = $_FORM["groupBy"];
// GET
$rtn["FORM"] = "FORM=" . urlencode(serialize($_FORM));
return $rtn;
}
示例8: getOAuthToken
/**
* Get or create a token for this person_id for this app
* @return array
*/
public function getOAuthToken()
{
$person_id = $this->person_id();
if (!$person_id) {
static::error('User not specified.');
}
if (!\person::exists($person_id)) {
static::error('Invalid user.');
}
$clause = array('person_id' => $person_id);
if (!$this->app_key()) {
$app_id = null;
} else {
$api_app = static::getApiAppByKey($this->app_key());
if (!$api_app) {
static::error('Invalid app_key.');
}
$app_id = $api_app->getID();
}
$clause[static::getApiAppModelName() . '_id'] = $app_id;
if (!$clause) {
static::error('Unknown Identity.');
}
$m = static::getOauthModelName();
$oauth = $m::getOne($clause);
if (!$oauth || !$oauth->token) {
$oauth = $m::insert($clause);
}
return array('oauth_token' => $oauth->token, 'issued' => $oauth->getTimeIssued(), 'now' => strtotime(\aql::now()), 'expires' => $oauth->getTimeExpires());
}
示例9: show_people
function show_people()
{
global $defaults;
$_FORM = person::load_form_data($defaults);
#echo "<pre>".print_r($_FORM,1)."</pre>";
echo person::get_list($_FORM);
}
示例10: set_name
function set_name($new_name)
{
//$this->name=strtoupper($new_name);
person::set_name($new_name);
//static access use double colon sign (::)
parent::set_name($new_name);
//static access can access class from parent class 1 level
}
示例11: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$person = person::find($id);
$person->fill($request->all());
$person->save();
Session::flash('message', 'Persona actualizada Correctamente');
return Redirect::to('people');
}
示例12: postLogin
function postLogin($p)
{
$success = person::auth($_POST['username'], $_POST['password']);
if (!$success) {
$this->redirect('login?auth=bad');
}
$id = person::getLoggedInId();
$this->redirect("main");
}
示例13: getLoggedInUser
function getLoggedInUser()
{
$id = person::getLoggedInId();
if ($id) {
return new Person((int) $id);
} else {
return NULL;
}
}
示例14: set_name
protected function set_name($new_name)
{
if ($new_name == "Stefan Sucks") {
$this->name = $new_name;
} else {
if ($new_name == "Johnny Fingers") {
person::set_name($new_name);
}
}
}
示例15: getModel
/**
* Return Data-Model for the View
*/
private function getModel()
{
require_once 'classes/SQL.php';
$model = new stdClass();
$model->template = 'admin/HighscoreTable';
$model->isAdmin = person::getPermissionName() == 'admin' ? 'true' : 'false';
$model->gameID = $this->getGameId();
$sql = new SQL();
$sql->connect();
$model->data = $sql->get("SELECT * FROM ViewHighscore ORDER BY GamerMainScore DESC");
return $model;
}