<commit_before><?php defined('SYSPATH') OR die('No direct script access.');

/**
 * ##Controller to view the page settings forms.
 *
 * @package	BoomCMS
 * @category	Controllers
 */
class Boom_Controller_Cms_Page_Settings_View extends Controller_Cms_Page_Settings
{
	/**
	 * ** View the page admin settings.**
	 *
	 */
	public function action_admin()
	{
		// Call the parent function to check permissions.
		parent::action_admin();

		// Display the admin settings form.
		$this->template = View::factory("$this->viewDirectory/admin", array(
			'page'	=>	$this->page,
		));
	}

	/**
	 * ** View the child page settings.**
	 *
	 */
	public function action_children()
	{
		// Call the parent function to check permissions.
		parent::action_children();

		// Get the ID and names of all the templates in the database.
		// These are used by both the basic and the advanced settings.
		$templates = ORM::factory('Template')->names();

		$childOrderingPolicy = $this->page->getChildORderingPolicy();

		// Create the main view with the basic settings
		$this->template = View::factory("$this->viewDirectory/children", array(
			'default_child_template'	=>	($this->page->children_template_id != 0)? $this->page->children_template_id : $this->page->getTemplateId(),
			'templates'			=>	$templates,
			'child_order_column'		=>	$childOrderingPolicy->getColumn(),
			'child_order_direction'	=>	$childOrderingPolicy->getDirection(),
			'allow_advanced'		=>	$this->allow_advanced,
		));

		// If we're showing the advanced settings then set the neccessary variables.
		if ($this->allow_advanced)
		{
			// Add the view for the advanced settings to the main view.
			$this->template->set(array(
				'default_grandchild_template'	=>	($this->page->grandchild_template_id != 0)? $this->page->grandchild_template_id : $this->page->getTemplateId(),
				'page'					=>	$this->page,
				'templates'				=>	$templates,
			));
		}
	}

	public function action_feature()
	{
		parent::action_feature();

		$images_in_page = new \Boom\Page\AssetsUsed($this->page->getCurrentVersion());
		$images_in_page->setType(\Boom\Asset\Type::IMAGE);

		$this->template = View::factory("$this->viewDirectory/feature", array(
			'feature_image_id' => $this->page->getFeatureImageId(),
			'images_in_page' => $images_in_page->getAll(),
		));
	}

	/**
	 * ** View the page navigation settings.**
	 *
	 */
	public function action_navigation()
	{
		// Call the parent to do a do permissions check
		parent::action_navigation();

		// Show the navigation settings form.
		$this->template = View::factory("$this->viewDirectory/navigation", array(
			'page'			=>	$this->page,
			'allow_advanced'	=>	$this->allow_advanced,
		));
	}

	/**
	 * ** View the page search settings. **
	 *
	 */
	public function action_search()
	{
		// Call the parent function for permissions check.
		parent::action_search();

		// Show the search settings template.
		$this->template = View::factory("$this->viewDirectory/search", array(
			'allow_advanced'	=>	$this->allow_advanced,
			'page'			=>	$this->page,
		));
	}

	public function action_sort_children()
	{
		parent::action_children();

		$finder = new \Boom\Finder\Page;

		$children = $finder
			->addFilter(\Boom\Finder\Page\Filter\ParentPage($this->page))
			->setLimit(50)
			->find();

		$this->template = View::factory("$this->viewDirectory/sort_children", array(
			'children' => $children
		));
	}

	/**
	 * ** View the page visibility settings. **
	 *
	 */
	public function action_visibility()
	{
		// Call the parent function to check permissions.
		parent::action_visibility();

		// GET request - show the visiblity form.
		$this->template = View::factory("$this->viewDirectory/visibility", array(
			'page'	=>	$this->page,
		));
	}
} // End Boom_Controller_Cms_Page_Settings_View<commit_msg>Removed redundant comments and style updates<commit_after><?php


class Boom_Controller_Cms_Page_Settings_View extends Controller_Cms_Page_Settings
{

	public function action_admin()
	{
		parent::action_admin();

		$this->template = new View("$this->viewDirectory/admin", array(
			'page' => $this->page,
		));
	}

	/**
	 * ** View the child page settings.**
	 *
	 */
	public function action_children()
	{
		// Call the parent function to check permissions.
		parent::action_children();

		// Get the ID and names of all the templates in the database.
		// These are used by both the basic and the advanced settings.
		$templates = ORM::factory('Template')->names();

		$childOrderingPolicy = $this->page->getChildORderingPolicy();

		// Create the main view with the basic settings
		$this->template = View::factory("$this->viewDirectory/children", array(
			'default_child_template'	=>	($this->page->children_template_id != 0)? $this->page->children_template_id : $this->page->getTemplateId(),
			'templates'			=>	$templates,
			'child_order_column'		=>	$childOrderingPolicy->getColumn(),
			'child_order_direction'	=>	$childOrderingPolicy->getDirection(),
			'allow_advanced'		=>	$this->allow_advanced,
		));

		// If we're showing the advanced settings then set the neccessary variables.
		if ($this->allow_advanced)
		{
			// Add the view for the advanced settings to the main view.
			$this->template->set(array(
				'default_grandchild_template'	=>	($this->page->grandchild_template_id != 0)? $this->page->grandchild_template_id : $this->page->getTemplateId(),
				'page'					=>	$this->page,
				'templates'				=>	$templates,
			));
		}
	}

	public function action_feature()
	{
		parent::action_feature();

		$images_in_page = new \Boom\Page\AssetsUsed($this->page->getCurrentVersion());
		$images_in_page->setType(\Boom\Asset\Type::IMAGE);

		$this->template = new View("$this->viewDirectory/feature", array(
			'feature_image_id' => $this->page->getFeatureImageId(),
			'images_in_page' => $images_in_page->getAll(),
		));
	}

	/**
	 * ** View the page navigation settings.**
	 *
	 */
	public function action_navigation()
	{
		parent::action_navigation();

		$this->template = new View("$this->viewDirectory/navigation", array(
			'page' => $this->page,
			'allow_advanced' => $this->allow_advanced,
		));
	}

	public function action_search()
	{
		parent::action_search();

		$this->template = new View("$this->viewDirectory/search", array(
			'allow_advanced' => $this->allow_advanced,
			'page' => $this->page,
		));
	}

	public function action_sort_children()
	{
		parent::action_children();

		$finder = new \Boom\Finder\Page;

		$children = $finder
			->addFilter(\Boom\Finder\Page\Filter\ParentPage($this->page))
			->setLimit(50)
			->find();

		$this->template = new View("$this->viewDirectory/sort_children", array(
			'children' => $children
		));
	}

	public function action_visibility()
	{
		parent::action_visibility();

		$this->template = new View("$this->viewDirectory/visibility", array(
			'page' => $this->page,
		));
	}
}
{'fraction_non_alphanumeric': 0.16133274879438841, 'fraction_numerical': 0.001169077889814409, 'mean_word_length': 4.111277072442121, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 141, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '7385331', 'n_tokens_mistral': 2422, 'n_tokens_neox': 2157, 'n_words': 461}