예제 #1
0
 /**
  * Constructor
  * @param	icms_ipf_Object	$object	target object
  * @param	string			$key	the key
  */
 public function __construct($object, $key)
 {
     parent::__construct($object->vars[$key]['form_caption'], " ");
     $urllinkObj = $object->getUrlLinkObj($key);
     $module_handler = icms::handler("icms_module");
     $module = $module_handler->getByDirname($object->handler->_moduleName);
     $this->addElement(new icms_form_elements_Label("", _CO_ICMS_URLLINK_URL));
     $this->addElement(new icms_ipf_form_elements_Text($urllinkObj, "url_" . $key));
     $this->addElement(new icms_form_elements_Label("", "<br/>" . _CO_ICMS_CAPTION));
     $this->addElement(new icms_ipf_form_elements_Text($urllinkObj, "caption_" . $key));
     $this->addElement(new icms_form_elements_Label("", "<br/>" . _CO_ICMS_DESC));
     $this->addElement(new icms_ipf_form_elements_Text($urllinkObj, "desc_" . $key));
     $this->addElement(new icms_form_elements_Label("", "<br/>" . _CO_ICMS_URLLINK_TARGET));
     $this->addElement(new icms_form_elements_Hidden("mid_" . $key, $module->getVar("mid")));
     $targ_val = $urllinkObj->getVar("target");
     $targetRadio = new icms_form_elements_Radio("", "target_" . $key, $targ_val != "" ? $targ_val : "_blank");
     $control = $urllinkObj->getControl("target");
     $targetRadio->addOptionArray($control["options"]);
     $this->addElement($targetRadio);
 }
예제 #2
0
 /**
  * Constructor
  * @param	object    $object   reference to targetobject (@link icms_ipf_Object)
  * @param	string    $key      the form name
  */
 public function __construct($object, $key)
 {
     $var = $object->vars[$key];
     $control = $object->getControl($key);
     if (isset($control['delimeter'])) {
         $this->_delimeter = $control['delimeter'];
     }
     parent::__construct($var['form_caption'], $key, $object->getVar($key, 'e'), $this->_delimeter);
     // Adding the options inside this Radio element
     // If the custom method is not from a module, than it's from the core
     if (isset($control['options'])) {
         $this->addOptionArray($control['options']);
     } else {
         // let's find out if the method we need to call comes from an already defined object
         if (isset($control['object'])) {
             if (method_exists($control['object'], $control['method'])) {
                 if ($option_array = $control['object']->{$control}['method']()) {
                     // Adding the options array to the Radio element
                     $this->addOptionArray($option_array);
                 }
             }
         } else {
             // finding the itemHandler; if none, let's take the itemHandler of the $object
             if (isset($control['itemHandler'])) {
                 if (!$control['module']) {
                     // Creating the specified core object handler
                     $control_handler = icms::handler($control['itemHandler']);
                 } else {
                     $control_handler =& icms_getModuleHandler($control['itemHandler'], $control['module']);
                 }
             } else {
                 $control_handler =& $object->handler;
             }
             // Checking if the specified method exists
             if (method_exists($control_handler, $control['method'])) {
                 // TODO : How could I pass the parameters in the following call ...
                 if ($option_array = $control_handler->{$control}['method']()) {
                     // Adding the options array to the Radio element
                     $this->addOptionArray($option_array);
                 }
             }
         }
     }
 }
예제 #3
0
/**
 * index for the image manager
 * @return  string    the fetched and constructed template
 */
function imanager_index($imgcat_id = NULL) {
	global $icmsTpl, $icmsConfig, $target, $type;

	if (!is_object(icms::$user)) {
		$groups = array(XOOPS_GROUP_ANONYMOUS);
		$admin = FALSE;
	} else {
		$groups =& icms::$user->getGroups();
		$admin = (!icms::$user->isAdmin(1)) ? FALSE : TRUE;
	}

	$imgcat_handler = icms::handler('icms_image_category');

	$criteriaRead = new icms_db_criteria_Compo();
	if (is_array($groups) && !empty($groups)) {
		$criteriaTray = new icms_db_criteria_Compo();
		foreach ($groups as $gid) {
			$criteriaTray->add(new icms_db_criteria_Item('gperm_groupid', $gid), 'OR');
		}
		$criteriaRead->add($criteriaTray);
		$criteriaRead->add(new icms_db_criteria_Item('gperm_name', 'imgcat_read'));
		$criteriaRead->add(new icms_db_criteria_Item('gperm_modid', 1));
	}
	$criteriaRead->add(new icms_db_criteria_Item('imgcat_display', 1));
	$id = (!is_null($imgcat_id) ? $imgcat_id : 0);
	$criteriaRead->add(new icms_db_criteria_Item('imgcat_pid', $id));
	$imagecategorys =& $imgcat_handler->getObjects($criteriaRead);
	$criteriaWrite = new icms_db_criteria_Compo();
	if (is_array($groups) && !empty($groups)) {
		$criteriaWrite->add($criteriaTray);
		$criteriaWrite->add(new icms_db_criteria_Item('gperm_name', 'imgcat_write'));
		$criteriaWrite->add(new icms_db_criteria_Item('gperm_modid', 1));
	}
	$criteriaWrite->add(new icms_db_criteria_Item('imgcat_display', 1));
	$criteriaWrite->add(new icms_db_criteria_Item('imgcat_pid', $id));
	$imagecategorysWrite =& $imgcat_handler->getObjects($criteriaWrite);

	$icmsTpl->assign('lang_imanager_title', _IMGMANAGER);
	$icmsTpl->assign('lang_imanager_catid', _MD_IMAGECATID);
	$icmsTpl->assign('lang_imanager_catname', _MD_IMAGECATNAME);
	$icmsTpl->assign('lang_imanager_catmsize', _MD_IMAGECATMSIZE);
	$icmsTpl->assign('lang_imanager_catmwidth', _MD_IMAGECATMWIDTH);
	$icmsTpl->assign('lang_imanager_catmheight', _MD_IMAGECATMHEIGHT);
	$icmsTpl->assign('lang_imanager_catstype', _MD_IMAGECATSTYPE);
	$icmsTpl->assign('lang_imanager_catdisp', _MD_IMAGECATDISP);
	$icmsTpl->assign('lang_imanager_catautoresize', _MD_IMAGECATATUORESIZE);
	$icmsTpl->assign('lang_imanager_catweight', _MD_IMAGECATWEIGHT);
	$icmsTpl->assign('lang_imanager_catsubs', _MD_IMAGECATSUBS);
	$icmsTpl->assign('lang_imanager_catqtde', _MD_IMAGECATQTDE);
	$icmsTpl->assign('lang_imanager_catoptions', _MD_IMAGECATOPTIONS);

	$icmsTpl->assign('lang_imanager_cat_edit', _EDIT);
	$icmsTpl->assign('lang_imanager_cat_del', _DELETE);
	$icmsTpl->assign('lang_imanager_cat_listimg', _LIST);
	$icmsTpl->assign('lang_imanager_cat_submit', _SUBMIT);

	$icmsTpl->assign('lang_imanager_cat_addnewcat', _MD_ADDIMGCATBTN);
	$icmsTpl->assign('lang_imanager_cat_addnewimg', _MD_ADDIMGBTN);

	$icmsTpl->assign('token', icms::$security->getTokenHTML());
	$icmsTpl->assign('catcount', count($imagecategorys));
	$icmsTpl->assign('writecatcount', count($imagecategorysWrite));
	$icmsTpl->assign('target', $target);
	$icmsTpl->assign('type', $type);
	$icmsTpl->assign('isAdmin', $admin);

	$icmsTpl->assign('imagecategorys', $imagecategorys);
	$icmsTpl->assign('admnav', adminNav($imgcat_id));

	$image_handler = icms::handler('icms_image');
	$count = $msize = $subs = array();
	$icmsTpl->assign('catcount', $catcount = count($imagecategorys));
	for ($i = 0; $i < $catcount; $i++) {
		$msize[$i] = icms_convert_size($imagecategorys[$i]->getVar('imgcat_maxsize'));
		$count[$i] = $image_handler->getCount(new icms_db_criteria_Item('imgcat_id', $imagecategorys[$i]->getVar('imgcat_id')));
		$criteriaRead = new icms_db_criteria_Compo();
		if (is_array($groups) && !empty($groups)) {
			$criteriaTray = new icms_db_criteria_Compo();
			foreach ($groups as $gid) {
				$criteriaTray->add(new icms_db_criteria_Item('gperm_groupid', $gid), 'OR');
			}
			$criteriaRead->add($criteriaTray);
			$criteriaRead->add(new icms_db_criteria_Item('gperm_name', 'imgcat_read'));
			$criteriaRead->add(new icms_db_criteria_Item('gperm_modid', 1));
		}
		$id = (!is_null($imgcat_id) ? $imgcat_id : 0);
		$criteriaRead->add(new icms_db_criteria_Item('imgcat_pid', $imagecategorys[$i]->getVar('imgcat_id')));
		$subs[$i]  = count($imgcat_handler->getObjects($criteriaRead));
	}
	$scount = array();
	foreach ($subs as $k=>$v) {
		$criteriaRead = new icms_db_criteria_Compo();
		if (is_array($groups) && !empty($groups)) {
			$criteriaTray = new icms_db_criteria_Compo();
			foreach ($groups as $gid) {
				$criteriaTray->add(new icms_db_criteria_Item('gperm_groupid', $gid), 'OR');
			}
			$criteriaRead->add($criteriaTray);
			$criteriaRead->add(new icms_db_criteria_Item('gperm_name', 'imgcat_read'));
			$criteriaRead->add(new icms_db_criteria_Item('gperm_modid', 1));
		}
		$id = (!is_null($imgcat_id) ? $imgcat_id : 0);
		$criteriaRead->add(new icms_db_criteria_Item('imgcat_pid', $imagecategorys[$k]->getVar('imgcat_id')));
		$ssubs = $imgcat_handler->getObjects($criteriaRead);
		$sc = 0;
		foreach ($ssubs as $id=>$va) {
			$sc += $image_handler->getCount(new icms_db_criteria_Item('imgcat_id', $va->getVar('imgcat_id')));
		}
		$scount[$k] = $sc;
	}
	$icmsTpl->assign('msize', $msize);
	$icmsTpl->assign('count', $count);
	$icmsTpl->assign('subs', $subs);
	$icmsTpl->assign('scount', $scount);

	if (!empty($catcount)) {
		$form = new icms_form_Theme(_ADDIMAGE, 'image_form', 'browser.php', 'post', TRUE);
		$form->setExtra('enctype="multipart/form-data"');
		$form->addElement(new icms_form_elements_Text(_IMAGENAME, 'image_nicename', 50, 255), TRUE);
		$select = new icms_form_elements_Select(_IMAGECAT, 'imgcat_id');
		$select->addOptionArray($imgcat_handler->getCategList($groups, 'imgcat_write'));
		$form->addElement($select, TRUE);
		$form->addElement(new icms_form_elements_File(_IMAGEFILE, 'image_file', 5000000));
		$form->addElement(new icms_form_elements_Text(_IMGWEIGHT, 'image_weight', 3, 4, 0));
		$form->addElement(new icms_form_elements_Radioyn(_IMGDISPLAY, 'image_display', 1, _YES, _NO));
		$form->addElement(new icms_form_elements_Hidden('op', 'addfile'));
		$form->addElement(new icms_form_elements_Hidden('target', $target));
		$form->addElement(new icms_form_elements_Hidden('type', $type));
		$tray = new icms_form_elements_Tray('' , '');
		$tray->addElement(new icms_form_elements_Button('', 'img_button', _SUBMIT, 'submit'));
		$btn = new icms_form_elements_Button('', 'reset', _CANCEL, 'button');
		$btn->setExtra('onclick="document.getElementById(\'addimgform\').style.display = \'none\'; return FALSE;"');
		$tray->addElement($btn);
		$form->addElement($tray);
		$icmsTpl->assign('addimgform', $form->render());
	}
	$form = new icms_form_Theme(_MD_ADDIMGCAT, 'imagecat_form', 'browser.php', 'post', TRUE);
	$list =& $imgcat_handler->getCategList($groups, 'imgcat_write');
	$sup = new icms_form_elements_Select(_MD_IMGCATPARENT, 'imgcat_pid', $id);
	$list[0] = '--------------------';
	ksort($list);
	$sup->addOptionArray($list);
	$form->addElement($sup);
	$form->addElement(new icms_form_elements_Text(_MD_IMGCATNAME, 'imgcat_name', 50, 255), TRUE);
	$form->addElement(new icms_form_elements_select_Group(_MD_IMGCATRGRP, 'readgroup', TRUE, XOOPS_GROUP_ADMIN, 5, TRUE));
	$form->addElement(new icms_form_elements_select_Group(_MD_IMGCATWGRP, 'writegroup', TRUE, XOOPS_GROUP_ADMIN, 5, TRUE));
	$form->addElement(new icms_form_elements_Text(_IMGMAXSIZE, 'imgcat_maxsize', 10, 10, 50000));
	$form->addElement(new icms_form_elements_Text(_IMGMAXWIDTH, 'imgcat_maxwidth', 3, 4, 120));
	$form->addElement(new icms_form_elements_Text(_IMGMAXHEIGHT, 'imgcat_maxheight', 3, 4, 120));
	$form->addElement(new icms_form_elements_Text(_MD_IMGCATWEIGHT, 'imgcat_weight', 3, 4, 0));
	$form->addElement(new icms_form_elements_Radioyn(_MD_IMGCATDISPLAY, 'imgcat_display', 1, _YES, _NO));
	$storetype = new icms_form_elements_Radio(_MD_IMGCATSTRTYPE, 'imgcat_storetype', 'file');
	$storetype->setDescription('<span style="color:#ff0000;">' . _MD_STRTYOPENG . '</span>');
	$storetype->addOptionArray(array('file' => sprintf(_MD_ASFILE, str_ireplace(ICMS_ROOT_PATH, "", ICMS_IMANAGER_FOLDER_PATH) . '/foldername'), 'db' => _MD_INDB));
	$storetype->setExtra('onchange="actField(this.value, \'imgcat_foldername\');"');
	$form->addElement($storetype);
	$fname = new icms_form_elements_Text(_MD_IMGCATFOLDERNAME, 'imgcat_foldername', 50, 255, '');
	$fname->setDescription('<span style="color:#ff0000;">' . _MD_IMGCATFOLDERNAME_DESC . '<br />' . _MD_STRTYOPENG . '</span>');
	$form->addElement($fname, TRUE);
	$form->addElement(new icms_form_elements_Hidden('op', 'addcat'));
	$form->addElement(new icms_form_elements_Hidden('target', $target));
	$form->addElement(new icms_form_elements_Hidden('type', $type));
	$tray1 = new icms_form_elements_Tray('' , '');
	$tray1->addElement(new icms_form_elements_Button('', 'imgcat_button', _SUBMIT, 'submit'));
	$btn = new icms_form_elements_Button('', 'reset', _CANCEL, 'button');
	$btn->setExtra('onclick="document.getElementById(\'addcatform\').style.display = \'none\'; return FALSE;"');
	$tray1->addElement($btn);
	$form->addElement($tray1);
	$icmsTpl->assign('addcatform', $form->render());

	return $icmsTpl->fetch(ICMS_MODULES_PATH . '/system/templates/admin/images/system_popup_imagemanager.html');
}
예제 #4
0
 /**
  * Constructor
  *
  * @param	string	$caption
  * @param	string	$name
  * @param	string	$value		Pre-selected value, can be "0" (No) or "1" (Yes)
  * @param	string	$yes		String for "Yes"
  * @param	string	$no			String for "No"
  */
 public function __construct($caption, $name, $value = null, $yes = _YES, $no = _NO)
 {
     parent::__construct($caption, $name, $value);
     $this->addOption(1, '&nbsp;' . $yes . '&nbsp;');
     $this->addOption(0, '&nbsp;' . $no);
 }
예제 #5
0
 /**
  * Returns a {@link icms_form_Element} for editing the value of this field
  *
  * @param icms_member_user_Object $user {@link icms_member_user_Object} object to edit the value of
  * @param mod_profile_Profile $profile {@link mod_profile_Profile} object to edit the value of
  *
  * @return icms_form_Element
  */
 public function getEditElement($user, $profile)
 {
     $value = in_array($this->getVar('field_name'), $this->getUserVars()) ? $user->getVar($this->getVar('field_name'), 'e') : $profile->getVar($this->getVar('field_name'), 'e');
     if ($value === null) {
         $value = $this->getVar('field_default');
     }
     $caption = $this->getVar('field_title');
     $caption = defined($caption) ? constant($caption) : $caption;
     $name = $this->getVar('field_name', 'e');
     $options = unserialize($this->getVar('field_options', 'n'));
     if ($this->getVar('field_type') != "image" && is_array($options)) {
         asort($options);
         foreach (array_keys($options) as $key) {
             $optval = defined($options[$key]) ? constant($options[$key]) : $options[$key];
             $optkey = defined($key) ? constant($key) : $key;
             unset($options[$key]);
             $options[$optkey] = $optval;
         }
     }
     switch ($this->getVar('field_type')) {
         case "autotext":
             $element = new icms_form_elements_Label($caption, $value);
             break;
         case "textarea":
             $element = new icms_form_elements_Textarea($caption, $name, $value, 4, 30);
             break;
         case "dhtml":
             $element = new icms_form_elements_Dhtmltextarea($caption, $name, $value, 10, 30);
             break;
         case "select":
             $element = new icms_form_elements_Select($caption, $name, $value);
             $element->addOptionArray($options);
             break;
         case "select_multi":
             $element = new icms_form_elements_Select($caption, $name, $value, 5, true);
             $element->addOptionArray($options);
             break;
         case "radio":
             $element = new icms_form_elements_Radio($caption, $name, $value);
             $element->addOptionArray($options);
             break;
         case "checkbox":
             $element = new icms_form_elements_Checkbox($caption, $name, $value);
             $element->addOptionArray($options);
             break;
         case "yesno":
             $element = new icms_form_elements_Radioyn($caption, $name, $value);
             break;
         case "group":
             $element = new icms_form_elements_select_Group($caption, $name, true, $value);
             break;
         case "group_multi":
             $element = new icms_form_elements_select_Group($caption, $name, true, $value, 5, true);
             break;
         case "language":
             $element = new icms_form_elements_select_Lang($caption, $name, $value);
             break;
         case "date":
             $element = new icms_form_elements_Date($caption, $name, 15, $value);
             break;
         case "longdate":
             $element = new icms_form_elements_Date($caption, $name, 15, str_replace("-", "/", $value));
             break;
         case "datetime":
             $element = new icms_form_elements_Datetime($caption, $name, 15, $value);
             break;
         case "timezone":
             $element = new icms_form_elements_select_Timezone($caption, $name, $value);
             $element->setExtra("style='width: 280px;'");
             break;
         case "rank":
             $element = new icms_form_elements_Select($caption, $name, $value);
             $ranks = icms_getModuleHandler("userrank", "system")->getList(icms_buildCriteria(array("rank_special" => 1)));
             $element->addOption(0, "--------------");
             $element->addOptionArray($ranks);
             break;
         case "theme":
             $element = new icms_form_elements_Select($caption, $name, $value);
             $element->addOption("0", _MD_PROFILE_SITEDEFAULT);
             $handle = opendir(ICMS_THEME_PATH . '/');
             $dirlist = array();
             while (false !== ($file = readdir($handle))) {
                 if (is_dir(ICMS_THEME_PATH . '/' . $file) && !preg_match("/^[.]{1,2}\$/", $file) && strtolower($file) != 'cvs') {
                     if (file_exists(ICMS_THEME_PATH . '/' . $file . '/theme.html') && in_array($file, $GLOBALS['icmsConfig']['theme_set_allowed'])) {
                         $dirlist[$file] = $file;
                     }
                 }
             }
             closedir($handle);
             if (!empty($dirlist)) {
                 asort($dirlist);
                 $element->addOptionArray($dirlist);
             }
             break;
         case "image":
             $element = new icms_form_elements_File($caption, $name, $options['maxsize'] * 1024);
             if ($value != "") {
                 $this->assignVar('field_description', "");
                 $element->setDescription($this->getOutputValue($user, $profile));
             }
             break;
         case "openid":
             if ($icmsConfigAuth['auth_openid'] != 1) {
                 break;
             }
             $element = new icms_form_elements_Text($caption, $name, 35, $this->getVar('field_maxlength'), $value);
             break;
         case "textbox":
         default:
             $element = new icms_form_elements_Text($caption, $name, 35, $this->getVar('field_maxlength'), $value);
             break;
     }
     if ($this->getVar('field_description') != '') {
         $element->setDescription($this->getVar('field_description'));
     }
     return $element;
 }
예제 #6
0
 * @copyright	http://www.impresscms.org/ The ImpressCMS Project
 * @license	LICENSE.txt
 * @package		Administration
 * @subpackage	Comments
 * @since	XOOPS
 * @author	http://www.xoops.org The XOOPS Project
 * @author	modified by UnderDog <*****@*****.**>
 * @version		SVN: $Id: commentform.inc.php 20768 2011-02-06 00:02:25Z skenow $
 */
defined("ICMS_ROOT_PATH") || die("ImpressCMS root path not defined");
$cform = new icms_form_Theme(_CM_POSTCOMMENT, "commentform", "postcomment.php", "post", true);
if (!preg_match("/^re:/i", $subject)) {
    $subject = "Re: " . icms_core_DataFilter::icms_substr($subject, 0, 56);
}
$cform->addElement(new icms_form_elements_Text(_CM_TITLE, 'subject', 50, 255, $subject), true);
$icons_radio = new icms_form_elements_Radio(_MESSAGEICON, 'icon', $icon);
$subject_icons = icms_core_Filesystem::getFileList(ICMS_ROOT_PATH . "/images/subject/", '', array('gif', 'jpg', 'png'));
foreach ($subject_icons as $iconfile) {
    $icons_radio->addOption($iconfile, '<img src="' . ICMS_IMAGES_URL . '/subject/' . $iconfile . '" alt="" />');
}
$cform->addElement($icons_radio);
$cform->addElement(new icms_form_elements_Dhtmltextarea(_CM_MESSAGE, 'message', $message, 10, 50), true);
$option_tray = new icms_form_elements_Tray(_OPTIONS, '<br />');
if (icms::$user) {
    if ($icmsConfig['anonpost'] == true) {
        $noname_checkbox = new icms_form_elements_Checkbox('', 'noname', $noname);
        $noname_checkbox->addOption(1, _POSTANON);
        $option_tray->addElement($noname_checkbox);
    }
    if (icms::$user->isAdmin($icmsModule->getVar('mid'))) {
        $nohtml_checkbox = new icms_form_elements_Checkbox('', 'nohtml', $nohtml);
예제 #7
0
 $occupation_text = new icms_form_elements_Text(_MA_USER_OCCUPATION, "user_occ", 30, 100, @$_POST["user_occ"]);
 $interest_text = new icms_form_elements_Text(_MA_USER_INTEREST, "user_intrest", 30, 100, @$_POST["user_intrest"]);
 foreach ($items_range as $var => $title) {
     $more = new icms_form_elements_Text("", "{$var}_more", 10, 5, @$_POST["{$var}_more"]);
     $less = new icms_form_elements_Text("", "{$var}_less", 10, 5, @$_POST["{$var}_less"]);
     $range_tray = new icms_form_elements_Tray($title, "&nbsp;-&nbsp;&nbsp;");
     $range_tray->addElement($less);
     $range_tray->addElement($more);
     $form->addElement($range_tray);
     unset($more, $less, $range_tray);
 }
 $mailok_radio = new icms_form_elements_Radio(_MA_USER_SHOWMAILOK, "user_mailok", empty($_POST["user_mailok"]) ? "both" : $_POST["user_mailok"]);
 $mailok_radio->addOptionArray(array("mailok" => _MA_USER_MAILOK, "mailng" => _MA_USER_MAILNG, "both" => _MA_USER_BOTH));
 $avatar_radio = new icms_form_elements_Radio(_MA_USER_HASAVATAR, "user_avatar", empty($_POST["user_avatar"]) ? "both" : $_POST["user_avatar"]);
 $avatar_radio->addOptionArray(array("y" => _YES, "n" => _NO, "both" => _MA_USER_BOTH));
 $level_radio = new icms_form_elements_Radio(_MA_USER_LEVEL, "level", @$_POST["level"]);
 $levels = array(0 => _ALL, 1 => _MA_USER_LEVEL_ACTIVE, 2 => _MA_USER_LEVEL_INACTIVE, 3 => _MA_USER_LEVEL_DISABLED);
 $level_radio->addOptionArray($levels);
 $member_handler = icms::handler('icms_member');
 $groups = $member_handler->getGroupList();
 $groups[0] = _ALL;
 $group_select = new icms_form_elements_Select(_MA_USER_GROUP, 'groups', @$_POST['groups'], 3, true);
 $group_select->addOptionArray($groups);
 $ranks = $rank_handler->getList();
 $ranks[0] = _ALL;
 $rank_select = new icms_form_elements_Select(_MA_USER_RANK, 'rank', (int) @$_POST['rank']);
 $rank_select->addOptionArray($ranks);
 $form->addElement($url_text);
 $form->addElement($location_text);
 $form->addElement($occupation_text);
 $form->addElement($interest_text);
예제 #8
0
 public function __construct($caption, $name, $value = null, $delimeter = "")
 {
     parent::__construct($caption, $name, $value, $delimeter);
     $this->_deprecated = icms_core_Debug::setDeprecated('icms_form_elements_Radio', sprintf(_CORE_REMOVE_IN_VERSION, '1.4'));
 }
예제 #9
0
/**
* Get {@link icms_form_Theme} for editing a user
*
* @param object $user {@link icms_member_user_Object} to edit
*
* @return object
*/
function getUserForm(&$user, $profile = false, $action = false)
{
    global $icmsConfig, $icmsConfigUser, $icmsConfigAuth;
    if ($action === false) {
        $action = $_SERVER['REQUEST_URI'];
    }
    $title = $user->isNew() ? _AM_PROFILE_ADDUSER : _MD_PROFILE_EDITPROFILE;
    icms_loadLanguageFile('core', 'user');
    $form = new icms_form_Theme($title, 'userinfo', $action, 'post', true);
    $profile_handler = icms_getModuleHandler('profile', basename(dirname(dirname(__FILE__))), 'profile');
    // Dynamic fields
    if (!$profile) {
        $profile_handler = icms_getModuleHandler('profile', basename(dirname(dirname(__FILE__))), 'profile');
        $profile = $profile_handler->get($user->getVar('uid'));
    }
    // Get fields
    $fields = $profile_handler->loadFields();
    // Get ids of fields that can be edited
    $gperm_handler = icms::handler('icms_member_groupperm');
    $editable_fields = $gperm_handler->getItemIds('profile_edit', icms::$user->getGroups(), icms::$module->getVar('mid'));
    $email_tray = new icms_form_elements_Tray(_MD_PROFILE_EMAIL, '<br />');
    if ($user->isNew() || icms::$user->isAdmin()) {
        $elements[0][] = array('element' => new icms_form_elements_Text(_US_LOGIN_NAME, 'login_name', 25, 75, $user->getVar('login_name', 'e')), 'required' => 1);
        $weights[0][] = 0;
        $elements[0][] = array('element' => new icms_form_elements_Text(_US_NICKNAME, 'uname', 25, 75, $user->getVar('uname', 'e')), 'required' => 1);
        $weights[0][] = 0;
        $elements[0][] = array('element' => new icms_form_elements_Text(_MD_PROFILE_EMAIL, 'email', 30, 60, $user->getVar('email')), 'required' => 1);
        $weights[0][] = 0;
    } else {
        $elements[0][] = array('element' => new icms_form_elements_Label(_US_LOGIN_NAME, $user->getVar('login_name', 'e')), 'required' => 0);
        $weights[0][] = 0;
        if ($icmsConfigUser['allow_chguname'] == 1) {
            $elements[0][] = array('element' => new icms_form_elements_Text(_US_NICKNAME, 'uname', 25, 75, $user->getVar('uname', 'e')), 'required' => 1);
        } else {
            $elements[0][] = array('element' => new icms_form_elements_Label(_US_NICKNAME, $user->getVar('uname')), 'required' => 0);
        }
        $weights[0][] = 0;
        $elements[0][] = array('element' => new icms_form_elements_Label(_MD_PROFILE_EMAIL, $user->getVar('email')), 'required' => 0);
        $weights[0][] = 0;
    }
    if ($icmsConfigAuth['auth_openid'] == 1) {
        $openid_tray = new icms_form_elements_Tray(_MD_PROFILE_OPENID, '<br />');
        $openid_tray->addElement(new icms_form_elements_Text('', 'openid', 30, 255, $user->getVar('openid')));
        $openid_checkbox = new icms_form_elements_Checkbox('', 'user_viewoid', $user->getVar('user_viewoid'));
        $openid_checkbox->addOption('1', _MD_PROFILE_OPENID_VIEW);
        $openid_tray->addElement($openid_checkbox);
        $elements[0][] = array('element' => $openid_tray, 'required' => 0);
        $weights[0][] = 0;
    }
    if (icms::$user->isAdmin() && $user->getVar('uid') != icms::$user->getVar('uid') or $user->getVar('uid') == icms::$user->getVar('uid')) {
        // ALTERED BY FREEFORM SOLUTIONS TO ALLOW USERS TO CHANGE THEIR OWN PASSWORDS
        //If the user is an admin and is editing someone else
        $pwd_text = new icms_form_elements_Password('', 'password', 10, 32, "", false, $icmsConfigUser['pass_level'] ? 'password_adv' : '');
        $pwd_text2 = new icms_form_elements_Password('', 'vpass', 10, 32);
        $pwd_tray = new icms_form_elements_Tray(_MD_PROFILE_PASSWORD . '<br />' . _MD_PROFILE_TYPEPASSTWICE);
        $pwd_tray->addElement($pwd_text, $user->isNew());
        $pwd_tray->addElement($pwd_text2, $user->isNew());
        $elements[0][] = array('element' => $pwd_tray, 'required' => 1);
        //cannot set an element tray required
        $weights[0][] = 0;
        if (icms::$user->isAdmin() && $user->getVar('uid') != icms::$user->getVar('uid')) {
            // ALTERED BY FREEFORM SOLUTIONS SO THAT USERS CAN'T ALTER THEIR OWN LEVEL
            $level_radio = new icms_form_elements_Radio(_MD_PROFILE_ACTIVEUSER, 'level', $user->getVar('level'));
            $level_radio->addOption(1, _MD_PROFILE_ACTIVE);
            $level_radio->addOption(0, _MD_PROFILE_INACTIVE);
            $level_radio->addOption(-1, _MD_PROFILE_DISABLED);
            $elements[0][] = array('element' => $level_radio, 'required' => 0);
            $weights[0][] = 0;
        }
    }
    $elements[0][] = array('element' => new icms_form_elements_Hidden('uid', $user->getVar('uid')), 'required' => 0);
    $weights[0][] = 0;
    $elements[0][] = array('element' => new icms_form_elements_Hidden('op', 'save'), 'required' => 0);
    $weights[0][] = 0;
    $profile_cat_handler = icms_getmodulehandler('category', basename(dirname(dirname(__FILE__))), 'profile');
    $categories = $profile_cat_handler->getObjects(null, true, false);
    foreach (array_keys($fields) as $i) {
        if (in_array($fields[$i]->getVar('fieldid'), $editable_fields)) {
            if ($fields[$i]->getVar('field_edit') == 1) {
                $fieldinfo['element'] = $fields[$i]->getEditElement($user, $profile);
                $fieldinfo['required'] = $fields[$i]->getVar('field_required');
                $key = $fields[$i]->getVar('catid');
                $elements[$key][] = $fieldinfo;
                $weights[$key][] = $fields[$i]->getVar('field_weight');
                // Image upload
                if ($fields[$i]->getVar('field_type') == "image") {
                    $form->setExtra('enctype="multipart/form-data"');
                }
            }
        }
    }
    if (icms::$user && icms::$user->isAdmin()) {
        icms_loadLanguageFile(basename(dirname(dirname(__FILE__))), 'admin');
        //If user has admin rights on groups
        include_once ICMS_ROOT_PATH . "/modules/system/constants.php";
        if ($gperm_handler->checkRight("system_admin", XOOPS_SYSTEM_GROUP, icms::$user->getGroups(), 1)) {
            //add group selection
            $group_select = new icms_form_elements_select_Group(_AM_PROFILE_GROUP, 'groups', false, $user->getGroups(), 15, true);
            // UPDATED BY FREEFORM SOLUTIONS - MAKE LIST TALLER
            $elements[0][] = array('element' => $group_select, 'required' => 0);
            $weights[0][] = 15000;
        }
    }
    ksort($elements);
    foreach (array_keys($elements) as $k) {
        array_multisort($weights[$k], SORT_ASC, array_keys($elements[$k]), SORT_ASC, $elements[$k]);
        $title = isset($categories[$k]) ? $categories[$k]['cat_title'] : _MD_PROFILE_DEFAULT;
        $desc = isset($categories[$k]) ? $categories[$k]['cat_description'] : "";
        $form->addElement(new icms_form_elements_Label($title, $desc), false);
        foreach (array_keys($elements[$k]) as $i) {
            $form->addElement($elements[$k][$i]['element'], $elements[$k][$i]['required']);
        }
    }
    $form->addElement(new icms_form_elements_Button('', 'submit', _MD_PROFILE_SAVECHANGES, 'submit'));
    return $form;
}
예제 #10
0
파일: main.php 프로젝트: nao-pon/impresscms
	$msnm_tray->addElement($msnm_match);
	$msnm_tray->addElement($msnm_text);
	$location_text = new icms_form_elements_Text(_AM_LOCATION, "user_from", 30, 100);
	$occupation_text = new icms_form_elements_Text(_AM_OCCUPATION, "user_occ", 30, 100);
	$interest_text = new icms_form_elements_Text(_AM_INTEREST, "user_intrest", 30, 100);

	//$bio_text = new icms_form_elements_Text(_AM_EXTRAINFO, "user_bio", 30, 100);
	$lastlog_more = new icms_form_elements_Text(_AM_LASTLOGMORE, "user_lastlog_more", 10, 5);
	$lastlog_less = new icms_form_elements_Text(_AM_LASTLOGLESS, "user_lastlog_less", 10, 5);
	$reg_more = new icms_form_elements_Text(_AM_REGMORE, "user_reg_more", 10, 5);
	$reg_less = new icms_form_elements_Text(_AM_REGLESS, "user_reg_less", 10, 5);
	$posts_more = new icms_form_elements_Text(_AM_POSTSMORE, "user_posts_more", 10, 5);
	$posts_less = new icms_form_elements_Text(_AM_POSTSLESS, "user_posts_less", 10, 5);
	$mailok_radio = new icms_form_elements_Radio(_AM_SHOWMAILOK, "user_mailok", "both");
	$mailok_radio->addOptionArray(array("mailok"=>_AM_MAILOK, "mailng"=>_AM_MAILNG, "both"=>_AM_BOTH));
	$type_radio = new icms_form_elements_Radio(_AM_SHOWTYPE, "user_type", "actv");
	$type_radio->addOptionArray(array("actv"=>_AM_ACTIVE, "inactv"=>_AM_INACTIVE, "both"=>_AM_BOTH));
	$sort_select = new icms_form_elements_Select(_AM_SORT, "user_sort");
	$sort_select->addOptionArray(array("uname"=>_AM_UNAME, "login_name"=>_AM_LOGINNAME, "email"=>_AM_EMAIL, "last_login"=>_AM_LASTLOGIN, "user_regdate"=>_AM_REGDATE, "posts"=>_AM_POSTS));
	$order_select = new icms_form_elements_Select(_AM_ORDER, "user_order");
	$order_select->addOptionArray(array("ASC"=>_AM_ASC, "DESC"=>_AM_DESC));
	$limit_text = new icms_form_elements_Text(_AM_LIMIT, "limit", 6, 2);
	$fct_hidden = new icms_form_elements_Hidden("fct", "findusers");
	$op_hidden = new icms_form_elements_Hidden("op", "submit");
	$submit_button = new icms_form_elements_Button("", "user_submit", _SUBMIT, "submit");

	$form = new icms_form_Theme(_AM_FINDUS, "uesr_findform", "admin.php", 'post', TRUE);
	$form->addElement($uname_tray);
	$form->addElement($name_tray);
	$form->addElement($login_name_tray);
	$form->addElement($email_tray);