foreach ($nmembers_results as $member) { if (in_array($member['proxy_id'], $current_member_list)) { $registered = true; } else { $registered = false; } $members[0]['options'][] = array('text' => $member['fullname'] . ($registered ? ' (already a member)' : ''), 'value' => $member['proxy_id'], 'disabled' => $registered); } foreach ($members[0]['options'] as $key => $member) { if (isset($member['options']) && is_array($member['options']) && !empty($member['options'])) { //Alphabetize members sort($members[0]['options'][$key]['options']); } } echo '<table cellspacing="0" cellpadding="0" class="select_multiple_table" width="100%">'; echo lp_multiple_select_table($members, 0, 0, true); echo '</table>'; } else { echo "No One Available [1]"; } } else { echo "No One Available [2]"; } } else { echo "Permissions error!"; } } else { echo "Invalid group provided!"; } } break;
function lp_multiple_select_table($checkboxes, $indent, $i, $category_check_all = false) { $return = ""; $input_class = 'select_multiple_checkbox'; foreach ($checkboxes as $checkbox) { if ($i % 2 == 0) { $class = 'even'; } else { $class = 'odd'; } if (isset($checkbox['category']) && $checkbox['category'] == true) { if ($category_check_all) { $input = '<input type="checkbox" id="' . $checkbox['value'] . '_category"/ value="' . $checkbox['value'] . '" />'; } else { $input = " "; } $class .= ' category'; $name_class = "select_multiple_name_category"; $input_class = "select_multiple_checkbox_category"; } else { if (isset($checkbox['disabled']) && $checkbox['disabled'] == true) { $input = " "; $class .= ' disabled'; $name_class = "select_multiple_name_disabled"; } else { $input = '<input type="checkbox" id="' . $checkbox['value'] . '" value="' . $checkbox['value'] . '" ' . $checkbox['checked'] . '/>'; $name_class = "select_multiple_name"; if ($input_class == "select_multiple_checkbox_category") { $input_class = 'select_multiple_checkbox'; } } } if (isset($checkbox["class"]) && $checkbox["class"]) { $class .= " " . $checkbox["class"]; } if (isset($checkbox['name_class'])) { $name_class = $checkbox['name_class']; } $i++; if (isset($checkbox['value']) && $checkbox['value']) { $return .= '<tr class="' . $class . '"><td class="' . $name_class . ' indent_' . $indent . '"><label for="' . $checkbox['value'] . '" id="' . $checkbox['value'] . '_label">' . $checkbox['text'] . '</label></td><td class="' . $input_class . '">' . $input . '</td></tr>'; } if (isset($checkbox['options'])) { $return .= lp_multiple_select_table($checkbox['options'], $indent + 1, $i); } } return $return; }