Swat/SwatBooleanCellRenderer.php
public function setFromStock($stock_id, $overwrite_properties = true)
    {
        $content_type = 'text/plain';

        switch ($stock_id) {
            case 'yes-no':
                $false_content = Swat::_('No');
                $true_content = Swat::_('Yes');
                break;

            case 'check-only':
                $content_type = 'text/xml';
                $false_content = ' '; // non-breaking space

                ob_start();
                $this->displayCheck();
                $true_content = ob_get_clean();
                break;

            default:
                throw new SwatUndefinedStockTypeException(
                    "Stock type with id of '{$stock_id}' not found.",
                    0,
                    $stock_id
                );
        }

        if ($overwrite_properties || $this->false_content === null) {
            $this->false_content = $false_content;
        }

        if ($overwrite_properties || $this->true_content === null) {
            $this->true_content = $true_content;
        }

        if ($overwrite_properties || $this->content_type === null) {
            $this->content_type = $content_type;
        }
    }
public function setFromStock($stock_id, $overwrite_properties = true)
    {
        $content_type = 'text/plain';

        switch ($stock_id) {
            case 'yes-no':
                $false_content = Swat::_('No');
                $true_content = Swat::_('Yes');
                break;

            case 'check-only':
                $content_type = 'text/xml';
                $false_content = ' '; // non-breaking space

                ob_start();
                $this->displayCheck();
                $true_content = ob_get_clean();
                break;

            default:
                throw new SwatUndefinedStockTypeException(
                    "Stock type with id of '{$stock_id}' not found.",
                    0,
                    $stock_id
                );
        }

        if ($overwrite_properties || $this->false_content === null) {
            $this->false_content = $false_content;
        }

        if ($overwrite_properties || $this->true_content === null) {
            $this->true_content = $true_content;
        }

        if ($overwrite_properties || $this->content_type === null) {
            $this->content_type = $content_type;
        }
    }
public function setFromStock ( $ stock_id , $ overwrite_properties = true ) { $ content_type = 'text/plain' ; switch ( $ stock_id ) { case 'yes-no' : $ false_content = Swat :: _ ( 'No' ) ; $ true_content = Swat :: _ ( 'Yes' ) ; break ; case 'check-only' : $ content_type = 'text/xml' ; $ false_content = ' '; / non-breaking space ob_start ( ) ; $ this -> displayCheck ( ) ; $ true_content = ob_get_clean ( ) ; break ; default : throw new SwatUndefinedStockTypeException ( "Stock type with id of '{$stock_id}' not found." , 0 , $ stock_id ) ; } if ( $ overwrite_properties || $ this -> false_content === null ) { $ this -> false_content = $ false_content ; } if ( $ overwrite_properties || $ this -> true_content === null ) { $ this -> true_content = $ true_content ; } if ( $ overwrite_properties || $ this -> content_type === null ) { $ this -> content_type = $ content_type ; } }
Sets the values of this boolean cell renderer to a stock type

Valid stock type ids are:

- check-only
- yes-no

@param string $stock_id the identifier of the stock type to use.
@param boolean $overwrite_properties optional. Whether to overwrite
properties if they are already set.
By default, properties are
overwritten.

@throws SwatUndefinedStockTypeException if an undefined <i>$stock_id</i>
is used.
Sets the values of this boolean cell renderer to a stock type