3
3
namespace Xibo\Helper;
6
use Xibo\Entity\Layout;
7
use Xibo\Exception\LibraryFullException;
6
use Xibo\Factory\LayoutFactory;
10
* Class LayoutUploadHandler
11
* @package Xibo\Helper
13
8
class LayoutUploadHandler extends BlueImpUploadHandler
18
* @throws \Xibo\Exception\ConfigurationException
20
10
protected function handle_form_data($file, $index)
22
$controller = $this->options['controller'];
23
/* @var \Xibo\Controller\Layout $controller */
25
12
// Handle form data, e.g. $_REQUEST['description'][$index]
26
13
$fileName = $file->name;
28
$controller->getLog()->debug('Upload complete for ' . $fileName . '.');
15
Log::debug('Upload complete for ' . $fileName . '.');
33
if ($this->options['libraryQuotaFull'])
34
throw new LibraryFullException(sprintf(__('Your library is full. Library Limit: %s K'), $this->options['libraryLimit']));
36
// Check for a user quota
37
$controller->getUser()->isQuotaFullByUser();
40
19
$name = isset($_REQUEST['name']) ? $_REQUEST['name'][$index] : '';
41
20
$template = isset($_REQUEST['template']) ? $_REQUEST['template'][$index] : 0;
42
21
$replaceExisting = isset($_REQUEST['replaceExisting']) ? $_REQUEST['replaceExisting'][$index] : 0;
43
22
$importTags = isset($_REQUEST['importTags']) ? $_REQUEST['importTags'][$index] : 0;
44
$useExistingDataSets = isset($_REQUEST['useExistingDataSets']) ? $_REQUEST['useExistingDataSets'][$index] : 0;
45
$importDataSetData = isset($_REQUEST['importDataSetData']) ? $_REQUEST['importDataSetData'][$index] : 0;
47
/* @var Layout $layout */
48
$layout = $controller->getLayoutFactory()->createFromZip(
49
$controller->getConfig()->GetSetting('LIBRARY_LOCATION') . 'temp/' . $fileName,
24
$layout = LayoutFactory::createFromZip(
25
Config::GetSetting('LIBRARY_LOCATION') . 'temp/' . $fileName,
51
27
$this->options['userId'],
57
$this->options['libraryController']
62
@unlink($controller->getConfig()->GetSetting('LIBRARY_LOCATION') . 'temp/' . $fileName);
35
@unlink(Config::GetSetting('LIBRARY_LOCATION') . 'temp/' . $fileName);
64
37
// Set the name for the return
65
38
$file->name = $layout->layout;
67
40
} catch (Exception $e) {
68
$controller->getLog()->error('Error importing Layout: %s', $e->getMessage());
69
$controller->getLog()->debug($e->getTraceAsString());
41
Log::error('Error uploading media: %s', $e->getMessage());
42
Log::debug($e->getTraceAsString());
71
44
$file->error = $e->getMessage();
73
$controller->getApp()->commit = false;
46
$this->options['controller']->getApp()->commit = false;
b'\\ No newline at end of file'