Skip to content
Snippets Groups Projects
Select Git revision
  • 650de7b907980cda5e0fbf7c9c425e4c485f4a46
  • main default protected
  • step-3263
  • feature/plugins-cli
  • feature/vite
  • step-2484-peerreview
  • biest/issue-5051
  • tests/simplify-jsonapi-tests
  • fix/typo-in-1a70031
  • feature/broadcasting
  • database-seeders-and-factories
  • feature/peer-review-2
  • feature-feedback-jsonapi
  • feature/peerreview
  • feature/balloon-plus
  • feature/stock-images-unsplash
  • tic-2588
  • 5.0
  • 5.2
  • biest/unlock-blocks
  • biest-1514
21 results

Instance.php

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.
    Form.php 15.11 KiB
    <?php
    
    namespace Studip\Forms;
    
    class Form extends Part
    {
    
        //models:
        protected $store_callbacks = [];
    
        //internals
        protected $inputs = [];
        protected $parts = [];
    
        //appearance in html-form
        protected $url = null;
        protected $save_button_text = '';
        protected $save_button_name = '';
    
        protected $cancel_button_text = '';
        protected $cancel_button_name = '';
        protected $autoStore = false;
        protected $debugmode = false;
        protected $success_message = '';
    
        protected $collapsable = false;
        protected $data_secure = true;
    
        //to identify a form element
        protected $id = null;
    
        /**
         * Creates a new Form object from a SORM object so that each field of the db-table becomes
         * an input-field of the form. You can modify the form by the params.
         * @param \SimpleORMap $object
         * @param array $params
         * @param string|null $url
         * @return Form
         */
        public static function fromSORM(\SimpleORMap $object, $params = [], $url = null)
        {
            $form = static::create();
            $form->addSORM($object, $params);
            if ($url) {
                $form->setURL($url);
            }
            return $form;
        }
    
    
        /**
         * A static constructor for an empty Form object.
         * @return Form
         */
        public static function create() : Form
        {
            $form = new static();
            return $form;
        }
    
        /**
         * Finalized constructor.
         *
         * @param mixed[] ...$parts
         */
        final public function __construct(...$parts)
        {
            parent::__construct(...$parts);
            //Set a default for the success message:
            $this->success_message = _('Daten wurden gespeichert.');