Ejemplo n.º 1
0
 /**
  * Render the day header
  *
  * @param Doku_Renderer $R
  * @param int $date
  */
 protected function dayheader(&$R, $date)
 {
     if ($R->getFormat() == 'xhtml') {
         /* @var Doku_Renderer_xhtml $R  */
         $R->doc .= '<h3 class="changes">';
         $R->cdata(dformat($date, $this->getConf('dayheaderfmt')));
         $R->doc .= '</h3>';
     } else {
         $R->header(dformat($date, $this->getConf('dayheaderfmt')), 3, 0);
     }
 }
Ejemplo n.º 2
0
 /**
  * Return formated data, depending on column type
  *
  * @param array               $column
  * @param string              $value
  * @param Doku_Renderer       $R
  * @return string
  */
 function _formatDataNew($column, $value, Doku_Renderer $R)
 {
     global $conf;
     $vals = explode("\n", $value);
     $outs = array();
     //multivalued line from db result for pageid and wiki has only in first value the ID
     $storedID = '';
     foreach ($vals as $val) {
         $val = trim($val);
         if ($val == '') {
             continue;
         }
         $type = $column['type'];
         if (is_array($type)) {
             $type = $type['type'];
         }
         switch ($type) {
             case 'page':
                 $val = $this->_addPrePostFixes($column['type'], $val);
                 $val = $this->ensureAbsoluteId($val);
                 $outs[] = $R->internallink($val, null, null, true);
                 break;
             case 'title':
                 list($id, $title) = explode('|', $val, 2);
                 $id = $this->_addPrePostFixes($column['type'], $id);
                 $id = $this->ensureAbsoluteId($id);
                 $outs[] = $R->internallink($id, $title, null, true);
                 break;
             case 'pageid':
                 list($id, $title) = explode('|', $val, 2);
                 //use ID from first value of the multivalued line
                 if ($title == null) {
                     $title = $id;
                     if (!empty($storedID)) {
                         $id = $storedID;
                     }
                 } else {
                     $storedID = $id;
                 }
                 $id = $this->_addPrePostFixes($column['type'], $id);
                 $outs[] = $R->internallink($id, $title, null, true);
                 break;
             case 'nspage':
                 // no prefix/postfix here
                 $val = ':' . $column['key'] . ":{$val}";
                 $outs[] = $R->internallink($val, null, null, true);
                 break;
             case 'mail':
                 list($id, $title) = explode(' ', $val, 2);
                 $id = $this->_addPrePostFixes($column['type'], $id);
                 if (!$title) {
                     $title = $id;
                 } else {
                     $title = hsc($title);
                 }
                 $outs[] = $R->emaillink($id, $title, true);
                 break;
             case 'url':
                 $val = $this->_addPrePostFixes($column['type'], $val);
                 $outs[] = $R->externallink($val, null, true);
                 break;
             case 'tag':
                 // per default use keyname as target page, but prefix on aliases
                 if (!is_array($column['type'])) {
                     $target = $column['key'] . ':';
                 } else {
                     $target = $this->_addPrePostFixes($column['type'], '');
                 }
                 $params = buildURLparams($this->_getTagUrlparam($column, $val));
                 $url = str_replace('/', ':', cleanID($target)) . '?' . $params;
                 // FIXME: The title is lost when moving to $R->internallink,
                 //        but this syntax is required to support different renderers.
                 // $title = sprintf($this->getLang('tagfilter'), hsc($val));
                 $outs[] = $R->internallink($url, hsc($val), true);
                 break;
             case 'timestamp':
                 $outs[] = dformat($val);
                 break;
             case 'wiki':
                 global $ID;
                 $oldid = $ID;
                 list($ID, $data) = explode('|', $val, 2);
                 //use ID from first value of the multivalued line
                 if ($data == null) {
                     $data = $ID;
                     $ID = $storedID;
                 } else {
                     $storedID = $ID;
                 }
                 $data = $this->_addPrePostFixes($column['type'], $data);
                 // Trim document_{start,end}, p_{open,close} from instructions
                 $allinstructions = p_get_instructions($data);
                 $wraps = 1;
                 if (isset($allinstructions[1]) && $allinstructions[1][0] == 'p_open') {
                     $wraps++;
                 }
                 $instructions = array_slice($allinstructions, $wraps, -$wraps);
                 $outs[] = p_render($R->getFormat(), $instructions, $byref_ignore);
                 $ID = $oldid;
                 break;
             default:
                 $val = $this->_addPrePostFixes($column['type'], $val);
                 //type '_img' or '_img<width>'
                 if (substr($type, 0, 3) == 'img') {
                     $width = (int) substr($type, 3);
                     if (!$width) {
                         $width = $this->getConf('image_width');
                     }
                     list($mediaid, $title) = explode('|', $val, 2);
                     if ($title === null) {
                         $title = $column['key'] . ': ' . basename(str_replace(':', '/', $mediaid));
                     } else {
                         $title = trim($title);
                     }
                     if (media_isexternal($val)) {
                         $html = $R->externalmedia($mediaid, $title, $align = null, $width, $height = null, $cache = null, $linking = 'direct', true);
                     } else {
                         $html = $R->internalmedia($mediaid, $title, $align = null, $width, $height = null, $cache = null, $linking = 'direct', true);
                     }
                     if (strpos($html, 'mediafile') === false) {
                         $html = str_replace('href', 'rel="lightbox" href', $html);
                     }
                     $outs[] = $html;
                 } else {
                     $outs[] = hsc($val);
                 }
         }
     }
     return join(', ', $outs);
 }
Ejemplo n.º 3
0
 /**
  * Create list footer
  *
  * @param array         $data   instruction by handler()
  * @param int           $rowcnt number of rows
  * @param Doku_Renderer $R      the current DokuWiki renderer
  */
 function postList($data, $rowcnt, Doku_Renderer $R)
 {
     switch ($R->getFormat()) {
         case 'xhtml':
             $R->doc .= '</ul></div>';
             break;
         case 'odt':
             $R->listu_close();
             break;
     }
 }
Ejemplo n.º 4
0
 /**
  * Create table footer
  *
  * @param array         $data   instruction by handler()
  * @param int           $rowcnt number of rows
  * @param Doku_Renderer $R      the current DokuWiki renderer
  */
 function postList($data, $rowcnt, Doku_Renderer $R)
 {
     global $ID;
     $text = '';
     // if summarize was set, add sums
     if ($data['summarize']) {
         $text .= '<tr>';
         $len = count($data['cols']);
         if ($data['rownumbers']) {
             $text .= '<td></td>';
         }
         for ($i = 0; $i < $len; $i++) {
             $text .= '<td class="' . $data['align'][$i] . 'align">';
             if (!empty($this->sums[$i])) {
                 $text .= '∑ ' . $this->sums[$i];
             } else {
                 $text .= '&nbsp;';
             }
             $text .= '</td>';
         }
         $text .= '<tr>';
     }
     // if limit was set, add control
     if ($data['limit']) {
         $text .= '<tr><th colspan="' . (count($data['cols']) + ($data['rownumbers'] ? 1 : 0)) . '">';
         $offset = (int) $_REQUEST['dataofs'];
         if ($offset) {
             $prev = $offset - $data['limit'];
             if ($prev < 0) {
                 $prev = 0;
             }
             // keep url params
             $params = $this->dthlp->_a2ua('dataflt', $_REQUEST['dataflt']);
             if (isset($_REQUEST['datasrt'])) {
                 $params['datasrt'] = $_REQUEST['datasrt'];
             }
             $params['dataofs'] = $prev;
             $text .= '<a href="' . wl($ID, $params) . '" title="' . $this->getLang('prev') . '" class="prev">' . $this->getLang('prev') . '</a>';
         }
         $text .= '&nbsp;';
         if ($rowcnt > $data['limit']) {
             $next = $offset + $data['limit'];
             // keep url params
             $params = $this->dthlp->_a2ua('dataflt', $_REQUEST['dataflt']);
             if (isset($_REQUEST['datasrt'])) {
                 $params['datasrt'] = $_REQUEST['datasrt'];
             }
             $params['dataofs'] = $next;
             $text .= '<a href="' . wl($ID, $params) . '" title="' . $this->getLang('next') . '" class="next">' . $this->getLang('next') . '</a>';
         }
         $text .= '</th></tr>';
     }
     $text .= '</table></div>';
     switch ($R->getFormat()) {
         case 'xhtml':
             $R->doc .= $text;
             break;
         case 'odt':
             $R->table_close();
             break;
     }
 }