本文整理汇总了PHP中Operator::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Operator::getInstance方法的具体用法?PHP Operator::getInstance怎么用?PHP Operator::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Operator
的用法示例。
在下文中一共展示了Operator::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: operatorSubmitted
function operatorSubmitted()
{
$operator = Operator::getInstance()->GetLoggedOperator();
$TML = new SmartyClass();
setOperator($TML);
$TML->assign('mode', 'profile');
$toCheck = array('login' => 'form.field.login', 'fullname' => 'form.field.agent_name', 'email' => 'form.field.agent_email');
foreach ($toCheck as $field => $res) {
if (empty($_REQUEST[$field])) {
$errors[] = Resources::Get("errors.required", array(Resources::Get($res)));
}
}
if (empty($errors) && !preg_match("/^[\\w_]+\$/", $_REQUEST['login'])) {
$errors[] = Resources::Get("page_agent.error.wrong_login");
}
if ($_REQUEST['password'] != $_REQUEST['password_confirm']) {
$errors[] = Resources::Get('my_settings.error.password_match');
}
if (!empty($_REQUEST['password']) && md5($_REQUEST['password_existing']) != $operator['password']) {
$errors[] = Resources::Get('my_settings.error.password_existing');
}
$hash = array();
$requestFile = $_FILES['avatarFile'];
if (empty($errors) && isset($requestFile) && !empty($requestFile['name']) && $requestFile['size'] > 0 && $requestFile['error'] == 0) {
$res = Operator::getInstance()->UploadOperatorAvatar($operator['operatorid'], $requestFile);
if (isset($res)) {
$errors[] = $res;
}
if (empty($errors)) {
$hash['avatar'] = Operator::getInstance()->getAvatarURL($operator['operatorid'], $requestFile['name']);
}
}
if (empty($errors)) {
$hash['login'] = $_REQUEST['login'];
$hash['email'] = $_REQUEST['email'];
$hash['fullname'] = $_REQUEST['fullname'];
if (!empty($_REQUEST['password'])) {
$hash['password'] = md5($_REQUEST['password']);
}
Operator::getInstance()->UpdateOperator($operator['operatorid'], $hash);
Operator::getInstance()->RefreshSessionOperator();
header("Location: " . WEBIM_ROOT . "/operator/profile.php");
exit;
}
foreach (array('login', 'email', 'fullname') as $f) {
$TML->assign($f, $_REQUEST[$f]);
}
$TML->assign('errors', $errors);
$TML->display('../templates/operator.tpl');
exit;
}
示例2: getImageNameFromParam
public static function getImageNameFromParam($pImage, $pDepartmentKey = null, $pLang = null, $pImagePostfix = null, $hasOnline = null)
{
if (!preg_match('/\\.(gif|jpg|png)$/i', $pImage)) {
$image = $pImage . '.gif';
} else {
$image = $pImage;
}
if (empty($pLang) || !Resources::IsLocaleAvailable($pLang)) {
$lang = Resources::getCurrentLocale();
} else {
$lang = $pLang;
}
if (empty($pImagePostfix)) {
if (empty($hasOnline)) {
$image_postfix = Operator::getInstance()->hasOnlineOperators($pDepartmentKey, $lang) ? 'on' : 'off';
} else {
$image_postfix = $hasOnline ? 'on' : 'off';
}
} else {
$image_postfix = $pImagePostfix;
}
$image = preg_replace('/\\.(gif|jpg|png)/i', '_' . $image_postfix . '.\\1', $image);
return "/themes/.buttons/{$lang}/{$image}";
}
示例3: getReportLostOrInterceptedByOperator
protected function getReportLostOrInterceptedByOperator($start, $end, $intercepted = false, $departmentid = null, $locale = null)
{
$afrom = '';
$awhere = '';
$params = array('p_start' => $start, 'p_end' => $end);
if ($departmentid !== null || $locale !== null) {
$afrom = '
LEFT JOIN
"{operatorlastaccess}" o
ON
lv."operatorid" = o."operatorid"
';
if ($departmentid !== null) {
$awhere .= '
AND lv."operatorid" IN (
SELECT "operatorid"
FROM "{operatordepartment}"
WHERE "departmentid" = :departmentid
)
';
$params['departmentid'] = $departmentid;
}
if ($locale !== null) {
$awhere .= 'AND (o."locales" LIKE :locale OR o."locales" IS NULL)';
$params['locale'] = '%' . $locale . '%';
}
}
$sql = 'SELECT
lv."operatorid" "opid",
COUNT(lv."id") "lost_vistors_count",
AVG(lv."waittime") "avg_waittime"
FROM
"{lostvisitor}" lv
LEFT JOIN
"{thread}" t
ON
t."threadid" = lv."threadid"
' . $afrom . '
WHERE
WM_UNIX_TIMESTAMP(t."created") >= :p_start
AND
WM_UNIX_TIMESTAMP(t."created") < :p_end
AND
lv."anotheroperatorid" IS ' . ($intercepted ? 'NOT' : '') . ' NULL
' . $awhere . '
GROUP BY lv."operatorid"';
try {
$this->db->Query($sql, $params);
$result = array();
while ($this->db->nextRecord()) {
$row = $this->db->getRow();
$result[$row['opid']] = $row;
$result[$row['opid']]['avg_waittime_str'] = (int) ($result[$row['opid']]['avg_waittime'] / 60) . ':' . $result[$row['opid']]['avg_waittime'] % 60;
}
} catch (Exception $e) {
}
$query = 'SELECT lv."operatorid" FROM "{operatorlastaccess}" lv ' . $afrom . ' WHERE 1=1 ' . $awhere;
try {
$this->db->Query($query, array_slice($params, 2, 2));
$operators = array();
while ($this->db->nextRecord()) {
$row = $this->db->getRow();
$operators[$row['operatorid']] = null;
}
} catch (Exception $e) {
}
if (count($operators) == 0) {
return;
}
foreach (array_keys($operators) as $id) {
$operator = Operator::getInstance()->GetOperatorById($id);
if (!isset($result[$id])) {
$result[$id] = array('opid' => $id, 'lost_vistors_count' => 0, 'avg_waittime' => 0, 'dispersion' => 0, 'avg_waittime' => 0, 'st_deviation' => 0);
}
$result[$id]['name'] = $operator['fullname'];
}
$sql = 'SELECT
lv."operatorid" "opid",
lv."waittime"
FROM
"{lostvisitor}" lv
LEFT JOIN
"{thread}" t
ON
t."threadid" = lv."threadid"
WHERE
WM_UNIX_TIMESTAMP(t."created") >= :p_start
AND
WM_UNIX_TIMESTAMP(t."created") < :p_end
AND
lv."anotheroperatorid" IS ' . ($intercepted ? 'NOT' : '') . ' NULL
';
try {
$this->db->Query($sql, array('p_start' => $start, 'p_end' => $end));
while ($this->db->nextRecord()) {
$row = $this->db->getRow();
if ($result[$row['opid']]['lost_vistors_count'] == 0) {
continue;
}
if (!isset($result[$row['opid']]['dispersion'])) {
//.........这里部分代码省略.........
示例4: displayChooseOperator
function displayChooseOperator($chooseoperator)
{
$departmentkey = verify_param('departmentkey', "/^\\w+\$/");
$onlineOperators = Operator::getInstance()->getOnlineOperators(null, $departmentkey, Resources::getCurrentLocale());
$TML = new SmartyClass();
// $TML->assign('ismandatory', $isMandatory);
if ($chooseoperator == 'optional') {
$onlineOperators = array_merge(array(array('operatorid' => '', 'fullname' => Resources::Get('chooseoperator.any'))), $onlineOperators);
} else {
$onlineOperators = array_merge(array(array('operatorid' => 0, 'fullname' => Resources::Get('chooseoperator.select'))), $onlineOperators);
}
$TML->assign('mode', $chooseoperator);
$TML->assign('onlineOperators', $onlineOperators);
showChoose($TML, 'operatorid', 'choose-operator.tpl');
}
示例5: dirname
<?php
/*
*
* Данный файл является частью проекта Веб Мессенджер.
*
* Все права защищены. (c) 2005-2009 ООО "ТОП".
* Данное программное обеспечение и все сопутствующие материалы
* предоставляются на условиях лицензии, доступной по адресу
* http://webim.ru/license.html
*
*/
$TITLE_KEY = 'leftMenu.auto_invites';
require_once dirname(__FILE__) . '/inc/admin_prolog.php';
require_once '../classes/functions.php';
require_once '../classes/class.operator.php';
require_once '../classes/class.smartyclass.php';
require_once '../classes/models/generic/class.mapperfactory.php';
Operator::getInstance()->IsCurrentUserAdminOrRedirect();
$TML = new SmartyClass($TITLE_KEY);
$TML->assign('invites', MapperFactory::getMapper('AutoInvite')->getAll());
$TML->display('auto_invites.tpl');
示例6: get_operators_list
function get_operators_list()
{
$operators = Operator::getInstance()->GetAllAccessedOperators();
$result = array();
$result[''] = Resources::Get('search.any.operator');
if (!empty($operators)) {
foreach ($operators as $op) {
$result[$op['operatorid']] = $op['fullname'];
}
}
return $result;
}
示例7:
<?php
/*
*
* Данный файл является частью проекта Веб Мессенджер.
*
* Все права защищены. (c) 2005-2009 ООО "ТОП".
* Данное программное обеспечение и все сопутствующие материалы
* предоставляются на условиях лицензии, доступной по адресу
* http://webim.ru/license.html
*
*/
require_once '../classes/functions.php';
require_once '../classes/class.operator.php';
Operator::getInstance()->Logout();
header('Location: ' . WEBIM_ROOT . '/operator/login.php');
exit;
示例8: getAdvancedReport
//.........这里部分代码省略.........
ORDER BY o.operatorid';
try {
$this->db->Query($sql, $params);
$result = array();
while ($this->db->nextRecord()) {
$row = $this->db->getRow();
$row['online_sum_chatting_time_seconds'] = $row['online_sum_chat_time_seconds'];
//Cause indetifiers more than 30 chars not suppoted by Oracle
unset($row['online_sum_chat_time_seconds']);
$result[$row['opid']] = $row;
$result[$row['opid']]['threads'] = 0;
$result[$row['opid']]['msgs'] = 0;
$result[$row['opid']]['avglen'] = 0;
if (!$result[$row['opid']]['online_time']) {
$result[$row['opid']]['online_time'] = 0;
}
if (!$result[$row['opid']]['online_sum_chatting_time']) {
$result[$row['opid']]['online_sum_chatting_time'] = 0;
}
if (!$result[$row['opid']]['online_chatting_time']) {
$result[$row['opid']]['online_chatting_time'] = 0;
}
if (!$result[$row['opid']]['online_sum_chatting_time_seconds']) {
$result[$row['opid']]['online_sum_chatting_time_seconds'] = 0;
}
$result[$row['opid']]['online_avg_chatting_time'] = 0;
}
} catch (Exception $e) {
}
if (empty($result)) {
return array();
}
foreach ($result as $id => $data) {
$operator = Operator::getInstance()->GetOperatorById($id);
$result[$id]['name'] = $operator['fullname'];
}
$sql = 'SELECT
m."operatorid" "opid",
COUNT(DISTINCT(m."threadid")) "threads",
SUM(
(
SELECT COUNT(*)
FROM "{message}" mi
WHERE
mi."messageid" = m."messageid"
AND mi."kind" = :kind
)
) "msgs",
AVG(LENGTH(m."message")) "avglen"
FROM
"{message}" m
WHERE
m."operatorid" IS NOT NULL
AND
m."operatorid" IN (' . implode(', ', array_keys($result)) . ')
AND
WM_UNIX_TIMESTAMP(m."created") >= :p_start
AND
WM_UNIX_TIMESTAMP(m."created") < :p_end
GROUP BY
m."operatorid"';
try {
$this->db->Query($sql, array('kind' => KIND_AGENT, 'p_start' => $start, 'p_end' => $end));
while ($this->db->nextRecord()) {
$row = $this->db->getRow();
$result[$row['opid']] = array_merge($result[$row['opid']], $row);
示例9: handleWithoutToken
function handleWithoutToken($threadid, $viewonly)
{
$TML = new SmartyClass();
$operator = Operator::getInstance()->GetLoggedOperator();
$remote_level = Browser::GetRemoteLevel($_SERVER['HTTP_USER_AGENT']);
if ($remote_level != "ajaxed") {
die("old browser is used, please update it");
}
$thread = Thread::getInstance()->GetThreadById($threadid);
if (!$thread || !isset($thread['token'])) {
die("wrong thread");
}
if ($viewonly && $operator['operatorid'] != $thread['operatorid']) {
redirectToPageWithToken($thread, $viewonly, $remote_level);
}
$forcetake = verify_param("force", "/^true\$/", false);
if ($forcetake) {
ThreadProcessor::getInstance()->ProcessThread($thread['threadid'], 'operator_force_join', array("operatorid" => $operator["operatorid"]));
redirectToPageWithToken($thread, null, $remote_level);
} else {
// is taken by another
$visitSession = VisitSession::GetInstance()->GetVisitSessionById($thread['visitsessionid']);
if ($thread['state'] != STATE_CLOSED && !empty($thread['operatorid']) && $operator['operatorid'] != $thread['operatorid'] && $operator['operatorid'] != $thread['nextoperatorid']) {
$page = array('visitor' => $visitSession['visitorname'], 'agent' => $thread['operatorfullname'], 'force' => true, 'takelink' => $_SERVER['PHP_SELF'] . "?thread={$threadid}&force=true", 'viewlink' => $_SERVER['PHP_SELF'] . "?thread={$threadid}&viewonly=true", 'priority' => $thread['state'] == STATE_QUEUE_EXACT_OPERATOR || $thread['state'] == STATE_CHATTING_OPERATOR_BROWSER_CLOSED_REFRESHED);
// TODO get rid of STATE_WAIT_ANOTHER_OPERATOR
$TML->assign('link_arguments', "&thread={$threadid}");
$TML->assign('page', $page);
$TML->display('confirm.tpl');
exit;
}
// is closed
if ($thread['state'] == STATE_CLOSED) {
$page = array('viewlink' => $_SERVER['PHP_SELF'] . "?thread=" . $threadid . "&viewonly=true", 'force' => false, 'thread_id' => $threadid, 'closed' => true);
$TML->assign('link_arguments', "&thread={$threadid}");
$TML->assign('page', $page);
$TML->display('confirm.tpl');
exit;
}
}
ThreadProcessor::getInstance()->ProcessThread($thread['threadid'], 'operator_join', array('operatorid' => $operator['operatorid']));
redirectToPageWithToken($thread, $viewonly, $remote_level);
}
示例10: sendFormSubmitted
function sendFormSubmitted()
{
$login = trim($_REQUEST['login']);
if (empty($login)) {
return Resources::Get("errors.required", array(Resources::Get('form.field.login')));
}
$o = Operator::getInstance()->GetOperatorByLogin($login);
if (empty($o)) {
return Resources::Get("errors.operator_not_found", array(Resources::Get('form.field.login')));
}
Operator::getInstance()->SendRecoverPasswordMail($o['operatorid'], $_SERVER['HTTP_HOST']);
}
示例11: UserDelete
function UserDelete($id)
{
Operator::getInstance()->DeleteOperator($id);
}
示例12: setAllDepartments
function setAllDepartments()
{
global $TML;
$operator = Operator::getInstance()->GetLoggedOperator(false);
$departments = MapperFactory::getMapper("OperatorDepartment")->enumDepartmentsWithOperator($operator['operatorid'], Resources::getCurrentLocale());
$TML->assign('departments', $departments);
}
示例13: smarty_block_role_admin
function smarty_block_role_admin($params, $content, &$smarty, &$repeat)
{
$o = Operator::getInstance()->GetLoggedOperator(false);
return $o['role'] == 'admin' ? $content : '';
}
示例14: setcookie
$res = true;
} else {
$res = false;
}
$_COOKIE[WEBIM_COOKIE_VISITOR_IN_CHAT] = $res;
setcookie(WEBIM_COOKIE_VISITOR_IN_CHAT, $res, time() + 30, '/');
}
$user_in_chat = false;
if($_COOKIE[WEBIM_COOKIE_VISITOR_IN_CHAT]) {
$user_in_chat = true;
}
$invite_image = $location . "/themes/" . Browser::getCurrentTheme() . '/images/default-auto-invite-operator.gif';
if($operators_count == 1) {
$operator = Operator::getInstance()->GetOperatorById(array_shift($operators));
if(!empty($operator) && !empty($operator['avatar'])) {
$invite_image = $operator['avatar'];
}
}
$json = new Json(SERVICES_JSON_LOOSE_TYPE);
$statistics = getUsersStatsFromCookie();//isset($_COOKIE[WEBIM_COOKIE_AUTOINVITE_STATS]) ? $json->decode($_COOKIE[WEBIM_COOKIE_AUTOINVITE_STATS]) : null;
$total_time_on_site = isset($_COOKIE[WEBIM_COOKIE_TOTAL_TIME_ON_SITE]) ? intval($_COOKIE[WEBIM_COOKIE_TOTAL_TIME_ON_SITE]) : 0;
$visited_pages = array();
if(isset($statistics['visited_pages']) && is_array($statistics['visited_pages'])) {
foreach ($statistics['visited_pages'] as $p) {
if(isset($p['url'], $p['time'], $p['referrer'])) {
示例15: getAvatar
function getAvatar($operatorId)
{
$operator = Operator::getInstance()->GetOperatorById($operatorId);
$avatar = $operator['avatar'];
return $avatar;
}