CMS  Version 3.9
question_types.inc File Reference

Go to the source code of this file.

Functions

 formatSortOrderInputField ($questionType)
 
 reorderQuestionTypes ()
 

Variables

 $menu_item = "Questionnaire Question Types"
 
 $title = "Question Types"
 
 $questionTypes = query(QuestionType, "ORDER BY sort_order")
 
 $table = new DataListView($questionTypes, "questionTypes")
 
$table emptyMessage = "There are no question types defined."
 
$table sortable = false
 
$table cssStyle = "width: 60%"
 
if($method=="POST") $script = $table->writeScript()
 

Function Documentation

◆ formatSortOrderInputField()

formatSortOrderInputField (   $questionType)

Definition at line 85 of file question_types.inc.

86 {
87  return "<input type='text' name='question_type_{$questionType->question_type_id}'
88  value='{$questionType->sort_order}' size='4'/>";
89 
90 }

◆ reorderQuestionTypes()

reorderQuestionTypes ( )

Definition at line 93 of file question_types.inc.

94 {
95  global $_POST;
96  // reorder
97  foreach($_POST as $name => $value)
98  {
99  global $_POST;
100 
101  // reorder
102  foreach($_POST as $name => $value)
103  {
104  if (!strncmp($name, "question_type_", 14))
105  {
106  $id = substr($name, 14);
107  $questionType = new QuestionType();
108  $questionType->filter = new InclusionFilter("question_type_id", "sort_order");
109  $questionType->question_type_id = $id;
110  $questionType->sort_order = $value;
111  $questionType->save();
112  }
113  }
114  // renumber
115  $questionTypes = query(QuestionType, "ORDER BY sort_order");
116  $value = 1;
117 
118  foreach($questionTypes as $questionType)
119  {
120  $questionType->filter = new InclusionFilter("sort_order");
121  $questionType->sort_order = $value;
122  $questionType->save();
123  $value++;
124  }
125  }
126 }
$_POST["owner_id"]
Definition: blog_form.inc:54
$name
Definition: upload.inc:54
$questionTypes

Variable Documentation

◆ $menu_item

$menu_item = "Questionnaire Question Types"

Definition at line 47 of file question_types.inc.

◆ $questionTypes

$questionTypes = query(QuestionType, "ORDER BY sort_order")

Definition at line 52 of file question_types.inc.

◆ $script

if ( $method=="POST") $script = $table->writeScript()

Definition at line 72 of file question_types.inc.

◆ $table

$table = new DataListView($questionTypes, "questionTypes")

Definition at line 54 of file question_types.inc.

◆ $title

$title = "Question Types"

Definition at line 49 of file question_types.inc.

◆ cssStyle

$table cssStyle = "width: 60%"

Definition at line 62 of file question_types.inc.

◆ emptyMessage

$table emptyMessage = "There are no question types defined."

Definition at line 60 of file question_types.inc.

◆ sortable

$table sortable = false

Definition at line 61 of file question_types.inc.