本文整理汇总了PHP中comment::add_comment方法的典型用法代码示例。如果您正苦于以下问题:PHP comment::add_comment方法的具体用法?PHP comment::add_comment怎么用?PHP comment::add_comment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类comment
的用法示例。
在下文中一共展示了comment::add_comment方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_comment_from_email
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;
}
示例2: array
<?php
require "constants.php";
require "config.php";
require "init.php";
$vars = array("quote_id" => $_POST["quote_id"], "username" => $_POST["username"], "user_id" => $_POST["user_id"], "comment" => $_POST["comment"]);
comment::add_comment($vars);
header("Location: " . $_POST["return"]);
示例3: comment
</strong>
</div>
</div>
<div class="mdl-color-text--primary-contrast mdl-card__supporting-text comments">
<?php
// including the comment forum
if (islogin()) {
$comment = $_POST['comment'];
//var_dump($comment);
if (isset($comment) && !empty($comment)) {
echo "comment is set and not empty";
$comobj = new comment();
$comobj->get_comment($ids, $comment);
$comobj->check_exist();
$comobj->add_comment();
//var_dump($comobj);
//die();
}
}
// including the comment forum
include 'display/forms/comment.form.php';
if (islogin()) {
// including the comments
include 'display/functions/comment.func.php';
include 'dbms/dbms_imp.php';
$resultc = $connection->query("SELECT `cid` FROM `comments` WHERE `nid`='{$ids}' ORDER BY `cid` DESC");
mysqli_close($connection);
while ($rows = $resultc->fetch_array()) {
$comm = new comment($rows[0]);
comment($comm);
示例4: move_forwards
function move_forwards()
{
$current_user =& singleton("current_user");
global $TPL;
$status = $this->get_value("status");
$db = new db_alloc();
if ($this->get_value("clientID")) {
$c = $this->get_foreign_object("client");
$extra = " for " . $c->get_value("clientName");
$taskDesc[] = "";
}
$taskname1 = "Sale " . $this->get_id() . ": raise an invoice" . $extra;
$taskname2 = "Sale " . $this->get_id() . ": place an order to the supplier";
$taskname3 = "Sale " . $this->get_id() . ": pay the supplier";
$taskname4 = "Sale " . $this->get_id() . ": deliver the goods / action the work";
$cyberadmin = 59;
$taskDesc[] = "Sale items:";
$taskDesc[] = "";
foreach ((array) $this->get_productSaleItems() as $psiID => $psi_row) {
$p = new product();
$p->set_id($psi_row["productID"]);
$taskDesc[] = " " . page::money($psi_row["sellPriceCurrencyTypeID"], $psi_row["sellPrice"], "%S%mo") . " for " . $psi_row["quantity"] . " x " . $p->get_name();
$hasItems = true;
}
if (!$hasItems) {
return alloc_error("No sale items have been added.");
}
$amounts = $this->get_amounts();
$taskDesc[] = "";
$taskDesc[] = "Total: " . $amounts["total_sellPrice"];
$taskDesc[] = "Total inc " . config::get_config_item("taxName") . ": " . $amounts["total_sellPrice_plus_gst"];
$taskDesc[] = "";
$taskDesc[] = "Refer to the sale in alloc for up-to-date information:";
$taskDesc[] = config::get_config_item("allocURL") . "sale/productSale.php?productSaleID=" . $this->get_id();
$taskDesc = implode("\n", $taskDesc);
if ($status == "edit") {
$this->set_value("status", "allocate");
$items = $this->get_productSaleItems();
foreach ($items as $r) {
$psi = new productSaleItem();
$psi->set_id($r["productSaleItemID"]);
$psi->select();
if (!$db->qr("SELECT transactionID FROM transaction WHERE productSaleItemID = %d", $psi->get_id())) {
$psi->create_transactions();
}
}
} else {
if ($status == "allocate") {
$this->set_value("status", "admin");
// 1. from salesperson to admin
$q = prepare("SELECT * FROM task WHERE projectID = %d AND taskName = '%s'", $cyberadmin, $taskname1);
if (config::for_cyber() && !$db->qr($q)) {
$task = new task();
$task->set_value("projectID", $cyberadmin);
// Cyber Admin Project
$task->set_value("taskName", $taskname1);
$task->set_value("managerID", $this->get_value("personID"));
// salesperson
$task->set_value("personID", 67);
// Cyber Support people (jane)
$task->set_value("priority", 3);
$task->set_value("taskTypeID", "Task");
$task->set_value("taskDescription", $taskDesc);
$task->set_value("dateTargetStart", date("Y-m-d"));
$task->set_value("dateTargetCompletion", date("Y-m-d", date("U") + 60 * 60 * 24 * 7));
$task->save();
$TPL["message_good"][] = "Task created: " . $task->get_id() . " " . $task->get_value("taskName");
$p1 = new person();
$p1->set_id($this->get_value("personID"));
$p1->select();
$p2 = new person();
$p2->set_id(67);
$p2->select();
$recipients[$p1->get_value("emailAddress")] = array("name" => $p1->get_name(), "addIP" => true, "internal" => true);
$recipients[$p2->get_value("emailAddress")] = array("name" => $p2->get_name(), "addIP" => true, "internal" => true);
$comment = $p2->get_name() . ",\n\n" . $taskname1 . "\n\n" . $taskDesc;
$commentID = comment::add_comment("task", $task->get_id(), $comment, "task", $task->get_id());
$emailRecipients = comment::add_interested_parties($commentID, null, $recipients);
// Re-email the comment out, including any attachments
if (!comment::send_comment($commentID, $emailRecipients)) {
alloc_error("Email failed to send.");
} else {
$TPL["message_good"][] = "Emailed task comment to " . $p1->get_value("emailAddress") . ", " . $p2->get_value("emailAddress") . ".";
}
}
} else {
if ($status == "admin" && $this->have_perm(PERM_APPROVE_PRODUCT_TRANSACTIONS)) {
$this->set_value("status", "finished");
if ($_REQUEST["changeTransactionStatus"]) {
$rows = $this->get_productSaleItems();
foreach ($rows as $row) {
$ids[] = $row["productSaleItemID"];
}
if ($ids) {
$q = prepare("UPDATE transaction SET status = '%s' WHERE productSaleItemID in (%s)", $_REQUEST["changeTransactionStatus"], $ids);
$db = new db_alloc();
$db->query($q);
}
}
// 2. from admin to salesperson
//.........这里部分代码省略.........
示例5: singleton
* 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/>.
*/
require_once "../alloc.php";
global $TPL;
$current_user =& singleton("current_user");
// add a comment
$commentID = comment::add_comment($_REQUEST["entity"], $_REQUEST["entityID"], $_REQUEST["comment"], $_REQUEST["commentMaster"], $_REQUEST["commentMasterID"]);
if (!$commentID) {
alloc_error("Could not create comment.", 1);
}
// add additional interested parties
if ($_REQUEST["eo_email"]) {
$other_parties[$_REQUEST["eo_email"]] = array("name" => $_REQUEST["eo_name"], "addIP" => $_REQUEST["eo_add_interested_party"], "addContact" => $_REQUEST["eo_add_client_contact"], "clientID" => $_REQUEST["eo_client_id"]);
}
// add all interested parties
$emailRecipients = comment::add_interested_parties($commentID, $_REQUEST["commentEmailRecipients"], $other_parties);
// We're going to store all the attachments and generated pdf files in this array
$files = array();
// If someone uploads attachments
if ($_FILES) {
$files = rejig_files_array($_FILES);
}
示例6: add_comment
function add_comment($commands)
{
$commentID = comment::add_comment($commands["entity"], $commands["entityID"], $commands["comment_text"]);
// add interested parties
foreach ((array) $commands["ip"] as $k => $info) {
$info["entity"] = "comment";
$info["entityID"] = $commentID;
interestedParty::add_interested_party($info);
}
$emailRecipients = array();
$emailRecipients[] = "interested";
if (defined("ALLOC_DEFAULT_FROM_ADDRESS") && ALLOC_DEFAULT_FROM_ADDRESS) {
list($from_address, $from_name) = parse_email_address(ALLOC_DEFAULT_FROM_ADDRESS);
$emailRecipients[] = $from_address;
}
// Re-email the comment out
comment::send_comment($commentID, $emailRecipients);
return array($status, $message);
}
示例7: mail_reminder
function mail_reminder()
{
// check for a reminder.reminderHash that links off to a token.tokenHash
// this lets us trigger reminders on complex actions, for example create
// a reminder that sends when a task status changes from pending to open
// Note this->reminderTime is going to always be null for the token that
// link to task->moved_from_pending_to_open().
// Whereas the task->reopen_pending_task() will have a reminderTime set.
$ok = true;
if ($this->get_value("reminderHash")) {
$token = new token();
if ($token->set_hash($this->get_value("reminderHash"))) {
list($entity, $method) = $token->execute();
if (is_object($entity) && $entity->get_id()) {
if (!$entity->{$method}()) {
$token->decrement_tokenUsed();
// next time, gadget
$ok = false;
}
}
}
}
if ($ok) {
$recipients = $this->get_all_recipients();
# Reminders can be clients, tasks, projects or "general" - comment threads don't exist for general
if ($this->get_value('reminderType') != 'general') {
# Nowhere to put the subject?
$commentID = comment::add_comment($this->get_value('reminderType'), $this->get_value('reminderLinkID'), $this->get_value('reminderContent'), $this->get_value('reminderType'), $this->get_value('reminderLinkID'));
# Repackage the recipients to become IPs of the new comment
$ips = array();
foreach ((array) $recipients as $id => $person) {
$ip = array();
$ip['name'] = $person['name'];
$ip['addIP'] = true;
$ip['addContact'] = false;
$ip['internal'] = true;
$ips[$person['emailAddress']] = $ip;
}
comment::add_interested_parties($commentID, false, $ips);
# email_receive false or true? false for now... maybe true is better?
comment::send_comment($commentID, array("interested"));
} else {
foreach ((array) $recipients as $person) {
if ($person['emailAddress']) {
$email = sprintf("%s %s <%s>", $person['firstName'], $person['surname'], $person['emailAddress']);
$subject = $this->get_value('reminderSubject');
$content = $this->get_value('reminderContent');
$e = new email_send($email, $subject, $content, "reminder");
$e->send();
}
}
}
// Update reminder (reminderTime can be blank for task->moved_from_pending_to_open)
if ($this->get_value('reminderRecuringInterval') == "No") {
$this->deactivate();
} else {
if ($this->get_value('reminderRecuringValue') != 0) {
$interval = $this->get_value('reminderRecuringValue');
$intervalUnit = $this->get_value('reminderRecuringInterval');
$newtime = $this->get_next_reminder_time(strtotime($this->get_value('reminderTime')), $interval, $intervalUnit);
$this->set_value('reminderTime', date("Y-m-d H:i:s", $newtime));
$this->set_value('reminderAdvNoticeSent', 0);
$this->save();
}
}
}
}
示例8: invoiceItem
$ii = new invoiceItem();
$ii->currency = $i->get_value("currencyTypeID");
$ii->set_value("invoiceID", $i->get_id());
$ii->set_value("iiMemo", $item["iiMemo"]);
$ii->set_value("iiUnitPrice", page::money($ii->currency, $item["iiUnitPrice"], "%mo"));
$ii->set_value("iiAmount", page::money($ii->currency, $item["iiAmount"], "%mo"));
$ii->set_value("iiQuantity", $item["iiQuantity"]);
$ii->save();
#echo "<br>Created invoice item: ".$ii->get_id();
}
if ($row["message"]) {
$ips = interestedParty::get_interested_parties("invoiceRepeat", $row["invoiceRepeatID"]);
$recipients = array();
foreach ($ips as $email => $info) {
$recipients[$email] = $info;
$recipients[$email]["addIP"] = true;
}
$commentID = comment::add_comment("invoice", $i->get_id(), $row["message"], "invoice", $i->get_id());
if ($recipients) {
$emailRecipients = comment::add_interested_parties($commentID, null, $recipients);
comment::attach_invoice($commentID, $i->get_id(), $verbose = true);
// Re-email the comment out, including any attachments
if (!comment::send_comment($commentID, $emailRecipients)) {
alloc_error("Failed to email invoice: " . $i->get_id());
}
}
}
// Put current_user back to normal
$current_user =& $orig_current_user;
singleton("current_user", $current_user);
}