Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions _build/data/transport.chunks.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
'file' => 'item',
'description' => '',
),
'FileAttachFenomTpl' => array(
'file' => 'item_fenom',
'description' => 'Пример оформления чанка с помощью шаблонизатора Fenom'
),
);

// Save chunks for setup options
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<p>{$description ? '<strong>' ~ $description ~ '</strong><br/>' : null}
<a href="{$url}">{$name}</a> <span class="badge">{$download}</span>
{$size ? '<br/><small>Size:' ~ $size ~ 'bytes </small>' : null}
{$ext ? '<br/><small>Size:' ~ $ext ~ '</small>' : null}
{$timestamp ? '<br/><small>Size:' ~ $timestamp ~ '</small>' : null}
{$hash ? '<br/><small>Size:' ~ $hash ~ '</small>' : null}
</p>
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion core/components/fileattach/model/fileattach/fileattach.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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');
}
}
}