]> git.mxchange.org Git - mailer.git/blobdiff - inc/template-functions.php
Moved "fix" files (which only helps to fix stuff) in own inc/fixes/ folder.
[mailer.git] / inc / template-functions.php
index 0526f1b40bea0edef2a0b8656d56eb10e54d64cf..d08805fa50f5e7938fa4758b4af32ad3a3adb03a 100644 (file)
@@ -11,7 +11,7 @@
  * Kurzbeschreibung  : Template-Funktionen                              *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2013 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2016 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -780,7 +780,7 @@ function compileRawCode ($code, $full = TRUE, $compileCode = TRUE) {
 }
 
 //
-function addSelectionBox ($type, $default, $prefix = '', $id = NULL, $class = 'form_select') {
+function addSelectionBox ($type, $default, $prefix = '', $id = NULL, $class = 'form_select', $allSteps = FALSE) {
        $OUT = '';
 
        if ($type == 'yn') {
@@ -880,7 +880,16 @@ function addSelectionBox ($type, $default, $prefix = '', $id = NULL, $class = 'f
 
                case 'mi': // Minutes
                case 'se': // Seconds
-                       for ($idx = 0; $idx <= 59; $idx+=5) {
+                       // Default is 5 minutes/seconds step
+                       $step = 5;
+
+                       // All steps?
+                       if ($allSteps === TRUE) {
+                               // Then all steps
+                               $step = 1;
+                       } // END - if
+
+                       for ($idx = 0; $idx <= 59; $idx += $step) {
                                $padded = padLeftZero($idx, 2);
                                $OUT .= '<option value="' . $padded . '"';
                                if ($default == $padded) $OUT .= ' selected="selected"';
@@ -960,7 +969,7 @@ function generateImageOrCode ($img_code, $headerSent = TRUE) {
 }
 
 // Create selection box or array of splitted timestamp
-function createTimeSelections ($timestamp, $prefix = '', $display = '', $align = 'center', $asArray = FALSE) {
+function createTimeSelections ($timestamp, $prefix = '', $display = '', $align = 'center', $asArray = FALSE, $allSteps = FALSE) {
        // Do not continue if ONE_DAY is absend
        if (!isConfigEntrySet('ONE_DAY')) {
                // Abort here
@@ -1076,7 +1085,7 @@ function createTimeSelections ($timestamp, $prefix = '', $display = '', $align =
                        if (isInString($unit, $display) || (empty($display))) {
                                // Generate year selection
                                $OUT .= '<td align="center">';
-                               $OUT .= addSelectionBox($field, $data[$unit], $prefix, NULL, 'mini_select');
+                               $OUT .= addSelectionBox($field, $data[$unit], $prefix, NULL, 'mini_select', $allSteps);
                                $OUT .= '</td>';
                        } else {
                                $OUT .= '<input type="hidden" name="' . $prefix . '_' . $field . '" value="0" />';
@@ -1831,7 +1840,7 @@ function generateSelectionBoxFromArray ($options, $name, $optionKey, $optionCont
        // Allow none?
        if ($allowNone === TRUE) {
                // Then add it
-               $OUT .= '<option value="0">{--SELECT_NONE--}</option>';
+               $OUT .= '<option value="">{--SELECT_NONE--}</option>';
        } // END - if
 
        // Walk through all options
@@ -1841,7 +1850,7 @@ function generateSelectionBoxFromArray ($options, $name, $optionKey, $optionCont
 
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'name=' . $name . ',default[' . gettype($default) . ']=' . $default . ',optionKey[' . gettype($optionKey) . ']=' . $optionKey);
                // Is default value same as given value?
-               if ((!is_null($default)) && (isset($option[$optionKey])) && ($default == $option[$optionKey])) {
+               if ((!is_null($default)) && (isset($option[$optionKey])) && ($default === $option[$optionKey])) {
                        // Then set default
                        $option['default'] = ' selected="selected"';
                } // END - if