1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13: class Kronolith_Calendar_External_Tasks extends Kronolith_Calendar_External
14: {
15: 16: 17: 18: 19:
20: protected $_share;
21:
22: 23: 24: 25: 26: 27: 28: 29:
30: public function __construct($params = array())
31: {
32: if (!isset($params['share'])) {
33: throw new BadMethodCallException('share parameter is missing');
34: }
35: Kronolith_Calendar::__construct($params);
36: }
37:
38: 39: 40: 41: 42:
43: public function toHash()
44: {
45: $owner = $GLOBALS['registry']->getAuth() &&
46: $this->_share->get('owner') == $GLOBALS['registry']->getAuth();
47:
48: $hash = parent::toHash();
49: $hash['name'] = $this->_share->get('name')
50: . ($owner || !$this->_share->get('owner') ? '' : ' [' . $GLOBALS['registry']->convertUsername($this->_share->get('owner'), false) . ']');
51: $hash['desc'] = (string)$this->_share->get('desc');
52: $hash['owner'] = $owner;
53: $hash['fg'] = Kronolith::foregroundColor($this->_share);
54: $hash['bg'] = Kronolith::backgroundColor($this->_share);
55: $hash['show'] = in_array('tasks/' . $this->_share->getName(), $GLOBALS['display_external_calendars']);
56: $hash['edit'] = $this->_share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT);
57: $hash['sub'] = Horde::url($GLOBALS['registry']->get('webroot', 'horde') . ($GLOBALS['conf']['urls']['pretty'] == 'rewrite' ? '/rpc/nag/' : '/rpc.php/nag/'), true, -1)
58: . ($this->_share->get('owner') ? $this->_share->get('owner') : '-system-') . '/'
59: . $this->_share->getName() . '.ics';
60: if ($owner) {
61: $hash['perms'] = Kronolith::permissionToJson($this->_share->getPermission());
62: }
63:
64: return $hash;
65: }
66: }
67: