Ver código fonte

add calendar content module

tags/v1.1
Dominik Schmidt-Philipp 4 anos atrás
pai
commit
830eee59d3
2 arquivos alterados com 67 adições e 0 exclusões
  1. +52
    -0
      app/modules/ccalendar.php
  2. +15
    -0
      app/modules/filesinfolders.php

+ 52
- 0
app/modules/ccalendar.php Ver arquivo

@@ -0,0 +1,52 @@
<?php

namespace Modules;

class CCalendar extends ContentType {

public $keys = array(
'VON' => 'from',
'BIS' => 'to'
);
public $values;
protected $layout;
protected $layouts = array(
'default' => 'weeks_compact'
);
function __construct($keys,$config) {
parent::__construct($keys,$config);
}


function weeks_compact() {
$v = (object) $this->values;
//$TS = strtotime($v->date);
//$href = $this->href;
$TS = time();
$start = $TS;
$end = $TS + 50 * 86400;
$days = "";
for ($day = $start; $day<=$end; $day=$day+(86400)) {
$days .= sprintf("<div class='calendar-day weekday-%s'>%s</div>",
date("w",$day),
date("D, d. ",$day)
);
}
return sprintf("<div class=\"calendar calendar-week\">"
."%s"
."</div>",
$days
);
}

}


+ 15
- 0
app/modules/filesinfolders.php Ver arquivo

@@ -356,6 +356,21 @@ class FilesInFolders {
array_shift($request),
$toc);
break;
case 'calendar':
array_shift($request);
$conf = array('path', $this->folder);
$v = $this->read_config();
$cal = new \Modules\CCalendar($v,$conf);
//$cal->dispatch();
//$conf = array('path', $this->folder);
//$v = $this->read_config();
$new=sprintf("<div class=\"calendar\">%s</div>",
$cal);
break;

case 'header':
array_shift($request);

Carregando…
Cancelar
Salvar