Select Git revision
Instance.php
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.');