admin_display_groups_popup_select_icon

4.x admin.groups.inc admin_display_groups_popup_select_icon()

This popup is called from the edit group page. It lets the user select an icon to assign to a group.

File

modules/admin/admin.groups.inc, line 731

Code

function admin_display_groups_popup_select_icon() {
  $rtn = "";

  fp_add_css(fp_get_module_path("admin") . "/css/admin.css");
  fp_add_js(fp_get_module_path("admin") . "/js/admin.js");

  $group_id = $_REQUEST["group_id"];
  $group = new Group();
  $group->group_id = $group_id;
  $group->bool_use_draft = true;
  $group->load_descriptive_data();

  $rtn = "<b>Please Select an Icon to use for $group->title (<i>$group->group_name</i>):</b>
      <div class='tenpt'>Current icon: <img src='" . fp_theme_location() . "/images/icons/$group->icon_filename' width='19'>
      $group->icon_filename.
      <br><br>
      Available Icons:
        <blockquote>";
  $handle = opendir(fp_theme_location(FALSE) . "/images/icons/.");
  $files = array();


  $accepted_exts = array(
    "jpg",
    "gif",
    "png",
    "bmp",
    "JPG",
    "GIF",
    "PNG",
    "BMP",
    "jpeg",
  );
  while ($file = readdir($handle)) {
    if ($file != "." && $file != "..") {
      // Make sure it's extension is an image file.
      // Find out it's ext first.
      $temp = explode(".", $file);
      $ext = $temp[count($temp) - 1];
      if (in_array($ext, $accepted_exts)) {
        $files[] = $file;
      }
    }
  }
  // make sure they are alphabetized.
  sort($files);


  foreach ($files as $file) {
    $rtn .= "<div style='padding: 5px;'>
        <input type='button' value='Select -> ' onClick='adminPopupSelectIcon(\"$file\");' >
        &nbsp; &nbsp;
        <img src='" . fp_theme_location() . "/images/icons/$file' width='19'>
        $file</div>";
  }


  $rtn .= "</blockquote></div>";
  return $rtn;
}