| 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 CJTTemplateDevelopmentStatesField extends CJTListField { |
| 13 |
|
| 14 |
/** |
| 15 |
* put your comment there... |
| 16 |
* |
| 17 |
*/ |
| 18 |
protected function prepareItems() { |
| 19 |
if ((isset($this->options['result'])) && ($this->options['result'] == 'fullList')) { |
| 20 |
$this->items['release']['text'] = cssJSToolbox::getText('Release'); |
| 21 |
$this->items['beta']['text'] = cssJSToolbox::getText('Beta'); |
| 22 |
$this->items['alpha']['text'] = cssJSToolbox::getText('Alpha'); |
| 23 |
$this->items['release-candidate']['text'] = cssJSToolbox::getText('Release Candidate'); |
| 24 |
$this->items['revision']['text'] = cssJSToolbox::getText('Revision'); |
| 25 |
} |
| 26 |
else { |
| 27 |
// Import dependencies. |
| 28 |
CJTxTable::import('template-revision'); |
| 29 |
CJTxTable::import('author'); |
| 30 |
$lastVersionFlag = CJTTemplateRevisionTable::FLAG_LAST_REVISION; |
| 31 |
$internalAuthorsFlag = CJTAuthorTable::FLAG_SYS_AUTHOR; |
| 32 |
$query = "SELECT DISTINCT(r.state) `text` |
| 33 |
FROM #__cjtoolbox_template_revisions r |
| 34 |
LEFT JOIN #__cjtoolbox_templates t |
| 35 |
ON r.templateId = t.id |
| 36 |
LEFT JOIN #__cjtoolbox_authors a |
| 37 |
ON t.authorId = a.id |
| 38 |
WHERE (r.attributes & {$lastVersionFlag}) AND (a.attributes & {$internalAuthorsFlag}) = 0 |
| 39 |
ORDER BY `text`"; |
| 40 |
$this->items = cssJSToolbox::getInstance()->getDBDriver()->select($query); |
| 41 |
} |
| 42 |
} |
| 43 |
|
| 44 |
} // End class. |