+// Helper function to create a selection box for YES/NO configuration entries
+function doTemplateConfigurationYesNoSelectionBox ($templateName, $clear, $configEntry) {
+ // Default is a "missing entry" warning
+ $OUT = '<div class="bad" style="cursor:help" title="{%message,ADMIN_CONFIG_ENTRY_MISSING=' . $configEntry . '%}">!' . $configEntry . '!</div>';
+
+ // Generate the HTML code
+ if (isConfigEntrySet($configEntry)) {
+ // Configuration entry is found
+ $OUT = '<select name="' . $configEntry . '" class="form_select" size="1">
+{%config,generateYesNoOptions=' . $configEntry . '%}
+</select>';
+ } // END - if
+
+ // Return it
+ return $OUT;
+}
+
+// Helper function to create a selection box for YES/NO form fields
+function doTemplateYesNoSelectionBox ($templateName, $clear, $formField) {
+ // Generate the HTML code
+ $OUT = '<select name="' . $formField . '" class="form_select" size="1">
+{%pipe,generateYesNoOptions%}
+</select>';
+
+ // Return it
+ return $OUT;
+}
+
+// Helper function to create a selection box for YES/NO form fields, by NO is default
+function doTemplateNoYesSelectionBox ($templateName, $clear, $formField) {
+ // Generate the HTML code
+ $OUT = '<select name="' . $formField . '" class="form_select" size="1">
+{%pipe,generateYesNoOptions=N%}
+</select>';
+
+ // Return it
+ return $OUT;
+}
+
+// Helper function to add extra content for member area (module=login)
+function doTemplateMemberFooterExtras ($templateName, $clear) {
+ // Is a member logged in?
+ if (!isMember()) {
+ // This shall not happen
+ reportBug(__FUNCTION__, __LINE__, 'Please use this template helper only for logged-in members.');
+ } // END - if
+
+ // Init filter data
+ $filterData = array(
+ // Current user's id number
+ 'userid' => getMemberId(),
+ // Name of used template
+ 'template' => $templateName,
+ // Target array for gathered data
+ '__data' => array(),
+ // Where the HTML output will go
+ '__output' => '',
+ );
+
+ // Run the filter chain
+ $filterData = runFilterChain('member_footer_extras', $filterData);
+
+ // Return output
+ return $filterData['__output'];
+}
+
+/**
+ * Helper function to determine whether current userid is set, if none is set,
+ * return a zero, else an EL code is being returned as of this function is used
+ * only in templates.
+ *
+ * @param $templateName Name of template (unused)
+ * @param $clear Wether to clear something (unused)
+ * @return $userId Wether zero or EL code snippet
+ */
+function doTemplateUserId ($templateName, $clear) {
+ // By default no userid is set
+ $userId = '0';
+
+ // Is there a user id currently set?
+ if (isCurrentUserIdSet()) {
+ // Then get the current user id
+ $userId = getCurrentUserId();
+ } // END - if
+
+ // Return it
+ return $userId;
+}
+
+// Template helper function to generate "Terms&Conditions" link (EL code again)
+function doTemplateGetTermsConditionsLink ($templateName, $clear) {
+ /*
+ * Use default link by default ;-) This link, however, will become
+ * deprecated once ext-terms is rolled out.
+ */
+ $linkCode = '{%url=modules.php?module=index&what=agb%}';
+
+ // Is ext-terms installed?
+ if (isExtensionInstalled('terms')) {
+ // Then use that link (only 'what' has changed)
+ $linkCode = '{%url=modules.php?module=index&what=terms%}';
+ } // END - if
+
+ // Return link (EL) code
+ return $linkCode;
+}
+
+// Template helper function to create selection box for "locked points mode"
+function doTemplatePointsLockedModeSelectionBox ($templateName, $clear = false, $default = NULL) {
+ // Init array
+ $lockedModes = array(
+ 0 => array('mode' => 'LOCKED'),
+ 1 => array('mode' => 'UNLOCKED'),
+ );
+
+ // Handle it over to generateSelectionBoxFromArray()
+ $content = generateSelectionBoxFromArray($lockedModes, 'points_locked_mode', 'mode', '', '', '', $default);
+
+ // Return prepared content
+ return $content;
+}
+
+// Template helper function to create selection box for payment method
+function doTemplatePointsPaymentMethodSelectionBox ($templateName, $clear = false, $default = NULL) {
+ // Init array
+ $paymentMethods = array(
+ 0 => array('method' => 'DIRECT'),
+ 1 => array('method' => 'REFERRAL'),
+ );
+
+ // Handle it over to generateSelectionBoxFromArray()
+ $content = generateSelectionBoxFromArray($paymentMethods, 'points_payment_method', 'method', '', '', '', $default);
+
+ // Return prepared content
+ return $content;
+}
+