function views_gantt_plugin_style_gantt::views_gantt_before_render in Views Gantt 7
Same name and namespace in other branches
- 7.2 views_gantt_plugin_style_gantt.inc \views_gantt_plugin_style_gantt::views_gantt_before_render()
1 call to views_gantt_plugin_style_gantt::views_gantt_before_render()
- views_gantt_plugin_style_gantt::render in ./
views_gantt_plugin_style_gantt.inc - Render the given style.
File
- ./
views_gantt_plugin_style_gantt.inc, line 657 - Contains the list style plugin.
Class
- views_gantt_plugin_style_gantt
- Style plugin to render Gantt charts.
Code
function views_gantt_before_render() {
// Save view name to variable.
variable_set('views_gantt_view_name', $this->view->name);
// Save data in session to use it when we will build XML file for chart.
$_SESSION['views_gantt']['project'] = $this->project;
$_SESSION['views_gantt']['tasks'] = $this->tasks;
// Add dhtmlxgantt library.
$library = libraries_load('dhtmlxgantt');
// Add css to fix chart style.
drupal_add_css(drupal_get_path('module', 'views_gantt') . "/css/reset.css");
// Add js.
drupal_add_js(drupal_get_path('module', 'views_gantt') . "/js/views_gantt.js");
//add the imagepath of gantt path respecting the libraries position
$img_path = base_path() . $library['library path'] . '/' . $library['path'] . '/codebase/imgs/';
drupal_add_js(array(
'views_gantt' => array(
'img_path' => $img_path,
),
), 'setting');
// Add jquery ui Dialog library.
drupal_add_library('system', 'ui.dialog');
// Add globals variables to use it in js.
$settings = array(
'views_gantt' => array(
'view_name' => $this->view->name,
'display_id' => $this->view->current_display,
'project_id' => $this->project['id'],
'exposed_input' => isset($this->view->exposed_input) ? $this->view->exposed_input : NULL,
'fullscreen_button' => '<a class="gantt-fullscreen">Fullscreen</a>',
),
);
drupal_add_js($settings, 'setting');
}