Hi...
I want to insert fck editor to addquestion function of myquiz module.
How do I make this?
Please help...
/*********************************************************/
/* Quizz Functions */
/*********************************************************/
function QuizzAddQuestion()
{
global $qid,$xoopsConfig,$xoopsModule, $xoopsDB, $xoopsUser, $xoopsTheme, $xoopsLogger;
xoops_cp_header();
OpenTable();
echo "
"._MYQUIZ_ADDQUESTION."";
echo "\n
";
echo "* : "._MYQUIZ_HELPOPTION."\n";
CloseTable();
xoops_cp_footer();
}
/*********************************************************/
/* Quizz Functions */
/*********************************************************/
function QuizzModifyQuestion(){
global $xoopsConfig,$xoopsDB,$qid,$pid,$myts,$xoopsModule, $xoopsUser, $xoopsTheme, $xoopsLogger;
xoops_cp_header();
OpenTable();
echo "
"._MYQUIZ_MODIFYQUESTION."";
$result = $xoopsDB->query("SELECT pollTitle, answer, coef, good, bad, comment, image FROM ".$xoopsDB->prefix("myquiz_desc")." WHERE pollID='$pid'");
list ($pollTitle,$answer,$coef,$good,$bad,$comment,$image) = $xoopsDB->fetchRow($result);
$pollTitle = preg_replace("/\"/",""",$pollTitle);
# check if the answer was ordered
if (ereg(",",$answer))
{
$array_answer = split(',',$answer);
}
echo "\n
";
echo "* : "._MYQUIZ_HELPOPTION."\n";
CloseTable();
xoops_cp_footer();
}
/*********************************************************/
/* Quizz Functions */
/*********************************************************/
function modifyPostedQuizzQuestion()
{
global $question, $optionText,$qid,$pid,$answer,$coef,$good,$bad,$comment,$optionSort,$image,$myts,$xoopsConfig,$xoopsDB, $xoopsUser, $xoopsTheme, $xoopsLogger;
$question = $_POST['question'];
$question = $myts->MakeTboxData4Save($question);
$good = $_POST['good'];
$good = $myts->MakeTareaData4Save($good);
$bad = $_POST['bad'];
$bad = $myts->MakeTareaData4Save($bad);
$comment = $_POST['comment'];
$comment = $myts->MakeTareaData4Save($comment);
$answer = $_POST['answer'];
$coef = $_POST['coef'];
$pid = $_POST['pid'];
$image = $_POST['image'];
$optionText = $_POST['optionText'];
$ordered_answer = implode(",",$optionSort);
$ordered_answer = preg_replace("/,--|--,|--/","",$ordered_answer);
# check if sorted answer is needed
if (!empty($ordered_answer)){
# check if all availaible answers are sorted
for($i = 1; $i <= sizeof($optionText); $i++){
if ((!empty($optionText[$i]) and $optionSort[$i] == "--") or (empty($optionText[$i]) and $optionSort[$i] != "--")){
xoops_cp_header();
OpenTable();
echo "
"._MYQUIZ_INCORRECTORDER."";
CloseTable();
xoops_cp_footer();
exit;
}
}
# change the answer the the ordered answer
$answer = $ordered_answer;
}
# update general information about current question ...
if(!$xoopsDB->query("UPDATE ".$xoopsDB->prefix("myquiz_desc")." SET pollTitle='$question', answer='$answer', coef='$coef', good='$good', bad='$bad', comment='$comment', image='$image' WHERE pollID='$pid'")){
echo $xoopsDB->errno(). ": ".$xoopsDB->error(). "
";
return;
}
for($i = 1; $i <= sizeof($optionText); $i++){
if($optionText[$i] != ""){
$optionText[$i] = $myts->MakeTboxData4Save($optionText[$i]);
}
if(!$xoopsDB->query("UPDATE ".$xoopsDB->prefix("myquiz_data")." SET optionText='$optionText[$i]' WHERE voteID='$i' AND pollID='$pid'")){
echo $xoopsDB->errno(). ": ".$xoopsDB->error(). "
";
return;
}
}
Header("Location: ".XOOPS_URL."/modules/myquiz/admin/index.php?acti=QuizzModify&qidi=$qid");
}