17 require_once SQ_LIB_PATH.
'/config/prefs.inc';
32 var $pref_vars = Array (
33 'SQ_CALENDAR_EVENTS_FREQUENCY' => Array(
34 'name' =>
'calendar_events_frequency',
35 'description' =>
'Recurrence event frequency threshold in days. If set to a non-zero positive value, the recurring event will be displayed only once in listing pages when its frequency is less than the specified threshold value',
48 parent::__construct($pref_file);
65 $is_root = $GLOBALS[
'SQ_SYSTEM']->userRoot();
66 $is_admin = ($is_root || $GLOBALS[
'SQ_SYSTEM']->userSystemAdmin());
68 if (is_null($pref) || $pref ==
'SQ_CALENDAR_EVENTS_FREQUENCY') {
70 $o->openField(
"Events frequency threshold");
73 if ($have_lock && $is_admin) {
74 text_box(
'prefs[SQ_CALENDAR_EVENTS_FREQUENCY]', $this->pref_vars[
'SQ_CALENDAR_EVENTS_FREQUENCY'][
'default'], 5);
76 echo array_get_index($this->pref_vars[
'SQ_CALENDAR_EVENTS_FREQUENCY'],
'default', 5);
79 echo
'<div class="sq-backend-note">'.$this->pref_vars[
'SQ_CALENDAR_EVENTS_FREQUENCY'][
'description'].
'</div>';
81 if (is_null($pref)) $o->closeField();
101 $is_root = $GLOBALS[
'SQ_SYSTEM']->userRoot();
102 $is_admin = ($is_root || $GLOBALS[
'SQ_SYSTEM']->userSystemAdmin());
103 if (!$is_admin)
return FALSE;
106 if (isset($_POST[
'prefs'][
'SQ_CALENDAR_EVENTS_FREQUENCY'])) {
109 if (!is_numeric($_POST[
'prefs'][
'SQ_CALENDAR_EVENTS_FREQUENCY'])) {
110 trigger_error(
"Recurring events frequency threshold must be an integer", E_USER_WARNING);
113 $frequency_threshold = (int)$_POST[
'prefs'][
'SQ_CALENDAR_EVENTS_FREQUENCY'];
116 if ($frequency_threshold < 0) {
117 trigger_error(
"Recurring events frequency threshold must be an integer", E_USER_WARNING);
121 $this->pref_vars[
'SQ_CALENDAR_EVENTS_FREQUENCY'][
'default'] = $frequency_threshold;