summaryrefslogtreecommitdiffstats
path: root/codebase/Dhtmlx/Connector/Data/ComboDataItem.php
blob: 4e65676fccf3386d331ec874b9788d74f3b44870 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
namespace Dhtmlx\Connector\Data;

/*! DataItem class for Combo component
**/
class ComboDataItem extends DataItem{
    private $selected;//!< flag of selected option

    function __construct($data,$config,$index){
        parent::__construct($data,$config,$index);

        $this->selected=false;
    }
    /*! mark option as selected
    */
    function select(){
        $this->selected=true;
    }
    /*! return self as XML string, starting part
    */
    function to_xml_start(){
        if ($this->skip) return "";

        return "<option ".($this->selected?"selected='true'":"")."value='".$this->xmlentities($this->get_id())."'><![CDATA[".$this->data[$this->config->text[0]["name"]]."]]>";
    }
    /*! return self as XML string, ending part
    */
    function to_xml_end(){
        if ($this->skip) return "";
        return "</option>";
    }
}