1
borabey52
myquiz module and fck editor
  • 2007/9/1 4:44

  • borabey52

  • Just popping in

  • Posts: 1

  • Since: 2007/9/1 4


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 "";
echo "";
echo ""._MYQUIZ_QUESTIONTITLE1.": ";
echo "";
echo "";
echo "";
for($i = 1; $i <= 12; $i++)
{
if ($i == 1) { $checked = "checked"; } else { $checked = "";}
echo "";
echo "";
echo "";

// echo "
"._MYQUIZ_COEF."
"._MYQUIZ_IMAGE." (*)
"._MYQUIZ_ANSWERS.""._MYQUIZ_ANSWER."
"._MYQUIZ_ANSWER1." $i:
";
}
echo "


"
.""
.""
.""
.""
."
"._MYQUIZ_COMMENT." (*)
"
."
"._MYQUIZ_IFBADANSWER." (*)
"
."
"._MYQUIZ_IFGOODANSWER." (*)
"
."


"
."";
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 "";
echo "";
echo "";
echo "
"._MYQUIZ_QUESTIONTITLE.": MakeTboxData4Edit($pollTitle)."\">
";
echo "";
echo "";
$i=1;
echo "";
$result = $xoopsDB->query("select optionText, voteID from ".$xoopsDB->prefix("myquiz_data")." WHERE pollID='$pid' ORDER BY voteID");
while(list($Text,$voteID) = $xoopsDB->fetchRow($result)){
if ($answer == $i) {$checked = "checked";} else {$checked = "";}
echo "\n";
echo "";

/*
echo "
";
echo "
"._MYQUIZ_COEF."
"._MYQUIZ_IMAGE." (*)
"._MYQUIZ_ANSWERS.""._MYQUIZ_ANSWER."
"._MYQUIZ_ANSWER1." $i :MakeTboxData4Edit($Text)."\">
";
*/
$i++;
}
echo "


";
echo "";
echo "";
echo "";
echo "
"._MYQUIZ_COMMENT." (*)
";
echo "
"._MYQUIZ_IFBADANSWER." (*)
";
echo "
"._MYQUIZ_IFGOODANSWER." (*)
";
echo "


";
echo "";
echo "
";
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");
}

Login

Who's Online

291 user(s) are online (211 user(s) are browsing Support Forums)


Members: 0


Guests: 291


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits