<commit_before><?php

require_once 'Swat/SwatTableViewColumn.php';
require_once 'Swat/SwatHtmlTag.php';

/**
 * An orderable table view column.
 *
 * This column has a clickable header that allows the user to change the
 * ordering of the column. This behaviour is commonly used for databound table
 * columns.
 *
 * TODO: Implement this functionality with AJAX.
 *
 * @package   Swat
 * @copyright 2004-2005 silverorange
 * @license   http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
 */
class SwatTableViewOrderableColumn extends SwatTableViewColumn
{
	// {{{ class constants

	/**
	 * Indicates no ordering is done
	 */
	const ORDER_BY_DIR_NONE = 0;

	/**
	 * Indicates descending ordering is done
	 */
	const ORDER_BY_DIR_DESCENDING = 1;

	/**
	 * Indicates ascending ordering is done
	 */
	const ORDER_BY_DIR_ASCENDING = 2;

	// }}}
	// {{{ public properties

	/**
	 * The base of the link used when building column header links
	 *
	 * Additional GET variables are appended to this link in the getLink()
	 * method.
	 *
	 * @var string
	 *
	 * @see SwatTableViewOrderableColumn::getLink()
	 */
	public $link = '';

	/**
	 * HTTP GET variables to remove from the column header link
	 *
	 * An array of GET variable names to unset before building new links.
	 *
	 * @var array
	 */
	public $unset_get_vars = array();

	/**
	 * The direction of ordering
	 *
	 * The current direction of ordering for this column. Valid values are
	 * ORDER_BY_DIR_* constants.
	 *
	 * @var integer
	 */
	private $direction = SwatTableViewOrderableColumn::ORDER_BY_DIR_NONE;

	/**
	 * The default direction of ordering
	 *
	 * The default direction of ordering before the GET variables are processed.
	 * When the GET variables are processed, they change $direction and 
	 * $default_direction remains unchanged.  Valid values are
	 * ORDER_BY_DIR_* constants.
	 *
	 * @var integer
	 */
	private $default_direction = SwatTableViewOrderableColumn::ORDER_BY_DIR_NONE;

	/**
	 * The mode of ordering
	 *
	 * The mode of switching between ordering states.
	 * Valid values are ORDER_MODE_TRISTATE, and ORDER_MODE_BISTATE constants.
	 *
	 * @var int
	 */
	//private $mode = SwatTableViewOrderableColumn::ORDER_MODE_TRISTATE;

	// }}}
	// {{{ public function init()
	
	/**
	 * Initializes this column
	 *
	 * The current direction of ordering is grabbed from GET variables.
	 */
	public function init()
	{
		$this->initFromGetVariables();
	}

	// }}}
	// {{{ public function setDirection()

	/**
	 * Sets the direction of ordering
	 * 
	 * This method sets the direction of ordering of the column, either asc,
	 * desc, or none.
	 *
	 * @param $direction integer One of the ORDER_BY_DIR_* class contants
	 * @param $set_as_orderby_column boolean Whether to set this column as the 
	 *                                    column currently used for ordering 
	 *                                    of the view
	 **/
	public function setDirection($direction) {
		$this->direction = $direction;
		$this->default_direction = $direction;

		if ($this->view->orderby_column === null)
			$this->view->orderby_column = $this;

		$this->view->default_orderby_column = $this;

		$this->initFromGetVariables();
	}

	// }}}
	// {{{ public function displayHeader()

	/**
	 * Displays the column header for this table view column
	 *
	 * This method displays an appropriate header based on the current
	 * direction of ordering of this table view column. If the column has been
	 * ordered, an image indicating the ordering is also displayed in the
	 * header.
	 */
	public function displayHeader()
	{
		$anchor = new SwatHtmlTag('a');
		$anchor->href = $this->getLink();
<commit_msg>Use new brace style.<commit_after><?php

require_once 'Swat/SwatTableViewColumn.php';
require_once 'Swat/SwatHtmlTag.php';

/**
 * An orderable table view column.
 *
 * This column has a clickable header that allows the user to change the
 * ordering of the column. This behaviour is commonly used for databound table
 * columns.
 *
 * TODO: Implement this functionality with AJAX.
 *
 * @package   Swat
 * @copyright 2004-2005 silverorange
 * @license   http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
 */
class SwatTableViewOrderableColumn extends SwatTableViewColumn
{
	// {{{ class constants

	/**
	 * Indicates no ordering is done
	 */
	const ORDER_BY_DIR_NONE = 0;

	/**
	 * Indicates descending ordering is done
	 */
	const ORDER_BY_DIR_DESCENDING = 1;

	/**
	 * Indicates ascending ordering is done
	 */
	const ORDER_BY_DIR_ASCENDING = 2;

	// }}}
	// {{{ public properties

	/**
	 * The base of the link used when building column header links
	 *
	 * Additional GET variables are appended to this link in the getLink()
	 * method.
	 *
	 * @var string
	 *
	 * @see SwatTableViewOrderableColumn::getLink()
	 */
	public $link = '';

	/**
	 * HTTP GET variables to remove from the column header link
	 *
	 * An array of GET variable names to unset before building new links.
	 *
	 * @var array
	 */
	public $unset_get_vars = array();

	/**
	 * The direction of ordering
	 *
	 * The current direction of ordering for this column. Valid values are
	 * ORDER_BY_DIR_* constants.
	 *
	 * @var integer
	 */
	private $direction = SwatTableViewOrderableColumn::ORDER_BY_DIR_NONE;

	/**
	 * The default direction of ordering
	 *
	 * The default direction of ordering before the GET variables are processed.
	 * When the GET variables are processed, they change $direction and 
	 * $default_direction remains unchanged.  Valid values are
	 * ORDER_BY_DIR_* constants.
	 *
	 * @var integer
	 */
	private $default_direction = SwatTableViewOrderableColumn::ORDER_BY_DIR_NONE;

	/**
	 * The mode of ordering
	 *
	 * The mode of switching between ordering states.
	 * Valid values are ORDER_MODE_TRISTATE, and ORDER_MODE_BISTATE constants.
	 *
	 * @var int
	 */
	//private $mode = SwatTableViewOrderableColumn::ORDER_MODE_TRISTATE;

	// }}}
	// {{{ public function init()
	
	/**
	 * Initializes this column
	 *
	 * The current direction of ordering is grabbed from GET variables.
	 */
	public function init()
	{
		$this->initFromGetVariables();
	}

	// }}}
	// {{{ public function setDirection()

	/**
	 * Sets the direction of ordering
	 * 
	 * This method sets the direction of ordering of the column, either asc,
	 * desc, or none.
	 *
	 * @param $direction integer One of the ORDER_BY_DIR_* class contants
	 * @param $set_as_orderby_column boolean Whether to set this column as the 
	 *                                    column currently used for ordering 
	 *                                    of the view
	 */
	public function setDirection($direction)
	{
		$this->direction = $direction;
		$this->default_direction = $direction;

		if ($this->view->orderby_column === null)
			$this->view->orderby_column = $this;

		$this->view->default_orderby_column = $this;

		$this->initFromGetVariables();
	}

	// }}}
	// {{{ public function displayHeader()

	/**
	 * Displays the column header for this table view column
	 *
	 * This method displays an appropriate header based on the current
	 * direction of ordering of this table view column. If the column has been
	 * ordered, an image indicating the ordering is also displayed in the
	 * header.
	 */
	public function displayHeader()
	{
		$anchor = new SwatHtmlTag('a');
		$anchor->href = $this->getLink();

{'fraction_non_alphanumeric': 0.0992209922099221, 'fraction_numerical': 0.0035533688670220036, 'mean_word_length': 3.1674259681093395, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1065381', 'n_tokens_mistral': 2285, 'n_tokens_neox': 2034, 'n_words': 731}