Skip to content
Snippets Groups Projects
Select Git revision
  • 8fef8bc3c46650f9bdcb9beffeafdd01ef8fe76f
  • main default protected
  • 5.5 protected
  • atlantis
  • 5.3 protected
  • 5.0 protected
  • issue-23
  • issue8-seat-logging-and-export
  • ticket-216
  • tickets-215-216-241-242
10 results

ConsultationCreator.vue

Blame
  • Forked from Stud.IP / Stud.IP
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    BasicDataWizardStep.php 25.60 KiB
    <?php
    /**
     * BasicDataWizardStep.php
     * Course wizard step for getting the basic course data.
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License as
     * published by the Free Software Foundation; either version 2 of
     * the License, or (at your option) any later version.
     *
     * @author      Thomas Hackl <thomas.hackl@uni-passau.de>
     * @copyright   2015 Stud.IP Core-Group
     * @license     http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
     * @category    Stud.IP
     */
    
    class BasicDataWizardStep implements CourseWizardStep
    {
        /**
         * Returns the Flexi template for entering the necessary values
         * for this step.
         *
         * @param Array $values Pre-set values
         * @param int $stepnumber which number has the current step in the wizard?
         * @param String $temp_id temporary ID for wizard workflow
         * @return String a Flexi template for getting needed data.
         */
        public function getStepTemplate($values, $stepnumber, $temp_id)
        {
            // Load template from step template directory.
            $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views/course/wizard/steps');
            if ($values[__CLASS__]['studygroup']) {
                $tpl = $factory->open('basicdata/index_studygroup');
                $values[__CLASS__]['lecturers'][$GLOBALS['user']->id] = 1;
            } else {
                $tpl = $factory->open('basicdata/index');
            }
            if ($this->setupTemplateAttributes($tpl, $values, $stepnumber, $temp_id)) {
                return $tpl->render();
            }
        }
    
        protected function setupTemplateAttributes($tpl, $values, $stepnumber, $temp_id)
        {
            // We only need our own stored values here.
            $values = $values[__CLASS__];
            // Get all available course types and their categories.
            $typestruct = [];
            foreach (SemType::getTypes() as $type) {
                $class = $type->getClass();
                // Creates a studygroup.
                if ($values['studygroup']) {
                    // Get all studygroup types.
                    if ($class['studygroup_mode']) {
                        $typestruct[$class['name']][] = $type;
                    }
                    // Pre-set institute for studygroup assignment.
                    $values['institute'] = Config::get()->STUDYGROUP_DEFAULT_INST;
                // Normal course.
                } else {
                    if (!$class['course_creation_forbidden'] && !$class['studygroup_mode']) {
                        $typestruct[$class['name']][] = $type;
                    }
                }
            }
            $tpl->set_attribute('types', $typestruct);
            // Select a default type if none is given.
            if (!$values['coursetype']) {
                if ($GLOBALS['user']->cfg->MY_COURSES_TYPE_FILTER && Request::isXhr()) {
                    $values['coursetype'] = $GLOBALS['user']->cfg->MY_COURSES_TYPE_FILTER;