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


PHP smail::sbrFeedbackEdit方法代碼示例

本文整理匯總了PHP中smail::sbrFeedbackEdit方法的典型用法代碼示例。如果您正苦於以下問題:PHP smail::sbrFeedbackEdit方法的具體用法?PHP smail::sbrFeedbackEdit怎麽用?PHP smail::sbrFeedbackEdit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在smail的用法示例。


在下文中一共展示了smail::sbrFeedbackEdit方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: editFeedbackNew

/**
 * Простое обновление отзыва  таблице sbr_feedbacks.
 *
 * @param type   $id
 * @param type   $descr
 * @param string $login
 * @param int    $stage_id
 * @param type   $vote
 *
 * @return xajaxResponse
 */
function editFeedbackNew($id, $descr, $login, $stage_id, $vote = null, $sbr_name = null, $stage_name = null)
{
    $stage_id = intval($stage_id);
    $objResponse = new xajaxResponse();
    $request = array('id' => intval($id), 'descr' => $descr);
    if (hasPermissions('sbr')) {
        $request['sbr_name'] = htmlspecialchars($sbr_name);
        $request['stage_name'] = htmlspecialchars($stage_name);
    }
    if ($vote !== null) {
        $vote = (int) $vote < 0 ? -1 : ((int) $vote > 0 ? 1 : 0);
        $request += array('ops_type' => $vote);
    }
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
    if ($login && hasPermissions('sbr')) {
        $user = new users();
        $user->GetUser($login);
        if (!$user->uid) {
            $error = 'Ошибка';
        }
        $sbr = sbr_meta::getInstance(sbr_meta::ADMIN_ACCESS, $user, is_emp($user->role));
    } else {
        $sbr = sbr_meta::getInstance();
    }
    $ele_id = 'form_container_' . $id;
    $link_id = 'ops_edit_link_' . $id;
    $text_id = 'op_message_' . $id;
    if ($sbr) {
        $stage = $sbr->initFromStage($stage_id, false);
    }
    if ($stage) {
        $old_fbk = $stage->getFeedback(intval($id));
        if (strtotime($old_fbk['posted_time']) + 3600 * 24 < time() && !hasPermissions('users')) {
            $error = "'Ошибка'";
            $objResponse->script("\$('{$link_id}').setStyle('display', 'block');");
            $objResponse->script("\$('{$text_id}').setStyle('display', 'block');");
            $objResponse->script("\$('{$ele_id}').setStyle('display', 'none');");
        } else {
            $feedback = $stage->feedback($request);
            if (hasPermissions('sbr')) {
                sbr_meta::setNamesSBR($request['sbr_name'], $request['stage_name'], $stage->data['sbr_id'], $stage_id);
                $objResponse->script("\$('sbr_name_{$id}').set('text', '{$sbr_name}');");
                $objResponse->script("\$('stage_name_{$id}').set('text', '{$stage_name}');");
            }
            if ($stage->error['feedback']) {
                $error = 'Ошибка';
                if ($stage->error['feedback']['descr']) {
                    $error = $stage->error['feedback']['descr'];
                }
            }
        }
    }
    if ($error) {
        $objResponse->script("alert({$error});");
        return $objResponse;
    }
    $userId = $sbr->uid == $sbr->emp_id ? $sbr->frl_id : $sbr->emp_id;
    $moderId = get_uid(false);
    if ($userId != $moderId) {
        $mail = new smail();
        $mail->sbrFeedbackEdit($old_fbk['id'], $userId, $moderId, $sbr);
    }
    if ($login) {
        $user = new users();
        $user->GetUserByUID($sbr->uid == $sbr->emp_id ? $sbr->frl_id : $sbr->emp_id);
        $rating = round($user->rating, 2);
        $objResponse->script("\$\$('.pp-rate span.form-in').set('html', {$rating});");
    }
    $cont_id = 'cont_' . $id;
    if ($vote !== null) {
        $cls = '';
        switch ((int) $vote) {
            case -1:
                $cls = 'b-button_poll_minus';
                break;
            case 0:
                $cls = 'b-button_poll_multi';
                break;
            case 1:
                $cls = 'b-button_poll_plus';
                break;
            default:
                $cls = 'b-button_poll_multi';
                break;
        }
        //$objResponse->script("$('$cont_id').removeClass('b-post__voice_negative'); $('$cont_id').removeClass('b-post__voice_neutral');$('$cont_id').removeClass('b-post__voice_plus');$('$cont_id').addClass('$cls');");
        $objResponse->script("\$('{$cont_id}').removeClass('b-button_poll_minus').removeClass('b-button_poll_plus').removeClass('b-button_poll_multi');\$('{$cont_id}').addClass('{$cls}');");
    }
    $ot = $old_fbk['rating'] == 1 ? 'plus' : ($old_fbk['rating'] == -1 ? 'minus' : 'neitral');
//.........這裏部分代碼省略.........
開發者ID:kapai69,項目名稱:fl-ru-damp,代碼行數:101,代碼來源:sbr.server.php


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