コード例 #1
0
 public static function getColHeader($e)
 {
     $pos = 0;
     $e_count = $e;
     //find the position in the row of td
     //trovo la posizione nella riga di td
     while ($e_count->prev_sibling() != null) {
         $pos++;
         $e_count = $e_count->prev_sibling();
     }
     $t = BasicChecks::getTable($e);
     // there isn't a <table> tag
     //non c'è il tag <table>
     if ($t == null) {
         return true;
         //tabella mal composta
     }
     $tr = $t->find("tr");
     $size_of_tr = sizeof($tr);
     if ($tr == null || $size_of_tr == 0) {
         return true;
     }
     //tabella mal composta - table is not well formed
     for ($i = 0; $i < $size_of_tr - 1; $i++) {
         $th_next = $tr[$i + 1]->find("th");
         if ($th_next == null || sizeof($th_next) == 0) {
             break;
         }
         //l'i-esima tr contiene l'intestazione pi interna
     }
     $h = $tr[$i]->childNodes();
     // Verify that the header box in place $pos  is actually a header
     //verifico che la casella in posizione $pos della presunta riga di intestazione sia effettivamente un'intestazione
     if (isset($h[$pos]) && $h[$pos]->tag == "th") {
         return $h[$pos];
     } else {
         return null;
     }
 }