示例#1
0
 /**
  * Shows a dialog for creating or editing a course wizard step.
  * @param string $id ID of step to edit, or null if new step
  */
 public function edit_action($id = '')
 {
     if ($id) {
         $title = _('Schritt bearbeiten');
         $this->step = CourseWizardStepRegistry::find($id);
     } else {
         $title = _('Schritt hinzufügen');
         $this->step = new CourseWizardStepRegistry();
         $this->step->name = '';
         $this->step->classname = '';
         $this->step->number = 0;
         $this->step->enabled = false;
         $this->availableClasses = array();
         foreach (get_declared_classes() as $className) {
             if (is_a($className, "CourseWizardStep", true) && $className !== "CourseWizardStep") {
                 $collection = new SimpleCollection(CourseWizardStepRegistry::findBySQL("1 ORDER BY `number`"));
                 if (!in_array($className, $collection->pluck("classname"))) {
                     $this->availableClasses[] = $className;
                 }
             }
         }
     }
     if (Request::isXhr()) {
         $this->response->add_header('X-Title', $title);
     }
 }
示例#2
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;
     }
 }