| 1 |
<?php |
<?php |
| 2 |
// $Id: jcarousellite_views_plugin_style.inc,v 1.1.2.2 2009/09/17 00:15:09 owahab Exp $ |
// $Id: jcarousellite_views_plugin_style.inc,v 1.1.2.3 2009/09/29 16:20:16 owahab Exp $ |
| 3 |
|
|
| 4 |
class jcarousellite_views_plugin_style extends views_plugin_style_list { |
class jcarousellite_views_plugin_style extends views_plugin_style_list { |
| 5 |
function options(&$options) { |
function options(&$options) { |
| 9 |
|
|
| 10 |
function options_form(&$form, &$form_values) { |
function options_form(&$form, &$form_values) { |
| 11 |
parent::options_form($form, $form_values); |
parent::options_form($form, $form_values); |
| 12 |
unset($form['alignment']); |
unset($form['grouping']); |
| 13 |
|
unset($form['type']); |
| 14 |
$form['items_visible'] = array( |
$form['items_visible'] = array( |
| 15 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 16 |
'#title' => t('Visible items'), |
'#title' => t('Visible items'), |
| 17 |
'#description' => t('Specify how many items visible in the Carousel.'), |
'#required' => TRUE, |
| 18 |
|
'#description' => t('Specify number of items visible in the Carousel.'), |
| 19 |
'#default_value' => $this->options['items_visible'], |
'#default_value' => $this->options['items_visible'], |
| 20 |
); |
); |
| 21 |
} |
} |
| 22 |
|
|
| 23 |
function options_validate(&$form, &$form_values) { |
function options_validate($form, &$form_state) { |
| 24 |
|
parent::options_validate($form, $form_state); |
| 25 |
|
$options = &$form_state['values']['style_options']; |
| 26 |
|
if (!is_numeric($options['items_visible'])) { |
| 27 |
|
form_error($form['items_visible'], t('Please specify a numerical value for the number of items visible.')); |
| 28 |
|
} |
| 29 |
} |
} |
| 30 |
|
|
| 31 |
function render() { |
function render() { |
|
; |
|
| 32 |
static $counter; |
static $counter; |
| 33 |
// Keep count of number of rendered views per page |
// @FIXME: Keep count of number of rendered views per page |
| 34 |
$counter[$this->view->vid]++; |
$counter[$this->view->vid]++; |
| 35 |
drupal_add_css(drupal_get_path('module', 'jcarousellite_views') .'/jcarousellite_views.css'); |
drupal_add_css(drupal_get_path('module', 'jcarousellite_views') .'/jcarousellite_views.css'); |
| 36 |
$js_code = jcarousellite_callback('add_view_js', $this->view->vid, $counter[$this->view->vid], $this->options); |
$js_code = jcarousellite_callback('add_view_js', $this->view->vid, $counter[$this->view->vid], $this->options); |
| 53 |
} |
} |
| 54 |
$view_output .= theme($this->theme_functions(), $this->view, $this->options, $rows, $title); |
$view_output .= theme($this->theme_functions(), $this->view, $this->options, $rows, $title); |
| 55 |
} |
} |
| 56 |
$output .= jcarousellite_callback('add_prev', $this->view->vid, $counter[$this->view->vid]); |
if (!is_null($view_output)) { |
| 57 |
$output .= $view_output; |
$output .= jcarousellite_callback('add_prev', $this->view->vid, $counter[$this->view->vid]); |
| 58 |
$output .= jcarousellite_callback('add_next', $this->view->vid, $counter[$this->view->vid]); |
$output .= $view_output; |
| 59 |
|
$output .= jcarousellite_callback('add_next', $this->view->vid, $counter[$this->view->vid]); |
| 60 |
|
} |
| 61 |
|
|
| 62 |
return $output; |
return $output; |
| 63 |
} |
} |