[Fusionforge-commits] r11005 - trunk/src/common/include

Alain Peyrat aljeux at libremir.placard.fr.eu.org
Fri Oct 15 12:56:28 CEST 2010


Author: aljeux
Date: 2010-10-15 12:56:28 +0200 (Fri, 15 Oct 2010)
New Revision: 11005

Modified:
   trunk/src/common/include/Plugin.class.php
Log:
Add default method groupisactivecheckbox() and groupisactivecheckboxpost() in Plugin class.

Modified: trunk/src/common/include/Plugin.class.php
===================================================================
--- trunk/src/common/include/Plugin.class.php	2010-10-15 10:56:18 UTC (rev 11004)
+++ trunk/src/common/include/Plugin.class.php	2010-10-15 10:56:28 UTC (rev 11005)
@@ -138,6 +138,37 @@
 		$role =& $params['role'] ;
 	}
 		
+	function groupisactivecheckbox (&$params) {
+		//Check if the group is active
+		// this code creates the checkbox in the project edit public info page to activate/deactivate the plugin
+		$group = group_get_object($params['group']);
+		$flag = strtolower('use_'.$this->name);
+		echo "<tr>";
+		echo "<td>";
+		echo ' <input type="checkbox" name="'.$flag.'" value="1" ';
+		// checked or unchecked?
+		if ( $group->usesPlugin ( $this->name ) ) {
+			echo "checked=\"checked\"";
+		}
+		echo " /><br/>";
+		echo "</td>";
+		echo "<td>";
+		echo "<strong>Use ".$this->text." Plugin</strong>";
+		echo "</td>";
+		echo "</tr>";
+	}
+
+	function groupisactivecheckboxpost (&$params) {
+		// this code actually activates/deactivates the plugin after the form was submitted in the project edit public info page
+		$group = group_get_object($params['group']);
+		$flag = strtolower('use_'.$this->name);
+		if ( getStringFromRequest($flag) == 1 ) {
+			$group->setPluginUse ( $this->name );
+		} else {
+			$group->setPluginUse ( $this->name, false );
+		}
+	}
+
 	function userisactivecheckbox (&$params) {
 		//check if user is active
 		// this code creates the checkbox in the user account manteinance page to activate/deactivate the plugin




More information about the Fusionforge-commits mailing list