themes
[ class tree: themes ] [ index: themes ] [ all elements ]

Source for file icon_browser.php

Documentation is available at icon_browser.php

  1. <?php
  2. /**
  3.  * @version $Header$
  4.  *
  5.  *  Copyright (c) 2008 bitweaver
  6.  *  All Rights Reserved. See below for details and a complete list of authors.
  7.  *  Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
  8.  *
  9.  * @package themes
  10.  * @subpackage functions
  11.  */
  12.  
  13. /**
  14.  * Setup
  15.  */
  16. require_once( "../kernel/setup_inc.php" );
  17.  
  18. if( !$gBitUser->isRegistered() ) {
  19.     $gBitSystem->fatalError( "You need to be registered to view this page." );
  20. }
  21.  
  22. $iconUsage = array(
  23.     "dialog-ok"                => "Success / Accept",
  24.     "document-open"            => "Import",
  25.     "document-properties"      => "Configuration",
  26.     "document-save-as"         => "Export",
  27.     "edit-copy"                => "Copy",
  28.     "edit-delete"              => "Delete",
  29.     "go-down"                  => "Navigate down",
  30.     "go-home"                  => "Home",
  31.     "go-next"                  => "Navigate right / next",
  32.     "go-previous"              => "Navigate left / previous",
  33.     "go-up"                    => "Navigate up",
  34.     "help-contents"            => "Help",
  35.     "insert-object"            => "Insert",
  36.     "mail-forward"             => "Mail send",
  37.     "view-sort-ascending"      => "All things sorting",
  38.     "view-sort-descending"     => "All things sorting",
  39.     "window-close"             => "Close window",
  40.     "accessories-text-editor"  => "Edit",
  41.     "applications-accessories" => "Plugin",
  42.     "preferences-system"       => "bitweaver administration",
  43.     "emblem-default"           => "Current selection",
  44.     "emblem-downloads"         => "Download",
  45.     "emblem-favorite"          => "Favorite",
  46.     "emblem-readonly"          => "Extra permissions set / Previously used as locked",
  47.     "emblem-shared"            => "No permissions set or unlocked",
  48.     "x-office-document"        => "Note",
  49.     "x-office-presentation"    => "Slideshow",
  50.     "folder"                   => "Folder",
  51.     "dialog-error"             => "Error",
  52.     "dialog-information"       => "Information",
  53. );
  54. $gBitSmarty->assign( 'iconUsage', $iconUsage );
  55.  
  56. $iconList = array();
  57. $iconNames = array();
  58. if( !empty( $_REQUEST['icon_style'] ) ) {
  59.     $iconThemes = array( $_REQUEST['icon_style'] );
  60. } else {
  61.     $iconThemes = scandir( CONFIG_PKG_PATH."iconsets/" );
  62. }
  63.  
  64. foreach( $iconThemes as $iconStyle ) {
  65.     if( $icons = icon_fetcher( $iconStyle ) ) {
  66.         $iconList[$iconStyle] = $icons;
  67.         $iconNames = array_merge( $iconNames, $iconList[$iconStyle] );
  68.     }
  69. }
  70.  
  71. asort( $iconNames );
  72. $gBitSmarty->assign( 'iconNames', $iconNames );
  73. $gBitSmarty->assign( 'iconList', $iconList );
  74.  
  75. $gBitSystem->display( 'bitpackage:themes/icon_browser.tpl', tra( 'Icon Listing' ) , array( 'display_mode' => 'display' ));
  76.  
  77. function icon_fetcher( $pStyle = DEFAULT_ICON_STYLE ) {
  78.     $ret = array();
  79.     if( strpos( $pStyle, '.' ) !== 0 && $pStyle != 'CVS' ) {
  80.         $stylePath = CONFIG_PKG_PATH."iconsets/".$pStyle;
  81.         if( is_dir( $stylePath."/large" )) {
  82.             $handle = opendir( $stylePath."/large" );
  83.             while( FALSE !== ( $icon = readdir( $handle ))) {
  84.                 if( preg_match( "#\.png$#", $icon ) && !preg_match( "#^process-working\.#", $icon )) {
  85.                     $ret[str_replace( ".png", "", $icon )] = str_replace( ".png", "", $icon );
  86.                 }
  87.             }
  88.         }
  89.     }
  90.     ksort( $ret );
  91.     return $ret;
  92. }
  93. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:41 +0000 by phpDocumentor 1.5.0-lsces