Пример #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
/**
 * 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');
}
Пример #3
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;
 }
Пример #4
0
 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);
 $form->addElement($mailok_radio);
 $form->addElement($avatar_radio);
Пример #5
0
	$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);
	$form->addElement($group_select);