root/releases/0.1.2a/units/icons/function_edit_icons.php

Revision 2, 2.2 kB (checked in by sven, 3 years ago)

importing elgg-0.1.1a

Line 
1 <?php
2
3     // Display icons and allow user to edit their names or delete some
4     
5     // Get all icons associated with a user
6         $icons = db_query("select * from icons where owner = " . $_SESSION['userid']);
7
8         $body = <<< END
9         <h2>
10             Your Icons
11         </h2>
12 END;
13         
14     // If we have some icons, display them; otherwise explain that there isn't anything to edit
15         if (sizeof($icons) > 0) {
16             
17             $body .= <<< END
18         <form action="" method="post" />       
19             <p>
20                 Your current icons are listed below.
21             </p>
22 END;
23             foreach($icons as $icon) {
24                 list($width, $height, $type, $attr) = getimagesize(path . "_icons/data/" . $icon->filename);
25
26                 $name = <<< END
27                         <label>Delete:
28                             <input type="checkbox" name="icons_delete[]" value="{$icon->ident}" />
29                         </label>
30 END;
31                 $column1 = <<< END
32                         <p align="center"><img src="/_icons/data/{$icon->filename}" {$attr} /></p>
33 END;
34                 if ($icon->filename == $_SESSION['icon']) {
35                     $checked = "checked=\"checked\"";
36                 } else {
37                     $checked = "";
38                 }
39                 $defaulticon = htmlentities(stripslashes($icon->description));
40                 $column2 = <<< END
41                         <label>Name:
42                             <input    type="text" name="description[{$icon->ident}]"
43                                     value="{$defaulticon}" />
44                         </label><br />
45                         <label>Default: <input type="radio" name="defaulticon" value="{$icon->ident}" {$checked} /></label>
46 END;
47
48                 $body .= run("templates:draw", array(
49                                 'context' => 'databox',
50                                 'name' => $column1,
51                                 'column1' => $column2,
52                                 'column2' => $name
53                             )
54                             );
55
56             }
57             
58             if ($_SESSION['icon'] == "default.png") {
59                 $checked = "checked = \"checked\"";
60             } else {
61                 $checked = "";
62             }
63             $column1 = <<< END
64                         <label>No default:
65                         <input type="radio" name="defaulticon" value="-1" {$checked} /></label>
66 END;
67             $body .= run("templates:draw", array(
68                             'context' => 'databox',
69                             'column1' => $column1
70                         )
71                         );
72             $body .= <<< END
73                 <p align="center">
74                     <input type="hidden" name="action" value="icons:edit" />
75                     <input type="submit" value="Save" />       
76                 </p>
77             </form>
78 END;
79             
80         } else {
81
82     $body .= <<< END
83         <p>
84             You don't have any icons loaded yet.
85         </p>
86 END;
87
88         }
89
90         $run_result .= $body;
91 ?>
Note: See TracBrowser for help on using the browser.