1) Импортировать product-credits_quiz.xml
2) Отредактировать файлы
================================
Файл: quiz.php
================================
НАЙТИ:
--------------------------------
$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
--------------------------------
ДОБАВИТЬ НИЖЕ:
--------------------------------
if ($vbulletin->userinfo['credits'] < $Quiz['credit_cost'])
{
eval(standard_error(fetch_error('credits_quiz_notenough', vb_number_format($Quiz['credit_cost'], $vbulletin->options['credits_decimals']), $vbphrase['credits'])));
}
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET credits = credits - " . $Quiz['credit_cost'] . " WHERE userid = " . $vbulletin->userinfo['userid']);
--------------------------------
НАЙТИ:
--------------------------------
$Report .= "[/list]\n\nYour overall score was: {$Overall}%";
--------------------------------
ДОБАВИТЬ НИЖЕ:
--------------------------------
$prize = $Quiz['credit_prize'];
if ($Quiz['credit_multiply'])
{
$prize *= ($Overall / 100);
}
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET credits = credits + $prize WHERE userid = " . $vbulletin->userinfo['userid']);
$Report .= "\n" . construct_phrase($vbphrase['credits_prizestring'], vb_number_format($prize, $vbulletin->options['credits_decimals']), $vbphrase['credits']);
================================
Файл: admincp/admin_quiz.php
================================
НАЙТИ:
--------------------------------
Print_My_DDM("Allow users who have finished the quiz to view the correct answers?","q_viewanswer",$viewanswer,-1);
--------------------------------
ДОБАВИТЬ НИЖЕ:
--------------------------------
print_input_row($vbphrase['credit_cost'], 'credit_cost', 0);
print_input_row($vbphrase['credit_prize'], 'credit_prize', 0);
print_yes_no_row($vbphrase['credit_multiply'], 'credit_multiply', 1);
--------------------------------
НАЙТИ:
--------------------------------
Print_My_DDM("Allow users who have finished the quiz to view the correct answers?","q_viewanswer",$viewanswer,$quiz['q_viewanswer']);
--------------------------------
ДОБАВИТЬ НИЖЕ:
--------------------------------
print_input_row($vbphrase['credit_cost'], 'credit_cost', $quiz['credit_cost']);
print_input_row($vbphrase['credit_prize'], 'credit_prize', $quiz['credit_prize']);
print_yes_no_row($vbphrase['credit_multiply'], 'credit_multiply', $quiz['credit_multiply']);
--------------------------------
НАЙТИ:
--------------------------------
$DB->query("delete from ".TABLE_PREFIX."quiz_submissions where sid='{$sub['sid']}'");
--------------------------------
ДОБАВИТЬ НИЖЕ:
--------------------------------
$subuser = fetch_userinfo($sub['s_from']);
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET credits = credits + " . $vbulletin->usergroupcache[$subuser['usergroupid']]['credit_makequiz'] . " WHERE userid = " . $subuser['userid']);
--------------------------------
НАЙТИ:
--------------------------------
$DB->query("insert into ".TABLE_PREFIX."quiz
(q_name,q_state,q_perms,q_start,q_end,q_autoend,q_timelimit,q_viewanswer,q_desc,q_forcat,q_image)
values
('{$q_name}',{$q_state},'{$Perms}',".time().",{$End_Time},{$q_autoend},{$q_timelimit},{$q_viewanswer},'{$q_desc}',$q_forcat,'{$q_image}')");
--------------------------------
ЗАМЕНИТЬ ЭТИМ:
--------------------------------
$vbulletin->input->clean_array_gpc('r', array(
'credit_cost' => TYPE_NUM,
'credit_prize' => TYPE_NUM,
'credit_multiply' => TYPE_BOOL
));
$db->query_write("
INSERT INTO " . TABLE_PREFIX . "quiz
(
q_name,
q_state,
q_perms,
q_start,
q_end,
q_autoend,
q_timelimit,
q_viewanswer,
q_desc,
q_forcat,
q_image,
credit_cost,
credit_prize,
credit_multiply
)
VALUES
(
'$q_name',
$q_state,
'$Perms',
" . TIMENOW . ",
$End_Time,
$q_autoend,
$q_timelimit,
$q_viewanswer,
'$q_desc',
$q_forcat,
'$q_image',
" . $vbulletin->GPC['credit_cost'] . ",
" . $vbulletin->GPC['credit_prize'] . ",
" . $vbulletin->GPC['credit_multiply'] . "
)
");
--------------------------------
НАЙТИ:
--------------------------------
$DB->query("update ".TABLE_PREFIX."quiz
set q_name='{$q_name}',q_state={$q_state},q_perms='{$Perms}',q_end={$End_Time},q_autoend={$q_autoend},q_timelimit={$q_timelimit},q_viewanswer={$q_viewanswer},q_desc='{$q_desc}',q_forcat=$q_forcat,q_image='{$q_image}'
where qid='{$quiz['qid']}'");
--------------------------------
ЗАМЕНИТЬ ЭТИМ:
--------------------------------
$vbulletin->input->clean_array_gpc('r', array(
'credit_cost' => TYPE_NUM,
'credit_prize' => TYPE_NUM,
'credit_multiply' => TYPE_BOOL
));
$db->query_write("
UPDATE " . TABLE_PREFIX . "quiz SET
q_name = '$q_name',
q_state = $q_state,
q_perms = '$Perms',
q_end = $End_Time,
q_autoend = $q_autoend,
q_timelimit = $q_timelimit,
q_viewanswer = $q_viewanswer,
q_desc = '$q_desc',
q_forcat = $q_forcat,
q_image = '$q_image',
credit_cost = " . $vbulletin->GPC['credit_cost'] . ",
credit_prize = " . $vbulletin->GPC['credit_prize'] . ",
credit_multiply = " . $vbulletin->GPC['credit_multiply'] . "
WHERE
qid = $quiz[qid]
");
================================