Horde_Themes::soundList PHP Method

soundList() public static method

Returns a list of available sounds.
public static soundList ( string $app = null, string $theme = null ) : array
$app string The app to search in.
$theme string The theme to search in.
return array An array of Horde_Themes_Sound objects. Keys are the base filenames.
    public static function soundList($app = null, $theme = null)
    {
        if (is_null($app)) {
            $app = $GLOBALS['registry']->getApp();
        }
        if (is_null($theme)) {
            $theme = $GLOBALS['prefs']->getValue('theme');
        }
        $cache = $GLOBALS['injector']->getInstance('Horde_Core_Factory_ThemesCache')->create($app, $theme);
        $sounds = array();
        foreach ($cache->build() as $val) {
            if (strpos($val, 'sounds/') === 0 && substr(strrchr($val, '.'), 1) == 'wav') {
                $sounds[basename($val)] = self::sound(substr($val, 7));
            }
        }
        ksort($sounds);
        return $sounds;
    }

Usage Example

Ejemplo n.º 1
0
 /**
  */
 public function display(Horde_Core_Prefs_Ui $ui)
 {
     global $prefs;
     $view = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/prefs'));
     $view->addHelper('FormTag');
     $view->addHelper('Tag');
     $view->addHelper('Text');
     $newmail_audio = $view->newmail_audio = $prefs->getValue('newmail_audio');
     $sounds = array();
     foreach (Horde_Themes::soundList() as $key => $val) {
         $sounds[] = array('c' => $newmail_audio == $key, 'l' => $key, 's' => $val->uri, 'v' => $key);
     }
     $view->sounds = $sounds;
     return $view->render('newmailaudio');
 }
All Usage Examples Of Horde_Themes::soundList