[prev in list] [next in list] [prev in thread] [next in thread]
List: os-sim-commits
Subject: [Os-sim-commits] os-sim/include/classes Policy_target_reference.inc,
From: Alberto Roman Linacero <alberto_r () users ! sourceforge ! net>
Date: 2007-02-28 15:44:29
Message-ID: E1HMQyn-0002VG-LZ () mail ! sourceforge ! net
[Download RAW message or body]
Update of /cvsroot/os-sim/os-sim/include/classes
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9978
Added Files:
Policy_target_reference.inc
Log Message:
- new class added to handle targets (servers and/or sensors) in policy
--- NEW FILE: Policy_target_reference.inc ---
<?php
require_once("ossim_db.inc");
class Policy_target_reference {
var $policy_id;
var $target_name;
function Policy_target_reference ($policy_id, $target_name)
{
$this->policy_id = $policy_id;
$this->target_name = $target_name;
}
function get_policy_id() { return $this->policy_id; }
function get_target_name() { return $this->target_name; }
function get_list($conn, $policy_id)
{
$list = array();
$policy_id = intval($policy_id);
$query = OssimQuery("SELECT * FROM policy_target_reference
WHERE policy_id = $policy_id");
if (!$rs = &$conn->Execute($query)) {
print $conn->ErrorMsg();
} else {
$list = array();
while (!$rs->EOF) {
$list[] = new Policy_target_reference
($rs->fields["policy_id"],
$rs->fields["target_name"]);
$rs->MoveNext();
}
}
return $list;
}
function insert($conn, $target_list, $policy_id)
{
foreach($target_list as $target_name)
{
$sql = "INSERT INTO policy_target_reference VALUES (?, ?)";
$params = array($policy_id, $target_name);
if (!$conn->Execute($sql, $params)) {
die($conn->ErrorMsg());
}
}
}
function in_policy_target_reference($conn, $policy_id, $target_name)
{
$policy_id = intval($policy_id);
$sql= "SELECT * FROM policy_target_reference WHERE policy_id = ? AND target_name = ?";
$params = array($policy_id, $target_name);
if (!$rs = &$conn->Execute($sql, $params)) {
print $conn->ErrorMsg();
}
return $rs->fields[0];
}
function delete($conn, $policy_id) {
$policy_id = intval($policy_id);
$sql = "DELETE FROM policy_target_reference WHERE policy_id = ?";
$params = array($policy_id);
if ($conn->Execute($sql, $params) === false) {
print 'error deleting: '.$conn->ErrorMsg().'<BR>';
exit;
}
}
}
?>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Os-sim-commits mailing list
Os-sim-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/os-sim-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic