本文整理汇总了PHP中person::get_id方法的典型用法代码示例。如果您正苦于以下问题:PHP person::get_id方法的具体用法?PHP person::get_id怎么用?PHP person::get_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类person
的用法示例。
在下文中一共展示了person::get_id方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_person
function add_person(person $person)
{
connect();
$result = mysql_query("SELECT * FROM PERSON WHERE ID = '" . $person->get_ID() . "'");
if (!$result) {
error_log('ERROR on select in add_person() ' . mysql_error());
die('Invalid query: ' . mysql_error());
}
// the function get_MS_ID does not exist in the original Homebase code
// this code causes and error and should be deleted
// not clear what the logic was
/* if (mysql_num_rows($result) != 0)
{
delete_dbMasterSchedule($person->get_MS_ID());
connect();
} */
error_log('will insert person id= ' . $person->get_id() . ' avail= ' . $person->get_availability());
$avail = implode(",", $person->get_availability());
$schedule = implode(",", $person->get_schedule());
$query = "INSERT INTO PERSON VALUES ('" . $person->get_id() . "','" . $person->get_first_name() . "','" . $person->get_last_name() . "','" . $person->get_birthday() . "','" . $person->get_gender() . "','" . $person->get_address() . "','" . $person->get_city() . "','" . $person->get_state() . "','" . $person->get_zip() . "','" . $person->get_phone1() . "','" . $person->get_phone2() . "','" . $person->get_email() . "','" . $person->get_type() . "','" . $person->get_status() . "','" . $schedule . "','" . $person->get_notes() . "','" . $person->get_skills() . "','" . $person->get_reason_interested() . "','" . $person->get_date_added() . "','" . $person->get_password() . "','" . $avail . "','" . $person->get_contact_preference() . "');";
error_log('query is ' . $query);
$result = mysql_query($query);
if (!$result) {
error_log("error doing insert in add_person " . mysql_error());
echo mysql_error() . " - Unable to insert in PERSON: " . $person->get_ID() . "\n";
mysql_close();
return false;
}
mysql_close();
return true;
}
示例2: show_users_stats
function show_users_stats($template)
{
global $TPL;
global $db;
$stats = new stats();
$projects = $stats->project_stats();
$tasks = $stats->task_stats();
$comments = $stats->comment_stats();
$persons = array();
$query = "SELECT * FROM person ORDER BY username";
$db->query($query);
while ($db->next_record()) {
$person = new person();
$person->read_db_record($db);
array_push($persons, $person->get_id());
}
usort($persons, "compare");
for ($i = 0; $i < count($persons); $i++) {
$person = new person();
$person->set_id($persons[$i]);
$person->select();
$TPL["user_username"] = $person->get_value("username");
$TPL["user_projects_current"] = $projects["current"][$person->get_id()] + 0;
$TPL["user_projects_total"] = $projects["current"][$person->get_id()] + $projects["archived"][$person->get_id()];
$TPL["user_tasks_current"] = $tasks["current"][$person->get_id()] + 0;
$TPL["user_tasks_total"] = $tasks["current"][$person->get_id()] + $tasks["completed"][$person->get_id()];
$TPL["user_comments_total"] = $comments["total"][$person->get_id()] + 0;
$TPL["user_graph"] = "<a href=\"" . $TPL["url_alloc_statsImage"] . "id=" . $person->get_id() . "&width=640&multiplier=8&labels=true\">";
$TPL["user_graph"] .= "<img alt=\"User graph\" src=\"" . $TPL["url_alloc_statsImage"] . "id=" . $person->get_id() . "&width=400&multiplier=2\"></a>";
if ($TPL["user_projects_total"] + $TPL["user_tasks_total"] + $TPL["user_comments_total"] > 0) {
$TPL["odd_even"] = $TPL["odd_even"] == "odd" ? "even" : "odd";
include_template($template);
}
}
}
示例3: prepare
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;
}
示例4: while
Phone No,
Comments
*/
$cur = config::get_config_item("currency");
$row = 1;
if (($handle = fopen("../../David_People.csv", "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
foreach ($data as $key => $val) {
# $data[$key] = utf8_encode($data[$key]);
}
$person = new person();
$person->currency = $cur;
$person->set_value("username", $data[0]);
$person->set_value("firstName", $data[1]);
$person->set_value("surname", $data[2]);
$person->set_value("password", encrypt_password($data[3]));
$person->set_value("emailAddress", $data[4]);
$person->set_value("phoneNo1", $data[5]);
$person->set_value("comments", $data[6]);
$person->set_value("perms", "employee");
$person->set_value("personActive", 1);
$person->set_value("personModifiedUser", $current_user->get_id());
$person->save();
$x++;
echo "<br>here: " . $person->get_id() . $data[0];
if ($x > 4) {
//die();
}
}
fclose($handle);
}
示例5: unset
$current_user->prefs["receiveOwnTaskComments"] = 1;
}
if ($current_user->prefs["showFilters"] == "no") {
$current_user->prefs["showFilters"] = 0;
} else {
$current_user->prefs["showFilters"] = 1;
}
if ($current_user->prefs["dailyTaskEmail"] != "yes") {
$current_user->prefs["dailyTaskEmail"] = 0;
} else {
$current_user->prefs["dailyTaskEmail"] = 1;
}
if ($current_user->prefs["topTasksStatus"]) {
$current_user->prefs["showTaskListHome"] = 1;
$current_user->prefs["taskListHome_filter"]["applyFilter"] = 1;
$current_user->prefs["taskListHome_filter"]["personID"] = $current_user->get_id();
$current_user->prefs["taskListHome_filter"]["taskStatus"] = $current_user->prefs["topTasksStatus"];
unset($current_user->prefs["topTasksStatus"]);
}
if ($current_user->prefs["topTasksNum"]) {
$current_user->prefs["showTaskListHome"] = 1;
$current_user->prefs["taskListHome_filter"]["applyFilter"] = 1;
$current_user->prefs["taskListHome_filter"]["personID"] = $current_user->get_id();
$current_user->prefs["taskListHome_filter"]["limit"] = $current_user->prefs["topTasksNum"];
unset($current_user->prefs["topTasksNum"]);
}
if ($current_user->prefs["showTimeSheetStats"]) {
$current_user->prefs["showTimeSheetStatsHome"] = 1;
} else {
$current_user->prefs["showTimeSheetStatsHome"] = 0;
}
示例6: person
}
$person = new person();
$person->set_id($task->get_value("personID"));
$person->select();
$TPL["person_username"] = $person->get_name();
$TPL["person_username_personID"] = $person->get_id();
$manager = new person();
$manager->set_id($task->get_value("managerID"));
$manager->select();
$TPL["manager_username"] = $manager->get_name();
$TPL["manager_username_personID"] = $manager->get_id();
$estimator = new person();
$estimator->set_id($task->get_value("estimatorID"));
$estimator->select();
$TPL["estimator_username"] = $estimator->get_name();
$TPL["estimator_username_personID"] = $estimator->get_id();
// If we've been sent here by a "New Message" or "New Fault" option in the Quick List dropdown
if (!$taskID && $_GET["tasktype"]) {
$task->set_value("taskTypeID", $_GET["tasktype"]);
}
// If we've been sent here by a "New Task" link from the calendar
if (!$taskID && $_GET["dateTargetStart"]) {
$TPL["task_dateTargetStart"] = $_GET["dateTargetStart"];
$task->set_value("personID", $_GET["personID"]);
}
// Set options for the dropdown boxen
$task->set_option_tpl_values();
$time_billed = $task->get_time_billed(false);
$time_billed_label = seconds_to_display_format($time_billed);
if ($time_billed != "") {
$TPL["time_billed_link"] = "<a href=\"" . $TPL["url_alloc_timeSheetList"] . "taskID=" . $task->get_id() . "&dontSave=true&applyFilter=true\">" . $time_billed_label . "</a>";
示例7: item
$item = new item();
$loan = new loan();
$db = new db_alloc();
$db->query("select * from item where itemID=%d", $itemID);
$db->next_record();
$item->read_db_record($db);
$item->set_values();
// new crap
if ($current_user->have_role("admin") || $current_user->have_role("manage")) {
$users = array();
$_db = new db_alloc();
$_db->query("SELECT * FROM person ORDER BY username");
while ($_db->next_record()) {
$person = new person();
$person->read_db_record($_db);
$users[$person->get_id()] = $person->get_value('username');
}
$TPL["userSelect"] = "<select name=\"userID\">" . page::select_options($users, $current_user->get_id()) . "</select><br>\n";
} else {
$TPL["userSelect"] = "";
}
$temp = mktime(0, 0, 0, date("m") + $_POST["timePeriod"], date("d"), date("Y"));
$whenToReturn = date("Y", $temp) . "-" . date("m", $temp) . "-" . date("d", $temp);
$today = date("Y") . "-" . date("m") . "-" . date("d");
if ($loanID) {
$loan->set_id($loanID);
$loan->select();
}
if ($_POST["borrowItem"]) {
$db->query("select * from loan where itemID=%d and dateReturned='0000-00-00'", $itemID);
if ($db->next_record()) {
示例8: export_gnome_planner
function export_gnome_planner($projectID)
{
$project = new project();
$project->set_id($projectID);
$project->select();
// Note: DOM_Document is a wrapper that wraps DOMDocument for PHP5 and DomDocument for PHP4
$doc = get_xml_document();
$doc->load(ALLOC_MOD_DIR . "shared" . DIRECTORY_SEPARATOR . "export_templates" . DIRECTORY_SEPARATOR . "template.planner");
// General metadata
$rootNode = $doc->getElementsByTagName("project");
$rootNode = $rootNode->item(0);
$rootNode->setAttribute("company", config::get_config_item("companyName"));
// Get the project manager
$projectManager = $project->get_project_manager();
$rootNode->setAttribute("manager", person::get_fullname($projectManager[0]));
$rootNode->setAttribute("name", $project->get_value("projectName"));
if ($project->get_value("dateActualStart")) {
$projectStartDate = export_planner_date(planner_date_timestamp($project->get_value("dateActualStart")));
} else {
$projectStartDate = export_planner_date(planner_date_timestamp($project->get_value("dateTargetStart")));
}
$rootNode->setAttribute("project-start", $projectStartDate);
$resourcesUsed = array();
// Export all tasks in the project
$taskOptions["projectIDs"] = array($project->get_id());
$taskOptions["return"] = "array";
$taskOptions["taskView"] = "byProject";
$tasks = task::get_list($taskOptions);
// We need to sort by taskID (we assume taskIDs were assigned linearly on import) otherwise Planner will get very confused with ordering
foreach ($tasks as $task) {
$taskIDs[] = $task['taskID'];
}
array_multisort($taskIDs, $tasks);
$taskRootNode = $doc->getElementsByTagName("tasks");
$taskRootNode = $taskRootNode->item(0);
foreach ($tasks as $task) {
$taskNode = $doc->createElement("task");
// Use the alloc internal ID rather than pointlessly renumbering things
$taskNode->setAttribute("id", $task["taskID"]);
$taskNode->setAttribute("name", $task["taskName"]);
$taskNode->setAttribute("note", $task["taskDescription"]);
// Ugly date handling
if (!$task["dateActualStart"]) {
if (!$task["dateTargetStart"]) {
// This is a reasonably bad situation
$taskStartDate = time();
} else {
$taskStartDate = planner_date_timestamp($task["dateTargetStart"]);
}
} else {
$taskStartDate = planner_date_timestamp($task["dateActualStart"]);
}
if (!$task["dateActualCompletion"]) {
if (!$task["dateTargetCompletion"]) {
//The task has to last for some amount of time, so end = start (otherwise we get end = 1970)
$taskEndDate = $taskStartDate;
} else {
$taskEndDate = planner_date_timestamp($task["dateTargetCompletion"]);
}
} else {
$taskEndDate = planner_date_timestamp($task["dateActualCompletion"]);
}
// Take a stab at the duration we need to give this task
$taskDuration = $taskEndDate - $taskStartDate;
// That's the total number of seconds, Planner expects the number of 8-hour days worth of seconds
$taskDuration = $taskDuration / 86400 * 28800;
// note: the above doesn't account for weekends so there is a discrepancy between task durations in alloc and those in Planner, the solution is to make people work on the weekends
$taskNode->setAttribute("work", $taskDuration);
$taskNode->setAttribute("start", export_planner_date($taskStartDate));
$taskNode->setAttribute("work-start", export_planner_date($taskStartDate));
$taskNode->setAttribute("end", export_planner_date($taskEndDate));
$taskNode->setAttribute("scheduling", "fixed-work");
$constraintNode = $doc->createElement("constraint");
$constraintNode->setAttribute("type", "start-no-earlier-than");
$constraintNode->setAttribute("time", export_planner_date($taskStartDate));
$taskNode->appendChild($constraintNode);
if ($task["taskTypeID"] == "Milestone") {
$taskNode->setAttribute("type", "milestone");
}
$resourcesUsed[$task["taskID"]] = $task['personID'];
$taskRootNode->appendChild($taskNode);
}
// Now do the resources and their linkage to tasks
$resourcesRootNode = $doc->getElementsByTagName("resources");
$resourcesRootNode = $resourcesRootNode->item(0);
$allocationsRootNode = $doc->getElementsByTagName("allocations");
$allocationsRootNode = $allocationsRootNode->item(0);
$resources = array();
//Store the users that need to be added to <resources>
foreach ($resourcesUsed as $taskID => $resourceID) {
if (isset($resources[$resourceID])) {
$person = $resources[$resourceID];
} else {
$person = new person();
$person->set_id($resourceID);
$person->select();
$resources[$resourceID] = $person;
// Add this person to <resources>
$resourceNode = $doc->createElement("resource");
$resourceNode->setAttribute("id", $person->get_id());
//.........这里部分代码省略.........
示例9: prepare
if ($_POST["password1"] && $_POST["password1"] == $_POST["password2"]) {
$person->set_value('password', encrypt_password($_POST["password1"]));
} else {
if (!$_POST["password1"] && $personID) {
// nothing required here, just don't update the password field
} else {
alloc_error("Please re-type the passwords");
}
}
if ($_POST["username"]) {
$q = prepare("SELECT personID FROM person WHERE username = '%s'", $_POST["username"]);
$db = new db_alloc();
$db->query($q);
$num_rows = $db->num_rows();
$row = $db->row();
if ($num_rows > 0 && !$person->get_id() || $num_rows > 0 && $person->get_id() != $row["personID"]) {
alloc_error("That username is already taken. Please select another.");
}
} else {
alloc_error("Please enter a username.");
}
$person->set_value("personActive", $_POST["personActive"] ? 1 : "0");
$max_alloc_users = get_max_alloc_users();
if (!$person->get_id() && $max_alloc_users && get_num_alloc_users() >= $max_alloc_users && $_POST["personActive"]) {
alloc_error(get_max_alloc_users_message());
}
if (!$TPL["message"]) {
$person->set_value("availability", rtrim($person->get_value("availability")));
$person->set_value("areasOfInterest", rtrim($person->get_value("areasOfInterest")));
$person->set_value("comments", rtrim($person->get_value("comments")));
$person->set_value("emergencyContact", rtrim($person->get_value("emergencyContact")));
示例10: sprintf
function get_stats_for_email($format)
{
if ($format == "html") {
$msg = "<br><br><h4>Alloc Stats For Today</h4>";
$msg .= sprintf("%d New and %d Active Projects<br><br>", $this->projects["new"]["total"], $this->projects["current"]["total"]);
$msg .= "<table >";
} else {
$msg = "\n- - - - - - - - - -\n";
$msg .= "Alloc Stats For Today\n";
$msg .= "\n";
$msg .= sprintf("%d New and %d Active Projects\n", $this->projects["new"]["total"], $this->projects["current"]["total"]);
$msg .= "\n";
$msg .= "Top Users:\n";
}
$num_users = 3;
for ($i = 0; $i < $num_users && $i < count($this->persons); $i++) {
$person = new person();
$person->set_id($this->persons[$i]["id"]);
$person->select();
if ($format == "html") {
$msg .= "<tr>";
$msg .= sprintf("<td>%s has</td>", $person->get_value("username"));
$msg .= sprintf("<td>%d New and</td>", $this->tasks["new"][$person->get_id()]["total"]);
$msg .= sprintf("<td>%d Active Tasks</td>", $this->tasks["current"][$person->get_id()]);
$msg .= "</tr>";
} else {
$msg .= sprintf("* %-15s %-15s %s\n", sprintf("%s has", $person->get_value("username")), sprintf("%d New and", $this->tasks["new"][$person->get_id()]["total"]), sprintf("%d Active Tasks", $this->tasks["current"][$person->get_id()]));
}
}
if ($format == "html") {
$msg .= "<hr />\nTo disable these daily emails, change the \"Daily Email\" setting on the Personal page.\n";
$msg .= "</table>";
} else {
$msg .= "\n- - - - - - - - - -\nTo disable these daily emails, change the \"Daily Email\" setting on the Personal page.\n";
}
return $msg;
}
示例11: rtrim
if ($_POST["save"]) {
// Saving a record
$absence->read_globals();
$absence->set_value("contactDetails", rtrim($absence->get_value("contactDetails")));
$success = $absence->save();
if ($success && !$TPL["message"]) {
$url = $TPL["url_alloc_person"] . "personID=" . $personID;
$urls[$returnToParent] and $url = $urls[$returnToParent];
alloc_redirect($url);
}
} else {
if ($_POST["delete"]) {
// Deleting a record
$absence->read_globals();
$absence->delete();
$url = $TPL["url_alloc_person"] . "personID=" . $personID;
$urls[$returnToParent] and $url = $urls[$returnToParent];
alloc_redirect($url);
}
}
// create a new record
$absence->read_globals();
$absence->set_value("personID", $person->get_id());
$absence->set_values("absence_");
$_GET["date"] and $TPL["absence_dateFrom"] = $_GET["date"];
$TPL["personName"] = $person->get_name();
// Set up the options for the absence type.
$absenceType_array = array('Annual Leave' => 'Annual Leave', 'Holiday' => 'Holiday', 'Illness' => 'Illness', 'Other' => 'Other');
$TPL["absenceType_options"] = page::select_options($absenceType_array, $absence->get_value("absenceType"));
$TPL["main_alloc_title"] = "Absence Form - " . APPLICATION_NAME;
include_template("templates/absenceFormM.tpl");
示例12: get_people_header
function get_people_header()
{
global $TPL;
global $people_ids;
global $people_header;
global $talent;
global $skill_class;
$people_ids = array();
$where = FALSE;
$db = new db_alloc();
$query = "SELECT * FROM person";
$query .= " LEFT JOIN proficiency ON person.personID=proficiency.personID";
$query .= " LEFT JOIN skill ON proficiency.skillID=skill.skillID WHERE personActive = 1 ";
if ($talent) {
$query .= prepare(" AND skill.skillID=%d", $talent);
} else {
if ($skill_class) {
$query .= prepare(" AND skill.skillClass='%s'", $skill_class);
}
}
$query .= " GROUP BY username ORDER BY username";
$db->query($query);
while ($db->next_record()) {
$person = new person();
$person->read_db_record($db);
array_push($people_ids, $person->get_id());
$people_header .= sprintf("<th style=\"text-align:center\">%s</th>\n", $person->get_value('username'));
}
}