Location: PHPKode > scripts > Schedule > schedule/documentation.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Class: Schedule</title>
    <style type='text/css'>
    <!--
      body,td { font: 8pt Verdana, Tahoma; color: #000000; }
      body { background-color: #EEEEEE; }
      .box { border: 1px solid #C0C0C0; padding: 5px; }
      .title { font-size: 14pt; font-weight: bold; color: #FFFFFF; }
      .titlebox { border: 1px solid #C0C0C0; background-color: #F0F0F0; padding: 8px; }
      .titletext { font-size: 10pt; font-weight: bold; color: #000099; }
      hr { height: 1px; color: #000099; background-color: #000099; }
      a { color: #000099; text-decoration: none; }
      a:hover { text-decoration: underline; }
    -->
    </style>
  </head>
  <body>
    <a name='top'></a>
    <div style='position: absolute; left: 0; top: 68px; width: 30%; padding: 10px;'>
      <br /><strong>Variables</strong>:<br />
      <a href='#' onClick='javascript:;' title="Image width &#13;Access: public">integer Schedule::width</a><br />
      <a href='#' onClick='javascript:;' title="Image height &#13;Access: public">integer Schedule::height</a><br />
      <a href='#' onClick='javascript:;' title="Background settings (color) &#13;Access: public">array Schedule::bg</a><br />
      <a href='#' onClick='javascript:;' title="Grid settings (color) &#13;Access: public">array Schedule::grid</a><br />
      <a href='#' onClick='javascript:;' title="Schedule settings (color) &#13;Access: public">array Schedule::schedule</a><br />
      <a href='#' onClick='javascript:;' title="Legend settings (color, font, padding) &#13;Access: public">array Schedule::legend</a><br />
      <a href='#' onClick='javascript:;' title="Block settings (color, font, padding, alpha) &#13;Access: public">array Schedule::block</a><br />
      <a href='#' onClick='javascript:;' title="XML struct &#13;Access: private">array Schedule::struct</a><br />
      <a href='#' onClick='javascript:;' title="Image resource &#13;Access: private">resource Schedule::im</a><br />
      <br /><strong>Methods</strong>:<br />
      <a href='#m97' title="Class constructor (can load a $xml data/file) &#13;Access: ">Schedule::Schedule()</a><br />
      <a href='#m136' title="Load data from file &#13;Access: public">Schedule::LoadXmlFile()</a><br />
      <a href='#m156' title="Parse data &#13;Access: public">Schedule::LoadXmlData()</a><br />
      <a href='#m205' title="Draw schedule &#13;Access: public">Schedule::Draw()</a><br />
      <a href='#m248' title="Draw schedule background &#13;Access: private">Schedule::DrawBackground()</a><br />
      <a href='#m261' title="Draw schedule grid according to schedule pointer &#13;Access: private">Schedule::DrawGrid()</a><br />
      <a href='#m344' title="Draw schedule blocks for all days given the schedule pointer &#13;Access: private">Schedule::DrawDays()</a><br />
      <a href='#m364' title="Updates settings from xml array &#13;Access: private">Schedule::UpdateSettings()</a><br />
      <a href='#m382' title="Updates settings to a part of the schedule class (block, legend, ..) &#13;Access: private">Schedule::UpdatePartSettings()</a><br />
      <a href='#m420' title="Sets (depending on value) a variable or array position (given a key) &#13;Access: private">Schedule::SetVar()</a><br />
      <a href='#m448' title="Draw a group of blocks in a given day &#13;Access: private">Schedule::DrawBlocks()</a><br />
      <a href='#m525' title="Given a string and the max value to 100%, it will return the value corresponding to that percentage e.g.: GetPercent('25%', 40) = 10 &#13;Access: private">Schedule::GetPercent()</a><br />
      <a href='#m540' title="Transforms an hex RGB string into a PHP RGB array &#13;Access: private">Schedule::GetColor()</a><br />
      <a href='#m571' title="Returns coordinates of the 4 corners of a block to draw in the image &#13;Access: private">Schedule::GetCoords()</a><br />
      <a href='#m591' title="Returns the align if it's valid or the first valid align &#13;Access: private">Schedule::GetAlign()</a><br />
      <a href='#m611' title="Draws the description of a block given the 4 corners of the block and some more settings &#13;Access: private">Schedule::DrawDescription()</a><br />
      <a href='#m667' title="Draw text given (x,y) points, font, color, horizontal and vertical align &#13;Access: private">Schedule::DrawText()</a><br />
      <a href='#m690' title="Draws a rectangle given the 4 corner points, border and background color &#13;Access: private">Schedule::DrawRectangle()</a><br />
      <a href='#m706' title="Allocates a color (if needed) and sets a variable with the index of that color (alpha is added if possible [GD2]) &#13;Access: private">Schedule::AllocateColor()</a><br />
      <a href='#m734' title="Resets the indexes of an array &#13;Access: private">Schedule::ReorganizeArray()</a><br />
    </div>
    <div style='position: absolute; right: 0; top: 68px; padding: 10px; width: 70%; height: 100%; background-color: #FFFFFF; border-left: 1px dashed #909090;'>
      <a name='m97'>
      <div width=100%>
        <div class=titlebox>[ <a href='#top'>Top</a> ] void <span class=titletext>Schedule::Schedule()</span> [line 97]</div>
        <div style='padding: 2px'></div>
        <div class=box>
          Class constructor (can load a $xml data/file) 
          <br /><br />
          <u>Parameters</u><br />
          <table border=0 cellspacing=0 cellpadding=1>
            <tr valign=top><td width=70 align=right>string&nbsp;</td><td><strong>$xml</strong></td><td>&nbsp;XML file or data</td></tr>
            <tr valign=top><td width=70 align=right>boolean&nbsp;</td><td><strong>$file</strong></td><td>&nbsp;Indicates whether $xml is a file or not (data)</td></tr>
          </table>
        </div>
        <div style='padding: 10px'></div>
      </div>
      <a name='m136'>
      <div width=100%>
        <div class=titlebox>[ <a href='#top'>Top</a> ] void <span class=titletext>Schedule::LoadXmlFile()</span> [line 136]</div>
        <div style='padding: 2px'></div>
        <div class=box>
          Load data from file 
          <br /><br />
          <u>Parameters</u><br />
          <table border=0 cellspacing=0 cellpadding=1>
            <tr valign=top><td width=70 align=right>string&nbsp;</td><td><strong>$file</strong></td><td>&nbsp;Path to filename</td></tr>
          </table>
        </div>
        <div style='padding: 10px'></div>
      </div>
      <a name='m156'>
      <div width=100%>
        <div class=titlebox>[ <a href='#top'>Top</a> ] void <span class=titletext>Schedule::LoadXmlData()</span> [line 156]</div>
        <div style='padding: 2px'></div>
        <div class=box>
          Parse data 
          <br /><br />
          <u>Parameters</u><br />
          <table border=0 cellspacing=0 cellpadding=1>
            <tr valign=top><td width=70 align=right>string&nbsp;</td><td><strong>$data</strong></td><td>&nbsp;XML data</td></tr>
          </table>
        </div>
        <div style='padding: 10px'></div>
      </div>
      <a name='m205'>
      <div width=100%>
        <div class=titlebox>[ <a href='#top'>Top</a> ] void <span class=titletext>Schedule::Draw()</span> [line 205]</div>
        <div style='padding: 2px'></div>
        <div class=box>
          Draw schedule 
          <br /><br />
          <u>Parameters</u><br />
          <table border=0 cellspacing=0 cellpadding=1>
            <tr valign=top><td width=70 align=right>string&nbsp;</td><td><strong>$output_file</strong></td><td>&nbsp;File to output</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$schedule</strong></td><td>&nbsp;Schedule pointer (usualy 0)</td></tr>
          </table>
        </div>
        <div style='padding: 10px'></div>
      </div>
      <a name='m248'>
      <div width=100%>
        <div class=titlebox>[ <a href='#top'>Top</a> ] void <span class=titletext>Schedule::DrawBackground()</span> [line 248]</div>
        <div style='padding: 2px'></div>
        <div class=box>
          Draw schedule background 
        </div>
        <div style='padding: 10px'></div>
      </div>
      <a name='m261'>
      <div width=100%>
        <div class=titlebox>[ <a href='#top'>Top</a> ] void <span class=titletext>Schedule::DrawGrid()</span> [line 261]</div>
        <div style='padding: 2px'></div>
        <div class=box>
          Draw schedule grid according to schedule pointer 
          <br /><br />
          <u>Parameters</u><br />
          <table border=0 cellspacing=0 cellpadding=1>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$schedule</strong></td><td>&nbsp;Schedule pointer</td></tr>
          </table>
        </div>
        <div style='padding: 10px'></div>
      </div>
      <a name='m344'>
      <div width=100%>
        <div class=titlebox>[ <a href='#top'>Top</a> ] void <span class=titletext>Schedule::DrawDays()</span> [line 344]</div>
        <div style='padding: 2px'></div>
        <div class=box>
          Draw schedule blocks for all days given the schedule pointer 
          <br /><br />
          <u>Parameters</u><br />
          <table border=0 cellspacing=0 cellpadding=1>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$schedule</strong></td><td>&nbsp;Schedule pointer</td></tr>
          </table>
        </div>
        <div style='padding: 10px'></div>
      </div>
      <a name='m364'>
      <div width=100%>
        <div class=titlebox>[ <a href='#top'>Top</a> ] void <span class=titletext>Schedule::UpdateSettings()</span> [line 364]</div>
        <div style='padding: 2px'></div>
        <div class=box>
          Updates settings from xml array 
          <br /><br />
          <u>Parameters</u><br />
          <table border=0 cellspacing=0 cellpadding=1>
            <tr valign=top><td width=70 align=right>array&nbsp;</td><td><strong>$settings</strong></td><td>&nbsp;Settings array</td></tr>
          </table>
        </div>
        <div style='padding: 10px'></div>
      </div>
      <a name='m382'>
      <div width=100%>
        <div class=titlebox>[ <a href='#top'>Top</a> ] void <span class=titletext>Schedule::UpdatePartSettings()</span> [line 382]</div>
        <div style='padding: 2px'></div>
        <div class=box>
          Updates settings to a part of the schedule class (block, legend, ..) 
          <br /><br />
          <u>Parameters</u><br />
          <table border=0 cellspacing=0 cellpadding=1>
            <tr valign=top><td width=70 align=right>array&nbsp;</td><td><strong>$settings</strong></td><td>&nbsp;Settings array</td></tr>
            <tr valign=top><td width=70 align=right>string&nbsp;</td><td><strong>$settings_part</strong></td><td>&nbsp;Settings section (block, legend, ..)</td></tr>
          </table>
        </div>
        <div style='padding: 10px'></div>
      </div>
      <a name='m420'>
      <div width=100%>
        <div class=titlebox>[ <a href='#top'>Top</a> ] void <span class=titletext>Schedule::SetVar()</span> [line 420]</div>
        <div style='padding: 2px'></div>
        <div class=box>
          Sets (depending on value) a variable or array position (given a key) 
          <br /><br />
          <u>Parameters</u><br />
          <table border=0 cellspacing=0 cellpadding=1>
            <tr valign=top><td width=70 align=right>string&nbsp;</td><td><strong>$varname</strong></td><td>&nbsp;Variable name</td></tr>
            <tr valign=top><td width=70 align=right>mixed&nbsp;</td><td><strong>$setting</strong></td><td>&nbsp;Setting value</td></tr>
            <tr valign=top><td width=70 align=right>string&nbsp;</td><td><strong>$array_key</strong></td><td>&nbsp;Array key (for $this-&gt;varname)</td></tr>
          </table>
        </div>
        <div style='padding: 10px'></div>
      </div>
      <a name='m448'>
      <div width=100%>
        <div class=titlebox>[ <a href='#top'>Top</a> ] void <span class=titletext>Schedule::DrawBlocks()</span> [line 448]</div>
        <div style='padding: 2px'></div>
        <div class=box>
          Draw a group of blocks in a given day 
          <br /><br />
          <u>Parameters</u><br />
          <table border=0 cellspacing=0 cellpadding=1>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$day</strong></td><td>&nbsp;Day where blocks should be drawed</td></tr>
            <tr valign=top><td width=70 align=right>array&nbsp;</td><td><strong>$blocks</strong></td><td>&nbsp;Array containing all blocks</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$maxdays</strong></td><td>&nbsp;Total days of the schedule</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$maxblocks</strong></td><td>&nbsp;Total blocks of the schedule</td></tr>
          </table>
        </div>
        <div style='padding: 10px'></div>
      </div>
      <a name='m525'>
      <div width=100%>
        <div class=titlebox>[ <a href='#top'>Top</a> ] integer <span class=titletext>Schedule::GetPercent()</span> [line 525]</div>
        <div style='padding: 2px'></div>
        <div class=box>
          Given a string and the max value to 100%, it will return the value corresponding to that percentage e.g.: GetPercent('25%', 40) = 10 
          <br /><br />
          <u>Parameters</u><br />
          <table border=0 cellspacing=0 cellpadding=1>
            <tr valign=top><td width=70 align=right>string&nbsp;</td><td><strong>$string</strong></td><td>&nbsp;String containing a percentage</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$max</strong></td><td>&nbsp;Value corresponding to 100%</td></tr>
          </table>
        </div>
        <div style='padding: 10px'></div>
      </div>
      <a name='m540'>
      <div width=100%>
        <div class=titlebox>[ <a href='#top'>Top</a> ] array <span class=titletext>Schedule::GetColor()</span> [line 540]</div>
        <div style='padding: 2px'></div>
        <div class=box>
          Transforms an hex RGB string into a PHP RGB array 
          <br /><br />
          <u>Parameters</u><br />
          <table border=0 cellspacing=0 cellpadding=1>
            <tr valign=top><td width=70 align=right>string&nbsp;</td><td><strong>$string</strong></td><td>&nbsp;String containing the color in hex RGB format</td></tr>
          </table>
        </div>
        <div style='padding: 10px'></div>
      </div>
      <a name='m571'>
      <div width=100%>
        <div class=titlebox>[ <a href='#top'>Top</a> ] array <span class=titletext>Schedule::GetCoords()</span> [line 571]</div>
        <div style='padding: 2px'></div>
        <div class=box>
          Returns coordinates of the 4 corners of a block to draw in the image 
          <br /><br />
          <u>Parameters</u><br />
          <table border=0 cellspacing=0 cellpadding=1>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$x</strong></td><td>&nbsp;X</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$y</strong></td><td>&nbsp;Y</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$x_span</strong></td><td>&nbsp;X expansion (to other days)</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$y_span</strong></td><td>&nbsp;Y expansion (to other blocks)</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$x_max</strong></td><td>&nbsp;Total X (total days)</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$y_max</strong></td><td>&nbsp;Total Y (total blocks)</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$x_offset</strong></td><td>&nbsp;X offset</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$y_offset</strong></td><td>&nbsp;Y offset</td></tr>
          </table>
        </div>
        <div style='padding: 10px'></div>
      </div>
      <a name='m591'>
      <div width=100%>
        <div class=titlebox>[ <a href='#top'>Top</a> ] string <span class=titletext>Schedule::GetAlign()</span> [line 591]</div>
        <div style='padding: 2px'></div>
        <div class=box>
          Returns the align if it's valid or the first valid align 
          <br /><br />
          <u>Parameters</u><br />
          <table border=0 cellspacing=0 cellpadding=1>
            <tr valign=top><td width=70 align=right>string&nbsp;</td><td><strong>$align</strong></td><td>&nbsp;String containing the desired align</td></tr>
            <tr valign=top><td width=70 align=right>array&nbsp;</td><td><strong>$possible_aligns</strong></td><td>&nbsp;Array containing all the possible aligns</td></tr>
          </table>
        </div>
        <div style='padding: 10px'></div>
      </div>
      <a name='m611'>
      <div width=100%>
        <div class=titlebox>[ <a href='#top'>Top</a> ] void <span class=titletext>Schedule::DrawDescription()</span> [line 611]</div>
        <div style='padding: 2px'></div>
        <div class=box>
          Draws the description of a block given the 4 corners of the block and some more settings 
          <br /><br />
          <u>Parameters</u><br />
          <table border=0 cellspacing=0 cellpadding=1>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$x1</strong></td><td>&nbsp;X of top left corner</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$y1</strong></td><td>&nbsp;Y of top left corner</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$x2</strong></td><td>&nbsp;X of bottom right corner</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$y2</strong></td><td>&nbsp;Y of bottom right corner</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$font</strong></td><td>&nbsp;Font</td></tr>
            <tr valign=top><td width=70 align=right>string&nbsp;</td><td><strong>$text</strong></td><td>&nbsp;Text to draw</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$color</strong></td><td>&nbsp;Color</td></tr>
            <tr valign=top><td width=70 align=right>string&nbsp;</td><td><strong>$align</strong></td><td>&nbsp;Alignment (default is left)</td></tr>
          </table>
        </div>
        <div style='padding: 10px'></div>
      </div>
      <a name='m667'>
      <div width=100%>
        <div class=titlebox>[ <a href='#top'>Top</a> ] void <span class=titletext>Schedule::DrawText()</span> [line 667]</div>
        <div style='padding: 2px'></div>
        <div class=box>
          Draw text given (x,y) points, font, color, horizontal and vertical align 
          <br /><br />
          <u>Parameters</u><br />
          <table border=0 cellspacing=0 cellpadding=1>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$x</strong></td><td>&nbsp;X</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$y</strong></td><td>&nbsp;Y</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$font</strong></td><td>&nbsp;Font</td></tr>
            <tr valign=top><td width=70 align=right>string&nbsp;</td><td><strong>$text</strong></td><td>&nbsp;Text to draw</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$color</strong></td><td>&nbsp;Color</td></tr>
            <tr valign=top><td width=70 align=right>string&nbsp;</td><td><strong>$align</strong></td><td>&nbsp;Horizontal alignment (default is center)</td></tr>
            <tr valign=top><td width=70 align=right>string&nbsp;</td><td><strong>$valign</strong></td><td>&nbsp;Vertical alignment (default is middle)</td></tr>
          </table>
        </div>
        <div style='padding: 10px'></div>
      </div>
      <a name='m690'>
      <div width=100%>
        <div class=titlebox>[ <a href='#top'>Top</a> ] void <span class=titletext>Schedule::DrawRectangle()</span> [line 690]</div>
        <div style='padding: 2px'></div>
        <div class=box>
          Draws a rectangle given the 4 corner points, border and background color 
          <br /><br />
          <u>Parameters</u><br />
          <table border=0 cellspacing=0 cellpadding=1>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$x1</strong></td><td>&nbsp;X of top left corner</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$y1</strong></td><td>&nbsp;Y of top left corner</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$x2</strong></td><td>&nbsp;X of bottom right corner</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$y2</strong></td><td>&nbsp;Y of bottom right corner</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$bordercolor</strong></td><td>&nbsp;Border color</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$bgcolor</strong></td><td>&nbsp;Background color</td></tr>
          </table>
        </div>
        <div style='padding: 10px'></div>
      </div>
      <a name='m706'>
      <div width=100%>
        <div class=titlebox>[ <a href='#top'>Top</a> ] void <span class=titletext>Schedule::AllocateColor()</span> [line 706]</div>
        <div style='padding: 2px'></div>
        <div class=box>
          Allocates a color (if needed) and sets a variable with the index of that color (alpha is added if possible [GD2]) 
          <br /><br />
          <u>Parameters</u><br />
          <table border=0 cellspacing=0 cellpadding=1>
            <tr valign=top><td width=70 align=right>string&nbsp;</td><td><strong>$varname</strong></td><td>&nbsp;Variable name</td></tr>
            <tr valign=top><td width=70 align=right>array&nbsp;</td><td><strong>$color</strong></td><td>&nbsp;Array containing RGB color</td></tr>
            <tr valign=top><td width=70 align=right>integer&nbsp;</td><td><strong>$alpha</strong></td><td>&nbsp;Transparency: (opaque) 0&lt;-&gt;127 (transparent)</td></tr>
          </table>
        </div>
        <div style='padding: 10px'></div>
      </div>
      <a name='m734'>
      <div width=100%>
        <div class=titlebox>[ <a href='#top'>Top</a> ] void <span class=titletext>Schedule::ReorganizeArray()</span> [line 734]</div>
        <div style='padding: 2px'></div>
        <div class=box>
          Resets the indexes of an array 
          <br /><br />
          <u>Parameters</u><br />
          <table border=0 cellspacing=0 cellpadding=1>
            <tr valign=top><td width=70 align=right>array&nbsp;</td><td><strong>$array</strong></td><td>&nbsp;Array to reorganize</td></tr>
          </table>
        </div>
        <div style='padding: 10px'></div>
      </div>
    </div>
    <div style='position: absolute; right: 0; top: 0; width: 110%; height: 50px; padding: 12px; background-color: #9999CC; border-bottom: 1px solid #333366;'>
      <p align=right><span class=title>Schedule</span></p>
    </div>
    <div style='position: absolute; right: 0; top: 50px; width: 110%; height: 18px; padding: 2px; background-color: #666699; border-bottom: 1px solid #333366; color: #FFFFFF;'>
      <p align=right>
        [ <strong>Author</strong>: Jeph &lt;hide@address.com&gt; ]
        [ <strong>Version</strong>: 0.1 ]
        [ <strong>Package</strong>: Schedule ]
        [ <strong>URL</strong>: &lt;none&gt; ]
      </p>
    </div>
  </body>
</html>
Return current item: Schedule