| 1 |
<?php |
| 2 |
/** |
| 3 |
* |
| 4 |
*/ |
| 5 |
|
| 6 |
// Import dependencies. |
| 7 |
cssJSToolbox::import('framework:html:list.php', 'framework:db:mysql:xtable.inc.php'); |
| 8 |
|
| 9 |
/** |
| 10 |
* |
| 11 |
*/ |
| 12 |
class CJTTemplateVersionsField extends CJTListField { |
| 13 |
|
| 14 |
/** |
| 15 |
* put your comment there... |
| 16 |
* |
| 17 |
*/ |
| 18 |
protected function prepareItems() { |
| 19 |
// Import dependencies. |
| 20 |
CJTxTable::import('template-revision'); |
| 21 |
CJTxTable::import('author'); |
| 22 |
$lastVersionFlag = CJTTemplateRevisionTable::FLAG_LAST_REVISION; |
| 23 |
$internalAuthorsFlag = CJTAuthorTable::FLAG_SYS_AUTHOR; |
| 24 |
// Query CJT Authors + Wordpress build-in local users. |
| 25 |
$query = "SELECT DISTINCT(r.version) `text` |
| 26 |
FROM #__cjtoolbox_template_revisions r |
| 27 |
LEFT JOIN #__cjtoolbox_templates t |
| 28 |
ON r.templateId = t.id |
| 29 |
LEFT JOIN #__cjtoolbox_authors a |
| 30 |
ON t.authorId = a.id |
| 31 |
WHERE (r.attributes & {$lastVersionFlag}) AND (a.attributes & {$internalAuthorsFlag}) = 0 |
| 32 |
ORDER BY `text`;"; |
| 33 |
$this->items = cssJSToolbox::getInstance()->getDBDriver()->select($query); |
| 34 |
} |
| 35 |
|
| 36 |
} // End class. |