1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

root/XoopsModules/translation/releases/1.01/translation/class/menu.php @ 8999

Revision 8999, 5.2 KB (checked in by txmodxoops, 15 months ago)

Module translation v1.01

Line 
1<?php
2/**
3 * ****************************************************************************
4 * Module généré par TDMCreate de la TDM "http://www.tdmxoops.net"
5 * ****************************************************************************
6 * TRANSLATION - MODULE FOR XOOPS AND IMPRESS CMS
7 * Copyright (c) txmod (webmaster@txmodxoops.org)
8 *
9 * You may not change or alter any portion of this comment or credits
10 * of supporting developers from this source code or any supporting source code
11 * which is considered copyrighted (c) material of the original comment or credit authors.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 *
16 * @copyright       txmod (http://www.txmodxoops.org)
17 * @license         GNU GPL
18 * @package         Translation
19 * @author          txmod (webmaster@txmodxoops.org)
20 *
21 * Version : 1.00:
22 * ****************************************************************************
23 */
24 
25class translationMenu
26{
27        public $Width = 100;
28        public $Height = 100;
29        public $BgColor = "transparent";
30        public $OverBgColor = "#FFF6C1";
31        public $BorderWidth = 1;
32        public $BorderColor = "#CCCCCC";
33        public $OverBorderColor = "#FF9900";
34        public $BorderStyle = "solid";
35        public $OverBorderStyle = "solid";
36        public $Font = "Tahoma, Arial, Helvetica";
37        public $FontColor = "#666666";
38        public $OverFontColor = "#1E90FF";
39        public $FontDeco = "none";
40        public $OverFontDeco = "none";
41        public $FontSize = 11;
42        public $FontWeight = "bold";
43        public $FontExtra = "Tahoma, Arial, Helvetica";
44        public $FontExtraColor = "#A98952";
45        public $OverFontExtraColor = "#0033FF";
46        public $FontExtraDeco = "underline";
47        public $OverFontExtraDeco = "underline";
48        public $FontExtraSize = 9;
49        public $FontExtraWeight = "normal";
50        public $TextAlign = "center";
51        private $_items = array();
52       
53        public function addItem($id, $link="", $icon="", $name="", $extra="", $alt=""){
54                if (isset($this->_items[$id])) return false;
55                $rtn["link"] = $link;
56                $rtn["icon"] = $icon;
57                $rtn["name"] = $name;
58                $rtn["extra"] = $extra;
59                $rtn["alt"] = $alt;
60                $this->_items[$id] = $rtn;
61                return true;
62        }
63       
64        public function setLink($id, $link){
65                if (isset($this->_items[$id])){
66                        $this->_items[$id]["link"] = $link;
67                        return true;
68                } else {
69                        return false;
70                }
71        }
72       
73        public function setIcon($id, $icon){
74                if (isset($this->_items[$id])){
75                        $this->_items[$id]["icon"] = $icon;
76                        return true;
77                } else {
78                        return false;
79                }
80        }
81       
82        public function setName($id, $name){
83                if (isset($this->_items[$id])){
84                        $this->_items[$id]["name"] = $name;
85                        return true;
86                } else {
87                        return false;
88                }
89        }
90       
91        public function setExtra($id, $extra){
92                if (isset($this->_items[$id])){
93                        $this->_items[$id]["extra"] = $extra;
94                        return true;
95                } else {
96                        return false;
97                }
98        }
99       
100        public function setAlt($id, $alt){
101                if (isset($this->_items[$id])){
102                        $this->_items[$id]["alt"] = $alt;
103                        return true;
104                } else {
105                        return false;
106                }
107        }
108       
109        public function getCSS($ws = true){
110                if ($ws) $csscode = "<style type=\"text/css\">\n<!--";
111                $csscode .= "div.rmmenuicon{
112                                margin: 3px;
113                                font-family: $this->Font;
114                                text-align: ".$this->TextAlign.";
115                        }
116                        div.rmmenuicon a {
117                                display: block; float: left;
118                                height: ".$this->Height."px !important;
119                                height: ".$this->Height."px;
120                                width: ".$this->Width."px !important;
121                                width: ".$this->Width."px;
122                                vertical-align: middle;
123                                text-decoration : none;
124                                border: ".$this->BorderWidth."px $this->BorderStyle $this->BorderColor;
125                                padding: 2px 5px 1px 5px;
126                                margin: 3px;
127                                color: $this->FontColor;
128                        }
129                        div.rmmenuicon img { margin-top: 8px; margin-bottom: 8px; }
130                        div.rmmenuicon a span {
131                                font-size: ".$this->FontSize."px;
132                                font-weight: $this->FontWeight;
133                                display: block;
134                        }
135                        div.rmmenuicon a span.uno{
136                                font-size: ".$this->FontExtraSize."px;
137                                font-weight: $this->FontExtraWeight;
138                                text-decoration: $this->FontExtraDeco;
139                                color: $this->FontExtraColor;
140                        }
141                        div.rmmenuicon a:hover{
142                                background-color: $this->OverBgColor;
143                                border: ".$this->BorderWidth."px $this->BorderStyle $this->OverBorderColor;
144                                color: $this->OverFontColor;
145                        }
146                        div.rmmenuicon a:hover span{
147                                text-decoration: $this->OverFontDeco;
148                        }
149                        div.rmmenuicon a:hover span.uno{
150                                text-decoration: $this->OverFontExtraDeco;
151                                color: $this->OverFontExtraColor;
152                        }";
153                if ($ws) $csscode .= "\n-->\n</style>";
154                return $csscode;
155        }
156       
157        public function render(){
158               
159                $ret = "<div class=\"rmmenuicon\">";
160                foreach ($this->_items as $k => $v){
161                        $ret .= "<a href=\"".$v["link"]."\" title=\"".($v["alt"]!="" ? $v["alt"] : $v["name"])."\">".($v["icon"]!="" ? "<img src=\"".$v["icon"]."\" alt=\"".$v["name"]."\" /> " : "");
162                        if ($v["name"] != "") $ret .= "<span>".$v["name"]."</span>";
163                        if ($v["extra"] != "") $ret .= "<span class=\"uno\">".$v["extra"]."</span>";
164                        // if ($v["extra"] != "") $ret .= "<span class=\"uno\">".$v["extra"]."</span>";
165                        $ret .= "</a>";
166                }
167                $ret .= "</div><div style=\"clear: both;\"></div>";
168                return $ret;
169        }
170       
171        public function display(){
172                echo $this->render();
173        }
174}
175       
176?>
Note: See TracBrowser for help on using the browser.