diff options
author | Sem <sembrestels@riseup.net> | 2011-11-09 01:35:57 +0100 |
---|---|---|
committer | Sem <sembrestels@riseup.net> | 2011-11-09 01:35:57 +0100 |
commit | 6b16fa9b322ae12a54c66ba5160cc7547d6e7667 (patch) | |
tree | 3fc01c57d72c0d76a0dfefa5d6e5c2136ec79117 /pages/videolist | |
parent | 314f5c66f927a3b542e908e0794a8602129f2f8f (diff) | |
download | elgg-6b16fa9b322ae12a54c66ba5160cc7547d6e7667.tar.gz elgg-6b16fa9b322ae12a54c66ba5160cc7547d6e7667.tar.bz2 |
Videolist on groups and edit/delete functionalities.
Diffstat (limited to 'pages/videolist')
-rw-r--r-- | pages/videolist/edit.php | 75 |
1 files changed, 40 insertions, 35 deletions
diff --git a/pages/videolist/edit.php b/pages/videolist/edit.php index cc06dd9c4..5ca1e4b64 100644 --- a/pages/videolist/edit.php +++ b/pages/videolist/edit.php @@ -1,43 +1,48 @@ <?php /** -* Elgg Edit Video -*/ - -require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + * Edit a videolist item + * + * @package ElggVideolist + */ gatekeeper(); -$video_file = (int) get_input('video'); -if ($video_file = get_entity($video_file)) { - - // Set the page owner - $page_owner = page_owner_entity(); - if ($page_owner === false || is_null($page_owner)) { - $container_guid = $video_file->container_guid; - if (!empty($container_guid)) - if ($page_owner = get_entity($container_guid)) { - set_page_owner($container_guid->guid); - } - if (empty($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($_SESSION['guid']); - } - } - - if ($video_file->canEdit()) { - // set up breadcrumbs - elgg_push_breadcrumb(elgg_echo('videolist:all'), elgg_get_site_url()."videolist/all.php"); - elgg_push_breadcrumb(sprintf(elgg_echo("videolist:user"),$page_owner->name), elgg_get_site_url()."videolist/".$page_owner->username); - elgg_push_breadcrumb(sprintf(elgg_echo("videolist:edit"))); - - $area1 = elgg_view('navigation/breadcrumbs'); - $area1 .= elgg_view_title($title = elgg_echo('videolist:edit')); - $area2 = elgg_view("forms/edit",array('entity' => $video_file)); - $body = elgg_view_layout('one_column_with_sidebar', $area1.$area2, $area3); - page_draw(elgg_echo("videolist:edit"), $body); - } -} else { +$guid = (int) get_input('guid'); +$videolist_item = get_entity($guid); +if (!$videolist_item) { + forward(); +} +if (!$videolist_item->canEdit()) { forward(); } -?> +$title = elgg_echo('videolist:edit'); +$container = get_entity($videolist_item->getContainerGUID()); + +elgg_push_breadcrumb(elgg_echo('videolist'), "videolist/all"); +if(elgg_instanceof($container, 'user')){ + elgg_push_breadcrumb($container->name, "videolist/owner/$container->username/"); +} else { + elgg_push_breadcrumb($container->name, "videolist/group/$container->guid/"); +} +elgg_push_breadcrumb($videolist_item->title, $videolist_item->getURL()); +elgg_push_breadcrumb($title); + +elgg_set_page_owner_guid($container->guid); + +$form_vars = array(); +$body_vars = array('guid' => $guid); + +foreach(array_keys(elgg_get_config('videolist')) as $variable) { + $body_vars[$variable] = $videolist_item->$variable; +} + +$content = elgg_view_form('videolist/edit', $form_vars, $body_vars); + +$body = elgg_view_layout('content', array( + 'content' => $content, + 'title' => $title, + 'filter' => '', +)); + +echo elgg_view_page($title, $body); |