Upgraded phpmyadmin to 4.0.4 (All Languages) - No modifications yet
[openemr.git] / phpmyadmin / doc / html / transformations.html
blob887884e1a48c562666bd72ca463d71d9392fd6a6
3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
7 <html xmlns="http://www.w3.org/1999/xhtml">
8 <head>
9 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
11 <title>Transformations &mdash; phpMyAdmin 4.0.4 documentation</title>
13 <link rel="stylesheet" href="_static/default.css" type="text/css" />
14 <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
16 <script type="text/javascript">
17 var DOCUMENTATION_OPTIONS = {
18 URL_ROOT: '',
19 VERSION: '4.0.4',
20 COLLAPSE_INDEX: false,
21 FILE_SUFFIX: '.html',
22 HAS_SOURCE: true
24 </script>
25 <script type="text/javascript" src="_static/jquery.js"></script>
26 <script type="text/javascript" src="_static/underscore.js"></script>
27 <script type="text/javascript" src="_static/doctools.js"></script>
28 <link rel="copyright" title="Copyright" href="copyright.html" />
29 <link rel="top" title="phpMyAdmin 4.0.4 documentation" href="index.html" />
30 <link rel="up" title="User Guide" href="user.html" />
31 <link rel="next" title="User management" href="privileges.html" />
32 <link rel="prev" title="User Guide" href="user.html" />
33 </head>
34 <body>
35 <div class="related">
36 <h3>Navigation</h3>
37 <ul>
38 <li class="right" style="margin-right: 10px">
39 <a href="genindex.html" title="General Index"
40 accesskey="I">index</a></li>
41 <li class="right" >
42 <a href="privileges.html" title="User management"
43 accesskey="N">next</a> |</li>
44 <li class="right" >
45 <a href="user.html" title="User Guide"
46 accesskey="P">previous</a> |</li>
47 <li><a href="index.html">phpMyAdmin 4.0.4 documentation</a> &raquo;</li>
48 <li><a href="user.html" accesskey="U">User Guide</a> &raquo;</li>
49 </ul>
50 </div>
52 <div class="document">
53 <div class="documentwrapper">
54 <div class="bodywrapper">
55 <div class="body">
57 <div class="section" id="transformations">
58 <span id="id1"></span><h1>Transformations<a class="headerlink" href="#transformations" title="Permalink to this headline"></a></h1>
59 <div class="section" id="introduction">
60 <span id="transformationsintro"></span><h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline"></a></h2>
61 <p>To enable transformations, you have to setup the <tt class="docutils literal"><span class="pre">column_info</span></tt>
62 table and the proper directives. Please see the <a class="reference internal" href="config.html#config"><em>Configuration</em></a> on how to do so.</p>
63 <p>You can apply different transformations to the contents of each
64 column. The transformation will take the content of each column and
65 transform it with certain rules defined in the selected
66 transformation.</p>
67 <p>Say you have a column &#8216;filename&#8217; which contains a filename. Normally
68 you would see in phpMyAdmin only this filename. Using transformations
69 you can transform that filename into a HTML link, so you can click
70 inside of the phpMyAdmin structure on the column&#8217;s link and will see
71 the file displayed in a new browser window. Using transformation
72 options you can also specify strings to append/prepend to a string or
73 the format you want the output stored in.</p>
74 <p>For a general overview of all available transformations and their
75 options, you can consult your <em>&lt;www.your-host.com&gt;/&lt;your-install-
76 dir&gt;/transformation_overview.php</em> installation.</p>
77 <p>For a tutorial on how to effectively use transformations, see our
78 <a class="reference external" href="http://www.phpmyadmin.net/home_page/docs.php">Link section</a> on the
79 official phpMyAdmin homepage.</p>
80 </div>
81 <div class="section" id="usage">
82 <span id="transformationshowto"></span><h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2>
83 <p>Go to your <em>tbl_structure.php</em> page (i.e. reached through clicking on
84 the &#8216;Structure&#8217; link for a table). There click on &#8220;Change&#8221; (or change
85 icon) and there you will see three new fields at the end of the line.
86 They are called &#8216;MIME-type&#8217;, &#8216;Browser transformation&#8217; and
87 &#8216;Transformation options&#8217;.</p>
88 <ul class="simple">
89 <li>The field &#8216;MIME-type&#8217; is a drop-down field. Select the MIME-type that
90 corresponds to the column&#8217;s contents. Please note that transformations
91 are inactive as long as no MIME-type is selected.</li>
92 <li>The field &#8216;Browser transformation&#8217; is a drop-down field. You can
93 choose from a hopefully growing amount of pre-defined transformations.
94 See below for information on how to build your own transformation.
95 There are global transformations and mimetype-bound transformations.
96 Global transformations can be used for any mimetype. They will take
97 the mimetype, if necessary, into regard. Mimetype-bound
98 transformations usually only operate on a certain mimetype. There are
99 transformations which operate on the main mimetype (like &#8216;image&#8217;),
100 which will most likely take the subtype into regard, and those who
101 only operate on a specific subtype (like &#8216;image/jpeg&#8217;). You can use
102 transformations on mimetypes for which the function was not defined
103 for. There is no security check for you selected the right
104 transformation, so take care of what the output will be like.</li>
105 <li>The field &#8216;Transformation options&#8217; is a free-type textfield. You have
106 to enter transform-function specific options here. Usually the
107 transforms can operate with default options, but it is generally a
108 good idea to look up the overview to see which options are necessary.
109 Much like the ENUM/SET-Fields, you have to split up several options
110 using the format &#8216;a&#8217;,&#8217;b&#8217;,&#8217;c&#8217;,...(NOTE THE MISSING BLANKS). This is
111 because internally the options will be parsed as an array, leaving the
112 first value the first element in the array, and so forth. If you want
113 to specify a MIME character set you can define it in the
114 transformation_options. You have to put that outside of the pre-
115 defined options of the specific mime-transform, as the last value of
116 the set. Use the format &#8220;&#8217;; charset=XXX&#8217;&#8221;. If you use a transform, for
117 which you can specify 2 options and you want to append a character
118 set, enter &#8220;&#8216;first parameter&#8217;,&#8217;second parameter&#8217;,&#8217;charset=us-ascii&#8217;&#8221;.
119 You can, however use the defaults for the parameters: &#8220;&#8217;&#8216;,&#8217;&#8216;,&#8217;charset
120 =us-ascii&#8217;&#8221;.</li>
121 </ul>
122 </div>
123 <div class="section" id="file-structure">
124 <span id="transformationsfiles"></span><h2>File structure<a class="headerlink" href="#file-structure" title="Permalink to this headline"></a></h2>
125 <p>All specific transformations for mimetypes are defined through class
126 files in the directory &#8216;libraries/plugins/transformations/&#8217;. Each of
127 them extends a certain transformation abstract class declared in
128 libraries/plugins/transformations/abstract.</p>
129 <p>They are stored in files to ease up customization and easy adding of
130 new transformations.</p>
131 <p>Because the user cannot enter own mimetypes, it is kept sure that
132 transformations always work. It makes no sense to apply a
133 transformation to a mimetype the transform-function doesn&#8217;t know to
134 handle.</p>
135 <p>There is a file called &#8216;<em>transformations.lib.php</em>&#8216; that provides some
136 basic functions which can be included by any other transform function.</p>
137 <p>The file name convention is <tt class="docutils literal"><span class="pre">[Mimetype]_[Subtype]_[Transformation</span>
138 <span class="pre">Name].class.php</span></tt>, while the abtract class that it extends has the
139 name <tt class="docutils literal"><span class="pre">[Transformation</span> <span class="pre">Name]TransformationsPlugin</span></tt>. All of the
140 methods that have to be implemented by a transformations plug-in are:</p>
141 <ol class="arabic simple">
142 <li>getMIMEType() and getMIMESubtype() in the main class;</li>
143 <li>getName(), getInfo() and applyTransformation() in the abstract class
144 it extends.</li>
145 </ol>
146 <p>The getMIMEType(), getMIMESubtype() and getName() methods return the
147 name of the MIME type, MIME Subtype and transformation accordingly.
148 getInfo() returns the transformation&#8217;s description and possible
149 options it may receive and applyTransformation() is the method that
150 does the actual work of the transformation plug-in.</p>
151 <p>Please see the libraries/plugins/transformations/TEMPLATE and
152 libraries/plugins/transformations/TEMPLATE_ABSTRACT files for adding
153 your own transformation plug-in. You can also generate a new
154 transformation plug-in (with or without the abstract transformation
155 class), by using
156 <tt class="file docutils literal"><span class="pre">libraries/plugins/transformations/generator_plugin.sh</span></tt> or
157 <tt class="file docutils literal"><span class="pre">libraries/plugins/transformations/generator_main_class.sh</span></tt>.</p>
158 <p>The applyTransformation() method always gets passed three variables:</p>
159 <ol class="arabic simple">
160 <li><strong>$buffer</strong> - Contains the text inside of the column. This is the
161 text, you want to transform.</li>
162 <li><strong>$options</strong> - Contains any user-passed options to a transform
163 function as an array.</li>
164 <li><strong>$meta</strong> - Contains an object with information about your column. The
165 data is drawn from the output of the <a class="reference external" href="http://www.php.net/mysql_fetch_field">mysql_fetch_field()</a> function. This means, all
166 object properties described on the <a class="reference external" href="http://www.php.net/mysql_fetch_field">manual page</a> are available in this
167 variable and can be used to transform a column accordingly to
168 unsigned/zerofill/not_null/... properties. The $meta-&gt;mimetype
169 variable contains the original MIME-type of the column (i.e.
170 &#8216;text/plain&#8217;, &#8216;image/jpeg&#8217; etc.)</li>
171 </ol>
172 </div>
173 </div>
176 </div>
177 </div>
178 </div>
179 <div class="sphinxsidebar">
180 <div class="sphinxsidebarwrapper">
181 <h3><a href="index.html">Table Of Contents</a></h3>
182 <ul>
183 <li><a class="reference internal" href="#">Transformations</a><ul>
184 <li><a class="reference internal" href="#introduction">Introduction</a></li>
185 <li><a class="reference internal" href="#usage">Usage</a></li>
186 <li><a class="reference internal" href="#file-structure">File structure</a></li>
187 </ul>
188 </li>
189 </ul>
191 <h4>Previous topic</h4>
192 <p class="topless"><a href="user.html"
193 title="previous chapter">User Guide</a></p>
194 <h4>Next topic</h4>
195 <p class="topless"><a href="privileges.html"
196 title="next chapter">User management</a></p>
197 <h3>This Page</h3>
198 <ul class="this-page-menu">
199 <li><a href="_sources/transformations.txt"
200 rel="nofollow">Show Source</a></li>
201 </ul>
202 <div id="searchbox" style="display: none">
203 <h3>Quick search</h3>
204 <form class="search" action="search.html" method="get">
205 <input type="text" name="q" />
206 <input type="submit" value="Go" />
207 <input type="hidden" name="check_keywords" value="yes" />
208 <input type="hidden" name="area" value="default" />
209 </form>
210 <p class="searchtip" style="font-size: 90%">
211 Enter search terms or a module, class or function name.
212 </p>
213 </div>
214 <script type="text/javascript">$('#searchbox').show(0);</script>
215 </div>
216 </div>
217 <div class="clearer"></div>
218 </div>
219 <div class="related">
220 <h3>Navigation</h3>
221 <ul>
222 <li class="right" style="margin-right: 10px">
223 <a href="genindex.html" title="General Index"
224 >index</a></li>
225 <li class="right" >
226 <a href="privileges.html" title="User management"
227 >next</a> |</li>
228 <li class="right" >
229 <a href="user.html" title="User Guide"
230 >previous</a> |</li>
231 <li><a href="index.html">phpMyAdmin 4.0.4 documentation</a> &raquo;</li>
232 <li><a href="user.html" >User Guide</a> &raquo;</li>
233 </ul>
234 </div>
235 <div class="footer">
236 &copy; <a href="copyright.html">Copyright</a> 2012 - 2013, The phpMyAdmin devel team.
237 Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
238 </div>
239 </body>
240 </html>