function InitFeedback($_userInitiated = true) { global $USER; Server::InitDataBlock(array("DBCONFIG")); if (empty(Server::$Configuration->Database["gl_fb"])) { return; } $cid = $USER->Browsers[0]->GetLastActiveChatId(); if ($_userInitiated || !empty($cid)) { if ($_userInitiated || Feedback::GetByChatId($cid) == null) { $langparam = isset($_GET["el"]) ? "&el=" . $_GET["el"] : ""; $value = "0;" . base64_encode(LIVEZILLA_URL . "feedback.php?cid=" . Encoding::Base64UrlEncode($cid) . $langparam); $fovl = new OverlayBox(CALLER_USER_ID, CALLER_BROWSER_ID, $value); $fovl->Id = md5($cid . CALLER_USER_ID . CALLER_BROWSER_ID); $fovl->Save(); $fovl->SetStatus(false); } } }
static function GetRatingAVG($_chatId, $ratav = "-") { Server::InitDataBlock(array("DBCONFIG")); $fb = Feedback::GetByChatId($_chatId); if (!empty($fb)) { $fb->LoadCriteriaList(); $scount = 0; $svalue = 0; $scomment = ""; foreach (Server::$Configuration->Database["gl_fb"] as $criteria) { if (!isset($fb->CriteriaList[$criteria->Id])) { continue; } if ($criteria->Type == 0) { $scount++; $svalue += $fb->CriteriaList[$criteria->Id]; } else { if ($criteria->Type == 1) { $scomment .= $fb->CriteriaList[$criteria->Id]; } } $ratav = round($svalue / $scount, 1) . "/5 (" . $scomment . ")"; } } return $ratav; }