[xoops-cvslog 3185] CVS update: xoops2jp/html/modules/base/actions

Back to archive index

Minahito minah****@users*****
2006年 5月 27日 (土) 22:06:25 JST


Index: xoops2jp/html/modules/base/actions/SearchShowallbyuserAction.class.php
diff -u /dev/null xoops2jp/html/modules/base/actions/SearchShowallbyuserAction.class.php:1.1.2.1
--- /dev/null	Sat May 27 22:06:25 2006
+++ xoops2jp/html/modules/base/actions/SearchShowallbyuserAction.class.php	Sat May 27 22:06:25 2006
@@ -0,0 +1,40 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_MODULE_PATH . "/base/actions/SearchShowallAction.class.php";
+require_once XOOPS_MODULE_PATH . "/base/forms/SearchShowallbyuserForm.class.php";
+
+class Legacy_SearchShowallbyuserAction extends Legacy_SearchShowallAction
+{
+	function _setupActionForm()
+	{
+		$this->mActionForm =& new Legacy_SearchShowallbyuserForm();
+		$this->mActionForm->prepare();
+	}
+	
+	function _getTemplateName()
+	{
+		return "legacy_search_showallbyuser.html";
+	}
+	
+	function _getSelectedMids()
+	{
+		$ret = array();
+		$ret[] = $this->mActionForm->get('mid');
+		
+		return $ret;
+	}
+
+	function executeViewIndex(&$controller, &$xoopsUser, &$render)
+	{
+		parent::executeViewIndex($controller, $xoopsUser, $render);
+		
+		$handler =& xoops_gethandler('user');
+		$user =& $handler->get($this->mActionForm->get('uid'));
+		
+		$render->setAttribute('targetUser', $user);
+	}
+}
+
+?>
Index: xoops2jp/html/modules/base/actions/SearchShowallAction.class.php
diff -u /dev/null xoops2jp/html/modules/base/actions/SearchShowallAction.class.php:1.1.2.1
--- /dev/null	Sat May 27 22:06:25 2006
+++ xoops2jp/html/modules/base/actions/SearchShowallAction.class.php	Sat May 27 22:06:25 2006
@@ -0,0 +1,46 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_MODULE_PATH . "/base/actions/SearchResultsAction.class.php";
+require_once XOOPS_MODULE_PATH . "/base/forms/SearchShowallForm.class.php";
+
+class Legacy_SearchShowallAction extends Legacy_SearchResultsAction
+{
+	function _setupActionForm()
+	{
+		$this->mActionForm =& new Legacy_SearchShowallForm();
+		$this->mActionForm->prepare();
+	}
+	
+	function _getTemplateName()
+	{
+		return "legacy_search_showall.html";
+	}
+	
+	function _getSelectedMids()
+	{
+		$ret = array();
+		$ret[] = $this->mActionForm->get('mid');
+		
+		return $ret;
+	}
+	
+	function executeViewIndex(&$controller, &$xoopsUser, &$render)
+	{
+		parent::executeViewIndex($controller, $xoopsUser, $render);
+		
+		//
+		// TODO remove Magic number '20'
+		//
+		$prevStart = $this->mActionForm->get('start') - 20;
+		if ($prevStart < 0) {
+			$prevStart = 0;
+		}
+		
+		$render->setAttribute('prevStart', $prevStart);
+		$render->setAttribute('nextStart', $this->mActionForm->get('start') + 20);
+	}
+}
+
+?>
Index: xoops2jp/html/modules/base/actions/SearchResultsAction.class.php
diff -u /dev/null xoops2jp/html/modules/base/actions/SearchResultsAction.class.php:1.1.2.1
--- /dev/null	Sat May 27 22:06:25 2006
+++ xoops2jp/html/modules/base/actions/SearchResultsAction.class.php	Sat May 27 22:06:25 2006
@@ -0,0 +1,110 @@
+<?php
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_MODULE_PATH . "/base/forms/SearchResultsForm.class.php";
+
+class Legacy_SearchResultsAction extends Legacy_Action
+{
+	var $mActionForm = null;
+	var $mSearchResults = array();
+	var $mModules = array();
+	
+	function prepare(&$controller, &$xoopsUser)
+	{
+		$root =& $controller->mRoot;
+		$root->mLanguageManager->loadModuleLanguage('base');
+		
+		$this->_setupActionForm();
+	}
+	
+	function _setupActionForm()
+	{
+		$this->mActionForm =& new Legacy_SearchResultsForm();
+		$this->mActionForm->prepare();
+	}
+	
+	function getDefaultView(&$controller, &$xoopsUser)
+	{
+		$this->mActionForm->fetch();
+		$this->mActionForm->validate();
+
+		//
+		// TODO ErrorHandling
+		//
+				
+		$root =& $controller->mRoot;
+		$service =& $root->mServiceManager->searchXCubeService("LegacySearch");
+		if ($service) {
+			$client =& new XCube_ServiceClient($service);
+
+			$parameters = array();
+			$parameters['current_uid'] = is_object($xoopsUser) ? $xoopsUser->get('uid') : 0;
+			
+			$this->mActionForm->update($parameters);
+			
+			$this->mSearchResults = $client->call("getItems", $parameters);
+		}
+		else {
+			return LEGACY_FRAME_VIEW_ERROR;
+		}
+		
+		//
+		// Make the module list for search form.
+		//
+		$groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
+		$handler = & xoops_gethandler( 'groupperm' );
+		$mids = $handler->getItemIds('module_read', $groups);
+		
+		$handler =& xoops_gethandler('module');
+		foreach ($mids as $mid) {
+			$module =& $handler->get($mid);
+			if ($module->get('isactive') && $module->get('hassearch')) {
+				$this->mModules[] =& $module;
+			}
+			unset($module);
+		}
+
+		return LEGACY_FRAME_VIEW_INDEX;
+	}
+	
+	function executeViewIndex(&$controller, &$xoopsUser, &$render)
+	{
+		$render->setTemplateName($this->_getTemplateName());
+	
+		$render->setAttribute('actionForm', $this->mActionForm);
+			
+		$render->setAttribute('searchResults', $this->mSearchResults);
+		$render->setAttribute('moduleArr', $this->mModules);
+
+		//
+		// If the request include $mids, setAttribute it. If it don't include, 
+		// setAttribute $mid or $this->mModules.
+		//		
+		$render->setAttribute('selectedMidArr', $this->_getSelectedMids());
+	}
+	
+	function _getTemplateName()
+	{
+		return "legacy_search_results.html";
+	}
+	
+	function _getSelectedMids()
+	{
+		$ret = $this->mActionForm->get('mids');
+		if (!count($ret)) {
+			foreach ($this->mModules as $module) {
+				$ret[] = $module->get('mid');
+			}
+		}
+		
+		return $ret;
+	}
+
+	function executeViewError(&$controller, &$xoopsUser, &$render)
+	{
+	//	$controller->executeForward("./index.php?Action=ImageList");
+	}
+}
+
+?>


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