Ejemplo n.º 1
0
 /**
  * @param Pieform $form
  * @param $values
  */
 public static function submit(Pieform $form, $values)
 {
     global $USER, $SESSION;
     if (isset($values['flexifact'])) {
         $id = (int) $values['flexifact'];
         $artefact = new ArtefactTypeFlexifact($id);
     } else {
         $artefact = new ArtefactTypeFlexifact();
         $artefact->set('owner', $USER->get('id'));
     }
     $artefact->set('title', $values['title']);
     $artefact->commit();
     $SESSION->add_ok_msg(get_string('savedsuccessfully', 'artefact.flexifact'));
     $data = $form->get_elements('data');
     foreach ($data as $elements) {
         foreach ($elements as $key => $element) {
             if ($key == 'goto') {
                 redirect($element);
             }
         }
     }
 }