--- favorite_nodes1.module 2008-03-14 16:27:27.000000000 +0100 +++ favorite_nodes.module 2008-06-24 13:39:05.000000000 +0200 @@ -552,6 +552,18 @@ function favorite_nodes_views_tables() { 'sortable' => FALSE, 'notafield' => TRUE, ), + 'remove' => array( + 'name' => t('Favorite Nodes: Remove from Favourites'), + 'handler' => 'favouite_nodes_handler_remove_link', + 'help' => t('A link which allows the user to remove from favourites'), + 'sortable' => FALSE, + ), + 'remove/add' => array( + 'name' => t('Favorite Nodes: Remove/add from Favorites'), + 'handler' => 'favouite_nodes_handler_remove_add_link', + 'help' => t('A link which allows the user to remove/add to/from favoruites'), + 'sortable' => false + ), ), 'sorts' => array( 'last' => array( @@ -648,3 +660,17 @@ function favorite_nodes_handler_user_cou return db_result(db_query("SELECT COUNT(*) FROM {favorite_nodes} WHERE nid = %d", $data->nid)); } +function favouite_nodes_handler_remove_link($fieldinfo, $fielddata, $value, $data) { + return l(t('remove from favorites'), 'favorite_nodes/delete/'. $data->nid); +} +function favouite_nodes_handler_remove_add_link($fieldinfo, $fielddata, $value, $data) { + global $user; + if (!_favorite_nodes_check($data->nid, $user->uid)) { + $link = array('title' => t('add to favorites'), 'href' => 'favorite_nodes/add/'. $node->nid); + return theme('link', $link); + } + else { + $link = array('title' => t('remove from favorites'), 'href' => 'favorite_nodes/delete/'. $node->nid); + return theme('link', $link); + } +} \ Kein Zeilenumbruch am Dateiende.