本文整理汇总了PHP中FileManager::getUploadedFilePath方法的典型用法代码示例。如果您正苦于以下问题:PHP FileManager::getUploadedFilePath方法的具体用法?PHP FileManager::getUploadedFilePath怎么用?PHP FileManager::getUploadedFilePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileManager
的用法示例。
在下文中一共展示了FileManager::getUploadedFilePath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display(&$args, $request)
{
$templateMgr = TemplateManager::getManager($request);
parent::display($args, $request);
$templateMgr->assign('roleOptions', array('' => 'manager.people.doNotEnroll', 'manager' => 'user.role.manager', 'editor' => 'user.role.editor', 'sectionEditor' => 'user.role.sectionEditor', 'layoutEditor' => 'user.role.layoutEditor', 'reviewer' => 'user.role.reviewer', 'copyeditor' => 'user.role.copyeditor', 'proofreader' => 'user.role.proofreader', 'author' => 'user.role.author', 'reader' => 'user.role.reader', 'subscriptionManager' => 'user.role.subscriptionManager'));
$roleDao = DAORegistry::getDAO('RoleDAO');
$journal = $request->getJournal();
set_time_limit(0);
switch (array_shift($args)) {
case 'confirm':
$this->import('UserXMLParser');
$sendNotify = (bool) $request->getUserVar('sendNotify');
$continueOnError = (bool) $request->getUserVar('continueOnError');
import('lib.pkp.classes.file.FileManager');
$fileManager = new FileManager();
if (($userFile = $fileManager->getUploadedFilePath('userFile')) !== false) {
// Import the uploaded file
$parser = new UserXMLParser($journal->getId());
$users =& $parser->parseData($userFile);
$i = 0;
$usersRoles = array();
foreach ($users as $user) {
$usersRoles[$i] = array();
foreach ($user->getRoles() as $role) {
array_push($usersRoles[$i], $role->getRoleName());
}
$i++;
}
$templateMgr->assign('users', $users);
$templateMgr->assign('usersRoles', $usersRoles);
$templateMgr->assign('sendNotify', $sendNotify);
$templateMgr->assign('continueOnError', $continueOnError);
$templateMgr->assign('errors', $parser->errors);
// Show confirmation form
$templateMgr->display($this->getTemplatePath() . 'importUsersConfirm.tpl');
}
break;
case 'import':
$this->import('UserXMLParser');
$roleDao = DAORegistry::getDAO('RoleDAO');
$userKeys = $request->getUserVar('userKeys');
if (!is_array($userKeys)) {
$userKeys = array();
}
$sendNotify = (bool) $request->getUserVar('sendNotify');
$continueOnError = (bool) $request->getUserVar('continueOnError');
$users = array();
foreach ($userKeys as $i) {
$newUser = new ImportedUser();
$newUser->setFirstName($request->getUserVar($i . '_firstName'));
$newUser->setMiddleName($request->getUserVar($i . '_middleName'));
$newUser->setLastName($request->getUserVar($i . '_lastName'));
$newUser->setUsername($request->getUserVar($i . '_username'));
$newUser->setEmail($request->getUserVar($i . '_email'));
$locales = array();
if ($request->getUserVar($i . '_locales') != null || is_array($request->getUserVar($i . '_locales'))) {
foreach ($request->getUserVar($i . '_locales') as $locale) {
array_push($locales, $locale);
}
}
$newUser->setLocales($locales);
$newUser->setSignature($request->getUserVar($i . '_signature'), null);
$newUser->setBiography($request->getUserVar($i . '_biography'), null);
$newUser->setTemporaryInterests($request->getUserVar($i . '_interests'));
$newUser->setGossip($request->getUserVar($i . '_gossip'), null);
$newUser->setCountry($request->getUserVar($i . '_country'));
$newUser->setMailingAddress($request->getUserVar($i . '_mailingAddress'));
$newUser->setFax($request->getUserVar($i . '_fax'));
$newUser->setPhone($request->getUserVar($i . '_phone'));
$newUser->setUrl($request->getUserVar($i . '_url'));
$newUser->setAffiliation($request->getUserVar($i . '_affiliation'), null);
$newUser->setGender($request->getUserVar($i . '_gender'));
$newUser->setInitials($request->getUserVar($i . '_initials'));
$newUser->setSalutation($request->getUserVar($i . '_salutation'));
$newUser->setPassword($request->getUserVar($i . '_password'));
$newUser->setMustChangePassword($request->getUserVar($i . '_mustChangePassword'));
$newUser->setUnencryptedPassword($request->getUserVar($i . '_unencryptedPassword'));
$newUserRoles = $request->getUserVar($i . '_roles');
if (is_array($newUserRoles) && count($newUserRoles) > 0) {
foreach ($newUserRoles as $newUserRole) {
if ($newUserRole != '') {
$role = new Role();
$role->setRoleId($roleDao->getRoleIdFromPath($newUserRole));
$newUser->addRole($role);
}
}
}
array_push($users, $newUser);
}
$parser = new UserXMLParser($journal->getId());
$parser->setUsersToImport($users);
if (!$parser->importUsers($sendNotify, $continueOnError)) {
// Failures occurred
$templateMgr->assign('isError', true);
$templateMgr->assign('errors', $parser->getErrors());
}
$templateMgr->assign('importedUsers', $parser->getImportedUsers());
$templateMgr->display($this->getTemplatePath() . 'importUsersResults.tpl');
break;
case 'exportAll':
//.........这里部分代码省略.........
示例2: display
function display(&$args)
{
$templateMgr =& TemplateManager::getManager();
parent::display($args);
$templateMgr->assign('roleOptions', array('' => 'manager.people.doNotEnroll', 'manager' => 'user.role.manager', 'director' => 'user.role.director', 'trackDirector' => 'user.role.trackDirector', 'reviewer' => 'user.role.reviewer', 'author' => 'user.role.author', 'reader' => 'user.role.reader'));
$roleDao =& DAORegistry::getDAO('RoleDAO');
$schedConf =& Request::getSchedConf();
switch (array_shift($args)) {
case 'confirm':
$this->import('UserXMLParser');
$templateMgr->assign('helpTopicId', 'conference.currentConference.importExport');
$sendNotify = (bool) Request::getUserVar('sendNotify');
$continueOnError = (bool) Request::getUserVar('continueOnError');
import('file.FileManager');
if (($userFile = FileManager::getUploadedFilePath('userFile')) !== false) {
// Import the uploaded file
$parser = new UserXMLParser($schedConf->getConferenceId(), $schedConf->getId());
$users =& $parser->parseData($userFile);
$i = 0;
$usersRoles = array();
foreach ($users as $user) {
$usersRoles[$i] = array();
foreach ($user->getRoles() as $role) {
array_push($usersRoles[$i], $role->getRoleName());
}
$i++;
}
$templateMgr->assign_by_ref('users', $users);
$templateMgr->assign_by_ref('usersRoles', $usersRoles);
$templateMgr->assign('sendNotify', $sendNotify);
$templateMgr->assign('continueOnError', $continueOnError);
$templateMgr->assign('errors', $parser->errors);
// Show confirmation form
$templateMgr->display($this->getTemplatePath() . 'importUsersConfirm.tpl');
}
break;
case 'import':
$this->import('UserXMLParser');
$userKeys = Request::getUserVar('userKeys');
if (!is_array($userKeys)) {
$userKeys = array();
}
$sendNotify = (bool) Request::getUserVar('sendNotify');
$continueOnError = (bool) Request::getUserVar('continueOnError');
$users = array();
foreach ($userKeys as $i) {
$newUser = new ImportedUser();
$newUser->setFirstName(Request::getUserVar($i . '_firstName'));
$newUser->setMiddleName(Request::getUserVar($i . '_middleName'));
$newUser->setLastName(Request::getUserVar($i . '_lastName'));
$newUser->setUsername(Request::getUserVar($i . '_username'));
$newUser->setEmail(Request::getUserVar($i . '_email'));
$locales = array();
if (Request::getUserVar($i . '_locales') != null || is_array(Request::getUserVar($i . '_locales'))) {
foreach (Request::getUserVar($i . '_locales') as $locale) {
array_push($locales, $locale);
}
}
$newUser->setLocales($locales);
$newUser->setSignature(Request::getUserVar($i . '_signature'), null);
$newUser->setBiography(Request::getUserVar($i . '_biography'), null);
$newUser->setInterests(Request::getUserVar($i . '_interests'), null);
$newUser->setCountry(Request::getUserVar($i . '_country'));
$newUser->setMailingAddress(Request::getUserVar($i . '_mailingAddress'));
$newUser->setFax(Request::getUserVar($i . '_fax'));
$newUser->setPhone(Request::getUserVar($i . '_phone'));
$newUser->setUrl(Request::getUserVar($i . '_url'));
$newUser->setAffiliation(Request::getUserVar($i . '_affiliation'));
$newUser->setGender(Request::getUserVar($i . '_gender'));
$newUser->setInitials(Request::getUserVar($i . '_initials'));
$newUser->setSalutation(Request::getUserVar($i . '_salutation'));
$newUser->setPassword(Request::getUserVar($i . '_password'));
$newUser->setMustChangePassword(Request::getUserVar($i . '_mustChangePassword'));
$newUser->setUnencryptedPassword(Request::getUserVar($i . '_unencryptedPassword'));
$newUserRoles = Request::getUserVar($i . '_roles');
if (is_array($newUserRoles) && count($newUserRoles) > 0) {
foreach ($newUserRoles as $newUserRole) {
if ($newUserRole != '') {
$role = new Role();
$role->setRoleId(RoleDAO::getRoleIdFromPath($newUserRole));
$newUser->AddRole($role);
}
}
}
array_push($users, $newUser);
}
$parser = new UserXMLParser($schedConf->getConferenceId(), $schedConf->getId());
$parser->setUsersToImport($users);
if (!$parser->importUsers($sendNotify, $continueOnError)) {
// Failures occurred
$templateMgr->assign('isError', true);
$templateMgr->assign('errors', $parser->getErrors());
}
$templateMgr->assign('importedUsers', $parser->getImportedUsers());
$templateMgr->display($this->getTemplatePath() . 'importUsersResults.tpl');
break;
case 'exportAll':
$this->import('UserExportDom');
$users =& $roleDao->getUsersBySchedConfId($schedConf->getId());
$users =& $users->toArray();
//.........这里部分代码省略.........
示例3: uploadEmails
/**
* Upload a custom email template file
* @param $args array
* @param $request PKPRequest
*/
function uploadEmails($args, $request)
{
$this->validate();
import('lib.pkp.classes.file.FileManager');
$fileManager = new FileManager();
$journal = $request->getJournal();
$journalId = $journal->getId();
$uploadName = 'email_file';
$fileName = $fileManager->getUploadedFileName($uploadName);
if (!$fileName) {
$request->redirect(null, null, 'emails');
}
$filesDir = Config::getVar('files', 'files_dir');
$filePath = $filesDir . '/journals/' . $journalId . '/' . $fileName;
if (!$fileManager->uploadError($uploadName)) {
if ($fileManager->uploadedFileExists($uploadName)) {
$uploadedFilePath = $fileManager->getUploadedFilePath($uploadName);
if ($this->_saveEmailTemplates($uploadedFilePath, $journal)) {
if ($fileManager->deleteFile($uploadedFilePath)) {
$this->_showMessage($request);
$request->redirect(null, null, 'emails');
}
}
}
}
$this->_showMessage($request, false);
$request->redirect(null, null, 'emails');
}