Home page upcoming events block
Add upcoming events block to home page and generate demo event content from events.json file. Change-Id: Ia126ef202621a9c9f97c502ebb4fe174528ca83f
This commit is contained in:
parent
6e46674c6b
commit
110f4d7a63
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"events": [
|
||||||
|
{
|
||||||
|
"title": "Gartner Data Center Conference",
|
||||||
|
"date_from": "2013-12-09 09:00:00",
|
||||||
|
"date_to": "2013-12-12 18:00:00",
|
||||||
|
"location": "US/Las Vegas, NV"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "OpenStack in action 4",
|
||||||
|
"date_from": "2013-12-05 09:00:00",
|
||||||
|
"location": "FR/Paris"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -251,6 +251,48 @@ function groups_demo_create_group($title, $location, $attributes = null) {
|
||||||
return $group;
|
return $group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create event node.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function groups_demo_create_event($title, $date_from, $date_to = NULL,
|
||||||
|
$location) {
|
||||||
|
$event = new stdClass();
|
||||||
|
$event->type = 'event';
|
||||||
|
$event->uid = 1;
|
||||||
|
$event->language = LANGUAGE_NONE;
|
||||||
|
$event->created = time() - 604800;
|
||||||
|
$event->status = 1;
|
||||||
|
$event->title = $title;
|
||||||
|
$event->body[LANGUAGE_NONE][0]['value'] = 'Lorem ipsum...';
|
||||||
|
list($country, $locality, $postal_code, $street_address) = explode('/', $location);
|
||||||
|
$event->field_address[LANGUAGE_NONE][0] = array(
|
||||||
|
'element_key' => 'node|event|field_address|und|0',
|
||||||
|
'thoroughfare' => $street_address,
|
||||||
|
'postal_code' => $postal_code,
|
||||||
|
'locality' => $locality,
|
||||||
|
'country' => $country,
|
||||||
|
);
|
||||||
|
$event->field_date[LANGUAGE_NONE][0] = array(
|
||||||
|
'value' => $date_from,
|
||||||
|
'show_todate' => FALSE,
|
||||||
|
'timezone' => 'Europe/Berlin',
|
||||||
|
'offset' => 3600,
|
||||||
|
'offset2' => 3600,
|
||||||
|
'timezone_db' => UTC,
|
||||||
|
'date_type' => 'datetime',
|
||||||
|
);
|
||||||
|
if (!empty($date_to)) {
|
||||||
|
$event->field_date[LANGUAGE_NONE][0]['value2'] = $date_to;
|
||||||
|
$event->field_date[LANGUAGE_NONE][0]['show_todate'] = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
$event->field_location[LANGUAGE_NONE][0] = array(
|
||||||
|
'value' => 'physical',
|
||||||
|
);
|
||||||
|
return $event;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function generate a demo content
|
* This function generate a demo content
|
||||||
*/
|
*/
|
||||||
|
@ -264,6 +306,14 @@ function groups_demo_content() {
|
||||||
$group['attributes']);
|
$group['attributes']);
|
||||||
node_save($node);
|
node_save($node);
|
||||||
}
|
}
|
||||||
|
// import events
|
||||||
|
$events_raw = file_get_contents(DRUPAL_ROOT . '/profiles/groups/events.json');
|
||||||
|
$events = json_decode($events_raw, TRUE);
|
||||||
|
foreach ($events['events'] as $event) {
|
||||||
|
$node = groups_demo_create_event($event['title'], $event['date_from'],
|
||||||
|
$event['date_to'], $event['location']);
|
||||||
|
node_save($node);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -52,7 +52,7 @@ function groups_homepage_default_page_manager_pages() {
|
||||||
'relationships' => array(),
|
'relationships' => array(),
|
||||||
);
|
);
|
||||||
$display = new panels_display();
|
$display = new panels_display();
|
||||||
$display->layout = 'two_brick';
|
$display->layout = 'three_50_25_25';
|
||||||
$display->layout_settings = array();
|
$display->layout_settings = array();
|
||||||
$display->panel_settings = array(
|
$display->panel_settings = array(
|
||||||
'style_settings' => array(
|
'style_settings' => array(
|
||||||
|
@ -64,6 +64,11 @@ function groups_homepage_default_page_manager_pages() {
|
||||||
'two_brick_left_below' => NULL,
|
'two_brick_left_below' => NULL,
|
||||||
'two_brick_right_below' => NULL,
|
'two_brick_right_below' => NULL,
|
||||||
'two_brick_bottom' => NULL,
|
'two_brick_bottom' => NULL,
|
||||||
|
'three_50_25_25_top' => NULL,
|
||||||
|
'three_50_25_25_first' => NULL,
|
||||||
|
'three_50_25_25_second' => NULL,
|
||||||
|
'three_50_25_25_third' => NULL,
|
||||||
|
'three_50_25_25_bottom' => NULL,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
$display->cache = array();
|
$display->cache = array();
|
||||||
|
@ -73,7 +78,7 @@ function groups_homepage_default_page_manager_pages() {
|
||||||
$display->panels = array();
|
$display->panels = array();
|
||||||
$pane = new stdClass();
|
$pane = new stdClass();
|
||||||
$pane->pid = 'new-dd6ca3f4-3444-af04-f1e2-47c9f488ed53';
|
$pane->pid = 'new-dd6ca3f4-3444-af04-f1e2-47c9f488ed53';
|
||||||
$pane->panel = 'two_brick_left_above';
|
$pane->panel = 'three_50_25_25_first';
|
||||||
$pane->type = 'block';
|
$pane->type = 'block';
|
||||||
$pane->subtype = 'groups_homepage-groups_homepage_welcome';
|
$pane->subtype = 'groups_homepage-groups_homepage_welcome';
|
||||||
$pane->shown = TRUE;
|
$pane->shown = TRUE;
|
||||||
|
@ -92,10 +97,10 @@ function groups_homepage_default_page_manager_pages() {
|
||||||
$pane->locks = array();
|
$pane->locks = array();
|
||||||
$pane->uuid = 'dd6ca3f4-3444-af04-f1e2-47c9f488ed53';
|
$pane->uuid = 'dd6ca3f4-3444-af04-f1e2-47c9f488ed53';
|
||||||
$display->content['new-dd6ca3f4-3444-af04-f1e2-47c9f488ed53'] = $pane;
|
$display->content['new-dd6ca3f4-3444-af04-f1e2-47c9f488ed53'] = $pane;
|
||||||
$display->panels['two_brick_left_above'][0] = 'new-dd6ca3f4-3444-af04-f1e2-47c9f488ed53';
|
$display->panels['three_50_25_25_first'][0] = 'new-dd6ca3f4-3444-af04-f1e2-47c9f488ed53';
|
||||||
$pane = new stdClass();
|
$pane = new stdClass();
|
||||||
$pane->pid = 'new-1a23fada-1c8b-2cf4-2978-e8aa64e28877';
|
$pane->pid = 'new-1a23fada-1c8b-2cf4-2978-e8aa64e28877';
|
||||||
$pane->panel = 'two_brick_right_above';
|
$pane->panel = 'three_50_25_25_second';
|
||||||
$pane->type = 'views_panes';
|
$pane->type = 'views_panes';
|
||||||
$pane->subtype = 'commons_activity_streams_activity-panel_pane_1';
|
$pane->subtype = 'commons_activity_streams_activity-panel_pane_1';
|
||||||
$pane->shown = TRUE;
|
$pane->shown = TRUE;
|
||||||
|
@ -111,10 +116,10 @@ function groups_homepage_default_page_manager_pages() {
|
||||||
$pane->locks = array();
|
$pane->locks = array();
|
||||||
$pane->uuid = '1a23fada-1c8b-2cf4-2978-e8aa64e28877';
|
$pane->uuid = '1a23fada-1c8b-2cf4-2978-e8aa64e28877';
|
||||||
$display->content['new-1a23fada-1c8b-2cf4-2978-e8aa64e28877'] = $pane;
|
$display->content['new-1a23fada-1c8b-2cf4-2978-e8aa64e28877'] = $pane;
|
||||||
$display->panels['two_brick_right_above'][0] = 'new-1a23fada-1c8b-2cf4-2978-e8aa64e28877';
|
$display->panels['three_50_25_25_second'][0] = 'new-1a23fada-1c8b-2cf4-2978-e8aa64e28877';
|
||||||
$pane = new stdClass();
|
$pane = new stdClass();
|
||||||
$pane->pid = 'new-4f60b089-fac8-aa14-d1f8-d5674b0d51bc';
|
$pane->pid = 'new-4f60b089-fac8-aa14-d1f8-d5674b0d51bc';
|
||||||
$pane->panel = 'two_brick_right_above';
|
$pane->panel = 'three_50_25_25_third';
|
||||||
$pane->type = 'views_panes';
|
$pane->type = 'views_panes';
|
||||||
$pane->subtype = 'commons_events_upcoming-panel_pane_2';
|
$pane->subtype = 'commons_events_upcoming-panel_pane_2';
|
||||||
$pane->shown = TRUE;
|
$pane->shown = TRUE;
|
||||||
|
@ -126,11 +131,11 @@ function groups_homepage_default_page_manager_pages() {
|
||||||
);
|
);
|
||||||
$pane->css = array();
|
$pane->css = array();
|
||||||
$pane->extras = array();
|
$pane->extras = array();
|
||||||
$pane->position = 1;
|
$pane->position = 0;
|
||||||
$pane->locks = array();
|
$pane->locks = array();
|
||||||
$pane->uuid = '4f60b089-fac8-aa14-d1f8-d5674b0d51bc';
|
$pane->uuid = '4f60b089-fac8-aa14-d1f8-d5674b0d51bc';
|
||||||
$display->content['new-4f60b089-fac8-aa14-d1f8-d5674b0d51bc'] = $pane;
|
$display->content['new-4f60b089-fac8-aa14-d1f8-d5674b0d51bc'] = $pane;
|
||||||
$display->panels['two_brick_right_above'][1] = 'new-4f60b089-fac8-aa14-d1f8-d5674b0d51bc';
|
$display->panels['three_50_25_25_third'][0] = 'new-4f60b089-fac8-aa14-d1f8-d5674b0d51bc';
|
||||||
$display->hide_title = PANELS_TITLE_NONE;
|
$display->hide_title = PANELS_TITLE_NONE;
|
||||||
$display->title_pane = '0';
|
$display->title_pane = '0';
|
||||||
$handler->conf['display'] = $display;
|
$handler->conf['display'] = $display;
|
||||||
|
|
Loading…
Reference in New Issue