Location: PHPKode > projects > Toutateam Groupware > toutateam-v1.56/notes/notes_morefields.php
<?php

// morefields module - Toutateam v1.5
// copyright  ©  2006 Yannick Bétemps  hide@address.com
// www.toutateam.com
// Author: Yannick Bétemps

class morefields_notes
{
	var $user_ID;
	var $user_group;
	var $curclass="morefields";
	var $curtable="notes";
	var $curtype="notes";
	var $fields_list;
	
	function morefields_notes()
	{
		global $user_ID,$user_group,$database;
		$this->user_ID=$user_ID;
		$this->user_group=$user_group;
		$database->setQuery("SELECT * FROM ".$this->curclass." WHERE field_type='".$this->curtype."' AND (IDAuthor=".$this->user_ID." OR (IDGroup=".$this->user_group." AND field_access='group') OR field_access='public'); ");
		$this->fields_list=$database->loadObjectList();
	}
	function print_fields($theId="-1",$theFrStyle="framestyle",$theTdHStyle="lightbordercolor",$theTdStyle="lightborder")
	{
		global $database;
		if(count($this->fields_list)>0)
		{
			//echo "Affichage pour l'ID : ".$theId."<br>\n";
			//echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\" class=\"".$theFrStyle."\" style=\"width:300px;\">\n";
			$myContent=array();
			if($theId>0)
			{
				$database->setQuery("SELECT options2 FROM ".$this->curtable." WHERE ID=".$theId.";");
				$myObj=null;
				if($database->loadObject($myObj))
				{
					$myContent=unserialize($myObj->options2);
					//echo "Contenu : (".$myObj->options2.") <br>\n";
					//foreach($myContent as $key=>$value) echo "Clef : $key => Value : $value<br>\n";
					//print_r($myContent);
				}
			}
			$index=0;
			foreach($this->fields_list as $myCurField)
			{
				$myIndexes=array();
				echo "<tr><td class=\"".$theTdHStyle."\" style=\"width:100px;\">\n";
				echo stripslashes($myCurField->field_name);
				echo "&nbsp;:</td><td class=\"".$theTdStyle."\">\n";
				if(array_key_exists($myCurField->field_name,$myContent)) $myTxtContent=$myContent[$myCurField->field_name];
				else $myTxtContent="";
				$myIndexes[$index]=$myCurField->field_name;
				echo "<textarea  rows=\"1\" name=\"add_field['".$myCurField->field_name."']\" style=\"width:100%\">".$myTxtContent."</textarea>";
				echo "</td></tr>\n";
				$index++;
			}
			echo "<input type=\"hidden\" name=\"field_indexes\" value=\"".str_replace("\"","'",(serialize($myIndexes)))."\">\n";
			//echo "</table>";
		}
	}
}
?>
Return current item: Toutateam Groupware