|
|
@ -36,7 +36,8 @@ class FormValidator extends HTML_QuickForm |
|
|
|
$attributes = [], |
|
|
|
$attributes = [], |
|
|
|
$layout = self::LAYOUT_HORIZONTAL, |
|
|
|
$layout = self::LAYOUT_HORIZONTAL, |
|
|
|
$trackSubmit = true |
|
|
|
$trackSubmit = true |
|
|
|
) { |
|
|
|
) |
|
|
|
|
|
|
|
{ |
|
|
|
// Default form class. |
|
|
|
// Default form class. |
|
|
|
if (is_array($attributes) && !isset($attributes['class']) || empty($attributes)) { |
|
|
|
if (is_array($attributes) && !isset($attributes['class']) || empty($attributes)) { |
|
|
|
$attributes['class'] = 'form-horizontal'; |
|
|
|
$attributes['class'] = 'form-horizontal'; |
|
|
@ -102,7 +103,7 @@ class FormValidator extends HTML_QuickForm |
|
|
|
|
|
|
|
|
|
|
|
//Set required field template |
|
|
|
//Set required field template |
|
|
|
$this->setRequiredNote( |
|
|
|
$this->setRequiredNote( |
|
|
|
'<span class="form_required">*</span> <small>'.get_lang('ThisFieldIsRequired').'</small>' |
|
|
|
'<span class="form_required">*</span> <small>' . get_lang('ThisFieldIsRequired') . '</small>' |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$noteTemplate = <<<EOT |
|
|
|
$noteTemplate = <<<EOT |
|
|
@ -133,15 +134,7 @@ EOT; |
|
|
|
{ |
|
|
|
{ |
|
|
|
return ' |
|
|
|
return ' |
|
|
|
<style> |
|
|
|
<style> |
|
|
|
.form_list { |
|
|
|
|
|
|
|
display: grid; |
|
|
|
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));; |
|
|
|
|
|
|
|
grid-gap: 10px 30px; |
|
|
|
|
|
|
|
gap: 10px 30px; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.form_list .input-group { |
|
|
|
|
|
|
|
display:block; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
</style> |
|
|
|
</style> |
|
|
|
<form{attributes}> |
|
|
|
<form{attributes}> |
|
|
|
<div class="form_list"> |
|
|
|
<div class="form_list"> |
|
|
@ -152,9 +145,9 @@ EOT; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|
|
|
|
* @return string |
|
|
|
* @todo this function should be added in the element class |
|
|
|
* @todo this function should be added in the element class |
|
|
|
* |
|
|
|
* |
|
|
|
* @return string |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function getDefaultElementTemplate() |
|
|
|
public function getDefaultElementTemplate() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -250,8 +243,8 @@ EOT; |
|
|
|
public function addDateRangePicker($name, $label, $required = true, $attributes = []) |
|
|
|
public function addDateRangePicker($name, $label, $required = true, $attributes = []) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$this->addElement('date_range_picker', $name, $label, $attributes); |
|
|
|
$this->addElement('date_range_picker', $name, $label, $attributes); |
|
|
|
$this->addElement('hidden', $name.'_start'); |
|
|
|
$this->addElement('hidden', $name . '_start'); |
|
|
|
$this->addElement('hidden', $name.'_end'); |
|
|
|
$this->addElement('hidden', $name . '_end'); |
|
|
|
|
|
|
|
|
|
|
|
if ($required) { |
|
|
|
if ($required) { |
|
|
|
$this->addRule($name, get_lang('ThisFieldIsRequired'), 'required'); |
|
|
|
$this->addRule($name, get_lang('ThisFieldIsRequired'), 'required'); |
|
|
@ -288,9 +281,9 @@ EOT; |
|
|
|
* @param array $options |
|
|
|
* @param array $options |
|
|
|
* @param array $attributes |
|
|
|
* @param array $attributes |
|
|
|
* |
|
|
|
* |
|
|
|
|
|
|
|
* @return HTML_QuickForm_element |
|
|
|
* @throws Exception |
|
|
|
* @throws Exception |
|
|
|
* |
|
|
|
* |
|
|
|
* @return HTML_QuickForm_element |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function addSelectAjax($name, $label, $options = [], $attributes = []) |
|
|
|
public function addSelectAjax($name, $label, $options = [], $attributes = []) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -381,7 +374,8 @@ EOT; |
|
|
|
$class = null, |
|
|
|
$class = null, |
|
|
|
$attributes = [], |
|
|
|
$attributes = [], |
|
|
|
$createElement = false |
|
|
|
$createElement = false |
|
|
|
) { |
|
|
|
) |
|
|
|
|
|
|
|
{ |
|
|
|
if ($createElement) { |
|
|
|
if ($createElement) { |
|
|
|
return $this->createElement( |
|
|
|
return $this->createElement( |
|
|
|
'button', |
|
|
|
'button', |
|
|
@ -553,18 +547,19 @@ EOT; |
|
|
|
* @param string $name Element name (for form treatment purposes) |
|
|
|
* @param string $name Element name (for form treatment purposes) |
|
|
|
* @param bool $createElement Whether to use the create or add method |
|
|
|
* @param bool $createElement Whether to use the create or add method |
|
|
|
* @param array $attributes |
|
|
|
* @param array $attributes |
|
|
|
* |
|
|
|
* @param $size |
|
|
|
|
|
|
|
* @param $class |
|
|
|
* @return HTML_QuickForm_button |
|
|
|
* @return HTML_QuickForm_button |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function addButtonSend($label, $name = 'submit', $createElement = false, $attributes = []) |
|
|
|
public function addButtonSend($label, $name = 'submit', $createElement = false, $attributes = [], $size, $class) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return $this->addButton( |
|
|
|
return $this->addButton( |
|
|
|
$name, |
|
|
|
$name, |
|
|
|
$label, |
|
|
|
$label, |
|
|
|
'paper-plane', |
|
|
|
'paper-plane', |
|
|
|
'primary', |
|
|
|
'primary', |
|
|
|
null, |
|
|
|
$size, |
|
|
|
null, |
|
|
|
$class, |
|
|
|
$attributes, |
|
|
|
$attributes, |
|
|
|
$createElement |
|
|
|
$createElement |
|
|
|
); |
|
|
|
); |
|
|
@ -901,7 +896,8 @@ EOT; |
|
|
|
$attributes = [], |
|
|
|
$attributes = [], |
|
|
|
$addNoneOption = false, |
|
|
|
$addNoneOption = false, |
|
|
|
$textCallable = '' |
|
|
|
$textCallable = '' |
|
|
|
) { |
|
|
|
) |
|
|
|
|
|
|
|
{ |
|
|
|
$options = []; |
|
|
|
$options = []; |
|
|
|
|
|
|
|
|
|
|
|
if ($addNoneOption) { |
|
|
|
if ($addNoneOption) { |
|
|
@ -956,9 +952,9 @@ EOT; |
|
|
|
* @param string $label |
|
|
|
* @param string $label |
|
|
|
* @param array $attributes |
|
|
|
* @param array $attributes |
|
|
|
* |
|
|
|
* |
|
|
|
|
|
|
|
* @return HTML_QuickForm_file |
|
|
|
* @throws Exception if the file doesn't have an id |
|
|
|
* @throws Exception if the file doesn't have an id |
|
|
|
* |
|
|
|
* |
|
|
|
* @return HTML_QuickForm_file |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function addFile($name, $label, $attributes = []) |
|
|
|
public function addFile($name, $label, $attributes = []) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -970,19 +966,19 @@ EOT; |
|
|
|
} |
|
|
|
} |
|
|
|
$this->addHtml( |
|
|
|
$this->addHtml( |
|
|
|
' |
|
|
|
' |
|
|
|
<div class="form-group" id="'.$id.'-form-group" style="display: none;"> |
|
|
|
<div class="form-group" id="' . $id . '-form-group" style="display: none;"> |
|
|
|
<div class="col-sm-offset-2 col-sm-8"> |
|
|
|
<div class="col-sm-offset-2 col-sm-8"> |
|
|
|
<div id="'.$id.'_crop_image" class="cropCanvas thumbnail"> |
|
|
|
<div id="' . $id . '_crop_image" class="cropCanvas thumbnail"> |
|
|
|
<img id="'.$id.'_preview_image"> |
|
|
|
<img id="' . $id . '_preview_image"> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<button class="btn btn-primary" type="button" name="cropButton" id="'.$id.'_crop_button"> |
|
|
|
<button class="btn btn-primary" type="button" name="cropButton" id="' . $id . '_crop_button"> |
|
|
|
<em class="fa fa-crop"></em> '.get_lang('CropYourPicture').' |
|
|
|
<em class="fa fa-crop"></em> ' . get_lang('CropYourPicture') . ' |
|
|
|
</button> |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div>' |
|
|
|
</div>' |
|
|
|
); |
|
|
|
); |
|
|
|
$this->addHidden($id.'_crop_result', ''); |
|
|
|
$this->addHidden($id . '_crop_result', ''); |
|
|
|
$this->addHidden($id.'_crop_image_base_64', ''); |
|
|
|
$this->addHidden($id . '_crop_image_base_64', ''); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $element; |
|
|
|
return $element; |
|
|
@ -1013,16 +1009,16 @@ EOT; |
|
|
|
$this->addHtml('<div class="panel panel-default">'); |
|
|
|
$this->addHtml('<div class="panel panel-default">'); |
|
|
|
$this->addHtml( |
|
|
|
$this->addHtml( |
|
|
|
' |
|
|
|
' |
|
|
|
<div class="panel-heading" role="tab" id="heading-'.$name.'-settings"> |
|
|
|
<div class="panel-heading" role="tab" id="heading-' . $name . '-settings"> |
|
|
|
<h4 class="panel-title"> |
|
|
|
<h4 class="panel-title"> |
|
|
|
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" |
|
|
|
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" |
|
|
|
href="#collapse-'.$name.'-settings" aria-expanded="false" aria-controls="collapse-'.$name.'-settings"> |
|
|
|
href="#collapse-' . $name . '-settings" aria-expanded="false" aria-controls="collapse-' . $name . '-settings"> |
|
|
|
' |
|
|
|
' |
|
|
|
); |
|
|
|
); |
|
|
|
$this->addHtml($title); |
|
|
|
$this->addHtml($title); |
|
|
|
$this->addHtml('</a></h4></div>'); |
|
|
|
$this->addHtml('</a></h4></div>'); |
|
|
|
$this->addHtml('<div id="collapse-'.$name.'-settings" class="panel-collapse collapse" role="tabpanel" |
|
|
|
$this->addHtml('<div id="collapse-' . $name . '-settings" class="panel-collapse collapse" role="tabpanel" |
|
|
|
aria-labelledby="heading-'.$name.'-settings"> |
|
|
|
aria-labelledby="heading-' . $name . '-settings"> |
|
|
|
<div class="panel-body"> |
|
|
|
<div class="panel-body"> |
|
|
|
'); |
|
|
|
'); |
|
|
|
|
|
|
|
|
|
|
@ -1056,7 +1052,8 @@ EOT; |
|
|
|
$required = true, |
|
|
|
$required = true, |
|
|
|
$fullPage = false, |
|
|
|
$fullPage = false, |
|
|
|
$config = [] |
|
|
|
$config = [] |
|
|
|
) { |
|
|
|
) |
|
|
|
|
|
|
|
{ |
|
|
|
$attributes = []; |
|
|
|
$attributes = []; |
|
|
|
$attributes['rows'] = isset($config['rows']) ? $config['rows'] : 15; |
|
|
|
$attributes['rows'] = isset($config['rows']) ? $config['rows'] : 15; |
|
|
|
$attributes['cols'] = isset($config['cols']) ? $config['cols'] : 80; |
|
|
|
$attributes['cols'] = isset($config['cols']) ? $config['cols'] : 80; |
|
|
@ -1102,8 +1099,8 @@ EOT; |
|
|
|
|
|
|
|
|
|
|
|
if ($geolocalization && $gMapsPlugin->javascriptIncluded === false) { |
|
|
|
if ($geolocalization && $gMapsPlugin->javascriptIncluded === false) { |
|
|
|
$gmapsApiKey = $gMapsPlugin->get('api_key'); |
|
|
|
$gmapsApiKey = $gMapsPlugin->get('api_key'); |
|
|
|
$url = '//maps.googleapis.com/maps/api/js?key='.$gmapsApiKey; |
|
|
|
$url = '//maps.googleapis.com/maps/api/js?key=' . $gmapsApiKey; |
|
|
|
$this->addHtml('<script type="text/javascript" src="'.$url.'" ></script>'); |
|
|
|
$this->addHtml('<script type="text/javascript" src="' . $url . '" ></script>'); |
|
|
|
$gMapsPlugin->javascriptIncluded = true; |
|
|
|
$gMapsPlugin->javascriptIncluded = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1115,9 +1112,9 @@ EOT; |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$this->addHidden( |
|
|
|
$this->addHidden( |
|
|
|
$name.'_coordinates', |
|
|
|
$name . '_coordinates', |
|
|
|
'', |
|
|
|
'', |
|
|
|
['id' => $name.'_coordinates'] |
|
|
|
['id' => $name . '_coordinates'] |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$this->applyFilter($name, 'stripslashes'); |
|
|
|
$this->applyFilter($name, 'stripslashes'); |
|
|
@ -1162,8 +1159,8 @@ EOT; |
|
|
|
$this->with_progress_bar = true; |
|
|
|
$this->with_progress_bar = true; |
|
|
|
$id = $this->getAttribute('id'); |
|
|
|
$id = $this->getAttribute('id'); |
|
|
|
|
|
|
|
|
|
|
|
$this->updateAttributes("onsubmit=\"javascript: addProgress('".$id."')\""); |
|
|
|
$this->updateAttributes("onsubmit=\"javascript: addProgress('" . $id . "')\""); |
|
|
|
$this->addHtml('<script language="javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/upload.js" type="text/javascript"></script>'); |
|
|
|
$this->addHtml('<script language="javascript" src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/upload.js" type="text/javascript"></script>'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -1203,7 +1200,7 @@ EOT; |
|
|
|
$element->setLayout($this->getLayout()); |
|
|
|
$element->setLayout($this->getLayout()); |
|
|
|
$elementError = parent::getElementError($element->getName()); |
|
|
|
$elementError = parent::getElementError($element->getName()); |
|
|
|
if (!is_null($elementError)) { |
|
|
|
if (!is_null($elementError)) { |
|
|
|
$returnValue .= Display::return_message($elementError, 'warning').'<br />'; |
|
|
|
$returnValue .= Display::return_message($elementError, 'warning') . '<br />'; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1214,7 +1211,7 @@ EOT; |
|
|
|
if (isset($this->with_progress_bar) && $this->with_progress_bar) { |
|
|
|
if (isset($this->with_progress_bar) && $this->with_progress_bar) { |
|
|
|
// @todo improve UI |
|
|
|
// @todo improve UI |
|
|
|
$returnValue .= '<br /> |
|
|
|
$returnValue .= '<br /> |
|
|
|
<div id="loading_div_'.$id.'" class="loading_div" style="display:none;margin-left:40%; margin-top:10px; height:50px;"> |
|
|
|
<div id="loading_div_' . $id . '" class="loading_div" style="display:none;margin-left:40%; margin-top:10px; height:50px;"> |
|
|
|
<div class="wobblebar-loader"></div> |
|
|
|
<div class="wobblebar-loader"></div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
'; |
|
|
|
'; |
|
|
@ -1283,7 +1280,8 @@ EOT; |
|
|
|
$label, |
|
|
|
$label, |
|
|
|
$required = false, |
|
|
|
$required = false, |
|
|
|
$attributes = [] |
|
|
|
$attributes = [] |
|
|
|
) { |
|
|
|
) |
|
|
|
|
|
|
|
{ |
|
|
|
$attributes = array_merge( |
|
|
|
$attributes = array_merge( |
|
|
|
$attributes, |
|
|
|
$attributes, |
|
|
|
[ |
|
|
|
[ |
|
|
@ -1349,7 +1347,8 @@ EOT; |
|
|
|
$label, |
|
|
|
$label, |
|
|
|
$required = false, |
|
|
|
$required = false, |
|
|
|
$attributes = [] |
|
|
|
$attributes = [] |
|
|
|
) { |
|
|
|
) |
|
|
|
|
|
|
|
{ |
|
|
|
$attributes = array_merge( |
|
|
|
$attributes = array_merge( |
|
|
|
$attributes, |
|
|
|
$attributes, |
|
|
|
[ |
|
|
|
[ |
|
|
@ -1399,7 +1398,8 @@ EOT; |
|
|
|
$allowNegative = false, |
|
|
|
$allowNegative = false, |
|
|
|
$minValue = null, |
|
|
|
$minValue = null, |
|
|
|
$maxValue = null |
|
|
|
$maxValue = null |
|
|
|
) { |
|
|
|
) |
|
|
|
|
|
|
|
{ |
|
|
|
$this->addElement( |
|
|
|
$this->addElement( |
|
|
|
'FloatNumber', |
|
|
|
'FloatNumber', |
|
|
|
$name, |
|
|
|
$name, |
|
|
@ -1475,7 +1475,8 @@ EOT; |
|
|
|
$label, |
|
|
|
$label, |
|
|
|
$required = false, |
|
|
|
$required = false, |
|
|
|
$attributes = [] |
|
|
|
$attributes = [] |
|
|
|
) { |
|
|
|
) |
|
|
|
|
|
|
|
{ |
|
|
|
$attributes = array_merge( |
|
|
|
$attributes = array_merge( |
|
|
|
$attributes, |
|
|
|
$attributes, |
|
|
|
[ |
|
|
|
[ |
|
|
@ -1522,7 +1523,8 @@ EOT; |
|
|
|
$label, |
|
|
|
$label, |
|
|
|
$required = false, |
|
|
|
$required = false, |
|
|
|
$attributes = [] |
|
|
|
$attributes = [] |
|
|
|
) { |
|
|
|
) |
|
|
|
|
|
|
|
{ |
|
|
|
$attributes = array_merge( |
|
|
|
$attributes = array_merge( |
|
|
|
$attributes, |
|
|
|
$attributes, |
|
|
|
[ |
|
|
|
[ |
|
|
@ -1566,17 +1568,17 @@ EOT; |
|
|
|
|
|
|
|
|
|
|
|
$this->addHtml(' |
|
|
|
$this->addHtml(' |
|
|
|
<div class="description-upload"> |
|
|
|
<div class="description-upload"> |
|
|
|
'.get_lang('ClickToSelectOrDragAndDropMultipleFilesOnTheUploadField').' |
|
|
|
' . get_lang('ClickToSelectOrDragAndDropMultipleFilesOnTheUploadField') . ' |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<span class="btn btn-success fileinput-button"> |
|
|
|
<span class="btn btn-success fileinput-button"> |
|
|
|
<i class="glyphicon glyphicon-plus"></i> |
|
|
|
<i class="glyphicon glyphicon-plus"></i> |
|
|
|
<span>'.get_lang('AddFiles').'</span> |
|
|
|
<span>' . get_lang('AddFiles') . '</span> |
|
|
|
<!-- The file input field used as target for the file upload widget --> |
|
|
|
<!-- The file input field used as target for the file upload widget --> |
|
|
|
<input id="'.$inputName.'" type="file" name="files[]" multiple> |
|
|
|
<input id="' . $inputName . '" type="file" name="files[]" multiple> |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
<div id="dropzone"> |
|
|
|
<div id="dropzone"> |
|
|
|
<div class="button-load"> |
|
|
|
<div class="button-load"> |
|
|
|
'.get_lang('UploadFiles').' |
|
|
|
' . get_lang('UploadFiles') . ' |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<br /> |
|
|
|
<br /> |
|
|
@ -1598,7 +1600,7 @@ EOT; |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Constant defined in old config/profile.conf.php |
|
|
|
// Constant defined in old config/profile.conf.php |
|
|
|
if (CHECK_PASS_EASY_TO_FIND === true) { |
|
|
|
if (CHECK_PASS_EASY_TO_FIND === true) { |
|
|
|
$message = get_lang('PassTooEasy').': '.api_generate_password(); |
|
|
|
$message = get_lang('PassTooEasy') . ': ' . api_generate_password(); |
|
|
|
|
|
|
|
|
|
|
|
if (!empty($groupName)) { |
|
|
|
if (!empty($groupName)) { |
|
|
|
$groupObj = $this->getElement($groupName); |
|
|
|
$groupObj = $this->getElement($groupName); |
|
|
@ -1634,14 +1636,14 @@ EOT; |
|
|
|
* Add an element with user ID and avatar to the form. |
|
|
|
* Add an element with user ID and avatar to the form. |
|
|
|
* It needs a Chamilo\UserBundle\Entity\User as value. The exported value is the Chamilo\UserBundle\Entity\User ID. |
|
|
|
* It needs a Chamilo\UserBundle\Entity\User as value. The exported value is the Chamilo\UserBundle\Entity\User ID. |
|
|
|
* |
|
|
|
* |
|
|
|
* @see \UserAvatar |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param string $name |
|
|
|
* @param string $name |
|
|
|
* @param string $label |
|
|
|
* @param string $label |
|
|
|
* @param string $imageSize Optional. Small, medium or large image |
|
|
|
* @param string $imageSize Optional. Small, medium or large image |
|
|
|
* @param string $subtitle Optional. The subtitle for the field |
|
|
|
* @param string $subtitle Optional. The subtitle for the field |
|
|
|
* |
|
|
|
* |
|
|
|
* @return \UserAvatar |
|
|
|
* @return \UserAvatar |
|
|
|
|
|
|
|
* @see \UserAvatar |
|
|
|
|
|
|
|
* |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function addUserAvatar($name, $label, $imageSize = 'small', $subtitle = '') |
|
|
|
public function addUserAvatar($name, $label, $imageSize = 'small', $subtitle = '') |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1670,18 +1672,18 @@ EOT; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$url = api_get_path(WEB_AJAX_PATH).'mail.ajax.php?a=select_option'; |
|
|
|
$url = api_get_path(WEB_AJAX_PATH) . 'mail.ajax.php?a=select_option'; |
|
|
|
$typeNoDots = 'email_template_option_'.str_replace('.tpl', '', $type); |
|
|
|
$typeNoDots = 'email_template_option_' . str_replace('.tpl', '', $type); |
|
|
|
$this->addSelect( |
|
|
|
$this->addSelect( |
|
|
|
'email_template_option['.$type.']', |
|
|
|
'email_template_option[' . $type . ']', |
|
|
|
$name, |
|
|
|
$name, |
|
|
|
$options, |
|
|
|
$options, |
|
|
|
['id' => $typeNoDots] |
|
|
|
['id' => $typeNoDots] |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$templateNoDots = 'email_template_'.str_replace('.tpl', '', $type); |
|
|
|
$templateNoDots = 'email_template_' . str_replace('.tpl', '', $type); |
|
|
|
$templateNoDotsBlock = 'email_template_block_'.str_replace('.tpl', '', $type); |
|
|
|
$templateNoDotsBlock = 'email_template_block_' . str_replace('.tpl', '', $type); |
|
|
|
$this->addHtml('<div id="'.$templateNoDotsBlock.'" style="display:none">'); |
|
|
|
$this->addHtml('<div id="' . $templateNoDotsBlock . '" style="display:none">'); |
|
|
|
$this->addTextarea( |
|
|
|
$this->addTextarea( |
|
|
|
$templateNoDots, |
|
|
|
$templateNoDots, |
|
|
|
get_lang('Preview'), |
|
|
|
get_lang('Preview'), |
|
|
@ -1738,25 +1740,25 @@ EOT; |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
$(function () { |
|
|
|
$(function () { |
|
|
|
'use strict'; |
|
|
|
'use strict'; |
|
|
|
$('#".$this->getAttribute('id')."').submit(function() { |
|
|
|
$('#" . $this->getAttribute('id') . "').submit(function() { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$('#dropzone').on('click', function() { |
|
|
|
$('#dropzone').on('click', function() { |
|
|
|
$('#".$inputName."').click(); |
|
|
|
$('#" . $inputName . "').click(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
var url = '".$url."'; |
|
|
|
var url = '" . $url . "'; |
|
|
|
var uploadButton = $('<button/>') |
|
|
|
var uploadButton = $('<button/>') |
|
|
|
.addClass('btn btn-primary') |
|
|
|
.addClass('btn btn-primary') |
|
|
|
.prop('disabled', true) |
|
|
|
.prop('disabled', true) |
|
|
|
.text('".addslashes(get_lang('Loading'))."') |
|
|
|
.text('" . addslashes(get_lang('Loading')) . "') |
|
|
|
.on('click', function () { |
|
|
|
.on('click', function () { |
|
|
|
var \$this = $(this), |
|
|
|
var \$this = $(this), |
|
|
|
data = \$this.data(); |
|
|
|
data = \$this.data(); |
|
|
|
\$this |
|
|
|
\$this |
|
|
|
.off('click') |
|
|
|
.off('click') |
|
|
|
.text('".addslashes(get_lang('Cancel'))."') |
|
|
|
.text('" . addslashes(get_lang('Cancel')) . "') |
|
|
|
.on('click', function () { |
|
|
|
.on('click', function () { |
|
|
|
\$this.remove(); |
|
|
|
\$this.remove(); |
|
|
|
data.abort(); |
|
|
|
data.abort(); |
|
|
@ -1766,7 +1768,7 @@ EOT; |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$('#".$inputName."').fileupload({ |
|
|
|
$('#" . $inputName . "').fileupload({ |
|
|
|
url: url, |
|
|
|
url: url, |
|
|
|
dataType: 'json', |
|
|
|
dataType: 'json', |
|
|
|
// Enable image resizing, except for Android and Opera, |
|
|
|
// Enable image resizing, except for Android and Opera, |
|
|
@ -1790,7 +1792,7 @@ EOT; |
|
|
|
if (file.preview) { |
|
|
|
if (file.preview) { |
|
|
|
data.context.prepend($('<div class=\"col-sm-4\">').html(file.preview)); |
|
|
|
data.context.prepend($('<div class=\"col-sm-4\">').html(file.preview)); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
data.context.prepend($('<div class=\"col-sm-4\">').html('".$icon."')); |
|
|
|
data.context.prepend($('<div class=\"col-sm-4\">').html('" . $icon . "')); |
|
|
|
} |
|
|
|
} |
|
|
|
if (index + 1 === data.files.length) { |
|
|
|
if (index + 1 === data.files.length) { |
|
|
|
data.context.find('button') |
|
|
|
data.context.find('button') |
|
|
@ -1827,15 +1829,15 @@ EOT; |
|
|
|
// Update file name with new one from Chamilo |
|
|
|
// Update file name with new one from Chamilo |
|
|
|
$(data.context.children()[index]).parent().find('.file_name').html(file.name); |
|
|
|
$(data.context.children()[index]).parent().find('.file_name').html(file.name); |
|
|
|
var message = $('<div class=\"col-sm-3\">').html( |
|
|
|
var message = $('<div class=\"col-sm-3\">').html( |
|
|
|
$('<span class=\"message-image-success\"/>').text('".addslashes(get_lang('UplUploadSucceeded'))."') |
|
|
|
$('<span class=\"message-image-success\"/>').text('" . addslashes(get_lang('UplUploadSucceeded')) . "') |
|
|
|
); |
|
|
|
); |
|
|
|
$(data.context.children()[index]).parent().append(message); |
|
|
|
$(data.context.children()[index]).parent().append(message); |
|
|
|
}); |
|
|
|
}); |
|
|
|
$('#dropzone').removeClass('hover'); |
|
|
|
$('#dropzone').removeClass('hover'); |
|
|
|
".$redirectCondition." |
|
|
|
" . $redirectCondition . " |
|
|
|
}).on('fileuploadfail', function (e, data) { |
|
|
|
}).on('fileuploadfail', function (e, data) { |
|
|
|
$.each(data.files, function (index) { |
|
|
|
$.each(data.files, function (index) { |
|
|
|
var failedMessage = '".addslashes(get_lang('UplUploadFailed'))."'; |
|
|
|
var failedMessage = '" . addslashes(get_lang('UplUploadFailed')) . "'; |
|
|
|
var error = $('<div class=\"col-sm-3\">').html( |
|
|
|
var error = $('<div class=\"col-sm-3\">').html( |
|
|
|
$('<span class=\"alert alert-danger\"/>').text(failedMessage) |
|
|
|
$('<span class=\"alert alert-danger\"/>').text(failedMessage) |
|
|
|
); |
|
|
|
); |
|
|
|