Browse Source

- Allow plug-ins to record specific changes in the object's history

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1333 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 14 năm trước cách đây
mục cha
commit
4543afbb59
1 tập tin đã thay đổi với 37 bổ sung0 xóa
  1. 37 0
      core/cmdbchangeop.class.inc.php

+ 37 - 0
core/cmdbchangeop.class.inc.php

@@ -554,4 +554,41 @@ class CMDBChangeOpSetAttributeCaseLog extends CMDBChangeOpSetAttribute
 	}
 }
 
+/**
+ * Record an action made by a plug-in  
+ *
+ * @package     iTopORM
+ */
+class CMDBChangeOpPlugin extends CMDBChangeOp
+{
+	public static function Init()
+	{
+		$aParams = array
+		(
+			"category" => "core/cmdb",
+			"key_type" => "",
+			"name_attcode" => "change",
+			"state_attcode" => "",
+			"reconc_keys" => array(),
+			"db_table" => "priv_changeop_plugin",
+			"db_key_field" => "id",
+			"db_finalclass_field" => "",
+		);
+		MetaModel::Init_Params($aParams);
+		MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>'', "is_null_allowed"=>false, "depends_on"=>array())));
+		/* May be used later when implementing an extension mechanism that will allow the plug-ins to store some extra information and still degrades gracefully when the plug-in is desinstalled
+		MetaModel::Init_AddAttribute(new AttributeString("extension_class", array("allowed_values"=>null, "sql"=>"extension_class", "default_value"=>'', "is_null_allowed"=>false, "depends_on"=>array())));
+		MetaModel::Init_AddAttribute(new AttributeInteger("extension_id", array("allowed_values"=>null, "sql"=>"extension_id", "default_value"=>0, "is_null_allowed"=>false, "depends_on"=>array())));
+		*/
+		MetaModel::Init_InheritAttributes();
+	}
+	
+	/**
+	 * Describe (as a text string) the modifications corresponding to this change
+	 */	 
+	public function GetDescription()
+	{
+		return $this->Get('description');
+	}
+}
 ?>