<commit_before><?php
/**
 * @version     $Id: listbox.php 3031 2011-10-09 14:21:07Z johanjanssens $
 * @package     Nooku_Server
 * @subpackage  Pages
 * @copyright   Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net).
 * @license     GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link        http://www.nooku.org
 */

/**
 * Listbox Template Helper Class
 *
 * @author      <NAME> <http://nooku.assembla.com/profile/gergoerdosi>
 * @package     Nooku_Server
 * @subpackage  Pages
 */

class ComPagesTemplateHelperListbox extends ComDefaultTemplateHelperListbox
{
    public function menus($config = array())
    {
        $config = new KConfig($config);
		$config->append(array(
			'model'		=> 'menus',
			'name' 		=> 'pages_menu_id',
			'value'		=> 'id',
			'text'		=> 'title',
		));

		return $this->_listbox($config);
    }
    
    public function pages($config = array())
    {
        $config = new KConfig($config);
        $config->append(array(
            'deselect' => true,
            'prompt' => '- Select -',
            'disable' => array()
        ));

        $options = array();
        if($config->deselect) {
            $options[] = $this->option(array('text' => JText::_($config->prompt)));
        }

        $menus = $this->getService('com://admin/pages.model.menus')->getList();
        $pages = $this->getService('com://admin/pages.model.pages')->enabled(true)->getList();

        foreach($menus as $menu)
        {
            $options[] = $this->option(array('text' => $menu->title, 'value' => '', 'disable' => true));
            foreach($pages->find(array('pages_menu_id' => $menu->id)) as $page)
            {
                $options[] = $this->option(array(
                    'text' => str_repeat(str_repeat('&nbsp;', 4), $page->level).$page->title,
                    'value' => $page->id,
                    'disable' => in_array($page->type, KConfig::unbox($config->disable))
                ));<commit_msg>Fixed typo re #219<commit_after><?php
/**
 * @version     $Id: listbox.php 3031 2011-10-09 14:21:07Z johanjanssens $
 * @package     Nooku_Server
 * @subpackage  Pages
 * @copyright   Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net).
 * @license     GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link        http://www.nooku.org
 */

/**
 * Listbox Template Helper Class
 *
 * @author      <NAME> <http://nooku.assembla.com/profile/gergoerdosi>
 * @package     Nooku_Server
 * @subpackage  Pages
 */

class ComPagesTemplateHelperListbox extends ComDefaultTemplateHelperListbox
{
    public function menus($config = array())
    {
        $config = new KConfig($config);
		$config->append(array(
			'model'		=> 'menus',
			'name' 		=> 'pages_menu_id',
			'value'		=> 'id',
			'text'		=> 'title',
		));

		return $this->_listbox($config);
    }
    
    public function pages($config = array())
    {
        $config = new KConfig($config);
        $config->append(array(
            'deselect' => true,
            'prompt' => '- Select -',
            'disable' => array()
        ));

        $options = array();
        if($config->deselect) {
            $options[] = $this->option(array('text' => JText::_($config->prompt)));
        }

        $menus = $this->getService('com://admin/pages.model.menus')->getList();
        $pages = $this->getService('com://admin/pages.model.pages')->published(true)->getList();

        foreach($menus as $menu)
        {
            $options[] = $this->option(array('text' => $menu->title, 'value' => '', 'disable' => true));
            foreach($pages->find(array('pages_menu_id' => $menu->id)) as $page)
            {
                $options[] = $this->option(array(
                    'text' => str_repeat(str_repeat('&nbsp;', 4), $page->level).$page->title,
                    'value' => $page->id,
                    'disable' => in_array($page->type, KConfig::unbox($config->disable))
                ));
{'fraction_non_alphanumeric': 0.18738965952080705, 'fraction_numerical': 0.012862547288776798, 'mean_word_length': 2.3553299492385786, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 81, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7488491', 'n_tokens_mistral': 1344, 'n_tokens_neox': 1257, 'n_words': 219}