Esempio n. 1
0
 /**
  * Displays a form to create new entries
  *
  * @param $conf
  * @return string
  */
 public function xhtml_newform($conf)
 {
     global $ID;
     // allowed to create?
     if (!$this->toolshelper) {
         $this->toolshelper = plugin_load('helper', 'blogtng_tools');
     }
     $new = $this->toolshelper->mkpostid($conf['format'], 'dummy');
     if (auth_quickaclcheck($new) < AUTH_CREATE) {
         return '';
     }
     $form = new Doku_Form($ID, wl($ID, array('do' => 'btngnew'), false, '&'));
     if ($conf['title']) {
         $form->addElement(form_makeOpenTag('h3'));
         $form->addElement(hsc($conf['title']));
         $form->addElement(form_makeCloseTag('h3'));
     }
     if (isset($conf['select'])) {
         $form->addElement(form_makeMenuField('btng[new][title]', helper_plugin_blogtng_tools::filterExplodeCSVinput($conf['select']), '', $this->getLang('title'), 'btng__nt', 'edit'));
     } else {
         $form->addElement(form_makeTextField('btng[new][title]', '', $this->getLang('title'), 'btng__nt', 'edit'));
     }
     if ($conf['tags']) {
         if ($conf['tags'][0] == '?') {
             $conf['tags'] = helper_plugin_blogtng_tools::filterExplodeCSVinput($this->getConf('default_tags'));
         }
         $form->addElement(form_makeTextField('btng[post][tags]', implode(', ', $conf['tags']), $this->getLang('tags'), 'btng__ntags', 'edit'));
     }
     if ($conf['type']) {
         if ($conf['type'][0] == '?') {
             $conf['type'] = $this->getConf('default_commentstatus');
         }
         $form->addElement(form_makeMenuField('btng[post][commentstatus]', array('enabled', 'closed', 'disabled'), $conf['type'], $this->getLang('commentstatus'), 'blogtng__ncommentstatus', 'edit'));
     }
     $form->addElement(form_makeButton('submit', null, $this->getLang('create')));
     $form->addHidden('btng[new][format]', hsc($conf['format']));
     $form->addHidden('btng[post][blog]', hsc($conf['blog'][0]));
     return '<div class="blogtng_newform">' . $form->getForm() . '</div>';
 }