3 declare(strict_types=1);
34 protected static string $js_path =
"./Modules/StudyProgramme/templates/js/";
63 $setterMethod =
"set" . ucfirst(
$key);
64 if (method_exists($this, $setterMethod)) {
65 $setterMethod($value);
71 $this->
setName(self::$default_from_name);
79 public static function addJavaScript(
bool $add_form_loader =
false,
string $js_base_path = null): void
84 $js_path = $js_base_path ?? self::$js_path;
86 $tpl->addJavaScript($js_path .
'ilAsyncPropertyFormGUI.js');
89 "$.ilAsyncPropertyForm.global_config.error_message_template = '" .
90 self::getErrorMessageTemplate() .
91 "'; $.ilAsyncPropertyForm.global_config.async_form_name = '" .
92 self::$default_from_name .
"';" 95 self::addOnLoadCode(
'global_config', $global_config);
97 if ($add_form_loader) {
98 self::addOnLoadCode(
'form_loader',
'$("body").ilAsyncPropertyForm();');
107 $result = parent::checkInput();
108 $this->has_errors = $result;
120 if (!$this->check_input_called) {
125 foreach ($this->
getItems() as $item) {
128 if (method_exists($item,
"getAlert") && $item->getAlert() !==
"") {
129 $errors[] = array(
'key' => $item->getFieldId(),
'message' => $item->getAlert());
151 $tpl =
new ilTemplate(
"tpl.property_form.html",
true,
true,
"Services/Form");
159 return trim(
$tpl->
get(
"alert"));
168 throw new ilException(
"You cannot clone into a already filled form!");
172 $properties = $reflect->getProperties(ReflectionProperty::IS_PUBLIC);
174 foreach ($properties as $property) {
175 $this->{$property->getName()} = $property->getValue($form_to_clone);
178 foreach ($form_to_clone->
getItems() as $item) {
197 if (!isset(self::$js_on_load_added[$id])) {
198 $tpl->addOnLoadCode($content);
199 self::$js_on_load_added[
$id] = $content;
208 self::addJavaScript($this->
isAsync());
210 return parent::getHTML();
218 if ($this->request_wrapper->has(
"cmd")) {
231 $a_formaction .=
"&cmdMode=asynch";
234 $this->formaction = $a_formaction;
239 return self::$js_path;
249 return self::$default_from_name;
267 self::$default_from_name = $a_name;
269 parent::setName($a_name);
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
get(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
setVariable($variable, $value='')
Sets a variable value.
Interface RequestWrapper.
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
__construct(Container $dic, ilPlugin $plugin)