Exemplo n.º 1
0
 function &getDisplay()
 {
     require_once 'AMP/UserData/Controller.php';
     require_once 'AMP/Content/Display/HTML.inc.php';
     $udm = new UserDataInput($this->dbcon, $this->getFormId());
     $action_plugin =& $udm->registerPlugin('AMPAction', 'Start');
     $action_plugin->setOptions(array('action_id' => $this->id));
     $controller = new UserData_Controller($udm);
     $controller->execute();
     return $controller->getDisplay();
 }
Exemplo n.º 2
0
 function _make_new_quiz_form($data, $fieldname)
 {
     if (!(isset($data[$fieldname]) && $data[$fieldname])) {
         $new_form = new AMPSystem_UserData(AMP_Registry::getDbcon());
         $new_form->setDefaults();
         $new_form->mergeData(array('name' => $data['name'], 'publish_form' => $data['publish']));
         $new_form->save();
         $udm = new UserDataInput(AMP_Registry::getDbcon(), $new_form->id, true);
         $read_plugin =& $udm->registerPlugin("AMP", 'Save');
         $read_plugin->saveRegistration('AMP', 'Save');
         $save_plugin =& $udm->registerPlugin('AMP', 'Read');
         $save_plugin->saveRegistration('AMP', 'Read');
     } else {
         $udm = new UserDataInput(AMP_Registry::getDbcon(), $data[$fieldname], true);
     }
     $this->_udm =& $udm;
     $override_plugin =& $udm->registerPlugin("QuickForm", 'Override');
     if (!$override_plugin->plugin_instance) {
         $override_plugin->saveRegistration('QuickForm', 'Override');
         $override_plugin->saveOption('override_file', "form.{$udm->instance}.quiz.xml");
     }
     return $udm->instance;
 }