Beispiel #1
0
     }
     if (!empty($p['poll_new_a'])) {
         $item = new CategoryItem(POLL);
         $item->owner = $p['poll'];
         $item->title = $p['poll_new_a'];
         $item->store();
     }
     js_redirect('a/polls/edit/' . $p['poll']);
 }
 $poll = PollItem::get($this->child);
 echo '<h1>Edit poll</h1>';
 $frm = new XhtmlForm();
 $frm->addHidden('poll', $this->child);
 $frm->addInput('poll_q', 'Question', $poll->text);
 if (ts($poll->time_start) < time()) {
     $frm->addText($poll->time_start, 'Poll starts');
 } else {
     $frm->addInput('poll_ts', 'Poll starts', $poll->time_start);
 }
 if (ts($poll->time_end) < time()) {
     $frm->addText($poll->time_end, 'Poll ends');
 } else {
     $frm->addInput('poll_te', 'Poll ends', $poll->time_end);
 }
 if ($poll) {
     $cats = new CategoryList(POLL);
     $cats->setOwner($this->child);
     foreach ($cats->getItems() as $i => $opt) {
         $frm->addInput('poll_a' . $i, 'Answer ' . ($i + 1), $opt->title);
     }
     $frm->addInput('poll_new_a', 'New answer');
Beispiel #2
0
 $menu->setCss('wiki_menu');
 $menu->add(t('Article'), 'u/wiki/show/' . $this->child);
 $menu->add(t('Edit'), 'u/wiki/edit/' . $this->child);
 $menu->add(t('History'), 'u/wiki/history/' . $this->child);
 echo '<div class="wiki">';
 echo $menu->render();
 /*
     if (!$session->isAdmin && !$this->lockerId) {
         echo "WIKI LOCKED";
         return;
     }
 */
 $form = new XhtmlForm('wiki_edit');
 $form->addHidden('wiki_name', $this->child);
 ///XXXX ugly hack
 $form->addText('Edit wiki article ' . $this->child);
 /*
     if ($this->lockerId)
         echo '<div class="wiki_locked">This article is currently locked from editing.</div>';
 */
 $rows = 8 + substr_count($wiki->text, "\n");
 if ($rows > 36) {
     $rows = 36;
 }
 $form->addRichedit('text', '', $wiki->text);
 /*
     if ($session->isAdmin) {
         if ($this->lockerId) {
             echo '<input type="button" class="button" value="'.t('Unlock').'" onclick="location.href=\''.URLadd('WikiEdit:'.$this->name, '&amp;wikilock=0').'\'"/>';
             echo xhtmlImage('gfx/icon_locked.png', 'This wiki is currently locked');
             echo '<b>Locked by '.Users::getName($this->lockerId).' at '.formatTime($this->timeLocked).'</b><br/>';