<li class="folders"><input type="radio" name="new_folder" value="0" id="fhome" <?php if ($folder_id == 0) { echo ' checked="checked"'; } ?> /><label for="fhome"><?php echo fs_get_workspace($owner_type, $owner_id); ?> </label> <?php if ($folder_id == $current_folder_id) { echo ' ' . _AT('current_location'); } ?> <?php fs_print_folders($folder_id, 0, $folders); ?> </li> </ul> </div> <div class="row buttons"> <input type="submit" name="submit" value="<?php echo _AT('move'); ?> " /> <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?> " /> </div>
/** * outputs the folders as a list. * * $current_folder_id the current folder id, used for pre-selecting the radio button * $parent_folder_id the folder id to display children of * $folders the array of folders returned from get_folders() * $disable whether or not the radio button is available */ function fs_print_folders($current_folder_id, $parent_folder_id, &$folders, $disable = FALSE) { if (!isset($folders[$parent_folder_id])) { return; } echo '<ul>'; foreach ($folders[$parent_folder_id] as $folder_id => $folder_info) { echo '<li class="folders">'; echo '<input type="radio" name="new_folder" value="'.$folder_id.'" id="f'.$folder_id.'"'; if ($_GET['folders'] && in_array($folder_id, $_GET['folders'])) { $disable = TRUE; } if ($folder_id == $current_folder_id) { echo ' checked="checked"'; } if ($disable) { echo ' disabled="disabled"'; } echo '/><label for="f'.$folder_id.'">'.htmlspecialchars($folder_info['title']); if ($folder_id == $current_folder_id) { echo ' '._AT('current_location'); } echo '</label>'; fs_print_folders($current_folder_id, $folder_id, $folders, $disable); if ($_GET['folders'] && in_array($folder_id, $_GET['folders'])) { $disable = FALSE; } echo '</li>'; } echo '</ul>'; }