<?php
  include_once '../doc-typo3-funcs.php';
  $doxygen_vars = array(	"title" => "TYPO3 4.0.1: typo3_src-4.0.1/typo3/sysext/cms/tslib/media/scripts/postit.inc Source File",
				"datetime" => "Sat Dec 2 19:22:30 2006",
				"date" => "2 Dec 2006",
				"doxygenversion" => "1.4.6",
				"projectname" => "TYPO3 4.0.1",
				"projectnumber" => "4.0.1"
			);
  get_header($doxygen_vars);
?>
<!-- Generated by Doxygen 1.4.6 -->
<div class="tabs">
  <ul>
    <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="namespaces.html"><span>Namespaces</span></a></li>
    <li><a href="classes.html"><span>Classes</span></a></li>
    <li id="current"><a href="files.html"><span>Files</span></a></li>
    <li><a href="dirs.html"><span>Directories</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
    <li><a href="examples.html"><span>Examples</span></a></li>
    <li>
      <form action="search.php" method="get">
        <table cellspacing="0" cellpadding="0" border="0">
          <tr>
            <td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
            <td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
          </tr>
        </table>
      </form>
    </li>
  </ul></div>
<div class="nav">
<a class="el" href="dir_c8daf1ad746050abf985cc546c89e248.html">typo3_src-4.0.1</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_18071ae4545d8b3e0364d30c0659c74a.html">typo3</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_57bf1ed8249c1fd5b014486d01bcb27a.html">sysext</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_21aa24ee31dafa72450e939d0692a893.html">cms</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_da3d3c31fb60c430897a32b4a10f682b.html">tslib</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_5d5928c48a24a7022098bcc9e1331896.html">media</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_cdcc1b4ce87312c897e9f35885142bfd.html">scripts</a></div>
<h1>postit.inc</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 &lt;?php
<a name="l00002"></a>00002 <span class="comment">/***************************************************************</span>
<a name="l00003"></a>00003 <span class="comment">*  Copyright notice</span>
<a name="l00004"></a>00004 <span class="comment">*</span>
<a name="l00005"></a>00005 <span class="comment">*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)</span>
<a name="l00006"></a>00006 <span class="comment">*  All rights reserved</span>
<a name="l00007"></a>00007 <span class="comment">*</span>
<a name="l00008"></a>00008 <span class="comment">*  This script is part of the TYPO3 project. The TYPO3 project is</span>
<a name="l00009"></a>00009 <span class="comment">*  free software; you can redistribute it and/or modify</span>
<a name="l00010"></a>00010 <span class="comment">*  it under the terms of the GNU General Public License as published by</span>
<a name="l00011"></a>00011 <span class="comment">*  the Free Software Foundation; either version 2 of the License, or</span>
<a name="l00012"></a>00012 <span class="comment">*  (at your option) any later version.</span>
<a name="l00013"></a>00013 <span class="comment">*</span>
<a name="l00014"></a>00014 <span class="comment">*  The GNU General Public License can be found at</span>
<a name="l00015"></a>00015 <span class="comment">*  http://www.gnu.org/copyleft/gpl.html.</span>
<a name="l00016"></a>00016 <span class="comment">*  A copy is found in the textfile GPL.txt and important notices to the license</span>
<a name="l00017"></a>00017 <span class="comment">*  from the author is found in LICENSE.txt distributed with these scripts.</span>
<a name="l00018"></a>00018 <span class="comment">*</span>
<a name="l00019"></a>00019 <span class="comment">*</span>
<a name="l00020"></a>00020 <span class="comment">*  This script is distributed in the hope that it will be useful,</span>
<a name="l00021"></a>00021 <span class="comment">*  but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00022"></a>00022 <span class="comment">*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00023"></a>00023 <span class="comment">*  GNU General Public License for more details.</span>
<a name="l00024"></a>00024 <span class="comment">*</span>
<a name="l00025"></a>00025 <span class="comment">*  This copyright notice MUST APPEAR in all copies of the script!</span>
<a name="l00026"></a>00026 <span class="comment">***************************************************************/</span>
<a name="l00041"></a>00041 <span class="keywordflow">if</span> (!is_object($this)) die ('Error: No parent object present.');
<a name="l00042"></a>00042 
<a name="l00043"></a>00043 
<a name="l00044"></a>00044 
<a name="l00045"></a>00045 
<a name="l00046"></a>00046 
<a name="l00047"></a>00047 
<a name="l00048"></a>00048 <span class="comment">/***************************************************************</span>
<a name="l00049"></a>00049 <span class="comment">TypoScript config:</span>
<a name="l00050"></a>00050 <span class="comment"></span>
<a name="l00051"></a>00051 <span class="comment"></span>
<a name="l00052"></a>00052 <span class="comment"></span>
<a name="l00053"></a>00053 <span class="comment">.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)</span>
<a name="l00054"></a>00054 <span class="comment">.charsPerLine   [string]                        The max number of chars per line of text on the note.</span>
<a name="l00055"></a>00055 <span class="comment">.images.[x]             [image-contentObjects]   [x] is the type-number defined by the second parameter in each line of data.</span>
<a name="l00056"></a>00056 <span class="comment">.textBox {</span>
<a name="l00057"></a>00057 <span class="comment">    chars                                               integer, the number of chars on each line</span>
<a name="l00058"></a>00058 <span class="comment">    lineDist                                    integer, the number of pixels between each line</span>
<a name="l00059"></a>00059 <span class="comment">    tmplObjNumber                               integer, pointer to the GIFBUILDER-OBJECT (of type TEXT!!) which serves as a TEMPLATE for the objects used to create the textlines</span>
<a name="l00060"></a>00060 <span class="comment">    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.)</span>
<a name="l00061"></a>00061 <span class="comment">        maxLines</span>
<a name="l00062"></a>00062 <span class="comment">  }</span>
<a name="l00063"></a>00063 <span class="comment"></span>
<a name="l00064"></a>00064 <span class="comment"></span>
<a name="l00065"></a>00065 <span class="comment">Example:</span>
<a name="l00066"></a>00066 <span class="comment"></span>
<a name="l00067"></a>00067 <span class="comment"></span>
<a name="l00068"></a>00068 <span class="comment">// Postit:</span>
<a name="l00069"></a>00069 <span class="comment">tt_content.splash.20 = PHP_SCRIPT</span>
<a name="l00070"></a>00070 <span class="comment">tt_content.splash.20 {</span>
<a name="l00071"></a>00071 <span class="comment">  file = media/scripts/postit.inc</span>
<a name="l00072"></a>00072 <span class="comment">  data.field = bodytext</span>
<a name="l00073"></a>00073 <span class="comment">  cols = 3</span>
<a name="l00074"></a>00074 <span class="comment">  textBox {</span>
<a name="l00075"></a>00075 <span class="comment">    chars = 16</span>
<a name="l00076"></a>00076 <span class="comment">    lineDist = 18</span>
<a name="l00077"></a>00077 <span class="comment">    tmplObjNumber = 100</span>
<a name="l00078"></a>00078 <span class="comment">    Valign = center</span>
<a name="l00079"></a>00079 <span class="comment">        maxLines = 5</span>
<a name="l00080"></a>00080 <span class="comment">  }</span>
<a name="l00081"></a>00081 <span class="comment">  typolink {</span>
<a name="l00082"></a>00082 <span class="comment">    parameter.current = 1</span>
<a name="l00083"></a>00083 <span class="comment">    extTarget = {$styles.content.links.extTarget}</span>
<a name="l00084"></a>00084 <span class="comment">    target = {$styles.content.links.target}</span>
<a name="l00085"></a>00085 <span class="comment">  }</span>
<a name="l00086"></a>00086 <span class="comment">  images.1 = IMAGE</span>
<a name="l00087"></a>00087 <span class="comment">  images.1.file = GIFBUILDER</span>
<a name="l00088"></a>00088 <span class="comment">  images.1.file {</span>
<a name="l00089"></a>00089 <span class="comment">    XY = [5.w],[5.h]</span>
<a name="l00090"></a>00090 <span class="comment">    5 = IMAGE</span>
<a name="l00091"></a>00091 <span class="comment">    5.file = media/uploads/postit_1.gif</span>
<a name="l00092"></a>00092 <span class="comment">    100 = TEXT</span>
<a name="l00093"></a>00093 <span class="comment">    100.text = Testing</span>
<a name="l00094"></a>00094 <span class="comment">    100.offset = -5,60</span>
<a name="l00095"></a>00095 <span class="comment">    100.fontFile = fileadmin/fonts/arial_bold.ttf</span>
<a name="l00096"></a>00096 <span class="comment">    100.fontSize = 15</span>
<a name="l00097"></a>00097 <span class="comment">    100.align=center</span>
<a name="l00098"></a>00098 <span class="comment">  }</span>
<a name="l00099"></a>00099 <span class="comment">  images.2 &lt; .images.1</span>
<a name="l00100"></a>00100 <span class="comment">  images.2.file.5.file = media/uploads/postit_2.gif</span>
<a name="l00101"></a>00101 <span class="comment">  images.2.file.100.angle = 11</span>
<a name="l00102"></a>00102 <span class="comment">  images.2.file.100.offset = -2,79</span>
<a name="l00103"></a>00103 <span class="comment">  images.3 &lt; .images.1</span>
<a name="l00104"></a>00104 <span class="comment">  images.3.file.5.file = media/uploads/postit_3.gif</span>
<a name="l00105"></a>00105 <span class="comment">  images.3.file.100.angle = -13</span>
<a name="l00106"></a>00106 <span class="comment">  images.3.file.100.offset = -7,81</span>
<a name="l00107"></a>00107 <span class="comment">}</span>
<a name="l00108"></a>00108 <span class="comment"></span>
<a name="l00109"></a>00109 <span class="comment">****************************************************************/</span>
<a name="l00110"></a>00110 
<a name="l00111"></a>00111 
<a name="l00112"></a>00112 
<a name="l00113"></a>00113 
<a name="l00114"></a>00114 
<a name="l00115"></a>00115 $data = $this-&gt;stdWrap($conf['data'],$conf['data.']);
<a name="l00116"></a>00116 $cols = intval($conf['cols']) ? intval($conf['cols']) : 3;
<a name="l00117"></a>00117 
<a name="l00118"></a>00118 
<a name="l00119"></a>00119 $lines = explode(chr(10),$data);
<a name="l00120"></a>00120 $imageArr = array();
<a name="l00121"></a>00121 <span class="keywordflow">while</span>(list($key,$content)=each($lines)) {
<a name="l00122"></a>00122         $content = trim($content);
<a name="l00123"></a>00123         <span class="keywordflow">if</span> ($content)   {
<a name="l00124"></a>00124                 $parts = explode(<span class="charliteral">'|'</span>,$content);
<a name="l00125"></a>00125                 $text = trim($parts[0]);
<a name="l00126"></a>00126                 $type = <a class="code" href="classt3lib__div.html#79f6a47a7658e28e3f65666f8ebc19f8">t3lib_div::intInRange</a>($parts[1],1,3);
<a name="l00127"></a>00127                 $link = trim($parts[2]);
<a name="l00128"></a>00128                 <span class="keywordflow">if</span> ($text)      {
<a name="l00129"></a>00129                         $imgConf = $conf['images.'][$type.<span class="charliteral">'.'</span>];
<a name="l00130"></a>00130                         $imgConf['file.'] = $this-&gt;gifBuilderTextBox ($imgConf['file.'], $conf['textBox.'], $text);
<a name="l00131"></a>00131 
<a name="l00132"></a>00132                         $image = $this-&gt;IMAGE($imgConf);
<a name="l00133"></a>00133                         <span class="keywordflow">if</span> ($image)     {
<a name="l00134"></a>00134                                 $this-&gt;setCurrentVal($link);
<a name="l00135"></a>00135                                 $imageArr[] = $this-&gt;typolink($image,$conf['typolink.']);
<a name="l00136"></a>00136                         }
<a name="l00137"></a>00137                 }
<a name="l00138"></a>00138         }
<a name="l00139"></a>00139 }
<a name="l00140"></a>00140 
<a name="l00141"></a>00141 
<a name="l00142"></a>00142 <span class="keywordflow">if</span> (is_array($imageArr))        {
<a name="l00143"></a>00143         reset($imageArr);
<a name="l00144"></a>00144         <span class="keywordflow">if</span> ($cols)      {
<a name="l00145"></a>00145                 $res = '';
<a name="l00146"></a>00146                 $rows = ceil(count($imageArr)/$cols);
<a name="l00147"></a>00147 
<a name="l00148"></a>00148                 <span class="keywordflow">for</span> ($a=0;$a&lt;$rows;$a++)        {
<a name="l00149"></a>00149                         $res.='&lt;tr&gt;';
<a name="l00150"></a>00150                         <span class="keywordflow">for</span> ($b=0;$b&lt;$cols;$b++)        {
<a name="l00151"></a>00151                                 $res.='&lt;td&gt;'.$imageArr[(($a*$cols)+$b)].'&lt;/td&gt;';
<a name="l00152"></a>00152                         }
<a name="l00153"></a>00153                         $res.='&lt;/tr&gt;';
<a name="l00154"></a>00154                 }
<a name="l00155"></a>00155 
<a name="l00156"></a>00156                 $content='&lt;table border=<span class="stringliteral">"0"</span> cellspacing=<span class="stringliteral">"0"</span> cellpadding=<span class="stringliteral">"0"</span>&gt;'.$res.'&lt;/table&gt;';
<a name="l00157"></a>00157         } <span class="keywordflow">else</span> {
<a name="l00158"></a>00158                 $content.=implode($imageArr,'');
<a name="l00159"></a>00159         }
<a name="l00160"></a>00160 }
<a name="l00161"></a>00161 
<a name="l00162"></a>00162 ?&gt;
</pre></div><?php
  include_once '../doc-typo3-funcs.php';
  get_footer();
?>