本文整理汇总了PHP中person::select方法的典型用法代码示例。如果您正苦于以下问题:PHP person::select方法的具体用法?PHP person::select怎么用?PHP person::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类person
的用法示例。
在下文中一共展示了person::select方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
}
示例3: prepare
<?php
$q = prepare("SELECT * FROM person WHERE dailyTaskEmail = 'yes'");
$db = new db_alloc();
$db->query($q);
while ($r = $db->row()) {
$person = new person();
$person->set_id($r["personID"]);
$person->select();
$person->load_prefs();
$person->prefs["dailyTaskEmail"] = 'yes';
$person->store_prefs();
}
示例4: date
function find_email($debug = false, $get_blobs = false, $ignore_date = false)
{
$info = inbox::get_mail_info();
$mailbox = $this->get_value("commentMaster") . $this->get_value("commentMasterID");
$mail = new email_receive($info);
$mail->open_mailbox(config::get_config_item("allocEmailFolder") . "/" . $mailbox, OP_HALFOPEN + OP_READONLY);
$mail->check_mail();
$msg_nums = $mail->get_all_email_msg_uids();
$debug and print "<hr><br><b>find_email(): " . date("Y-m-d H:i:s") . " found " . count($msg_nums) . " emails for mailbox: " . $mailbox . "</b>";
// fetch and parse email
foreach ((array) $msg_nums as $num) {
$debug and print "<hr><br>Examining message number: " . $num;
unset($mimebits);
// this will stream output
$mail->set_msg($num);
$mail->get_msg_header();
$text = $mail->fetch_mail_text();
list($from1, $e1n) = parse_email_address($mail->mail_headers["from"]);
list($from2, $e2n) = parse_email_address($this->get_value("commentCreatedUserText"));
if (!$from2 && $this->get_value("commentCreatedUser")) {
$p = new person();
$p->set_id($this->get_value("commentCreatedUser"));
$p->select();
$from2 = $p->get_value("emailAddress");
}
if (!$from2 && $this->get_value("commentCreatedUserClientContactID")) {
$p = new clientContact();
$p->set_id($this->get_value("commentCreatedUserClientContactID"));
$p->select();
$from2 = $p->get_value("clientContactEmail");
}
$text1 = str_replace(array("\\s", "\n", "\r"), "", trim($text));
$text2 = str_replace(array("\\s", "\n", "\r"), "", trim($this->get_value("comment")));
$date = format_date("U", $this->get_value("commentCreatedTime"));
$date1 = strtotime($mail->mail_headers["date"]) - 300;
$date3 = strtotime($mail->mail_headers["date"]) + 300;
similar_text($text1, $text2, $percent);
if ($percent >= 99 && ($from1 == $from2 || !$from2 || same_email_address($from1, config::get_config_item("AllocFromEmailAddress"))) && ($date > $date1 && $date < $date3 || $ignore_date)) {
$debug and print "<br><b style='color:green'>Found you! Msg no: " . $num . " in mailbox: " . $mailbox . " for commentID: " . $this->get_id() . "</b>";
foreach ((array) $mail->mail_parts as $v) {
$s = $v["part_object"];
// structure
$raw_data = imap_fetchbody($mail->connection, $mail->msg_uid, $v["part_number"], FT_UID | FT_PEEK);
$thing = $mail->decode_part($s->encoding, $raw_data);
$filename = $mail->get_parameter_attribute_value($s->parameters, "name");
$filename or $filename = $mail->get_parameter_attribute_value($s->parameters, "filename");
$filename or $filename = $mail->get_parameter_attribute_value($s->dparameters, "name");
$filename or $filename = $mail->get_parameter_attribute_value($s->dparameters, "filename");
$bits = array();
$bits["part"] = $v["part_number"];
$bits["name"] = $filename;
$bits["size"] = strlen($thing);
$get_blobs and $bits["blob"] = $thing;
$filename and $mimebits[] = $bits;
}
$mail->close();
return array($mail, $text, $mimebits);
} else {
similar_text($text1, $text2, $percent);
$debug and print "<br>TEXT: " . sprintf("%d", $text1 == $text2) . " (" . sprintf("%d", $percent) . "%)";
#$debug and print "<br>Text1:<br>".$text1."<br>* * *<br>";
#$debug and print "Text2:<br>".$text2."<br>+ + +</br>";
$debug and print "<br>FROM: " . sprintf("%d", $from1 == $from2 || !$from2 || same_email_address($from1, config::get_config_item("AllocFromEmailAddress")));
$debug and print " From1: " . page::htmlentities($from1);
$debug and print " From2: " . page::htmlentities($from2);
$debug and print "<br>DATE: " . sprintf("%d", $date > $date1 && $date < $date3) . " (" . date("Y-m-d H:i:s", $date) . " | " . date("Y-m-d H:i:s", $date1) . " | " . date("Y-m-d H:i:s", $date3) . ")";
$debug and print "<br>";
}
}
$mail->close();
return array(false, false, false);
}
示例5: meta
$m = new meta("currencyType");
$currencyOps = $m->get_assoc_array("currencyTypeID", "currencyTypeID");
$TPL["currencyTypeOptions"] = page::select_options($currencyOps, $transaction_to_edit->get_value("currencyTypeID"));
if (is_object($expenseForm) && $expenseForm->get_value("clientID")) {
$clientID_sql = prepare(" AND clientID = %d", $expenseForm->get_value("clientID"));
}
$q = "SELECT projectID AS value, projectName AS label \n FROM project \n WHERE projectStatus = 'Current' \n " . $clientID_sql . " \n ORDER BY projectName";
$TPL["projectOptions"] = page::select_options($q, $selectedProjectID);
if (is_object($expenseForm)) {
$expenseForm->set_values();
$TPL["expenseFormID"] = $expenseForm->get_id();
}
if (is_object($expenseForm) && $expenseForm->get_value("expenseFormCreatedUser")) {
$p = new person();
$p->set_id($expenseForm->get_value("expenseFormCreatedUser"));
$p->select();
$TPL["user"] = $p->get_name();
}
if ($_POST["cancel"]) {
if (is_object($expenseForm)) {
$expenseForm->delete_transactions();
$expenseForm->delete();
alloc_redirect($TPL["url_alloc_expenseFormList"]);
} else {
alloc_error("Unable to delete Expense Form");
}
} else {
if ($_POST["changeTransactionStatus"] == "pending") {
$expenseForm->set_value("expenseFormComment", rtrim($expenseForm->get_value("expenseFormComment")));
$expenseForm->save();
$expenseForm->set_status("pending");
示例6: person
$TPL["task_closed_by"] = person::get_fullname($task->get_value("closerID"));
$TPL["task_closed_when"] = $task->get_value("dateClosed");
}
$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);
示例7: singleton
function set_option_tpl_values()
{
// Set template values to provide options for edit selects
global $TPL;
$current_user =& singleton("current_user");
global $isMessage;
$db = new db_alloc();
$projectID = $_GET["projectID"] or $projectID = $this->get_value("projectID");
$TPL["personOptions"] = "<select name=\"personID\"><option value=\"\">" . $this->get_personList_dropdown($projectID, "personID") . "</select>";
$TPL["managerPersonOptions"] = "<select name=\"managerID\"><option value=\"\">" . $this->get_personList_dropdown($projectID, "managerID") . "</select>";
$TPL["estimatorPersonOptions"] = "<select name=\"estimatorID\"><option value=\"\">" . $this->get_personList_dropdown($projectID, "estimatorID") . "</select>";
// TaskType Options
$taskType = new meta("taskType");
$taskType_array = $taskType->get_assoc_array("taskTypeID", "taskTypeID");
$TPL["taskTypeOptions"] = page::select_options($taskType_array, $this->get_value("taskTypeID"));
// Project dropdown
$TPL["projectOptions"] = task::get_project_options($projectID);
// We're building these two with the <select> tags because they will be
// replaced by an AJAX created dropdown when the projectID changes.
$TPL["parentTaskOptions"] = $this->get_parent_task_select();
$TPL["interestedPartyOptions"] = $this->get_task_cc_list_select();
$db->query(prepare("SELECT fullName, emailAddress, clientContactPhone, clientContactMobile\n FROM interestedParty\n LEFT JOIN clientContact ON interestedParty.clientContactID = clientContact.clientContactID\n WHERE entity='task' \n AND entityID = %d\n AND interestedPartyActive = 1\n ORDER BY fullName", $this->get_id()));
while ($db->next_record()) {
$value = interestedParty::get_encoded_interested_party_identifier($db->f("fullName"), $db->f("emailAddress"));
$phone = array("p" => $db->f('clientContactPhone'), "m" => $db->f('clientContactMobile'));
$TPL["interestedParties"][] = array('key' => $value, 'name' => $db->f("fullName"), 'email' => $db->f("emailAddress"), 'phone' => $phone);
}
$TPL["task_taskStatusLabel"] = $this->get_task_status("label");
$TPL["task_taskStatusColour"] = $this->get_task_status("colour");
$TPL["task_taskStatusValue"] = $this->get_value("taskStatus");
$TPL["task_taskStatusOptions"] = page::select_options(task::get_task_statii_array(true), $this->get_value("taskStatus"));
// Project label
if (has("project")) {
$p = new project();
$p->set_id($this->get_value("projectID"));
$p->select();
$TPL["projectName"] = $p->get_display_value();
}
$taskPriorities = config::get_config_item("taskPriorities") or $taskPriorities = array();
$projectPriorities = config::get_config_item("projectPriorities") or $projectPriorities = array();
$priority = $this->get_value("priority") or $priority = 3;
$TPL["priorityOptions"] = page::select_options(array_kv($taskPriorities, null, "label"), $priority);
$TPL["priorityLabel"] = " <div style=\"display:inline; color:" . $taskPriorities[$priority]["colour"] . "\">[";
if (is_object($p)) {
list($priorityFactor, $daysUntilDue) = $this->get_overall_priority($p->get_value("projectPriority"), $this->get_value("priority"), $this->get_value("dateTargetCompletion"));
$str = "Task priority: " . $taskPriorities[$this->get_value("priority")]["label"] . "<br>";
$str .= "Project priority: " . $projectPriorities[$p->get_value("projectPriority")]["label"] . "<br>";
$str .= "Days until due: " . $daysUntilDue . "<br>";
$str .= "Calculated priority: " . $priorityFactor;
$TPL["priorityLabel"] .= page::help($str, $this->get_priority_label());
} else {
$TPL["priorityLabel"] .= $this->get_priority_label();
}
$TPL["priorityLabel"] .= "]</div>";
// If we're viewing the printer friendly view
if ($_GET["media"] == "print") {
// Parent Task label
$t = new task();
$t->set_id($this->get_value("parentTaskID"));
$t->select();
$TPL["parentTask"] = $t->get_display_value();
// Task Type label
$TPL["taskType"] = $this->get_value("taskTypeID");
// Priority
$TPL["priority"] = $this->get_value("priority");
// Assignee label
$p = new person();
$p->set_id($this->get_value("personID"));
$p->select();
$TPL["person"] = $p->get_display_value();
}
}
示例8: person
}
}
}
// display the approved by admin and managers name and date
$person = new person();
if ($timeSheet->get_value("approvedByManagerPersonID")) {
$person_approvedByManager = new person();
$person_approvedByManager->set_id($timeSheet->get_value("approvedByManagerPersonID"));
$person_approvedByManager->select();
$TPL["timeSheet_approvedByManagerPersonID_username"] = $person_approvedByManager->get_name();
$TPL["timeSheet_approvedByManagerPersonID"] = $timeSheet->get_value("approvedByManagerPersonID");
}
if ($timeSheet->get_value("approvedByAdminPersonID")) {
$person_approvedByAdmin = new person();
$person_approvedByAdmin->set_id($timeSheet->get_value("approvedByAdminPersonID"));
$person_approvedByAdmin->select();
$TPL["timeSheet_approvedByAdminPersonID_username"] = $person_approvedByAdmin->get_name();
$TPL["timeSheet_approvedByAdminPersonID"] = $timeSheet->get_value("approvedByAdminPersonID");
}
// display the project name.
if (($timeSheet->get_value("status") == 'edit' || $timeSheet->get_value("status") == 'rejected') && !$timeSheet->get_value("projectID")) {
$query = prepare("SELECT * FROM project WHERE projectStatus = 'Current' ORDER by projectName");
#.prepare(" LEFT JOIN projectPerson on projectPerson.projectID = project.projectID ")
#.prepare("WHERE projectPerson.personID = '%d' ORDER BY projectName", $current_user->get_id());
} else {
$query = prepare("SELECT * FROM project ORDER by projectName");
}
// This needs to be just above the newTimeSheet_projectID logic
$projectID = $timeSheet->get_value("projectID");
// If we are entering the page from a project link: New time sheet
if ($_GET["newTimeSheet_projectID"] && !$projectID) {
示例9: singleton
function load_productSale_filter($_FORM)
{
$current_user =& singleton("current_user");
// display the list of project name.
$db = new db_alloc();
if (!$_FORM['showAllProjects']) {
$filter = "WHERE projectStatus = 'Current' ";
}
$query = prepare("SELECT projectID AS value, projectName AS label FROM project {$filter} ORDER by projectName");
$rtn["show_project_options"] = page::select_options($query, $_FORM["projectID"], 70);
// display the list of user name.
if (have_entity_perm("productSale", PERM_READ, $current_user, false)) {
$rtn["show_userID_options"] = page::select_options(person::get_username_list(), $_FORM["personID"]);
} else {
$person = new person();
$person->set_id($current_user->get_id());
$person->select();
$person_array = array($current_user->get_id() => $person->get_name());
$rtn["show_userID_options"] = page::select_options($person_array, $_FORM["personID"]);
}
// display a list of status
$status_array = productSale::get_statii();
unset($status_array["create"]);
$rtn["show_status_options"] = page::select_options($status_array, $_FORM["status"]);
// display the date from filter value
$rtn["showAllProjects"] = $_FORM["showAllProjects"];
$options["clientStatus"] = array("Current");
$options["return"] = "dropdown_options";
$ops = client::get_list($options);
$ops = array_kv($ops, "clientID", "clientName");
$rtn["clientOptions"] = page::select_options($ops, $_FORM["clientID"]);
// Get
$rtn["FORM"] = "FORM=" . urlencode(serialize($_FORM));
return $rtn;
}
示例10: array
function get_all_parties($projectID = "")
{
$db = new db_alloc();
$interestedPartyOptions = array();
if (!$projectID && is_object($this)) {
$projectID = $this->get_value("projectID");
}
if ($projectID) {
$project = new project($projectID);
$interestedPartyOptions = $project->get_all_parties();
}
$extra_interested_parties = config::get_config_item("defaultInterestedParties") or $extra_interested_parties = array();
foreach ($extra_interested_parties as $name => $email) {
$interestedPartyOptions[$email] = array("name" => $name);
}
if (is_object($this)) {
if ($this->get_value("personID")) {
$p = new person();
$p->set_id($this->get_value("personID"));
$p->select();
$p->get_value("emailAddress") and $interestedPartyOptions[$p->get_value("emailAddress")] = array("name" => $p->get_value("firstName") . " " . $p->get_value("surname"), "role" => "assignee", "selected" => false, "personID" => $this->get_value("personID"));
}
if ($this->get_value("approvedByManagerPersonID")) {
$p = new person();
$p->set_id($this->get_value("approvedByManagerPersonID"));
$p->select();
$p->get_value("emailAddress") and $interestedPartyOptions[$p->get_value("emailAddress")] = array("name" => $p->get_value("firstName") . " " . $p->get_value("surname"), "role" => "manager", "selected" => true, "personID" => $this->get_value("approvedByManagerPersonID"));
}
$this_id = $this->get_id();
}
// return an aggregation of the current task/proj/client parties + the existing interested parties
$interestedPartyOptions = interestedParty::get_interested_parties("timeSheet", $this_id, $interestedPartyOptions);
return $interestedPartyOptions;
}
示例11: 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;
}
示例12: 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;
}
示例13: person
function store_prefs()
{
$p = new person();
$p->set_id($this->get_id());
$p->select();
$p->load_prefs();
$old_prefs = $p->prefs or $old_prefs = array();
foreach ($old_prefs as $k => $v) {
if ($this->prefs[$k] != $v) {
$save = true;
}
}
foreach ($this->prefs as $k => $v) {
if ($old_prefs[$k] != $v) {
$save = true;
}
}
if ($save || (!is_array($old_prefs) || !count($old_prefs))) {
$arr = serialize($this->prefs);
$p->set_value("sessData", $arr);
$p->currency = config::get_config_item('currency');
$p->save();
}
}