1 <?php
 2 /**
 3  * @package    FrameworkOnFramework
 4  * @subpackage form
 5  * @copyright   Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved.
 6  * @license    GNU General Public License version 2 or later; see LICENSE.txt
 7  */
 8 // Protect from unauthorized access
 9 defined('FOF_INCLUDED') or die;
10 
11 /**
12  * Access level field header
13  *
14  * @package  FrameworkOnFramework
15  * @since    2.0
16  */
17 class FOFFormHeaderAccesslevel extends FOFFormHeaderFieldselectable
18 {
19     /**
20      * Method to get the list of access levels
21      *
22      * @return  array   A list of access levels.
23      *
24      * @since   2.0
25      */
26     protected function getOptions()
27     {
28         $db    = FOFPlatform::getInstance()->getDbo();
29         $query = $db->getQuery(true);
30 
31         $query->select('a.id AS value, a.title AS text');
32         $query->from('#__viewlevels AS a');
33         $query->group('a.id, a.title, a.ordering');
34         $query->order('a.ordering ASC');
35         $query->order($query->qn('title') . ' ASC');
36 
37         // Get the options.
38         $db->setQuery($query);
39         $options = $db->loadObjectList();
40 
41         return $options;
42     }
43 }
44