/** * Returns all the profiles for the user, including the global ones * * @param string $p_username The user's username. * @param string $p_password The user's password. * @param integer $p_page_number Page number. * @param integer $p_per_page Results per page. * @return mixed */ function mc_user_profiles_get_all($p_username, $p_password, $p_page_number, $p_per_page) { $t_user_id = mci_check_login($p_username, $p_password); if ($t_user_id === false) { return mci_soap_fault_login_failed(); } if (!mci_has_readonly_access($t_user_id)) { return mci_soap_fault_access_denied($t_user_id); } $t_results = array(); $t_start = max(array(0, $p_page_number - 1)) * $p_per_page; foreach (profile_get_all_for_user($t_user_id) as $t_profile_row) { $t_result = array('id' => $t_profile_row['id'], 'description' => $t_profile_row['description'], 'os' => $t_profile_row['os'], 'os_build' => $t_profile_row['os_build'], 'platform' => $t_profile_row['platform']); if ($t_profile_row['user_id'] != 0) { $t_result['user_id'] = mci_account_get_array_by_id($t_profile_row['user_id']); } $t_results[] = $t_result; } # the profile_api does not implement pagination in the backend, so we emulate it here # we can always push the pagination in the database, but this seems unlikely in the # near future, as the number of profiles is expected to be small $t_paged_results = array_slice($t_results, $t_start, $p_per_page); return array('total_results' => count($t_results), 'results' => $t_paged_results); }
function print_profile_option_list($p_user_id, $p_select_id = '', $p_profiles = null) { if ('' === $p_select_id) { $p_select_id = profile_get_default($p_user_id); } if ($p_profiles != null) { $t_profiles = $p_profiles; } else { $t_profiles = profile_get_all_for_user($p_user_id); } print_profile_option_list_from_profiles($t_profiles, $p_select_id); }
</td> </tr> <?php } if ($t_show_platform || $t_show_os || $t_show_os_version) { ?> <tr> <th class="category"> <label for="profile_id"><?php echo lang_get('select_profile'); ?> </label> </th> <td> <?php if (count(profile_get_all_for_user(auth_get_current_user_id())) > 0) { ?> <select <?php echo helper_get_tab_index(); ?> id="profile_id" name="profile_id"> <?php print_profile_option_list(auth_get_current_user_id(), $f_profile_id); ?> </select> <?php } ?> </td> </tr> <tr>
<input type="submit" class="button" value="<?php echo lang_get('add_profile_button'); ?> " /> </td> </tr> </table> </form> </div> <?php # Add Profile Form END ?> <?php # Edit or Delete Profile Form BEGIN $t_profiles = profile_get_all_for_user($t_user_id); if ($t_profiles) { ?> <br /> <div align="center"> <form method="post" action="account_prof_update.php"> <?php echo form_security_field('profile_update'); ?> <table class="width75" cellspacing="1"> <tr> <td class="form-title" colspan="2"> <?php echo lang_get('edit_or_delete_profiles_title'); ?> </td>
function print_profile_option_list($p_user_id, $p_select_id = '') { if ('' === $p_select_id) { $p_select_id = profile_get_default($p_user_id); } $t_profiles = profile_get_all_for_user($p_user_id); print '<option value=""></option>'; foreach ($t_profiles as $t_profile) { extract($t_profile, EXTR_PREFIX_ALL, 'v'); $v_platform = string_display($v_platform); $v_os = string_display($v_os); $v_os_build = string_display($v_os_build); print "<option value=\"{$v_id}\""; check_selected($p_select_id, $v_id); print ">{$v_platform} {$v_os} {$v_os_build}</option>"; } }