/[drupal]/contributions/modules/facebook_status/facebook_status.flag.inc
ViewVC logotype

Contents of /contributions/modules/facebook_status/facebook_status.flag.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Tue Jun 2 02:14:39 2009 UTC (5 months, 3 weeks ago) by icecreamyou
Branch: MAIN
CVS Tags: DRUPAL-6--2-0-RC2, DRUPAL-6--2-0-RC1, DRUPAL-6--2-0-BETA4, HEAD
Branch point for: DRUPAL-6--2
File MIME type: text/x-php
Added Views support for posting on other users' profiles
Fixed a bug with Views relationships
*Major updates to default Views
Removed trailing spaces in facebook_status.author_pane.inc
Removed theme_facebook_status_flag_create()
Optimized code for better performance
Lots of other minor improvements and bug fixes

Note: most Views now require the PHP module to be enabled.
1 <?php
2 // $Id$
3
4 /**
5 @file
6 * Includes a class that extends the Flag module for Facebook-style Statuses.
7 */
8
9 /**
10 * Adds a new flag type.
11 */
12 class facebook_status_flag extends flag_flag {
13 function _load_content($content_id) {
14 return is_numeric($content_id) ? facebook_status_load($content_id) : NULL;
15 }
16 function applies_to_content_object($status) {
17 //Check for status_time == 0 so we don't flag blank statuses.
18 if ($status && $status->status_time) {
19 return TRUE;
20 }
21 return FALSE;
22 }
23 function get_content_id($status) {
24 return $status->sid;
25 }
26 function get_labels_token_types() {
27 return array('facebook_status');
28 }
29 function get_views_info() {
30 return array(
31 'views table' => 'facebook_status',
32 'join field' => 'uid',
33 'title field' => 'status',
34 'title' => t('Facebook-style Status'),
35 'help' => t('Display information about the flag set on a status.'),
36 );
37 }
38 function applies_to_content_id_array($content_ids) {
39 foreach ($content_ids as $content_id) {
40 $passed[$content_id] = TRUE;
41 }
42 return $passed;
43 }
44 function get_relevant_action_objects($content_id) {
45 return array(
46 'facebook_status' => $this->fetch_content($content_id),
47 );
48 }
49 function replace_tokens($label, $contexts, $content_id) {
50 if ($content_id && ($status = $this->fetch_content($content_id))) {
51 $contexts['facebook_status'] = $status;
52 }
53 return parent::replace_tokens($label, $contexts, $content_id);
54 }
55 function get_flag_action($content_id) {
56 $flag_action = parent::get_flag_action($content_id);
57 $status = $this->fetch_content($content_id);
58 $flag_action->content_title = $status->status;
59 $flag_action->content_url = _flag_url('user/'. $status->uid);
60 return $flag_action;
61 }
62 function rules_get_event_arguments_definition() {
63 return array(
64 'account' => array(
65 'type' => 'facebook_status',
66 'label' => t('Flagged status'),
67 'handler' => 'flag_rules_get_event_argument',
68 ),
69 );
70 }
71 function rules_get_element_argument_definition() {
72 return array('type' => 'facebook_status', 'label' => t('Flagged status'));
73 }
74 }

  ViewVC Help
Powered by ViewVC 1.1.2