function build_editform($item, $feedback, $cm)
 {
     global $DB, $CFG;
     require_once 'label_form.php';
     //get the lastposition number of the feedback_items
     $position = $item->position;
     $lastposition = $DB->count_records('feedback_item', array('feedback' => $feedback->id));
     if ($position == -1) {
         $i_formselect_last = $lastposition + 1;
         $i_formselect_value = $lastposition + 1;
         $item->position = $lastposition + 1;
     } else {
         $i_formselect_last = $lastposition;
         $i_formselect_value = $item->position;
     }
     //the elements for position dropdownlist
     $positionlist = array_slice(range(0, $i_formselect_last), 1, $i_formselect_last, true);
     //all items for dependitem
     $feedbackitems = feedback_get_depend_candidates_for_item($feedback, $item);
     $commonparams = array('cmid' => $cm->id, 'id' => isset($item->id) ? $item->id : NULL, 'typ' => $item->typ, 'items' => $feedbackitems, 'feedback' => $feedback->id);
     $this->context = get_context_instance(CONTEXT_MODULE, $cm->id);
     //preparing the editor for new file-api
     $item->presentationformat = FORMAT_HTML;
     $item->presentationtrust = 1;
     $item = file_prepare_standard_editor($item, 'presentation', $this->presentationoptions, $this->context, 'mod_feedback', 'item', $item->id);
     //build the form
     $this->item_form = new feedback_label_form('edit_item.php', array('item' => $item, 'common' => $commonparams, 'positionlist' => $positionlist, 'position' => $position, 'presentationoptions' => $this->presentationoptions));
 }
 function build_editform($item, $feedback, $cm)
 {
     global $DB, $CFG;
     require_once 'multichoicerated_form.php';
     //get the lastposition number of the feedback_items
     $position = $item->position;
     $lastposition = $DB->count_records('feedback_item', array('feedback' => $feedback->id));
     if ($position == -1) {
         $i_formselect_last = $lastposition + 1;
         $i_formselect_value = $lastposition + 1;
         $item->position = $lastposition + 1;
     } else {
         $i_formselect_last = $lastposition;
         $i_formselect_value = $item->position;
     }
     //the elements for position dropdownlist
     $positionlist = array_slice(range(0, $i_formselect_last), 1, $i_formselect_last, true);
     $item->presentation = empty($item->presentation) ? '' : $item->presentation;
     $info = $this->get_info($item);
     $item->ignoreempty = $this->ignoreempty($item);
     $item->hidenoselect = $this->hidenoselect($item);
     //all items for dependitem
     $feedbackitems = feedback_get_depend_candidates_for_item($feedback, $item);
     $commonparams = array('cmid' => $cm->id, 'id' => isset($item->id) ? $item->id : NULL, 'typ' => $item->typ, 'items' => $feedbackitems, 'feedback' => $feedback->id);
     //build the form
     $this->item_form = new feedback_multichoicerated_form('edit_item.php', array('item' => $item, 'common' => $commonparams, 'positionlist' => $positionlist, 'position' => $position, 'info' => $info));
 }
Exemplo n.º 3
0
 function build_editform($item, $feedback, $cm)
 {
     global $DB, $CFG;
     require_once 'numeric_form.php';
     //get the lastposition number of the feedback_items
     $position = $item->position;
     $lastposition = $DB->count_records('feedback_item', array('feedback' => $feedback->id));
     if ($position == -1) {
         $i_formselect_last = $lastposition + 1;
         $i_formselect_value = $lastposition + 1;
         $item->position = $lastposition + 1;
     } else {
         $i_formselect_last = $lastposition;
         $i_formselect_value = $item->position;
     }
     //the elements for position dropdownlist
     $positionlist = array_slice(range(0, $i_formselect_last), 1, $i_formselect_last, true);
     $item->presentation = empty($item->presentation) ? '' : $item->presentation;
     $range_from_to = explode('|', $item->presentation);
     $range_from = (isset($range_from_to[0]) and is_numeric($range_from_to[0])) ? str_replace(FEEDBACK_DECIMAL, $this->sep_dec, floatval($range_from_to[0])) : '-';
     $range_to = (isset($range_from_to[1]) and is_numeric($range_from_to[1])) ? str_replace(FEEDBACK_DECIMAL, $this->sep_dec, floatval($range_from_to[1])) : '-';
     $item->rangefrom = $range_from;
     $item->rangeto = $range_to;
     //all items for dependitem
     $feedbackitems = feedback_get_depend_candidates_for_item($feedback, $item);
     $commonparams = array('cmid' => $cm->id, 'id' => isset($item->id) ? $item->id : NULL, 'typ' => $item->typ, 'items' => $feedbackitems, 'feedback' => $feedback->id);
     //build the form
     $this->item_form = new feedback_numeric_form('edit_item.php', array('item' => $item, 'common' => $commonparams, 'positionlist' => $positionlist, 'position' => $position));
 }
 function build_editform($item, $feedback, $cm)
 {
     global $DB, $CFG;
     require_once 'textfield_form.php';
     //get the lastposition number of the feedback_items
     $position = $item->position;
     $lastposition = $DB->count_records('feedback_item', array('feedback' => $feedback->id));
     if ($position == -1) {
         $i_formselect_last = $lastposition + 1;
         $i_formselect_value = $lastposition + 1;
         $item->position = $lastposition + 1;
     } else {
         $i_formselect_last = $lastposition;
         $i_formselect_value = $item->position;
     }
     //the elements for position dropdownlist
     $positionlist = array_slice(range(0, $i_formselect_last), 1, $i_formselect_last, true);
     $item->presentation = empty($item->presentation) ? '' : $item->presentation;
     $sizeAndLength = explode('|', $item->presentation);
     $itemsize = (isset($sizeAndLength[0]) and $sizeAndLength[0] >= 5) ? $sizeAndLength[0] : 30;
     $itemlength = isset($sizeAndLength[1]) ? $sizeAndLength[1] : 5;
     $item->itemsize = $itemsize;
     $item->itemmaxlength = $itemlength;
     //all items for dependitem
     $feedbackitems = feedback_get_depend_candidates_for_item($feedback, $item);
     $commonparams = array('cmid' => $cm->id, 'id' => isset($item->id) ? $item->id : NULL, 'typ' => $item->typ, 'items' => $feedbackitems, 'feedback' => $feedback->id);
     //build the form
     $this->item_form = new feedback_textfield_form('edit_item.php', array('item' => $item, 'common' => $commonparams, 'positionlist' => $positionlist, 'position' => $position));
 }
Exemplo n.º 5
0
 public function build_editform($item, $feedback, $cm)
 {
     global $DB, $CFG;
     require_once 'info_form.php';
     //get the lastposition number of the feedback_items
     $position = $item->position;
     $lastposition = $DB->count_records('feedback_item', array('feedback' => $feedback->id));
     if ($position == -1) {
         $i_formselect_last = $lastposition + 1;
         $i_formselect_value = $lastposition + 1;
         $item->position = $lastposition + 1;
     } else {
         $i_formselect_last = $lastposition;
         $i_formselect_value = $item->position;
     }
     //the elements for position dropdownlist
     $positionlist = array_slice(range(0, $i_formselect_last), 1, $i_formselect_last, true);
     $item->presentation = empty($item->presentation) ? self::MODE_COURSE : $item->presentation;
     $item->required = 0;
     //all items for dependitem
     $feedbackitems = feedback_get_depend_candidates_for_item($feedback, $item);
     $commonparams = array('cmid' => $cm->id, 'id' => isset($item->id) ? $item->id : null, 'typ' => $item->typ, 'items' => $feedbackitems, 'feedback' => $feedback->id);
     // Options for the 'presentation' select element.
     $presentationoptions = array();
     if ($feedback->anonymous == FEEDBACK_ANONYMOUS_NO || $item->presentation == self::MODE_RESPONSETIME) {
         // "Response time" is hidden anyway in case of anonymous feedback, no reason to offer this option.
         // However if it was already selected leave it in the dropdown.
         $presentationoptions[self::MODE_RESPONSETIME] = get_string('responsetime', 'feedback');
     }
     $presentationoptions[self::MODE_COURSE] = get_string('course');
     $presentationoptions[self::MODE_CATEGORY] = get_string('coursecategory');
     //build the form
     $this->item_form = new feedback_info_form('edit_item.php', array('item' => $item, 'common' => $commonparams, 'positionlist' => $positionlist, 'position' => $position, 'presentationoptions' => $presentationoptions));
 }
Exemplo n.º 6
0
    public function build_editform($item, $feedback, $cm) {
        global $DB, $CFG;
        require_once('label_form.php');

        //get the lastposition number of the feedback_items
        $position = $item->position;
        $lastposition = $DB->count_records('feedback_item', array('feedback'=>$feedback->id));
        if ($position == -1) {
            $i_formselect_last = $lastposition + 1;
            $i_formselect_value = $lastposition + 1;
            $item->position = $lastposition + 1;
        } else {
            $i_formselect_last = $lastposition;
            $i_formselect_value = $item->position;
        }
        //the elements for position dropdownlist
        $positionlist = array_slice(range(0, $i_formselect_last), 1, $i_formselect_last, true);

        //all items for dependitem
        $feedbackitems = feedback_get_depend_candidates_for_item($feedback, $item);
        $commonparams = array('cmid'=>$cm->id,
                             'id'=>isset($item->id) ? $item->id : null,
                             'typ'=>$item->typ,
                             'items'=>$feedbackitems,
                             'feedback'=>$feedback->id);

        $this->context = context_module::instance($cm->id);

        //preparing the editor for new file-api
        $item->presentationformat = FORMAT_HTML;
        $item->presentationtrust = 1;

        // Append editor context to presentation options, giving preference to existing context.
        $this->presentationoptions = array_merge(array('context' => $this->context),
                                                 $this->presentationoptions);

        $item = file_prepare_standard_editor($item,
                                            'presentation', //name of the form element
                                            $this->presentationoptions,
                                            $this->context,
                                            'mod_feedback',
                                            'item', //the filearea
                                            $item->id);

        //build the form
        $customdata = array('item' => $item,
                            'common' => $commonparams,
                            'positionlist' => $positionlist,
                            'position' => $position,
                            'presentationoptions' => $this->presentationoptions);

        $this->item_form = new feedback_label_form('edit_item.php', $customdata);
    }
Exemplo n.º 7
0
    public function build_editform($item, $feedback, $cm) {
        global $DB, $CFG;
        require_once('textarea_form.php');

        //get the lastposition number of the feedback_items
        $position = $item->position;
        $lastposition = $DB->count_records('feedback_item', array('feedback'=>$feedback->id));
        if ($position == -1) {
            $i_formselect_last = $lastposition + 1;
            $i_formselect_value = $lastposition + 1;
            $item->position = $lastposition + 1;
        } else {
            $i_formselect_last = $lastposition;
            $i_formselect_value = $item->position;
        }
        //the elements for position dropdownlist
        $positionlist = array_slice(range(0, $i_formselect_last), 1, $i_formselect_last, true);

        $item->presentation = empty($item->presentation) ? '' : $item->presentation;

        $width_and_height = explode('|', $item->presentation);

        if (isset($width_and_height[0]) AND $width_and_height[0] >= 5) {
            $itemwidth = $width_and_height[0];
        } else {
            $itemwidth = 30;
        }

        if (isset($width_and_height[1])) {
            $itemheight = $width_and_height[1];
        } else {
            $itemheight = 5;
        }
        $item->itemwidth = $itemwidth;
        $item->itemheight = $itemheight;

        //all items for dependitem
        $feedbackitems = feedback_get_depend_candidates_for_item($feedback, $item);
        $commonparams = array('cmid'=>$cm->id,
                             'id'=>isset($item->id) ? $item->id : null,
                             'typ'=>$item->typ,
                             'items'=>$feedbackitems,
                             'feedback'=>$feedback->id);

        //build the form
        $customdata = array('item' => $item,
                            'common' => $commonparams,
                            'positionlist' => $positionlist,
                            'position' => $position);

        $this->item_form = new feedback_textarea_form('edit_item.php', $customdata);
    }