Пример #1
0
 /**
  * Plugin initialization.
  */
 function init()
 {
     $this->require_plugin('libcalendaring');
     $this->rc = rcube::get_instance();
     $this->lib = libcalendaring::get_instance();
     $this->register_task('calendar', 'calendar');
     // load calendar configuration
     $this->load_config();
     // load localizations
     $this->add_texts('localization/', $this->rc->task == 'calendar' && (!$this->rc->action || $this->rc->action == 'print'));
     $this->timezone = $this->lib->timezone;
     $this->gmt_offset = $this->lib->gmt_offset;
     $this->dst_active = $this->lib->dst_active;
     $this->timezone_offset = $this->gmt_offset / 3600 - $this->dst_active;
     require $this->home . '/lib/calendar_ui.php';
     $this->ui = new calendar_ui($this);
     // catch iTIP confirmation requests that don're require a valid session
     if ($this->rc->action == 'attend' && !empty($_REQUEST['_t'])) {
         $this->add_hook('startup', array($this, 'itip_attend_response'));
     } else {
         if ($this->rc->action == 'feed' && !empty($_REQUEST['_cal'])) {
             $this->add_hook('startup', array($this, 'ical_feed_export'));
         } else {
             // default startup routine
             $this->add_hook('startup', array($this, 'startup'));
         }
     }
     $this->add_hook('user_delete', array($this, 'user_delete'));
 }
 function __construct($plugin, $domain = 'libcalendaring')
 {
     $this->plugin = $plugin;
     $this->rc = rcube::get_instance();
     $this->lib = libcalendaring::get_instance();
     $this->domain = $domain;
     $hook = $this->rc->plugins->exec_hook('calendar_load_itip', array('identity' => $this->rc->user->list_emails(true)));
     $this->sender = $hook['identity'];
     $this->plugin->add_hook('message_before_send', array($this, 'before_send_hook'));
     $this->plugin->add_hook('smtp_connect', array($this, 'smtp_connect_hook'));
 }
Пример #3
0
 /**
  * Plugin initialization.
  */
 function init()
 {
     $this->require_plugin('libcalendaring');
     $this->rc = rcube::get_instance();
     $this->lib = libcalendaring::get_instance();
     $this->register_task('tasks', 'tasklist');
     // load plugin configuration
     $this->load_config();
     $this->timezone = $this->lib->timezone;
     // proceed initialization in startup hook
     $this->add_hook('startup', array($this, 'startup'));
 }
Пример #4
0
 /**
  * Plugin initialization.
  */
 function init()
 {
     $this->require_plugin('libcalendaring');
     $this->rc = rcube::get_instance();
     $this->lib = libcalendaring::get_instance();
     $this->register_task('tasks', 'tasklist');
     // load plugin configuration
     $this->load_config();
     // load localizations
     $this->add_texts('localization/', $this->rc->task == 'tasks' && (!$this->rc->action || $this->rc->action == 'print'));
     $this->rc->load_language($_SESSION['language'], array('tasks.tasks' => $this->gettext('navtitle')));
     // add label for task title
     $this->timezone = $this->lib->timezone;
     if ($this->rc->task == 'tasks' && $this->rc->action != 'save-pref') {
         $this->load_driver();
         // register calendar actions
         $this->register_action('index', array($this, 'tasklist_view'));
         $this->register_action('task', array($this, 'task_action'));
         $this->register_action('tasklist', array($this, 'tasklist_action'));
         $this->register_action('counts', array($this, 'fetch_counts'));
         $this->register_action('fetch', array($this, 'fetch_tasks'));
         $this->register_action('inlineui', array($this, 'get_inline_ui'));
         $this->register_action('mail2task', array($this, 'mail_message2task'));
         $this->register_action('get-attachment', array($this, 'attachment_get'));
         $this->register_action('upload', array($this, 'attachment_upload'));
         $this->collapsed_tasks = array_filter(explode(',', $this->rc->config->get('tasklist_collapsed_tasks', '')));
     } else {
         if ($this->rc->task == 'mail') {
             // TODO: register hooks to catch ical/vtodo email attachments
             if ($this->rc->action == 'show' || $this->rc->action == 'preview') {
                 // $this->add_hook('message_load', array($this, 'mail_message_load'));
                 // $this->add_hook('template_object_messagebody', array($this, 'mail_messagebody_html'));
             }
             // add 'Create event' item to message menu
             if ($this->api->output->type == 'html') {
                 $this->api->add_content(html::tag('li', null, $this->api->output->button(array('command' => 'tasklist-create-from-mail', 'label' => 'tasklist.createfrommail', 'type' => 'link', 'classact' => 'icon taskaddlink active', 'class' => 'icon taskaddlink', 'innerclass' => 'icon taskadd'))), 'messagemenu');
             }
         }
     }
     if (!$this->rc->output->ajax_call && !$this->rc->output->env['framed']) {
         require_once $this->home . '/tasklist_ui.php';
         $this->ui = new tasklist_ui($this);
         $this->ui->init();
     }
     // add hooks for alarms handling
     $this->add_hook('pending_alarms', array($this, 'pending_alarms'));
     $this->add_hook('dismiss_alarms', array($this, 'dismiss_alarms'));
 }
Пример #5
0
 /**
  * Set CSS class according to the event's attendde partstat
  */
 public static function add_partstat_class($event, $partstats, $user = null)
 {
     // set classes according to PARTSTAT
     if (is_array($event['attendees'])) {
         $user_emails = libcalendaring::get_instance()->get_user_emails($user);
         $partstat = 'UNKNOWN';
         foreach ($event['attendees'] as $attendee) {
             if (in_array($attendee['email'], $user_emails)) {
                 $partstat = $attendee['status'];
                 break;
             }
         }
         if (in_array($partstat, $partstats)) {
             $event['className'] = trim($event['className'] . ' fc-invitation-' . strtolower($partstat));
         }
     }
     return $event;
 }