1<?php
2
3/* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5/**
6* Class ilSCORM2004Rule
7*
8* Sequencing Template class for SCORM 2004 Editing
9*
10* @author Hendrik Holtmann <holtmann@me.com>
11* @version $Id$
12*
13* @ingroup ModulesScorm2004
14*/
15class ilSCORM2004Rule extends ilSCORM2004SeqNode
16{
17
18    //db fields
19    private $id = null;
20    private $seqNodeId = null;
21    private $type = null;
22    private $action = true;
23    /**
24    * Constructor
25    * @access	public
26    */
27    public function __construct()
28    {
29        parent::__construct();
30        $this->setNodeName("rule");
31    }
32
33
34    // **********************
35    // GETTER METHODS
36    // **********************
37
38    public function getSeqNodeId()
39    {
40        return $this->seqNodeId;
41    }
42
43    public function getId()
44    {
45        return $this->id;
46    }
47
48    public function getType()
49    {
50        return $this->type;
51    }
52
53    public function getAction()
54    {
55        return $this->action;
56    }
57
58    // **********************
59    // Setter METHODS
60    // **********************
61
62    public function setSeqNodeId($a_seqnodeid)
63    {
64        $this->seqNodeId = $a_seqnodeid;
65    }
66
67    public function setId($a_id)
68    {
69        $this->id = $a_id;
70    }
71
72    public function setType($a_type)
73    {
74        $this->type = $a_type;
75    }
76
77    public function setAction($a_action)
78    {
79        $this->action = $a_action;
80    }
81
82
83    // **********************
84    // Standard DB Operations for Object
85    // **********************
86
87    public function insert($a_insert_node = false)
88    {
89        if ($a_insert_node == true) {
90            $this->setSeqNodeId(parent::insert());
91        }
92        $sql = "INSERT INTO sahs_sc13_seq_rule (seqnodeid,type,action)" .
93                " values(" .
94                $this->db->quote($this->seqNodeId, "integer") . "," .
95                $this->db->quote($this->type, "text") . "," .
96                $this->db->quote($this->action, "text") . ");";
97        $result = $this->db->manipulate($sql);
98        return true;
99    }
100}
101