Remove old images and logos
[elgg.git] / units / icons / function_edit_icons.php
blob70a297cea500de6937e9e61ff274319784be4d89
1 <?php
3 // Display icons and allow user to edit their names or delete some
5 global $page_owner;
7 $url = url;
9 // Get all icons associated with a user
10 $icons = db_query("select * from icons where owner = $page_owner");
11 if ($page_owner != $_SESSION['userid']) {
12 $currenticon = db_query("select icons.filename, users.icon from users join icons on icons.ident = users.icon where users.ident = $page_owner");
13 $currenticon = $currenticon[0]->filename;
14 } else {
15 $currenticon = $_SESSION['icon'];
18 $header = gettext("Site pictures"); // gettext variable
19 $body = <<< END
20 <h2>
21 $header
22 </h2>
23 END;
25 // If we have some icons, display them; otherwise explain that there isn't anything to edit
26 if (sizeof($icons) > 0) {
28 $desc = gettext("Site pictures are small pictures that act as a representative icon throughout the system."); // gettext variable
29 $body .= <<< END
30 <form action="" method="post" />
31 <p>
32 $desc
33 </p>
34 END;
35 foreach($icons as $icon) {
36 list($width, $height, $type, $attr) = @getimagesize(path . "_icons/data/" . $icon->filename);
38 $delete = gettext("Delete");
39 $name = <<< END
40 <label for="icons_deletecheckbox">$delete:
41 <input type="checkbox" id="icons_deletecheckbox" name="icons_delete[]" value="{$icon->ident}" />
42 </label>
43 END;
44 $defaulticon = htmlentities(stripslashes($icon->description));
45 $column1 = <<< END
46 <img alt="{$defaulticon}" src="{$url}_icons/data/{$icon->filename}" {$attr} />
47 END;
48 if ($icon->filename == $currenticon) {
49 $checked = "checked=\"checked\"";
50 } else {
51 $checked = "";
53 $nameLabel = gettext("Name:");//gettext variable
54 $default = gettext("Default:");//gettext variable
55 $column2 = <<< END
56 <label>$nameLabel
57 <input type="text" name="description[{$icon->ident}]"
58 value="{$defaulticon}" />
59 </label><br />
60 <label>$default <input type="radio" name="defaulticon" value="{$icon->ident}" {$checked} /></label>
61 END;
63 $body .= run("templates:draw", array(
64 'context' => 'databox',
65 'name' => $column1,
66 'column1' => $column2,
67 'column2' => $name
73 if ($_SESSION['icon'] == "default.png") {
74 $checked = "checked = \"checked\"";
75 } else {
76 $checked = "";
78 $noDefault = gettext("No default:");
79 $column1 = <<< END
80 <label>$noDefault
81 <input type="radio" name="defaulticon" value="-1" {$checked} /></label>
82 END;
83 $body .= run("templates:draw", array(
84 'context' => 'databox',
85 'column1' => $column1
88 $save = gettext("Save"); // gettext variable
89 $body .= <<< END
90 <p align="center">
91 <input type="hidden" name="action" value="icons:edit" />
92 <input type="submit" value=$save />
93 </p>
94 </form>
95 END;
97 } else {
99 $noneLoaded = gettext("You don't have any site pictures loaded yet."); // gettext variable
100 $body .= <<< END
102 $noneLoaded
103 </p>
104 END;
108 $run_result .= $body;