Esempio n. 1
0
$select->addOption(1, 'Select 1');
$select->addOption(2, 'Select 2');
$select->addOption(3, 'Select 3');
$select->setDescription('Description Select');
$select->setClass('span2');
$tab3->addElement($select, true);
$select_optgroup = new Xoops\Form\Select('Select Optgroup', 'select_optgroup', '', 1, false);
$select_optgroup->addOptgroup('Swiss', array(1 => 'Geneva', 2 => 'Bern', 3 => 'Zurich'));
$select_optgroup->addOptgroup('France', array(4 => 'Paris', 5 => 'Lyon', 6 => 'Grenoble', 7 => 'Marseille'));
$select_optgroup->setDescription('Description Select Optgroup');
$select_optgroup->setClass('span3');
$tab3->addElement($select_optgroup, true);
$date = new Xoops\Form\DateSelect('Date', 'date', 2, 0);
$date->setDescription('Description Date');
$tab3->addElement($date, true);
$date_time = new Xoops\Form\DateTime('Date time', 'date_time', 2, '', 'Date...');
$date_time->setDescription('Description Date time');
$tab3->addElement($date_time, true);
$tab3->addElement(new Xoops\Form\Captcha('Captcha', 'captcha', false), true);
$testtray = new Xoops\Form\ElementTray('Test tray');
$select_tray = new Xoops\Form\Select('Select_tray', 'select_tray', '', 4, true);
$select_tray->addOption(1, 'Select_tray 1');
$select_tray->addOption(2, 'Select_tray 2');
$select_tray->addOption(3, 'Select_tray 3');
$select_tray->addOption(4, 'Select_tray 4');
$select_tray->addOption(5, 'Select_tray 5');
$select_tray->addOption(6, 'Select_tray 6');
$select_tray->setDescription('Description Select_tray');
$select_tray->setClass('span2');
$testtray->addElement($select_tray, true);
$testtray->addElement($select_tray);
Esempio n. 2
0
 * @copyright 2011-2015 XOOPS Project (http://xoops.org)
 * @license   GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @author    trabis <*****@*****.**>
 * @author    Richard Griffith <*****@*****.**>
 */
include dirname(dirname(__DIR__)) . '/mainfile.php';
$xoops = Xoops::getInstance();
$xoops->header();
$default = Time::cleanTime();
$dateOnly = Request::getDateTime('date', $default);
$dateAndTime = Request::getDateTime('date_time', $default);
// Date demo form
$form = new Xoops\Form\ThemeForm('Date and Time', 'form_localedates', '', 'post');
$date = new Xoops\Form\DateSelect('Date', 'date', $dateOnly);
$date->setDescription(\XoopsLocale::formatTimestamp($dateOnly, 'custom'));
$form->addElement($date, true);
$date_time = new Xoops\Form\DateTime('Date time', 'date_time', $dateAndTime);
$date_time->setDescription(Time::describeRelativeInterval($dateAndTime));
$form->addElement($date_time, true);
$buttonSubmit = new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit');
$form->addElement($buttonSubmit);
$form->display();
// Locale selection form
$localePicker = new Xoops\Form\ThemeForm('Change Locale', 'form_locale', '', 'get');
$localeSelect = new Xoops\Form\SelectLocale('Locale', 'lang', Request::getString('lang', 'en_US'));
$localePicker->addElement($localeSelect);
$buttonSubmit = new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit');
$localePicker->addElement($buttonSubmit);
$localePicker->display();
\Xoops\Utils::dumpFile(__FILE__);
$xoops->footer();
Esempio n. 3
0
 /**
  * Note change in arguments, removed size and showtime
  *
  * @param mixed   $caption
  * @param mixed   $name
  * @param integer $size
  * @param integer $value
  * @param mixed   $showtime
  */
 function __construct($caption, $name, $size = 12, $value = 0, $showtime = true)
 {
     parent::__construct($caption, $name, $value);
 }
Esempio n. 4
0
 /**
  * Build the main tab
  *
  * @param PublisherItem      $obj     data source
  * @param ContainerInterface $mainTab add elements to this tab/form
  *
  * @return void
  */
 private function buildMainTab(PublisherItem $obj, ContainerInterface $mainTab)
 {
     $xoops = Xoops::getInstance();
     $publisher = Publisher::getInstance();
     // Category
     $category_select = new Xoops\Form\Select(_CO_PUBLISHER_CATEGORY, 'categoryid', $obj->getVar('categoryid', 'e'));
     $category_select->setDescription(_CO_PUBLISHER_CATEGORY_DSC);
     $category_select->addOptionArray($publisher->getCategoryHandler()->getCategoriesForSubmit());
     $mainTab->addElement($category_select);
     // ITEM TITLE
     $mainTab->addElement(new Xoops\Form\Text(_CO_PUBLISHER_TITLE, 'title', 50, 255, $obj->getVar('title', 'e')), true);
     // SUBTITLE
     if ($this->isGranted(_PUBLISHER_SUBTITLE)) {
         $mainTab->addElement(new Xoops\Form\Text(_CO_PUBLISHER_SUBTITLE, 'subtitle', 50, 255, $obj->getVar('subtitle', 'e')));
     }
     // SHORT URL
     if ($this->isGranted(_PUBLISHER_ITEM_SHORT_URL)) {
         $text_short_url = new Xoops\Form\Text(_CO_PUBLISHER_ITEM_SHORT_URL, 'item_short_url', 50, 255, $obj->getVar('short_url', 'e'));
         $text_short_url->setDescription(_CO_PUBLISHER_ITEM_SHORT_URL_DSC);
         $mainTab->addElement($text_short_url);
     }
     // TAGS
     if ($xoops->isActiveModule('tag') && $this->isGranted(_PUBLISHER_ITEM_TAG)) {
         include_once $xoops->path('modules/tag/include/formtag.php');
         $text_tags = new Tag('item_tag', 60, 255, $obj->getVar('item_tag', 'e'), 0);
         $mainTab->addElement($text_tags);
     }
     $this->buildEditors($obj, $mainTab);
     $this->buildTSOptions($obj, $mainTab);
     // Available pages to wrap
     if ($this->isGranted(_PUBLISHER_AVAILABLE_PAGE_WRAP)) {
         $wrap_pages = XoopsLists::getHtmlListAsArray(PublisherUtils::getUploadDir(true, 'content'));
         $available_wrap_pages_text = array();
         foreach ($wrap_pages as $page) {
             $available_wrap_pages_text[] = "<span onclick='publisherPageWrap(\"body\", \"[pagewrap={$page}] \");'" . " onmouseover='style.cursor=\"pointer\"'>{$page}</span>";
         }
         $available_wrap_pages = new Xoops\Form\Label(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP, implode(', ', $available_wrap_pages_text));
         $available_wrap_pages->setDescription(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP_DSC);
         $mainTab->addElement($available_wrap_pages);
     }
     // Uid
     /*  We need to retrieve the users manually because for some reason, on the frxoops.org server,
         the method users::getobjects encounters a memory error
         */
     // Trabis : well, maybe is because you are getting 6000 objects into memory , no??? LOL
     if ($this->isGranted(_PUBLISHER_UID)) {
         $uid_select = new Xoops\Form\SelectUser(_CO_PUBLISHER_UID, 'uid', true, array($obj->getVar('uid', 'e')), 1, false);
         $uid_select->setDescription(_CO_PUBLISHER_UID_DSC);
         $mainTab->addElement($uid_select);
     }
     // Author Alias
     if ($this->isGranted(_PUBLISHER_AUTHOR_ALIAS)) {
         $element = new Xoops\Form\Text(_CO_PUBLISHER_AUTHOR_ALIAS, 'author_alias', 50, 255, $obj->getVar('author_alias', 'e'));
         $element->setDescription(_CO_PUBLISHER_AUTHOR_ALIAS_DSC);
         $mainTab->addElement($element);
         unset($element);
     }
     // STATUS
     if ($this->isGranted(_PUBLISHER_STATUS)) {
         $options = array(_PUBLISHER_STATUS_PUBLISHED => _CO_PUBLISHER_PUBLISHED, _PUBLISHER_STATUS_OFFLINE => _CO_PUBLISHER_OFFLINE, _PUBLISHER_STATUS_SUBMITTED => _CO_PUBLISHER_SUBMITTED, _PUBLISHER_STATUS_REJECTED => _CO_PUBLISHER_REJECTED);
         $status_select = new Xoops\Form\Select(_CO_PUBLISHER_STATUS, 'status', $obj->getVar('status'));
         $status_select->addOptionArray($options);
         $status_select->setDescription(_CO_PUBLISHER_STATUS_DSC);
         $mainTab->addElement($status_select);
         unset($status_select);
     }
     // Datesub
     if ($this->isGranted(_PUBLISHER_DATESUB)) {
         $datesub = $obj->getVar('datesub') == 0 ? time() : $obj->getVar('datesub');
         $datesub_datetime = new Xoops\Form\DateTime(_CO_PUBLISHER_DATESUB, 'datesub', $datesub);
         $datesub_datetime->setDescription(_CO_PUBLISHER_DATESUB_DSC);
         $mainTab->addElement($datesub_datetime);
     }
     // NOTIFY ON PUBLISH
     if ($this->isGranted(_PUBLISHER_NOTIFY)) {
         $notify_radio = new Xoops\Form\RadioYesNo(_CO_PUBLISHER_NOTIFY, 'notify', $obj->getVar('notifypub'));
         $mainTab->addElement($notify_radio);
     }
 }