/** * Constructor for the base occurrence class * * * @global object * @param int $referentiel_referentiel id */ function bareme_class($params) { global $COURSE, $DB; global $CFG; if (!empty($params)) { if (!empty($params['blockid'])) { $this->blockid = $params['blockid']; } if (!empty($params['courseid'])) { $this->courseid = $params['courseid']; } if (!empty($params['occurrenceid'])) { $this->occurrenceid = $params['occurrenceid']; } else { $this->occurrenceid = 0; } if (!empty($params['baremeid'])) { $baremeid = $params['baremeid']; } else { $baremeid = 0; } if (!empty($params['scaleid'])) { $scaleid = $params['scaleid']; } else { $scaleid = 0; } if (!empty($baremeid)) { $this->bareme = $DB->get_record('referentiel_scale', array('id' => $baremeid)); } elseif (!empty($scaleid)) { if ($scale = $DB->get_record('scale', array('id' => $scaleid))) { // print_object($scale); $this->bareme = referentiel_scale_2_bareme($scale); } } } }
function referentiel_creation_modification_bareme($form) { global $DB; if (!empty($form) && !empty($form->scaleid)) { if ($scale = $DB->get_record('scale', array('id' => $form->scaleid))) { //echo "<br /> 486\n"; //print_object($form); //echo "<br />\n"; if ($rec_bareme = referentiel_scale_2_bareme($scale)) { $rec_bareme->threshold = $form->seuilid; $rec_bareme->icons = ''; if ($tscales = explode(',', $rec_bareme->scale)) { while (list($key, $val) = each($tscales)) { // echo "$key => $val<br />\n"; if (!empty($form->iconscale[$key])) { $rec_bareme->icons .= $form->iconscale[$key] . ','; } } } // DEBUG //echo "<br /> 501\n"; //print_object($rec_bareme); // tester s'il existe déjà if ($oldbareme = $DB->get_record('referentiel_scale', array('scaleid' => $rec_bareme->scaleid))) { $rec_bareme->id = $oldbareme->id; $DB->update_record('referentiel_scale', $rec_bareme); } else { // sinon le créer $rec_bareme->id = $DB->insert_record('referentiel_scale', $rec_bareme); } // DEBUG //echo "<br /> 513\n"; //print_object($rec_bareme); if ($rec_bareme->id && $form->ref_referentiel) { referentiel_set_bareme_occurrence($rec_bareme, $form->ref_referentiel); } } } } }
if ($rec_bareme = $DB->get_record('referentiel_scale', array('id' => $baremeid))) { // print_object($rec_bareme); referentiel_affiche_bareme($rec_bareme); referentiel_modifier_bareme($mode, $course->id, $cm->id, $rec_bareme, $referentiel_referentiel->id); echo $OUTPUT->box_end(); echo $OUTPUT->footer(); die; } } if (!empty($scaleid)) { if ($mode == 'editbareme' && confirm_sesskey()) { // DEBUG // echo "<br>DEBUG :: $scaleid selected\n"; if ($scale = $DB->get_record('scale', array('id' => $scaleid))) { // print_object($scale); if ($rec_bareme = referentiel_scale_2_bareme($scale)) { // print_object($rec_bareme); referentiel_affiche_bareme($rec_bareme); referentiel_modifier_bareme($mode, $course->id, $cm->id, $rec_bareme, $referentiel_referentiel->id); echo $OUTPUT->box_end(); echo $OUTPUT->footer(); die; } } } else { if ($mode == 'echangebareme' && confirm_sesskey()) { if ($confirm = optional_param('confirm', 0, PARAM_INT)) { referentiel_echange_bareme_occurrence($scaleid, $referentiel_referentiel->id); } } else { if ($mode == 'selectbareme') {