summaryrefslogtreecommitdiff
path: root/calendario.module
diff options
context:
space:
mode:
Diffstat (limited to 'calendario.module')
-rw-r--r--calendario.module34
1 files changed, 29 insertions, 5 deletions
diff --git a/calendario.module b/calendario.module
index 18939b2..6967746 100644
--- a/calendario.module
+++ b/calendario.module
@@ -12,7 +12,7 @@ function calendario_theme($existing, $type, $theme, $path) {
return array(
'embed-widget' => array(
'template' => 'calendario-embed-widget',
- 'variables' => array('period' => NULL, 'type' => NULL),
+ 'variables' => array('link' => NULL),
),
);
}
@@ -34,12 +34,36 @@ function calendario_entity_info_alter(&$entity_info) {
/**
* Include a calendar widget.
- *
- * @todo
- * Set $period and $type.
*/
function calendario_widget($view = NULL) {
- return theme('embed-widget');
+ $display = $view->current_display;
+ $path = explode('/', $view->display[$display]->handler->options['path']);
+
+ switch ($path[1]) {
+ case 'dia':
+ case 'semana':
+ case 'mes':
+ case 'ano':
+ $type = NULL;
+ $period = $path[1];
+ //$date = isset($path[2]) ? .'/'. $path[2] : '';
+ $date = isset($view->args[0]) ? .'/'. $view->args[0] : '';
+ $argument = NULL;
+ $link = $period . $date;
+ break;
+
+ default:
+ $type = $path[1];
+ $period = $path[3];
+ //$date = isset($path[4]) ? .'/'. $path[4] : '';
+ $date = isset($view->args[1]) ? .'/'. $view->args[1] : '';
+ //$argument = $path[2];
+ $argument = isset($view->args[0]) ? .'/'. $view->args[0] : '';
+ $link = $type . $argument .'/'. $period . $date
+ break;
+ }
+
+ return theme('embed-widget', array('link' => $link));
}
/**