]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
edit videos
authorDave Tosh <dave@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 7 Apr 2010 20:24:20 +0000 (20:24 +0000)
committerDave Tosh <dave@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 7 Apr 2010 20:24:20 +0000 (20:24 +0000)
actions/edit.php [new file with mode: 0644]
views/default/forms/edit.php

diff --git a/actions/edit.php b/actions/edit.php
new file mode 100644 (file)
index 0000000..6ccc2a3
--- /dev/null
@@ -0,0 +1,42 @@
+<?php\r
+/**\r
+ * Elgg video edit\r
+ */\r
+\r
+global $CONFIG;\r
+       \r
+// Get variables\r
+$title = strip_tags(get_input("title_videourl"));\r
+$tags = get_input("tags");\r
+$access_id = (int) get_input("access_id");\r
+       \r
+$guid = (int) get_input('video_guid');\r
+\r
+if (!$video = get_entity($guid)) {\r
+       register_error(elgg_echo("videolist:noentity"));\r
+       forward($CONFIG->wwwroot . "pg/videolist/" . $_SESSION['user']->username);\r
+       exit;\r
+}\r
+       \r
+$result = false;\r
+\r
+$container_guid = $video->container_guid;\r
+$container = get_entity($container_guid);\r
+       \r
+if ($video->canEdit()) {\r
+       \r
+       $video->access_id = $access_id;\r
+       $video->title = $title;\r
+       \r
+       // Save tags\r
+       $tags = explode(",", $tags);\r
+       $video->tags = $tags;\r
+       $result = $video->save();\r
+}\r
+       \r
+if ($result)\r
+       system_message(elgg_echo("videolist:editsaved"));\r
+else\r
+       register_error(elgg_echo("videolist:editfailed"));\r
+       \r
+forward($CONFIG->wwwroot . "pg/videolist/" . $container->username);
\ No newline at end of file
index 00658bd2b2c29085a85d41a5f57c1437594ba8ea..4114b5ad6e6e06bf9837f30e52bb35fa99cd0bb8 100644 (file)
@@ -8,7 +8,7 @@ $page_owner = page_owner_entity();
 $container_guid = $vars['entity']->container_guid;
 ?>
 
-<form action="<?php echo $vars['url']; ?>action/videolist/add" enctype="multipart/form-data" method="post" class="margin_top">
+<form action="<?php echo $vars['url']; ?>action/videolist/edit" enctype="multipart/form-data" method="post" class="margin_top">
 
        <p><label><?php echo elgg_echo("title"); ?><br />
                <?php echo elgg_view("input/text", array("internalname" => "title_videourl","value" => $vars['entity']->title));?>
@@ -27,7 +27,7 @@ $container_guid = $vars['entity']->container_guid;
                echo "<input type='hidden' name=\"container_guid\" value=\"{$container_guid}\" />";
                
                if (isset($vars['entity'])) {
-                       echo "<input type='hidden' name=\"file_guid\" value=\"{$vars['entity']->getGUID()}\" />";
+                       echo "<input type='hidden' name=\"video_guid\" value=\"{$vars['entity']->getGUID()}\" />";
                }
                echo elgg_view('input/securitytoken');
        ?>