Add required rules when editon custom icon on course homepage - refs #8194

1.10.x
Angel Fernando Quiroz Campos 9 years ago
parent 91150cfe5c
commit 5d85e2a36f
  1. 17
      main/course_info/tools.php

@ -49,15 +49,14 @@ switch ($action) {
$currentUrl = api_get_self().'?action=edit_icon&id=' . $id.'&'.api_get_cidreq();
$form = new FormValidator('icon_edit', 'post', $currentUrl);
$form->addElement('header', get_lang('EditIcon'));
$form->addHeader(get_lang('EditIcon'));
$form->addHtml('<div class="col-md-7">');
$form->addElement('text', 'name', get_lang('Name'));
$form->addElement('text', 'link', get_lang('Links'));
$form->addText('name', get_lang('Name'));
$form->addText('link', get_lang('Links'));
$allowed_picture_types = array ('jpg', 'jpeg', 'png');
$form->addElement('file', 'icon', get_lang('CustomIcon'));
$form->addFile('icon', get_lang('CustomIcon'));
$form->addRule('icon', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types);
$form->addElement(
'select',
$form->addSelect(
'target',
get_lang('LinkTarget'),
[
@ -65,14 +64,12 @@ switch ($action) {
'_blank' => get_lang('LinkOpenBlank')
]
);
$form->addElement(
'select',
$form->addSelect(
'visibility',
get_lang('Visibility'),
array(1 => get_lang('Visible'), 0 => get_lang('Invisible'))
);
$form->addElement(
'textarea',
$form->addTextarea(
'description',
get_lang('Description'),
array('rows' => '3', 'cols' => '40')

Loading…
Cancel
Save