Пример #1
0
function viewNote()
{
    $sNoteId = trim(getParameter('view_note_id'));
    if ($sNoteId == '' || is_null($sNoteId)) {
        $response = 'Không có note id!';
        $json = new Services_JSON();
        Header('Content-Type: application/json');
        return $json->encode($response);
    }
    global $arrConf;
    $oCustomer = new getInfoMainConsole();
    $oCustomer->callcenter_db_connect($arrConf['cadena_dsn']);
    $result = $oCustomer->getNote($sNoteId);
    // return json
    if (!$result) {
        $response['content'] = 'Lỗi: ' . $oCustomer->errMsg;
    } else {
        $response['note_id'] = $sNoteId;
        $response['content'] = $result['note'];
        //check permission
        $response['permit'] = $oCustomer->checkPermitNote($sNoteId, $_SESSION['callcenter']['extension']);
    }
    $json = new Services_JSON();
    Header('Content-Type: application/json');
    return $json->encode($response);
}