<?php
/*
* 项目: iOrange(橘子)
* 作者: 离家出走(yzxh24)
* Email: yzxh24@gmail.com
* 主页: www.iorange.cc
*/
/* vim: set ts=4 sw=4: */
class ColorRead
{
    private static $_style = array(
        //紫色
        1 => array(
            'name'  => '紫',
            'style' => 'a{color:#000000; font-size: 10pt;line-height:20px;}
a:hover{color:#000000; font-size: 10pt;line-height:20px;}
a:link{color:#000000; font-size: 10pt;line-height:20px;}
a:visited{color:#000000; font-size: 10pt;line-height:20px;}
a:active{color:#000000; font-size: 10pt;line-height:20px;}
body{font-size: 10pt;background-color:#F1AFF3;color:#000000; margin: 0px; padding: 0px;line-height:20px;}'
        ),
        //褐色
        2 => array(
               'name' => '褐',
               'style' => 'a{color:#ffffff; font-size: 10pt;line-height:20px;}
a:hover{color:#ffffff; font-size: 10pt;line-height:20px;}
a:link{color:#ffffff; font-size: 10pt;line-height:20px;}
a:visited{color:#ffffff; font-size: 10pt;line-height:20px;}
a:active{color:#ffffff; font-size: 10pt;line-height:20px;}
body{font-size: 10pt;background-color:#662A05;color:#ffffff; margin: 0px; padding: 0px;line-height:20px;}',
        ),
        //蓝色
        3 => array(
                'name'=>'蓝',
                'style'=> 'a{color:#000000; font-size: 10pt;line-height:20px;}
a:hover{color:#000000; font-size: 10pt;line-height:20px;}
a:link{color:#000000; font-size: 10pt;line-height:20px;}
a:visited{color:#000000; font-size: 10pt;line-height:20px;}
a:active{color:#000000; font-size: 10pt;line-height:20px;}
body{font-size: 10pt;background-color:#E7F4FE;color:#000000; margin: 0px; padding: 0px;line-height:20px;}',
        ),
        //绿色
        4 => array(
                'name' => '绿',
                'style'=>'a{color:#ffffff; font-size: 10pt;line-height:20px;}
a:hover{color:#ffffff; font-size: 10pt;line-height:20px;}
a:link{color:#ffffff; font-size: 10pt;line-height:20px;}
a:visited{color:#ffffff; font-size: 10pt;line-height:20px;}
a:active{color:#ffffff; font-size: 10pt;line-height:20px;}
body{font-size: 10pt;background-color:#006600;color:#ffffff; margin: 0px; padding: 0px;line-height:20px;}',
        ),
        //黑色
        5 => array(
                'name' => '黑',
                'style'=>'a{color:#ffffff; font-size: 10pt;line-height:20px;}
a:hover{color:#ffffff; font-size: 10pt;line-height:20px;}
a:link{color:#ffffff; font-size: 10pt;line-height:20px;}
a:visited{color:#ffffff; font-size: 10pt;line-height:20px;}
a:active{color:#ffffff; font-size: 10pt;line-height:20px;}
body{font-size: 10pt;background-color:#000000;color:#ffffff; margin: 0px; padding: 0px;line-height:20px;}',
        ),
        //柑色
        6 => array(
                'name' => '柑',
                'style'=> 'a{color:#0000FF; font-size:  10pt;line-height:20px;}
a:hover{color:#FFFFFF; font-size: 10pt;line-height:20px;}
a:link{color:#FFFFFF; font-size:  10pt;line-height:20px;}
a:visited{color:#FFFFFF; font-size:  10pt;line-height:20px;}
a:active{color:#FFFFFF; font-size:  10pt;line-height:20px;}
body{font-size: 10pt;background-color:#FAA755;color:#FFFFFF; margin: 0px; padding: 0px;line-height:20px;}',
        ),
    );

    private $_type = 1;

    public function  __construct($type = 1)
    {
        $this->_type = 1;
    }

    public static function css($style)
    {
        if (isset(self::$_style[$style]['style']))
        {
            return self::$_style[$style]['style'];
        }
        return false;
    }

    public static function styleSelect($style)
    {
        foreach (self::$_style as $key => $value)
        {
            $keys[$key] = $value['name'];
        }
        return $keys;
    }

    public static function styleUrl($style)
    {
        $get = (!empty($_GET) ? $_GET : array());
        unset($get['style']);
        $keys = self::styleSelect($style);
        $keys[0] = '原';
        foreach ($keys as $key => $value)
        {
            if ($style == $key)
            {
                $a[] = $value;
            }
            else
            {
                $a[] = ilink($value, url('read', array_merge($get, array('style'=>$key))));
            }
        }

        return $a;
    }

    public static function styles()
    {
        return array_keys(self::$_style);
    }
}