diff --git a/main/inc/lib/agenda.lib.php b/main/inc/lib/agenda.lib.php index b685003f8c..346b78aed5 100644 --- a/main/inc/lib/agenda.lib.php +++ b/main/inc/lib/agenda.lib.php @@ -1597,6 +1597,7 @@ class Agenda * @param array $sendTo array('users' => [1, 2], 'groups' => [3, 4]) * @param array $attributes * @param bool $addOnlyItemsInSendTo + * @param bool $required */ public function setSendToSelect( $form, @@ -1604,7 +1605,8 @@ class Agenda $userList = null, $sendTo = array(), $attributes = array(), - $addOnlyItemsInSendTo = false + $addOnlyItemsInSendTo = false, + $required = false ) { $params = array( 'id' => 'users_to_send_id', @@ -1625,7 +1627,11 @@ class Agenda $sendToUsers = isset($sendTo['users']) ? $sendTo['users'] : array(); /** @var HTML_QuickForm_select $select */ - $select = $form->addElement('select', 'users_to_send', get_lang('To'), null, $params); + $select = $form->addSelect('users_to_send', get_lang('To'), null, $params); + + if ($required) { + $form->setRequired($select); + } $selectedEveryoneOptions = array(); if (isset($sendTo['everyone']) && $sendTo['everyone']) { @@ -1799,7 +1805,7 @@ class Agenda } else { $sendTo = isset($params['send_to']) ? $params['send_to'] : null; if ($this->type == 'course') { - $this->showToForm($form, $sendTo); + $this->showToForm($form, $sendTo, array(), false, true); } } @@ -1902,13 +1908,15 @@ class Agenda * @param array $sendTo array('everyone' => false, 'users' => [1, 2], 'groups' => [3, 4]) * @param array $attributes * @param bool $addOnlyItemsInSendTo + * @param bool $required * @return bool */ public function showToForm( $form, $sendTo = array(), $attributes = array(), - $addOnlyItemsInSendTo = false + $addOnlyItemsInSendTo = false, + $required = false ) { if ($this->type != 'course') { return false; @@ -1936,8 +1944,10 @@ class Agenda $userList, $sendTo, $attributes, - $addOnlyItemsInSendTo + $addOnlyItemsInSendTo, + $required ); + return true; } @@ -2246,8 +2256,7 @@ class Agenda ); $selectedValues = $this->parseAgendaFilter($filter); $this->showToForm($form, $selectedValues, $attributes); - $form = $form->return_form(); - + $form = $form->returnForm(); } $actions .= "". Display::return_icon('new_event.png', get_lang('AgendaAdd'), '', ICON_SIZE_MEDIUM).""; diff --git a/main/inc/lib/attendance.lib.php b/main/inc/lib/attendance.lib.php index 2577a19956..f87b856e83 100755 --- a/main/inc/lib/attendance.lib.php +++ b/main/inc/lib/attendance.lib.php @@ -1636,7 +1636,7 @@ class Attendance $users = $this->get_users_rel_course(); $user_ids = array_keys($users); $course_id = api_get_course_int_id(); - + $affected_rows = 0; if ($all_delete) { $attendance_calendar = $this->get_attendance_calendar($attendance_id); // get all dates from calendar by current attendance diff --git a/main/inc/lib/database.constants.inc.php b/main/inc/lib/database.constants.inc.php index 432662be50..ec59e713ea 100755 --- a/main/inc/lib/database.constants.inc.php +++ b/main/inc/lib/database.constants.inc.php @@ -116,9 +116,6 @@ define('TABLE_MAIN_SESSION_FIELD', 'session_field'); define('TABLE_MAIN_SESSION_FIELD_OPTIONS', 'session_field_options'); define('TABLE_MAIN_SESSION_FIELD_VALUES', 'session_field_values'); -// Message -define('TABLE_MAIN_MESSAGE', 'message'); - // Term and conditions define('TABLE_MAIN_LEGAL', 'legal'); diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index a17bfdf301..8bc7895d86 100755 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -2054,6 +2054,7 @@ class Display * @param string $title * @param string $footer * @param string $style + * * @return string */ public static function panel($content, $title = '', $footer = '', $style = '') diff --git a/main/inc/lib/formvalidator/Element/DateRangePicker.php b/main/inc/lib/formvalidator/Element/DateRangePicker.php index 197efc0e48..970bc7765f 100755 --- a/main/inc/lib/formvalidator/Element/DateRangePicker.php +++ b/main/inc/lib/formvalidator/Element/DateRangePicker.php @@ -2,7 +2,7 @@ /* For licensing terms, see /license.txt */ /** - * Form element to select a date and hour (with popup datepicker) + * Form element to select a range of dates (with popup datepicker) */ class DateRangePicker extends HTML_QuickForm_text { @@ -21,7 +21,7 @@ class DateRangePicker extends HTML_QuickForm_text } /** - * HTML code to display this datepicker + * @return string */ public function toHtml() { @@ -100,10 +100,12 @@ class DateRangePicker extends HTML_QuickForm_text { $dates = explode('/', $dateRange); $dates = array_map('trim', $dates); + $start = isset($dates[0]) ? $dates[0] : ''; + $end = isset($dates[1]) ? $dates[1] : ''; return array( - 'start' => $dates[0], - 'end' => $dates[1] + 'start' => $start, + 'end' => $end ); } @@ -117,6 +119,7 @@ class DateRangePicker extends HTML_QuickForm_text if (empty($dates['start']) || empty($dates['end'])) { return false; } + $format = 'Y-m-d H:i'; $d = DateTime::createFromFormat($format, $dates['start']); $resultStart = $d && $d->format($format) == $dates['start']; diff --git a/main/inc/lib/formvalidator/Element/SelectAjax.php b/main/inc/lib/formvalidator/Element/SelectAjax.php index dff8633cfb..b71e6b70f9 100644 --- a/main/inc/lib/formvalidator/Element/SelectAjax.php +++ b/main/inc/lib/formvalidator/Element/SelectAjax.php @@ -11,7 +11,7 @@ class SelectAjax extends HTML_QuickForm_select */ function SelectAjax($elementName = null, $elementLabel = null, $options = null, $attributes = null) { - parent::HTML_QuickForm_Select($elementName, $elementLabel, $options, $attributes); + parent::__construct($elementName, $elementLabel, $options, $attributes); } /** diff --git a/main/inc/lib/formvalidator/Element/SelectLanguage.php b/main/inc/lib/formvalidator/Element/SelectLanguage.php index 43893a557c..1c7cc6be17 100644 --- a/main/inc/lib/formvalidator/Element/SelectLanguage.php +++ b/main/inc/lib/formvalidator/Element/SelectLanguage.php @@ -14,7 +14,7 @@ class SelectLanguage extends HTML_QuickForm_select if (!isset($attributes['class'])) { $attributes['class'] = 'chzn-select'; } - parent::HTML_QuickForm_Select($elementName, $elementLabel, $options, $attributes); + parent::__construct($elementName, $elementLabel, $options, $attributes); // Get all languages $languages = api_get_languages(); $this->_options = array(); diff --git a/main/inc/lib/formvalidator/Element/SelectTheme.php b/main/inc/lib/formvalidator/Element/SelectTheme.php index d874266770..903a259814 100644 --- a/main/inc/lib/formvalidator/Element/SelectTheme.php +++ b/main/inc/lib/formvalidator/Element/SelectTheme.php @@ -11,10 +11,10 @@ class SelectTheme extends HTML_QuickForm_select */ function SelectTheme($elementName=null, $elementLabel=null, $options=null, $attributes=null) { if (!isset($attributes['class'])) { - //todo this was comment due a bug in infocours.php with jquery-ui + //todo this was comment due a bug in infocours.php with jquery-ui //$attributes['class'] = 'chzn-select'; - } - parent::HTML_QuickForm_Select($elementName, $elementLabel, $options, $attributes); + } + parent::__construct($elementName, $elementLabel, $options, $attributes); // Get all languages $themes = api_get_themes(); $this->_options = array(); @@ -22,6 +22,6 @@ class SelectTheme extends HTML_QuickForm_select $this->addOption('--',''); // no theme select for ($i=0; $i< count($themes[0]);$i++) { $this->addOption($themes[1][$i],$themes[0][$i]); - } + } } -} \ No newline at end of file +} diff --git a/main/inc/lib/formvalidator/FormValidator.class.php b/main/inc/lib/formvalidator/FormValidator.class.php index f5525c097a..fb9eb6855d 100755 --- a/main/inc/lib/formvalidator/FormValidator.class.php +++ b/main/inc/lib/formvalidator/FormValidator.class.php @@ -576,7 +576,7 @@ EOT; /** * @param string $name * @param string $label - * @param array $options + * @param array $options * @param array $attributes * * @return HTML_QuickForm_select diff --git a/main/inc/lib/message.lib.php b/main/inc/lib/message.lib.php index dac6c1f0f6..941a1a8e84 100755 --- a/main/inc/lib/message.lib.php +++ b/main/inc/lib/message.lib.php @@ -884,16 +884,20 @@ class MessageManager $message_content .= $user_image.' '; } + $receiverUserInfo = api_get_user_info($row['user_receiver_id']); + $message_content .='