Exemplo n.º 1
0
/**
 * compares the value of the itemid related to the completedid with the dependvalue.
 * this is used if a depend item is set.
 * the value can come as temporary or as permanently value. the deciding is done by $tmp.
 *
 * @global object
 * @global object
 * @param int $completeid
 * @param int $itemid
 * @param mixed $dependvalue
 * @param boolean $tmp
 * @return bool
 */
function feedback_compare_item_value($completedid, $itemid, $dependvalue, $tmp = false) {
    global $DB, $CFG;

    $dbvalue = feedback_get_item_value($completedid, $itemid, $tmp);

    //get the class of the given item-typ
    $item = $DB->get_record('feedback_item', array('id'=>$itemid));

    //get the instance of the item-class
    $itemobj = feedback_get_item_class($item->typ);
    return $itemobj->compare_value($item, $dbvalue, $dependvalue); //true or false
}
Exemplo n.º 2
0
 foreach ($feedbackitems as $feedbackitem) {
     if (!isset($startitem)) {
         //avoid showing double pagebreaks
         if ($feedbackitem->typ == 'pagebreak') {
             continue;
         }
         $startitem = $feedbackitem;
     }
     $value = '';
     //get the value
     $frmvaluename = $feedbackitem->typ . '_' . $feedbackitem->id;
     if (isset($savereturn)) {
         $value = isset($formdata->{$frmvaluename}) ? $formdata->{$frmvaluename} : NULL;
     } else {
         if (isset($feedbackcompletedtmp->id)) {
             $value = feedback_get_item_value($feedbackcompletedtmp->id, $feedbackitem->id, true);
         }
     }
     echo '<tr>';
     if ($feedbackitem->hasvalue == 1 and $feedback->autonumbering) {
         $itemnr++;
         echo '<td valign="top">' . $itemnr . '.&nbsp;</td>';
     } else {
         echo '<td>&nbsp;</td>';
     }
     if ($feedbackitem->typ != 'pagebreak') {
         feedback_print_item($feedbackitem, $value, false, false, $highlightrequired);
     }
     echo '</tr>';
     echo '<tr><td>&nbsp;</td></tr>';
     $lastbreakposition = $feedbackitem->position;
Exemplo n.º 3
0
 foreach ($feedbackitems as $feedbackitem) {
     if (!isset($startitem)) {
         //avoid showing double pagebreaks
         if ($feedbackitem->typ == 'pagebreak') {
             continue;
         }
         $startitem = $feedbackitem;
     }
     $value = '';
     //get the value
     $frmvaluename = $feedbackitem->typ . '_' . $feedbackitem->id;
     if (isset($savereturn)) {
         $value = isset($formdata->{$frmvaluename}) ? $formdata->{$frmvaluename} : NULL;
     } else {
         if (isset($feedbackcompletedtmp->id)) {
             $value = feedback_get_item_value($feedbackcompletedtmp->id, $feedbackitem->id, $USER->sesskey);
         }
     }
     echo '<tr>';
     if ($feedbackitem->hasvalue == 1 and $feedback->autonumbering) {
         $itemnr++;
         echo '<td valign="top">' . $itemnr . '.&nbsp;</td>';
     } else {
         echo '<td>&nbsp;</td>';
     }
     if ($feedbackitem->typ != 'pagebreak') {
         feedback_print_item($feedbackitem, $value, false, false, $highlightrequired);
     }
     echo '</tr>';
     echo '<tr><td>&nbsp;</td></tr>';
     $lastbreakposition = $feedbackitem->position;
Exemplo n.º 4
0
     }
 }
 if ($feedbackitem->dependitem > 0) {
     $dependstyle = ' feedback_complete_depend';
 } else {
     $dependstyle = '';
 }
 echo $OUTPUT->box_start('feedback_item_box_' . $align . $dependstyle);
 $value = '';
 //get the value
 $frmvaluename = $feedbackitem->typ . '_' . $feedbackitem->id;
 if (isset($savereturn)) {
     $value = isset($formdata->{$frmvaluename}) ? $formdata->{$frmvaluename} : NULL;
 } else {
     if (isset($feedbackcompletedtmp->id)) {
         $value = feedback_get_item_value($feedbackcompletedtmp->id, $feedbackitem->id, sesskey());
     }
 }
 if ($feedbackitem->hasvalue == 1 and $feedback->autonumbering) {
     $itemnr++;
     echo $OUTPUT->box_start('feedback_item_number_' . $align);
     echo $itemnr;
     echo $OUTPUT->box_end();
 }
 if ($feedbackitem->typ != 'pagebreak') {
     echo $OUTPUT->box_start('box generalbox boxalign_' . $align);
     feedback_print_item_complete($feedbackitem, $value, $highlightrequired);
     echo $OUTPUT->box_end();
 }
 echo $OUTPUT->box_end();
 $lastbreakposition = $feedbackitem->position;
Exemplo n.º 5
0
/**
 * compares the value of the itemid related to the completedid with the dependvalue.
 * this is used if a depend item is set.
 * the value can come as temporary or as permanently value. the deciding is done by $tmp.
 *
 * @param int $completedid
 * @param stdClass|int $item
 * @param mixed $dependvalue
 * @param bool $tmp
 * @return bool
 */
function feedback_compare_item_value($completedid, $item, $dependvalue, $tmp = false)
{
    global $DB;
    if (is_int($item)) {
        $item = $DB->get_record('feedback_item', array('id' => $item));
    }
    $dbvalue = feedback_get_item_value($completedid, $item->id, $tmp);
    $itemobj = feedback_get_item_class($item->typ);
    return $itemobj->compare_value($item, $dbvalue, $dependvalue);
    //true or false
}