Advertisement
Guest User

View with Custom Query

a guest
Jul 5th, 2010
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.60 KB | None | 0 0
  1. $view = new view;
  2. $view->name = 'hud_downloads';
  3. $view->description = 'HUD Downloads';
  4. $view->tag = 'huds downloads';
  5. $view->view_php = '';
  6. $view->base_table = 'node';
  7. $view->is_cacheable = FALSE;
  8. $view->api_version = 2;
  9. $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
  10. $handler = $view->new_display('default', 'Defaults', 'default');
  11. $handler->override_option('fields', array(
  12. 'title' => array(
  13. 'label' => 'Title',
  14. 'alter' => array(
  15. 'alter_text' => 0,
  16. 'text' => '',
  17. 'make_link' => 0,
  18. 'path' => '',
  19. 'link_class' => '',
  20. 'alt' => '',
  21. 'prefix' => '',
  22. 'suffix' => '',
  23. 'target' => '',
  24. 'help' => '',
  25. 'trim' => 0,
  26. 'max_length' => '15',
  27. 'word_boundary' => 1,
  28. 'ellipsis' => 1,
  29. 'html' => 0,
  30. 'strip_tags' => 0,
  31. ),
  32. 'empty' => '',
  33. 'hide_empty' => 0,
  34. 'empty_zero' => 0,
  35. 'link_to_node' => 1,
  36. 'exclude' => 0,
  37. 'id' => 'title',
  38. 'table' => 'node',
  39. 'field' => 'title',
  40. 'relationship' => 'none',
  41. 'override' => array(
  42. 'button' => 'Override',
  43. ),
  44. ),
  45. ));
  46. $handler->override_option('filters', array(
  47. 'type' => array(
  48. 'operator' => 'in',
  49. 'value' => array(
  50. 'huds' => 'huds',
  51. ),
  52. 'group' => '0',
  53. 'exposed' => FALSE,
  54. 'expose' => array(
  55. 'operator' => FALSE,
  56. 'label' => '',
  57. ),
  58. 'id' => 'type',
  59. 'table' => 'node',
  60. 'field' => 'type',
  61. 'override' => array(
  62. 'button' => 'Override',
  63. ),
  64. 'relationship' => 'none',
  65. ),
  66. 'status' => array(
  67. 'operator' => '=',
  68. 'value' => '1',
  69. 'group' => '0',
  70. 'exposed' => FALSE,
  71. 'expose' => array(
  72. 'operator' => FALSE,
  73. 'label' => '',
  74. ),
  75. 'id' => 'status',
  76. 'table' => 'node',
  77. 'field' => 'status',
  78. 'override' => array(
  79. 'button' => 'Override',
  80. ),
  81. 'relationship' => 'none',
  82. ),
  83. ));
  84. $handler->override_option('access', array(
  85. 'type' => 'none',
  86. ));
  87. $handler->override_option('cache', array(
  88. 'type' => 'none',
  89. ));
  90. $handler->override_option('use_ajax', TRUE);
  91. $handler->override_option('items_per_page', 5);
  92. $handler->override_option('use_pager', 'mini');
  93. $handler->override_option('style_plugin', 'table');
  94. $handler = $view->new_display('block', 'Block 2', 'block_2');
  95. $handler->override_option('fields', array(
  96. 'title' => array(
  97. 'label' => 'Title',
  98. 'alter' => array(
  99. 'alter_text' => 0,
  100. 'text' => '',
  101. 'make_link' => 0,
  102. 'path' => '',
  103. 'link_class' => '',
  104. 'alt' => '',
  105. 'prefix' => '',
  106. 'suffix' => '',
  107. 'target' => '',
  108. 'help' => '',
  109. 'trim' => 1,
  110. 'max_length' => '18',
  111. 'word_boundary' => 1,
  112. 'ellipsis' => 1,
  113. 'html' => 0,
  114. 'strip_tags' => 0,
  115. ),
  116. 'empty' => '',
  117. 'hide_empty' => 0,
  118. 'empty_zero' => 0,
  119. 'link_to_node' => 1,
  120. 'exclude' => 0,
  121. 'id' => 'title',
  122. 'table' => 'node',
  123. 'field' => 'title',
  124. 'relationship' => 'none',
  125. 'override' => array(
  126. 'button' => 'Use default',
  127. ),
  128. ),
  129. 'count' => array(
  130. 'label' => 'Count',
  131. 'alter' => array(
  132. 'alter_text' => 0,
  133. 'text' => '',
  134. 'make_link' => 0,
  135. 'path' => '',
  136. 'link_class' => '',
  137. 'alt' => '',
  138. 'prefix' => '',
  139. 'suffix' => '',
  140. 'target' => '',
  141. 'help' => '',
  142. 'trim' => 0,
  143. 'max_length' => '',
  144. 'word_boundary' => 1,
  145. 'ellipsis' => 1,
  146. 'html' => 0,
  147. 'strip_tags' => 0,
  148. ),
  149. 'empty' => '',
  150. 'hide_empty' => 0,
  151. 'empty_zero' => 0,
  152. 'set_precision' => FALSE,
  153. 'precision' => 0,
  154. 'decimal' => '.',
  155. 'separator' => ',',
  156. 'prefix' => '',
  157. 'suffix' => '',
  158. 'exclude' => 0,
  159. 'id' => 'count',
  160. 'table' => 'pubdlcnt',
  161. 'field' => 'count',
  162. 'override' => array(
  163. 'button' => 'Use default',
  164. ),
  165. 'relationship' => 'none',
  166. ),
  167. ));
  168. $handler->override_option('title', 'Most Downloaded');
  169. $handler->override_option('use_pager', '0');
  170. $handler->override_option('style_options', array(
  171. 'grouping' => '',
  172. 'override' => 1,
  173. 'sticky' => 0,
  174. 'order' => 'desc',
  175. 'columns' => array(
  176. 'title' => 'title',
  177. 'count' => 'count',
  178. ),
  179. 'info' => array(
  180. 'title' => array(
  181. 'sortable' => 1,
  182. 'separator' => '',
  183. ),
  184. 'count' => array(
  185. 'sortable' => 1,
  186. 'separator' => '',
  187. ),
  188. ),
  189. 'default' => 'count',
  190. ));
  191. $handler->override_option('block_description', 'Most Downloaded HUDs 2');
  192. $handler->override_option('block_caching', -1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement