當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Operator::GetOperatorById方法代碼示例

本文整理匯總了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;
}
開發者ID:kapai69,項目名稱:fl-ru-damp,代碼行數:62,代碼來源:client.php


注:本文中的Operator::GetOperatorById方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。