[ Index ] |
|
Code source de Dotclear 1.2.5 |
1 <?php 2 # ***** BEGIN LICENSE BLOCK ***** 3 # This file is part of DotClear. 4 # Copyright (c) 2004 Olivier Meunier and contributors. All rights 5 # reserved. 6 # 7 # DotClear is free software; you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation; either version 2 of the License, or 10 # (at your option) any later version. 11 # 12 # DotClear 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. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with DotClear; if not, write to the Free Software 19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 # 21 # ***** END LICENSE BLOCK ***** 22 23 class checkList 24 { 25 var $check = array(); 26 27 function checkList() 28 { 29 30 } 31 32 function addItem($name,$test,$on,$off) 33 { 34 $this->check[$name] = array( 35 'test' => (($test === NULL) ? NULL : (boolean) $test), 36 'on' => $on, 37 'off' => $off 38 ); 39 } 40 41 function checkAll() 42 { 43 foreach ($this->check as $v) { 44 if ($v['test'] === false) { 45 return false; 46 } 47 } 48 return true; 49 } 50 51 function checkItem($name) 52 { 53 if (!empty($this->check[$name])) { 54 return $this->check[$name]['test']; 55 } else { 56 return false; 57 } 58 } 59 60 function checkWarnings() 61 { 62 foreach ($this->check as $v) { 63 if ($v['test'] === NULL) { 64 return true; 65 } 66 } 67 return false; 68 } 69 70 function getHTML($img_on='',$img_off='',$img_wrn='') 71 { 72 $img_on = '<img src="'.$img_on.'" alt="ok" />'; 73 $img_off = '<img src="'.$img_off.'" alt="error" />'; 74 $img_wrn = '<img src="'.$img_wrn.'" alt="warning" />'; 75 76 $res = '<table summary="Checklist" class="install">'; 77 78 foreach ($this->check as $k => $v) 79 { 80 $ok = $v['test']; 81 if ($ok === NULL) { 82 $img = $img_wrn; 83 $str = $v['off']; 84 } elseif ($ok == false) { 85 $img = $img_off; 86 $str = $v['off']; 87 } elseif ($ok) { 88 $img = $img_on; 89 $str = $v['on']; 90 } 91 92 $res .= 93 '<tr>'. 94 '<td valign="top">'.$img.'</td>'. 95 '<td valign="top">'.$str.'</td>'. 96 '</tr>'; 97 } 98 99 $res .= '</table>'; 100 return $res; 101 } 102 } 103 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Feb 23 21:40:15 2007 | par Balluche grâce à PHPXref 0.7 |