Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cGuiBackendHelpbox
  • cGuiFileOverview
  • cGuiFoldingRow
  • cGuiList
  • cGuiMenu
  • cGuiNavigation
  • cGuiNotification
  • cGuiObjectPager
  • cGuiPage
  • cGuiScrollList
  • cGuiSourceEditor
  • cGuiTableForm
  • cGuiTree
  • cPager
  • cTemplate
  • cTree
  • cTreeItem
  • NoteLink
  • NoteList
  • NoteListItem
  • NoteView
  • TODOLink
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file contains the generic file overviewer class.
  5:  *
  6:  * @package Core
  7:  * @subpackage GUI
  8:  * @version SVN Revision $Rev:$
  9:  *
 10:  * @author Mischa Holz
 11:  * @copyright four for business AG <www.4fb.de>
 12:  * @license http://www.contenido.org/license/LIZENZ.txt
 13:  * @link http://www.4fb.de
 14:  * @link http://www.contenido.org
 15:  */
 16: 
 17: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 18: 
 19: /**
 20:  * Displays files in the left bottom frame
 21:  * @package Core
 22:  * @subpackage GUI
 23:  */
 24: class cGuiFileOverview extends cGuiPage {
 25: 
 26:     /**
 27:      * Path to the directory that is being displayed
 28:      * @var string
 29:      */
 30:     protected $directory;
 31: 
 32:     /**
 33:      * Name of the marked up file
 34:      * @var string
 35:      */
 36:     protected $markedFile;
 37: 
 38:     /**
 39:      * Type of the file information in the database
 40:      * @var string
 41:      */
 42:     protected $fileInfoType;
 43: 
 44:     /**
 45:      * Selected file extension
 46:      * @var string
 47:      */
 48:     protected $fileExtension;
 49: 
 50:     /**
 51:      * Default constructor. Initializes the class for the directory
 52:      * @param string $dir
 53:      * @param string $markedFile [optional]
 54:      * @param string $fileInfoType [optional]
 55:      */
 56:     public function __construct($dir, $markedFile = '', $fileInfoType = '') {
 57:         parent::__construct('generic_file_overview');
 58: 
 59:         // assign properties
 60:         $this->directory = $dir;
 61:         $this->markedFile = $markedFile;
 62:         $this->fileInfoType = $fileInfoType;
 63:     }
 64: 
 65:     /**
 66:      * Display only special file extensions
 67:      *
 68:      * @param array|string $extension
 69:      *         Name of extensions
 70:      */
 71:     public function setFileExtension($extension) {
 72:         if (cSecurity::isString($extension)) {
 73:             $extension = array($extension);
 74:         }
 75:         $this->fileExtension = $extension;
 76:     }
 77: 
 78:     /**
 79:      * Renders the page
 80:      * @see cGuiPage::render()
 81:      */
 82:     public function render() {
 83:         global $area, $cfg, $perm;
 84: 
 85:         // create an array of all files in the directory
 86:         $files = array();
 87:         foreach (new DirectoryIterator($this->directory) as $file) {
 88:             if ($file->isDir()) {
 89:                 continue;
 90:             }
 91:             if (!empty($this->fileExtension) && !in_array($file->getExtension(), $this->fileExtension)) {
 92:                 continue;
 93:             }
 94:             $files[] = $file->getBasename();
 95:         }
 96: 
 97:         // sort the files
 98:         sort($files);
 99: 
100:         // assign variables for the JavaScript
101:         $this->set('s', 'JS_AREA', $area);
102:         $this->set('s', 'JS_ACTION_DELETE', $area . '_delete');
103: 
104:         // assign variables for every file
105:         $fileInfos = new cApiFileInformationCollection();
106:         foreach($files as $file) {
107:             if($this->fileInfoType != '') {
108:                 $fileInfo = $fileInfos->getFileInformation($file, $this->fileInfoTyp);
109:                 $this->set('d', 'DESCRIPTION', $fileInfo['description']);
110:             } else {
111:                 $this->set('d', 'DESCRIPTION', '');
112:             }
113:             $this->set('d', 'AREA', $area);
114:             $this->set('d', 'ACTION', $area . '_edit');
115:             $this->set('d', 'FILENAME', $file);
116:             if($file == $this->markedFile) {
117:                 $this->set('d', 'MARKED', 'marked');
118:             } else {
119:                 $this->set('d', 'MARKED', '');
120:             }
121:             if(getEffectiveSetting("client", "readonly", "false") == "true" || (!$perm->have_perm_area_action($area, $area . "_delete"))) {
122:                 $this->set('d', 'DELETE_IMAGE', $cfg['path']['images'] . 'delete_inact.gif');
123:             } else {
124:                 $this->set('d', 'DELETE_IMAGE', $cfg['path']['images'] . 'delete.gif');
125:             }
126: 
127:             $this->next();
128:         }
129: 
130:         // call the render method of cGuiPage to display the webpage
131:         parent::render();
132:     }
133: 
134: }
135: 
CMS CONTENIDO 4.9.8 API documentation generated by ApiGen 2.8.0