P2Pvalue / cbpp-directory-code

Source code for the CBPP directory website
http://directory.p2pvalue.eu/
GNU General Public License v2.0
3 stars 6 forks source link

Dynamic block for current number of cases #60

Closed drozas closed 9 years ago

drozas commented 9 years ago

Create a block which displays the total current number of CBPP cases

drozas commented 9 years ago

Looking at feasibility of doing it with views - http://drupal.stackexchange.com/questions/15871/count-of-nodes-by-type

drozas commented 9 years ago

Exported view from dev:

$view = new view(); $view->name = 'cbpp_communites_aggregated'; $view->description = 'This is a view to gather displays on aggregation operations in cbbp communities'; $view->tag = 'default'; $view->base_table = 'node'; $view->human_name = 'cbpp_communites_aggregated'; $view->core = 7; $view->api_version = '3.0'; $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master _/ $handler = $view->new_display('default', 'Master', 'default'); $handler->display->display_options['use_more_always'] = FALSE; $handler->display->display_options['group_by'] = TRUE; $handler->display->display_options['access']['type'] = 'perm'; $handler->display->display_options['cache']['type'] = 'none'; $handler->display->display_options['query']['type'] = 'views_query'; $handler->display->display_options['exposed_form']['type'] = 'basic'; $handler->display->display_options['pager']['type'] = 'some'; $handler->display->display_options['pager']['options']['items_per_page'] = '5'; $handler->display->display_options['style_plugin'] = 'default'; $handler->display->display_options['rowplugin'] = 'fields'; / Field: Content: Type _/ $handler->display->display_options['fields']['type']['id'] = 'type'; $handler->display->display_options['fields']['type']['table'] = 'node'; $handler->display->display_options['fields']['type']['field'] = 'type'; $handler->display->displayoptions['fields']['type']['exclude'] = TRUE; / Field: COUNT(Content: Type) _/ $handler->display->display_options['fields']['type_1']['id'] = 'type_1'; $handler->display->display_options['fields']['type_1']['table'] = 'node'; $handler->display->display_options['fields']['type_1']['field'] = 'type'; $handler->display->display_options['fields']['type_1']['group_type'] = 'count'; $handler->display->display_options['fields']['type_1']['label'] = ''; $handler->display->display_options['fields']['type_1']['exclude'] = TRUE; $handler->display->display_options['fields']['type_1']['element_labelcolon'] = FALSE; / Field: Global: Custom text _/ $handler->display->display_options['fields']['nothing']['id'] = 'nothing'; $handler->display->display_options['fields']['nothing']['table'] = 'views'; $handler->display->display_options['fields']['nothing']['field'] = 'nothing'; $handler->display->display_options['fields']['nothing']['label'] = ''; $handler->display->display_options['fields']['nothing']['alter']['text'] = 'There are currently [type_1] Commons-Based Peer Production cases!'; $handler->display->display_options['fields']['nothing']['element_type'] = 'h3'; $handler->display->display_options['fields']['nothing']['element_labelcolon'] = FALSE; / Filter criterion: Content: Type */ $handler->display->display_options['filters']['type']['id'] = 'type'; $handler->display->display_options['filters']['type']['table'] = 'node'; $handler->display->display_options['filters']['type']['field'] = 'type'; $handler->display->display_options['filters']['type']['value'] = array( 'cbpp_community' => 'cbpp_community', );

/* Display: Block */ $handler = $view->new_display('block', 'Block', 'block');

drozas commented 9 years ago

Done! @pdavenne, @cataspanglish I added the following text "There are currently XXX Commons-Based Peer Production cases!" and placed it on the right sidebar. I'll reassign this to you in case you you want to me to modify the text/position. Otherwise, feel free to mark this issue as closed ;-)