本文整理匯總了PHP中Operator::GetOperatorById方法的典型用法代碼示例。如果您正苦於以下問題:PHP Operator::GetOperatorById方法的具體用法?PHP Operator::GetOperatorById怎麽用?PHP Operator::GetOperatorById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Operator
的用法示例。
在下文中一共展示了Operator::GetOperatorById方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createNewThread
function createNewThread()
{
$extAddr = Browser::GetExtAddr();
$remoteHost = !empty($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : $extAddr;
$visitSessionId = VisitSession::GetInstance()->updateCurrentOrCreateSession();
$params = array();
$params['visitsessionid'] = $visitSessionId;
$params['lastpingvisitor'] = null;
// $canChangeName = Visitor::getInstance()->canVisitorChangeName();
// if (!empty($_REQUEST['visitorname']) && $canChangeName) {
// Visitor::getInstance()->setVisitorNameCookie($_REQUEST['visitorname']);
// $params['visitorname'] = $_REQUEST['visitorname'];
// }
$operatorid = verify_param('operatorid', "/^(\\d)\$/");
$departmentkey = verify_param('departmentkey', "/^\\w+\$/");
$autoinviteid = verify_param('autoinviteid', "/^\\d+\$/");
if (!empty($departmentkey)) {
$department = MapperFactory::getMapper('Department')->getByDepartmentKey($departmentkey);
$params['departmentid'] = $department['departmentid'];
}
// else {
// $departments = MapperFactory::getMapper("Department")->enumDepartments(Resources::getCurrentLocale());
//
// if (count($departments) == 1) {
// $params['departmentid'] = $departments[0]['departmentid'];
// }
// }
//
$startThreadState = null;
if (!empty($operatorid) && ($operator = Operator::GetOperatorById($operatorid))) {
$params['nextoperatorid'] = $operator['operatorid'];
$startThreadState = STATE_LOADING_FOR_EXACT_OPERATOR;
} else {
$startThreadState = STATE_LOADING;
}
$thread = Thread::getInstance()->CreateThread(Resources::getCurrentLocale(), $startThreadState, $params);
VisitSession::GetInstance()->UpdateVisitSession($visitSessionId, array('hasthread' => 1));
set_has_threads(HAS_THREADS_FILE);
// если пользователь не ввел email, то по умолчанию сообщаем email с основной базы
if (empty($_REQUEST['email']) && !empty($_SESSION['uid'])) {
$_REQUEST['email'] = $GLOBALS['DB']->val('SELECT email FROM users WHERE uid = ?', $_SESSION['uid']);
}
Thread::getInstance()->sendFirstMessageWithVisitorInfo($thread, $_REQUEST);
if (!empty($autoinviteid)) {
Thread::getInstance()->sendAutoIniviteTextToOperator($thread, $autoinviteid);
}
$visitor = GetVisitorFromRequestAndSetCookie();
$opener = Thread::getInstance()->getOpenerWithTitle();
VisitSession::GetInstance()->setVisitSessionCurrentPage($visitor['id'], $opener[0], $opener[1]);
if (!empty($_REQUEST['message'])) {
$v = GetVisitorFromRequestAndSetCookie();
$hash = array();
$hash['sendername'] = $v['name'];
$hash['message'] = $_REQUEST['message'];
ThreadProcessor::getInstance()->ProcessThread($thread['threadid'], 'visitor_message', $hash);
}
if (!empty($email) || !empty($phone)) {
Thread::getInstance()->PostMessage($thread['threadid'], KIND_FOR_AGENT, Resources::get('start.chat.info', array($email, $phone)));
}
// MapperFactory::getMapper("Thread")->incrementVisitorMessageCount($threadid);
return $thread;
}