当前位置: 首页>>代码示例>>PHP>>正文


PHP Horde_Themes::sound方法代码示例

本文整理汇总了PHP中Horde_Themes::sound方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Themes::sound方法的具体用法?PHP Horde_Themes::sound怎么用?PHP Horde_Themes::sound使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Horde_Themes的用法示例。


在下文中一共展示了Horde_Themes::sound方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: toAlarm

 /**
  * Returns an alarm hash of this event suitable for Horde_Alarm.
  *
  * @param Horde_Date $time  Time of alarm.
  * @param string $user      The user to return alarms for.
  * @param Prefs $prefs      A Prefs instance.
  *
  * @return array  Alarm hash or null.
  */
 public function toAlarm($time, $user = null, $prefs = null)
 {
     if (!$this->alarm || $this->status == Kronolith::STATUS_CANCELLED) {
         return;
     }
     if ($this->recurs()) {
         $eventDate = $this->recurrence->nextRecurrence($time);
         if (!$eventDate || $eventDate && $this->recurrence->hasException($eventDate->year, $eventDate->month, $eventDate->mday)) {
             return;
         }
         $start = clone $eventDate;
         $diff = Date_Calc::dateDiff($this->start->mday, $this->start->month, $this->start->year, $this->end->mday, $this->end->month, $this->end->year);
         if ($diff == -1) {
             $diff = 0;
         }
         $end = new Horde_Date(array('year' => $start->year, 'month' => $start->month, 'mday' => $start->mday + $diff, 'hour' => $this->end->hour, 'min' => $this->end->min, 'sec' => $this->end->sec));
     } else {
         $start = clone $this->start;
         $end = clone $this->end;
     }
     $serverName = $_SERVER['SERVER_NAME'];
     $serverConf = $GLOBALS['conf']['server']['name'];
     if (!empty($GLOBALS['conf']['reminder']['server_name'])) {
         $_SERVER['SERVER_NAME'] = $GLOBALS['conf']['server']['name'] = $GLOBALS['conf']['reminder']['server_name'];
     }
     if (empty($user)) {
         $user = $GLOBALS['registry']->getAuth();
     }
     if (empty($prefs)) {
         $prefs = $GLOBALS['prefs'];
     }
     $methods = !empty($this->methods) ? $this->methods : @unserialize($prefs->getValue('event_alarms'));
     if (isset($methods['notify'])) {
         $methods['notify']['show'] = array('__app' => $GLOBALS['registry']->getApp(), 'event' => $this->id, 'calendar' => $this->calendar);
         $methods['notify']['ajax'] = 'event:' . $this->calendarType . '|' . $this->calendar . ':' . $this->id . ':' . $start->dateString();
         if (!empty($methods['notify']['sound'])) {
             if ($methods['notify']['sound'] == 'on') {
                 // Handle boolean sound preferences.
                 $methods['notify']['sound'] = (string) Horde_Themes::sound('theetone.wav');
             } else {
                 // Else we know we have a sound name that can be
                 // served from Horde.
                 $methods['notify']['sound'] = (string) Horde_Themes::sound($methods['notify']['sound']);
             }
         }
         if ($this->isAllDay()) {
             if ($start->compareDate($end) == 0) {
                 $methods['notify']['subtitle'] = sprintf(_("On %s"), '<strong>' . $start->strftime($prefs->getValue('date_format')) . '</strong>');
             } else {
                 $methods['notify']['subtitle'] = sprintf(_("From %s to %s"), '<strong>' . $start->strftime($prefs->getValue('date_format')) . '</strong>', '<strong>' . $end->strftime($prefs->getValue('date_format')) . '</strong>');
             }
         } else {
             $methods['notify']['subtitle'] = sprintf(_("From %s at %s to %s at %s"), '<strong>' . $start->strftime($prefs->getValue('date_format')), $start->format($prefs->getValue('twentyFour') ? 'H:i' : 'h:ia') . '</strong>', '<strong>' . $end->strftime($prefs->getValue('date_format')), $this->end->format($prefs->getValue('twentyFour') ? 'H:i' : 'h:ia') . '</strong>');
         }
     }
     if (isset($methods['mail'])) {
         $image = Kronolith::getImagePart('big_alarm.png');
         $view = new Horde_View(array('templatePath' => KRONOLITH_TEMPLATES . '/alarm', 'encoding' => 'UTF-8'));
         new Horde_View_Helper_Text($view);
         $view->event = $this;
         $view->imageId = $image->getContentId();
         $view->user = $user;
         $view->dateFormat = $prefs->getValue('date_format');
         $view->timeFormat = $prefs->getValue('twentyFour') ? 'H:i' : 'h:ia';
         $view->start = $start;
         if (!$prefs->isLocked('event_reminder')) {
             $view->prefsUrl = Horde::url($GLOBALS['registry']->getServiceLink('prefs', 'kronolith'), true)->remove(session_name());
         }
         if ($this->attendees) {
             $view->attendees = Kronolith::getAttendeeEmailList($this->attendees)->addresses;
         }
         $methods['mail']['mimepart'] = Kronolith::buildMimeMessage($view, 'mail', $image);
     }
     if (isset($methods['desktop'])) {
         if ($this->isAllDay()) {
             if ($this->start->compareDate($this->end) == 0) {
                 $methods['desktop']['subtitle'] = sprintf(_("On %s"), $start->strftime($prefs->getValue('date_format')));
             } else {
                 $methods['desktop']['subtitle'] = sprintf(_("From %s to %s"), $start->strftime($prefs->getValue('date_format')), $end->strftime($prefs->getValue('date_format')));
             }
         } else {
             $methods['desktop']['subtitle'] = sprintf(_("From %s at %s to %s at %s"), $start->strftime($prefs->getValue('date_format')), $start->format($prefs->getValue('twentyFour') ? 'H:i' : 'h:ia'), $end->strftime($prefs->getValue('date_format')), $this->end->format($prefs->getValue('twentyFour') ? 'H:i' : 'h:ia'));
         }
         $methods['desktop']['url'] = strval($this->getViewUrl(array(), true, false));
     }
     $alarmStart = clone $start;
     $alarmStart->min -= $this->alarm;
     $alarm = array('id' => $this->uid, 'user' => $user, 'start' => $alarmStart, 'end' => $end, 'methods' => array_keys($methods), 'params' => $methods, 'title' => $this->getTitle($user), 'text' => $this->description, 'instanceid' => $this->recurs() ? $eventDate->dateString() : null);
     $_SERVER['SERVER_NAME'] = $serverName;
     $GLOBALS['conf']['server']['name'] = $serverConf;
     return $alarm;
//.........这里部分代码省略.........
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:101,代码来源:Event.php

示例2: toAlarm

 /**
  * Returns an alarm hash of this task suitable for Horde_Alarm.
  *
  * @param string $user  The user to return alarms for.
  * @param Prefs $prefs  A Prefs instance.
  *
  * @return array  Alarm hash or null.
  */
 public function toAlarm($user = null, $prefs = null)
 {
     if (empty($this->alarm) || $this->completed) {
         return;
     }
     if (empty($user)) {
         $user = $GLOBALS['registry']->getAuth();
     }
     if (empty($prefs)) {
         $prefs = $GLOBALS['prefs'];
     }
     $methods = !empty($this->methods) ? $this->methods : @unserialize($prefs->getValue('task_alarms'));
     if (!$methods) {
         $methods = array();
     }
     if (isset($methods['notify'])) {
         $methods['notify']['show'] = array('__app' => $GLOBALS['registry']->getApp(), 'task' => $this->id, 'tasklist' => $this->tasklist);
         $methods['notify']['ajax'] = 'task:' . $this->tasklist . ':' . $this->id;
         if (!empty($methods['notify']['sound'])) {
             if ($methods['notify']['sound'] == 'on') {
                 // Handle boolean sound preferences;
                 $methods['notify']['sound'] = (string) Horde_Themes::sound('theetone.wav');
             } else {
                 // Else we know we have a sound name that can be
                 // served from Horde.
                 $methods['notify']['sound'] = (string) Horde_Themes::sound($methods['notify']['sound']);
             }
         }
     }
     if (isset($methods['mail'])) {
         $image = Nag::getImagePart('big_alarm.png');
         $view = new Horde_View(array('templatePath' => NAG_TEMPLATES . '/alarm', 'encoding' => 'UTF-8'));
         new Horde_View_Helper_Text($view);
         $view->task = $this;
         $view->imageId = $image->getContentId();
         $view->due = new Horde_Date($this->due);
         $view->dateFormat = $prefs->getValue('date_format');
         $view->timeFormat = $prefs->getValue('twentyFour') ? 'H:i' : 'h:ia';
         if (!$prefs->isLocked('task_alarms')) {
             $view->prefsUrl = Horde::url($GLOBALS['registry']->getServiceLink('prefs', 'nag'), true)->remove(session_name());
         }
         $methods['mail']['mimepart'] = Nag::buildMimeMessage($view, 'mail', $image);
     }
     if (isset($methods['desktop'])) {
         $methods['desktop']['url'] = Horde::url('view.php', true)->add('tasklist', $this->tasklist)->add('task', $this->id)->toString(true, true);
     }
     return array('id' => $this->uid, 'user' => $user, 'start' => new Horde_Date($this->due - $this->alarm * 60), 'methods' => array_keys($methods), 'params' => $methods, 'title' => $this->name, 'text' => $this->desc);
 }
开发者ID:GenerationLabs,项目名称:horde,代码行数:56,代码来源:Task.php

示例3: _notify

 /**
  */
 protected function _notify(Horde_Notification_Handler $handler, Horde_Notification_Listener $listener)
 {
     global $injector, $prefs, $session;
     if (!$prefs->getValue('newmail_notify') || !$listener instanceof Horde_Notification_Listener_Status) {
         return;
     }
     /* Rate limit. If rate limit is not yet set, this is the initial
      * login so skip. */
     $curr = time();
     $ratelimit = $session->get('imp', self::SESS_RATELIMIT);
     if ($ratelimit && $ratelimit + self::RATELIMIT > $curr) {
         return;
     }
     $session->set('imp', self::SESS_RATELIMIT, $curr);
     if (!$ratelimit) {
         return;
     }
     $ajax_queue = $injector->getInstance('IMP_Ajax_Queue');
     $imp_imap = $injector->getInstance('IMP_Factory_Imap')->create();
     $recent = array();
     try {
         foreach ($imp_imap->status($injector->getInstance('IMP_Ftree')->poll->getPollList(), Horde_Imap_Client::STATUS_RECENT_TOTAL, array('sort' => true)) as $key => $val) {
             if (!empty($val['recent_total'])) {
                 /* Open the mailbox R/W so we ensure the 'recent' flag is
                  * cleared. */
                 $imp_imap->openMailbox($key, Horde_Imap_Client::OPEN_READWRITE);
                 $mbox = IMP_Mailbox::get($key);
                 $recent[$mbox->display] = $val['recent_total'];
                 $ajax_queue->poll($mbox);
             }
         }
     } catch (Exception $e) {
     }
     if (empty($recent)) {
         return;
     }
     $recent_sum = array_sum($recent);
     reset($recent);
     switch (count($recent)) {
         case 1:
             $mbox_list = key($recent);
             break;
         case 2:
             $mbox_list = implode(_(" and "), array_keys($recent));
             break;
         default:
             $akeys = array_keys($recent);
             $mbox_list = $akeys[0] . ', ' . $akeys[1] . ', ' . _("and") . ' ' . $akeys[2];
             if ($addl_mbox = count($recent) - 3) {
                 $mbox_list .= ' (' . sprintf(ngettext("and %d more mailbox", "and %d more mailboxes", $addl_mbox), $addl_mbox) . ')';
             }
             break;
     }
     $text = sprintf(ngettext("You have %d new mail message in %s.", "You have %d new mail messages in %s.", $recent_sum), $recent_sum, $mbox_list);
     /* Status notification. */
     $handler->push($text, 'horde.message');
     /* Web notifications. */
     $handler->attach('webnotification', null, 'Horde_Core_Notification_Listener_Webnotification');
     $handler->push(Horde_Core_Notification_Event_Webnotification::createEvent($text, array('icon' => strval(Horde_Themes::img('unseen.png')))), 'webnotification');
     if ($audio = $prefs->getValue('newmail_audio')) {
         $handler->attach('audio');
         $handler->push(Horde_Themes::sound($audio), 'audio');
     }
 }
开发者ID:horde,项目名称:horde,代码行数:66,代码来源:NewmailNotify.php

示例4: strval

if ($form->validate()) {
    $form->getInfo($vars, $info);
    if (empty($info['alarm'])) {
        $info['alarm'] = strval(new Horde_Support_Uuid());
    }
    $params = array();
    foreach ($info['methods'] as $method) {
        foreach ($info as $name => $value) {
            if (strpos($name, $method . '_') === 0) {
                $params[$method][substr($name, strlen($method) + 1)] = $value;
            }
        }
    }
    // Full path to any sound files.
    if (!empty($params['notify']['sound'])) {
        $params['notify']['sound'] = (string) Horde_Themes::sound($params['notify']['sound']);
    }
    try {
        $horde_alarm->set(array('id' => $info['alarm'], 'title' => $info['title'], 'text' => $info['text'], 'start' => new Horde_Date($info['start']), 'end' => empty($info['end']) ? null : new Horde_Date($info['end']), 'methods' => $info['methods'], 'params' => $params));
        $notification->push(_("The alarm has been saved."), 'horde.success');
    } catch (Horde_Alarm_Exception $e) {
        $notification->push($e);
    }
}
$id = $vars->get('alarm');
if ($id) {
    if ($vars->get('delete')) {
        try {
            $horde_alarm->delete($id, '');
            $notification->push(_("The alarm has been deleted."), 'horde.success');
        } catch (Horde_Alarm_Exception $e) {
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:31,代码来源:alarms.php

示例5: _renderVarInput_sound

 protected function _renderVarInput_sound(&$form, &$var, &$vars)
 {
     $value = htmlspecialchars($var->getValue($vars));
     $html = '<ul class="sound-list">';
     if (!$var->isRequired()) {
         $html .= '<li><label><input type="radio" id="' . $this->_genID($var->getVarName(), false) . '" name="' . htmlspecialchars($var->getVarName()) . '" value=""' . (!$value ? ' checked="checked"' : '') . ' /> ' . Horde_Core_Translation::t("No Sound") . '</label></li>';
     }
     foreach ($var->type->getSounds() as $sound) {
         $sound = htmlspecialchars($sound);
         $html .= '<li><label><input type="radio" id="' . $this->_genID($var->getVarName(), false) . '" name="' . htmlspecialchars($var->getVarName()) . '" value="' . $sound . '"' . ($value == $sound ? ' checked="checked"' : '') . ' />' . $sound . '</label>' . ' <embed autostart="false" src="' . Horde_Themes::sound($sound) . '" /></li>';
     }
     return $html . '</ul>';
 }
开发者ID:horde,项目名称:horde,代码行数:13,代码来源:Html.php


注:本文中的Horde_Themes::sound方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。