本文整理汇总了PHP中Chat::SetValues方法的典型用法代码示例。如果您正苦于以下问题:PHP Chat::SetValues方法的具体用法?PHP Chat::SetValues怎么用?PHP Chat::SetValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chat
的用法示例。
在下文中一共展示了Chat::SetValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: demandChats
function demandChats($xml = "", $q_filter = "", $q_searchw = "")
{
global $RESPONSE, $DUT;
if (!isDataUpdate(POST_INTERN_DUT_CHATS, DATA_UPDATE_KEY_CHATS)) {
return;
}
$loads = !empty($_POST["p_dc_l"]) && is_numeric($_POST["p_dc_l"]) ? $_POST["p_dc_l"] : DATA_DEMAND_LOADS;
$limit = !empty($_POST["p_dc_p"]) && is_numeric($_POST["p_dc_p"]) && $_POST["p_dc_p"] > 1 ? ($_POST["p_dc_p"] - 1) * $loads : 0;
if (!empty($_POST["p_dc_fg"])) {
$q_filter = "`chat_type`=2 AND `group_id`='" . DBManager::RealEscape($_POST["p_dc_fg"]) . "'";
} else {
if (!empty($_POST["p_dc_fe"])) {
$q_filter = "`chat_type`=1 AND `external_id`='" . DBManager::RealEscape($_POST["p_dc_fe"]) . "'";
} else {
if (!empty($_POST["p_dc_fi"])) {
$q_filter = "`chat_type`=0 AND `internal_id`='" . DBManager::RealEscape($_POST["p_dc_fi"]) . "'";
} else {
if (!isset($_POST["p_dc_f"])) {
$_POST["p_dc_f"] = "012";
}
$fchars = str_split($_POST["p_dc_f"]);
foreach ($fchars as $fchar) {
if (is_numeric($fchar)) {
if (!empty($fchar)) {
$q_filter .= empty($q_filter) ? "`chat_type`=" . $fchar : " OR `chat_type`=" . $fchar;
} else {
$q_filter .= empty($q_filter) ? "`chat_type`=0" : " OR `chat_type`=0";
}
}
}
if (!empty($_POST["p_dc_q"])) {
$q = DBManager::RealEscape(strtolower($_POST["p_dc_q"]));
$q_searchw = "LOWER(`fullname`) LIKE '%" . $q . "%' OR LOWER(`area_code`) LIKE '%" . $q . "%' OR LOWER(`html`) LIKE '%" . $q . "%' OR LOWER(`plaintext`) LIKE '%" . $q . "%' OR LOWER(`transcript_text`) LIKE '%" . $q . "%' OR LOWER(`email`) LIKE '%" . $q . "%' OR LOWER(`company`) LIKE '%" . $q . "%' OR LOWER(`phone`) LIKE '%" . $q . "%' OR LOWER(`chat_id`) LIKE '%" . $q . "%' OR LOWER(`external_id`) LIKE '%" . $q . "%' OR LOWER(`question`) LIKE '%" . $q . "%'";
$q_searchw = " AND (" . $q_searchw . ")";
}
}
}
}
initData(array("INPUTS"));
$q_base = "`closed`>0 AND `html`!='0'";
$q_grperm = Chat::GetPermissionSQL(CALLER_SYSTEM_ID);
$q_inner = "FROM `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` WHERE " . $q_base . " AND (" . $q_filter . ")" . $q_searchw . $q_grperm . " ORDER BY `closed` DESC";
$result = queryDB(true, "SELECT * " . $q_inner . " LIMIT " . $limit . "," . DBManager::RealEscape($loads) . ";");
if ($result) {
while ($row = DBManager::FetchArray($result)) {
$chat = new Chat();
$chat->SetValues($row);
$xml .= $chat->GetXML($chat->Permission(CALLER_SYSTEM_ID), true, false);
}
}
$q_count["total"] = "SELECT COUNT(*) AS `total`";
$q_count["totalperm"] = "(SELECT COUNT(*) FROM (SELECT `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "`.`chat_id` FROM `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` WHERE " . $q_base . $q_grperm . ") AS `sta`) AS `totalperm`";
$q_count["totalquery"] = "(SELECT COUNT(*) FROM (SELECT `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "`.`chat_id` " . $q_inner . ") AS `stb`) AS `totalquery`";
$result = queryDB(true, $q_count["total"] . "," . $q_count["totalperm"] . "," . $q_count["totalquery"] . " FROM `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "`");
$row = DBManager::FetchArray($result);
$c_total = min($row["total"], $row["totalperm"]);
$c_totalquery = min($row["totalquery"], $row["totalperm"]);
$RESPONSE->Archive .= "<dc dut=\"" . base64_encode($DUT[DATA_UPDATE_KEY_CHATS]) . "\" p=\"" . base64_encode($loads) . "\" t=\"" . base64_encode($c_total) . "\" q=\"" . base64_encode($c_totalquery) . "\">\r\n" . $xml . "\r\n</dc>";
}
示例2: ChatsList
function ChatsList()
{
$sql_limit = "";
if (!empty($_POST["p_limit"])) {
if (is_numeric($_POST["p_limit"])) {
$sql_limit = " LIMIT " . $_POST["p_limit"];
} else {
$this->ErrorFilter = "Limit";
return;
}
}
$sql_where = "WHERE `closed`>0";
if (!empty($_POST["p_chatid"])) {
$sql_where .= " AND `chat_id`='" . DBManager::RealEscape($_POST["p_chatid"]) . "'";
}
if (!empty($_POST["p_group"])) {
$sql_where .= " AND `group_id`='" . DBManager::RealEscape($_POST["p_group"]) . "'";
}
if (!empty($_POST["p_operator"])) {
$opsid = Operator::GetSystemId($_POST["p_operator"]);
if ($opsid != null) {
$sql_where .= " AND `internal_id`='" . DBManager::RealEscape($opsid) . "'";
} else {
$this->ErrorFilter = "Operator";
return;
}
}
if (!empty($_POST["p_start_after"])) {
if (is_numeric($_POST["p_start_after"]) && !empty($_POST["p_start_after"])) {
$sql_where .= " AND `time` > " . $_POST["p_start_after"];
} else {
$this->ErrorFilter = "Start After";
return;
}
}
if (!empty($_POST["p_start_before"])) {
if (is_numeric($_POST["p_start_before"]) && !empty($_POST["p_start_before"])) {
$sql_where .= " AND `time` < " . $_POST["p_start_before"];
} else {
$this->ErrorFilter = "Start Before";
return;
}
}
$results = array("Chats" => array());
$result = DBManager::Execute(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` " . $sql_where . " ORDER BY `chat_id` ASC " . $sql_limit . ";");
while ($row = DBManager::FetchArray($result)) {
$chat = new Chat($row["chat_id"]);
$chat->SetValues($row, true);
if (isset($_POST["p_output"])) {
if ($_POST["p_output"] == "HTML") {
unset($chat->Plaintext);
}
if ($_POST["p_output"] == "Plaintext") {
unset($chat->HTML);
}
}
$results["Chats"][] = array("Chat" => ApiV2::ClearObject(ApiV2::GetObjectFields("Chat"), $chat));
}
$this->JSONOutput = APIV2::Encode($results, $this->JSONParams);
}