From: Michael J. Rubinsky Date: Wed, 26 Jan 2011 16:22:57 +0000 (-0500) Subject: Horde 4 CS, PHP5 for Kronolith_FreeBusy_* X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=9fd8909d9cdb2361efff43a7ce609a64d4959078;p=horde.git Horde 4 CS, PHP5 for Kronolith_FreeBusy_* --- diff --git a/kronolith/lib/FreeBusy/View.php b/kronolith/lib/FreeBusy/View.php index fc5f0dacc..dea393793 100644 --- a/kronolith/lib/FreeBusy/View.php +++ b/kronolith/lib/FreeBusy/View.php @@ -10,41 +10,69 @@ * @author Jan Schneider * @package Kronolith */ -class Kronolith_FreeBusy_View { +class Kronolith_FreeBusy_View +{ + protected $_requiredMembers = array(); + protected $_optionalMembers = array(); + protected $_requiredResourceMembers = array(); + protected $_optionalResourceMembers = array(); + protected $_timeBlocks = array(); - var $_requiredMembers = array(); - var $_optionalMembers = array(); - var $_requiredResourceMembers = array(); - var $_optionalResourceMembers = array(); - var $_timeBlocks = array(); + protected $_startHour; + protected $_endHour; - var $_startHour; - var $_endHour; + protected $_start; + protected $_end; - var $_start; - var $_end; - - function addRequiredMember($vFreebusy) + /** + * Adds a required attendee + * + * @param Kronolith_Freebusy $vFreebusy + */ + public function addRequiredMember(Kronolith_Freebusy $vFreebusy) { $this->_requiredMembers[] = clone $vFreebusy; } - function addOptionalMember($vFreebusy) + /** + * Adds an optional attendee + * + * @param Kronolith_Freebusy $vFreebusy + */ + public function addOptionalMember(Kronoolith_Freebusy $vFreebusy) { $this->_optionalMembers[] = clone $vFreebusy; } - function addOptionalResourceMember($vFreebusy) + /** + * Adds an optional resource + * + * @param Kronolith_Freebusy $vFreebusy + */ + public function addOptionalResourceMember(Kronolith_Freebusy $vFreebusy) { $this->_optionalResourceMembers[] = clone $vFreebusy; } - function addRequiredResourceMember($vFreebusy) + /** + * Adds a required resource + * + * @param Kronolith_Freebusy $vFreebusy + */ + public function addRequiredResourceMember(Kronolith_Freebusy $vFreebusy) { $this->_requiredResourceMembers[] = clone $vFreebusy; } - function render($day = null) + /** + * Renders the fb view + * + * @global Horde_Prefs $prefs + * @param Horde_Date $day The day to render + * + * @return string The html of the rendered fb view. + */ + public function render($day = null) { global $prefs; @@ -140,8 +168,7 @@ class Kronolith_FreeBusy_View { $html .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/section.html'); } - // Required Resources - //if (count($this->_requiredResourceMembers) > 0) { + // Resources if (count($this->_requiredResourceMembers) > 0 || count($this->_optionalResourceMembers) > 0) { $template = $GLOBALS['injector']->createInstance('Horde_Template'); $rows = ''; @@ -170,28 +197,6 @@ class Kronolith_FreeBusy_View { $html .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/section.html'); } -// // Optional Resources -// if (count($this->_optionalResourceMembers) > 0) { -// $template = $GLOBALS['injector']->createInstance('Horde_Template'); -// $rows = ''; -// foreach ($this->_optionalResourceMembers as $member) { -// $member->simplify(); -// $blocks = $this->_getBlocks($member, $member->getBusyPeriods(), 'busyblock.html', _("Busy")); -// $template = $GLOBALS['injector']->createInstance('Horde_Template'); -// $template->set('blocks', $blocks); -// $template->set('name', $member->getName()); -// $rows .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/row.html'); -// } -// $template = $GLOBALS['injector']->createInstance('Horde_Template'); -// $template->set('title', _("Optional Resources")); -// $template->set('rows', $rows); -// $template->set('span', count($this->_timeBlocks)); -// $template->set('hours', $hours_html); -// $template->set('legend', ''); -// $html .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/section.html'); -// } - - // Possible meeting times. $optimal->setAttribute('ORGANIZER', _("All Attendees")); $blocks = $this->_getBlocks($optimal, @@ -253,7 +258,7 @@ class Kronolith_FreeBusy_View { * @return mixed The newly created concrete Kronolith_FreeBusy_View * instance, or false on an error. */ - function factory($view) + static public function factory($view) { $driver = basename($view); $class = 'Kronolith_FreeBusy_View_' . $driver; @@ -279,7 +284,7 @@ class Kronolith_FreeBusy_View { * @return mixed The created concrete Kronolith_FreeBusy_View instance, or * false on an error. */ - function &singleton($view) + static public function &singleton($view) { static $instances = array(); @@ -290,7 +295,17 @@ class Kronolith_FreeBusy_View { return $instances[$view]; } - function _getBlocks($member, $periods, $blockfile, $label) + /** + * Render the blocks + * + * @param Horde_Icalendar_Vfreebusy $member Member's freebusy info + * @param array $periods Free periods + * @param string $blockfile Template file to use for blocks + * @param string $label Label to use + * + * @return string The block html + */ + protected function _getBlocks($member, $periods, $blockfile, $label) { $template = $GLOBALS['injector']->createInstance('Horde_Template'); $template->set('label', $label); diff --git a/kronolith/lib/FreeBusy/View/Day.php b/kronolith/lib/FreeBusy/View/Day.php index db63728ad..bbd2a9418 100644 --- a/kronolith/lib/FreeBusy/View/Day.php +++ b/kronolith/lib/FreeBusy/View/Day.php @@ -10,11 +10,11 @@ * @author Jan Schneider * @package Kronolith */ -class Kronolith_FreeBusy_View_Day extends Kronolith_FreeBusy_View { +class Kronolith_FreeBusy_View_Day extends Kronolith_FreeBusy_View +{ + public $view = 'day'; - var $view = 'day'; - - function _title() + protected function _title() { global $registry, $prefs; @@ -31,7 +31,7 @@ class Kronolith_FreeBusy_View_Day extends Kronolith_FreeBusy_View { . ''; } - function _hours() + protected function _hours() { global $prefs; @@ -49,7 +49,7 @@ class Kronolith_FreeBusy_View_Day extends Kronolith_FreeBusy_View { return $hours_html; } - function _render($day = null) + protected function _render($day = null) { $this->_start = new Horde_Date($day); $this->_start->hour = $this->_startHour; diff --git a/kronolith/lib/FreeBusy/View/Month.php b/kronolith/lib/FreeBusy/View/Month.php index 703889135..4759a7552 100644 --- a/kronolith/lib/FreeBusy/View/Month.php +++ b/kronolith/lib/FreeBusy/View/Month.php @@ -10,12 +10,24 @@ * @author Jan Schneider * @package Kronolith */ -class Kronolith_FreeBusy_View_Month extends Kronolith_FreeBusy_View { +class Kronolith_FreeBusy_View_Month extends Kronolith_FreeBusy_View +{ + /** + * This view type + * + * @var string + */ + public $view = 'month'; - var $view = 'month'; - var $_days = 30; + /** + * Number of days + * + * @var integer + */ + protected $_days = 30; - function _title() + + protected function _title() { $end = new Horde_Date($this->_start); $end->mday += $this->_days - 1; @@ -32,7 +44,7 @@ class Kronolith_FreeBusy_View_Month extends Kronolith_FreeBusy_View { . ''; } - function _hours() + protected function _hours() { global $prefs; @@ -81,7 +93,7 @@ class Kronolith_FreeBusy_View_Month extends Kronolith_FreeBusy_View { return $hours_html; } - function _render($day = null) + protected function _render($day = null) { $this->_start = new Horde_Date($day); $this->_start->mday = 1; diff --git a/kronolith/lib/FreeBusy/View/Week.php b/kronolith/lib/FreeBusy/View/Week.php index 1db9f646c..4c7e4294d 100644 --- a/kronolith/lib/FreeBusy/View/Week.php +++ b/kronolith/lib/FreeBusy/View/Week.php @@ -10,12 +10,23 @@ * @author Jan Schneider * @package Kronolith */ -class Kronolith_FreeBusy_View_Week extends Kronolith_FreeBusy_View { +class Kronolith_FreeBusy_View_Week extends Kronolith_FreeBusy_View +{ + /** + * This view type + * + * @var string + */ + public $view = 'week'; - var $view = 'week'; - var $_days = 7; + /** + * Number of days + * + * @var integer + */ + protected $_days = 7; - function _title() + protected function _title() { global $prefs; @@ -35,7 +46,7 @@ class Kronolith_FreeBusy_View_Week extends Kronolith_FreeBusy_View { . ''; } - function _hours() + protected function _hours() { global $prefs; @@ -77,7 +88,7 @@ class Kronolith_FreeBusy_View_Week extends Kronolith_FreeBusy_View { return $hours_html; } - function _render($day = null) + protected function _render($day = null) { $this->_start = new Horde_Date(Date_Calc::beginOfWeek($day->mday, $day->month, $day->year, '%Y%m%d000000')); $this->_end = new Horde_Date($this->_start); diff --git a/kronolith/lib/FreeBusy/View/Workweek.php b/kronolith/lib/FreeBusy/View/Workweek.php index e776a96e3..96256490d 100644 --- a/kronolith/lib/FreeBusy/View/Workweek.php +++ b/kronolith/lib/FreeBusy/View/Workweek.php @@ -10,9 +10,20 @@ * @author Jan Schneider * @package Kronolith */ -class Kronolith_FreeBusy_View_Workweek extends Kronolith_FreeBusy_View_Week { - +class Kronolith_FreeBusy_View_Workweek extends Kronolith_FreeBusy_View_Week +{ + /** + * This view type + * + * @var string + */ var $view = 'workweek'; + + /** + * Number of days + * + * @var integer + */ var $_days = 5; }