[xoops-cvslog 5009] CVS update: xoops2jp/html/modules/base/kernel

アーカイブの一覧に戻る

Minahito minah****@users*****
2006年 10月 14日 (土) 02:52:06 JST


Index: xoops2jp/html/modules/base/kernel/Legacy_Module.class.php
diff -u xoops2jp/html/modules/base/kernel/Legacy_Module.class.php:1.1.2.6 xoops2jp/html/modules/base/kernel/Legacy_Module.class.php:1.1.2.7
--- xoops2jp/html/modules/base/kernel/Legacy_Module.class.php:1.1.2.6	Fri Oct 13 18:21:40 2006
+++ xoops2jp/html/modules/base/kernel/Legacy_Module.class.php	Sat Oct 14 02:52:06 2006
@@ -1,7 +1,7 @@
 <?php
 /**
  * @package Legacy
- * @version $Id: Legacy_Module.class.php,v 1.1.2.6 2006/10/13 09:21:40 minahito Exp $
+ * @version $Id: Legacy_Module.class.php,v 1.1.2.7 2006/10/13 17:52:06 minahito Exp $
  */
 
 class Legacy_AbstractModule
@@ -202,10 +202,31 @@
 	function searchAction(&$searchArgs)
 	{
 	}
+	
+	function doLegacyGlobalSearch($queries, $andor, $max_hit, $start, $uid)
+	{
+	}
+	
+	function hasAdminIndex()
+	{
+		return false;
+	}
+	
+	function getAdminIndex()
+	{
+		return null;
+	}
+	
+	function getAdminMenu()
+	{
+	}
 }
 
 class Legacy_ModuleAdapter extends Legacy_AbstractModule
 {
+	var $_mAdminMenuLoadedFlag = false;
+	var $mAdminMenu = null;
+	
 	function searchAction(&$searchArgs)
 	{
 		if(!is_object($searchArgs)) {
@@ -312,6 +333,92 @@
 			}
 		}
 	}
+
+	function doLegacyGlobalSearch($queries, $andor, $max_hit, $start, $uid)
+	{
+		$ret = array();
+		$results = $this->mXoopsModule->search($queries, $andor, $max_hit, $start, $uid);
+		
+		if (is_array($results) && count($results) > 0) {
+			foreach ($results as $result) {
+				$item = array();
+				if (isset($result['image']) && strlen($result['image']) > 0) {
+					$item['image'] = XOOPS_URL . '/modules/' . $this->mXoopsModule->get('dirname') . '/' . $result['image'];
+				}
+				else {
+					$item['image'] = XOOPS_URL . '/images/icons/posticon2.gif';
+				}
+						
+				$item['link'] = XOOPS_URL . '/modules/' . $this->mXoopsModule->get('dirname') . '/' . $result['link'];
+				$item['title'] = $result['title'];
+				$item['uid'] = $result['uid'];
+						
+				//
+				// TODO If this service will come to web service, we should
+				// change format from unixtime to string by timeoffset.
+				//
+				$item['time'] = isset($result['time']) ? $result['time'] : 0;
+				
+				$ret[] = $item;
+			}
+		}
+		
+		return $ret;
+	}
+	
+	function hasAdminIndex()
+	{
+		$dmy =& $this->mXoopsModule->getInfo();
+		return isset($this->mXoopsModule->modinfo['adminindex']) && $this->mXoopsModule->modinfo['adminindex'] != null;
+	}
+	
+	function getAdminIndex()
+	{
+		$dmy =& $this->mXoopsModule->getInfo();
+		return XOOPS_MODULE_URL . '/' . $this->mXoopsModule->get('dirname') . '/' . $this->mXoopsModule->modinfo['adminindex'];
+	}
+	
+	function getAdminMenu()
+	{
+		if ($this->_mAdminMenuLoadedFlag) {
+			return $this->mAdminMenu;
+		}
+		
+		$dmy =& $this->mXoopsModule->getInfo();
+
+		//
+		// Load admin menu, and add preference menu by own judge.
+		//
+		$this->mXoopsModule->loadAdminMenu();
+		if ($this->mXoopsModule->get('hasnotification')
+		    || ($this->mXoopsModule->getInfo('config') && is_array($this->mXoopsModule->getInfo('config')))
+		    || ($this->mXoopsModule->getInfo('comments') && is_array($this->mXoopsModule->getInfo('comments')))) {
+				$this->mXoopsModule->adminmenu[] = array(
+					'link' => XOOPS_MODULE_URL . '/base/admin/index.php?action=PreferenceEdit&amp;confmod_id=' . $this->mXoopsModule->get('mid'),
+					'title' => _PREFERENCES,
+					'absolute' => true);
+		}
+			
+		if ($this->mXoopsModule->hasHelp()) {
+			$helpUrl = XOOPS_MODULE_URL . "/base/admin/index.php?action=Help&amp;dirname=" . $this->mXoopsModule->get('dirname');
+			$this->mXoopsModule->adminmenu[] = array('link' => $helpUrl,
+			                              'title' => _HELP,
+			                              'absolute' => true);
+		}
+		
+		$this->_mAdminMenuLoadedFlag = true;
+		
+		if ($this->mXoopsModule->adminmenu) {
+			foreach ($this->mXoopsModule->adminmenu as $menu) {
+				if (!(isset($menu['absolute']) && isset($menu['absolute']) == true)) {
+					$menu['link'] = XOOPS_MODULE_URL . '/' . $this->mXoopsModule->get('dirname') . '/' . $menu['link'];
+				}
+				$this->mAdminMenu[] = $menu;
+			}
+		}
+		
+		return $this->mAdminMenu;
+	}
 }
 
 ?>
\ No newline at end of file


xoops-cvslog メーリングリストの案内
アーカイブの一覧に戻る