123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <?php
- if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); }
- abstract class Section extends Widget
- {
-
- function show()
- {
- $this->out->elementStart('div',
- array('id' => $this->divId(),
- 'class' => 'section'));
- $this->showTitle();
- $have_more = $this->showContent();
- if ($have_more) {
- $this->showMore();
- }
- $this->out->elementEnd('div');
- }
- function showTitle()
- {
- $link = $this->link();
- if (!empty($link)) {
- $this->out->elementStart('h2');
- $this->out->element('a', array('href' => $link), $this->title());
- $this->out->elementEnd('h2');
- } else {
- $this->out->element('h2', null,
- $this->title());
- }
- }
- function showMore()
- {
- $this->out->elementStart('p');
- $this->out->element('a', array('href' => $this->moreUrl(),
- 'class' => 'more'),
- $this->moreTitle());
- $this->out->elementEnd('p');
- }
- abstract public function divId();
- function title()
- {
-
- return _('Untitled section');
- }
- function link()
- {
- return null;
- }
- function showContent()
- {
- $this->out->element('p', null,
-
- _('(None)'));
- return false;
- }
- function moreUrl()
- {
- return null;
- }
- function moreTitle()
- {
-
- return _('More...');
- }
- }
|