Beispiel #1
0
 /**
  * @return void
  */
 public function getDump()
 {
     $xoops = Xoops::getInstance();
     $maintenance = new Maintenance();
     parent::__construct('', "form_dump", "dump.php", 'post', true);
     $dump_tray = new Xoops\Form\ElementTray(_AM_MAINTENANCE_DUMP_TABLES_OR_MODULES, '');
     $select_tables1 = new Xoops\Form\Select('', "dump_tables", '', 7, true);
     $select_tables1->addOptionArray($maintenance->displayTables(true));
     $dump_tray->addElement($select_tables1, false);
     $ele = new Xoops\Form\Select('     ' . _AM_MAINTENANCE_OR . '     ', 'dump_modules', '', 7, true);
     $module_list = XoopsLists::getModulesList();
     $module_handler = $xoops->getHandlerModule();
     foreach ($module_list as $file) {
         if (XoopsLoad::fileExists(\XoopsBaseConfig::get('root-path') . '/modules/' . $file . '/xoops_version.php')) {
             clearstatcache();
             $file = trim($file);
             $module = $module_handler->create();
             $module->loadInfo($file);
             if ($module->getInfo('tables') && $xoops->isActiveModule($file)) {
                 $ele->addOption($module->getInfo('dirname'), $module->getInfo('name'));
             }
             unset($module);
         }
     }
     $dump_tray->addElement($ele);
     $this->addElement($dump_tray);
     $this->addElement(new Xoops\Form\RadioYesNo(_AM_MAINTENANCE_DUMP_DROP, 'drop', 1));
     $this->addElement(new Xoops\Form\Hidden("op", "dump_save"));
     $this->addElement(new Xoops\Form\Button("", "dump_save", XoopsLocale::A_SUBMIT, "submit"));
 }
Beispiel #2
0
 /**
  * @param BannersBannerclient $obj
  */
 public function __construct(BannersBannerClient $obj)
 {
     $title = $obj->isNew() ? sprintf(_AM_BANNERS_CLIENTS_ADD) : sprintf(_AM_BANNERS_CLIENTS_EDIT);
     parent::__construct($title, 'form', 'clients.php', 'post', true);
     $this->addElement(new Xoops\Form\Text(_AM_BANNERS_CLIENTS_NAME, 'name', 5, 255, $obj->getVar('bannerclient_name')), true);
     // date
     if ($obj->isNew()) {
         $user = '******';
     } else {
         if ($obj->getVar('bannerclient_uid') == 0) {
             $user = '******';
         } else {
             $user = '******';
         }
     }
     $uname = new Xoops\Form\ElementTray(_AM_BANNERS_CLIENTS_UNAME, '');
     $type = new Xoops\Form\Radio('', 'user', $user);
     $options = array('N' => _AM_BANNERS_CLIENTS_UNAME_NO, 'Y' => _AM_BANNERS_CLIENTS_UNAME_YES);
     $type->addOptionArray($options);
     $uname->addElement($type);
     $uname->addElement(new Xoops\Form\SelectUser('', 'uid', false, $obj->getVar('bannerclient_uid'), 1, false));
     $this->addElement($uname);
     $this->addElement(new Xoops\Form\TextArea(_AM_BANNERS_CLIENTS_EXTRAINFO, 'extrainfo', $obj->getVar('bannerclient_extrainfo'), 5, 5), false);
     if (!$obj->isNew()) {
         $this->addElement(new Xoops\Form\Hidden('cid', $obj->getVar('bannerclient_cid')));
     }
     $this->addElement(new Xoops\Form\Hidden('op', 'save'));
     $this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
 }
Beispiel #3
0
 /**
  *__construct
  *
  * @param array $xlanguage language options array
  */
 public function __construct($xlanguage)
 {
     $xoops = Xoops::getInstance();
     parent::__construct('', 'xlanguage_form', $xoops->getEnv('PHP_SELF'), 'post', true, 'horizontal');
     $lang_tray = new Xoops\Form\Select(_XLANGUAGE_TINYMCE_SUBTITLE, 'select_language');
     $lang_tray->addOption('', _XLANGUAGE_TINYMCE_SELECT);
     foreach ($xlanguage as $k => $v) {
         $lang_tray->addOption($v['xlanguage_code'], $v['xlanguage_description']);
     }
     $this->addElement($lang_tray, true);
     $text_tray = new Xoops\Form\TextArea('', 'text_language', '', 7, 7);
     $text_tray->setExtra('onkeyup="Xoops_xlanguageDialog.onkeyupMLC(this);"');
     $this->addElement($text_tray);
     $this->addElement(new Xoops\Form\Raw('<div id="text_language_msg"><script type="text/javascript">Xoops_xlanguageDialog.onkeyupMLC(this);</script></div>'));
     /**
      * Buttons
      */
     $button_tray = new Xoops\Form\ElementTray('', '');
     $button = new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'insert');
     $button->setExtra('onclick="Xoops_xlanguageDialog.insertMLC();return false;"');
     $button->setClass('btn btn-success');
     $button_tray->addElement($button);
     $button_2 = new Xoops\Form\Button('', 'button', XoopsLocale::A_CLOSE, 'button');
     $button_2->setExtra('onclick="tinyMCEPopup.close();"');
     $button_2->setClass('btn btn-danger');
     $button_tray->addElement($button_2);
     $this->addElement($button_tray);
 }
Beispiel #4
0
 public function __construct(AvatarsAvatar $obj)
 {
     if ($obj->isNew()) {
         $blank_img = 'blank.gif';
     } else {
         $blank_img = str_replace('avatars/', '', $obj->getVar('avatar_file', 'e'));
     }
     //$xoops = Xoops::getInstance();
     // New and edit form
     $title = $obj->isNew() ? XoopsLocale::A_ADD : XoopsLocale::A_EDIT;
     $action = $_SERVER['REQUEST_URI'];
     parent::__construct($title, 'avatar_form', $action, "post", true);
     $this->setExtra('enctype="multipart/form-data"');
     // Name
     $this->addElement(new Xoops\Form\Text(XoopsLocale::NAME, 'avatar_name', 5, 255, $obj->getVar('avatar_name', 'e')), true);
     // Upload part
     $imgtray_img = new Xoops\Form\ElementTray(XoopsLocale::FILE, '<br />');
     $avatars_path = \XoopsBaseConfig::get('uploads-path') . '/avatars';
     $imageselect_img = new Xoops\Form\Select(sprintf(XoopsLocale::F_FILE_EXISTS_IN, $avatars_path . '/'), 'avatar_file', $blank_img);
     $image_array_img = XoopsLists::getImgListAsArray($avatars_path);
     $imageselect_img->addOption("{$blank_img}", $blank_img);
     foreach ($image_array_img as $image_img) {
         $imageselect_img->addOption("{$image_img}", $image_img);
     }
     $xoops_upload_url = \XoopsBaseConfig::get('uploads-url');
     $imageselect_img->setExtra("onchange='showImgSelected(\"xo-avatar-img\", \"avatar_file\", \"avatars\", \"\", \"" . $xoops_upload_url . "\")'");
     $imgtray_img->addElement($imageselect_img, false);
     $imgtray_img->addElement(new Xoops\Form\Label('', "<br /><img src='" . $xoops_upload_url . "/avatars/" . $blank_img . "' name='image_img' id='xo-avatar-img' alt='' />"));
     $fileseltray_img = new Xoops\Form\ElementTray('<br />', '<br /><br />');
     $fileseltray_img->addElement(new Xoops\Form\File(XoopsLocale::A_UPLOAD, 'avatar_file'), false);
     // , $xoops->getModuleConfig('avatars_imagefilesize')
     $imgtray_img->addElement($fileseltray_img);
     $this->addElement($imgtray_img);
     // Weight
     $weight = new Xoops\Form\Text(XoopsLocale::DISPLAY_ORDER, 'avatar_weight', 1, 4, $obj->getVar('avatar_weight', 'e'), '');
     $weight->setPattern('^\\d+$', XoopsLocale::E_YOU_NEED_A_POSITIVE_INTEGER);
     $this->addElement($weight, true);
     // Display
     $this->addElement(new Xoops\Form\RadioYesNo(XoopsLocale::DISPLAY_THIS_ITEM, 'avatar_display', $obj->getVar('avatar_display', 'e'), XoopsLocale::YES, XoopsLocale::NO));
     // Hidden
     if ($obj->isNew()) {
         $this->addElement(new Xoops\Form\Hidden('avatar_type', 's'));
     }
     $this->addElement(new Xoops\Form\Hidden('op', 'save'));
     $this->addElement(new Xoops\Form\Hidden('avatar_id', $obj->getVar('avatar_id', 'e')));
     // Button
     $this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
 }
Beispiel #5
0
 /**
  * @param UserrankRank|XoopsObject $obj
  */
 public function __construct(XoopsObject $obj)
 {
     if ($obj->isNew()) {
         $blank_img = 'blank.gif';
     } else {
         $blank_img = str_replace('ranks/', '', $obj->getVar('rank_image', 'e'));
     }
     $title = $obj->isNew() ? sprintf(_AM_USERRANK_ADD) : sprintf(_AM_USERRANK_EDIT);
     parent::__construct($title, 'form', 'userrank.php', 'post', true);
     $this->setExtra('enctype="multipart/form-data"');
     $this->addElement(new Xoops\Form\Text(_AM_USERRANK_TITLE, 'rank_title', 4, 50, $obj->getVar('rank_title')), true);
     $min = new Xoops\Form\Text(_AM_USERRANK_MINPOST, 'rank_min', 1, 10, $obj->getVar('rank_min'));
     $min->setPattern('^\\d+$', _AM_USERRANK_ERROR_POST);
     $this->addElement($min);
     $max = new Xoops\Form\Text(_AM_USERRANK_MAXPOST, 'rank_max', 1, 10, $obj->getVar('rank_max'));
     $max->setPattern('^\\d+$', _AM_USERRANK_ERROR_POST);
     $this->addElement($max);
     $imgtray_img = new Xoops\Form\ElementTray(_AM_USERRANK_IMAGE, '<br />');
     $imgpath_img = sprintf(_AM_USERRANK_IMAGE_PATH, \XoopsBaseConfig::get('uploads-path') . '/ranks/');
     $imageselect_img = new Xoops\Form\Select($imgpath_img, 'rank_image', $blank_img);
     $image_array_img = XoopsLists::getImgListAsArray(\XoopsBaseConfig::get('uploads-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\", \"\", \"" . \XoopsBaseConfig::get('uploads-url') . "\")'");
     $imgtray_img->addElement($imageselect_img, false);
     $imgtray_img->addElement(new Xoops\Form\Label('', "<br /><img src='" . \XoopsBaseConfig::get('uploads-url') . "/ranks/" . $blank_img . "' name='image_img' id='xo-ranks-img' alt='' />"));
     $fileseltray_img = new Xoops\Form\ElementTray('<br />', '<br /><br />');
     $fileseltray_img->addElement(new Xoops\Form\File(_AM_USERRANK_UPLOAD, 'rank_image'), false);
     $fileseltray_img->addElement(new Xoops\Form\Label(''), false);
     $imgtray_img->addElement($fileseltray_img);
     $this->addElement($imgtray_img);
     if (!$obj->isNew()) {
         $rank_special = $obj->getVar('rank_special');
     } else {
         $rank_special = 0;
     }
     $special_tray = new Xoops\Form\ElementTray(_AM_USERRANK_SPECIAL, '<br />');
     $special_tray->setDescription(_AM_USERRANK_SPECIAL_CAN);
     $special_tray->addElement(new Xoops\Form\RadioYesNo('', 'rank_special', $rank_special));
     $this->addElement($special_tray);
     if (!$obj->isNew()) {
         $this->addElement(new Xoops\Form\Hidden('rank_id', $obj->getVar('rank_id')));
     }
     $this->addElement(new Xoops\Form\Hidden('op', 'userrank_save'));
     $this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
 }
Beispiel #6
0
 /**
  * @param null $obj
  */
 public function __construct($obj = null)
 {
     $xoops = Xoops::getInstance();
     parent::__construct('', 'xlanguage_form', $xoops->getEnv('PHP_SELF'), 'post', true, 'horizontal');
     // language name
     $xlanguage_select = new Xoops\Form\Select(_AM_XLANGUAGE_NAME, 'xlanguage_name', $obj->getVar('xlanguage_name'));
     $xlanguage_select->addOptionArray(XoopsLists::getLocaleList());
     $this->addElement($xlanguage_select, true);
     // language description
     $this->addElement(new Xoops\Form\Text(_AM_XLANGUAGE_DESCRIPTION, 'xlanguage_description', 5, 30, $obj->getVar('xlanguage_description')), true);
     // language charset
     $autoload = XoopsLoad::loadConfig('xlanguage');
     $charset_select = new Xoops\Form\Select(_AM_XLANGUAGE_CHARSET, 'xlanguage_charset', $obj->getVar('xlanguage_charset'));
     $charset_select->addOptionArray($autoload['charset']);
     $this->addElement($charset_select);
     // language code
     $this->addElement(new Xoops\Form\Text(_AM_XLANGUAGE_CODE, 'xlanguage_code', 5, 10, $obj->getVar('xlanguage_code')), true);
     // language weight
     $this->addElement(new Xoops\Form\Text(_AM_XLANGUAGE_WEIGHT, 'xlanguage_weight', 1, 4, $obj->getVar('xlanguage_weight')));
     // language image
     $image_option_tray = new Xoops\Form\ElementTray(_AM_XLANGUAGE_IMAGE, '');
     $image_array = XoopsLists::getImgListAsArray(\XoopsBaseConfig::get('root-path') . '/media/xoops/images/flags/' . \Xoops\Module\Helper::getHelper('xlanguage')->getConfig('theme') . '/');
     $image_select = new Xoops\Form\Select('', 'xlanguage_image', $obj->getVar('xlanguage_image'));
     $image_select->addOptionArray($image_array);
     $image_select->setExtra("onchange='showImgSelected(\"image\", \"xlanguage_image\", \"/media/xoops/images/flags/" . \Xoops\Module\Helper::getHelper('xlanguage')->getConfig('theme') . "/\", \"\", \"" . \XoopsBaseConfig::get('url') . "\")'");
     $image_tray = new Xoops\Form\ElementTray('', '&nbsp;');
     $image_tray->addElement($image_select);
     $image_tray->addElement(new Xoops\Form\Label('', "<div style='padding: 8px;'><img style='width:24px; height:24px; ' src='" . \XoopsBaseConfig::get('url') . "/media/xoops/images/flags/" . \Xoops\Module\Helper::getHelper('xlanguage')->getConfig('theme') . "/" . $obj->getVar("xlanguage_image") . "' name='image' id='image' alt='' /></div>"));
     $image_option_tray->addElement($image_tray);
     $this->addElement($image_option_tray);
     $this->addElement(new Xoops\Form\Hidden('xlanguage_id', $obj->getVar('xlanguage_id')));
     /**
      * Buttons
      */
     $button_tray = new Xoops\Form\ElementTray('', '');
     $button_tray->addElement(new Xoops\Form\Hidden('op', 'save'));
     $button = new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit');
     $button->setClass('btn btn-success');
     $button_tray->addElement($button);
     $button_2 = new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset');
     $button_2->setClass('btn btn-warning');
     $button_tray->addElement($button_2);
     switch (basename($xoops->getEnv('PHP_SELF'), '.php')) {
         case 'xoops_xlanguage':
             $button_3 = new Xoops\Form\Button('', 'button', XoopsLocale::A_CLOSE, 'button');
             $button_3->setExtra('onclick="tinyMCEPopup.close();"');
             $button_3->setClass('btn btn-danger');
             $button_tray->addElement($button_3);
             break;
         case 'index':
         default:
             $button_3 = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button');
             $button_3->setExtra("onclick='javascript:history.go(-1);'");
             $button_3->setClass('btn btn-danger');
             $button_tray->addElement($button_3);
             break;
     }
     $this->addElement($button_tray);
 }
Beispiel #7
0
 /**
  * @param SmiliesSmiley|XoopsObject $obj
  */
 public function __construct(SmiliesSmiley $obj)
 {
     $xoops = Xoops::getInstance();
     if ($obj->isNew()) {
         $blank_img = 'blank.gif';
     } else {
         $blank_img = str_replace('smilies/', '', $obj->getVar('smiley_url', 'e'));
     }
     $title = $obj->isNew() ? sprintf(_AM_SMILIES_ADD) : sprintf(_AM_SMILIES_EDIT);
     parent::__construct($title, 'form', $xoops->getEnv('PHP_SELF'), 'post', true);
     $this->setExtra('enctype="multipart/form-data"');
     $this->addElement(new Xoops\Form\Text(_AM_SMILIES_CODE, 'smiley_code', 2, 25, $obj->getVar('smiley_code')), true);
     $this->addElement(new Xoops\Form\Text(_AM_SMILIES_DESCRIPTION, 'smiley_emotion', 4, 50, $obj->getVar('smiley_emotion')), true);
     $imgtray_img = new Xoops\Form\ElementTray(_AM_SMILIES_FILE, '<br />');
     $imgpath_img = sprintf(_AM_SMILIES_IMAGE_PATH, \XoopsBaseConfig::get('uploads-url') . '/smilies/');
     $imageselect_img = new Xoops\Form\Select($imgpath_img, 'smiley_url', $blank_img);
     $image_array_img = XoopsLists::getImgListAsArray(\XoopsBaseConfig::get('uploads-url') . '/smilies');
     $imageselect_img->addOptionArray($image_array_img);
     $imageselect_img->setExtra('onchange="showImgSelected(\'xo-smilies-img\', \'smiley_url\', \'smilies\', \'\', \'' . \XoopsBaseConfig::get('uploads-url') . '\' )"');
     $imgtray_img->addElement($imageselect_img, false);
     $imgtray_img->addElement(new Xoops\Form\Label('', "<br /><img src='" . \XoopsBaseConfig::get('uploads-url') . "/smilies/" . $blank_img . "' name='image_img' id='xo-smilies-img' alt=''>"));
     $fileseltray_img = new Xoops\Form\ElementTray('<br />', '<br /><br />');
     $fileseltray_img->addElement(new Xoops\Form\File(_AM_SMILIES_UPLOADS, 'smiley_url'), false);
     $fileseltray_img->addElement(new Xoops\Form\Label(''), false);
     $imgtray_img->addElement($fileseltray_img);
     $this->addElement($imgtray_img);
     $this->addElement(new Xoops\Form\RadioYesNo(_AM_SMILIES_OFF, 'smiley_display', $obj->getVar('smiley_display')));
     $this->addElement(new Xoops\Form\Hidden('smiley_id', $obj->getVar('smiley_id')));
     /**
      * Buttons
      */
     $button_tray = new Xoops\Form\ElementTray('', '');
     $button_tray->addElement(new Xoops\Form\Hidden('op', 'save'));
     $button = new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit');
     $button->setClass('btn btn-success');
     $button_tray->addElement($button);
     $button_2 = new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset');
     $button_2->setClass('btn btn-warning');
     $button_tray->addElement($button_2);
     switch (basename($xoops->getEnv('PHP_SELF'), '.php')) {
         case 'xoops_smilies':
             $button_3 = new Xoops\Form\Button('', 'button', XoopsLocale::A_CLOSE, 'button');
             $button_3->setExtra('onclick="tinyMCEPopup.close();"');
             $button_3->setClass('btn btn-danger');
             $button_tray->addElement($button_3);
             break;
         case 'smilies':
         default:
             $button_3 = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button');
             $button_3->setExtra("onclick='javascript:history.go(-1);'");
             $button_3->setClass('btn btn-danger');
             $button_tray->addElement($button_3);
             break;
     }
     $this->addElement($button_tray);
 }
Beispiel #8
0
 /**
  * @param null $obj
  */
 public function __construct($object = null)
 {
     $this->object = $object;
     $this->config = $object->config;
     $xoops = Xoops::getInstance();
     parent::__construct('', 'xcaptchaform', $xoops->getEnv('PHP_SELF'), 'post', true, 'horizontal');
     $activate = new Xoops\Form\Radio(_AM_XCAPTCHA_ACTIVATE, 'disabled', $this->config['disabled']);
     $activate->addOption(1, _AM_XCAPTCHA_ENABLE);
     $activate->addOption(0, _AM_XCAPTCHA_DISABLE);
     $this->addElement($activate, false);
     $plugin_List = new Xoops\Form\Select(_AM_XCAPTCHA_PLUGINS, 'mode', $this->config['mode']);
     $plugin_List->addOptionArray($this->object->plugin_List);
     $this->addElement($plugin_List, false);
     $this->addElement(new Xoops\Form\Text(_AM_XCAPTCHA_NAME, 'name', 50, 50, $this->config['name']), true);
     $skipmember = new Xoops\Form\Radio(_AM_XCAPTCHA_SKIPMEMBER, 'skipmember', $this->config['skipmember']);
     $skipmember->addOption(1, _AM_XCAPTCHA_ENABLE);
     $skipmember->addOption(0, _AM_XCAPTCHA_DISABLE);
     $this->addElement($skipmember, false);
     $this->addElement(new Xoops\Form\Text(_AM_XCAPTCHA_MAXATTEMPTS, 'maxattempts', 2, 2, $this->config['maxattempts']), true);
     $this->addElement(new Xoops\Form\Hidden('type', 'config'));
     $buttonTray = new Xoops\Form\ElementTray('', '');
     $buttonTray->addElement(new Xoops\Form\Hidden('op', 'save'));
     $buttonTray->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
     $buttonTray->addElement(new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset'));
     $buttonCancelSend = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button');
     $buttonCancelSend->setExtra("onclick='javascript:history.go(-1);'");
     $buttonTray->addElement($buttonCancelSend);
     $this->addElement($buttonTray);
 }
 /**
  * @param Array
  *
  *        'obj'     => ImagesImage|XoopsObject $obj
  *        'target'  => textarea id
  */
 public function __construct($param)
 {
     $xoops = Xoops::getInstance();
     $helper = Xoops\Module\Helper::getHelper('images');
     //todo, remove extract
     extract($param);
     $groups = $xoops->getUserGroups();
     if ($obj->isNew()) {
         $title = _AM_IMAGES_IMG_ADD;
     } else {
         $title = _AM_IMAGES_IMG_EDIT;
     }
     parent::__construct($title, 'image', $xoops->getEnv('PHP_SELF'), 'post', true);
     $this->setExtra('enctype="multipart/form-data"');
     $this->addElement(new Xoops\Form\Text(_AM_IMAGES_NAME, 'image_nicename', 50, 255, $obj->getVar('image_nicename')), true);
     $categories = $helper->getHandlerCategories()->getListByPermission($groups, 'imgcat_write');
     $select = new Xoops\Form\Select(_AM_IMAGES_CAT_SELECT, 'imgcat_id', $obj->getVar('imgcat_id'));
     $select->addOption('', _AM_IMAGES_CAT_SELECT);
     $select->addOptionArray($categories);
     $this->addElement($select, true);
     $this->addElement(new Xoops\Form\File(_AM_IMAGES_IMG_FILE, 'image_file'));
     $this->addElement(new Xoops\Form\Hidden('image_weight', $obj->getVar('image_weight')));
     $this->addElement(new Xoops\Form\Hidden('image_display', $obj->getVar('image_display')));
     $this->addElement(new Xoops\Form\Hidden('image_name', $obj->getVar('image_name')));
     $this->addElement(new Xoops\Form\Hidden('image_id', $obj->getVar('image_id')));
     $this->addElement(new Xoops\Form\Hidden('target', $target));
     /**
      * Buttons
      */
     $buttonTray = new Xoops\Form\ElementTray('', '');
     $buttonTray->addElement(new Xoops\Form\Hidden('op', 'save'));
     $buttonSubmit = new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit');
     $buttonSubmit->setClass('btn btn-success');
     $buttonTray->addElement($buttonSubmit);
     $buttonReset = new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset');
     $buttonReset->setClass('btn btn-warning');
     $buttonTray->addElement($buttonReset);
     switch (basename($xoops->getEnv('PHP_SELF'), '.php')) {
         case 'xoops_images':
             $buttonClose = new Xoops\Form\Button('', 'button', XoopsLocale::A_CLOSE, 'button');
             $buttonClose->setExtra('onclick="tinyMCEPopup.close();"');
             $buttonClose->setClass('btn btn-danger');
             $buttonTray->addElement($buttonClose);
             break;
         case 'images':
         default:
             $buttonCancel = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button');
             $buttonCancel->setExtra("onclick='javascript:history.go(-1);'");
             $buttonCancel->setClass('btn btn-danger');
             $buttonTray->addElement($buttonCancel);
             break;
     }
     $this->addElement($buttonTray);
 }
Beispiel #10
0
 /**
  * @param PublisherFile $obj
  */
 public function __construct(PublisherFile $obj)
 {
     $xoops = Xoops::getInstance();
     $publisher = Publisher::getInstance();
     $publisher->loadLanguage('main');
     parent::__construct(_AM_PUBLISHER_UPLOAD_FILE, "form", $xoops->getEnv('PHP_SELF'));
     $this->setExtra('enctype="multipart/form-data"');
     // NAME
     $name_text = new Xoops\Form\Text(_CO_PUBLISHER_FILENAME, 'name', 50, 255, $obj->getVar('name'));
     $name_text->setDescription(_CO_PUBLISHER_FILE_NAME_DSC);
     $this->addElement($name_text, true);
     // DESCRIPTION
     $description_text = new Xoops\Form\TextArea(_CO_PUBLISHER_FILE_DESCRIPTION, 'description', $obj->getVar('description'));
     $description_text->setDescription(_CO_PUBLISHER_FILE_DESCRIPTION_DSC);
     $this->addElement($description_text);
     // FILE TO UPLOAD
     $file_box = new Xoops\Form\File(_CO_PUBLISHER_FILE_TO_UPLOAD, "item_upload_file");
     $file_box->set('size', 50);
     $this->addElement($file_box);
     $status_select = new Xoops\Form\RadioYesNo(_CO_PUBLISHER_FILE_STATUS, 'file_status', _PUBLISHER_STATUS_FILE_ACTIVE);
     $status_select->setDescription(_CO_PUBLISHER_FILE_STATUS_DSC);
     $this->addElement($status_select);
     // fileid
     $this->addElement(new Xoops\Form\Hidden('fileid', $obj->getVar('fileid')));
     // itemid
     $this->addElement(new Xoops\Form\Hidden('itemid', $obj->getVar('itemid')));
     $files_button_tray = new Xoops\Form\ElementTray('', '');
     $files_hidden = new Xoops\Form\Hidden('op', 'uploadfile');
     $files_button_tray->addElement($files_hidden);
     if (!$obj->getVar('fileid')) {
         $files_butt_create = new Xoops\Form\Button('', '', _MD_PUBLISHER_UPLOAD, 'submit');
         $files_butt_create->setExtra('onclick="this.form.elements.op.value=\'uploadfile\'"');
         $files_button_tray->addElement($files_butt_create);
         $files_butt_another = new Xoops\Form\Button('', '', _CO_PUBLISHER_FILE_UPLOAD_ANOTHER, 'submit');
         $files_butt_another->setExtra('onclick="this.form.elements.op.value=\'uploadanother\'"');
         $files_button_tray->addElement($files_butt_another);
     } else {
         $files_butt_create = new Xoops\Form\Button('', '', _MD_PUBLISHER_MODIFY, 'submit');
         $files_butt_create->setExtra('onclick="this.form.elements.op.value=\'modify\'"');
         $files_button_tray->addElement($files_butt_create);
     }
     $files_butt_clear = new Xoops\Form\Button('', '', _MD_PUBLISHER_CLEAR, 'reset');
     $files_button_tray->addElement($files_butt_clear);
     $buttonCancel = new Xoops\Form\Button('', '', _MD_PUBLISHER_CANCEL, 'button');
     $buttonCancel->setExtra('onclick="history.go(-1)"');
     $files_button_tray->addElement($buttonCancel);
     $this->addElement($files_button_tray);
 }
Beispiel #11
0
 /**
  * @param BannersBanner|XoopsObject $obj
  */
 public function __construct(BannersBanner &$obj)
 {
     $xoops = Xoops::getInstance();
     $helper = Banners::getInstance();
     if ($obj->isNew()) {
         $blank_img = 'blank.gif';
         $html_banner = 0;
     } else {
         if (substr_count($obj->getVar('banner_imageurl'), $xoops_upload_url . '/banners/') == 0) {
             $blank_img = 'blank.gif';
         } else {
             $namefile = substr_replace($obj->getVar('banner_imageurl'), '', 0, strlen($xoops_upload_url . '/banners/'));
             $pathfile = $xoops_root_path . '/uploads/banners/' . $namefile;
             if (is_file($pathfile)) {
                 $blank_img = str_replace($xoops_upload_url . '/banners/', '', $obj->getVar('banner_imageurl', 'e'));
             } else {
                 $blank_img = 'blank.gif';
             }
         }
         $html_banner = $obj->getVar('banner_htmlbanner');
     }
     $title = $obj->isNew() ? sprintf(_AM_BANNERS_BANNERS_ADD) : sprintf(_AM_BANNERS_BANNERS_EDIT);
     parent::__construct($title, 'form', 'banners.php', 'post', true);
     $this->setExtra('enctype="multipart/form-data"');
     $client_Handler = $helper->getHandlerBannerclient();
     $client_select = new Xoops\Form\Select(_AM_BANNERS_CLIENTS_NAME, 'cid', $obj->getVar('banner_cid'));
     $client_select->addOptionArray($client_Handler->getList());
     $this->addElement($client_select, true);
     $imptotal = new Xoops\Form\Text(_AM_BANNERS_BANNERS_IMPRESSIONSP, 'imptotal', 1, 255, $obj->getVar('banner_imptotal'));
     //$imptotal->setPattern('^[0-9]*[0-9]+$|^[0-9]+[0-9]*$', _AM_BANNERS_BANNERS_IMPRESSIONSP_PATTERN);
     $this->addElement($imptotal, true);
     $imgtray_img = new Xoops\Form\ElementTray(_AM_BANNERS_BANNERS_IMAGE, '<br /><br />');
     $imgtray_img->addElement(new Xoops\Form\Text(_AM_BANNERS_BANNERS_IMGURL, 'imageurl', 8, 255, $obj->getVar('banner_imageurl')));
     $imgpath_img = sprintf(_AM_BANNERS_BANNERS_IMAGE_PATH, $xoops_upload_path . '/banners/');
     $imageselect_img = new Xoops\Form\Select($imgpath_img, 'banners_imageurl', $blank_img);
     $image_array_img = XoopsLists::getImgListAsArray($xoops_upload_path . '/banners');
     $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-banners-img\', \'banners_imageurl\', \'banners\', \'\', \'' . $xoops_upload_url . '\' )"');
     $imgtray_img->addElement($imageselect_img, false);
     $imgtray_img->addElement(new Xoops\Form\Label('', "<br /><img src='" . $xoops_upload_url . "/banners/" . $blank_img . "' name='image_img' id='xo-banners-img' alt='' />"));
     $fileseltray_img = new Xoops\Form\ElementTray('<br />', '<br /><br />');
     $fileseltray_img->addElement(new Xoops\Form\File(_AM_BANNERS_BANNERS_UPLOADS, 'banners_imageurl'), false);
     $fileseltray_img->addElement(new Xoops\Form\Label(''), false);
     $imgtray_img->addElement($fileseltray_img);
     $this->addElement($imgtray_img);
     $this->addElement(new Xoops\Form\Text(_AM_BANNERS_BANNERS_CLICKURL, 'clickurl', 5, 255, $obj->getVar('banner_clickurl')), false);
     $this->addElement(new Xoops\Form\RadioYesNo(_AM_BANNERS_BANNERS_USEHTML, 'htmlbanner', $html_banner));
     $this->addElement(new Xoops\Form\TextArea(_AM_BANNERS_BANNERS_CODEHTML, 'htmlcode', $obj->getVar('banner_htmlcode'), 5, 5), false);
     if (!$obj->isNew()) {
         $this->addElement(new Xoops\Form\Hidden('bid', $obj->getVar('banner_bid')));
     }
     $this->addElement(new Xoops\Form\Hidden('op', 'save'));
     $this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
 }
Beispiel #12
0
 /**
  * @param ImagesImage|XoopsObject $obj
  */
 public function __construct(ImagesImage $obj)
 {
     $xoops = Xoops::getInstance();
     $helper = Xoops\Module\Helper::getHelper('images');
     $groups = $xoops->getUserGroups();
     if ($obj->isNew()) {
         $title = _AM_IMAGES_IMG_ADD;
     } else {
         $title = _AM_IMAGES_IMG_EDIT;
     }
     parent::__construct('', 'image', $xoops->getEnv('PHP_SELF'), 'post', true);
     $this->setExtra('enctype="multipart/form-data"');
     $tabtray = new Xoops\Form\TabTray('', 'uniqueid', $xoops->getModuleConfig('jquery_theme', 'system'));
     $tab1 = new Xoops\Form\Tab($title, 'tabid-1');
     $tab1->addElement(new Xoops\Form\Text(_AM_IMAGES_NAME, 'image_nicename', 50, 255, $obj->getVar('image_nicename')), true);
     if ($obj->isNew()) {
         $categories = $helper->getHandlerCategories()->getListByPermission($groups, 'imgcat_write');
         $select = new Xoops\Form\Select(_AM_IMAGES_CAT_SELECT, 'imgcat_id', $obj->getVar('imgcat_id'));
         $select->addOption('', _AM_IMAGES_CAT_SELECT);
         $select->addOptionArray($categories);
         $tab1->addElement($select, true);
     } else {
         $tab1->addElement(new Xoops\Form\Label(_AM_IMAGES_CAT_SELECT, '<span class="red bold">' . $helper->getHandlerCategories()->get($obj->getVar('imgcat_id'))->getVar('imgcat_name') . '</span>'));
         $this->addElement(new Xoops\Form\Hidden('imgcat_id', $obj->getVar('imgcat_id')));
     }
     // warning
     $category = $helper->getHandlerCategories()->get($obj->getVar('imgcat_id'));
     $upload_msg[] = _AM_IMAGES_CAT_SIZE . ' : ' . $category->getVar('imgcat_maxsize');
     $upload_msg[] = _AM_IMAGES_CAT_WIDTH . ' : ' . $category->getVar('imgcat_maxwidth');
     $upload_msg[] = _AM_IMAGES_CAT_HEIGHT . ' : ' . $category->getVar('imgcat_maxheight');
     $image_tray = new Xoops\Form\File(_AM_IMAGES_IMG_FILE, 'image_file');
     $image_tray->setDescription(self::message($upload_msg, ''));
     $tab1->addElement($image_tray);
     $tab1->addElement(new Xoops\Form\Text(_AM_IMAGES_WEIGHT, 'image_weight', 1, 4, $obj->getVar('image_weight')));
     $tab1->addElement(new Xoops\Form\RadioYesNo(_AM_IMAGES_DISPLAY, 'image_display', $obj->getVar('image_display')));
     $tabtray->addElement($tab1);
     $this->addElement($tabtray);
     $this->addElement(new Xoops\Form\Hidden('image_name', $obj->getVar('image_name')));
     $this->addElement(new Xoops\Form\Hidden('image_id', $obj->getVar('image_id')));
     /**
      * Buttons
      */
     $button_tray = new Xoops\Form\ElementTray('', '');
     $button_tray->addElement(new Xoops\Form\Hidden('op', 'save'));
     $button = new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit');
     $button->setClass('btn btn-success');
     $button_tray->addElement($button);
     $button_2 = new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset');
     $button_2->setClass('btn btn-warning');
     $button_tray->addElement($button_2);
     $button_3 = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button');
     $button_3->setExtra("onclick='javascript:history.go(-1);'");
     $button_3->setClass('btn btn-danger');
     $button_tray->addElement($button_3);
     $this->addElement($button_tray);
 }
Beispiel #13
0
 /**
  * @param ImagesCategory|XoopsObject $obj
  */
 public function __construct(ImagesCategory $obj)
 {
     $xoops = Xoops::getInstance();
     $perm_handler = $xoops->getHandlerGroupperm();
     if ($obj->isNew()) {
         $title = _AM_IMAGES_CAT_ADD;
         $read = FixedGroups::ADMIN;
         $write = FixedGroups::ADMIN;
     } else {
         $title = _AM_IMAGES_CAT_EDIT;
         $read = $perm_handler->getGroupIds('imgcat_read', $obj->getVar('imgcat_id'), $xoops->module->getVar('mid'));
         $write = $perm_handler->getGroupIds('imgcat_write', $obj->getVar('imgcat_id'), $xoops->module->getVar('mid'));
     }
     parent::__construct($title, 'imagecat_form', $xoops->getEnv('PHP_SELF'), 'post', true);
     $tabtray = new Xoops\Form\TabTray('', 'uniqueid', $xoops->getModuleConfig('jquery_theme', 'system'));
     $tab1 = new Xoops\Form\Tab(_MI_IMAGES_CATEGORIES, 'tabid-1');
     $tab1->addElement(new Xoops\Form\Text(_AM_IMAGES_CAT_NAME, 'imgcat_name', 50, 255, $obj->getVar('imgcat_name')), true);
     $tab1->addElement(new Xoops\Form\Text(_AM_IMAGES_CAT_SIZE, 'imgcat_maxsize', 2, 8, $obj->getVar('imgcat_maxsize')));
     $tab1->addElement(new Xoops\Form\Text(_AM_IMAGES_CAT_WIDTH, 'imgcat_maxwidth', 1, 4, $obj->getVar('imgcat_maxwidth')));
     $tab1->addElement(new Xoops\Form\Text(_AM_IMAGES_CAT_HEIGHT, 'imgcat_maxheight', 1, 4, $obj->getVar('imgcat_maxheight')));
     $tab1->addElement(new Xoops\Form\Text(_AM_IMAGES_WEIGHT, 'imgcat_weight', 1, 5, $obj->getVar('imgcat_weight')));
     $tab1->addElement(new Xoops\Form\RadioYesNo(_AM_IMAGES_CAT_DISPLAY, 'imgcat_display', $obj->getVar('imgcat_display')));
     if ($obj->isNew()) {
         $store = new Xoops\Form\Radio(_AM_IMAGES_CAT_STR_TYPE . '<div class="red">' . _AM_IMAGES_CAT_STR_TYOPENG . '</div>', 'imgcat_storetype', 'file');
         $store->addOptionArray(array('file' => _AM_IMAGES_CAT_ASFILE, 'db' => _AM_IMAGES_CAT_INDB));
         $tab1->addElement($store);
     } else {
         $store = array('db' => _AM_IMAGES_CAT_INDB, 'file' => _AM_IMAGES_CAT_ASFILE);
         $tab1->addElement(new Xoops\Form\Label(_AM_IMAGES_CAT_STR_TYPE, $store[$obj->getVar('imgcat_storetype')]));
         $this->addElement(new Xoops\Form\Hidden('imgcat_storetype', $obj->getVar('imgcat_storetype')));
     }
     $tab2 = new Xoops\Form\Tab(_MI_IMAGES_PERMISSIONS, 'tabid-2');
     $tab2->addElement(new Xoops\Form\SelectGroup(_AM_IMAGES_CAT_READ_GRP, 'readgroup', true, $read, 5, true));
     $tab2->addElement(new Xoops\Form\SelectGroup(_AM_IMAGES_CAT_WRITE_GRP, 'writegroup', true, $write, 5, true));
     $tabtray->addElement($tab1);
     $tabtray->addElement($tab2);
     $this->addElement($tabtray);
     $this->addElement(new Xoops\Form\Hidden('imgcat_id', $obj->getVar('imgcat_id')));
     /**
      * Buttons
      */
     $button_tray = new Xoops\Form\ElementTray('', '');
     $button_tray->addElement(new Xoops\Form\Hidden('op', 'save'));
     $button = new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit');
     $button->setClass('btn btn-success');
     $button_tray->addElement($button);
     $button_2 = new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset');
     $button_2->setClass('btn btn-warning');
     $button_tray->addElement($button_2);
     $button_3 = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button');
     $button_3->setExtra("onclick='javascript:history.go(-1);'");
     $button_3->setClass('btn btn-danger');
     $button_tray->addElement($button_3);
     $this->addElement($button_tray);
 }
Beispiel #14
0
 /**
  * @param PagePage_related|XoopsObject $obj
  */
 public function __construct(PagePage_related $obj)
 {
     $helper = Page::getInstance();
     $xoops = $helper->xoops();
     $xoops->theme()->addScript('modules/page/media/jquery/multi-select.0.3-7/js/jquery.multi-select.js');
     $xoops->theme()->addScript('modules/page/media/jquery/multi-select-init.js');
     $xoops->theme()->addStylesheet('modules/page/media/jquery/multi-select.0.3-7/css/multi-select.css');
     // Get handler
     $content_Handler = $helper->getContentHandler();
     $link_Handler = $helper->getLinkHandler();
     $title = $obj->isNew() ? PageLocale::A_ADD_RELATED : PageLocale::A_EDIT_RELATED;
     parent::__construct($title, 'form', 'related.php', 'post', true);
     //name
     $this->addElement(new Xoops\Form\Text(PageLocale::RELATED_NAME, 'related_name', 4, 255, $obj->getVar('related_name'), ''), true);
     //menu
     $menu = new Xoops\Form\RadioYesNo(PageLocale::RELATED_MENU, 'related_domenu', $obj->getVar('related_domenu'));
     $menu->setDescription(PageLocale::RELATED_MENU_DSC);
     $this->addElement($menu, false);
     //navigation
     $navigation = new Xoops\Form\Select(PageLocale::RELATED_NAVIGATION, 'related_navigation', $obj->getVar('related_navigation'), 1, false);
     $navigation->addOption(1, PageLocale::L_RELATED_NAVIGATION_OPTION1);
     $navigation->addOption(2, PageLocale::L_RELATED_NAVIGATION_OPTION2);
     $navigation->addOption(3, PageLocale::L_RELATED_NAVIGATION_OPTION3);
     $navigation->addOption(4, PageLocale::L_RELATED_NAVIGATION_OPTION4);
     $navigation->addOption(5, PageLocale::L_RELATED_NAVIGATION_OPTION5);
     $navigation->setClass('span3');
     $this->addElement($navigation);
     $related_links = $link_Handler->getContentByRelated($obj->getVar('related_id'));
     $contents_used = $link_Handler->getContentUsed();
     $contents = $content_Handler->getPageTitle(1);
     $related_links_form = new Xoops\Form\Select(PageLocale::RELATED_MAIN, 'datas', $related_links, $size = 20, $multiple = true);
     foreach ($contents as $k => $content) {
         if (!in_array($content['content_id'], $contents_used) || in_array($content['content_id'], $related_links)) {
             $related_links_form->addOption($content['content_id'], $content['content_title']);
         }
     }
     $this->addElement($related_links_form, true);
     $this->addElement(new Xoops\Form\Hidden('related_id', $obj->getVar('related_id')));
     /**
      * Buttons
      */
     $buttonTray = new Xoops\Form\ElementTray('', '');
     $buttonTray->addElement(new Xoops\Form\Hidden('op', 'save'));
     $buttonSubmit = new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit');
     $buttonSubmit->setClass('btn btn-success');
     $buttonTray->addElement($buttonSubmit);
     $buttonReset = new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset');
     $buttonReset->setClass('btn btn-warning');
     $buttonTray->addElement($buttonReset);
     $buttonCancel = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button');
     $buttonCancel->setExtra("onclick='javascript:history.go(-1);'");
     $buttonCancel->setClass('btn btn-danger');
     $buttonTray->addElement($buttonCancel);
     $this->addElement($buttonTray);
 }
Beispiel #15
0
 /**
  * __construct
  *
  * @param string  $caption
  * @param string  $name
  * @param integer $size
  * @param integer $value
  */
 public function __construct($caption, $name, $size = 15, $value = 0)
 {
     parent::__construct($caption, '&nbsp;');
     $value = (int) $value;
     $value = $value > 0 ? $value : time();
     $datetime = getdate($value);
     $this->addElement(new Xoops\Form\DateSelect('', $name . '[date]', $size, $value));
     $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);
     $timeselect = new Xoops\Form\Select('', $name . '[time]', $datetime['hours'] * 3600 + 600 * floor($datetime['minutes'] / 10));
     $timeselect->addOptionArray($timearray);
     $this->addElement($timeselect);
 }
Beispiel #16
0
 /**
  * @param null $obj
  */
 public function __construct($object = null)
 {
     $this->object = $object;
     $this->config = $object->config;
     $xoops = Xoops::getInstance();
     parent::__construct('', 'xcaptchaform', $xoops->getEnv('PHP_SELF'), 'post', true, 'horizontal');
     $this->addElement(new Xoops\Form\Text(_XCAPTCHA_NUM_CHARS, 'num_chars', 2, 2, $this->config['num_chars']), true);
     $this->addElement(new Xoops\Form\RadioYesNo(_XCAPTCHA_CASESENSITIVE, 'casesensitive', $this->config['casesensitive']));
     $fontmin_form = new Xoops\Form\Select(_XCAPTCHA_FONTSIZE_MIN, 'fontsize_min', $this->config['fontsize_min']);
     for ($i = 10; $i <= 30; ++$i) {
         $fontmin_form->addOption($i, $i);
     }
     $this->addElement($fontmin_form, false);
     $fontmax_form = new Xoops\Form\Select(_XCAPTCHA_FONTSIZE_MAX, 'fontsize_max', $this->config['fontsize_max']);
     for ($i = 10; $i <= 30; ++$i) {
         $fontmax_form->addOption($i, $i);
     }
     $this->addElement($fontmax_form, false);
     $backtype_form = new Xoops\Form\Select(_XCAPTCHA_BACKGROUND_TYPE, 'background_type', $this->config['background_type'], $size = 7);
     $backtype_form->addOption(0, _XCAPTCHA_BACKGROUND_BAR);
     $backtype_form->addOption(1, _XCAPTCHA_BACKGROUND_CIRCLE);
     $backtype_form->addOption(2, _XCAPTCHA_BACKGROUND_LINE);
     $backtype_form->addOption(3, _XCAPTCHA_BACKGROUND_RECTANGLE);
     $backtype_form->addOption(4, _XCAPTCHA_BACKGROUND_ELLIPSE);
     $backtype_form->addOption(5, _XCAPTCHA_BACKGROUND_POLYGONE);
     $backtype_form->addOption(100, _XCAPTCHA_BACKGROUND_IMAGE);
     $this->addElement($backtype_form, false);
     $backnum_form = new Xoops\Form\Select(_XCAPTCHA_BACKGROUND_NUM, 'background_num', $this->config['background_num']);
     for ($i = 10; $i <= 100; $i = $i + 10) {
         $backnum_form->addOption($i, $i);
     }
     $this->addElement($backnum_form, false);
     $polygon_point = new Xoops\Form\Select(_XCAPTCHA_POLYGON_POINT, 'polygon_point', $this->config['polygon_point']);
     for ($i = 3; $i <= 20; ++$i) {
         $polygon_point->addOption($i, $i);
     }
     $this->addElement($polygon_point, false);
     $value = implode('|', $this->config['skip_characters']);
     $this->addElement(new Xoops\Form\TextArea(_XCAPTCHA_SKIP_CHARACTERS, 'skip_characters', $value, 5, 50), true);
     $this->addElement(new Xoops\Form\Hidden('type', 'image'));
     $buttonTray = new Xoops\Form\ElementTray('', '');
     $buttonTray->addElement(new Xoops\Form\Hidden('op', 'save'));
     $buttonTray->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
     $buttonTray->addElement(new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset'));
     $buttonCancelSend = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button');
     $buttonCancelSend->setExtra("onclick='javascript:history.go(-1);'");
     $buttonTray->addElement($buttonCancelSend);
     $this->addElement($buttonTray);
 }
Beispiel #17
0
 /**
  * @param null $obj
  */
 public function __construct($object = null)
 {
     $this->object = $object;
     $this->config = $object->config;
     $xoops = Xoops::getInstance();
     parent::__construct('', 'xcaptchaform', $xoops->getEnv('PHP_SELF'), 'post', true, 'horizontal');
     $this->addElement(new Xoops\Form\Text(_XCAPTCHA_NUM_CHARS, 'num_chars', 2, 2, $this->config['num_chars']), true);
     $this->addElement(new Xoops\Form\Hidden('type', 'text'));
     $buttonTray = new Xoops\Form\ElementTray('', '');
     $buttonTray->addElement(new Xoops\Form\Hidden('op', 'save'));
     $buttonTray->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
     $buttonTray->addElement(new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset'));
     $buttonCancelSend = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button');
     $buttonCancelSend->setExtra("onclick='javascript:history.go(-1);'");
     $buttonTray->addElement($buttonCancelSend);
     $this->addElement($buttonTray);
 }
Beispiel #18
0
 public function __construct(AvatarsAvatar $obj)
 {
     $xoops = Xoops::getInstance();
     $helper = Avatars::getInstance();
     // Get avatar handler
     $avatar_handler = $helper->getHandlerAvatar();
     $action = $_SERVER['REQUEST_URI'];
     parent::__construct(AvatarsLocale::USERFORM, 'avatar_user_form', $action, "post", true);
     $this->setExtra('enctype="multipart/form-data"');
     // select and uploads
     $avatar_select = new Xoops\Form\Select('', 'user_avatar', $xoops->user->getVar('user_avatar'));
     $avatar_list = $avatar_handler->getListByType('S', true);
     $avatar_selected = $xoops->user->getVar("user_avatar", "E");
     $avatar_selected = in_array($avatar_selected, array_keys($avatar_list)) ? $avatar_selected : "blank.gif";
     $avatar_select->addOptionArray($avatar_list);
     $xoops_url = \XoopsBaseConfig::get('url');
     $xoops_upload_url = \XoopsBaseConfig::get('uploads-url');
     $avatar_select->setExtra("onchange='showImgSelected(\"avatar\", \"user_avatar\", \"uploads\", \"\", \"" . $xoops_url . "\")'");
     $avatar_tray = new Xoops\Form\ElementTray(XoopsLocale::FILE, '&nbsp;');
     $avatar_tray->addElement($avatar_select);
     $avatar_tray->addElement(new Xoops\Form\Label('', "<a href=\"javascript:openWithSelfMain('" . $xoops_url . "/modules/avatars/popup.php','avatars',600,400);\">" . XoopsLocale::LIST_ . "</a><br />"));
     $avatar_tray->addElement(new Xoops\Form\Label('', "<br /><img src='" . $xoops_upload_url . "/" . $avatar_selected . "' name='avatar' id='avatar' alt='' />"));
     if ($helper->getConfig('avatars_allowupload') == 1 && $xoops->user->getVar('posts') >= $helper->getConfig('avatars_postsrequired')) {
         $fileseltray_img = new Xoops\Form\ElementTray('<br />', '<br /><br />');
         $fileseltray_img->addElement(new Xoops\Form\File(XoopsLocale::A_UPLOAD, 'user_avatar'), false);
         $avatar_tray->addElement($fileseltray_img);
     }
     $this->addElement($avatar_tray);
     // Hidden
     $this->addElement(new Xoops\Form\Hidden('avatar_type', 'c'));
     $this->addElement(new Xoops\Form\Hidden('uid', $xoops->user->getVar('uid')));
     $this->addElement(new Xoops\Form\Hidden('op', 'save'));
     $this->addElement(new Xoops\Form\Hidden('avatar_id', $obj->getVar('avatar_id', 'e')));
     // Button
     $this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
 }
Beispiel #19
0
 /**
  * @param null $obj
  */
 public function __construct($object = null)
 {
     $this->object = $object;
     $this->config = $object->config;
     $xoops = Xoops::getInstance();
     parent::__construct('', 'xcaptchaform', $xoops->getEnv('PHP_SELF'), 'post', true, 'horizontal');
     $this->addElement(new Xoops\Form\TextArea(_XCAPTCHA_PRIVATE_KEY, 'private_key', $this->config['private_key'], 5, 50), true);
     $this->addElement(new Xoops\Form\Textarea(_XCAPTCHA_PUBLIC_KEY, 'public_key', $this->config['public_key'], 5, 50), true);
     $theme_form = new Xoops\Form\Select(_XCAPTCHA_THEME, 'theme', $this->config['theme'], $size = 4);
     $theme_form->addOptionArray($this->object->getThemes());
     $this->addElement($theme_form, false);
     $lang_form = new Xoops\Form\Select(_XCAPTCHA_LANG, 'lang', $this->config['lang'], $size = 4);
     $lang_form->addOptionArray($this->object->getLanguages());
     $this->addElement($lang_form, false);
     $this->addElement(new Xoops\Form\Hidden('type', 'recaptcha'));
     $buttonTray = new Xoops\Form\ElementTray('', '');
     $buttonTray->addElement(new Xoops\Form\Hidden('op', 'save'));
     $buttonTray->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
     $buttonTray->addElement(new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset'));
     $buttonCancelSend = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button');
     $buttonCancelSend->setExtra("onclick='javascript:history.go(-1);'");
     $buttonTray->addElement($buttonCancelSend);
     $this->addElement($buttonTray);
 }
Beispiel #20
0
 $icq_tray = new Xoops\Form\ElementTray(XoopsLocale::ICQ, "&nbsp;");
 $icq_tray->addElement($icq_match);
 $icq_tray->addElement($icq_text);
 $aim_text = new Xoops\Form\Text("", "user_aim", 30, 100);
 $aim_match = new Xoops\Form\SelectMatchOption("", "user_aim_match");
 $aim_tray = new Xoops\Form\ElementTray(XoopsLocale::AIM, "&nbsp;");
 $aim_tray->addElement($aim_match);
 $aim_tray->addElement($aim_text);
 $yim_text = new Xoops\Form\Text("", "user_yim", 30, 100);
 $yim_match = new Xoops\Form\SelectMatchOption("", "user_yim_match");
 $yim_tray = new Xoops\Form\ElementTray(XoopsLocale::YIM, "&nbsp;");
 $yim_tray->addElement($yim_match);
 $yim_tray->addElement($yim_text);
 $msnm_text = new Xoops\Form\Text("", "user_msnm", 30, 100);
 $msnm_match = new Xoops\Form\SelectMatchOption("", "user_msnm_match");
 $msnm_tray = new Xoops\Form\ElementTray(XoopsLocale::MSNM, "&nbsp;");
 $msnm_tray->addElement($msnm_match);
 $msnm_tray->addElement($msnm_text);
 $location_text = new Xoops\Form\Text(XoopsLocale::LOCATION_CONTAINS, "user_from", 30, 100);
 $occupation_text = new Xoops\Form\Text(XoopsLocale::OCCUPATION_CONTAINS, "user_occ", 30, 100);
 $interest_text = new Xoops\Form\Text(XoopsLocale::INTEREST_CONTAINS, "user_intrest", 30, 100);
 $lastlog_more = new Xoops\Form\Text(SystemLocale::LAST_LOGIN_GREATER_THAN_X, "user_lastlog_more", 10, 5);
 $lastlog_less = new Xoops\Form\Text(SystemLocale::LAST_LOGIN_LESS_THAN_X, "user_lastlog_less", 10, 5);
 $reg_more = new Xoops\Form\Text(SystemLocale::REGISTRATION_DATE_GREATER_THAN_X, "user_reg_more", 10, 5);
 $reg_less = new Xoops\Form\Text(SystemLocale::REGISTRATION_DATE_LESS_THAN_X, "user_reg_less", 10, 5);
 $posts_more = new Xoops\Form\Text(SystemLocale::POSTS_NUMBER_GREATER_THAN_X, "user_posts_more", 10, 5);
 $posts_less = new Xoops\Form\Text(SystemLocale::POSTS_NUMBER_LESS_THAN_X, "user_posts_less", 10, 5);
 $mailok_radio = new Xoops\Form\Radio(XoopsLocale::TYPE_OF_USERS_TO_SHOW, "user_mailok", "both");
 $mailok_radio->addOptionArray(array("mailok" => XoopsLocale::ONLY_USERS_THAT_ACCEPT_EMAIL, "mailng" => XoopsLocale::ONLY_USERS_THAT_DO_NOT_ACCEPT_EMAIL, "both" => XoopsLocale::ALL_USERS));
 $type_radio = new Xoops\Form\Radio(XoopsLocale::TYPE_OF_USERS_TO_SHOW, "user_type", "both");
 $type_radio->addOptionArray(array("actv" => SystemLocale::ONLY_ACTIVE_USERS, "inactv" => SystemLocale::ONLY_INACTIVE_USERS, "both" => XoopsLocale::ALL_USERS));
Beispiel #21
0
 /**
  * __construct
  *
  * @param XoopsUser|XoopsObject &$obj user object
  */
 public function __construct(XoopsUser $obj)
 {
     $xoops = Xoops::getInstance();
     if ($obj->isNew()) {
         //Add user
         $uid_value = "";
         $uname_value = "";
         $name_value = "";
         $email_value = "";
         $email_cbox_value = 0;
         $url_value = "";
         $timezone_value = $xoops->getConfig('default_TZ');
         $icq_value = "";
         $aim_value = "";
         $yim_value = "";
         $msnm_value = "";
         $location_value = "";
         $occ_value = "";
         $interest_value = "";
         $sig_value = "";
         $sig_cbox_value = 0;
         $bio_value = "";
         $rank_value = 0;
         $mailok_value = 0;
         $form_title = SystemLocale::ADD_USER;
         $form_isedit = false;
         $groups = array(FixedGroups::USERS);
     } else {
         //Edit user
         $uid_value = $obj->getVar("uid", "E");
         $uname_value = $obj->getVar("uname", "E");
         $name_value = $obj->getVar("name", "E");
         $email_value = $obj->getVar("email", "E");
         $email_cbox_value = $obj->getVar("user_viewemail") ? 1 : 0;
         $url_value = $obj->getVar("url", "E");
         $timezone_value = $obj->getVar("timezone_offset");
         $icq_value = $obj->getVar("user_icq", "E");
         $aim_value = $obj->getVar("user_aim", "E");
         $yim_value = $obj->getVar("user_yim", "E");
         $msnm_value = $obj->getVar("user_msnm", "E");
         $location_value = $obj->getVar("user_from", "E");
         $occ_value = $obj->getVar("user_occ", "E");
         $interest_value = $obj->getVar("user_intrest", "E");
         $sig_value = $obj->getVar("user_sig", "E");
         $sig_cbox_value = $obj->getVar("attachsig") == 1 ? 1 : 0;
         $bio_value = $obj->getVar("bio", "E");
         $rank_value = $obj->getVar('rank');
         $mailok_value = $obj->getVar('user_mailok', 'E');
         $form_title = sprintf(SystemLocale::F_UPDATE_USER, $obj->getVar("uname"));
         $form_isedit = true;
         $groups = array_values($obj->getGroups());
     }
     //Affichage du formulaire
     parent::__construct($form_title, "form_user", "admin.php", "post", true);
     $this->addElement(new Xoops\Form\Text(XoopsLocale::USER_NAME, "username", 4, 25, $uname_value), true);
     $this->addElement(new Xoops\Form\Text(XoopsLocale::NAME, "name", 5, 60, $name_value));
     $email_tray = new Xoops\Form\ElementTray(XoopsLocale::EMAIL, "<br />");
     $email_text = new Xoops\Form\Text("", "email", 5, 60, $email_value);
     $email_tray->addElement($email_text, true);
     $email_cbox = new Xoops\Form\Checkbox("", "user_viewemail", $email_cbox_value);
     $email_cbox->addOption(1, XoopsLocale::ALLOW_OTHER_USERS_TO_VIEW_EMAIL);
     $email_tray->addElement($email_cbox);
     $this->addElement($email_tray, true);
     $this->addElement(new Xoops\Form\Text(XoopsLocale::WEB_URL, "url", 5, 100, $url_value));
     $this->addElement(new Xoops\Form\SelectTimeZone(XoopsLocale::TIME_ZONE, "timezone_offset", $timezone_value));
     $this->addElement(new Xoops\Form\Text(XoopsLocale::ICQ, "user_icq", 3, 15, $icq_value));
     $this->addElement(new Xoops\Form\Text(XoopsLocale::AIM, "user_aim", 3, 18, $aim_value));
     $this->addElement(new Xoops\Form\Text(XoopsLocale::YIM, "user_yim", 3, 25, $yim_value));
     $this->addElement(new Xoops\Form\Text(XoopsLocale::MSNM, "user_msnm", 3, 100, $msnm_value));
     $this->addElement(new Xoops\Form\Text(XoopsLocale::LOCATION, "user_from", 5, 100, $location_value));
     $this->addElement(new Xoops\Form\Text(XoopsLocale::OCCUPATION, "user_occ", 5, 100, $occ_value));
     $this->addElement(new Xoops\Form\Text(XoopsLocale::INTEREST, "user_intrest", 5, 150, $interest_value));
     $sig_tray = new Xoops\Form\ElementTray(XoopsLocale::SIGNATURE, "<br />");
     $sig_tarea = new Xoops\Form\TextArea("", "user_sig", $sig_value, 5, 5);
     $sig_tray->addElement($sig_tarea);
     $sig_cbox = new Xoops\Form\Checkbox("", "attachsig", $sig_cbox_value);
     $sig_cbox->addOption(1, XoopsLocale::ALWAYS_ATTACH_MY_SIGNATURE);
     $sig_tray->addElement($sig_cbox);
     $this->addElement($sig_tray);
     $this->addElement(new Xoops\Form\TextArea(XoopsLocale::EXTRA_INFO, "bio", $bio_value, 5, 5));
     $ranklist = $xoops->service('userrank')->getAssignableUserRankList()->getValue();
     if ($ranklist !== null) {
         $rank_select = new Xoops\Form\Select(XoopsLocale::RANK, "rank", $rank_value);
         $rank_select->addOption(0, "--------------");
         if (count($ranklist) > 0) {
             $rank_select->addOptionArray($ranklist);
         }
         $this->addElement($rank_select);
     } else {
         $this->addElement(new Xoops\Form\Hidden("rank", $rank_value));
     }
     // adding a new user requires password fields
     if (!$form_isedit) {
         $this->addElement(new Xoops\Form\Password(XoopsLocale::PASSWORD, "password", 3, 32), true);
         $this->addElement(new Xoops\Form\Password(XoopsLocale::RETYPE_PASSWORD, "pass2", 3, 32), true);
     } else {
         $this->addElement(new Xoops\Form\Password(XoopsLocale::PASSWORD, "password", 3, 32));
         $this->addElement(new Xoops\Form\Password(XoopsLocale::RETYPE_PASSWORD, "pass2", 3, 32));
     }
     $this->addElement(new Xoops\Form\RadioYesNo(XoopsLocale::ONLY_USERS_THAT_ACCEPT_EMAIL, 'user_mailok', $mailok_value));
     //Groups administration addition XOOPS 2.0.9: Mith
     $gperm_handler = $xoops->getHandlerGroupPermission();
     $group_select = array();
     //If user has admin rights on groups
     if ($gperm_handler->checkRight("system_admin", XOOPS_SYSTEM_GROUP, $xoops->user->getGroups(), 1)) {
         //add group selection
         $group_select[] = new Xoops\Form\SelectGroup(XoopsLocale::GROUPS, 'groups', false, $groups, 5, true);
     } else {
         //add each user groups
         foreach ($groups as $key => $group) {
             $group_select[] = new Xoops\Form\Hidden('groups[' . $key . ']', $group);
         }
     }
     foreach ($group_select as $group) {
         $this->addElement($group);
         unset($group);
     }
     $this->addElement(new Xoops\Form\Hidden("fct", "users"));
     $this->addElement(new Xoops\Form\Hidden("op", "users_save"));
     $this->addElement(new Xoops\Form\Button("", "submit", XoopsLocale::A_SUBMIT, "submit"));
     if (!empty($uid_value)) {
         $this->addElement(new Xoops\Form\Hidden("uid", $uid_value));
     }
 }
Beispiel #22
0
 /**
  * @param PublisherCategory $obj
  */
 public function __construct(PublisherCategory $obj)
 {
     $xoops = Xoops::getInstance();
     $publisher = Publisher::getInstance();
     $member_handler = $xoops->getHandlerMember();
     $userGroups = $member_handler->getGroupList();
     parent::__construct(_AM_PUBLISHER_CATEGORY, "form", $xoops->getEnv('PHP_SELF'));
     $this->setExtra('enctype="multipart/form-data"');
     // Category
     $criteria = new Criteria(null);
     $criteria->setSort('weight');
     $criteria->setOrder('ASC');
     $categories = $publisher->getCategoryHandler()->getObjects($criteria);
     $mytree = new XoopsObjectTree($categories, "categoryid", "parentid");
     $cat_select = $mytree->makeSelBox('parentid', 'name', '--', $obj->getVar('parentid'), true);
     $this->addElement(new Xoops\Form\Label(_AM_PUBLISHER_PARENT_CATEGORY_EXP, $cat_select));
     // Name
     $this->addElement(new Xoops\Form\Text(_AM_PUBLISHER_CATEGORY, 'name', 50, 255, $obj->getVar('name', 'e')), true);
     // Description
     $this->addElement(new Xoops\Form\TextArea(_AM_PUBLISHER_COLDESCRIPT, 'description', $obj->getVar('description', 'e'), 7, 60));
     // EDITOR
     $groups = $xoops->getUserGroups();
     $gperm_handler = $publisher->getGrouppermHandler();
     $module_id = $publisher->getModule()->mid();
     $allowed_editors = PublisherUtils::getEditors($gperm_handler->getItemIds('editors', $groups, $module_id));
     $nohtml = false;
     if (count($allowed_editors) > 0) {
         $editor = @$_POST['editor'];
         if (!empty($editor)) {
             PublisherUtils::setCookieVar('publisher_editor', $editor);
         } else {
             $editor = PublisherUtils::getCookieVar('publisher_editor');
             if (empty($editor) && $xoops->isUser()) {
                 $editor = $xoops->user->getVar('publisher_editor');
                 // Need set through user profile
             }
         }
         $editor = empty($editor) || !in_array($editor, $allowed_editors) ? $publisher->getConfig('submit_editor') : $editor;
         $form_editor = new Xoops\Form\SelectEditor($this, 'editor', $editor, $nohtml, $allowed_editors);
         $this->addElement($form_editor);
     } else {
         $editor = $publisher->getConfig('submit_editor');
     }
     $editor_configs = array();
     $editor_configs['rows'] = $publisher->getConfig('submit_editor_rows') == '' ? 35 : $publisher->getConfig('submit_editor_rows');
     $editor_configs['cols'] = $publisher->getConfig('submit_editor_cols') == '' ? 60 : $publisher->getConfig('submit_editor_cols');
     $editor_configs['width'] = $publisher->getConfig('submit_editor_width') == '' ? "100%" : $publisher->getConfig('submit_editor_width');
     $editor_configs['height'] = $publisher->getConfig('submit_editor_height') == '' ? "400px" : $publisher->getConfig('submit_editor_height');
     $editor_configs['name'] = 'header';
     $editor_configs['value'] = $obj->getVar('header', 'e');
     $text_header = new Xoops\Form\Editor(_AM_PUBLISHER_CATEGORY_HEADER, $editor, $editor_configs, $nohtml, $onfailure = null);
     $text_header->setDescription(_AM_PUBLISHER_CATEGORY_HEADER_DSC);
     $this->addElement($text_header);
     // IMAGE
     $image_array = XoopsLists::getImgListAsArray(PublisherUtils::getImageDir('category'));
     $image_select = new Xoops\Form\Select('', 'image', $obj->image());
     //$image_select -> addOption ('-1', '---------------');
     $image_select->addOptionArray($image_array);
     $image_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/' . PUBLISHER_DIRNAME . '/images/category/' . "\", \"\", \"" . \XoopsBaseConfig::get('url') . "\")'");
     $image_tray = new Xoops\Form\ElementTray(_AM_PUBLISHER_IMAGE, '&nbsp;');
     $image_tray->addElement($image_select);
     $image_tray->addElement(new Xoops\Form\Label('', "<br /><br /><img src='" . PublisherUtils::getImageDir('category', false) . $obj->image() . "' name='image3' id='image3' alt='' />"));
     $image_tray->setDescription(_AM_PUBLISHER_IMAGE_DSC);
     $this->addElement($image_tray);
     // IMAGE UPLOAD
     //$max_size = 5000000;
     $file_box = new Xoops\Form\File(_AM_PUBLISHER_IMAGE_UPLOAD, "image_file");
     $file_box->setExtra("size ='45'");
     $file_box->setDescription(_AM_PUBLISHER_IMAGE_UPLOAD_DSC);
     $this->addElement($file_box);
     // Short url
     $text_short_url = new Xoops\Form\Text(_AM_PUBLISHER_CATEGORY_SHORT_URL, 'short_url', 50, 255, $obj->getVar('short_url', 'e'));
     $text_short_url->setDescription(_AM_PUBLISHER_CATEGORY_SHORT_URL_DSC);
     $this->addElement($text_short_url);
     // Meta Keywords
     $text_meta_keywords = new Xoops\Form\TextArea(_AM_PUBLISHER_CATEGORY_META_KEYWORDS, 'meta_keywords', $obj->getVar('meta_keywords', 'e'), 7, 60);
     $text_meta_keywords->setDescription(_AM_PUBLISHER_CATEGORY_META_KEYWORDS_DSC);
     $this->addElement($text_meta_keywords);
     // Meta Description
     $text_meta_description = new Xoops\Form\TextArea(_AM_PUBLISHER_CATEGORY_META_DESCRIPTION, 'meta_description', $obj->getVar('meta_description', 'e'), 7, 60);
     $text_meta_description->setDescription(_AM_PUBLISHER_CATEGORY_META_DESCRIPTION_DSC);
     $this->addElement($text_meta_description);
     // Weight
     $this->addElement(new Xoops\Form\Text(_AM_PUBLISHER_COLPOSIT, 'weight', 4, 4, $obj->getVar('weight')));
     // Added by skalpa: custom template support
     //todo, check this
     $this->addElement(new Xoops\Form\Text("Custom template", 'template', 50, 255, $obj->getVar('template', 'e')), false);
     // READ PERMISSIONS
     $groups_read_checkbox = new Xoops\Form\Checkbox(_AM_PUBLISHER_PERMISSIONS_CAT_READ, 'groups_read[]', $obj->getGroups_read());
     foreach ($userGroups as $group_id => $group_name) {
         $groups_read_checkbox->addOption($group_id, $group_name);
     }
     $this->addElement($groups_read_checkbox);
     // SUBMIT PERMISSIONS
     $groups_submit_checkbox = new Xoops\Form\Checkbox(_AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT, 'groups_submit[]', $obj->getGroups_submit());
     $groups_submit_checkbox->setDescription(_AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT_DSC);
     foreach ($userGroups as $group_id => $group_name) {
         $groups_submit_checkbox->addOption($group_id, $group_name);
     }
     $this->addElement($groups_submit_checkbox);
     // MODERATION PERMISSIONS
     $groups_moderation_checkbox = new Xoops\Form\Checkbox(_AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR, 'groups_moderation[]', $obj->getGroups_moderation());
     $groups_moderation_checkbox->setDescription(_AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR_DSC);
     foreach ($userGroups as $group_id => $group_name) {
         $groups_moderation_checkbox->addOption($group_id, $group_name);
     }
     $this->addElement($groups_moderation_checkbox);
     $moderator = new Xoops\Form\SelectUser(_AM_PUBLISHER_CATEGORY_MODERATOR, 'moderator', true, $obj->getVar('moderator', 'e'), 1, false);
     $moderator->setDescription(_AM_PUBLISHER_CATEGORY_MODERATOR_DSC);
     $this->addElement($moderator);
     $cat_tray = new Xoops\Form\ElementTray(_AM_PUBLISHER_SCATEGORYNAME, '<br /><br />');
     for ($i = 0; $i < $this->_subCatsCount; ++$i) {
         if ($i < (isset($_POST['scname']) ? sizeof($_POST['scname']) : 0)) {
             $subname = isset($_POST['scname']) ? $_POST['scname'][$i] : '';
         } else {
             $subname = '';
         }
         $cat_tray->addElement(new Xoops\Form\Text('', 'scname[' . $i . ']', 50, 255, $subname));
     }
     $t = new Xoops\Form\Text('', 'nb_subcats', 3, 2);
     $l = new Xoops\Form\Label('', sprintf(_AM_PUBLISHER_ADD_OPT, $t->render()));
     $b = new Xoops\Form\Button('', 'submit_subcats', _AM_PUBLISHER_ADD_OPT_SUBMIT, 'submit');
     if (!$obj->getVar('categoryid')) {
         $b->setExtra('onclick="this.form.elements.op.value=\'addsubcats\'"');
     } else {
         $b->setExtra('onclick="this.form.elements.op.value=\'mod\'"');
     }
     $r = new Xoops\Form\ElementTray('');
     $r->addElement($l);
     $r->addElement($b);
     $cat_tray->addElement($r);
     $this->addElement($cat_tray);
     $this->addElement(new Xoops\Form\Hidden('categoryid', $obj->getVar('categoryid')));
     $this->addElement(new Xoops\Form\Hidden('nb_sub_yet', $this->_subCatsCount));
     // Action buttons tray
     $button_tray = new Xoops\Form\ElementTray('', '');
     // No ID for category -- then it's new category, button says 'Create'
     if (!$obj->getVar('categoryid')) {
         $button_tray->addElement(new Xoops\Form\Button('', 'addcategory', _AM_PUBLISHER_CREATE, 'submit'));
         $butt_clear = new Xoops\Form\Button('', '', _AM_PUBLISHER_CLEAR, 'reset');
         $button_tray->addElement($butt_clear);
         $butt_cancel = new Xoops\Form\Button('', '', _AM_PUBLISHER_CANCEL, 'button');
         $butt_cancel->setExtra('onclick="history.go(-1)"');
         $button_tray->addElement($butt_cancel);
         $this->addElement($button_tray);
     } else {
         $button_tray->addElement(new Xoops\Form\Button('', 'addcategory', _AM_PUBLISHER_MODIFY, 'submit'));
         $butt_cancel = new Xoops\Form\Button('', '', _AM_PUBLISHER_CANCEL, 'button');
         $butt_cancel->setExtra('onclick="history.go(-1)"');
         $button_tray->addElement($butt_cancel);
         $this->addElement($button_tray);
     }
 }
Beispiel #23
0
 /**
  * __construct
  *
  * @param XoopsGroup|XoopsObject &$obj group object
  */
 public function __construct(XoopsGroup &$obj)
 {
     $xoops = Xoops::getInstance();
     if ($obj->isNew()) {
         $s_cat_value = '';
         $a_mod_value = array();
         $r_mod_value = array();
         $r_block_value = array();
     } else {
         $sysperm_handler = $xoops->getHandlerGroupperm();
         $s_cat_value = $sysperm_handler->getItemIds('system_admin', $obj->getVar('groupid'));
         $member_handler = $xoops->getHandlerMember();
         $thisgroup = $member_handler->getGroup($obj->getVar('groupid'));
         $moduleperm_handler = $xoops->getHandlerGroupperm();
         $a_mod_value = $moduleperm_handler->getItemIds('module_admin', $thisgroup->getVar('groupid'));
         $r_mod_value = $moduleperm_handler->getItemIds('module_read', $thisgroup->getVar('groupid'));
         $gperm_handler = $xoops->getHandlerGroupperm();
         $r_block_value = $gperm_handler->getItemIds('block_read', $obj->getVar('groupid'));
     }
     include_once $xoops->path('/modules/system/constants.php');
     $title = $obj->isNew() ? SystemLocale::ADD_NEW_GROUP : SystemLocale::EDIT_GROUP;
     parent::__construct($title, "groupform", 'admin.php', "post", true);
     $this->setExtra('enctype="multipart/form-data"');
     $name_text = new Xoops\Form\Text(SystemLocale::GROUP_NAME, "name", 4, 50, $obj->getVar('name'));
     $desc_text = new Xoops\Form\TextArea(SystemLocale::GROUP_DESCRIPTION, "desc", $obj->getVar('description'));
     $system_catids = new Xoops\Form\ElementTray(SystemLocale::SYSTEM_ADMIN_RIGHTS, '');
     $s_cat_checkbox_all = new Xoops\Form\Checkbox('', "catbox", 1);
     $s_cat_checkbox_all->addOption('allbox', XoopsLocale::ALL);
     $s_cat_checkbox_all->setExtra(" onclick='xoopsCheckGroup(\"groupform\", \"catbox\" , \"system_catids[]\");' ");
     $s_cat_checkbox_all->setClass('xo-checkall');
     $system_catids->addElement($s_cat_checkbox_all);
     $s_cat_checkbox = new Xoops\Form\Checkbox('', "system_catids", $s_cat_value);
     //$s_cat_checkbox->columns = 6;
     $admin_dir = \XoopsBaseConfig::get('root-path') . '/modules/system/admin/';
     $dirlist = XoopsLists::getDirListAsArray($admin_dir);
     foreach ($dirlist as $file) {
         include \XoopsBaseConfig::get('root-path') . '/modules/system/admin/' . $file . '/xoops_version.php';
         if (!empty($modversion['category'])) {
             if ($xoops->getModuleConfig('active_' . $file, 'system') == 1) {
                 $s_cat_checkbox->addOption($modversion['category'], $modversion['name']);
             }
         }
         unset($modversion);
     }
     unset($dirlist);
     $system_catids->addElement($s_cat_checkbox);
     $admin_mids = new Xoops\Form\ElementTray(SystemLocale::MODULE_ADMIN_RIGHTS, '');
     $s_admin_checkbox_all = new Xoops\Form\Checkbox('', "adminbox", 1);
     $s_admin_checkbox_all->addOption('allbox', XoopsLocale::ALL);
     $s_admin_checkbox_all->setExtra(" onclick='xoopsCheckGroup(\"groupform\", \"adminbox\" , \"admin_mids[]\");' ");
     $s_admin_checkbox_all->setClass('xo-checkall');
     $admin_mids->addElement($s_admin_checkbox_all);
     $a_mod_checkbox = new Xoops\Form\Checkbox('', "admin_mids[]", $a_mod_value);
     //$a_mod_checkbox->columns = 5;
     $module_handler = $xoops->getHandlerModule();
     $criteria = new CriteriaCompo(new Criteria('hasadmin', 1));
     $criteria->add(new Criteria('isactive', 1));
     $criteria->add(new Criteria('dirname', 'system', '<>'));
     $a_mod_checkbox->addOptionArray($module_handler->getNameList($criteria));
     $admin_mids->addElement($a_mod_checkbox);
     $read_mids = new Xoops\Form\ElementTray(SystemLocale::MODULE_ACCESS_RIGHTS, '');
     $s_mod_checkbox_all = new Xoops\Form\Checkbox('', "readbox", 1);
     $s_mod_checkbox_all->addOption('allbox', XoopsLocale::ALL);
     $s_mod_checkbox_all->setExtra(" onclick='xoopsCheckGroup(\"groupform\", \"readbox\" , \"read_mids[]\");' ");
     $s_mod_checkbox_all->setClass('xo-checkall');
     $read_mids->addElement($s_mod_checkbox_all);
     $r_mod_checkbox = new Xoops\Form\Checkbox('', "read_mids[]", $r_mod_value);
     //$r_mod_checkbox->columns = 5;
     $criteria = new CriteriaCompo(new Criteria('hasmain', 1));
     $criteria->add(new Criteria('isactive', 1));
     $r_mod_checkbox->addOptionArray($module_handler->getNameList($criteria));
     $read_mids->addElement($r_mod_checkbox);
     $criteria = new CriteriaCompo(new Criteria('isactive', 1));
     $criteria->setSort("mid");
     $criteria->setOrder("ASC");
     $module_list = $module_handler->getNameList($criteria);
     $module_list[0] = SystemLocale::CUSTOM_BLOCK;
     $block_handler = $xoops->getHandlerBlock();
     $blocks_obj = $block_handler->getDistinctObjects(new Criteria("mid", "('" . implode("', '", array_keys($module_list)) . "')", "IN"), true);
     $blocks_module = array();
     foreach (array_keys($blocks_obj) as $bid) {
         $title = $blocks_obj[$bid]->getVar("title");
         $blocks_module[$blocks_obj[$bid]->getVar('mid')][$blocks_obj[$bid]->getVar('bid')] = empty($title) ? $blocks_obj[$bid]->getVar("name") : $title;
     }
     ksort($blocks_module);
     $r_block_tray = new Xoops\Form\ElementTray(SystemLocale::BLOCK_ACCESS_RIGHTS, "<br /><br />");
     $s_checkbox_all = new Xoops\Form\Checkbox('', "blocksbox", 1);
     $s_checkbox_all->addOption('allbox', XoopsLocale::ALL);
     $s_checkbox_all->setExtra(" onclick='xoopsCheckGroup(\"groupform\", \"blocksbox\" , \"read_bids[]\");' ");
     $s_checkbox_all->setClass('xo-checkall');
     $r_block_tray->addElement($s_checkbox_all);
     foreach (array_keys($blocks_module) as $mid) {
         $new_blocks_array = array();
         foreach ($blocks_module[$mid] as $key => $value) {
             $new_blocks_array[$key] = "<a href='" . \XoopsBaseConfig::get('url') . "/modules/system/admin.php?fct=blocksadmin&amp;op=edit&amp;bid={$key}' " . "title='ID: {$key}' rel='external'>{$value}</a>";
         }
         $r_block_checkbox = new Xoops\Form\Checkbox('<strong>' . $module_list[$mid] . '</strong><br />', "read_bids[]", $r_block_value);
         //$r_block_checkbox->columns = 5;
         $r_block_checkbox->addOptionArray($new_blocks_array);
         $r_block_tray->addElement($r_block_checkbox);
         unset($r_block_checkbox);
     }
     if (!$obj->isNew()) {
         $this->addElement(new Xoops\Form\Hidden('g_id', $obj->getVar('groupid')));
         $this->addElement(new Xoops\Form\Hidden("op", "groups_save_update"));
     } else {
         $this->addElement(new Xoops\Form\Hidden("op", "groups_save_add"));
     }
     $this->addElement(new Xoops\Form\Hidden('fct', 'groups'));
     $this->addElement($name_text, true);
     $this->addElement($desc_text);
     $this->addElement($system_catids);
     $this->addElement($admin_mids);
     $this->addElement($read_mids);
     $this->addElement($r_block_tray);
     $this->addElement(new Xoops\Form\Button("", "submit", XoopsLocale::A_SUBMIT, "submit"));
 }
Beispiel #24
0
     $rank_select->addOptionArray($ranks);
     $form->addElement($url_text);
     $form->addElement($location_text);
     $form->addElement($occupation_text);
     $form->addElement($interest_text);
     $form->addElement($mailok_radio);
     $form->addElement($avatar_radio);
     $form->addElement($level_radio);
     $form->addElement($group_select);
     $form->addElement($rank_select);
 } else {
     foreach (array("uname", "email") as $var) {
         $title = $items_match[$var];
         $text = new Xoops\Form\Text("", $var, 30, 100, @$_POST[$var]);
         $match = new Xoops\Form\SelectMatchOption("", "{$var}_match", @$_POST["{$var}_match"]);
         $match_tray = new Xoops\Form\ElementTray($title, "&nbsp;");
         $match_tray->addElement($match);
         $match_tray->addElement($text);
         $form->addElement($match_tray);
         unset($text, $match, $match_tray);
     }
 }
 $sort_select = new Xoops\Form\Select(XoopsLocale::SORT_BY, "user_sort", @$_POST["user_sort"]);
 $sort_select->addOptionArray(array("uname" => XoopsLocale::USER_NAME, "last_login" => XoopsLocale::LAST_LOGIN, "user_regdate" => XoopsLocale::REGISTRATION_DATE, "posts" => XoopsLocale::POSTS));
 $order_select = new Xoops\Form\Select(XoopsLocale::ORDER, "user_order", @$_POST["user_order"]);
 $order_select->addOptionArray(array("ASC" => XoopsLocale::ASCENDING_ORDER, "DESC" => XoopsLocale::DESCENDING_ORDER));
 $form->addElement($sort_select);
 $form->addElement($order_select);
 $form->addElement(new Xoops\Form\Text(XoopsLocale::NUMBER_OF_RESULTS_PER_PAGE, "limit", 6, 6, empty($_REQUEST["limit"]) ? 50 : (int) $_REQUEST["limit"]));
 $form->addElement(new Xoops\Form\Hidden("mode", $mode));
 $form->addElement(new Xoops\Form\Hidden("target", @$_REQUEST["target"]));
/**
 * @param $config
 *
 * @return array
 */
function createConfigform($config)
{
    $xoops = Xoops::getInstance();
    $config_handler = $xoops->getHandlerConfig();
    //$xoops->config = $config_handler->getConfigsByCat(XOOPS_CONF);
    //$config =& $xoops->config;
    $ret = array();
    $confcount = count($config);
    for ($i = 0; $i < $confcount; ++$i) {
        $conf_catid = $config[$i]->getVar('conf_catid');
        if (!isset($ret[$conf_catid])) {
            $ret[$conf_catid] = new Xoops\Form\ThemeForm('', 'configs', 'index.php', 'post');
        }
        $title = Xoops_Locale::translate($config[$i]->getVar('conf_title'), 'system');
        switch ($config[$i]->getVar('conf_formtype')) {
            case 'textarea':
                $myts = MyTextSanitizer::getInstance();
                if ($config[$i]->getVar('conf_valuetype') == 'array') {
                    // this is exceptional.. only when value type is arrayneed a smarter way for this
                    $ele = $config[$i]->getVar('conf_value') != '' ? new Xoops\Form\TextArea($title, $config[$i]->getVar('conf_name'), $myts->htmlspecialchars(implode('|', $config[$i]->getConfValueForOutput())), 5, 50) : new Xoops\Form\TextArea($title, $config[$i]->getVar('conf_name'), '', 5, 50);
                } else {
                    $ele = new Xoops\Form\TextArea($title, $config[$i]->getVar('conf_name'), $myts->htmlspecialchars($config[$i]->getConfValueForOutput()), 5, 100);
                }
                break;
            case 'select':
                $ele = new Xoops\Form\Select($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput());
                $options =& $config_handler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id')));
                $opcount = count($options);
                for ($j = 0; $j < $opcount; ++$j) {
                    $optval = Xoops_Locale::translate($options[$j]->getVar('confop_value'), 'system');
                    $optkey = Xoops_Locale::translate($options[$j]->getVar('confop_name'), 'system');
                    $ele->addOption($optval, $optkey);
                }
                break;
            case 'select_multi':
                $ele = new Xoops\Form\Select($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), 5, true);
                $options =& $config_handler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id')));
                $opcount = count($options);
                for ($j = 0; $j < $opcount; ++$j) {
                    $optval = Xoops_Locale::translate($options[$j]->getVar('confop_value'), 'system');
                    $optkey = Xoops_Locale::translate($options[$j]->getVar('confop_name'), 'system');
                    $ele->addOption($optval, $optkey);
                }
                break;
            case 'yesno':
                $ele = new Xoops\Form\RadioYesNo($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), XoopsLocale::YES, XoopsLocale::NO);
                break;
            case 'theme':
            case 'theme_multi':
                $ele = $config[$i]->getVar('conf_formtype') != 'theme_multi' ? new Xoops\Form\Select($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()) : new Xoops\Form\Select($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), 5, true);
                $dirlist = XoopsLists::getThemesList();
                if (!empty($dirlist)) {
                    asort($dirlist);
                    $ele->addOptionArray($dirlist);
                }
                break;
            case 'tplset':
                $ele = new Xoops\Form\Select($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput());
                $tplset_handler = $xoops->getHandlerTplSet();
                $tplsetlist = $tplset_handler->getNameList();
                asort($tplsetlist);
                foreach ($tplsetlist as $key => $name) {
                    $ele->addOption($key, $name);
                }
                break;
            case 'timezone':
                $ele = new Xoops\Form\SelectTimeZone($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput());
                break;
            case 'language':
                $ele = new Xoops\Form\SelectLanguage($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput());
                break;
            case 'locale':
                $ele = new Xoops\Form\SelectLocale($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput());
                break;
            case 'startpage':
                $ele = new Xoops\Form\Select($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput());
                $module_handler = $xoops->getHandlerModule();
                $criteria = new CriteriaCompo(new Criteria('hasmain', 1));
                $criteria->add(new Criteria('isactive', 1));
                $moduleslist =& $module_handler->getNameList($criteria, true);
                $moduleslist['--'] = XoopsLocale::NONE;
                $ele->addOptionArray($moduleslist);
                break;
            case 'group':
                $ele = new Xoops\Form\SelectGroup($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 1, false);
                break;
            case 'group_multi':
                $ele = new Xoops\Form\SelectGroup($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 5, true);
                break;
                // RMV-NOTIFY - added 'user' and 'user_multi'
            // RMV-NOTIFY - added 'user' and 'user_multi'
            case 'user':
                $ele = new Xoops\Form\SelectUser($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 1, false);
                break;
            case 'user_multi':
                $ele = new Xoops\Form\SelectUser($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 5, true);
                break;
            case 'module_cache':
                $module_handler = $xoops->getHandlerModule();
                $modules = $module_handler->getObjectsArray(new Criteria('hasmain', 1), true);
                $currrent_val = $config[$i]->getConfValueForOutput();
                $cache_options = array('0' => XoopsLocale::NO_CACHE, '30' => sprintf(XoopsLocale::F_SECONDS, 30), '60' => XoopsLocale::ONE_MINUTE, '300' => sprintf(XoopsLocale::F_MINUTES, 5), '1800' => sprintf(XoopsLocale::F_MINUTES, 30), '3600' => XoopsLocale::ONE_HOUR, '18000' => sprintf(XoopsLocale::F_HOURS, 5), '86400' => XoopsLocale::ONE_DAY, '259200' => sprintf(XoopsLocale::F_DAYS, 3), '604800' => XoopsLocale::ONE_WEEK, '2592000' => XoopsLocale::ONE_MONTH);
                if (count($modules) > 0) {
                    $ele = new Xoops\Form\ElementTray($title, '<br />');
                    foreach (array_keys($modules) as $mid) {
                        $c_val = isset($currrent_val[$mid]) ? (int) $currrent_val[$mid] : null;
                        $selform = new Xoops\Form\Select($modules[$mid]->getVar('name'), $config[$i]->getVar('conf_name') . "[{$mid}]", $c_val);
                        $selform->addOptionArray($cache_options);
                        $ele->addElement($selform);
                        unset($selform);
                    }
                } else {
                    $ele = new Xoops\Form\Label($title, SystemLocale::NO_MODULE_TO_CACHE);
                }
                break;
            case 'site_cache':
                $ele = new Xoops\Form\Select($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput());
                $ele->addOptionArray(array('0' => XoopsLocale::NO_CACHE, '30' => sprintf(XoopsLocale::F_SECONDS, 30), '60' => XoopsLocale::ONE_MINUTE, '300' => sprintf(XoopsLocale::F_MINUTES, 5), '1800' => sprintf(XoopsLocale::F_MINUTES, 30), '3600' => XoopsLocale::ONE_HOUR, '18000' => sprintf(XoopsLocale::F_HOURS, 5), '86400' => XoopsLocale::ONE_DAY, '259200' => sprintf(XoopsLocale::F_DAYS, 3), '604800' => XoopsLocale::ONE_WEEK, '2592000' => XoopsLocale::ONE_MONTH));
                break;
            case 'password':
                $myts = MyTextSanitizer::getInstance();
                $ele = new Xoops\Form\Password($title, $config[$i]->getVar('conf_name'), 50, 255, $myts->htmlspecialchars($config[$i]->getConfValueForOutput()));
                break;
            case 'color':
                $myts = MyTextSanitizer::getInstance();
                $ele = new Xoops\Form\ColorPicker($title, $config[$i]->getVar('conf_name'), $myts->htmlspecialchars($config[$i]->getConfValueForOutput()));
                break;
            case 'hidden':
                $myts = MyTextSanitizer::getInstance();
                $ele = new Xoops\Form\Hidden($config[$i]->getVar('conf_name'), $myts->htmlspecialchars($config[$i]->getConfValueForOutput()));
                break;
            case 'textbox':
            default:
                $myts = MyTextSanitizer::getInstance();
                $ele = new Xoops\Form\Text($title, $config[$i]->getVar('conf_name'), 50, 255, $myts->htmlspecialchars($config[$i]->getConfValueForOutput()));
                break;
        }
        if ($config[$i]->getVar('conf_desc') != '') {
            $ele->setDescription(Xoops_Locale::translate($config[$i]->getVar('conf_desc'), 'system'));
        }
        $ret[$conf_catid]->addElement($ele);
        $hidden = new Xoops\Form\Hidden('conf_ids[]', $config[$i]->getVar('conf_id'));
        $ret[$conf_catid]->addElement($hidden);
        unset($ele);
        unset($hidden);
    }
    return $ret;
}
Beispiel #26
0
                    $form->addElement(new Xoops\Form\Label(_PM_TO, XoopsUser::getUnameFromId($to_userid, false)));
                    $form->addElement(new Xoops\Form\Hidden('to_userid', $to_userid));
                } else {
                    $form->addElement(new Xoops\Form\SelectUser(_PM_TO, 'to_userid'));
                }
                $subject = "";
                $message = "";
            }
        }
        $form->addElement(new Xoops\Form\Text(_PM_SUBJECTC, 'subject', 4, 100, $subject), true);
        $icons = new Xoops\Form\Radio(XoopsLocale::MESSAGE_ICON, 'msg_image', '', true);
        $subject_icons = XoopsLists::getSubjectsList();
        foreach (array_keys($subject_icons) as $i) {
            $icons->addOption($i, "<img src='" . $xoops->url("images/subject/") . $i . "' alt='" . $i . "' />");
        }
        $form->addElement($icons, false);
        $form->addElement(new Xoops\Form\DhtmlTextArea(_PM_MESSAGEC, 'message', $message, 8, 37), true);
        $form->addElement(new Xoops\Form\RadioYesNo(_PM_SAVEINOUTBOX, 'savecopy', 0));
        $form->addElement(new Xoops\Form\Hidden('op', 'submit'));
        $buttons = new Xoops\Form\ElementTray('');
        $buttons->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
        $buttons->addElement(new Xoops\Form\Button('', 'reset', _PM_CLEAR, 'reset'));
        $cancel_send = new Xoops\Form\Button('', 'cancel', _PM_CANCELSEND, 'button');
        $cancel_send->setExtra("onclick='javascript:window.close();'");
        $buttons->addElement($cancel_send);
        $form->addElement($buttons);
        $tpl->assign('form', $form->render());
        $tpl->display("module:pm/pm_pmlite.tpl");
    }
}
$xoops->simpleFooter();
Beispiel #27
0
 /**
  * @param AlumniCategory|XoopsObject $obj
  */
 public function __construct(AlumniCategory &$obj)
 {
     $xoops = Xoops::getInstance();
     $moduleDirName = basename(dirname(__DIR__));
     $admin_lang = '_AM_' . strtoupper($moduleDirName);
     $title = $obj->isNew() ? sprintf(AlumniLocale::ADD_CAT) : sprintf(AlumniLocale::EDIT_CAT);
     parent::__construct($title, 'form', false, 'post', true);
     include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
     $this->setExtra('enctype="multipart/form-data"');
     include_once XOOPS_ROOT_PATH . '/class/tree.php';
     $categoryHandler = $xoops->getModuleHandler('category', 'alumni');
     $arr = $categoryHandler->getall();
     $mytree = new XoopsObjectTree($arr, 'cid', 'pid');
     $this->addElement(new Xoops\Form\Label(AlumniLocale::CATEGORY_PID, $mytree->makeSelBox('pid', 'title', '-', $obj->getVar('pid'), true)));
     $this->addElement(new Xoops\Form\Text(AlumniLocale::CATEGORY_TITLE, 'title', 50, 255, $obj->getVar('title')), true);
     if ($obj->isNew()) {
         $default_img = 'default.gif';
     } else {
         $default_img = str_replace('alumni/', '', $obj->getVar('img', 'e'));
     }
     $img = $obj->getVar("img") ? $obj->getVar("img") : 'default.gif';
     $imgtray_img = new Xoops\Form\ElementTray(AlumniLocale::IMGCAT, '<br />');
     $img_path = \XoopsBaseConfig::get('root-path') . '/modules/alumni/images/cat';
     $imgpath_img = sprintf(AlumniLocale::FORMIMAGE_PATH, $img_path);
     $imageselect_img = new Xoops\Form\Select(sprintf(XoopsLocale::F_FILE_EXISTS_IN, $img_path . '/'), 'img', $img);
     $image_array_img = XoopsLists::getImgListAsArray($img_path);
     $imageselect_img->addOption("{$default_img}", $default_img);
     foreach ($image_array_img as $image_img) {
         $imageselect_img->addOption("{$image_img}", $image_img);
     }
     $alumni_upload_url = \XoopsBaseConfig::get('url') . '/modules/alumni/images/cat';
     $imageselect_img->setExtra("onchange='showImgSelected(\"image_img\", \"img\", \"\", \"\", \"" . $alumni_upload_url . "\")'");
     $imgtray_img->addElement($imageselect_img, false);
     $imgtray_img->addElement(new Xoops\Form\Label('', "<br /><img src='" . $alumni_upload_url . "/" . $img . "' name='image_img' id='image_img' alt='' />"));
     $fileseltray_category_img = new Xoops\Form\ElementTray('<br />', '<br />');
     $fileseltray_category_img->addElement(new Xoops\Form\File(AlumniLocale::FORMUPLOAD, "img"), false);
     $fileseltray_category_img->addElement(new Xoops\Form\Label(''), false);
     $imgtray_img->addElement($fileseltray_category_img);
     $this->addElement($imgtray_img);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::ORDER, 'ordre', 4, 4, $obj->getVar('ordre')), false);
     $this->addElement(new Xoops\Form\Label(AlumniLocale::IFSCHOOL, ''));
     $photo_old = $obj->getVar('scphoto') ? $obj->getVar('scphoto') : '';
     $uploadirectory_photo = XOOPS_ROOT_PATH . "/modules/{$moduleDirName}/photos/school_photos";
     $imgtray_photo = new Xoops\Form\ElementTray(AlumniLocale::SCPHOTO, '<br />');
     $imgpath_photo = sprintf(AlumniLocale::FORMIMAGE_PATH, $uploadirectory_photo);
     $fileseltray_photo = new Xoops\Form\ElementTray('', '<br />');
     $fileseltray_photo->addElement(new XoopsFormFile(AlumniLocale::FORMUPLOAD, 'scphoto', $xoops->getModuleConfig('alumni_photomax')), false);
     if ($photo_old) {
         $fileseltray_photo->addElement(new Xoops\Form\Label(AlumniLocale::SELECTED_PHOTO, '<a href="../photos/school_photos/' . $photo_old . '">' . $photo_old . '</a>', false));
         $imgtray_checkbox = new Xoops\Form\Checkbox('', 'del_photo', 0);
         $imgtray_checkbox->addOption(1, AlumniLocale::DELPICT);
         $fileseltray_photo->addElement($imgtray_checkbox);
     }
     $imgtray_photo->addElement($fileseltray_photo);
     $this->addElement($imgtray_photo);
     $this->addElement(new Xoops\Form\Hidden('photo_old', $photo_old));
     $this->addElement(new Xoops\Form\Text(AlumniLocale::SCADDRESS, 'scaddress', 50, 255, $obj->getVar('scaddress')), false);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::SCADDRESS2, 'scaddress2', 50, 255, $obj->getVar('scaddress2')), false);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::SCCITY, 'sccity', 50, 255, $obj->getVar('sccity')), false);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::SCSTATE, 'scstate', 50, 255, $obj->getVar('scstate')), false);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::SCZIP, 'sczip', 50, 255, $obj->getVar('sczip')), false);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::SCPHONE, 'scphone', 50, 255, $obj->getVar('scphone')), false);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::SCFAX, 'scfax', 50, 255, $obj->getVar('scfax')), false);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::SCMOTTO, 'scmotto', 50, 255, $obj->getVar('scmotto')), false);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::SCURL, 'scurl', 50, 255, $obj->getVar('scurl')), false);
     $this->addElement(new Xoops\Form\Hidden('op', 'save_category'));
     $this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
 }
Beispiel #28
0
 /**
  * @param array       $obj
  * @param XoopsModule $mod
  */
 public function getForm(&$obj, XoopsModule $mod)
 {
     $xoops = Xoops::getInstance();
     $helper = Userconfigs::getInstance();
     $config_handler = $helper->getHandlerConfig();
     /* @var $plugin UserconfigsPluginInterface */
     if ($plugin = \Xoops\Module\Plugin::getPlugin($mod->getVar('dirname'), 'userconfigs')) {
         parent::__construct('', 'pref_form', 'index.php', 'post', true);
         if ($mod->getVar('dirname') != 'system') {
             $xoops->loadLanguage('modinfo', $mod->getVar('dirname'));
             $xoops->loadLocale($mod->getVar('dirname'));
         }
         $configs = $plugin->configs();
         $configNames = array();
         foreach (array_keys($configs) as $i) {
             $configNames[$configs[$i]['name']] =& $configs[$i];
         }
         $configCats = $plugin->categories();
         if (!$configCats) {
             $configCats = array('default' => array('name' => _MD_USERCONFIGS_CONFIGS, 'description' => ''));
         }
         if (!in_array('default', array_keys($configCats))) {
             $configCats['default'] = array('name' => _MD_USERCONFIGS_CONFIGS, 'description' => '');
         }
         foreach (array_keys($configNames) as $name) {
             if (!isset($configNames[$name]['category'])) {
                 $configNames[$name]['category'] = 'default';
             }
         }
         $tabtray = new Xoops\Form\TabTray('', 'pref_tabtay', $xoops->getModuleConfig('jquery_theme', 'system'));
         $tabs = array();
         foreach ($configCats as $name => $info) {
             $tabs[$name] = new Xoops\Form\Tab($info['name'], 'pref_tab_' . $name);
             if (isset($info['description']) && $info['description'] != '') {
                 $tabs[$name]->addElement(new Xoops\Form\Label('', $info['description']));
             }
         }
         $count = count($obj);
         for ($i = 0; $i < $count; ++$i) {
             $title = Xoops_Locale::translate($obj[$i]->getVar('conf_title'), $mod->getVar('dirname'));
             $desc = $obj[$i]->getVar('conf_desc') != '' ? Xoops_Locale::translate($obj[$i]->getVar('conf_desc'), $mod->getVar('dirname')) : '';
             switch ($obj[$i]->getVar('conf_formtype')) {
                 case 'textarea':
                     $myts = MyTextSanitizer::getInstance();
                     if ($obj[$i]->getVar('conf_valuetype') == 'array') {
                         // this is exceptional.. only when value type is arrayneed a smarter way for this
                         $ele = $obj[$i]->getVar('conf_value') != '' ? new Xoops\Form\TextArea($title, $obj[$i]->getVar('conf_name'), $myts->htmlSpecialChars(implode('|', $obj[$i]->getConfValueForOutput())), 5, 5) : new Xoops\Form\TextArea($title, $obj[$i]->getVar('conf_name'), '', 5, 5);
                     } else {
                         $ele = new Xoops\Form\TextArea($title, $obj[$i]->getVar('conf_name'), $myts->htmlSpecialChars($obj[$i]->getConfValueForOutput()), 5, 5);
                     }
                     break;
                 case 'select':
                     $ele = new Xoops\Form\Select($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput());
                     $options = $config_handler->getConfigOptions(new Criteria('conf_id', $obj[$i]->getVar('conf_id')));
                     $opcount = count($options);
                     for ($j = 0; $j < $opcount; ++$j) {
                         $optval = Xoops_Locale::translate($options[$j]->getVar('confop_value'), $mod->getVar('dirname'));
                         $optkey = Xoops_Locale::translate($options[$j]->getVar('confop_name'), $mod->getVar('dirname'));
                         $ele->addOption($optval, $optkey);
                     }
                     break;
                 case 'select_multi':
                     $ele = new Xoops\Form\Select($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput(), 5, true);
                     $options = $config_handler->getConfigOptions(new Criteria('conf_id', $obj[$i]->getVar('conf_id')));
                     $opcount = count($options);
                     for ($j = 0; $j < $opcount; ++$j) {
                         $optval = Xoops_Locale::translate($options[$j]->getVar('confop_value'), $mod->getVar('dirname'));
                         $optkey = Xoops_Locale::translate($options[$j]->getVar('confop_name'), $mod->getVar('dirname'));
                         $ele->addOption($optval, $optkey);
                     }
                     break;
                 case 'yesno':
                     $ele = new Xoops\Form\RadioYesNo($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput());
                     break;
                 case 'theme':
                 case 'theme_multi':
                     $ele = $obj[$i]->getVar('conf_formtype') != 'theme_multi' ? new Xoops\Form\Select($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()) : new Xoops\Form\Select($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput(), 5, true);
                     $dirlist = XoopsLists::getThemesList();
                     if (!empty($dirlist)) {
                         asort($dirlist);
                         $ele->addOptionArray($dirlist);
                     }
                     break;
                 case 'tplset':
                     $ele = new Xoops\Form\Select($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput());
                     $tplset_handler = $xoops->getHandlerTplSet();
                     $tplsetlist = $tplset_handler->getNameList();
                     asort($tplsetlist);
                     foreach ($tplsetlist as $key => $name) {
                         $ele->addOption($key, $name);
                     }
                     break;
                 case 'cpanel':
                     $ele = new Xoops\Form\Hidden($obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput());
                     /*
                                             $ele = new Xoops\Form\Select($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput());
                                             XoopsLoad::load("cpanel", "system");
                                             $list = XoopsSystemCpanel::getGuis();
                                             $ele->addOptionArray($list);  */
                     break;
                 case 'timezone':
                     $ele = new Xoops\Form\SelectTimeZone($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput());
                     break;
                 case 'language':
                     $ele = new Xoops\Form\SelectLanguage($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput());
                     break;
                 case 'locale':
                     $ele = new Xoops\Form\SelectLocale($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput());
                     break;
                 case 'startpage':
                     $ele = new Xoops\Form\Select($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput());
                     $module_handler = $xoops->getHandlerModule();
                     $criteria = new CriteriaCompo(new Criteria('hasmain', 1));
                     $criteria->add(new Criteria('isactive', 1));
                     $moduleslist = $module_handler->getNameList($criteria, true);
                     $moduleslist['--'] = XoopsLocale::NONE;
                     $ele->addOptionArray($moduleslist);
                     break;
                 case 'group':
                     $ele = new Xoops\Form\SelectGroup($title, $obj[$i]->getVar('conf_name'), false, $obj[$i]->getConfValueForOutput(), 1, false);
                     break;
                 case 'group_multi':
                     $ele = new Xoops\Form\SelectGroup($title, $obj[$i]->getVar('conf_name'), false, $obj[$i]->getConfValueForOutput(), 5, true);
                     break;
                     // RMV-NOTIFY: added 'user' and 'user_multi'
                 // RMV-NOTIFY: added 'user' and 'user_multi'
                 case 'user':
                     $ele = new Xoops\Form\SelectUser($title, $obj[$i]->getVar('conf_name'), false, $obj[$i]->getConfValueForOutput(), 1, false);
                     break;
                 case 'user_multi':
                     $ele = new Xoops\Form\SelectUser($title, $obj[$i]->getVar('conf_name'), false, $obj[$i]->getConfValueForOutput(), 5, true);
                     break;
                 case 'module_cache':
                     $module_handler = $xoops->getHandlerModule();
                     $modules = $module_handler->getObjectsArray(new Criteria('hasmain', 1), true);
                     $currrent_val = $obj[$i]->getConfValueForOutput();
                     $cache_options = array('0' => XoopsLocale::NO_CACHE, '30' => sprintf(XoopsLocale::F_SECONDS, 30), '60' => XoopsLocale::ONE_MINUTE, '300' => sprintf(XoopsLocale::F_MINUTES, 5), '1800' => sprintf(XoopsLocale::F_MINUTES, 30), '3600' => XoopsLocale::ONE_HOUR, '18000' => sprintf(XoopsLocale::F_HOURS, 5), '86400' => XoopsLocale::ONE_DAY, '259200' => sprintf(XoopsLocale::F_DAYS, 3), '604800' => XoopsLocale::ONE_WEEK, '2592000' => XoopsLocale::ONE_MONTH);
                     if (count($modules) > 0) {
                         $ele = new Xoops\Form\ElementTray($title, '<br />');
                         foreach (array_keys($modules) as $mid) {
                             $c_val = isset($currrent_val[$mid]) ? (int) $currrent_val[$mid] : null;
                             $selform = new Xoops\Form\Select($modules[$mid]->getVar('name'), $obj[$i]->getVar('conf_name') . "[{$mid}]", $c_val);
                             $selform->addOptionArray($cache_options);
                             $ele->addElement($selform);
                             unset($selform);
                         }
                     } else {
                         $ele = new Xoops\Form\Label($title, SystemLocale::NO_MODULE_TO_CACHE);
                     }
                     break;
                 case 'site_cache':
                     $ele = new Xoops\Form\Select($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput());
                     $ele->addOptionArray(array('0' => XoopsLocale::NO_CACHE, '30' => sprintf(XoopsLocale::F_SECONDS, 30), '60' => XoopsLocale::ONE_MINUTE, '300' => sprintf(XoopsLocale::F_MINUTES, 5), '1800' => sprintf(XoopsLocale::F_MINUTES, 30), '3600' => XoopsLocale::ONE_HOUR, '18000' => sprintf(XoopsLocale::F_HOURS, 5), '86400' => XoopsLocale::ONE_DAY, '259200' => sprintf(XoopsLocale::F_DAYS, 3), '604800' => XoopsLocale::ONE_WEEK, '2592000' => XoopsLocale::ONE_MONTH));
                     break;
                 case 'password':
                     $myts = MyTextSanitizer::getInstance();
                     $ele = new Xoops\Form\Password($title, $obj[$i]->getVar('conf_name'), 5, 255, $myts->htmlSpecialChars($obj[$i]->getConfValueForOutput()));
                     break;
                 case 'color':
                     $myts = MyTextSanitizer::getInstance();
                     $ele = new Xoops\Form\ColorPicker($title, $obj[$i]->getVar('conf_name'), $myts->htmlSpecialChars($obj[$i]->getConfValueForOutput()));
                     break;
                 case 'hidden':
                     $myts = MyTextSanitizer::getInstance();
                     $ele = new Xoops\Form\Hidden($obj[$i]->getVar('conf_name'), $myts->htmlSpecialChars($obj[$i]->getConfValueForOutput()));
                     break;
                 case 'textbox':
                 default:
                     $myts = MyTextSanitizer::getInstance();
                     $ele = new Xoops\Form\Text($title, $obj[$i]->getVar('conf_name'), 5, 255, $myts->htmlSpecialChars($obj[$i]->getConfValueForOutput()));
                     break;
             }
             $hidden = new Xoops\Form\Hidden('conf_ids[]', $obj[$i]->getVar('conf_id'));
             if (isset($ele)) {
                 $ele->setDescription($desc);
                 if ($obj[$i]->getVar('conf_formtype') != 'hidden') {
                     $name = 'default';
                     if (isset($configNames[$obj[$i]->getVar('conf_name')]['category'])) {
                         $name = $configNames[$obj[$i]->getVar('conf_name')]['category'];
                     }
                     $tabs[$name]->addElement($ele);
                 } else {
                     $this->addElement($ele);
                 }
                 $this->addElement($hidden);
                 unset($ele);
                 unset($hidden);
             }
         }
         foreach (array_keys($tabs) as $name) {
             if ($tabs[$name]->getElements()) {
                 $tabtray->addElement($tabs[$name]);
             }
         }
         $this->addElement($tabtray);
         $this->addElement(new Xoops\Form\Hidden('op', 'save'));
         $this->addElement(new Xoops\Form\Hidden('mid', $mod->getVar('mid')));
         $this->addElement(new Xoops\Form\Button('', 'button', XoopsLocale::A_SUBMIT, 'submit'));
     }
 }
Beispiel #29
0
 * @subpackage      tinymce / xoops plugins
 * @since           2.6.0
 * @author          Laurent JEN (aka DuGris)
 * @version         $Id$
 */
use Xoops\Core\XoopsTpl;
require_once dirname(__FILE__) . '/../../../../../../mainfile.php';
$xoops = Xoops::getInstance();
$xoops->disableErrorReporting();
$xoops->simpleHeader(true);
$form = new Xoops\Form\ThemeForm('', 'imagecat_form', '#', false, 'vertical');
$form->addElement(new Xoops\Form\TextArea(XoopsLocale::PASTE_THE_QUOTE_YOU_WANT_TO_INSERT, 'text_id', '', 9, 7));
/**
 * Buttons
 */
$button_tray = new Xoops\Form\ElementTray('', '');
$button_tray->addElement(new Xoops\Form\Hidden('op', 'save'));
$button = new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit');
$button->setExtra('onclick="Xoops_quoteDialog.insert();"');
$button->setClass('btn btn-success');
$button_tray->addElement($button);
$button_2 = new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset');
$button_2->setClass('btn btn-warning');
$button_tray->addElement($button_2);
$button_3 = new Xoops\Form\Button('', 'button', XoopsLocale::A_CLOSE, 'button');
$button_3->setExtra('onclick="tinyMCEPopup.close();"');
$button_3->setClass('btn btn-danger');
$button_tray->addElement($button_3);
$form->addElement($button_tray);
$xoopsTpl = new XoopsTpl();
$xoopsTpl->assign('js_file', 'js/xoops_quote.js');
Beispiel #30
0
   $importfile_select_array["xfsection"] = "XF-Section " . $from_module_version;
   $xfs_version = $from_module_version;
   }
   } */
 if (isset($importfile_select_array) && count($importfile_select_array) > 0) {
     $sform = new Xoops\Form\ThemeForm(_AM_PUBLISHER_IMPORT_SELECTION, "op", xoops_getenv('PHP_SELF'));
     $sform->setExtra('enctype="multipart/form-data"');
     // Partners to import
     $importfile_select = new Xoops\Form\Select('', 'importfile', $importfile);
     $importfile_select->addOptionArray($importfile_select_array);
     $importfile_tray = new Xoops\Form\ElementTray(_AM_PUBLISHER_IMPORT_SELECT_FILE, '&nbsp;');
     $importfile_tray->addElement($importfile_select);
     $importfile_tray->setDescription(_AM_PUBLISHER_IMPORT_SELECT_FILE_DSC);
     $sform->addElement($importfile_tray);
     // Buttons
     $button_tray = new Xoops\Form\ElementTray('', '');
     $hidden = new Xoops\Form\Hidden('op', 'importExecute');
     $button_tray->addElement($hidden);
     $butt_import = new Xoops\Form\Button('', '', _AM_PUBLISHER_IMPORT, 'submit');
     $butt_import->setExtra('onclick="this.form.elements.op.value=\'importExecute\'"');
     $button_tray->addElement($butt_import);
     $butt_cancel = new Xoops\Form\Button('', '', _AM_PUBLISHER_CANCEL, 'button');
     $butt_cancel->setExtra('onclick="history.go(-1)"');
     $button_tray->addElement($butt_cancel);
     $sform->addElement($button_tray);
     /*$sform->addElement(new Xoops\Form\Hidden('xfs_version', $xfs_version));
       $sform->addElement(new Xoops\Form\Hidden('wfs_version', $wfs_version));*/
     $sform->addElement(new Xoops\Form\Hidden('news_version', $news_version));
     $sform->addElement(new Xoops\Form\Hidden('smartsection_version', $smartsection_version));
     $sform->display();
     unset($hidden);