All right...it did post a bool, that is true....which has been the
case...here is the action....I am posting only until the
if($this->getRequest()->isMethod('post')) line...after that it's just code
execution...the template code follows after the action
* public function executeCreateQuestions()
{
$this->user = $_SESSION['user'];
$username = $_SESSION['user'];
$configs = new Criteria();
$configs->add(ConfigurationsPeer::GROUP_ID,1);
$configurations = ConfigurationsPeer::doSelect($configs);
if($configurations == null)
{
// redirect to the configurations not loaded page.
}
else
{
foreach($configurations as $configuration)
{
$courseTitle = $configuration->getCourses();
$topics_as_array = $configuration->getTopics();
$topics_levels= explode(",",$topics_as_array);
$options_for_select = array();
$topics_for = $courseTitle.' topics';
$levels_for = '';
foreach($topics_levels as $topic_level){
$topic_level_as_string =
(string)$topic_level;
$splits = explode("-",$topic_level_as_string);
$topics_for= $topics_for.','.$splits[0];
$levels_for = $levels_for.','.$splits[1];
}
$options_for_select = explode("," , $topics_for);
$levels_for_select = explode("," , $levels_for);
$this->topic_options = $options_for_select;
$this->level_options = $levels_for_select;
}
}
if(isset($_GET['qId']))
{
$updateQuestionId = $_GET['qId'];
$uc = new Criteria();
$uc->add(QuestionsPeer::ID,$updateQuestionId);
$this->updateRecords = QuestionsPeer::doSelect($uc);
}
if($username == '')
{
$this->redirect('user/login');
}
var_dump($this->getRequest()->isMethod('post'));
if(($this->getRequest()->isMethod('post'))) // The action takes place
when the Submit button is hit.
{ *
TEMPLATE
*<?php use_helper('Form') ?>
<?php echo include_stylesheets() ?>
<?php
?>
<script type="text/javascript">
function visibilitySwitch()
{
var id_of_element = document.getElementById('answer-type');
var user_choice =
id_of_element.options[id_of_element.selectedIndex].value;
var choice1 = "multiChoiceSingleCorrect";
var answer_options_id_2 = document.getElementById('true-false');
var answer_options_id = document.getElementById('multiple-choice');
if(user_choice == "2")
{
answer_options_id.setAttribute("class","visible");
answer_options_id_2.setAttribute("class","display");
}
if(user_choice == "3")
{
answer_options_id_2.setAttribute("class","visible");
answer_options_id.setAttribute("class","display");
}
}
function expand(id)
{
var e = document.getElementById(id).style.height;
e = parseInt(e.replace("px",""));
if (isNaN(e)) {
e = 250;
}
e += 30;
document.getElementById(id).style.height = e + "px";
}
function contract(id)
{
e = document.getElementById(id).style.height;
e = parseInt(e.replace("px",""));
if (isNaN(e)) {
e = 250;
}
if (e > 250) {
e -= 30;
document.getElementById(id).style.height = e + "px";
}
}
function userPressedEnter(e)
{
if(e.keyCode == 13 )
{
textarea = document.getElementById("question_box");
currentText = textarea.value;
textarea.value = currentText+"<br>";
}
}
function rs_txt_box(name, col_inc, row_inc)
{
var obj = document.getElementById(name);
obj.rows += row_inc;
obj.cols += col_inc;
}
function insertLines()
{
var questionboxArea = document.getElementById("question_box");
var choice1 = document.getElementById("option_1");
var choice2 = document.getElementById("option_2");
var choice3 = document.getElementById("option_3");
var choice4 = document.getElementById("option_4");
val = questionboxArea.value;
questionboxArea.value = val.replace(/\n/gi,"\n");
/* Text areas appear as options for multiple type single answer
choices, in that event, perform the insertLines operation*/
questionType = document.getElementById("answer-type");
userChoice = questionType.value;
if(userChoice == 2)
{
val1 = choice1.value;
val2 = choice2.value;
val3 = choice3.value;
val4 = choice4.value;
choice1.value = val1.replace(/\n/gi,"\n");
choice2.value = val2.replace(/\n/gi,"\n");
choice3.value = val3.replace(/\n/gi,"\n");
choice4.value= val4.replace(/\n/gi,"\n");
}
}
</script>
<p><font color="red"><?php if(isset($unselectedFields)){ echo
$unselectedFields;}echo "<br>"; if(isset($noQuestionMessage)){echo
$noQuestionMessage;}?></font></p><br>
<?php echo form_tag('questions/createQuestions',
Array('multipart'=>true)) ?>
<table border="5" cellspacing="1" cellpadding="2" class="table">
<tr>
<td>TOPIC </td><td>QUESTION-ANSWER TYPE </td><td> ALLOCATE
POINTS</td><td> TIME LIMIT</td>
</tr>
<tr>
<td align="center">
<?php echo select_tag('topics_to_choose',
options_for_select($topic_options))?>
</td>
<td>
<?php echo
select_tag('answer-type',options_for_select(array(1=>'Question-answer type',
2=>'Multiple-choice single correct answer', 3=>'True or False')),
array('onChange'=>'Javascript:visibilitySwitch()') ) ?>
</td>
<td align="center">
<?php echo select_tag('answer-points',options_for_select(array(1=>'1',
2=>'2', 3=>'3', 4=>'4', 5=>'5', 6=>'6', 7=>'7', 8=>'8', 9=>'9', 10=>'10')) )
?>
</td>
<td align="center">
<?php echo
select_tag('time_mins',options_for_select(array(1=>'0',2=>'1',3=>'2',4=>'3',5=>'4',6=>'5',7=>'6')));
?>
<b>:</b>
<?php echo
select_tag('time_secs',options_for_select(array(1=>'00',2=>'01',3=>'02',4=>'03',5=>'04',6=>'05',7=>'06',8=>'07',9=>'08',10=>'09',11=>'10',
12=>'11',13=>'12',14=>'13',15=>'14',16=>'15',17=>'16',18=>'17',19=>'18',20=>'19',21=>'20',22=>'21',23=>'22',24=>'23',23=>'24',24=>'25',25=>'26',26=>'27',
27=>'28',28=>'29',29=>'30',30=>'31',31=>'32',32=>'33',34=>'35',35=>'36',36=>'37',37=>'38',38=>'39',39=>'40',40=>'41',42=>'43',43=>'44',44=>'45',45=>'46',
46=>'47',47=>'48',48=>'49',49=>'50',50=>'51',52=>'53',53=>'54',55=>'56',57=>'58',58=>'59',59=>'60')));
?>
</td>
</tr>
</table>
<br>
<br>
<?php echo input_file_tag('image_question') ?>
<a onclick="javascript:rs_txt_box('question_box', 5, 0);"
href="javascript://">
<img style="margin: 2px;" src="/images/rs_right.gif" alt=""/>
<a onclick="rs_txt_box('question_box', 0, 10);" href="javascript://">
<img style="margin: 2px;" src="/images/rs_down.gif" alt=""/>
<a onclick="rs_txt_box('question_box', -5, 0);" href="javascript://">
<img style="margin: 2px;" src="/images/rs_left.gif" alt=""/>
<a onclick="rs_txt_box('question_box', 0, -10);" href="javascript://">
<img style="margin: 2px;" src="/images/rs_up.gif" alt=""/>
<?php echo textarea_tag('question_box',' ','size=105x4'); ?>
<p><font color="red"><?php if(isset($errorMessage)){ echo $errorMessage;}
?></p></font>
<br><br>
<p> <font color="black"><b>ANSWER CHOICES(mark the correct
answer)</b> </font></p>
<br>
<div id="true-false" class="invisible">
True <?php echo radiobutton_tag('true_false', 'true',
false) ?> <br>
False<?php echo radiobutton_tag('true_false', 'false',
false) ?><br><br>
</div>
<div id="multiple-choice" class="display">
<table border="5" cellspacing="1" cellpadding="2" class="table">
<tr>
<td>Choice No.</td><td>Answer Choices</td><td>Actions</td>
</tr>
<tr>
<td><?php echo radiobutton_tag('correct_answer','1',1) ?> 1.</td>
<td><?php echo textarea_tag('option_1','','size=70x4') ?>
<td>
<a onclick="javascript:rs_txt_box('option_1', 5, 0);" href="javascript://">
<img style="margin: 2px;" src="/images/rs_right.gif" alt=""/>
<a onclick="rs_txt_box('option_1', 0, 10);" href="javascript://">
<img style="margin: 2px;" src="/images/rs_down.gif" alt=""/>
<a onclick="rs_txt_box('option_1', -5, 0);" href="javascript://">
<img style="margin: 2px;" src="/images/rs_left.gif" alt=""/>
<a onclick="rs_txt_box('option_1', 0, -10);" href="javascript://">
<img style="margin: 2px;" src="/images/rs_image.gif" alt=""/>
<?php echo input_file_tag('answer_file1') ?></td>
</tr>
<tr>
<td><?php echo radiobutton_tag('correct_answer','2',2) ?> 2.</td>
<td><?php echo textarea_tag('option_2','','size=70x4') ?>
<td>
<a onclick="javascript:rs_txt_box('option_2', 5, 0);" href="javascript://">
<img style="margin: 2px;" src="/images/rs_right.gif" alt=""/>
<a onclick="rs_txt_box('option_2', 0, 10);" href="javascript://">
<img style="margin: 2px;" src="/images/rs_down.gif" alt=""/>
<a onclick="rs_txt_box('option_2', -5, 0);" href="javascript://">
<img style="margin: 2px;" src="/images/rs_left.gif" alt=""/>
<a onclick="rs_txt_box('option_2', 0, -10);" href="javascript://">
<img style="margin: 2px;" src="/images/rs_image.gif" alt=""/>
<?php echo input_file_tag('answer_file2') ?></td>
</tr>
<tr>
<td><?php echo radiobutton_tag('correct_answer','3',3) ?> 3.</td>
<td><?php echo textarea_tag('option_3','','size=70x4') ?>
<td>
<a onclick="javascript:rs_txt_box('option_3', 5, 0);" href="javascript://">
<img style="margin: 2px;" src="/images/rs_right.gif" alt=""/>
<a onclick="rs_txt_box('option_3', 0, 10);" href="javascript://">
<img style="margin: 2px;" src="/images/rs_down.gif" alt=""/>
<a onclick="rs_txt_box('option_3', -5, 0);" href="javascript://">
<img style="margin: 2px;" src="/images/rs_left.gif" alt=""/>
<a onclick="rs_txt_box('option_3', 0, -10);" href="javascript://">
<img style="margin: 2px;" src="/images/rs_image.gif" alt=""/><?php echo
input_file_tag('answer_file3') ?><td>
</tr>
<tr>
<td><?php echo radiobutton_tag('correct_answer','4',4) ?> 4.</td>
<td><?php echo textarea_tag('option_4','','size=70x4') ?>
<td>
<a onclick="javascript:rs_txt_box('option_4', 5, 0);" href="javascript://">
<img style="margin: 2px;" src="/images/rs_right.gif" alt=""/>
<a onclick="rs_txt_box('option_4', 0, 10);" href="javascript://">
<img style="margin: 2px;" src="/images/rs_down.gif" alt=""/>
<a onclick="rs_txt_box('option_4', -5, 0);" href="javascript://">
<img style="margin: 2px;" src="/images/rs_left.gif" alt=""/>
<a onclick="rs_txt_box('option_4', 0, -10);" href="javascript://">
<img style="margin: 2px;" src="/images/rs_image.gif" alt=""/>
<?php echo input_file_tag('answer_file4') ?></td>
</tr>
</table>
<?php //echo submit_tag('Hint',array('type'=>'button'))?>
</div>
<br><br>
<?php echo submit_tag('Create
question',array('class'=>'button','onclick'=>'javascript:insertLines()')) ?>
</form>*
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en