Main Page   File List   File Members   Related Pages  

base_page.inc.php

Go to the documentation of this file.
00001 <?php
00002 // $Header: /cvsroot/modphpcms/modphpcms/modules/includes/base_page.inc.php,v 1.2 2004/06/08 19:14:33 fred87 Exp $
00003 
00015 function Ibase_page_getColSpan($cell)
00016 {
00017   $col = substr($cell, 1, 1);
00018   if ($col == 'l' AND get_entry('config', 'is_leftcol') == 'n')
00019     return 0;
00020   if ($col == 'r' AND get_entry('config', 'is_rightcol') == 'n')
00021     return 0;
00022 
00023   switch ($cell)
00024   {
00025     case 'tl': // top left
00026       if (get_entry('config', 'tl_merge') != 'h')
00027         return 1;
00028       if (get_entry('config', 'tr_merge') == 'h')
00029         return 3; // Whole top row is merged
00030       return 2; // It's just merged with the top center
00031     case 'tc':  // top centre
00032       if (Ibase_page_getColSpan('tl') > 1)
00033         return 0;
00034       if (get_entry('config', 'tr_merge') == 'h')
00035         return 2;
00036       return 1;
00037     case 'tr': // top right
00038       if (Ibase_page_getColSpan('tl') == 3)
00039         return 0; // merged with cell on left
00040       if (Ibase_page_getColSpan('tc') == 2)
00041         return 0; // ditto
00042       return 1;
00043     case 'ml':
00044       return 1;
00045     case 'mr':
00046       return 1;
00047     case 'bl': // bottom left
00048       if (Ibase_page_getRowSpan('bl') == 0)
00049         return 0; // merged with cells above
00050       switch (get_entry('config', 'bl_merge'))
00051       {
00052         case 'n':
00053           return 1;
00054         case 'h':
00055           if (get_entry('config', 'br_merge') == 'h')
00056             return 3;
00057           return 2;
00058         default: // 'v' is an error, should be trapped by the if
00059           die (
00060             'Critical error: config::bl_merge = ' .
00061             get_entry('config', 'bl_merge') .
00062               ' in Ibase_page_getColSpan(\'bl\').');
00063       }
00064     case 'bc': // bottom centre
00065       if (Ibase_page_getColSpan('bl') > 1)
00066         return 0;
00067       if (get_entry('config', 'br_merge') == 'h')
00068         return 2;
00069       return 1;
00070     case 'br': // bottom right
00071       if (Ibase_page_getRowSpan('br') == 0)
00072         return 0;
00073       if (Ibase_page_getColSpan('bl') == 3)
00074         return 0;
00075       if (Ibase_page_getColSpan('bc') == 2)
00076         return 0;
00077       return 1;
00078     default:
00079       die (
00080         'Critical error: $cell = ' . $cell .
00081           ' in Ibase_page_getColSpan($cell).');
00082   }
00083 }
00084 
00091 function Ibase_page_getRowSpan($cell)
00092 {
00093   $row = substr($cell, 0, 1);
00094   if ($row == 't' AND get_entry('config', 'is_toprow') == 'n')
00095     return 0;
00096   if ($row == 'b' AND get_entry('config', 'is_bottomrow') == 'n')
00097     return 0;
00098 
00099   switch ($cell)
00100   {
00101     case 'tl':
00102       if (get_entry('config', 'tl_merge') != 'v')
00103         return 1;
00104       if (get_entry('config', 'bl_merge') == 'v')
00105         return 3;
00106       return 2;
00107     case 'tc':
00108       return 1;
00109     case 'tr':
00110       if (get_entry('config', 'tr_merge') != 'v')
00111         return 1;
00112       if (get_entry('config', 'br_merge') == 'v')
00113         return 3;
00114       return 2;
00115     case 'ml': // middle row, left column
00116       if (Ibase_page_getRowSpan('tl') > 1)
00117         return 0;
00118       if (get_entry('config', 'bl_merge') == 'v')
00119         return 2;
00120       return 1;
00121     case 'mr': // middle row, right column
00122       if (Ibase_page_getRowSpan('tr') > 1)
00123         return 0;
00124       if (get_entry('config', 'br_merge') == 'v')
00125         return 2;
00126       return 1;
00127         case 'bl':
00128       if (Ibase_page_getRowSpan('tl') == 3)
00129         return 0;
00130       if (Ibase_page_getRowSpan('ml') == 2)
00131         return 0;
00132       return 1;
00133     case 'bc':
00134       return 1;
00135     case 'br':
00136       if (Ibase_page_getRowSpan('tr') == 3)
00137         return 0;
00138       if (Ibase_page_getRowSPan('mr') == 2)
00139         return 0;
00140       return 1;
00141     default:
00142       die (
00143         'Critical error: $cell = ' . $cell .
00144         ' in Ibase_page_getRowSpan($cell).');
00145   }
00146 }
00147 
00154 function Ibase_page_doShowData($cell)
00155 {
00156   if (Ibase_page_getColSpan($cell) == 1 AND Ibase_page_getRowSpan($cell) == 1)
00157     return true;
00158   if (get_entry('config', $cell . '_showifmerged') == 'y')
00159     return true;
00160   return false;
00161 }
00162 ?>

Generated on Wed Jun 9 03:38:16 2004 for modphpcms by doxygen1.2.18