예제 #1
0
 public static function registerStep($name, $class, $number, $enabled = false)
 {
     $step = new CourseWizardStepRegistry();
     $step->name = $name;
     $step->classname = $class;
     $step->number = $number;
     $step->enabled = $enabled ? 1 : 0;
     return $step->store();
 }
예제 #2
0
 function up()
 {
     // Create table for step registry.
     DBManager::get()->execute("CREATE TABLE IF NOT EXISTS `coursewizardsteps` (\n            `id` VARCHAR(32) NOT NULL,\n            `name` VARCHAR(255) NOT NULL,\n            `classname` VARCHAR(255) NOT NULL UNIQUE,\n            `number` TINYINT(1) NOT NULL,\n            `enabled` TINYINT(1) NOT NULL DEFAULT 1,\n            `mkdate` INT NOT NULL DEFAULT 0,\n            `chdate` INT NOT NULL DEFAULT 0,\n            PRIMARY KEY (`id`))");
     // Add the default steps:
     // Step 1: Basic data.
     if (!CourseWizardStepRegistry::findByClassName('BasicDataWizardStep')) {
         CourseWizardStepRegistry::registerStep('Grunddaten', 'BasicDataWizardStep', 1, true);
     }
     // Step 2: Study area assignment (there are course classes requiring this).
     if (!CourseWizardStepRegistry::findByClassName('StudyAreasWizardStep')) {
         CourseWizardStepRegistry::registerStep('Studienbereiche', 'StudyAreasWizardStep', 2, true);
     }
     // Add text template for studygroup acceptance to global config.
     if (!Config::get()->STUDYGROUP_ACCEPTANCE_TEXT) {
         Config::get()->create('STUDYGROUP_ACCEPTANCE_TEXT', array('value' => _('Die Moderatorinnen und ' . 'Moderatoren der Studiengruppe können Ihren ' . 'Aufnahmewunsch bestätigen oder ablehnen. Erst nach ' . 'Bestätigung erhalten Sie vollen Zugriff auf die ' . 'Gruppe.'), 'is_default' => 1, 'type' => 'string', 'range' => 'global', 'section' => 'studygroups', 'description' => _('Text, der angezeigt wird, wenn man sich ' . 'in eine zugriffsbeschränkte Studiengruppe eintragen möchte')));
     }
 }
예제 #3
0
파일: wizard.php 프로젝트: ratbird/hope
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     global $perm;
     if (Request::isXhr()) {
         $this->dialog = true;
     }
     PageLayout::setTitle(_('Neue Veranstaltung anlegen'));
     $navigation = new Navigation(_('Neue Veranstaltung anlegen'), 'dispatch.php/course/wizard');
     Navigation::addItem('/browse/my_courses/new_course', $navigation);
     Navigation::activateItem('/browse/my_courses/new_course');
     $this->sidebar = Sidebar::get();
     $this->sidebar->setImage('sidebar/seminar-sidebar.png');
     $this->sidebar->setTitle(_('Neue Veranstaltung anlegen'));
     $this->steps = CourseWizardStepRegistry::findBySQL("`enabled`=1 ORDER BY `number`");
     // Special handling for studygroups.
     if (Request::int('studygroup')) {
         $this->flash['studygroup'] = true;
     }
 }
예제 #4
0
 /**
  * Deletes the given entry from step registry.
  * @param $id ID of the entry to delete
  */
 public function delete_action($id)
 {
     CSRFProtection::verifyUnsafeRequest();
     if (Request::submitted('delete')) {
         $step = CourseWizardStepRegistry::find($id);
         if ($step) {
             $name = $step->name;
             if (CourseWizardStepRegistry::unregisterStep($id)) {
                 PageLayout::postMessage(MessageBox::success(sprintf(_('Der Schritt "%s" wurde gelöscht.'), $name)));
             } else {
                 PageLayout::postMessage(MessageBox::error(sprintf(_('Der Schritt %s konnte nicht gelöscht werden.'), $name)));
             }
         }
     }
     $this->redirect($this->url_for('admin/coursewizardsteps'));
 }