当前位置: 首页>>代码示例>>PHP>>正文


PHP person::load_current_user方法代码示例

本文整理汇总了PHP中person::load_current_user方法的典型用法代码示例。如果您正苦于以下问题:PHP person::load_current_user方法的具体用法?PHP person::load_current_user怎么用?PHP person::load_current_user使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在person的用法示例。


在下文中一共展示了person::load_current_user方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
     }
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:11,代码来源:services.inc.php

示例2: singleton

 function add_comment_from_email($email_receive, $entity)
 {
     $current_user =& singleton("current_user");
     $commentID = comment::add_comment($entity->classname, $entity->get_id(), $email_receive->get_converted_encoding());
     $commentID or alloc_error("Unable to create an alloc comment (" . $entity->classname . ":" . $entity->get_id() . ") from email.");
     $comment = new comment();
     $comment->set_id($commentID);
     $comment->select();
     $comment->set_value("commentEmailUID", $email_receive->msg_uid);
     $comment->set_value("commentEmailMessageID", $email_receive->mail_headers["message-id"]);
     $comment->rename_email_attachment_dir($email_receive->dir);
     // Try figure out and populate the commentCreatedUser/commentCreatedUserClientContactID fields
     list($from_address, $from_name) = parse_email_address($email_receive->mail_headers["from"]);
     list($personID, $clientContactID, $from_name) = comment::get_person_and_client($from_address, $from_name, $entity->get_project_id());
     $personID and $comment->set_value('commentCreatedUser', $personID);
     $clientContactID and $comment->set_value('commentCreatedUserClientContactID', $clientContactID);
     $comment->set_value("commentCreatedUserText", $email_receive->mail_headers["from"]);
     $comment->set_value("commentEmailMessageID", $email_receive->mail_headers["message-id"]);
     $comment->updateSearchIndexLater = true;
     $comment->skip_modified_fields = true;
     $comment->save();
     if ($email_receive->mimebits) {
         comment::update_mime_parts($comment->get_id(), $email_receive->mimebits);
     }
     // CYBER-ONLY: Re-open task, if comment has been made by an external party.
     if (config::for_cyber() && !$comment->get_value('commentCreatedUser')) {
         $e = $entity->get_parent_object();
         if ($e->classname == "task" && substr($e->get_value("taskStatus"), 0, 4) != "open") {
             $tmp = $current_user;
             $current_user = new person();
             $personID = $e->get_value("managerID") or $personID = $e->get_value("personID") or $personID = $e->get_value("creatorID");
             $current_user->load_current_user($personID);
             // fake identity
             singleton("current_user", $current_user);
             $e->set_value("taskStatus", "open_inprogress");
             $e->save();
             $current_user = $tmp;
         }
     }
     return $comment;
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:41,代码来源:comment.inc.php

示例3: prepare

<?php

$q = prepare("SELECT * FROM person");
$db = new db_alloc();
$db->query($q);
while ($row = $db->row()) {
    $current_user = new person();
    $current_user->load_current_user($row["personID"]);
    if (sprintf("%d", $current_user->prefs["tasksGraphPlotHome"]) > 0) {
        $current_user->prefs["showCalendarHome"] = 1;
    }
    if (sprintf("%d", $current_user->prefs["projectListNum"]) > 0) {
        $current_user->prefs["showProjectHome"] = 1;
    }
    if ($current_user->prefs["receiveOwnTaskComments"] == 'no') {
        $current_user->prefs["receiveOwnTaskComments"] = 0;
    } else {
        $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;
开发者ID:cjbayliss,项目名称:alloc,代码行数:31,代码来源:patch-00283-alla.php

示例4: prepare

$query = prepare("SELECT *\n                    FROM reminder\n                   WHERE reminderActive = 1\n                     AND reminderAdvNoticeSent = 0\n                     AND NOW() > \n                         CASE\n                           WHEN reminderAdvNoticeInterval = 'Minute' THEN DATE_SUB(reminderTime, INTERVAL reminderAdvNoticeValue MINUTE)\n                           WHEN reminderAdvNoticeInterval = 'Hour'   THEN DATE_SUB(reminderTime, INTERVAL reminderAdvNoticeValue HOUR)\n                           WHEN reminderAdvNoticeInterval = 'Day'    THEN DATE_SUB(reminderTime, INTERVAL reminderAdvNoticeValue DAY)\n                           WHEN reminderAdvNoticeInterval = 'Week'   THEN DATE_SUB(reminderTime, INTERVAL reminderAdvNoticeValue WEEK)\n                           WHEN reminderAdvNoticeInterval = 'No'     THEN NULL\n                         END\n                 ");
$db->query($query);
while ($db->next_record()) {
    $reminder = new reminder();
    $reminder->read_db_record($db);
    //echo "<br>Adv: ".$reminder->get_id();
    $current_user = new person();
    $current_user->load_current_user($db->f('reminderCreatedUser'));
    singleton("current_user", $current_user);
    if (!$reminder->is_alive()) {
        $reminder->deactivate();
    } else {
        $reminder->mail_advnotice();
    }
}
// do reminders
$query = prepare("SELECT *\n                    FROM reminder\n                   WHERE reminderActive = 1\n                     AND (reminderTime IS NULL OR NOW() > reminderTime)\n                 ");
$db->query($query);
while ($db->next_record()) {
    $reminder = new reminder();
    $reminder->read_db_record($db);
    //echo "<br>Rem: ".$reminder->get_id();
    $current_user = new person();
    $current_user->load_current_user($db->f('reminderCreatedUser'));
    singleton("current_user", $current_user);
    if (!$reminder->is_alive()) {
        $reminder->deactivate();
    } else {
        $reminder->mail_reminder();
    }
}
开发者ID:cjbayliss,项目名称:alloc,代码行数:31,代码来源:sendReminders.php

示例5: array

 function attach_email_to_existing_task($req = array())
 {
     global $TPL;
     $info = inbox::get_mail_info();
     $current_user =& singleton("current_user");
     $orig_current_user =& $current_user;
     $req["taskID"] = sprintf("%d", $req["taskID"]);
     $task = new task();
     $task->set_id($req["taskID"]);
     if ($task->select()) {
         $email_receive = new email_receive($info);
         $email_receive->open_mailbox($info["folder"]);
         $email_receive->set_msg($req["id"]);
         $email_receive->get_msg_header();
         $email_receive->save_email();
         $c = comment::add_comment_from_email($email_receive, $task);
         $commentID = $c->get_id();
         $commentID and $TPL["message_good_no_esc"][] = "Created comment " . $commentID . " on task " . $task->get_task_link(array("prefixTaskID" => true));
         // Possibly change the identity of current_user
         list($from_address, $from_name) = parse_email_address($email_receive->mail_headers["from"]);
         $person = new person();
         $personID = $person->find_by_email($from_address);
         $personID or $personID = $person->find_by_name($from_name);
         if ($personID) {
             $current_user = new person();
             $current_user->load_current_user($personID);
             singleton("current_user", $current_user);
         }
         // swap back to normal user
         $current_user =& $orig_current_user;
         singleton("current_user", $current_user);
         // manually add task manager and assignee to ip list
         $extraips = array();
         if ($task->get_value("personID")) {
             $p = new person($task->get_value("personID"));
             if ($p->get_value("emailAddress")) {
                 $extraips[$p->get_value("emailAddress")]["name"] = $p->get_name();
                 $extraips[$p->get_value("emailAddress")]["role"] = "assignee";
                 $extraips[$p->get_value("emailAddress")]["personID"] = $task->get_value("personID");
                 $extraips[$p->get_value("emailAddress")]["selected"] = 1;
             }
         }
         if ($task->get_value("managerID")) {
             $p = new person($task->get_value("managerID"));
             if ($p->get_value("emailAddress")) {
                 $extraips[$p->get_value("emailAddress")]["name"] = $p->get_name();
                 $extraips[$p->get_value("emailAddress")]["role"] = "manager";
                 $extraips[$p->get_value("emailAddress")]["personID"] = $task->get_value("managerID");
                 $extraips[$p->get_value("emailAddress")]["selected"] = 1;
             }
         }
         // add all the other interested parties
         $ips = interestedParty::get_interested_parties("task", $req["taskID"], $extraips);
         foreach ((array) $ips as $k => $inf) {
             $inf["entity"] = "comment";
             $inf["entityID"] = $commentID;
             $inf["email"] and $inf["emailAddress"] = $inf["email"];
             if ($req["emailto"] == "internal" && !$inf["external"] && !$inf["clientContactID"]) {
                 $id = interestedParty::add_interested_party($inf);
                 $recipients[] = $inf["name"] . " " . add_brackets($k);
             } else {
                 if ($req["emailto"] == "default") {
                     $id = interestedParty::add_interested_party($inf);
                     $recipients[] = $inf["name"] . " " . add_brackets($k);
                 }
             }
         }
         $recipients and $recipients = implode(", ", (array) $recipients);
         $recipients and $TPL["message_good"][] = "Sent email to " . $recipients;
         // Re-email the comment out
         comment::send_comment($commentID, array("interested"), $email_receive);
         // File email away in the task's mail folder
         $mailbox = "INBOX/task" . $task->get_id();
         $email_receive->create_mailbox($mailbox) and $TPL["message_good"][] = "Created mailbox: " . $mailbox;
         $email_receive->move_mail($req["id"], $mailbox) and $TPL["message_good"][] = "Moved email " . $req["id"] . " to " . $mailbox;
         $email_receive->close();
     }
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:78,代码来源:inbox.inc.php

示例6: date

define("NO_AUTH", true);
require_once "../alloc.php";
singleton("errors_fatal", true);
singleton("errors_format", "text");
singleton("errors_logged", true);
singleton("errors_thrown", true);
singleton("errors_haltdb", false);
#$today = $_REQUEST["today"] or $today = date("Y-m-d");
$q = prepare("SELECT invoiceRepeatDate.invoiceRepeatID\n                   , invoiceRepeatDate.invoiceDate\n                   , invoiceRepeat.invoiceID AS templateInvoiceID\n                   , invoiceRepeat.personID AS currentUser\n                   , invoiceRepeat.message\n                   , invoice.invoiceID\n                FROM invoiceRepeatDate\n           LEFT JOIN invoiceRepeat ON invoiceRepeatDate.invoiceRepeatID = invoiceRepeat.invoiceRepeatID\n           LEFT JOIN invoice ON invoice.invoiceRepeatID = invoiceRepeatDate.invoiceRepeatID\n                 AND invoice.invoiceRepeatDate = invoiceRepeatDate.invoiceDate\n               WHERE invoice.invoiceID IS NULL\n                 AND invoiceRepeatDate.invoiceDate <= '%s'", $today);
$orig_current_user =& singleton("current_user");
$db = new db_alloc();
$id = $db->query($q);
while ($row = $db->row($id)) {
    if ($row["currentUser"]) {
        $current_user = new person();
        $current_user->load_current_user($row["currentUser"]);
        singleton("current_user", $current_user);
    }
    #echo "<br>Checking row: ".print_r($row,1);
    $invoice = new invoice();
    $invoice->set_id($row["templateInvoiceID"]);
    $invoice->select();
    $i = new invoice();
    $i->set_value("invoiceRepeatID", $row["invoiceRepeatID"]);
    $i->set_value("invoiceRepeatDate", $row["invoiceDate"]);
    $i->set_value("invoiceNum", invoice::get_next_invoiceNum());
    $i->set_value("clientID", $invoice->get_value("clientID"));
    $i->set_value("projectID", $invoice->get_value("projectID"));
    $i->set_value("invoiceName", $invoice->get_value("invoiceName"));
    $i->set_value("invoiceStatus", "edit");
    $i->set_value("invoiceDateTo", $row["invoiceDate"]);
开发者ID:cjbayliss,项目名称:alloc,代码行数:31,代码来源:checkRepeat.php


注:本文中的person::load_current_user方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。