示例#1
0
 public function initialize()
 {
     $this->emailClient->setTransport('mailgun', '\\Kanboard\\Plugin\\Mailgun\\EmailHandler');
     $this->template->hook->attach('template:config:integrations', 'mailgun:integration');
     $this->on('app.bootstrap', function ($container) {
         Translator::load($container['config']->getCurrentLanguage(), __DIR__ . '/Locale');
     });
 }
示例#2
0
 public function onStartup()
 {
     Translator::load($this->languageModel->getCurrentLanguage(), __DIR__ . '/Locale');
     $this->eventManager->register(WebhookHandler::EVENT_COMMIT, t('Gitlab commit received'));
     $this->eventManager->register(WebhookHandler::EVENT_ISSUE_OPENED, t('Gitlab issue opened'));
     $this->eventManager->register(WebhookHandler::EVENT_ISSUE_CLOSED, t('Gitlab issue closed'));
     $this->eventManager->register(WebhookHandler::EVENT_ISSUE_REOPENED, t('Gitlab issue reopened'));
     $this->eventManager->register(WebhookHandler::EVENT_ISSUE_COMMENT, t('Gitlab issue comment created'));
 }
示例#3
0
 public function testCreationForAllLanguages()
 {
     $c = new Config($this->container);
     $p = new Project($this->container);
     foreach ($c->getLanguages() as $locale => $language) {
         Translator::load($locale);
         $this->assertNotFalse($p->create(array('name' => 'UnitTest ' . $locale)), 'Unable to create project with ' . $locale . ':' . $language);
     }
     Translator::unload();
 }
示例#4
0
 public function initialize()
 {
     $this->applicationAccessMap->add('hourlyrate', '*', Role::APP_ADMIN);
     $this->projectAccessMap->add('budget', '*', Role::PROJECT_MANAGER);
     $this->template->hook->attach('template:project:dropdown', 'budget:project/dropdown');
     $this->template->hook->attach('template:user:sidebar:actions', 'budget:user/sidebar');
     $this->on('app.bootstrap', function ($container) {
         Translator::load($container['config']->getCurrentLanguage(), __DIR__ . '/Locale');
     });
 }
示例#5
0
 public function initialize()
 {
     $this->template->hook->attach('template:config:integrations', 'hipchat:config/integration');
     $this->template->hook->attach('template:project:integrations', 'hipchat:project/integration');
     $this->userNotificationType->setType('hipchat', t('Hipchat'), '\\Kanboard\\Plugin\\Hipchat\\Notification\\Hipchat');
     $this->projectNotificationType->setType('hipchat', t('Hipchat'), '\\Kanboard\\Plugin\\Hipchat\\Notification\\Hipchat');
     $this->on('app.bootstrap', function ($container) {
         Translator::load($container['config']->getCurrentLanguage(), __DIR__ . '/Locale');
     });
 }
示例#6
0
 /**
  * Send notification to someone
  *
  * @access public
  * @param  array     $user        User
  * @param  string    $event_name
  * @param  array     $event_data
  */
 public function sendUserNotification(array $user, $event_name, array $event_data)
 {
     Translator::unload();
     // Use the user language otherwise use the application language (do not use the session language)
     if (!empty($user['language'])) {
         Translator::load($user['language']);
     } else {
         Translator::load($this->config->get('application_language', 'en_US'));
     }
     foreach ($this->userNotificationType->getSelectedTypes($user['id']) as $type) {
         $this->userNotificationType->getType($type)->notifyUser($user, $event_name, $event_data);
     }
 }
示例#7
0
 public function initialize()
 {
     $container = $this->container;
     $this->applicationAccessMap->add('timetable', '*', Role::APP_ADMIN);
     $this->applicationAccessMap->add('timetableday', '*', Role::APP_ADMIN);
     $this->applicationAccessMap->add('timetableextra', '*', Role::APP_ADMIN);
     $this->applicationAccessMap->add('timetableoff', '*', Role::APP_ADMIN);
     $this->applicationAccessMap->add('timetableweek', '*', Role::APP_ADMIN);
     $this->template->hook->attach('template:user:sidebar:actions', 'timetable:user/sidebar');
     $this->on('app.bootstrap', function ($container) {
         Translator::load($container['config']->getCurrentLanguage(), __DIR__ . '/Locale');
     });
     // Calculate time spent according to the timetable
     $this->hook->on('model:subtask-time-tracking:calculate:time-spent', function ($user_id, DateTime $start, DateTime $end) use($container) {
         return $container['timetable']->calculateEffectiveDuration($user_id, $start, $end);
     });
     // Split calendar events according to the timetable
     $this->hook->on('model:subtask-time-tracking:calendar:events', function ($user_id, array $events, $start, $end) use($container) {
         return $container['timetable']->calculateEventsIntersect($user_id, $events, $start, $end);
     });
 }
示例#8
0
 public function onStartup()
 {
     Translator::load($this->languageModel->getCurrentLanguage(), __DIR__ . '/Locale');
 }
示例#9
0
 /**
  * Load translations
  *
  * @access public
  */
 public function setupTranslations()
 {
     Translator::load($this->getCurrentLanguage());
 }
示例#10
0
/**
 * Translate a number
 *
 * @param  mixed $value
 * @return string
 */
function n($value)
{
    return Translator::getInstance()->number($value);
}
示例#11
0
 public function onStartup()
 {
     Translator::load($this->languageModel->getCurrentLanguage(), __DIR__ . '/Locale');
     $this->eventManager->register(WebhookHandler::EVENT_COMMIT, t('Gogs commit received'));
 }
示例#12
0
/**
 * Translate a date
 *
 * @return string
 */
function dt($format, $timestamp)
{
    return Translator::getInstance()->datetime($format, $timestamp);
}