本文整理汇总了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');
//.........这里部分代码省略.........