MDL-29804 - Clean up Feedback modules coding style
This commit is contained in:
+227
-184
@@ -1,12 +1,26 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* prints the form to edit the feedback items such moving, deleting and so on
|
||||
*
|
||||
* @author Andreas Grabs
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
||||
* @package feedback
|
||||
*/
|
||||
* prints the form to edit the feedback items such moving, deleting and so on
|
||||
*
|
||||
* @author Andreas Grabs
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
||||
* @package feedback
|
||||
*/
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
@@ -16,7 +30,7 @@ feedback_init_feedback_session();
|
||||
|
||||
$id = required_param('id', PARAM_INT);
|
||||
|
||||
if(($formdata = data_submitted()) AND !confirm_sesskey()) {
|
||||
if (($formdata = data_submitted()) AND !confirm_sesskey()) {
|
||||
print_error('invalidsesskey');
|
||||
}
|
||||
|
||||
@@ -27,7 +41,6 @@ $moveitem = optional_param('moveitem', false, PARAM_INT);
|
||||
$movehere = optional_param('movehere', false, PARAM_INT);
|
||||
$switchitemrequired = optional_param('switchitemrequired', false, PARAM_INT);
|
||||
|
||||
// $SESSION->feedback->current_tab = $do_show;
|
||||
$current_tab = $do_show;
|
||||
|
||||
$url = new moodle_url('/mod/feedback/edit.php', array('id'=>$id, 'do_show'=>$do_show));
|
||||
@@ -53,22 +66,22 @@ require_login($course->id, true, $cm);
|
||||
require_capability('mod/feedback:edititems', $context);
|
||||
|
||||
//move up/down items
|
||||
if($moveupitem){
|
||||
if ($moveupitem) {
|
||||
$item = $DB->get_record('feedback_item', array('id'=>$moveupitem));
|
||||
feedback_moveup_item($item);
|
||||
}
|
||||
if($movedownitem){
|
||||
if ($movedownitem) {
|
||||
$item = $DB->get_record('feedback_item', array('id'=>$movedownitem));
|
||||
feedback_movedown_item($item);
|
||||
}
|
||||
|
||||
//moving of items
|
||||
if($movehere && isset($SESSION->feedback->moving->movingitem)){
|
||||
if ($movehere && isset($SESSION->feedback->moving->movingitem)) {
|
||||
$item = $DB->get_record('feedback_item', array('id'=>$SESSION->feedback->moving->movingitem));
|
||||
feedback_move_item($item, intval($movehere));
|
||||
$moveitem = false;
|
||||
}
|
||||
if($moveitem){
|
||||
if ($moveitem) {
|
||||
$item = $DB->get_record('feedback_item', array('id'=>$moveitem));
|
||||
$SESSION->feedback->moving->shouldmoving = 1;
|
||||
$SESSION->feedback->moving->movingitem = $moveitem;
|
||||
@@ -76,7 +89,7 @@ if($moveitem){
|
||||
unset($SESSION->feedback->moving);
|
||||
}
|
||||
|
||||
if($switchitemrequired) {
|
||||
if ($switchitemrequired) {
|
||||
$item = $DB->get_record('feedback_item', array('id'=>$switchitemrequired));
|
||||
@feedback_switch_item_required($item);
|
||||
redirect($url->out(false));
|
||||
@@ -89,24 +102,26 @@ $create_template_form->set_feedbackdata(array('context'=>$context, 'course'=>$co
|
||||
$create_template_form->set_form_elements();
|
||||
$create_template_form->set_data(array('id'=>$id, 'do_show'=>'templates'));
|
||||
$create_template_formdata = $create_template_form->get_data();
|
||||
if(isset($create_template_formdata->savetemplate) && $create_template_formdata->savetemplate == 1) {
|
||||
if (isset($create_template_formdata->savetemplate) && $create_template_formdata->savetemplate == 1) {
|
||||
//check the capabilities to create templates
|
||||
if(!has_capability('mod/feedback:createprivatetemplate', $context) AND
|
||||
if (!has_capability('mod/feedback:createprivatetemplate', $context) AND
|
||||
!has_capability('mod/feedback:createpublictemplate', $context)) {
|
||||
print_error('cannotsavetempl', 'feedback');
|
||||
}
|
||||
if(trim($create_template_formdata->templatename) == '') {
|
||||
if (trim($create_template_formdata->templatename) == '') {
|
||||
$savereturn = 'notsaved_name';
|
||||
}else {
|
||||
} else {
|
||||
//if the feedback is located on the frontpage then templates can be public
|
||||
if(has_capability('mod/feedback:createpublictemplate', get_system_context())) {
|
||||
if (has_capability('mod/feedback:createpublictemplate', get_system_context())) {
|
||||
$create_template_formdata->ispublic = isset($create_template_formdata->ispublic) ? 1 : 0;
|
||||
}else {
|
||||
} else {
|
||||
$create_template_formdata->ispublic = 0;
|
||||
}
|
||||
if(!feedback_save_as_template($feedback, $create_template_formdata->templatename, $create_template_formdata->ispublic)) {
|
||||
if (!feedback_save_as_template($feedback,
|
||||
$create_template_formdata->templatename,
|
||||
$create_template_formdata->ispublic)) {
|
||||
$savereturn = 'failed';
|
||||
}else {
|
||||
} else {
|
||||
$savereturn = 'saved';
|
||||
}
|
||||
}
|
||||
@@ -115,12 +130,12 @@ if(isset($create_template_formdata->savetemplate) && $create_template_formdata->
|
||||
//get the feedbackitems
|
||||
$lastposition = 0;
|
||||
$feedbackitems = $DB->get_records('feedback_item', array('feedback'=>$feedback->id), 'position');
|
||||
if(is_array($feedbackitems)){
|
||||
if (is_array($feedbackitems)) {
|
||||
$feedbackitems = array_values($feedbackitems);
|
||||
if(count($feedbackitems) > 0) {
|
||||
if (count($feedbackitems) > 0) {
|
||||
$lastitem = $feedbackitems[count($feedbackitems)-1];
|
||||
$lastposition = $lastitem->position;
|
||||
}else {
|
||||
} else {
|
||||
$lastposition = 0;
|
||||
}
|
||||
}
|
||||
@@ -137,9 +152,6 @@ $use_template_form->set_feedbackdata(array('course' => $course));
|
||||
$use_template_form->set_form_elements();
|
||||
$use_template_form->set_data(array('id'=>$id));
|
||||
|
||||
//the create_template-form
|
||||
//$create_template_form = new feedback_edit_create_template_form('use_templ.php');
|
||||
|
||||
/// Print the page header
|
||||
$strfeedbacks = get_string("modulenameplural", "feedback");
|
||||
$strfeedback = get_string("modulename", "feedback");
|
||||
@@ -150,7 +162,7 @@ $PAGE->set_title(format_string($feedback->name));
|
||||
echo $OUTPUT->header();
|
||||
|
||||
/// print the tabs
|
||||
include('tabs.php');
|
||||
require('tabs.php');
|
||||
|
||||
/// Print the main part of the page
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -160,38 +172,45 @@ include('tabs.php');
|
||||
$savereturn=isset($savereturn)?$savereturn:'';
|
||||
|
||||
//print the messages
|
||||
if($savereturn == 'notsaved_name') {
|
||||
echo '<p align="center"><b><font color="red">'.get_string('name_required','feedback').'</font></b></p>';
|
||||
if ($savereturn == 'notsaved_name') {
|
||||
echo '<p align="center"><b><font color="red">'.
|
||||
get_string('name_required', 'feedback').
|
||||
'</font></b></p>';
|
||||
}
|
||||
|
||||
if($savereturn == 'saved') {
|
||||
echo '<p align="center"><b><font color="green">'.get_string('template_saved','feedback').'</font></b></p>';
|
||||
if ($savereturn == 'saved') {
|
||||
echo '<p align="center"><b><font color="green">'.
|
||||
get_string('template_saved', 'feedback').
|
||||
'</font></b></p>';
|
||||
}
|
||||
|
||||
if($savereturn == 'failed') {
|
||||
echo '<p align="center"><b><font color="red">'.get_string('saving_failed','feedback').'</font></b></p>';
|
||||
if ($savereturn == 'failed') {
|
||||
echo '<p align="center"><b><font color="red">'.
|
||||
get_string('saving_failed', 'feedback').
|
||||
'</font></b></p>';
|
||||
}
|
||||
|
||||
feedback_print_errors();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
///print the template-section
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
if($do_show == 'templates') {
|
||||
if ($do_show == 'templates') {
|
||||
echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide');
|
||||
$use_template_form->display();
|
||||
|
||||
if(has_capability('mod/feedback:createprivatetemplate', $context) OR
|
||||
if (has_capability('mod/feedback:createprivatetemplate', $context) OR
|
||||
has_capability('mod/feedback:createpublictemplate', $context)) {
|
||||
$deleteurl = new moodle_url('/mod/feedback/delete_template.php', array('id'=>$id));
|
||||
$deleteurl = new moodle_url('/mod/feedback/delete_template.php', array('id' => $id));
|
||||
$create_template_form->display();
|
||||
echo '<p><a href="'.$deleteurl->out().'">'.get_string('delete_templates', 'feedback').'</a></p>';
|
||||
}else {
|
||||
echo '<p><a href="'.$deleteurl->out().'">'.
|
||||
get_string('delete_templates', 'feedback').
|
||||
'</a></p>';
|
||||
} else {
|
||||
echo ' ';
|
||||
}
|
||||
|
||||
if(has_capability('mod/feedback:edititems', $context)) {
|
||||
$exporturl = new moodle_url('/mod/feedback/export.php', array('action'=>'exportfile', 'id'=>$id));
|
||||
if (has_capability('mod/feedback:edititems', $context)) {
|
||||
$urlparams = array('action'=>'exportfile', 'id'=>$id);
|
||||
$exporturl = new moodle_url('/mod/feedback/export.php', $urlparams);
|
||||
$importurl = new moodle_url('/mod/feedback/import.php', array('id'=>$id));
|
||||
echo '<p>
|
||||
<a href="'.$exporturl->out().'">'.get_string('export_questions', 'feedback').'</a>/
|
||||
@@ -203,11 +222,11 @@ if($do_show == 'templates') {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
///print the Item-Edit-section
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
if($do_show == 'edit') {
|
||||
if ($do_show == 'edit') {
|
||||
|
||||
$add_item_form->display();
|
||||
|
||||
if(is_array($feedbackitems)){
|
||||
if (is_array($feedbackitems)) {
|
||||
$itemnr = 0;
|
||||
|
||||
$align = right_to_left() ? 'right' : 'left';
|
||||
@@ -215,156 +234,180 @@ if($do_show == 'edit') {
|
||||
$helpbutton = $OUTPUT->help_icon('preview', 'feedback');
|
||||
|
||||
echo $OUTPUT->heading($helpbutton . get_string('preview', 'feedback'));
|
||||
if(isset($SESSION->feedback->moving) AND $SESSION->feedback->moving->shouldmoving == 1) {
|
||||
echo $OUTPUT->heading('<a href="edit.php?id='.$id.'">'.get_string('cancel_moving', 'feedback').'</a>');
|
||||
if (isset($SESSION->feedback->moving) AND $SESSION->feedback->moving->shouldmoving == 1) {
|
||||
$anker = '<a href="edit.php?id='.$id.'">';
|
||||
$anker .= get_string('cancel_moving', 'feedback');
|
||||
$anker .= '</a>';
|
||||
echo $OUTPUT->heading($anker);
|
||||
}
|
||||
// echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide');
|
||||
|
||||
//check, if there exists required-elements
|
||||
$countreq = $DB->count_records('feedback_item', array('feedback'=>$feedback->id, 'required'=> 1));
|
||||
if($countreq > 0) {
|
||||
// echo '<font color="red">(*)' . get_string('items_are_required', 'feedback') . '</font>';
|
||||
echo '<span class="feedback_required_mark">(*)' . get_string('items_are_required', 'feedback') . '</span>';
|
||||
$params = array('feedback' => $feedback->id, 'required' => 1);
|
||||
$countreq = $DB->count_records('feedback_item', $params);
|
||||
if ($countreq > 0) {
|
||||
echo '<span class="feedback_required_mark">(*)';
|
||||
echo get_string('items_are_required', 'feedback');
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
//use list instead a table
|
||||
echo $OUTPUT->box_start('feedback_items');
|
||||
if(isset($SESSION->feedback->moving) AND $SESSION->feedback->moving->shouldmoving == 1) {
|
||||
$moveposition = 1;
|
||||
$movehereurl = new moodle_url($url, array('movehere'=>$moveposition));
|
||||
echo $OUTPUT->box_start('feedback_item_box_'.$align.' clipboard'); //only shown if shouldmoving = 1
|
||||
$buttonlink = $movehereurl->out();
|
||||
echo '<a title="'.get_string('move_here','feedback').'" href="'.$buttonlink.'">
|
||||
<img class="movetarget" alt="'.get_string('move_here','feedback').'" src="'.$OUTPUT->pix_url('movehere') . '" />
|
||||
</a>';
|
||||
echo $OUTPUT->box_end();
|
||||
}
|
||||
//print the inserted items
|
||||
$itempos = 0;
|
||||
foreach($feedbackitems as $feedbackitem){
|
||||
$itempos++;
|
||||
if(isset($SESSION->feedback->moving) AND $SESSION->feedback->moving->movingitem == $feedbackitem->id){ //hiding the item to move
|
||||
if (isset($SESSION->feedback->moving) AND $SESSION->feedback->moving->shouldmoving == 1) {
|
||||
$moveposition = 1;
|
||||
$movehereurl = new moodle_url($url, array('movehere'=>$moveposition));
|
||||
//only shown if shouldmoving = 1
|
||||
echo $OUTPUT->box_start('feedback_item_box_'.$align.' clipboard');
|
||||
$buttonlink = $movehereurl->out();
|
||||
$strbutton = get_string('move_here', 'feedback');
|
||||
$src = $OUTPUT->pix_url('movehere');
|
||||
echo '<a title="'.$strbutton.'" href="'.$buttonlink.'">
|
||||
<img class="movetarget" alt="'.$strbutton.'" src="'.$src.'" />
|
||||
</a>';
|
||||
echo $OUTPUT->box_end();
|
||||
}
|
||||
//print the inserted items
|
||||
$itempos = 0;
|
||||
foreach ($feedbackitems as $feedbackitem) {
|
||||
$itempos++;
|
||||
//hiding the item to move
|
||||
if (isset($SESSION->feedback->moving)) {
|
||||
if ($SESSION->feedback->moving->movingitem == $feedbackitem->id) {
|
||||
continue;
|
||||
}
|
||||
if($feedbackitem->dependitem > 0) {
|
||||
$dependstyle = ' feedback_depend';
|
||||
}else {
|
||||
$dependstyle = '';
|
||||
}
|
||||
echo $OUTPUT->box_start('feedback_item_box_'.$align.$dependstyle);
|
||||
//items without value only are labels
|
||||
if($feedbackitem->hasvalue == 1 AND $feedback->autonumbering) {
|
||||
$itemnr++;
|
||||
echo $OUTPUT->box_start('feedback_item_number_'.$align) . $itemnr . $OUTPUT->box_end();
|
||||
}
|
||||
echo $OUTPUT->box_start('box generalbox boxalign_'.$align);
|
||||
echo $OUTPUT->box_start('feedback_item_commands_'.$align);
|
||||
echo '<span class="feedback_item_commands">('.get_string('position', 'feedback').':'.$itempos .')</span>';
|
||||
//print the moveup-button
|
||||
if($feedbackitem->position > 1){
|
||||
echo '<span class="feedback_item_command_moveup">';
|
||||
$moveupurl = new moodle_url($url, array('moveupitem'=>$feedbackitem->id));
|
||||
$buttonlink = $moveupurl->out();
|
||||
echo '<a class="icon up" title="'.get_string('moveup_item','feedback').'" href="'.$buttonlink.'">
|
||||
<img alt="'.get_string('moveup_item','feedback').'" src="'.$OUTPUT->pix_url('t/up') . '" />
|
||||
</a>';
|
||||
echo '</span>';
|
||||
}
|
||||
//print the movedown-button
|
||||
if($feedbackitem->position < $lastposition - 1){
|
||||
echo '<span class="feedback_item_command_movedown">';
|
||||
$movedownurl = new moodle_url($url, array('movedownitem'=>$feedbackitem->id));
|
||||
$buttonlink = $movedownurl->out();
|
||||
echo '<a class="icon down" title="'.get_string('movedown_item','feedback').'" href="'.$buttonlink.'">
|
||||
<img alt="'.get_string('movedown_item','feedback').'" src="'.$OUTPUT->pix_url('t/down') . '" />
|
||||
</a>';
|
||||
echo '</span>';
|
||||
}
|
||||
//print the move-button
|
||||
echo '<span class="feedback_item_command_move">';
|
||||
$moveurl = new moodle_url($url, array('moveitem'=>$feedbackitem->id));
|
||||
$buttonlink = $moveurl->out();
|
||||
echo '<a class="editing_move" title="'.get_string('move_item','feedback').'" href="'.$buttonlink.'">
|
||||
<img alt="'.get_string('move_item','feedback').'" src="'.$OUTPUT->pix_url('t/move') . '" />
|
||||
</a>';
|
||||
echo '</span>';
|
||||
//print the button to edit the item
|
||||
if($feedbackitem->typ != 'pagebreak') {
|
||||
echo '<span class="feedback_item_command_edit">';
|
||||
$editurl = new moodle_url('/mod/feedback/edit_item.php');
|
||||
$editurl->params(array('do_show'=>$do_show,
|
||||
'cmid'=>$id,
|
||||
'id'=>$feedbackitem->id,
|
||||
'typ'=>$feedbackitem->typ));
|
||||
|
||||
// in edit_item.php the param id is used for the itemid and the cmid is the id to get the module
|
||||
$buttonlink = $editurl->out();
|
||||
echo '<a class="editing_update" title="'.get_string('edit_item','feedback').'" href="'.$buttonlink.'">
|
||||
<img alt="'.get_string('edit_item','feedback').'" src="'.$OUTPUT->pix_url('t/edit') . '" />
|
||||
</a>';
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
//print the toggle-button to switch required yes/no
|
||||
if($feedbackitem->hasvalue == 1) {
|
||||
echo '<span class="feedback_item_command_toggle">';
|
||||
// echo '<form action="edit.php" method="post"><fieldset>';
|
||||
if($feedbackitem->required == 1) {
|
||||
// echo '<input title="'.get_string('switch_item_to_not_required','feedback').'" type="image" src="pics/required.gif" hspace="1" height="11" width="11" border="0" />';
|
||||
// echo '<input class="feedback_required_button" title="'.get_string('switch_item_to_not_required','feedback').'" type="image" src="pics/required.gif" />';
|
||||
$buttontitle = get_string('switch_item_to_not_required','feedback');
|
||||
$buttonimg = 'pics/required.gif';
|
||||
} else {
|
||||
// echo '<input title="'.get_string('switch_item_to_required','feedback').'" type="image" src="pics/notrequired.gif" hspace="1" height="11" width="11" border="0" />';
|
||||
// echo '<input class="feedback_required_button" title="'.get_string('switch_item_to_required','feedback').'" type="image" src="pics/notrequired.gif" />';
|
||||
$buttontitle = get_string('switch_item_to_required','feedback');
|
||||
$buttonimg = 'pics/notrequired.gif';
|
||||
}
|
||||
$requiredurl = new moodle_url($url, array('switchitemrequired'=>$feedbackitem->id));
|
||||
$buttonlink = $requiredurl->out();
|
||||
echo '<a class="icon feedback_switchrequired" title="'.$buttontitle.'" href="'.$buttonlink.'">
|
||||
<img alt="'.$buttontitle.'" src="'.$buttonimg.'" />
|
||||
</a>';
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
//print the delete-button
|
||||
echo '<span class="feedback_item_command_toggle">';
|
||||
$deleteitemurl = new moodle_url('/mod/feedback/delete_item.php');
|
||||
$deleteitemurl->params(array('id'=>$id,
|
||||
'do_show'=>$do_show,
|
||||
'deleteitem'=>$feedbackitem->id));
|
||||
|
||||
$buttonlink = $deleteitemurl->out();
|
||||
echo '<a class="icon delete" title="'.get_string('delete_item','feedback').'" href="'.$buttonlink.'">
|
||||
<img alt="'.get_string('delete_item','feedback').'" src="'.$OUTPUT->pix_url('t/delete') . '" />
|
||||
</a>';
|
||||
echo '</span>';
|
||||
echo $OUTPUT->box_end();
|
||||
if($feedbackitem->typ != 'pagebreak') {
|
||||
feedback_print_item_preview($feedbackitem);
|
||||
}else {
|
||||
echo $OUTPUT->box_start('feedback_pagebreak');
|
||||
echo get_string('pagebreak', 'feedback').'<hr class="feedback_pagebreak" />';
|
||||
echo $OUTPUT->box_end();
|
||||
}
|
||||
echo $OUTPUT->box_end();
|
||||
echo $OUTPUT->box_end();
|
||||
if(isset($SESSION->feedback->moving) AND $SESSION->feedback->moving->shouldmoving == 1) {
|
||||
$moveposition++;
|
||||
$movehereurl->param('movehere', $moveposition);
|
||||
echo $OUTPUT->box_start('clipboard'); //only shown if shouldmoving = 1
|
||||
$buttonlink = $movehereurl->out();
|
||||
echo '<a title="'.get_string('move_here','feedback').'" href="'.$buttonlink.'">
|
||||
<img class="movetarget" alt="'.get_string('move_here','feedback').'" src="'.$OUTPUT->pix_url('movehere') . '" />
|
||||
</a>';
|
||||
echo $OUTPUT->box_end();
|
||||
}
|
||||
echo '<div class="clearer"> </div>';
|
||||
}
|
||||
if ($feedbackitem->dependitem > 0) {
|
||||
$dependstyle = ' feedback_depend';
|
||||
} else {
|
||||
$dependstyle = '';
|
||||
}
|
||||
echo $OUTPUT->box_start('feedback_item_box_'.$align.$dependstyle);
|
||||
//items without value only are labels
|
||||
if ($feedbackitem->hasvalue == 1 AND $feedback->autonumbering) {
|
||||
$itemnr++;
|
||||
echo $OUTPUT->box_start('feedback_item_number_'.$align);
|
||||
echo $itemnr;
|
||||
echo $OUTPUT->box_end();
|
||||
}
|
||||
echo $OUTPUT->box_start('box generalbox boxalign_'.$align);
|
||||
echo $OUTPUT->box_start('feedback_item_commands_'.$align);
|
||||
echo '<span class="feedback_item_commands">';
|
||||
echo '('.get_string('position', 'feedback').':'.$itempos .')';
|
||||
echo '</span>';
|
||||
//print the moveup-button
|
||||
if ($feedbackitem->position > 1) {
|
||||
echo '<span class="feedback_item_command_moveup">';
|
||||
$moveupurl = new moodle_url($url, array('moveupitem'=>$feedbackitem->id));
|
||||
$buttonlink = $moveupurl->out();
|
||||
$strbutton = get_string('moveup_item', 'feedback');
|
||||
echo '<a class="icon up" title="'.$strbutton.'" href="'.$buttonlink.'">
|
||||
<img alt="'.$strbutton.'" src="'.$OUTPUT->pix_url('t/up') . '" />
|
||||
</a>';
|
||||
echo '</span>';
|
||||
}
|
||||
//print the movedown-button
|
||||
if ($feedbackitem->position < $lastposition - 1) {
|
||||
echo '<span class="feedback_item_command_movedown">';
|
||||
$urlparams = array('movedownitem'=>$feedbackitem->id);
|
||||
$movedownurl = new moodle_url($url, $urlparams);
|
||||
$buttonlink = $movedownurl->out();
|
||||
$strbutton = get_string('movedown_item', 'feedback');
|
||||
echo '<a class="icon down" title="'.$strbutton.'" href="'.$buttonlink.'">
|
||||
<img alt="'.$strbutton.'" src="'.$OUTPUT->pix_url('t/down') . '" />
|
||||
</a>';
|
||||
echo '</span>';
|
||||
}
|
||||
//print the move-button
|
||||
echo '<span class="feedback_item_command_move">';
|
||||
$moveurl = new moodle_url($url, array('moveitem'=>$feedbackitem->id));
|
||||
$buttonlink = $moveurl->out();
|
||||
$strbutton = get_string('move_item', 'feedback');
|
||||
echo '<a class="editing_move" title="'.$strbutton.'" href="'.$buttonlink.'">
|
||||
<img alt="'.$strbutton.'" src="'.$OUTPUT->pix_url('t/move') . '" />
|
||||
</a>';
|
||||
echo '</span>';
|
||||
//print the button to edit the item
|
||||
if ($feedbackitem->typ != 'pagebreak') {
|
||||
echo '<span class="feedback_item_command_edit">';
|
||||
$editurl = new moodle_url('/mod/feedback/edit_item.php');
|
||||
$editurl->params(array('do_show'=>$do_show,
|
||||
'cmid'=>$id,
|
||||
'id'=>$feedbackitem->id,
|
||||
'typ'=>$feedbackitem->typ));
|
||||
|
||||
// in edit_item.php the param id is used for the itemid
|
||||
// and the cmid is the id to get the module
|
||||
$buttonlink = $editurl->out();
|
||||
$strbutton = get_string('edit_item', 'feedback');
|
||||
echo '<a class="editing_update" title="'.$strbutton.'" href="'.$buttonlink.'">
|
||||
<img alt="'.$strbutton.'" src="'.$OUTPUT->pix_url('t/edit') . '" />
|
||||
</a>';
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
//print the toggle-button to switch required yes/no
|
||||
if ($feedbackitem->hasvalue == 1) {
|
||||
echo '<span class="feedback_item_command_toggle">';
|
||||
if ($feedbackitem->required == 1) {
|
||||
$buttontitle = get_string('switch_item_to_not_required', 'feedback');
|
||||
$buttonimg = 'pics/required.gif';
|
||||
} else {
|
||||
$buttontitle = get_string('switch_item_to_required', 'feedback');
|
||||
$buttonimg = 'pics/notrequired.gif';
|
||||
}
|
||||
$urlparams = array('switchitemrequired'=>$feedbackitem->id);
|
||||
$requiredurl = new moodle_url($url, $urlparams);
|
||||
$buttonlink = $requiredurl->out();
|
||||
echo '<a class="icon '.
|
||||
'feedback_switchrequired" '.
|
||||
'title="'.$buttontitle.'" '.
|
||||
'href="'.$buttonlink.'">'.
|
||||
'<img alt="'.$buttontitle.'" src="'.$buttonimg.'" />'.
|
||||
'</a>';
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
//print the delete-button
|
||||
echo '<span class="feedback_item_command_toggle">';
|
||||
$deleteitemurl = new moodle_url('/mod/feedback/delete_item.php');
|
||||
$deleteitemurl->params(array('id'=>$id,
|
||||
'do_show'=>$do_show,
|
||||
'deleteitem'=>$feedbackitem->id));
|
||||
|
||||
$buttonlink = $deleteitemurl->out();
|
||||
$strbutton = get_string('delete_item', 'feedback');
|
||||
$src = $OUTPUT->pix_url('t/delete');
|
||||
echo '<a class="icon delete" title="'.$strbutton.'" href="'.$buttonlink.'">
|
||||
<img alt="'.$strbutton.'" src="'.$src.'" />
|
||||
</a>';
|
||||
echo '</span>';
|
||||
echo $OUTPUT->box_end();
|
||||
if ($feedbackitem->typ != 'pagebreak') {
|
||||
feedback_print_item_preview($feedbackitem);
|
||||
} else {
|
||||
echo $OUTPUT->box_start('feedback_pagebreak');
|
||||
echo get_string('pagebreak', 'feedback').'<hr class="feedback_pagebreak" />';
|
||||
echo $OUTPUT->box_end();
|
||||
}
|
||||
echo $OUTPUT->box_end();
|
||||
echo $OUTPUT->box_end();
|
||||
if (isset($SESSION->feedback->moving) AND $SESSION->feedback->moving->shouldmoving == 1) {
|
||||
$moveposition++;
|
||||
$movehereurl->param('movehere', $moveposition);
|
||||
echo $OUTPUT->box_start('clipboard'); //only shown if shouldmoving = 1
|
||||
$buttonlink = $movehereurl->out();
|
||||
$strbutton = get_string('move_here', 'feedback');
|
||||
$src = $OUTPUT->pix_url('movehere');
|
||||
echo '<a title="'.$strbutton.'" href="'.$buttonlink.'">
|
||||
<img class="movetarget" alt="'.$strbutton.'" src="'.$src.'" />
|
||||
</a>';
|
||||
echo $OUTPUT->box_end();
|
||||
}
|
||||
echo '<div class="clearer"> </div>';
|
||||
}
|
||||
echo $OUTPUT->box_end();
|
||||
}else{
|
||||
echo $OUTPUT->box(get_string('no_items_available_yet','feedback'),'generalbox boxaligncenter');
|
||||
} else {
|
||||
echo $OUTPUT->box(get_string('no_items_available_yet', 'feedback'),
|
||||
'generalbox boxaligncenter');
|
||||
}
|
||||
}
|
||||
/// Finish the page
|
||||
|
||||
Reference in New Issue
Block a user