aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-04 18:35:48 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-04 18:35:48 +0000
commita7ab0d0d8b2b2be2a331125d0e6d3d2734b91f69 (patch)
tree1781825422ae26964ce4a680a0c90ee79fafb81e /mod
parent6faba7480f02a248ba9d10c59c9a92f27aac48a1 (diff)
downloadelgg-a7ab0d0d8b2b2be2a331125d0e6d3d2734b91f69.tar.gz
elgg-a7ab0d0d8b2b2be2a331125d0e6d3d2734b91f69.tar.bz2
Closes #109: Group icons can be set. Fixed recreate group on edit.
git-svn-id: https://code.elgg.org/elgg/trunk@1304 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod')
-rw-r--r--mod/groups/actions/edit.php48
-rw-r--r--mod/groups/languages/en.php1
-rw-r--r--mod/groups/views/default/forms/groups/edit.php13
3 files changed, 59 insertions, 3 deletions
diff --git a/mod/groups/actions/edit.php b/mod/groups/actions/edit.php
index c8eebbd84..b5502115b 100644
--- a/mod/groups/actions/edit.php
+++ b/mod/groups/actions/edit.php
@@ -59,7 +59,53 @@
$group->save();
- $group->join($user); // Creator always a member
+ if (!$group->isMember($user))
+ $group->join($user); // Creator always a member
+
+
+ // Now see if we have a file icon
+ if ((isset($_FILES['icon'])) && (substr_count($_FILES['icon']['type'],'image/')))
+ {
+ $prefix = "groups/".$group->guid;
+
+ $filehandler = new ElggFile();
+ $filehandler->owner_guid = $group->owner_guid;
+ $filehandler->setFilename($prefix . ".jpg");
+ $filehandler->open("write");
+ $filehandler->write(get_uploaded_file('icon'));
+ $filehandler->close();
+
+ $thumbtiny = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),25,25, true);
+ $thumbsmall = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),40,40, true);
+ $thumbmedium = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),100,100, true);
+ $thumblarge = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(),200,200, false);
+ if ($thumbtiny) {
+
+ $thumb = new ElggFile();
+ $thumb->setMimeType('image/jpeg');
+
+ $thumb->setFilename($prefix."tiny.jpg");
+ $thumb->open("write");
+ $thumb->write($thumbtiny);
+ $thumb->close();
+
+ $thumb->setFilename($prefix."small.jpg");
+ $thumb->open("write");
+ $thumb->write($thumbsmall);
+ $thumb->close();
+
+ $thumb->setFilename($prefix."medium.jpg");
+ $thumb->open("write");
+ $thumb->write($thumbmedium);
+ $thumb->close();
+
+ $thumb->setFilename($prefix."large.jpg");
+ $thumb->open("write");
+ $thumb->write($thumblarge);
+ $thumb->close();
+
+ }
+ }
system_message(elgg_echo("groups:saved"));
diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php
index d286835d5..af3213fbf 100644
--- a/mod/groups/languages/en.php
+++ b/mod/groups/languages/en.php
@@ -22,6 +22,7 @@
'groups:new' => "Create a new group",
'groups:edit' => "Edit a group",
+ 'groups:icon' => 'Group icon (leave blank to leave unchanged)',
'groups:title' => 'Group title',
'groups:description' => 'Description',
'groups:interests' => 'Interests',
diff --git a/mod/groups/views/default/forms/groups/edit.php b/mod/groups/views/default/forms/groups/edit.php
index 7a3a9c353..abb226464 100644
--- a/mod/groups/views/default/forms/groups/edit.php
+++ b/mod/groups/views/default/forms/groups/edit.php
@@ -9,8 +9,17 @@
* @link http://elgg.com/
*/
?>
-<form action="<?php echo $vars['url']; ?>action/groups/edit" method="post">
+<form action="<?php echo $vars['url']; ?>action/groups/edit" enctype="multipart/form-data" method="post">
+ <p>
+ <label><?php echo elgg_echo("groups:icon"); ?><br />
+ <?php
+
+ echo elgg_view("input/file",array('internalname' => 'icon'));
+
+ ?>
+ </label>
+ </p>
<?php
//var_export($vars['profile']);
@@ -46,7 +55,7 @@
<?php
if ($vars['entity'])
{
- ?><input type="hidden" name="group_guid" value="<?php //echo $vars['entity']->getGUID(); ?>" /><?php
+ ?><input type="hidden" name="group_guid" value="<?php echo $vars['entity']->getGUID(); ?>" /><?php
}
?>
<input type="hidden" name="user_guid" value="<?php echo page_owner_entity()->guid; ?>" />