Documentation TYPO3 par Ameos

postit.inc

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00041 if (!is_object($this)) die ('Error: No parent object present.');
00042 
00043 
00044 
00045 
00046 
00047 
00048 /***************************************************************
00049 TypoScript config:
00050 
00051 
00052 
00053 .data           [string / stdWrap]              The data for the notes. Every line is a new note. Each line is divided by "|" where the first part is the test, the second part is the type (1-) and the third part is the optional link (typolink-format)
00054 .charsPerLine   [string]                        The max number of chars per line of text on the note.
00055 .images.[x]             [image-contentObjects]   [x] is the type-number defined by the second parameter in each line of data.
00056 .textBox {
00057     chars                                               integer, the number of chars on each line
00058     lineDist                                    integer, the number of pixels between each line
00059     tmplObjNumber                               integer, pointer to the GIFBUILDER-OBJECT (of type TEXT!!) which serves as a TEMPLATE for the objects used to create the textlines
00060     Valign                                              string. If set to "center", the tmplObjNumber-TEXT-object is expected to be centeret in the image and calculations will be done to spred the lines above and below in case of multiple lines. (based on .angle of the TEXT object also.)
00061         maxLines
00062   }
00063 
00064 
00065 Example:
00066 
00067 
00068 // Postit:
00069 tt_content.splash.20 = PHP_SCRIPT
00070 tt_content.splash.20 {
00071   file = media/scripts/postit.inc
00072   data.field = bodytext
00073   cols = 3
00074   textBox {
00075     chars = 16
00076     lineDist = 18
00077     tmplObjNumber = 100
00078     Valign = center
00079         maxLines = 5
00080   }
00081   typolink {
00082     parameter.current = 1
00083     extTarget = {$styles.content.links.extTarget}
00084     target = {$styles.content.links.target}
00085   }
00086   images.1 = IMAGE
00087   images.1.file = GIFBUILDER
00088   images.1.file {
00089     XY = [5.w],[5.h]
00090     5 = IMAGE
00091     5.file = media/uploads/postit_1.gif
00092     100 = TEXT
00093     100.text = Testing
00094     100.offset = -5,60
00095     100.fontFile = fileadmin/fonts/arial_bold.ttf
00096     100.fontSize = 15
00097     100.align=center
00098   }
00099   images.2 < .images.1
00100   images.2.file.5.file = media/uploads/postit_2.gif
00101   images.2.file.100.angle = 11
00102   images.2.file.100.offset = -2,79
00103   images.3 < .images.1
00104   images.3.file.5.file = media/uploads/postit_3.gif
00105   images.3.file.100.angle = -13
00106   images.3.file.100.offset = -7,81
00107 }
00108 
00109 ****************************************************************/
00110 
00111 
00112 
00113 
00114 
00115 $data = $this->stdWrap($conf['data'],$conf['data.']);
00116 $cols = intval($conf['cols']) ? intval($conf['cols']) : 3;
00117 
00118 
00119 $lines = explode(chr(10),$data);
00120 $imageArr = array();
00121 while(list($key,$content)=each($lines)) {
00122         $content = trim($content);
00123         if ($content)   {
00124                 $parts = explode('|',$content);
00125                 $text = trim($parts[0]);
00126                 $type = t3lib_div::intInRange($parts[1],1,3);
00127                 $link = trim($parts[2]);
00128                 if ($text)      {
00129                         $imgConf = $conf['images.'][$type.'.'];
00130                         $imgConf['file.'] = $this->gifBuilderTextBox ($imgConf['file.'], $conf['textBox.'], $text);
00131 
00132                         $image = $this->IMAGE($imgConf);
00133                         if ($image)     {
00134                                 $this->setCurrentVal($link);
00135                                 $imageArr[] = $this->typolink($image,$conf['typolink.']);
00136                         }
00137                 }
00138         }
00139 }
00140 
00141 
00142 if (is_array($imageArr))        {
00143         reset($imageArr);
00144         if ($cols)      {
00145                 $res = '';
00146                 $rows = ceil(count($imageArr)/$cols);
00147 
00148                 for ($a=0;$a<$rows;$a++)        {
00149                         $res.='<tr>';
00150                         for ($b=0;$b<$cols;$b++)        {
00151                                 $res.='<td>'.$imageArr[(($a*$cols)+$b)].'</td>';
00152                         }
00153                         $res.='</tr>';
00154                 }
00155 
00156                 $content='<table border="0" cellspacing="0" cellpadding="0">'.$res.'</table>';
00157         } else {
00158                 $content.=implode($imageArr,'');
00159         }
00160 }
00161 
00162 ?>


Généré par Les spécialistes TYPO3 avec  doxygen 1.4.6