/**
  * put your comment there...
  * 
  */
 protected function prepareItems()
 {
     CJTxTable::import('author');
     $internalAuthorsFlag = CJTAuthorTable::FLAG_SYS_AUTHOR;
     // Query all dates (without time!) or internal authors.
     $query = " SELECT DISTINCT(DATE(t.creationDate)) `text`\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM #__cjtoolbox_templates t\n\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN #__cjtoolbox_authors a\n\t\t\t\t\t\t\t\t\t\t\t\t\tON  t.authorId = a.id\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE (a.attributes & {$internalAuthorsFlag}) = 0\n\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY `text`;";
     $this->items = cssJSToolbox::getInstance()->getDBDriver()->select($query);
 }
 /**
  * put your comment there...
  * 
  */
 protected function prepareItems()
 {
     CJTxTable::import('author');
     $internalAuthorsFlag = CJTAuthorTable::FLAG_SYS_AUTHOR;
     // Query CJT Authors + Wordpress build-in local users.
     $query = " SELECT a.id, a.name `text`\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM #__cjtoolbox_authors a\n\t\t\t\t\t\t\t\t\t\t\t\t\tRIGHT JOIN #__cjtoolbox_templates t\n\t\t\t\t\t\t\t\t\t\t\t\t\tON a.id = t.authorId\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE (a.attributes & {$internalAuthorsFlag}) = 0\n\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY `text`";
     // Get all exists authors
     $this->items = cssJSToolbox::getInstance()->getDBDriver()->select($query);
 }
 /**
  * put your comment there...
  * 
  */
 protected function prepareItems()
 {
     // Import dependencies.
     CJTxTable::import('template-revision');
     CJTxTable::import('author');
     $lastVersionFlag = CJTTemplateRevisionTable::FLAG_LAST_REVISION;
     $internalAuthorsFlag = CJTAuthorTable::FLAG_SYS_AUTHOR;
     // Query all dates (without time!).
     $query = " SELECT DISTINCT(DATE(r.dateCreated)) `text` \n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM #__cjtoolbox_template_revisions r\n\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN #__cjtoolbox_templates t\n\t\t\t\t\t\t\t\t\t\t\t\t\tON  r.templateId = t.id\n\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN #__cjtoolbox_authors a\n\t\t\t\t\t\t\t\t\t\t\t\t\tON  t.authorId = a.id\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE (r.attributes & {$lastVersionFlag}) AND (a.attributes & {$internalAuthorsFlag}) = 0\n\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY `text`";
     $this->items = cssJSToolbox::getInstance()->getDBDriver()->select($query);
 }
 /**
  * put your comment there...
  * 
  */
 protected function prepareItems()
 {
     if (isset($this->options['result']) && $this->options['result'] == 'fullList') {
         $this->items['published']['text'] = cssJSToolbox::getText('published');
         $this->items['draft']['text'] = cssJSToolbox::getText('draft');
         $this->items['trash']['text'] = cssJSToolbox::getText('trash');
     } else {
         CJTxTable::import('author');
         $internalAuthorsFlag = CJTAuthorTable::FLAG_SYS_AUTHOR;
         // Query all template state exluding Internal authors.
         $query = "SELECT DISTINCT(state) `text` \n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM #__cjtoolbox_templates t\n\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN #__cjtoolbox_authors a\n\t\t\t\t\t\t\t\t\t\t\t\t\tON  t.authorId = a.id\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE (a.attributes & {$internalAuthorsFlag}) = 0\n\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY `text`";
         $this->items = cssJSToolbox::getInstance()->getDBDriver()->select($query);
     }
 }
 /**
  * put your comment there...
  * 
  */
 public function __construct($type)
 {
     // Save type data for later use!
     $this->type = cssJSToolbox::$config->templates->types[$type];
     $this->type->name = $type;
     // Get which Wordpress queue (wp_script, wp_styles) object to fetch data from.
     $wpQueueName = self::$typesMap[$type];
     /**
      * @var CJTCouplingModel
      */
     $coupling = CJTModel::getInstance('coupling');
     // Initialize ArrayIterator with templates list!
     parent::__construct($coupling->getQueueObject($wpQueueName)->registered);
     // Import dependencies!
     cssJSToolbox::import('framework:db:mysql:xtable.inc.php');
     CJTxTable::import('template');
     CJTxTable::import('author');
 }
 /**
  * put your comment there...
  * 
  */
 protected function prepareItems()
 {
     if (isset($this->options['result']) && $this->options['result'] == 'fullList') {
         $this->items['release']['text'] = cssJSToolbox::getText('release');
         $this->items['beta']['text'] = cssJSToolbox::getText('beta');
         $this->items['alpha']['text'] = cssJSToolbox::getText('alpha');
         $this->items['release-candidate']['text'] = cssJSToolbox::getText('release-candidate');
         $this->items['revision']['text'] = cssJSToolbox::getText('revision');
     } else {
         // Import dependencies.
         CJTxTable::import('template-revision');
         CJTxTable::import('author');
         $lastVersionFlag = CJTTemplateRevisionTable::FLAG_LAST_REVISION;
         $internalAuthorsFlag = CJTAuthorTable::FLAG_SYS_AUTHOR;
         $query = "SELECT DISTINCT(r.state) `text` \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM #__cjtoolbox_template_revisions r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN #__cjtoolbox_templates t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tON  r.templateId = t.id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN #__cjtoolbox_authors a\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tON  t.authorId = a.id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE (r.attributes & {$lastVersionFlag}) AND (a.attributes & {$internalAuthorsFlag}) = 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY `text`";
         $this->items = cssJSToolbox::getInstance()->getDBDriver()->select($query);
     }
 }
    /**
     * put your comment there...
     * 
     */
    public function getItemsQuery()
    {
        // Import dependencies.
        cssJSToolbox::import('framework:db:mysql:xtable.inc.php');
        CJTxTable::import('template-revision');
        CJTxTable::import('author');
        // From clause.
        $query['from'] = ' FROM #__cjtoolbox_templates t
													LEFT JOIN #__cjtoolbox_template_revisions r ON t.id = r.templateId
													LEFT JOIN #__cjtoolbox_authors a ON t.authorId = a.id';
        // Always get only the last revision.
        $where[] = '(r.attributes & ' . CJTTemplateRevisionTable::FLAG_LAST_REVISION . ')';
        // For version 6 don't display Internal/System (e.g Wordpress, ) Authors templates
        $where[] = '((a.attributes & ' . CJTAuthorTable::FLAG_SYS_AUTHOR . ') = 0)';
        // Build where clause based on the given filters!
        $filters = array('types' => array('table' => 't', 'name' => 'type'), 'authors' => array('table' => 't', 'name' => 'authorId'), 'version' => array('table' => 'r', 'name' => 'version'), 'creation-dates' => array('name' => 'DATE(creationDate)'), 'last-modified-dates' => array('name' => 'DATE(dateCreated)'), 'states' => array('table' => 't', 'name' => 'state'), 'development-state' => array('table' => 'r', 'name' => 'state'));
        foreach ($filters as $name => $field) {
            $filterName = "filter_{$name}";
            // Add filter only if there is a value specified.
            if (!empty($this->inputs[$filterName])) {
                $value = $this->inputs[$filterName];
                if (!is_numeric($value)) {
                    $value = "'{$value}'";
                }
                $field['table'] = isset($field['table']) ? "{$field['table']}." : '';
                $where[] = "{$field['table']}{$field['name']} = {$value} ";
            }
        }
        $query['where'] = ' WHERE ' . implode(' AND ', $where);
        return $query;
    }