For 5-6 choice?

All web design discussion, including Ultimate Quiz MOD support.

Moderator: CricketMX Forum Moderators

For 5-6 choice?

Postby fatihalp » Tue Mar 06, 2007 6:18 pm

Thanks for that good mod.

Mod is coming 4 choice in "Multiple Choice Quiz"
I want to give to user (or admin) 5 choice :oops:

Thanks!
fatihalp
Greenhorn
Greenhorn
 
Posts: 3
Joined: Tue Mar 06, 2007 5:52 pm

Postby fatihalp » Wed Mar 07, 2007 4:38 pm

Nobody? :(
fatihalp
Greenhorn
Greenhorn
 
Posts: 3
Joined: Tue Mar 06, 2007 5:52 pm

Postby Grinch » Wed Mar 07, 2007 6:01 pm

Be patient, battye will get to you.
User avatar
Grinch
Site Admin
Site Admin
 
Posts: 2164
Joined: Sat Jan 24, 2004 2:02 pm
Location: Martinsburg, WV

Postby battye » Thu Mar 08, 2007 12:35 pm

There is a limit of only 4. It would require a lot of modifications to add any more. Sorry :(
CricketMX.com.. home of bat's, rat's and other farmyard animals...
My articles: view all articles by battye

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
battye
Site Admin
Site Admin
 
Posts: 14264
Joined: Sun Jan 11, 2004 8:26 am
Location: Victoria Falls, Zimbabwe

Postby fatihalp » Thu Mar 08, 2007 4:40 pm

Thanks for reply once. Can't we add 1 more choice? :cry:

I have tried but its getting error :(

Thanks...
fatihalp
Greenhorn
Greenhorn
 
Posts: 3
Joined: Tue Mar 06, 2007 5:52 pm

Postby battye » Fri Mar 09, 2007 6:52 am

I'm afraid not :(

It will require a lot of modifications to the code and database.
CricketMX.com.. home of bat's, rat's and other farmyard animals...
My articles: view all articles by battye

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
battye
Site Admin
Site Admin
 
Posts: 14264
Joined: Sun Jan 11, 2004 8:26 am
Location: Victoria Falls, Zimbabwe

Postby xzc » Thu Jul 05, 2007 2:46 pm

battye wrote:I'm afraid not :(

It will require a lot of modifications to the code and database.


Hello, battye. I do really like your mod, while I also encounter the same issue and I want to try do this myself. If so, could you pls tell the things I need to do from the high level perspective? Thanks a lot!
xzc
Frequent Poster
Frequent Poster
 
Posts: 30
Joined: Thu Jul 05, 2007 2:32 pm

Postby battye » Thu Jul 05, 2007 2:47 pm

Sure, stick around for a couple of minutes while I search through the code. :)

Welcome to the forum :)
CricketMX.com.. home of bat's, rat's and other farmyard animals...
My articles: view all articles by battye

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
battye
Site Admin
Site Admin
 
Posts: 14264
Joined: Sun Jan 11, 2004 8:26 am
Location: Victoria Falls, Zimbabwe

Postby battye » Thu Jul 05, 2007 2:52 pm

Hmm, looks like you left us... :shock:
I didn't take that long to reply...
CricketMX.com.. home of bat's, rat's and other farmyard animals...
My articles: view all articles by battye

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
battye
Site Admin
Site Admin
 
Posts: 14264
Joined: Sun Jan 11, 2004 8:26 am
Location: Victoria Falls, Zimbabwe

Postby battye » Thu Jul 05, 2007 2:58 pm

Code: Select all
            $quiz_multiple_choice = array();
            $quiz_multiple_choice = explode("!*-.@.-*!", $quiz_data['quiz_alternates']);
            
            $template->assign_vars( array(
             "U_QUIZ_NAME" => $quiz_name,
             "U_STATISTICS" => "<a href='" . append_sid("quiz_stats.$phpEx?" . POST_QUIZ_URL . "=$quiz_id") . "'>" . $lang['Quiz_stats'] . "</a>",
            
             "F_FORM" => append_sid("quiz.$phpEx?mode=results"),
             "F_ID" => $quiz_id,
             "F_TYPE" => $quiz_type,
             "F_TIME" => time(),
            
             "L_MOD_LANGS" => $mod_langs,
             "L_MULTIPLE_INFORMATION" => $lang['Quiz_multiple_information'],
             "L_SUBMIT" => $lang['Submit_quiz']));
            
             $template->assign_block_vars("quiz_row", array(
             "U_QUESTION_ID" => $quiz_question_id,
             "U_QUESTION" => $quiz_question,
            
             "Q_ALTERNATE_ONE" => $quiz_multiple_choice[0],
             "Q_ALTERNATE_TWO" => $quiz_multiple_choice[1],
             "Q_ALTERNATE_THREE" => $quiz_multiple_choice[2],
             "Q_ALTERNATE_FOUR" => $quiz_multiple_choice[3]));



In this area of the code of quiz.php, you will need to add more Q_ALTERNATE_* strings. Just keep incrementing the number in the brackets [4], [5] etc



Code: Select all
      <tr>
         <td class="row1" rowspan="4" width="75%" align="center" valign="middle" height="100%">
            <span class="forumlink">
               {quiz_row.U_QUESTION}
            </span>
         </td>


In quiz_play_multiple_choice_body.tpl, you'll need to change that rowspan to however many multiple choices you want.

Code: Select all
      <tr>
         <td class="row2" width="25%" align="left" valign="middle" height="100%">
            <span class="gen">
               &nbsp;&nbsp;<input type="radio" name="uqm{quiz_row.U_QUESTION_ID}" value="{quiz_row.Q_ALTERNATE_TWO}" /> {quiz_row.Q_ALTERNATE_TWO}
            </span>
         </td>
      </tr>


You'll also need more of those blocks, changing the Q_ALTERNATE_* values each time.


Back in quiz.php, find this:

Code: Select all
            $question_sql = "INSERT INTO " . QUIZ_MULTIPLE_CHOICE_TABLE . "
            (quiz_id, question_id, quiz_question, quiz_alternates, quiz_answer)    
            VALUES ( " . next_quiz_id() . ", " . ($i + 1) . ", '" . str_replace("\'", "''", bbencode_first_pass(htmlspecialchars($HTTP_POST_VARS["Question_$i"]), '')) . "',
            '" . str_replace("\'", "''", htmlspecialchars($HTTP_POST_VARS["Alternate1_$i"])) . "!*-.@.-*!" . str_replace("\'", "''", htmlspecialchars($HTTP_POST_VARS["Alternate2_$i"])) . "!*-.@.-*!" . str_replace("\'", "''", htmlspecialchars($HTTP_POST_VARS["Alternate3_$i"])) . "!*-.@.-*!" . str_replace("\'", "''", htmlspecialchars($HTTP_POST_VARS["Alternate4_$i"])) . "',
            '" . htmlspecialchars($answer[$i]) . "')";


You will need to add more of the _POST var values there. You'll also need to add more fields to the quiz_add_multiple_choice_body.tpl file, but that is reasonably straight forward so I won't go into that.

There may or may not be other things you have to do, but hopefully that gets you on the right track.
CricketMX.com.. home of bat's, rat's and other farmyard animals...
My articles: view all articles by battye

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
battye
Site Admin
Site Admin
 
Posts: 14264
Joined: Sun Jan 11, 2004 8:26 am
Location: Victoria Falls, Zimbabwe

Postby xzc » Fri Jul 06, 2007 3:22 am

Thanks for your so quick reply!!
So, it seems no need to change any part of the database or table structure, right? Good design!!
Thanks again, once I finished, I will report back to the forum.
xzc
Frequent Poster
Frequent Poster
 
Posts: 30
Joined: Thu Jul 05, 2007 2:32 pm

Postby battye » Fri Jul 06, 2007 10:18 am

xzc wrote:Thanks for your so quick reply!!
So, it seems no need to change any part of the database or table structure, right? Good design!!
Thanks again, once I finished, I will report back to the forum.


It seems that no database alterations need to be made after all, which is good :)
CricketMX.com.. home of bat's, rat's and other farmyard animals...
My articles: view all articles by battye

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
battye
Site Admin
Site Admin
 
Posts: 14264
Joined: Sun Jan 11, 2004 8:26 am
Location: Victoria Falls, Zimbabwe


Return to Web Design

Who is online

Users browsing this forum: No registered users and 1 guest

cron