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

Back to archive index

Minahito minah****@users*****
2006年 4月 7日 (金) 18:02:36 JST


Index: xoops2jp/html/modules/base/admin/actions/BlockEditAction.class.php
diff -u xoops2jp/html/modules/base/admin/actions/BlockEditAction.class.php:1.1.2.3 xoops2jp/html/modules/base/admin/actions/BlockEditAction.class.php:1.1.2.4
--- xoops2jp/html/modules/base/admin/actions/BlockEditAction.class.php:1.1.2.3	Thu Apr  6 15:01:47 2006
+++ xoops2jp/html/modules/base/admin/actions/BlockEditAction.class.php	Fri Apr  7 18:02:36 2006
@@ -36,6 +36,64 @@
 		$this->mActionForm->prepare();
 	}
 	
+	function execute(&$controller, &$xoopsUser)
+	{
+		$ret = parent::execute($controller, $xoopsUser);
+		
+		if ($ret == LEGACY_FRAME_VIEW_SUCCESS) {
+			//
+			// Reset block_module_link.
+			//
+			$handler =& xoops_getmodulehandler('block_module_link', 'base');
+			$handler->deleteAll(new Criteria('block_id', $this->mObject->get('bid')));
+			foreach ($this->mObject->mBmodule as $bmodule) {
+				$handler->insert($bmodule);
+			}
+
+			//
+			// Insert group permissions.
+			//
+			$currentGroupid = array();
+			foreach ($this->mObject->mGroup as $group) {
+				$currentGroupid[] = $group->get('groupid');
+			}
+			
+			$permHandler =& xoops_gethandler('groupperm');
+			$criteria =& new CriteriaCompo();
+			$criteria->add(new Criteria('gperm_modid', 1));
+			$criteria->add(new Criteria('gperm_itemid', $this->mObject->get('bid')));
+			$criteria->add(new Criteria('gperm_name', 'block_read'));
+			
+			$gpermArr =&  $permHandler->getObjects($criteria);
+			foreach ($gpermArr as $gperm) {
+				if (!in_array($gperm->get('gperm_groupid', $currentGroupid))) {
+					$permHandler->delete($gperm, $force);
+				}
+			}
+			
+			foreach ($this->mObject->mGroup as $group) {
+				$insertFlag = true;
+				foreach ($gpermArr as $gperm) {
+					if ($gperm->get('gperm_groupid') == $group->get('group_id')) {
+						$insertFlag = false;
+					}
+				}
+				
+				if ($insertFlag) {
+					$gperm =& $permHandler->create();
+					$gperm->set('gperm_modid', 1);
+					$gperm->set('gperm_groupid', $group->get('groupid'));
+					$gperm->set('gperm_itemid', $this->mObject->get('bid'));
+					$gperm->set('gperm_name', 'block_read');
+					
+					$permHandler->insert($gperm, $force);
+				}
+			}
+		}
+		
+		return $ret;
+	}
+	
 	function executeViewInput(&$controller, &$xoopsUser, &$render)
 	{
 		$render->setTemplateName("block_edit.html");


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