瀏覽代碼

add calendar content module

tags/v1.1
父節點
當前提交
830eee59d3
共有 2 個文件被更改,包括 67 次插入0 次删除
  1. +52
    -0
      app/modules/ccalendar.php
  2. +15
    -0
      app/modules/filesinfolders.php

+ 52
- 0
app/modules/ccalendar.php 查看文件

@@ -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 查看文件

@@ -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);

Loading…
取消
儲存