本文整理汇总了PHP中person::read_db_record方法的典型用法代码示例。如果您正苦于以下问题:PHP person::read_db_record方法的具体用法?PHP person::read_db_record怎么用?PHP person::read_db_record使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类person
的用法示例。
在下文中一共展示了person::read_db_record方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
}
示例2: 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;
}
示例3: 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);
}
}
示例4: item
$loanID = $_POST["loanID"] or $loanID = $_GET["loanID"];
$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);
示例5: import_find_username
function import_find_username($candidates)
{
//Attempts to find a Person record that corresponds to one of the names specified in the $candidates array. Returns false on failure.
global $db;
//Our aim is just to find one record that matches the username
foreach ($candidates as $candidate) {
$query = prepare("SELECT * FROM person WHERE username = '%s'", $candidate);
$db->query($query);
if ($db->next_record()) {
$person = new person();
$person->read_db_record($db);
$person->select();
return $person;
}
}
//No such user
return false;
}
示例6: while
function order_by_most_frequent_use()
{
$max_search_back = 90;
// maximum number of days to go back when sorting
$query = "SELECT * FROM person ORDER BY username";
$db = new db_alloc();
$db->query($query);
while ($db->next_record()) {
$person = new person();
$person->read_db_record($db);
for ($value = 0, $i = 0; $value == 0 && $i < $max_search_back; $i++) {
$date = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - $i, date("Y")));
$value = $this->tasks["all"][$person->get_id()][$date];
// + $this->projects["all"][$person->get_id()][$date]
// + $this->comments["all"][$person->get_id()][$date];
if ($value > 0) {
array_push($this->persons, array("id" => $person->get_id(), "username" => $person->get_value('username'), "count_back" => $i, "value" => $value));
}
}
}
usort($this->persons, array($this, "compare"));
}
示例7: get_list
public static function get_list($_FORM = array())
{
global $TPL;
$current_user =& singleton("current_user");
list($filter, $filter2) = person::get_list_filter($_FORM);
$debug = $_FORM["debug"];
$debug and print "<pre>_FORM: " . print_r($_FORM, 1) . "</pre>";
$debug and print "<pre>filter: " . print_r($filter, 1) . "</pre>";
$_FORM["return"] or $_FORM["return"] = "html";
// Get averages for hours worked over the past fortnight and year
if ($current_user->have_perm(PERM_PERSON_READ_MANAGEMENT) && $_FORM["showHours"]) {
$t = new timeSheetItem();
list($ts_hrs_col_1, $ts_dollars_col_1) = $t->get_averages(date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 14, date("Y"))));
list($ts_hrs_col_2, $ts_dollars_col_2) = $t->get_fortnightly_average();
} else {
unset($_FORM["showHours"]);
}
// A header row
$summary .= person::get_list_tr_header($_FORM);
if (is_array($filter) && count($filter)) {
$filter = " WHERE " . implode(" AND ", $filter);
}
if (is_array($filter2) && count($filter2)) {
unset($filter["skill"]);
$filter .= " AND " . implode(" OR ", $filter2);
}
$q = "SELECT person.*\n FROM person\n LEFT JOIN proficiency ON person.personID = proficiency.personID\n " . $filter . "\n GROUP BY username\n ORDER BY firstName,surname,username";
$debug and print "Query: " . $q;
$db = new db_alloc();
$db->query($q);
while ($row = $db->next_record()) {
$p = new person();
if (!$p->read_db_record($db)) {
continue;
}
$row = $p->perm_cleanup($row);
// this is not the right way to do this - alla
$print = true;
$_FORM["showHours"] and $row["hoursSum"] = $ts_hrs_col_1[$row["personID"]];
$_FORM["showHours"] and $row["hoursAvg"] = $ts_hrs_col_2[$row["personID"]];
$row["name"] = $p->get_name();
$row["name_link"] = $p->get_link($_FORM);
$row["personActive_label"] = $p->get_value("personActive") == 1 ? "Y" : "";
if ($_FORM["showSkills"]) {
$senior_skills = $p->get_skills('Senior');
$advanced_skills = $p->get_skills('Advanced');
$intermediate_skills = $p->get_skills('Intermediate');
$junior_skills = $p->get_skills('Junior');
$novice_skills = $p->get_skills('Novice');
$skills = array();
$senior_skills and $skills[] = "<img src=\"../images/skill_senior.png\" alt=\"Senior=\"> " . page::htmlentities($senior_skills);
$advanced_skills and $skills[] = "<img src=\"../images/skill_advanced.png\" alt=\"Advanced=\"> " . page::htmlentities($advanced_skills);
$intermediate_skills and $skills[] = "<img src=\"../images/skill_intermediate.png\" alt=\"Intermediate=\"> " . page::htmlentities($intermediate_skills);
$junior_skills and $skills[] = "<img src=\"../images/skill_junior.png\" alt=\"Junior=\"> " . page::htmlentities($junior_skills);
$novice_skills and $skills[] = "<img src=\"../images/skill_novice.png\" alt=\"Novice\"> " . page::htmlentities($novice_skills);
$row["skills_list"] = implode("<br>", $skills);
}
if ($_FORM["showLinks"]) {
$row["navLinks"] = '<a href="' . $TPL["url_alloc_taskList"] . 'personID=' . $row["personID"] . '&taskView=byProject&applyFilter=1';
$row["navLinks"] .= '&dontSave=1&taskStatus=open&projectType=Current">Tasks</a> ';
has("project") and $row["navLinks"] .= '<a href="' . $TPL["url_alloc_personGraph"] . 'personID=' . $row["personID"] . '">Graph</a> ';
$row["navLinks"] .= '<a href="' . $TPL["url_alloc_taskCalendar"] . 'personID=' . $row["personID"] . '">Calendar</a> ';
$dateFrom = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 28, date("Y")));
$dateTo = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") + 1, date("Y")));
$row["navLinks"] .= '<a href="' . $TPL["url_alloc_timeSheetGraph"] . 'personID=' . $row["personID"] . '&dateFrom=' . $dateFrom . '&dateTo=' . $dateTo . '&applyFilter=1&dontSave=1">Hours</a>';
}
$summary .= person::get_list_tr($row, $_FORM);
$rows[$row["personID"]] = $row;
}
$rows or $rows = array();
if ($print && $_FORM["return"] == "array") {
return $rows;
} else {
if ($print && $_FORM["return"] == "html") {
return "<table class=\"list sortable\">" . $summary . "</table>";
} else {
if (!$print && $_FORM["return"] == "html") {
return "<table style=\"width:100%\"><tr><td colspan=\"10\" style=\"text-align:center\"><b>No People Found</b></td></tr></table>";
}
}
}
}
示例8: 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'));
}
}