Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

L'en-tête du formulaire d'ajout/modification de question à été déplacé pour que se soit un fichier générique #277

Open
wants to merge 2 commits into
base: Release-1.5.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions application/controllers/Question.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public function update($id = 0, $error = 0)
}
$output['nbAnswer'] = count($reponses);
$output['answers'] = $answers;
$this->display_view('multiple_choice/add', $output);
$this->display_view(['common/question_form_header','multiple_choice/add'], $output);
break;
case 2:
// MUTLIPLE ANSWER
Expand All @@ -271,7 +271,7 @@ public function update($id = 0, $error = 0)
}
$output['nbAnswer'] = count($reponses);
$output['answers'] = $answers;
$this->display_view('multiple_answer/add', $output);
$this->display_view(['common/question_form_header','multiple_answer/add'], $output);
break;
case 3:
// TODO
Expand All @@ -291,7 +291,7 @@ public function update($id = 0, $error = 0)
$output['answers'] = $answers;
$output['cloze_text'] = $cloze_text->Cloze_Text;
$output['id_cloze_text'] = $cloze_text->ID;
$this->display_view('cloze_text/add', $output);
$this->display_view(['common/question_form_header','cloze_text/add'], $output);
break;
case 5:
// TODO
Expand All @@ -300,7 +300,7 @@ public function update($id = 0, $error = 0)
// FREE ANSWER
$output['id_answer'] = $this->free_answer_model->get_by('FK_Question ='.$question->ID)->ID;
$output['answer'] = $this->free_answer_model->get_by('FK_Question ='.$question->ID)->Answer;
$this->display_view('free_answers/add', $output);
$this->display_view(['common/question_form_header','free_answers/add'], $output);
break;
case 7:
// PICTURE LANDMARK
Expand All @@ -316,7 +316,7 @@ public function update($id = 0, $error = 0)
$output['nbAnswer'] = count($reponses);
$output['answers'] = $answers;

$this->display_view('picture_landmark/add', $output);
$this->display_view(['common/question_form_header','picture_landmark/add'], $output);
}
}

Expand Down
82 changes: 82 additions & 0 deletions application/modules/common/views/question_form_header.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* View of question's details to update
*
* @author Orif, section informatique (BuYa, ViDi)
* @link https://github.com/OrifInformatique/gestion_questionnaires
* @copyright Copyright (c) Orif (http://www.orif.ch)
*/
?>

<div class="container">
<h1 class="title-section"><?php echo $this->lang->line('title_question_update'); ?></h1>
<?php
$attributes = array("id" => "addQuestionForm",
"name" => "addQuestionForm");
echo form_open('Question/add_free_answer', $attributes);
?>

<!-- Hidden fields to put informations in $_POST -->
<?php
echo form_hidden('question_type', $question_type->ID);
if(isset($id)){
echo form_hidden('id', $id);
}
if(isset($id_answer)){
echo form_hidden('id_answer', $id_answer);
}
?>

<div class="row">
<div class="col-sm-12 text-right">
<b class="form-header"><?php echo $this->lang->line('question_type').' : '.$question_type->Type_Name; ?></b>
</div>
</div>

<!-- ERROR MESSAGES -->
<?php
if (!empty(validation_errors())) {
echo '<div class="alert alert-danger">'.validation_errors().'</div>';}
?>

<!-- QUESTION FIELDS -->
<div class="row">
<div class="col-sm-12 form-group">
<?php echo form_label($this->lang->line('focus_topic'), 'focus_topic', array('class' => 'form-label')); ?>
<?php
if(isset($focus_topic)){
echo form_dropdown('focus_topic', $topics, $focus_topic->ID, 'class="form-control" id="focus_topic"');
} else {
echo form_dropdown('focus_topic', $topics, null, 'class="form-control" id="focus_topic"');
}
?>
</div>
</div>

<div class="row">
<div class="col-sm-12 form-group">
<?php echo form_label($this->lang->line('question_text'), 'name', array('class' => 'form-label')); ?>
<?php
if(isset($name)){
echo form_input('name', $name, 'maxlength="65535" class="form-control" id="name"');
} else {
echo form_input('name', '', 'maxlength="65535" class="form-control" id="name"');
}
?>
</div>
</div>

<div class="row">
<div class="col-sm-6 form-group">
<?php echo form_label($this->lang->line('points'), 'points', array('class' => 'form-label')); ?>
</div>
<div class="col-sm-1 form-group">
<?php
if(isset($name)){
echo form_input('points', $points, 'maxlength="11" class="form-control" id="points"');
} else {
echo form_input('points', '', 'maxlength="11" class="form-control" id="points"');
}
?>
</div>
</div>
85 changes: 0 additions & 85 deletions application/views/cloze_text/add.php
Original file line number Diff line number Diff line change
@@ -1,88 +1,3 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* View of question's details to update
*
* @author Orif, section informatique (BuYa, ViDi)
* @link https://github.com/OrifInformatique/gestion_questionnaires
* @copyright Copyright (c) Orif (http://www.orif.ch)
*/
?>

<div class="container">
<h1 class="title-section"><?php echo $this->lang->line('title_question_update'); ?></h1>
<?php
$attributes = array("id" => "addQuestionForm",
"name" => "addQuestionForm");
echo form_open('Question/add_cloze_text', $attributes);
?>


<!-- Hidden fields to put informations in $_POST -->
<?php
echo form_hidden('question_type', $question_type->ID);
echo form_hidden('nbAnswer', $nbAnswer);
if(isset($id)){
echo form_hidden('id', $id);
}
if(isset($id_cloze_text)){
echo form_hidden('id_cloze_text', $id_cloze_text);
}
?>

<div class="row">
<div class="col-sm-12 text-right">
<b class="form-header"><?php echo $this->lang->line('question_type').' : '.$question_type->Type_Name; ?></b>
</div>
</div>

<!-- ERROR MESSAGES -->
<?php
if (!empty(validation_errors())) {
echo '<div class="alert alert-danger">'.validation_errors().'</div>';}
?>

<!-- QUESTION FIELDS -->
<div class="row">
<div class="col-sm-12 form-group">
<?php echo form_label($this->lang->line('focus_topic'), 'focus_topic', array('class' => 'form-label')); ?>
<?php
if(isset($focus_topic)){
echo form_dropdown('focus_topic', $topics, $focus_topic->ID, 'class="form-control" id="focus_topic"');
} else {
echo form_dropdown('focus_topic', $topics, null, 'class="form-control" id="focus_topic"');
}
?>
</div>
</div>

<div class="row">
<div class="col-sm-12 form-group">
<?php echo form_label($this->lang->line('question_text'), 'name', array('class' => 'form-label')); ?>
<?php
if(isset($name)){
echo form_input('name', $name, 'maxlength="65535" class="form-control" id="name"');
} else {
echo form_input('name', '', 'maxlength="65535" class="form-control" id="name"');
}
?>
</div>
</div>

<div class="row">
<div class="col-sm-6 form-group">
<?php echo form_label($this->lang->line('points'), 'points', array('class' => 'form-label')); ?>
</div>
<div class="col-sm-1 form-group">
<?php
if(isset($name)){
echo form_input('points', $points, 'maxlength="11" class="form-control" id="points"');
} else {
echo form_input('points', '', 'maxlength="11" class="form-control" id="points"');
}
?>
</div>
</div>

<div class="row">
<div class="col-sm-12 form-group">
<?php echo form_label($this->lang->line('cloze_text'), 'cloze_text', array('class' => 'form-label')); ?>
Expand Down
85 changes: 1 addition & 84 deletions application/views/free_answers/add.php
Original file line number Diff line number Diff line change
@@ -1,87 +1,4 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* View of question's details to update
*
* @author Orif, section informatique (BuYa, ViDi)
* @link https://github.com/OrifInformatique/gestion_questionnaires
* @copyright Copyright (c) Orif (http://www.orif.ch)
*/
?>

<div class="container">
<h1 class="title-section"><?php echo $this->lang->line('title_question_update'); ?></h1>
<?php
$attributes = array("id" => "addQuestionForm",
"name" => "addQuestionForm");
echo form_open('Question/add_free_answer', $attributes);
?>

<!-- Hidden fields to put informations in $_POST -->
<?php
echo form_hidden('question_type', $question_type->ID);
if(isset($id)){
echo form_hidden('id', $id);
}
if(isset($id_answer)){
echo form_hidden('id_answer', $id_answer);
}
?>

<div class="row">
<div class="col-sm-12 text-right">
<b class="form-header"><?php echo $this->lang->line('question_type').' : '.$question_type->Type_Name; ?></b>
</div>
</div>

<!-- ERROR MESSAGES -->
<?php
if (!empty(validation_errors())) {
echo '<div class="alert alert-danger">'.validation_errors().'</div>';}
?>

<!-- QUESTION FIELDS -->
<div class="row">
<div class="col-sm-12 form-group">
<?php echo form_label($this->lang->line('focus_topic'), 'focus_topic', array('class' => 'form-label')); ?>
<?php
if(isset($focus_topic)){
echo form_dropdown('focus_topic', $topics, $focus_topic->ID, 'class="form-control" id="focus_topic"');
} else {
echo form_dropdown('focus_topic', $topics, null, 'class="form-control" id="focus_topic"');
}
?>
</div>
</div>

<div class="row">
<div class="col-sm-12 form-group">
<?php echo form_label($this->lang->line('question_text'), 'name', array('class' => 'form-label')); ?>
<?php
if(isset($name)){
echo form_input('name', $name, 'maxlength="65535" class="form-control" id="name"');
} else {
echo form_input('name', '', 'maxlength="65535" class="form-control" id="name"');
}
?>
</div>
</div>

<div class="row">
<div class="col-sm-6 form-group">
<?php echo form_label($this->lang->line('points'), 'points', array('class' => 'form-label')); ?>
</div>
<div class="col-sm-1 form-group">
<?php
if(isset($name)){
echo form_input('points', $points, 'maxlength="11" class="form-control" id="points"');
} else {
echo form_input('points', '', 'maxlength="11" class="form-control" id="points"');
}
?>
</div>
</div>

<!-- ANSWERS FIELDS -->
<!-- ANSWERS FIELDS -->

<div class="row">
<div class="col-sm-12 form-group">
Expand Down
81 changes: 0 additions & 81 deletions application/views/multiple_answer/add.php
Original file line number Diff line number Diff line change
@@ -1,84 +1,3 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* View of question's details to update
*
* @author Orif, section informatique (BuYa, ViDi)
* @link https://github.com/OrifInformatique/gestion_questionnaires
* @copyright Copyright (c) Orif (http://www.orif.ch)
*/
?>

<div class="container">
<h1 class="title-section"><?php echo $this->lang->line('title_question_update'); ?></h1>
<?php
$attributes = array("id" => "addQuestionForm",
"name" => "addQuestionForm");
echo form_open('Question/add_multiple_answer', $attributes);
?>

<!-- Hidden fields to put informations in $_POST -->
<?php
echo form_hidden('question_type', $question_type->ID);
echo form_hidden('nbAnswer', $nbAnswer);
if(isset($id)){
echo form_hidden('id', $id);
}
?>

<div class="row">
<div class="col-sm-12 text-right">
<b class="form-header"><?php echo $this->lang->line('question_type').' : '.$question_type->Type_Name; ?></b>
</div>
</div>

<!-- ERROR MESSAGES -->
<?php
if (!empty(validation_errors())) {
echo '<div class="alert alert-danger">'.validation_errors().'</div>';}
?>

<!-- QUESTION FIELDS -->
<div class="row">
<div class="col-sm-12 form-group">
<?php echo form_label($this->lang->line('focus_topic'), 'focus_topic', array('class' => 'form-label')); ?>
<?php
if(isset($focus_topic)){
echo form_dropdown('focus_topic', $topics, $focus_topic->ID, 'class="form-control" id="focus_topic"');
} else {
echo form_dropdown('focus_topic', $topics, null, 'class="form-control" id="focus_topic"');
}
?>
</div>
</div>

<div class="row">
<div class="col-sm-12 form-group">
<?php echo form_label($this->lang->line('question_text'), 'name', array('class' => 'form-label')); ?>
<?php
if(isset($name)){
echo form_input('name', $name, 'maxlength="65535" class="form-control" id="name"');
} else {
echo form_input('name', '', 'maxlength="65535" class="form-control" id="name"');
}
?>
</div>
</div>

<div class="row">
<div class="col-sm-6 form-group">
<?php echo form_label($this->lang->line('points'), 'points', array('class' => 'form-label')); ?>
</div>
<div class="col-sm-1 form-group">
<?php
if(isset($name)){
echo form_input('points', $points, 'maxlength="11" class="form-control" id="points"');
} else {
echo form_input('points', '', 'maxlength="11" class="form-control" id="points"');
}
?>
</div>
</div>

<!-- ANSWERS FIELDS -->
<div class="row">
<div class="col-sm-6 form-group">
Expand Down
Loading