• Main Page
  • Modules
  • Classes
  • Files
  • File List

controllers/grid/files/form/LibraryFileForm.inc.php

00001 <?php
00002 
00015 import('lib.pkp.classes.form.Form');
00016 import('classes.file.LibraryFileManager');
00017 
00018 class LibraryFileForm extends Form {
00020    var $pressId;
00021 
00023    var $libraryFileManager;
00024 
00030    function LibraryFileForm($template, $pressId) {
00031       $this->pressId = $pressId;
00032 
00033       parent::Form($template);
00034       $this->libraryFileManager = new LibraryFileManager($pressId);
00035 
00036       $this->addCheck(new FormValidatorLocale($this, 'libraryFileName', 'required', 'settings.libraryFiles.nameRequired'));
00037       $this->addCheck(new FormValidatorCustom($this, 'fileType', 'required', 'settings.libraryFiles.typeRequired',
00038             create_function('$type, $form, $libraryFileManager', 'return is_numeric($type) && $libraryFileManager->getNameFromType($type);'), array(&$this, $this->libraryFileManager)));
00039 
00040       $this->addCheck(new FormValidatorPost($this));
00041    }
00042 
00048    function fetch(&$request) {
00049       $press =& $request->getPress();
00050       AppLocale::requireComponents(LOCALE_COMPONENT_OMP_MANAGER);
00051 
00052       // load the file types for the selector on the form.
00053       $templateMgr =& TemplateManager::getManager();
00054       $libraryFileManager =& $this->libraryFileManager;
00055       $fileTypeKeys = $libraryFileManager->getTypeTitleKeyMap();
00056       $templateMgr->assign('fileTypes', $fileTypeKeys);
00057 
00058       return parent::fetch($request);
00059    }
00060 
00065    function readInputData() {
00066       $this->readUserVars(array('libraryFileName', 'fileType'));
00067    }
00068 }
00069 
00070 ?>

Generated on Mon Sep 17 2012 13:58:55 for Open Monograph Press by  doxygen 1.7.1