header() public method

Render a heading
public header ( string $text, integer $level, integer $pos )
$text string the text to display
$level integer header level
$pos integer byte position in the original source
示例#1
0
 function header($text, $level, $pos)
 {
     parent::header($text, $level, $pos);
     global $sectionTitle;
     if (!$text) {
         $sectionTitle = "";
         return;
     }
     $sectionTitle = $text;
 }
 function header($text, $level, $pos)
 {
     parent::header($text, $level, $pos);
     if ($this->_displayPN()) {
         $pnid = $this->_getID($this->getConf('numbering') ? 2 : 1);
         $linkText = $this->getConf('linkText') ? $pnid : '§';
         $link = '&nbsp;<a href="#' . $pnid . '" id="' . $pnid;
         $link .= '" class="pn" title="' . $this->getLang('sectionlink') . '">' . $linkText . '</a>';
         $link .= $this->_getAnnotationLink();
         $this->doc = preg_replace('/(<\\/h[1-5]>)$/', $link . '\\1', $this->doc);
     }
 }
 /**
  * Render a heading
  *
  * @param string $text the text to display
  * @param int $level header level
  * @param int $pos byte position in the original source
  */
 function header($text, $level, $pos)
 {
     // We are going from 2 to 3
     // The parent is 2
     if ($level > $this->previousNodeLevel) {
         $nodePosition = 1;
         // Keep the position of the parent
         $this->nodeParentPosition[$this->previousNodeLevel] = $this->previousNodePosition;
     } elseif ($level < $this->previousNodeLevel) {
         $nodePosition = $this->nodeParentPosition[$level] + 1;
     } else {
         $nodePosition = $this->previousNodePosition + 1;
     }
     // Pump the doc from the previous section
     $this->sections[$this->sectionNumber] = array('level' => $this->previousNodeLevel, 'position' => $this->previousNodePosition, 'content' => $this->doc, 'text' => $this->previousSectionTextHeader);
     // And reset it
     $this->doc = '';
     // Set the looping variable
     $this->sectionNumber = $this->sectionNumber + 1;
     $this->previousNodeLevel = $level;
     $this->previousNodePosition = $nodePosition;
     $this->previousSectionTextHeader = $text;
     $numbering = "";
     if ($level == 2) {
         $numbering = $nodePosition;
     }
     if ($level == 3) {
         $numbering = $this->nodeParentPosition[$level - 1] . "." . $nodePosition;
     }
     if ($level == 4) {
         $numbering = $this->nodeParentPosition[$level - 2] . "." . $this->nodeParentPosition[$level - 1] . "." . $nodePosition;
     }
     if ($level == 5) {
         $numbering = $this->nodeParentPosition[$level - 3] . "." . $this->nodeParentPosition[$level - 2] . "." . $this->nodeParentPosition[$level - 1] . "." . $nodePosition;
     }
     if ($numbering != "") {
         $textWithLocalization = $numbering . " - " . $text;
     } else {
         $textWithLocalization = $text;
     }
     parent::header($textWithLocalization, $level, $pos);
 }
 /**
  * Displays list of selected/deleted pages
  *
  * @param Doku_Renderer_xhtml $renderer
  * @param array               $list array with pageids as key, status as value
  * @param string              $action 'remove' or 'include'
  */
 private function showPagelist($renderer, $list, $action)
 {
     $jslang = $this->getLang('js');
     if ($action == 'remove') {
         $id = 'deletedpagelist';
         $heading = 'removed';
         $actiontitle = $jslang['include'];
     } else {
         $id = 'pagelist';
         $heading = 'toprint';
         $actiontitle = $jslang['remove'];
     }
     $renderer->header($this->getLang($heading), 2, 0);
     $renderer->doc .= "<ul id={$id} class='pagelist {$action}'>";
     foreach ($list as $pageid => $cpt) {
         if ($action == 'remove' && $cpt == 0 || $action == 'include' && $cpt == 1) {
             $renderer->doc .= "<li class='level1' id='pg__{$pageid}' title='{$this->getLang('sortable')}'>";
             $renderer->doc .= "<a class='action' title='{$actiontitle}'></a>";
             $renderer->doc .= '&nbsp;&nbsp;';
             $renderer->doc .= $this->createLink($pageid);
             $renderer->listitem_close();
         }
     }
     $renderer->listu_close();
 }