From 786a7d665e25fd71e57f1724a1ed3ebf140a0f7a Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Sat, 1 Nov 2014 21:11:33 +0000 Subject: [PATCH] functions.inc.php: - pacol(): - add $linkto parameter (if list mode should link to something) - replace $not_in_db with $multiopt - the remaining parameters can now be specified as associated array (backwards-compatible) git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1719 a1433add-5e2c-0410-b055-b7f2511e0802 --- functions.inc.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/functions.inc.php b/functions.inc.php index e9219fe3..2bfe10e1 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -385,13 +385,23 @@ function safesession ($param, $default="") { * @param String PALANG_desc * @param any optional $default * @param array optional $options - * @param int $not_in_db + * @param int or $not_in_db - if array, can contain the remaining parameters as associated array + * @param ... * @return array for $struct */ -function pacol($allow_editing, $display_in_form, $display_in_list, $type, $PALANG_label, $PALANG_desc, $default = "", $options = array(), $not_in_db=0, $dont_write_to_db=0, $select="", $extrafrom="") { +function pacol($allow_editing, $display_in_form, $display_in_list, $type, $PALANG_label, $PALANG_desc, $default = "", $options = array(), $multiopt=0, $dont_write_to_db=0, $select="", $extrafrom="", $linkto="") { if ($PALANG_label != '') $PALANG_label = Config::lang($PALANG_label); if ($PALANG_desc != '') $PALANG_desc = Config::lang($PALANG_desc ); + if (is_array($multiopt)) { # remaining parameters provided in named array + $not_in_db = 0; # keep default value + foreach ($multiopt as $key => $value) { + $$key = $value; # extract everything to the matching variable + } + } else { + $not_in_db = $multiopt; + } + return array( 'editable' => $allow_editing, 'display_in_form' => $display_in_form, @@ -405,6 +415,7 @@ function pacol($allow_editing, $display_in_form, $display_in_list, $type, $PALAN 'dont_write_to_db' => $dont_write_to_db, 'select' => $select, # replaces the field name after SELECT 'extrafrom' => $extrafrom, # added after FROM xy - useful for JOINs etc. + 'linkto' => $linkto, # make the value a link - %s will be replaced with the ID ); }