diff --git a/_build/data/transport.chunks.php b/_build/data/transport.chunks.php index f334b85..28ea836 100644 --- a/_build/data/transport.chunks.php +++ b/_build/data/transport.chunks.php @@ -7,6 +7,10 @@ 'file' => 'item', 'description' => '', ), + 'FileAttachFenomTpl' => array( + 'file' => 'item_fenom', + 'description' => 'Пример оформления чанка с помощью шаблонизатора Fenom' + ), ); // Save chunks for setup options diff --git a/core/components/fileattach/elements/chunks/chunk.item_fenom.tpl b/core/components/fileattach/elements/chunks/chunk.item_fenom.tpl new file mode 100644 index 0000000..9d1e6dc --- /dev/null +++ b/core/components/fileattach/elements/chunks/chunk.item_fenom.tpl @@ -0,0 +1,7 @@ +

{$description ? '' ~ $description ~ '
' : null} + {$name} {$download} + {$size ? '
Size:' ~ $size ~ 'bytes ' : null} + {$ext ? '
Size:' ~ $ext ~ '' : null} + {$timestamp ? '
Size:' ~ $timestamp ~ '' : null} + {$hash ? '
Size:' ~ $hash ~ '' : null} +

diff --git a/core/components/fileattach/elements/snippets/snippet.fileattach.php b/core/components/fileattach/elements/snippets/snippet.fileattach.php index 81c4d76..a60750f 100644 --- a/core/components/fileattach/elements/snippets/snippet.fileattach.php +++ b/core/components/fileattach/elements/snippets/snippet.fileattach.php @@ -139,7 +139,12 @@ if (($ext != '') && ($ext != $itemArr['ext'])) continue; } - $list[] = $modx->getChunk($tpl, $itemArr); + /** @var pdoTools $pdo */ + if (class_exists('pdoTools')) { + $list[] = $FileAttach->pdoTools->getChunk($tpl, $itemArr); + } else { + $list[] = $modx->getChunk($tpl, $itemArr); + } } // Output diff --git a/core/components/fileattach/model/fileattach/fileattach.class.php b/core/components/fileattach/model/fileattach/fileattach.class.php index 2e1f5b5..fa1e0c6 100644 --- a/core/components/fileattach/model/fileattach/fileattach.class.php +++ b/core/components/fileattach/model/fileattach/fileattach.class.php @@ -29,6 +29,12 @@ class FileAttach { /* @var modX $modx */ public $modx; + /** @var array $config */ + public $config = array(); + + /** @var pdoFetch $pdoTools */ + public $pdoTools = null; + /** * @param modX $modx * @param array $config @@ -56,5 +62,9 @@ function __construct(modX &$modx, array $config = array()) { $this->modx->addPackage('fileattach', $this->config['modelPath']); $this->modx->lexicon->load('fileattach:default'); - } + + if (class_exists('pdoTools') && !is_object($this->pdoTools)) { + $this->pdoTools = $this->modx->getService('pdoTools'); + } + } } \ No newline at end of file