本文整理汇总了PHP中person::get_people_by_username方法的典型用法代码示例。如果您正苦于以下问题:PHP person::get_people_by_username方法的具体用法?PHP person::get_people_by_username怎么用?PHP person::get_people_by_username使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类person
的用法示例。
在下文中一共展示了person::get_people_by_username方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_tsiHint
function add_tsiHint($stuff)
{
$current_user =& singleton("current_user");
$errstr = "Failed to record new time sheet item hint. ";
$username = $stuff["username"];
$people = person::get_people_by_username();
$personID = $people[$username]["personID"];
$personID or alloc_error("Person " . $username . " not found.");
$taskID = $stuff["taskID"];
$projectID = $stuff["projectID"];
$duration = $stuff["duration"];
$comment = $stuff["comment"];
$date = $stuff["date"];
if ($taskID) {
$task = new task();
$task->set_id($taskID);
$task->select();
$projectID = $task->get_value("projectID");
$extra = " for task " . $taskID;
}
$projectID or alloc_error(sprintf($errstr . "No project found%s.", $extra));
$row_projectPerson = projectPerson::get_projectPerson_row($projectID, $current_user->get_id());
$row_projectPerson or alloc_error($errstr . "The person(" . $current_user->get_id() . ") has not been added to the project(" . $projectID . ").");
if ($row_projectPerson && $projectID) {
// Add new time sheet item
$tsiHint = new tsiHint();
$d = $date or $d = date("Y-m-d");
$tsiHint->set_value("date", $d);
$tsiHint->set_value("duration", $duration);
if (is_object($task)) {
$tsiHint->set_value("taskID", sprintf("%d", $taskID));
}
$tsiHint->set_value("personID", $personID);
$tsiHint->set_value("comment", $comment);
$tsiHint->save();
$ID = $tsiHint->get_id();
}
if ($ID) {
return array("status" => "yay", "message" => $ID);
} else {
alloc_error($errstr . "Time hint not added.");
}
}
示例2: expand_ip
function expand_ip($ip, $projectID = null)
{
// jon alloc username
// jon@jon.com alloc username or client or stranger
// Jon <jon@jon.com> alloc username or client or stranger
// Jon Smith alloc fullname or client fullname
// username
$people or $people = person::get_people_by_username();
if (preg_match("/^\\w+\$/i", $ip)) {
return array($people[$ip]["personID"], $people[$ip]["name"], $people[$ip]["emailAddress"]);
}
// email address
$people = person::get_people_by_username("emailAddress");
list($email, $name) = parse_email_address($ip);
if ($people[$email]) {
return array($people[$email]["personID"], $people[$email]["name"], $people[$email]["emailAddress"]);
}
// Jon smith
if (preg_match("/^[\\w\\s]+\$/i", $ip)) {
$personID = person::find_by_name($ip, 100);
if ($personID) {
$people = person::get_people_by_username("personID");
return array($personID, $people[$personID]["name"], $people[$personID]["emailAddress"]);
}
$ccid = clientContact::find_by_name($ip, $projectID, 100);
if ($ccid) {
$cc = new clientContact();
$cc->set_id($ccid);
$cc->select();
$name = $cc->get_value("clientContactName");
$email = $cc->get_value("clientContactEmail");
}
}
return array(null, $name, $email);
}
示例3: define
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* allocPSA is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with allocPSA. If not, see <http://www.gnu.org/licenses/>.
*/
define("NO_REDIRECT", 1);
require_once "../alloc.php";
//usleep(1000);
$t = tsiHint::parse_tsiHint_string($_REQUEST["tsiHint_item"]);
$people = person::get_people_by_username();
foreach ($t as $k => $v) {
if ($v) {
if ($k == "taskID") {
$task = new task();
$task->set_id($v);
if ($task->select()) {
$v = $task->get_id() . " " . $task->get_link();
} else {
$v = "Task " . $v . " not found.";
}
} else {
if ($k == "username") {
$name = $people[$v]["name"] or $name = $people[$v]["username"];
}
}
示例4: edit_task
function edit_task($commands, $email_receive)
{
$task_fields = $this->get_fields("task");
// Task commands
if ($commands["task"]) {
unset($changes);
$taskPriorities = config::get_config_item("taskPriorities") or $taskPriorities = array();
foreach ($taskPriorities as $k => $v) {
$priorities[strtolower($v["label"])] = $k;
}
$people_by_username = person::get_people_by_username();
// Else edit/create the task ...
$task = new task();
if ($commands["task"] && strtolower($commands["task"]) != "new") {
$task->set_id($commands["task"]);
if (!$task->select()) {
alloc_error("Unable to select task with ID: " . $commands["task"]);
}
}
foreach ($commands as $k => $v) {
// transform from username to personID
if ($k == "assign") {
$changes[$k] = "personID";
$v = $people_by_username[$v]["personID"];
$v or alloc_error("Unrecognized username.");
}
if ($k == "manage") {
$changes[$k] = "managerID";
$v = $people_by_username[$v]["personID"];
$v or alloc_error("Unrecognized username.");
}
if ($k == "estimator") {
$changes[$k] = "estimatorID";
$v = $people_by_username[$v]["personID"];
$v or alloc_error("Unrecognized username.");
}
// transform from priority label to priority ID
if ($k == "priority" && !in_array($v, array(1, 2, 3, 4, 5))) {
$v = $priorities[strtolower($v)];
}
// so that --type parent becomes --type Parent
// mysql's referential integrity is case-insensitive :(
if ($k == "type") {
$v = ucwords($v);
}
// Plug the value in
if ($task_fields[$k][0]) {
$changes[$k] = $task_fields[$k][0];
$task->set_value($task_fields[$k][0], sprintf("%s", $v));
}
}
if (isset($commands["pend"])) {
$changes["pend"] = implode(",", (array) $task->get_pending_tasks());
}
if (isset($commands["reopen"])) {
$reopen_rows = $task->get_reopen_reminders();
unset($rr_bits);
foreach ($reopen_rows as $rr) {
$rr_bits[] = $rr["reminderTime"];
}
$changes["reopen"] = implode(",", (array) $rr_bits);
}
if (isset($commands["tags"])) {
$changes["tags"] = implode(",", $task->get_tags());
}
if (strtolower($commands["task"]) == "new") {
if (!$commands["desc"] && is_object($email_receive)) {
$task->set_value("taskDescription", $email_receive->get_converted_encoding());
}
}
$after_label = "After: ";
if (strtolower($commands["task"]) != "new") {
$str = $this->condense_changes($changes, $task->row());
$str and $status[] = "msg";
$str and $message[] = "Before: " . $str;
} else {
$after_label = "Fields: ";
}
// Save task
$err = $task->validate();
if (!$err && $task->save()) {
$task->select();
if (isset($commands["pend"])) {
$task->add_pending_tasks($commands["pend"]);
$changes["pend"] = implode(",", (array) $task->get_pending_tasks());
}
if (isset($commands["reopen"])) {
$task->add_reopen_reminder($commands["reopen"]);
$reopen_rows = $task->get_reopen_reminders();
unset($rr_bits);
foreach ($reopen_rows as $rr) {
$rr_bits[] = $rr["reminderTime"];
}
$changes["reopen"] = implode(",", (array) $rr_bits);
}
if (isset($commands["tags"])) {
$task->add_tags(array($commands["tags"]));
$changes["tags"] = implode(",", $task->get_tags());
}
$str = $this->condense_changes($changes, $task->row());
//.........这里部分代码省略.........