twitter.views_default.inc 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <?php
  2. function twitter_views_default_views() {
  3. $view = new view;
  4. $view->name = 'tweets';
  5. $view->description = 'Displays Twitter.com status messages for users who have associated Twitter accounts.';
  6. $view->tag = '';
  7. $view->view_php = '';
  8. $view->base_table = 'twitter';
  9. $view->is_cacheable = '0';
  10. $view->api_version = 2;
  11. $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
  12. $handler = $view->new_display('default', 'Tweets', 'default');
  13. $handler->override_option('fields', array(
  14. 'profile_image_url' => array(
  15. 'label' => '',
  16. 'exclude' => 0,
  17. 'id' => 'profile_image_url',
  18. 'table' => 'twitter_account',
  19. 'field' => 'profile_image_url',
  20. 'relationship' => 'none',
  21. ),
  22. 'text' => array(
  23. 'label' => '',
  24. 'exclude' => 0,
  25. 'id' => 'text',
  26. 'table' => 'twitter',
  27. 'field' => 'text',
  28. 'relationship' => 'none',
  29. ),
  30. 'created_time' => array(
  31. 'label' => '',
  32. 'date_format' => 'time ago',
  33. 'custom_date_format' => '',
  34. 'exclude' => 0,
  35. 'id' => 'created_time',
  36. 'table' => 'twitter',
  37. 'field' => 'created_time',
  38. 'relationship' => 'none',
  39. ),
  40. ));
  41. $handler->override_option('sorts', array(
  42. 'created_time' => array(
  43. 'order' => 'DESC',
  44. 'id' => 'created_time',
  45. 'table' => 'twitter',
  46. 'field' => 'created_time',
  47. 'relationship' => 'none',
  48. ),
  49. ));
  50. $handler->override_option('arguments', array(
  51. 'uid' => array(
  52. 'default_action' => 'default',
  53. 'style_plugin' => 'default_summary',
  54. 'style_options' => array(),
  55. 'wildcard' => 'all',
  56. 'wildcard_substitution' => 'All author',
  57. 'title' => '%1\'s tweets',
  58. 'default_argument_type' => 'user',
  59. 'default_argument' => '',
  60. 'validate_type' => 'php',
  61. 'validate_options' => array(
  62. 'code' => '$uid = arg(1);
  63. if (!empty($uid)) {
  64. $account = user_load($uid);
  65. $twitter_accounts = twitter_twitter_accounts($account);
  66. if(count($twitter_accounts)) {
  67. return TRUE;
  68. }
  69. else {
  70. return FALSE;
  71. }
  72. }',
  73. ),
  74. 'validate_fail' => 'not found',
  75. 'break_phrase' => 0,
  76. 'not' => 0,
  77. 'id' => 'uid',
  78. 'table' => 'users',
  79. 'field' => 'uid',
  80. 'relationship' => 'none',
  81. 'default_argument_user' => 1,
  82. 'default_argument_fixed' => '',
  83. 'default_argument_php' => '',
  84. 'validate_argument_node_type' => array(
  85. 'poll' => 0,
  86. 'page' => 0,
  87. 'review' => 0,
  88. 'story' => 0,
  89. ),
  90. 'validate_argument_node_access' => 0,
  91. 'validate_argument_nid_type' => 'nid',
  92. 'validate_argument_vocabulary' => array(),
  93. 'validate_argument_type' => 'tid',
  94. 'validate_argument_php' => '',
  95. ),
  96. ));
  97. $handler->override_option('filters', array(
  98. 'protected' => array(
  99. 'operator' => '=',
  100. 'value' => 0,
  101. 'group' => '0',
  102. 'exposed' => FALSE,
  103. 'expose' => array(
  104. 'operator' => FALSE,
  105. 'label' => '',
  106. ),
  107. 'id' => 'protected',
  108. 'table' => 'twitter_account',
  109. 'field' => 'protected',
  110. 'relationship' => 'none',
  111. ),
  112. ));
  113. $handler->override_option('access', array(
  114. 'type' => 'none',
  115. 'role' => array(),
  116. 'perm' => '',
  117. ));
  118. $handler->override_option('use_pager', 'mini');
  119. $handler->override_option('style_plugin', 'table');
  120. $handler->override_option('style_options', array(
  121. 'grouping' => '',
  122. 'override' => 1,
  123. 'sticky' => 0,
  124. 'order' => 'asc',
  125. 'columns' => array(
  126. 'profile_image_url' => 'profile_image_url',
  127. 'text' => 'text',
  128. 'created_time' => 'text',
  129. ),
  130. 'info' => array(
  131. 'profile_image_url' => array(
  132. 'sortable' => 0,
  133. 'separator' => '',
  134. ),
  135. 'text' => array(
  136. 'sortable' => 0,
  137. 'separator' => ' &#8212; ',
  138. ),
  139. 'created_time' => array(
  140. 'sortable' => 0,
  141. 'separator' => '',
  142. ),
  143. ),
  144. 'default' => '-1',
  145. ));
  146. $handler = $view->new_display('page', 'Page', 'page');
  147. $handler->override_option('path', 'user/%/tweets');
  148. $handler->override_option('menu', array(
  149. 'type' => 'tab',
  150. 'title' => 'Twitter',
  151. 'weight' => '1',
  152. ));
  153. $handler->override_option('tab_options', array(
  154. 'type' => 'none',
  155. 'title' => '',
  156. 'weight' => 0,
  157. ));
  158. $handler = $view->new_display('block', 'Block', 'block');
  159. $handler->override_option('fields', array(
  160. 'text' => array(
  161. 'label' => '',
  162. 'exclude' => 0,
  163. 'id' => 'text',
  164. 'table' => 'twitter',
  165. 'field' => 'text',
  166. 'relationship' => 'none',
  167. ),
  168. 'created_time' => array(
  169. 'label' => '',
  170. 'date_format' => 'time ago',
  171. 'custom_date_format' => '',
  172. 'exclude' => 0,
  173. 'id' => 'created_time',
  174. 'table' => 'twitter',
  175. 'field' => 'created_time',
  176. 'relationship' => 'none',
  177. ),
  178. ));
  179. $handler->override_option('items_per_page', 5);
  180. $handler->override_option('use_more', 1);
  181. $handler->override_option('style_plugin', 'list');
  182. $handler->override_option('row_options', array(
  183. 'inline' => array(
  184. 'text' => 'text',
  185. 'created_time' => 'created_time',
  186. ),
  187. 'separator' => ' &#8212; ',
  188. ));
  189. $handler->override_option('block_description', 'User Tweets');
  190. return array('tweets' => $view);
  191. }