本文整理汇总了PHP中XoopsFormSelect::setExtra方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsFormSelect::setExtra方法的具体用法?PHP XoopsFormSelect::setExtra怎么用?PHP XoopsFormSelect::setExtra使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsFormSelect
的用法示例。
在下文中一共展示了XoopsFormSelect::setExtra方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: salat_block_show
function salat_block_show($options)
{
$block = array();
$infos = salat_getInfos();
$sform = new XoopsThemeForm(_MA_SALAT_GETPRAYERS, "form", XOOPS_URL . '/modules/salat/index.php');
foreach ($infos as $info) {
$options[$info['city']] = $info['city'] . ' - ' . $info['country'];
if (isset($info['default'])) {
$default = $info['city'];
}
}
$city = isset($default) ? $default : '';
$date = time();
$timezone = 0;
// City
$element = new XoopsFormSelect(_MA_SALAT_SELECT_CITY, 'city', $city);
$element->addOptionArray($options);
$element->setExtra('width="100" style="width:100px;"');
$sform->addElement($element);
unset($element);
$element = new XoopsFormTextDateSelect(_MA_SALAT_SELECT_DATE, 'date', 12, $date);
//$element->setExtra('width="100" style="width:100px;"');
$sform->addElement($element);
unset($element);
// Timezone
$element = new XoopsFormSelectTimezone(_MA_SALAT_SELECT_TIMEZONE, 'timezone', $timezone);
$element->setExtra('width="100" style="width:100px;"');
$sform->addElement($element);
unset($element);
$sform->addElement(new XoopsFormButton('', 'get_prayers', _SUBMIT, 'submit'));
$block['content'] = $sform->render();
return $block;
}
示例2: display_action_form
function display_action_form($action = "")
{
$action_options = array("no" => _SELECT, "template" => art_constant("AM_PERMISSION_TEMPLATE"), "apply" => art_constant("AM_PERMISSION_TEMPLATE_APPLY"), "default" => art_constant("AM_PERMISSION_SETBYGROUP"));
$actionform = new XoopsSimpleForm(art_constant("AM_PERMISSION_ACTION"), 'actionform', 'admin.permission.php', "GET");
$action_select = new XoopsFormSelect("", 'action', $action);
$action_select->setExtra('onchange="document.forms.actionform.submit()"');
$action_select->addOptionArray($action_options);
$actionform->addElement($action_select);
$actionform->display();
}
示例3: XoopsFormSelectEditor
/**
* Constructor
*
* @param object $form the form calling the editor selection
* @param string $name editor name
* @param string $value Pre-selected text value
* @param bool $noHtml dohtml disabled
*/
function XoopsFormSelectEditor(&$form, $name = "editor", $value = null, $noHtml = false)
{
$this->XoopsFormElementTray(_SELECTEDITOR);
$editor_handler =& xoops_gethandler("editor");
$option_select = new XoopsFormSelect("", $name, $value);
$extra = 'onchange="if(this.options[this.selectedIndex].value.length > 0 ){
window.document.forms.' . $form->getName() . '.skipValidationJS.value=1;
window.document.forms.' . $form->getName() . '.submit();
}"';
$option_select->setExtra($extra);
$option_select->addOptionArray($editor_handler->getList($noHtml));
$this->addElement($option_select);
}
示例4: getForm
/**
* @param bool $action
* @return XoopsThemeForm
*/
public function getForm($action = false)
{
global $xoopsDB, $xoopsModuleConfig;
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
$title = $this->isNew() ? sprintf(_AM_PRESENTER_CAT_ADD) : sprintf(_AM_PRESENTER_CAT_EDIT);
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
// Cat_pid
include_once XOOPS_ROOT_PATH . '/class/tree.php';
$categoriesHandler =& xoops_getModuleHandler('categories', 'presenter');
$criteria = new CriteriaCompo();
$categories = $categoriesHandler->getObjects($criteria);
if ($categories) {
$categories_tree = new XoopsObjectTree($categories, 'cat_id', 'cat_pid');
$cat_pid = $categories_tree->makeSelBox('cat_pid', 'cat_title', '--', $this->getVar('cat_pid', 'e'), false);
$form->addElement(new XoopsFormLabel(_AM_PRESENTER_CAT_PID, $cat_pid));
}
// Cat_title
$form->addElement(new XoopsFormText(_AM_PRESENTER_CAT_TITLE, 'cat_title', 50, 255, $this->getVar('cat_title')), true);
// Cat_desc
$form->addElement(new XoopsFormTextArea(_AM_PRESENTER_CAT_DESC, 'cat_desc', $this->getVar('cat_desc'), 4, 47), true);
// Cat_image
$cat_image = $this->getVar('cat_image') ? $this->getVar('cat_image') : 'blank.gif';
$uploadir = '/uploads/presenter/images/categories';
$imgtray = new XoopsFormElementTray(_AM_PRESENTER_CAT_IMAGE, '<br />');
$imgpath = sprintf(_AM_PRESENTER_FORMIMAGE_PATH, $uploadir);
$imageselect = new XoopsFormSelect($imgpath, 'cat_image', $cat_image);
$image_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $uploadir);
foreach ($image_array as $image) {
$imageselect->addOption("{$image}", $image);
}
$imageselect->setExtra("onchange='showImgSelected(\"image_cat_image\", \"cat_image\", \"" . $uploadir . "\", \"\", \"" . XOOPS_URL . "\")'");
$imgtray->addElement($imageselect);
$imgtray->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_URL . "/" . $uploadir . "/" . $cat_image . "' name='image_cat_image' id='image_cat_image' alt='' />"));
$fileseltray = new XoopsFormElementTray('', '<br />');
$fileseltray->addElement(new XoopsFormFile(_AM_PRESENTER_FORMUPLOAD, 'cat_image', $xoopsModuleConfig['maxsize']));
$fileseltray->addElement(new XoopsFormLabel(''));
$imgtray->addElement($fileseltray);
$form->addElement($imgtray);
// Cat_weight
$form->addElement(new XoopsFormText(_AM_PRESENTER_CAT_WEIGHT, 'cat_weight', 50, 255, $this->getVar('cat_weight')), false);
// Cat_color
// $form->addElement(new XoopsFormColorPicker(_AM_PRESENTER_CAT_COLOR, 'cat_color', $this->getVar('cat_color')), false);
$form->addElement(new XoopsFormHidden('op', 'save'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
return $form;
}
示例5: render
function render()
{
xoops_load('XoopsEditorHandler');
$editor_handler = XoopsEditorHandler::getInstance();
$editor_handler->allowed_editors = $this->allowed_editors;
$option_select = new XoopsFormSelect("", $this->name, $this->value);
$extra = 'onchange="if(this.options[this.selectedIndex].value.length > 0 ){
window.document.forms.' . $this->form->getName() . '.submit();
}"';
$option_select->setExtra($extra);
$option_select->addOptionArray($editor_handler->getList($this->nohtml));
$this->addElement($option_select);
return parent::render();
}
示例6: getForm
/**
* @return XoopsThemeForm
*/
function getForm()
{
if ($this->isNew()) {
$blank_img = 'blank.gif';
} else {
$blank_img = str_replace('avatars/', '', $this->getVar('avatar_file', 'e'));
}
// Get User Config
$config_handler =& xoops_gethandler('config');
$xoopsConfigUser = $config_handler->getConfigsByCat(XOOPS_CONF_USER);
// New and edit form
$form = new XoopsThemeForm(_AM_SYSTEM_AVATAR_ADD, 'avatar_form', 'admin.php', "post", true);
$form->setExtra('enctype="multipart/form-data"');
// Name
$form->addElement(new XoopsFormText(_IMAGENAME, 'avatar_name', 50, 255, $this->getVar('avatar_name', 'e')), true);
// Name description
$maxpixel = '<div>' . _US_MAXPIXEL . ' : ' . $xoopsConfigUser['avatar_width'] . ' x ' . $xoopsConfigUser['avatar_height'] . '</div>';
$maxsize = '<div>' . _US_MAXIMGSZ . ' : ' . $xoopsConfigUser['avatar_maxsize'] . '</div>';
// Upload part
$imgtray_img = new XoopsFormElementTray(_IMAGEFILE, '<br />');
$imgtray_img->setDescription($maxpixel . $maxsize);
$imageselect_img = new XoopsFormSelect(sprintf(_AM_SYSTEM_AVATAR_USE_FILE, XOOPS_UPLOAD_PATH . '/avatars/'), 'avatar_file', $blank_img);
$image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH . '/avatars');
$imageselect_img->addOption("{$blank_img}", $blank_img);
foreach ($image_array_img as $image_img) {
$imageselect_img->addOption("{$image_img}", $image_img);
}
$imageselect_img->setExtra("onchange='showImgSelected(\"xo-avatar-img\", \"avatar_file\", \"avatars\", \"\", \"" . XOOPS_UPLOAD_URL . "\")'");
$imgtray_img->addElement($imageselect_img, false);
$imgtray_img->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_UPLOAD_URL . "/avatars/" . $blank_img . "' name='image_img' id='xo-avatar-img' alt='' />"));
$fileseltray_img = new XoopsFormElementTray('<br />', '<br /><br />');
$fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_AVATAR_UPLOAD, 'avatar_file', 500000), false);
$imgtray_img->addElement($fileseltray_img);
$form->addElement($imgtray_img);
// Weight
$form->addElement(new XoopsFormText(_IMGWEIGHT, 'avatar_weight', 3, 4, $this->getVar('avatar_weight', 'e')));
// Display
$form->addElement(new XoopsFormRadioYN(_IMGDISPLAY, 'avatar_display', $this->getVar('avatar_display', 'e'), _YES, _NO));
// Hidden
if ($this->isNew()) {
$form->addElement(new XoopsFormHidden('avatar_type', 's'));
}
$form->addElement(new XoopsFormHidden('op', 'save'));
$form->addElement(new XoopsFormHidden('fct', 'avatars'));
$form->addElement(new XoopsFormHidden('avatar_id', $this->getVar('avatar_id', 'e')));
// Button
$form->addElement(new XoopsFormButton('', 'avt_button', _SUBMIT, 'submit'));
return $form;
}
示例7: editCategory
/**
* editCategory()
*
* @param integer $catid
* @return
*/
function editCategory($category_obj = null)
{
global $xoopsModule;
$category_handler =& xoops_getmodulehandler('category', 'newbb');
if (empty($category_obj)) {
$category_obj =& $category_handler->create();
}
$groups_cat_access = null;
include_once XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->getVar("dirname") . "/class/xoopsformloader.php";
if (!$category_obj->isNew()) {
$sform = new XoopsThemeForm(_AM_NEWBB_EDITCATEGORY . " " . $category_obj->getVar('cat_title'), "op", xoops_getenv('PHP_SELF'));
} else {
$sform = new XoopsThemeForm(_AM_NEWBB_CREATENEWCATEGORY, "op", xoops_getenv('PHP_SELF'));
$category_obj->setVar('cat_title', '');
$category_obj->setVar('cat_image', '');
$category_obj->setVar('cat_description', '');
$category_obj->setVar('cat_order', 0);
$category_obj->setVar('cat_url', 'http://www.myxoops.org myXOOPS Support');
}
$sform->addElement(new XoopsFormText(_AM_NEWBB_SETCATEGORYORDER, 'cat_order', 5, 10, $category_obj->getVar('cat_order')), false);
$sform->addElement(new XoopsFormText(_AM_NEWBB_CATEGORY, 'title', 50, 80, $category_obj->getVar('cat_title', 'E')), true);
$sform->addElement(new XoopsFormDhtmlTextArea(_AM_NEWBB_CATEGORYDESC, 'cat_description', $category_obj->getVar('cat_description', 'E'), 10, 60), false);
$imgdir = "/modules/" . $xoopsModule->getVar("dirname") . "/images/category";
$cat_image = $category_obj->getVar("cat_image");
$cat_image = empty($cat_image) ? 'blank.gif' : $cat_image;
$graph_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $imgdir . "/");
array_unshift($graph_array, _NONE);
$cat_image_select = new XoopsFormSelect('', 'cat_image', $category_obj->getVar('cat_image'));
$cat_image_select->addOptionArray($graph_array);
$cat_image_select->setExtra("onchange=\"showImgSelected('img', 'cat_image', '/" . $imgdir . "/', '', '" . XOOPS_URL . "')\"");
$cat_image_tray = new XoopsFormElementTray(_AM_NEWBB_IMAGE, ' ');
$cat_image_tray->addElement($cat_image_select);
$cat_image_tray->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_URL . $imgdir . "/" . $cat_image . " 'name='img' id='img' alt='' />"));
$sform->addElement($cat_image_tray);
$sform->addElement(new XoopsFormText(_AM_NEWBB_SPONSORLINK, 'cat_url', 50, 80, $category_obj->getVar('cat_url', 'E')), false);
$sform->addElement(new XoopsFormHidden('cat_id', $category_obj->getVar("cat_id")));
$button_tray = new XoopsFormElementTray('', '');
$button_tray->addElement(new XoopsFormHidden('op', 'save'));
$butt_save = new XoopsFormButton('', '', _SUBMIT, 'submit');
$butt_save->setExtra('onclick="this.form.elements.op.value=\'save\'"');
$button_tray->addElement($butt_save);
if ($category_obj->getVar("cat_id")) {
$butt_delete = new XoopsFormButton('', '', _CANCEL, 'submit');
$butt_delete->setExtra('onclick="this.form.elements.op.value=\'default\'"');
$button_tray->addElement($butt_delete);
}
$sform->addElement($button_tray);
$sform->display();
}
示例8: getForm
function getForm($action = false)
{
if ($this->isNew()) {
$blank_img = 'blank.gif';
} else {
$blank_img = str_replace('ranks/', '', $this->getVar('rank_image', 'e'));
}
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
$title = $this->isNew() ? sprintf(_AM_SYSTEM_USERRANK_ADD) : sprintf(_AM_SYSTEM_USERRANK_EDIT);
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
$form->addElement(new XoopsFormText(_AM_SYSTEM_USERRANK_TITLE, 'rank_title', 50, 50, $this->getVar('rank_title'), true));
$form->addElement(new XoopsFormText(_AM_SYSTEM_USERRANK_MINPOST, 'rank_min', 10, 10, $this->getVar('rank_min')));
$form->addElement(new XoopsFormText(_AM_SYSTEM_USERRANK_MAXPOST, 'rank_max', 10, 10, $this->getVar('rank_max')));
$imgtray_img = new XoopsFormElementTray(_AM_SYSTEM_USERRANK_IMAGE, '<br />');
$imgpath_img = sprintf(_AM_SYSTEM_USERRANK_IMAGE_PATH, XOOPS_UPLOAD_PATH . '/ranks/');
$imageselect_img = new XoopsFormSelect($imgpath_img, 'rank_image', $blank_img);
$image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH . '/ranks');
$imageselect_img->addOption("{$blank_img}", $blank_img);
foreach ($image_array_img as $image_img) {
$imageselect_img->addOption("{$image_img}", $image_img);
}
$imageselect_img->setExtra("onchange='showImgSelected(\"xo-ranks-img\", \"rank_image\", \"ranks\", \"\", \"" . XOOPS_UPLOAD_URL . "\")'");
$imgtray_img->addElement($imageselect_img, false);
$imgtray_img->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_UPLOAD_URL . "/ranks/" . $blank_img . "' name='image_img' id='xo-ranks-img' alt='' />"));
$fileseltray_img = new XoopsFormElementTray('<br />', '<br /><br />');
$fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_USERRANK_UPLOAD, 'rank_image', 500000), false);
$fileseltray_img->addElement(new XoopsFormLabel(''), false);
$imgtray_img->addElement($fileseltray_img);
$form->addElement($imgtray_img);
if (!$this->isNew()) {
$rank_special = $this->getVar('rank_special');
} else {
$rank_special = 0;
}
$special_tray = new XoopsFormElementTray(_AM_SYSTEM_USERRANK_SPECIAL, '<br />');
$special_tray->setDescription(_AM_SYSTEM_USERRANK_SPECIAL_CAN);
$special_tray->addElement(new XoopsFormRadioYN('', 'rank_special', $rank_special));
$form->addElement($special_tray);
if (!$this->isNew()) {
$form->addElement(new XoopsFormHidden('rank_id', $this->getVar('rank_id')));
}
$form->addElement(new XoopsFormHidden('op', 'userrank_save'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
return $form;
}
示例9: getForm
/**
* @param bool $action
*
* @return XoopsThemeForm
*/
function getForm($action = false)
{
if ($this->isNew()) {
$blank_img = 'blank.gif';
} else {
$blank_img = str_replace('smilies/', '', $this->getVar('smile_url', 'e'));
}
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
$title = $this->isNew() ? sprintf(_AM_SYSTEM_SMILIES_ADD) : sprintf(_AM_SYSTEM_SMILIES_EDIT);
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
$form->addElement(new XoopsFormText(_AM_SYSTEM_SMILIES_CODE, 'code', 26, 25, $this->getVar('code')), true);
$form->addElement(new XoopsFormText(_AM_SYSTEM_SMILIES_DESCRIPTION, 'emotion', 50, 50, $this->getVar('emotion')), true);
$imgtray_img = new XoopsFormElementTray(_AM_SYSTEM_SMILIES_FILE, '<br />');
$imgpath_img = sprintf(_AM_SYSTEM_SMILIES_IMAGE_PATH, XOOPS_UPLOAD_PATH . '/smilies/');
$imageselect_img = new XoopsFormSelect($imgpath_img, 'smile_url', $blank_img);
$image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH . '/smilies');
$imageselect_img->addOption("{$blank_img}", $blank_img);
foreach ($image_array_img as $image_img) {
$imageselect_img->addOption("{$image_img}", $image_img);
}
$imageselect_img->setExtra('onchange="showImgSelected(\'xo-smilies-img\', \'smile_url\', \'smilies\', \'\', \'' . XOOPS_UPLOAD_URL . '\' )"');
$imgtray_img->addElement($imageselect_img, false);
$imgtray_img->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_UPLOAD_URL . "/smilies/" . $blank_img . "' name='image_img' id='xo-smilies-img' alt='' />"));
$fileseltray_img = new XoopsFormElementTray('<br />', '<br /><br />');
$fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_SMILIES_UPLOADS, 'smile_url', 500000), false);
$fileseltray_img->addElement(new XoopsFormLabel(''), false);
$imgtray_img->addElement($fileseltray_img);
$form->addElement($imgtray_img);
if (!$this->isNew()) {
$form->addElement(new XoopsFormHidden('smilies_id', $this->getVar('id')));
$display = $this->getVar('display');
} else {
$display = 0;
}
$form->addElement(new XoopsFormRadioYN(_AM_SYSTEM_SMILIES_OFF, 'display', $display));
$form->addElement(new XoopsFormHidden('op', 'save_smilie'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
return $form;
}
示例10: getForm
/**
* @return XoopsThemeForm
*/
public function getForm()
{
if ($this->isNew()) {
$blank_img = 'blank.gif';
} else {
$blank_img = $this->getVar('avatar_file', 'e');
}
// Get User Config
$config_handler = xoops_getHandler('config');
$xoopsConfigUser = $config_handler->getConfigsByCat(XOOPS_CONF_USER);
$form = new XoopsThemeForm(_AM_SYSTEM_AVATAR_ADD, 'avatar_form', 'admin.php', 'post', true);
$form->setExtra('enctype="multipart/form-data"');
$form->addElement(new XoopsFormText(_IMAGENAME, 'avatar_name', 50, 255, $this->getVar('avatar_name', 'e')), true);
$maxpixel = '<div class="small basic italic">' . _US_MAXPIXEL . ' : ' . $xoopsConfigUser['avatar_width'] . ' x ' . $xoopsConfigUser['avatar_height'] . '</div>';
$maxsize = '<div class="small basic italic">' . _US_MAXIMGSZ . ' : ' . $xoopsConfigUser['avatar_maxsize'] . '</div>';
$uploadirectory_img = '';
$imgtray_img = new XoopsFormElementTray(_IMAGEFILE . '<br><br>' . $maxpixel . $maxsize, '<br>');
$imageselect_img = new XoopsFormSelect(sprintf(_AM_SYSTEM_AVATAR_USE_FILE, XOOPS_UPLOAD_PATH), 'avatar_file', $blank_img);
$image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH);
$imageselect_img->addOption("{$blank_img}", $blank_img);
foreach ($image_array_img as $image_img) {
// if (preg_match('#avt#', $image_img)) {
if (false !== strpos(image_img, 'avt')) {
$imageselect_img->addOption("{$image_img}", $image_img);
}
}
$imageselect_img->setExtra("onchange='showImgSelected(\"image_img\", \"avatar_file\", \"" . $uploadirectory_img . "\", \"\", \"" . XOOPS_UPLOAD_URL . "\")'");
$imgtray_img->addElement($imageselect_img, false);
$imgtray_img->addElement(new XoopsFormLabel('', "<br><img src='" . XOOPS_UPLOAD_URL . '/' . $blank_img . "' name='image_img' id='image_img' alt='' />"));
$fileseltray_img = new XoopsFormElementTray('<br>', '<br><br>');
$fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_AVATAR_UPLOAD, 'avatar_file', 500000), false);
$imgtray_img->addElement($fileseltray_img);
$form->addElement($imgtray_img);
$form->addElement(new XoopsFormText(_IMGWEIGHT, 'avatar_weight', 3, 4, $this->getVar('avatar_weight', 'e')));
$form->addElement(new XoopsFormRadioYN(_IMGDISPLAY, 'avatar_display', $this->getVar('avatar_display', 'e'), _YES, _NO));
$form->addElement(new XoopsFormHidden('op', 'save'));
$form->addElement(new XoopsFormHidden('fct', 'avatars'));
$form->addElement(new XoopsFormHidden('avatar_id', $this->getVar('avatar_id', 'e')));
$form->addElement(new XoopsFormButton('', 'avt_button', _SUBMIT, 'submit'));
return $form;
}
示例11: ExtcalFormDateTime
function ExtcalFormDateTime(&$form, $startTS = 0, $endTS = 0)
{
$startTS = intval($startTS);
$startTS = $startTS > 0 ? $startTS : time();
$startDatetime = getDate($startTS);
$endTS = intval($endTS);
$endTS = $endTS > 0 ? $endTS : time();
$endDatetime = getDate($endTS);
$timearray = array();
for ($i = 0; $i < 24; $i++) {
for ($j = 0; $j < 60; $j = $j + 10) {
$key = $i * 3600 + $j * 60;
$timearray[$key] = $j != 0 ? $i . ':' . $j : $i . ':0' . $j;
}
}
ksort($timearray);
// Start date element's form
$startElmtTray = new XoopsFormElementTray(_MD_EXTCAL_START_DATE, ' ');
$startDate = new XoopsFormTextDateSelect('', 'event_start[date]', 15, $startTS);
$startDate->setExtra('onBlur=\'validDate("event_start[date]", "event_start[time]", "event_end[date]", "event_end[time]");\'');
$startElmtTray->addElement($startDate);
$startTime = new XoopsFormSelect('', 'event_start[time]', $startDatetime['hours'] * 3600 + 600 * ceil($startDatetime['minutes'] / 10));
$startTime->setExtra('onChange=\'validDate("event_start[date]", "event_start[time]", "event_end[date]", "event_end[time]");\'');
$startTime->addOptionArray($timearray);
$startElmtTray->addElement($startTime);
$form->addElement($startElmtTray, true);
// End date element's form
$endElmtTray = new XoopsFormElementTray(_MD_EXTCAL_END_DATE, '<br />');
$endDateElmtTray = new XoopsFormElementTray('', " ");
$endElmtTray->addElement(new XoopsFormRadioYN(_MD_EXTCAL_EVENT_END, 'have_end', 1));
$endDate = new XoopsFormTextDateSelect('', 'event_end[date]', 15, $endTS);
$endDate->setExtra('onBlur=\'validDate("event_start[date]", "event_start[time]", "event_end[date]", "event_end[time]");\'');
$endDateElmtTray->addElement($endDate);
$endTime = new XoopsFormSelect('', 'event_end[time]', $endDatetime['hours'] * 3600 + 600 * ceil($endDatetime['minutes'] / 10));
$endTime->setExtra('onChange=\'validDate("event_start[date]", "event_start[time]", "event_end[date]", "event_end[time]");\'');
$endTime->addOptionArray($timearray);
$endDateElmtTray->addElement($endTime);
$endElmtTray->addElement($endDateElmtTray);
$form->addElement($endElmtTray);
}
示例12: getForm
function getForm($action = false)
{
global $xoopsDB, $xoopsModule, $xoopsModuleConfig;
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
$title = $this->isNew() ? sprintf(_AM_TDMCREATE_MODULES_ADD) : sprintf(_AM_TDMCREATE_MODULES_EDIT);
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
$form = new XoopsThemeForm($title, 'form_modules', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
$form->insertBreak('<div align="center"><b>' . _AM_TDMCREATE_MODULES_IMPORTANT . '</b></div>', 'head');
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_NAME, 'modules_name', 50, 255, $this->getVar('modules_name')), true);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_VERSION, 'modules_version', 50, 255, $this->getVar('modules_version')), true);
$form->addElement(new XoopsFormTextArea(_AM_TDMCREATE_MODULES_DESCRIPTION, 'modules_description', $this->getVar('modules_description'), 3, 47), true);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_AUTHOR, 'modules_author', 50, 255, $this->getVar('modules_author')), true);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_LICENSE, 'modules_license', 50, 255, $this->getVar('modules_license')), true);
$modules_display_menu = $this->isNew() ? '1' : $this->getVar('modules_display_menu');
$form->addElement(new XoopsFormRadioYN(_AM_TDMCREATE_MODULES_DISPLAY_MENU, 'modules_display_menu', $modules_display_menu, _YES, _NO));
$modules_display_admin = $this->isNew() ? '1' : $this->getVar('modules_display_admin');
$form->addElement(new XoopsFormRadioYN(_AM_TDMCREATE_MODULES_DISPLAY_ADMIN, 'modules_display_admin', $modules_display_admin, _YES, _NO));
$modules_active_search = $this->isNew() ? '1' : $this->getVar('modules_active_search');
$form->addElement(new XoopsFormRadioYN(_AM_TDMCREATE_MODULES_ACTIVE_SEARCH, 'modules_active_search', $modules_active_search, _YES, _NO));
$modules_image = $this->getVar('modules_image') ? $this->getVar('modules_image') : 'blank.gif';
$uploadirectory = "/modules/" . $xoopsModule->dirname() . "/images/uploads/modules";
$imgtray = new XoopsFormElementTray(_AM_TDMCREATE_MODULES_IMAGE, '<br />');
$imgpath = sprintf(_AM_TDMCREATE_FORMIMAGE_PATH, "./modules/" . $xoopsModule->dirname() . "/images/uploads/modules");
$imageselect = new XoopsFormSelect($imgpath, 'modules_image', $modules_image);
$modules_image_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $uploadirectory);
foreach ($modules_image_array as $image) {
$imageselect->addOption("{$image}", $image);
}
$imageselect->setExtra("onchange='showImgSelected(\"image3\", \"modules_image\", \"" . $uploadirectory . "\", \"\", \"" . XOOPS_URL . "\")'");
$imgtray->addElement($imageselect, false);
$imgtray->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_URL . "/" . $uploadirectory . "/" . $modules_image . "' name='image3' id='image3' alt='' />"));
$fileseltray = new XoopsFormElementTray('', '<br />');
$fileseltray->addElement(new XoopsFormFile(_AM_TDMCREATE_FORMUPLOAD, 'attachedfile', 104857600), false);
$fileseltray->addElement(new XoopsFormLabel(''), false);
$imgtray->addElement($fileseltray);
$form->addElement($imgtray);
$form->insertBreak('<div align="center"><b>' . _AM_TDMCREATE_MODULES_NOTIMPORTANT . '</b></div>', 'head');
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_AUTHOR_WEBSITE_URL, 'modules_author_website_url', 50, 255, $this->getVar('modules_author_website_url')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_AUTHOR_WEBSITE_NAME, 'modules_author_website_name', 50, 255, $this->getVar('modules_author_website_name')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_CREDITS, 'modules_credits', 50, 255, $this->getVar('modules_credits')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_RELEASE_INFO, 'modules_release_info', 50, 255, $this->getVar('modules_release_info')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_RELEASE_FILE, 'modules_release_file', 50, 255, $this->getVar('modules_release_file')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_MANUAL, 'modules_manual', 50, 255, $this->getVar('modules_manual')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_MANUAL_FILE, 'modules_manual_file', 50, 255, $this->getVar('modules_manual_file')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_DEMO_SITE_URL, 'modules_demo_site_url', 50, 255, $this->getVar('modules_demo_site_url')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_DEMO_SITE_NAME, 'modules_demo_site_name', 50, 255, $this->getVar('modules_demo_site_name')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_MODULE_WEBSITE_URL, 'modules_module_website_url', 50, 255, $this->getVar('modules_module_website_url')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_MODULE_WEBSITE_NAME, 'modules_module_website_name', 50, 255, $this->getVar('modules_module_website_name')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_RELEASE, 'modules_release', 50, 255, $this->getVar('modules_release')), false);
$form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_STATUS, 'modules_module_status', 50, 255, $this->getVar('modules_module_status')), false);
$form->addElement(new XoopsFormHidden('op', 'modules_save'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
$form->display();
return $form;
}
示例13: editclient
function editclient($showmenu = false, $id = 0)
{
global $client_handler, $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule;
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
// If there is a parameter, and the id exists, retrieve data: we're editing a client
if ($id != 0) {
// Creating the client object
$clientObj = new SmartclientClient($id);
if ($clientObj->notLoaded()) {
redirect_header("client.php", 1, _AM_SCLIENT_NOCLIENTSELECTED);
exit;
}
switch ($clientObj->status()) {
case _SCLIENT_STATUS_SUBMITTED:
$breadcrumb_action1 = _AM_SCLIENT_SUBMITTED_CLIENTS;
$breadcrumb_action2 = _AM_SCLIENT_APPROVING;
$page_title = _AM_SCLIENT_SUBMITTED_TITLE;
$page_info = _AM_SCLIENT_SUBMITTED_INFO;
$button_caption = _AM_SCLIENT_APPROVE;
$new_status = _SCLIENT_STATUS_ACTIVE;
break;
case _SCLIENT_STATUS_ACTIVE:
$breadcrumb_action1 = _AM_SCLIENT_ACTIVE_CLIENTS;
$breadcrumb_action2 = _AM_SCLIENT_EDITING;
$page_title = _AM_SCLIENT_ACTIVE_EDITING;
$page_info = _AM_SCLIENT_ACTIVE_EDITING_INFO;
$button_caption = _AM_SCLIENT_MODIFY;
$new_status = _SCLIENT_STATUS_ACTIVE;
break;
case _SCLIENT_STATUS_INACTIVE:
$breadcrumb_action1 = _AM_SCLIENT_INACTIVE_CLIENTS;
$breadcrumb_action2 = _AM_SCLIENT_EDITING;
$page_title = _AM_SCLIENT_INACTIVE_EDITING;
$page_info = _AM_SCLIENT_INACTIVE_EDITING_INFO;
$button_caption = _AM_SCLIENT_MODIFY;
$new_status = _SCLIENT_STATUS_INACTIVE;
break;
case _SCLIENT_STATUS_REJECTED:
$breadcrumb_action1 = _AM_SCLIENT_REJECTED_CLIENTS;
$breadcrumb_action2 = _AM_SCLIENT_EDITING;
$page_title = _AM_SCLIENT_REJECTED_EDITING;
$page_info = _AM_SCLIENT_REJECTED_EDITING_INFO;
$button_caption = _AM_SCLIENT_MODIFY;
$new_status = _SCLIENT_STATUS_REJECTED;
break;
case "default":
default:
break;
}
if ($showmenu) {
smartclient_adminMenu(1, $breadcrumb_action1 . " > " . $breadcrumb_action2);
}
echo "<br />\n";
smartclient_collapsableBar('bottomtable', 'bottomtableicon');
echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a> " . $page_title . "</h3>";
echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . $page_info . "</span>";
echo "<div id='bottomtable'>";
} else {
// there's no parameter, so we're adding a client
$clientObj =& $client_handler->create();
$breadcrumb_action1 = _AM_SCLIENT_CLIENTS;
$breadcrumb_action2 = _AM_SCLIENT_CREATE;
$button_caption = _AM_SCLIENT_CREATE;
$new_status = _SCLIENT_STATUS_ACTIVE;
if ($showmenu) {
smartclient_adminMenu(1, $breadcrumb_action1 . " > " . $breadcrumb_action2);
}
smartclient_collapsableBar('bottomtable', 'bottomtableicon');
echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a> " . _AM_SCLIENT_CLIENT_CREATING . "</h3>";
echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_SCLIENT_CLIENT_CREATING_DSC . "</span>";
echo "<div id='bottomtable'>";
}
// CLIENT FORM
$sform = new XoopsThemeForm(_AM_SCLIENT_CLIENTS, "op", xoops_getenv('PHP_SELF'));
$sform->setExtra('enctype="multipart/form-data"');
// TITLE
$title_text = new XoopsFormText(_CO_SCLIENT_TITLE_REQ, 'title', 50, 255, $clientObj->title('e'));
$sform->addElement($title_text, true);
// LOGO
$logo_array =& XoopsLists::getImgListAsArray(smartclient_getImageDir());
$logo_select = new XoopsFormSelect('', 'image', $clientObj->image());
$logo_select->addOption('-1', '---------------');
$logo_select->addOptionArray($logo_array);
$logo_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/' . SMARTCLIENT_DIRNAME . '/images' . "\", \"\", \"" . XOOPS_URL . "\")'");
$logo_tray = new XoopsFormElementTray(_AM_SCLIENT_LOGO, ' ');
$logo_tray->addElement($logo_select);
$logo_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartclient_getImageDir('', false) . $clientObj->image() . "' name='image3' id='image3' alt='' />"));
$logo_tray->setDescription(_AM_SCLIENT_LOGO_DSC);
$sform->addElement($logo_tray);
// LOGO UPLOAD
$max_size = 5000000;
$file_box = new XoopsFormFile(_AM_SCLIENT_LOGO_UPLOAD, "logo_file", $max_size);
$file_box->setExtra("size ='45'");
$file_box->setDescription(sprintf(_AM_SCLIENT_LOGO_UPLOAD_DSC, $xoopsModuleConfig['img_max_width'], $xoopsModuleConfig['img_max_height']));
$sform->addElement($file_box);
// IMAGE_URL
$image_url_text = new XoopsFormText(_CO_SCLIENT_IMAGE_URL, 'image_url', 50, 255, $clientObj->image_url());
$image_url_text->setDescription(_CO_SCLIENT_IMAGE_URL_DSC);
$sform->addElement($image_url_text, false);
// URL
//.........这里部分代码省略.........
示例14: topicsmanager
function topicsmanager()
{
global $xoopsModule, $xoopsModuleConfig, $xoopsDB;
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
//$uploadfolder=sprintf(_AMS_AM_UPLOAD_WARNING,XOOPS_URL . "/modules/" . $xoopsModule -> dirname().'/images/topics');
$uploadirectory = "/modules/" . $xoopsModule->dirname() . '/images/topics';
$start = isset($_GET['start']) ? intval($_GET['start']) : 0;
include_once XOOPS_ROOT_PATH . "/class/tree.php";
$xt = new AmsTopic($xoopsDB->prefix("ams_topics"));
$allTopics = $xt->getAllTopics();
$totaltopics = count($allTopics);
if ($totaltopics > 0) {
$topic_obj_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid');
$topics_arr = $topic_obj_tree->getAllChild(0);
}
echo "<form action='index.php' method='POST'>";
echo "<div class=\"odd\">";
echo "<div style='text-align: center;'><b>" . _AMS_AM_TOPICSMNGR . ' (' . ($start + 1) . '-' . ($start + $xoopsModuleConfig['storycountadmin'] > $totaltopics ? $totaltopics : $start + $xoopsModuleConfig['storycountadmin']) . ' ' . _AMS_AM_OF . ' ' . $totaltopics . ')' . "</b><br /><br />";
echo "<table border='1' width='100%'><tr class='bg3'><td align='center'>" . _AMS_AM_TOPIC . "</td><td align='left'>" . _AMS_AM_TOPICNAME . "</td><td align='center'>" . _AMS_AM_PARENTTOPIC . "</td><td> " . _AMS_AM_WEIGHT . " </td><td align='center'>" . _AMS_AM_ACTION . "</td></tr>";
//If topic not empty
if ($totaltopics > 0) {
$i = 0;
foreach ($topics_arr as $thisTopic) {
$i++;
if ($i > $start && $i - $start <= $xoopsModuleConfig['storycountadmin']) {
$linkedit = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/admin/index.php?op=topicsmanager&topic_id=' . $thisTopic->topic_id();
$linkdelete = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/admin/index.php?op=delTopic&topic_id=' . $thisTopic->topic_id();
$action = sprintf("<a href='%s'>%s</a> - <a href='%s'>%s</a>", $linkedit, _AMS_AM_EDIT, $linkdelete, _AMS_AM_DELETE);
$parent = ' ';
$pid = $thisTopic->topic_pid();
if ($pid > 0) {
$parent = $topics_arr[$pid]->topic_title();
$thisTopic->prefix = str_replace(".", "-", $thisTopic->prefix) . ' ';
} else {
$thisTopic->prefix = str_replace(".", "", $thisTopic->prefix);
}
echo "<tr><td>" . $thisTopic->topic_id() . "</td><td align='left'>" . $thisTopic->prefix() . $thisTopic->topic_title() . "</td><td align='left'>" . $parent . "</td><td align='center'><input type='text' name='weight[" . $thisTopic->topic_id() . "]' value='" . $thisTopic->weight . "' size='10' maxlength='10' /> </td><td>" . $action . "</td></tr>";
}
}
echo "<tr><td colspan='3'></td><td><input type='hidden' name='op' value='reorder' />\r\n <input type='submit' name='submit' value='" . _AMS_AM_SUBMIT . "' /></td><td></td></tr>";
}
echo "</table></div></div></form>";
if ($totaltopics > $xoopsModuleConfig['storycountadmin']) {
$pagenav = new XoopsPageNav($totaltopics, $xoopsModuleConfig['storycountadmin'], $start, 'start', 'op=topicsmanager');
echo "<div align='right'>";
echo $pagenav->renderNav() . '</div><br />';
}
$topic_id = isset($_GET['topic_id']) ? intval($_GET['topic_id']) : 0;
if ($topic_id > 0) {
$xtmod = $topics_arr[$topic_id];
$topic_title = $xtmod->topic_title('E');
$op = 'modTopicS';
if (trim($xtmod->topic_imgurl()) != '') {
$topicimage = $xtmod->topic_imgurl();
} else {
$topicimage = "blank.png";
}
$btnlabel = _AMS_AM_MODIFY;
$parent = $xtmod->topic_pid();
$formlabel = _AMS_AM_MODIFYTOPIC;
$banner = $xtmod->banner;
$banner_inherit = $xtmod->banner_inherit;
$forum = $xtmod->forum_id;
unset($xtmod);
} else {
$topic_title = '';
$op = 'addTopic';
$topicimage = 'xoops.gif';
$btnlabel = _AMS_AM_ADD;
$parent = 0;
$formlabel = _AMS_AM_ADD_TOPIC;
$banner = '';
$banner_inherit = 0;
$forum = 0;
}
$sform = new XoopsThemeForm($formlabel, "topicform", XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/index.php', 'post');
$sform->setExtra('enctype="multipart/form-data"');
$sform->addElement(new XoopsFormText(_AMS_AM_TOPICNAME . ' ' . _AMS_AM_MAX40CHAR, 'topic_title', 40, 50, $topic_title), true);
$sform->addElement(new XoopsFormHidden('op', $op), false);
$sform->addElement(new XoopsFormHidden('topic_id', $topic_id), false);
if ($totaltopics > 0) {
$sform->addElement(new XoopsFormLabel(_AMS_AM_PARENTTOPIC, $topic_obj_tree->makeSelBox('topic_pid', 'topic_title', '--', $parent, true)));
} else {
$sform->addElement(new XoopsFormHidden('topic_pid', 0));
}
// ********** Picture
$imgtray = new XoopsFormElementTray(_AMS_AM_TOPICIMG, '<br />');
$imgpath = sprintf(_AMS_AM_IMGNAEXLOC, "modules/" . $xoopsModule->dirname() . "/images/topics/");
$imageselect = new XoopsFormSelect($imgpath, 'topic_imgurl', $topicimage);
$topics_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/modules/AMS/images/topics/");
foreach ($topics_array as $image) {
$imageselect->addOption("{$image}", $image);
}
$imageselect->setExtra("onchange='showImgSelected(\"image3\", \"topic_imgurl\", \"" . $uploadirectory . "\", \"\", \"" . XOOPS_URL . "\")'");
$imgtray->addElement($imageselect, false);
$imgtray->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_URL . "/" . $uploadirectory . "/" . $topicimage . "' name='image3' id='image3' alt='' />"));
$uploadfolder = sprintf(_AMS_AM_UPLOAD_WARNING, XOOPS_URL . "/modules/" . $xoopsModule->dirname() . '/images/topics');
$fileseltray = new XoopsFormElementTray('', '<br />');
$fileseltray->addElement(new XoopsFormFile(_AMS_AM_TOPIC_PICTURE, 'attachedfile', $xoopsModuleConfig['maxuploadsize']), false);
$fileseltray->addElement(new XoopsFormLabel($uploadfolder), false);
//.........这里部分代码省略.........
示例15: XoopsPoll
}
if ( $op == "addmore" ) {
$poll = new XoopsPoll($_GET['poll_id']);
$poll_form = new XoopsThemeForm(_AM_ADDMORE, "poll_form", "index.php", 'post', true);
$question_label = new XoopsFormLabel(_AM_POLLQUESTION, $poll->getVar("question"));
$poll_form->addElement($question_label);
$option_tray = new XoopsFormElementTray(_AM_POLLOPTIONS, "");
$barcolor_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH."/modules/xoopspoll/images/colorbars/");
for($i = 0; $i < 10; $i++){
$current_bar = (current($barcolor_array) != "blank.gif") ? current($barcolor_array) : next($barcolor_array);
$option_text = new XoopsFormText("", "option_text[]", 50, 255);
$option_tray->addElement($option_text);
$color_select = new XoopsFormSelect("", "option_color[".$i."]", $current_bar);
$color_select->addOptionArray($barcolor_array);
$color_select->setExtra("onchange='showImgSelected(\"option_color_image[".$i."]\", \"option_color[".$i."]\", \"modules/xoopspoll/images/colorbars\", \"\", \"".XOOPS_URL."\")'");
$color_label = new XoopsFormLabel("", "<img src='".XOOPS_URL."/modules/xoopspoll/images/colorbars/".$current_bar."' name='option_color_image[".$i."]' id='option_color_image[".$i."]' width='30' align='bottom' height='15' alt='' /><br />");
$option_tray->addElement($color_select);
$option_tray->addElement($color_label);
unset($color_select, $color_label, $option_text);
if ( !next($barcolor_array) ) {
reset($barcolor_array);
}
}
$poll_form->addElement($option_tray);
$submit_button = new XoopsFormButton("", "poll_submit", _SUBMIT, "submit");
$poll_form->addElement($submit_button);
$op_hidden = new XoopsFormHidden("op", "savemore");
$poll_form->addElement($op_hidden);
$poll_id_hidden = new XoopsFormHidden("poll_id", $poll->getVar("poll_id"));
$poll_form->addElement($poll_id_hidden);