[Vtigercrm-commits] [vtiger-commits] r9716 - /vtigercrm/branches/5.0.2/modules/Faq/Faq.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Thu Oct 26 12:22:34 EDT 2006


Author: richie
Date: Thu Oct 26 10:22:27 2006
New Revision: 9716

Log:
Added function save_module

Modified:
    vtigercrm/branches/5.0.2/modules/Faq/Faq.php

Modified: vtigercrm/branches/5.0.2/modules/Faq/Faq.php
==============================================================================
--- vtigercrm/branches/5.0.2/modules/Faq/Faq.php (original)
+++ vtigercrm/branches/5.0.2/modules/Faq/Faq.php Thu Oct 26 10:22:27 2006
@@ -33,7 +33,7 @@
 	var $log;
 	var $db;
 
-	var $tab_name = Array('vtiger_crmentity','vtiger_faq','vtiger_faqcomments');
+	var $tab_name = Array('vtiger_crmentity','vtiger_faq');
 	var $tab_name_index = Array('vtiger_crmentity'=>'crmid','vtiger_faq'=>'id','vtiger_faqcomments'=>'faqid');
 				
 	var $entity_table = "vtiger_crmentity";
@@ -86,6 +86,40 @@
 		$this->log->debug("Exiting Faq method ...");
 	}
 
+	function save_module($module)
+	{
+		//Inserting into Faq comment table
+		$this->insertIntoFAQCommentTable('vtiger_faqcomments', $module);
+		
+	}
+
+
+	/** Function to insert values in vtiger_faqcomments table for the specified module,
+  	  * @param $table_name -- table name:: Type varchar
+  	  * @param $module -- module:: Type varchar
+ 	 */	
+	function insertIntoFAQCommentTable($table_name, $module)
+	{
+		global $log;
+		$log->info("in insertIntoFAQCommentTable  ".$table_name."    module is  ".$module);
+        	global $adb;
+
+        	$current_time = $adb->formatDate(date('YmdHis'));
+
+		if($this->column_fields['comments'] != '')
+			$comment = $this->column_fields['comments'];
+		else
+			$comment = $_REQUEST['comments'];
+
+		if($comment != '')
+		{
+			$comment = addslashes($comment);
+			$sql = "insert into vtiger_faqcomments values('',".$this->id.",'".$comment."',".$current_time.")";	
+			$adb->query($sql);
+		}
+	}	
+	
+
 	/**     Function to get the list of comments for the given FAQ id
          *      @param  int  $faqid - FAQ id
 	 *      @return list $list - return the list of comments and comment informations as a html output where as these comments and comments informations will be formed in div tag.





More information about the vtigercrm-commits mailing list