[ Index ] |
|
Code source de IMP H3 (4.1.5) |
1 <?php 2 3 require_once 'Horde/IMAP/Thread.php'; 4 5 /** 6 * The IMP_Thread class extends the IMAP_Thread class to include a function 7 * to generate the thread tree images. This class is necessary to ensure 8 * backwards compatibility with Horde 3.0. 9 * 10 * For the next (mythical) release of Horde 4.x, this code should be merged 11 * into the IMAP_Thread class. 12 * 13 * $Horde: imp/lib/IMAP/Thread.php,v 1.5.2.3 2007/01/02 13:54:58 jan Exp $ 14 * 15 * Copyright 2005-2007 Michael Slusarz <slusarz@curecanti.org> 16 * 17 * See the enclosed file COPYING for license information (GPL). If you 18 * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. 19 * 20 * @author Michael Slusarz <slusarz@curecanti.org> 21 * @since IMP 4.1 22 * @package IMP 23 */ 24 class IMP_Thread extends IMAP_Thread { 25 26 /** 27 * Cached value of the Horde graphics directory. 28 * 29 * @var string 30 */ 31 var $_graphicsdir; 32 33 /** 34 * Cached values of the thread image objects. 35 * 36 * @var string 37 */ 38 var $_imgcache = array(); 39 40 /** 41 * Generate the thread representation image for the given index list. 42 * 43 * @param array $indices The list of indices to create a tree for. 44 * @param boolean $sortdir True for newest first, false for oldest first. 45 * 46 * @return array An array with the index as the key and the thread image 47 * representation as the value. 48 */ 49 function getThreadImageTree($indices, $sortdir) 50 { 51 $container = $last_level = $last_thread = null; 52 $tree = array(); 53 54 if ($sortdir) { 55 $indices = array_reverse($indices); 56 } 57 58 foreach ($indices as $val) { 59 $tree[$val] = ''; 60 61 $indentBase = $this->getThreadBase($val); 62 if (empty($indentBase)) { 63 continue; 64 } 65 66 $lines = ''; 67 $indentLevel = $this->getThreadIndent($val); 68 $lastinlevel = $this->lastInLevel($val); 69 70 if ($lastinlevel && ($indentBase == $val)) { 71 continue; 72 } 73 74 if ($lastinlevel) { 75 $join_img = ($sortdir) ? 'joinbottom-down.png' : 'joinbottom.png'; 76 } elseif (($indentLevel == 1) && ($indentBase == $val)) { 77 $join_img = ($sortdir) ? 'joinbottom.png' : 'joinbottom-down.png'; 78 $container = $val; 79 } else { 80 $join_img = 'join.png'; 81 } 82 $threadLevel[$indentLevel] = $lastinlevel; 83 for ($i = ($container == $indentBase) ? 1 : 2; $i < $indentLevel; $i++) { 84 $lines .= $this->_image(!isset($threadLevel[$i]) || ($threadLevel[$i]) ? 'blank.png' : 'line.png'); 85 } 86 $tree[$val] = $lines . $this->_image($join_img); 87 } 88 89 return $tree; 90 } 91 92 /** 93 * Utility function to return a url for the various thread images. 94 * 95 * @access private 96 * 97 * @param string $name Image filename. 98 * 99 * @return string Link to the folder image. 100 */ 101 function _image($name) 102 { 103 if (!empty($this->_imgcache[$name])) { 104 return $this->_imgcache[$name]; 105 } 106 107 if (empty($this->_graphicsdir)) { 108 $this->_graphicsdir = $GLOBALS['registry']->getImageDir('horde'); 109 } 110 111 $this->_imgcache[$name] = Horde::img('tree/' . $name, '', 'style="vertical-align:middle"', $this->_graphicsdir); 112 113 return $this->_imgcache[$name]; 114 } 115 116 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 12:30:07 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |