[xoops-cvslog 2753] CVS update: xoops2jp/html/modules/user/admin/forms

Back to archive index

Minahito minah****@users*****
2006年 4月 11日 (火) 18:16:37 JST


Index: xoops2jp/html/modules/user/admin/forms/UserSearchForm.class.php
diff -u /dev/null xoops2jp/html/modules/user/admin/forms/UserSearchForm.class.php:1.1.2.1
--- /dev/null	Tue Apr 11 18:16:37 2006
+++ xoops2jp/html/modules/user/admin/forms/UserSearchForm.class.php	Tue Apr 11 18:16:37 2006
@@ -0,0 +1,146 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_ROOT_PATH . "/class/XCube_ActionForm.class.php";
+require_once XOOPS_MODULE_PATH . "/base/class/Legacy_Validator.class.php";
+
+class User_UserSearchForm extends XCube_ActionForm
+{
+	function prepare()
+	{
+		//
+		// Set form properties
+		//
+		$this->mFormProperties['uname'] =& new XCube_StringProperty('uname');
+		$this->mFormProperties['name'] =& new XCube_StringProperty('name');
+		$this->mFormProperties['email'] =& new XCube_StringProperty('email');
+		$this->mFormProperties['user_icq'] =& new XCube_StringProperty('user_icq');
+		$this->mFormProperties['user_aim'] =& new XCube_StringProperty('user_aim');
+		$this->mFormProperties['user_yim'] =& new XCube_StringProperty('user_yim');
+		$this->mFormProperties['user_msnm'] =& new XCube_StringProperty('user_msnm');
+		$this->mFormProperties['url'] =& new XCube_StringProperty('url');
+		$this->mFormProperties['user_from'] =& new XCube_StringProperty('user_from');
+		$this->mFormProperties['user_occ'] =& new XCube_StringProperty('user_occ');
+		$this->mFormProperties['user_intrest'] =& new XCube_StringProperty('user_intrest');
+		$this->mFormProperties['lastlog_more'] =& new XCube_IntProperty('lastlog_more');
+		$this->mFormProperties['lastlog_less'] =& new XCube_IntProperty('lastlog_less');
+		$this->mFormProperties['regdate_more'] =& new XCube_IntProperty('regdate_more');
+		$this->mFormProperties['regdate_less'] =& new XCube_IntProperty('regdate_less');
+		$this->mFormProperties['over_posts'] =& new XCube_IntProperty('over_posts');
+		$this->mFormProperties['under_posts'] =& new XCube_IntProperty('under_posts');
+		$this->mFormProperties['mail_condition'] =& new XCube_IntProperty('mail_condition');
+		$this->mFormProperties['user_level'] =& new XCube_IntProperty('user_level');
+	
+		//
+		// Set field properties
+		//
+	
+		$this->mFieldProperties['uname'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['uname']->setDependsByArray(array('maxlength'));
+		$this->mFieldProperties['uname']->addMessage('maxlength', _AD_USER_ERROR_MAXLENGTH, _AD_USER_LANG_UNAME, '25');
+		$this->mFieldProperties['uname']->addVar('maxlength', '25');
+	
+		$this->mFieldProperties['name'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['name']->setDependsByArray(array('maxlength'));
+		$this->mFieldProperties['name']->addMessage('maxlength', _AD_USER_ERROR_MAXLENGTH, _AD_USER_LANG_NAME, '60');
+		$this->mFieldProperties['name']->addVar('maxlength', '60');
+	
+		$this->mFieldProperties['email'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['email']->setDependsByArray(array('maxlength'));
+		$this->mFieldProperties['email']->addMessage('maxlength', _AD_USER_ERROR_MAXLENGTH, _AD_USER_LANG_EMAIL, '60');
+		$this->mFieldProperties['email']->addVar('maxlength', '60');
+	
+		$this->mFieldProperties['user_icq'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['user_icq']->setDependsByArray(array('maxlength'));
+		$this->mFieldProperties['user_icq']->addMessage('maxlength', _AD_USER_ERROR_MAXLENGTH, _AD_USER_LANG_USER_ICQ, '15');
+		$this->mFieldProperties['user_icq']->addVar('maxlength', '15');
+	
+		$this->mFieldProperties['user_aim'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['user_aim']->setDependsByArray(array('maxlength'));
+		$this->mFieldProperties['user_aim']->addMessage('maxlength', _AD_USER_ERROR_MAXLENGTH, _AD_USER_LANG_USER_AIM, '18');
+		$this->mFieldProperties['user_aim']->addVar('maxlength', '18');
+	
+		$this->mFieldProperties['user_yim'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['user_yim']->setDependsByArray(array('maxlength'));
+		$this->mFieldProperties['user_yim']->addMessage('maxlength', _AD_USER_ERROR_MAXLENGTH, _AD_USER_LANG_USER_YIM, '25');
+		$this->mFieldProperties['user_yim']->addVar('maxlength', '25');
+	
+		$this->mFieldProperties['user_msnm'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['user_msnm']->setDependsByArray(array('maxlength'));
+		$this->mFieldProperties['user_msnm']->addMessage('maxlength', _AD_USER_ERROR_MAXLENGTH, _AD_USER_LANG_USER_MSNM, '100');
+		$this->mFieldProperties['user_msnm']->addVar('maxlength', '100');
+	
+		$this->mFieldProperties['url'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['url']->setDependsByArray(array('maxlength'));
+		$this->mFieldProperties['url']->addMessage('maxlength', _AD_USER_ERROR_MAXLENGTH, _AD_USER_LANG_URL, '100');
+		$this->mFieldProperties['url']->addVar('maxlength', '100');
+	
+		$this->mFieldProperties['user_from'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['user_from']->setDependsByArray(array('maxlength'));
+		$this->mFieldProperties['user_from']->addMessage('maxlength', _AD_USER_ERROR_MAXLENGTH, _AD_USER_LANG_USER_FROM, '100');
+		$this->mFieldProperties['user_from']->addVar('maxlength', '100');
+	
+		$this->mFieldProperties['user_occ'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['user_occ']->setDependsByArray(array('maxlength'));
+		$this->mFieldProperties['user_occ']->addMessage('maxlength', _AD_USER_ERROR_MAXLENGTH, _AD_USER_LANG_USER_OCC, '100');
+		$this->mFieldProperties['user_occ']->addVar('maxlength', '100');
+	
+		$this->mFieldProperties['user_intrest'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['user_intrest']->setDependsByArray(array('maxlength'));
+		$this->mFieldProperties['user_intrest']->addMessage('maxlength', _AD_USER_ERROR_MAXLENGTH, _AD_USER_LANG_USER_INTREST, '150');
+		$this->mFieldProperties['user_intrest']->addVar('maxlength', '150');
+	
+		$this->mFieldProperties['lastlog_more'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['lastlog_more']->setDependsByArray(array('intRange'));
+		$this->mFieldProperties['lastlog_more']->addMessage('intRange', _AD_USER_ERROR_INTRANGE, _AD_USER_LANG_LASTLOG_MORE, '0');
+		$this->mFieldProperties['lastlog_more']->addVar('min', '0');
+		$this->mFieldProperties['lastlog_more']->addVar('max', '65535');
+	
+		$this->mFieldProperties['lastlog_less'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['lastlog_less']->setDependsByArray(array('intRange'));
+		$this->mFieldProperties['lastlog_less']->addMessage('intRange', _AD_USER_ERROR_INTRANGE, _AD_USER_LANG_LASTLOG_LESS, '0');
+		$this->mFieldProperties['lastlog_less']->addVar('min', '0');
+		$this->mFieldProperties['lastlog_less']->addVar('max', '65535');
+	
+		$this->mFieldProperties['regdate_more'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['regdate_more']->setDependsByArray(array('intRange'));
+		$this->mFieldProperties['regdate_more']->addMessage('intRange', _AD_USER_ERROR_INTRANGE, _AD_USER_LANG_REGDATE_MORE, '0');
+		$this->mFieldProperties['regdate_more']->addVar('min', '0');
+		$this->mFieldProperties['regdate_more']->addVar('max', '65535');
+	
+		$this->mFieldProperties['regdate_less'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['regdate_less']->setDependsByArray(array('intRange'));
+		$this->mFieldProperties['regdate_less']->addMessage('intRange', _AD_USER_ERROR_INTRANGE, _AD_USER_LANG_REGDATE_LESS, '0');
+		$this->mFieldProperties['regdate_less']->addVar('min', '0');
+		$this->mFieldProperties['regdate_less']->addVar('max', '65535');
+	
+		$this->mFieldProperties['over_posts'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['over_posts']->setDependsByArray(array('intRange'));
+		$this->mFieldProperties['over_posts']->addMessage('intRange', _AD_USER_ERROR_INTRANGE, _AD_USER_LANG_OVER_POSTS, '0');
+		$this->mFieldProperties['over_posts']->addVar('min', '0');
+		$this->mFieldProperties['over_posts']->addVar('max', '65535');
+	
+		$this->mFieldProperties['under_posts'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['under_posts']->setDependsByArray(array('intRange'));
+		$this->mFieldProperties['under_posts']->addMessage('intRange', _AD_USER_ERROR_INTRANGE, _AD_USER_LANG_UNDER_POSTS, '0');
+		$this->mFieldProperties['under_posts']->addVar('min', '0');
+		$this->mFieldProperties['under_posts']->addVar('max', '65535');
+	
+		$this->mFieldProperties['mail_condition'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['mail_condition']->setDependsByArray(array('required','intRange'));
+		$this->mFieldProperties['mail_condition']->addMessage('required', _AD_USER_ERROR_REQUIRED, _AD_USER_LANG_DISPLAY_USER_MAIL_CONDITION);
+		$this->mFieldProperties['mail_condition']->addMessage('intRange', _AD_USER_ERROR_INTRANGE, _AD_USER_LANG_DISPLAY_USER_MAIL_CONDITION);
+		$this->mFieldProperties['mail_condition']->addVar('min', '1');
+		$this->mFieldProperties['mail_condition']->addVar('max', '3');
+	
+		$this->mFieldProperties['user_level'] =& new XCube_FieldProperty($this);
+		$this->mFieldProperties['user_level']->setDependsByArray(array('required','intRange'));
+		$this->mFieldProperties['user_level']->addMessage('required', _AD_USER_ERROR_REQUIRED, _AD_USER_LANG_DISPLAY_USER_LEVEL);
+		$this->mFieldProperties['user_level']->addMessage('intRange', _AD_USER_ERROR_INTRANGE, _AD_USER_LANG_DISPLAY_USER_LEVEL);
+		$this->mFieldProperties['user_level']->addVar('min', '1');
+		$this->mFieldProperties['user_level']->addVar('max', '3');
+	}
+}
+
+?>
Index: xoops2jp/html/modules/user/admin/forms/UserSearchFilterForm.class.php
diff -u /dev/null xoops2jp/html/modules/user/admin/forms/UserSearchFilterForm.class.php:1.1.2.1
--- /dev/null	Tue Apr 11 18:16:37 2006
+++ xoops2jp/html/modules/user/admin/forms/UserSearchFilterForm.class.php	Tue Apr 11 18:16:37 2006
@@ -0,0 +1,167 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_MODULE_PATH . "/user/class/AbstractFilterForm.class.php";
+require_once XOOPS_MODULE_PATH . "/user/admin/forms/UserSearchForm.class.php";
+
+define('USER_SORT_KEY_UID', 1);
+define('USER_SORT_KEY_NAME', 2);
+define('USER_SORT_KEY_UNAME', 3);
+define('USER_SORT_KEY_EMAIL', 4);
+define('USER_SORT_KEY_URL', 5);
+define('USER_SORT_KEY_USER_AVATAR', 6);
+define('USER_SORT_KEY_USER_REGDATE', 7);
+define('USER_SORT_KEY_USER_ICQ', 8);
+define('USER_SORT_KEY_USER_FROM', 9);
+define('USER_SORT_KEY_USER_SIG', 10);
+define('USER_SORT_KEY_USER_VIEWEMAIL', 11);
+define('USER_SORT_KEY_ACTKEY', 12);
+define('USER_SORT_KEY_USER_AIM', 13);
+define('USER_SORT_KEY_USER_YIM', 14);
+define('USER_SORT_KEY_USER_MSNM', 15);
+define('USER_SORT_KEY_PASS', 16);
+define('USER_SORT_KEY_POSTS', 17);
+define('USER_SORT_KEY_ATTACHSIG', 18);
+define('USER_SORT_KEY_RANK', 19);
+define('USER_SORT_KEY_LEVEL', 20);
+define('USER_SORT_KEY_THEME', 21);
+define('USER_SORT_KEY_TIMEZONE_OFFSET', 22);
+define('USER_SORT_KEY_LAST_LOGIN', 23);
+define('USER_SORT_KEY_UMODE', 24);
+define('USER_SORT_KEY_UORDER', 25);
+define('USER_SORT_KEY_NOTIFY_METHOD', 26);
+define('USER_SORT_KEY_NOTIFY_MODE', 27);
+define('USER_SORT_KEY_USER_OCC', 28);
+define('USER_SORT_KEY_BIO', 29);
+define('USER_SORT_KEY_USER_INTREST', 30);
+define('USER_SORT_KEY_USER_MAILOK', 31);
+define('USER_SORT_KEY_MAXVALUE', 31);
+
+define('USER_SORT_KEY_DEFAULT', USER_SORT_KEY_UID);
+
+class User_UserSearchFilterForm extends User_AbstractFilterForm
+{
+	var $mSort = 0;
+	var $_mSortKeys = array(
+		USER_SORT_KEY_UID => 'uid',
+		USER_SORT_KEY_NAME => 'name',
+		USER_SORT_KEY_UNAME => 'uname',
+		USER_SORT_KEY_EMAIL => 'email',
+		USER_SORT_KEY_URL => 'url',
+		USER_SORT_KEY_USER_AVATAR => 'user_avatar',
+		USER_SORT_KEY_USER_REGDATE => 'user_regdate',
+		USER_SORT_KEY_USER_ICQ => 'user_icq',
+		USER_SORT_KEY_USER_FROM => 'user_from',
+		USER_SORT_KEY_USER_SIG => 'user_sig',
+		USER_SORT_KEY_USER_VIEWEMAIL => 'user_viewemail',
+		USER_SORT_KEY_ACTKEY => 'actkey',
+		USER_SORT_KEY_USER_AIM => 'user_aim',
+		USER_SORT_KEY_USER_YIM => 'user_yim',
+		USER_SORT_KEY_USER_MSNM => 'user_msnm',
+		USER_SORT_KEY_PASS => 'pass',
+		USER_SORT_KEY_POSTS => 'posts',
+		USER_SORT_KEY_ATTACHSIG => 'attachsig',
+		USER_SORT_KEY_RANK => 'rank',
+		USER_SORT_KEY_LEVEL => 'level',
+		USER_SORT_KEY_THEME => 'theme',
+		USER_SORT_KEY_TIMEZONE_OFFSET => 'timezone_offset',
+		USER_SORT_KEY_LAST_LOGIN => 'last_login',
+		USER_SORT_KEY_UMODE => 'umode',
+		USER_SORT_KEY_UORDER => 'uorder',
+		USER_SORT_KEY_NOTIFY_METHOD => 'notify_method',
+		USER_SORT_KEY_NOTIFY_MODE => 'notify_mode',
+		USER_SORT_KEY_USER_OCC => 'user_occ',
+		USER_SORT_KEY_BIO => 'bio',
+		USER_SORT_KEY_USER_INTREST => 'user_intrest',
+		USER_SORT_KEY_USER_MAILOK => 'user_mailok'
+	);
+	var $_mCriteria = null;
+
+	var $_mMatchFields = array ("uname", "name", "email", "user_icq", "user_aim", "user_yim", "user_msnm",
+	                            "url", "user_from", "user_occ", "user_intrest");
+	
+	function fetch()
+	{
+		$this->mSort = isset($_REQUEST['sort']) ? intval($_REQUEST['sort']) : USER_SORT_KEY_DEFAULT;
+	
+		if ($this->mSort > USER_SORT_KEY_MAXVALUE) {
+			$this->mSort = USER_SORT_KEY_DEFAULT;
+		}
+
+		$form =& new User_UserSearchForm();
+		$form->prepare();
+
+		$form->fetch();
+		$form->validate();
+		
+		if ($form->hasError()) {
+			return;
+		}
+		
+		foreach ($this->_mMatchFields as $field) {
+			if (strlen($form->get($field)) > 0) {
+				$this->mNavi->addExtra($field, $form->get($field));
+				$this->_mCriteria->add(new Criteria($field, '%' . $form->get($field) . '%', 'LIKE'));
+			}
+		}
+		
+		$this->mNavi->addExtra('mail_condition', $form->get('mail_condition'));
+		switch ($form->get('mail_condition')) {
+			case 1:
+				$this->_mCriteria->add(new Criteria('user_mailok', 1));
+				break;
+				
+			case 2:
+				$this->_mCriteria->add(new Criteria('user_mailok', 0));
+				break;
+		}
+
+		$this->mNavi->addExtra('user_level', $form->get('user_level'));
+		switch ($form->get('user_level')) {
+			case 1:
+				$this->_mCriteria->add(new Criteria('level', 0, '>'));
+				break;
+				
+			case 2:
+				$this->_mCriteria->add(new Criteria('level', 0));
+				break;
+		}
+		
+		if (strlen($form->get('over_posts')) > 0) {
+			$this->mNavi->addExtra('over_posts', $form->get('over_posts'));
+			$this->_mCriteria->add(new Criteria('posts', $form->get('over_posts'), '>='));
+		}
+
+		if (strlen($form->get('under_posts')) > 0) {
+			$this->mNavi->addExtra('under_posts', $form->get('under_posts'));
+			$this->_mCriteria->add(new Criteria('posts', $form->get('under_posts'), '<='));
+		}
+
+		if (strlen($form->get('lastlog_more')) > 0) {
+			$this->mNavi->addExtra('lastlog_more', $form->get('lastlog_more'));
+			$time = time() - $form->get('lastlog_more') * 86400;
+			$this->_mCriteria->add(new Criteria('last_login', $time, '<='));
+		}
+
+		if (strlen($form->get('lastlog_less')) > 0) {
+			$this->mNavi->addExtra('lastlog_less', $form->get('lastlog_less'));
+			$time = time() - $form->get('lastlog_more') * 86400;
+			$this->_mCriteria->add(new Criteria('last_login', $time, '>='));
+		}
+
+		if (strlen($form->get('regdate_more')) > 0) {
+			$this->mNavi->addExtra('regdate_more', $form->get('regdate_more'));
+			$time = time() - $form->get('regdate_more') * 86400;
+			$this->_mCriteria->add(new Criteria('user_regdate', $time, '<='));
+		}
+
+		if (strlen($form->get('regdate_less')) > 0) {
+			$this->mNavi->addExtra('regdate_less', $form->get('regdate_less'));
+			$time = time() - $form->get('regdate_less') * 86400;
+			$this->_mCriteria->add(new Criteria('user_regdate', $time, '>='));
+		}
+	}
+}
+
+?>


xoops-cvslog メーリングリストの案内
Back to archive index