<?php

namespace Nextend\SmartSlider3Pro\Generator\Joomla\Djclassifieds\Elements;

use Nextend\Framework\Database\Database;
use Nextend\Framework\Form\Element\Select;

class DjclassifiedsTypes extends Select {

    public function __construct($insertAt, $name = '', $label = '', $default = '', $parameters = array()) {
        parent::__construct($insertAt, $name, $label, $default, $parameters);

        $types = Database::queryAll("SELECT id, name FROM #__djcf_types ORDER BY id", false, "object");

        $this->options['0'] = n2_('All');

        if (count($types)) {
            foreach ($types AS $type) {
                $this->options[$type->id] = $type->name;
            }
        }
    }
}