File size: 2,960 Bytes
07c3cdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
class TreeNode
{
    public $text = "";
    public $id = "";
    public $iconCls = "";
    public $leaf = true;
    public $draggable = false;
    public $href = "#";
    public $hrefTarget = "";

    public function __construct ($id, $text, $iconCls, $leaf, $draggable, $href, $hrefTarget)
    {
        $this->id = $id;
        $this->text = $text;
        $this->iconCls = $iconCls;
        $this->leaf = $leaf;
        $this->draggable = $draggable;
        $this->href = $href;
        $this->hrefTarget = $hrefTarget;
    }

    public function toJson ()
    {
        return G::json_encode( $this );
    }
}

class ExtJsTreeNode extends TreeNode
{
    public $children = array ();

    public function add ($object)
    {
        $this->children[] = $object;
    }

    public function toJson ()
    {
        return G::json_encode( $this );
    }
}

$o = new Cases();
$PRO_UID = $_SESSION['PROCESS'];

$treeArray = array ();
//if (isset($_GET['action'])&&$_GET['action']=='test'){
echo "[";
// dynaforms assemble
$extTreeDynaforms = new ExtJsTreeNode( "node-dynaforms", G::loadtranslation( 'ID_DYNAFORMS' ), "", false, false, "", "" );
$i = 0;
$APP_UID = $_GET['APP_UID'];
$DEL_INDEX = $_GET['DEL_INDEX'];
$steps = $o->getAllDynaformsStepsToRevise( $_GET['APP_UID'] );
$steps->next();
while ($step = $steps->getRow()) {
    require_once 'classes/model/Dynaform.php';
    $od = new Dynaform();
    $dynaformF = $od->Load( $step['STEP_UID_OBJ'] );

    $n = $step['STEP_POSITION'];
    $TITLE = " - " . $dynaformF['DYN_TITLE'];
    $DYN_UID = $dynaformF['DYN_UID'];
    $href = "cases_StepToRevise?type=DYNAFORM&ex=$i&PRO_UID=$PRO_UID&DYN_UID=$DYN_UID&APP_UID=$APP_UID&position=" . $step['STEP_POSITION'] . "&DEL_INDEX=$DEL_INDEX";
    $extTreeDynaforms->add( new TreeNode( $DYN_UID, $TITLE, "datasource", true, false, $href, "openCaseFrame" ) );
    $i ++;
    $steps->next();
}
echo $extTreeDynaforms->toJson();
// end the dynaforms tree menu
echo ",";
// assembling the input documents tree menu
$extTreeInputDocs = new ExtJsTreeNode( "node-input-documents", G::loadtranslation( 'ID_REQUEST_DOCUMENTS' ), "", false, false, "", "" );
$i = 0;
$APP_UID = $_GET['APP_UID'];
$DEL_INDEX = $_GET['DEL_INDEX'];
$steps = $o->getAllInputsStepsToRevise( $_GET['APP_UID'] );
$steps->next();
while ($step = $steps->getRow()) {
    require_once 'classes/model/InputDocument.php';
    $od = new InputDocument();
    $IDF = $od->Load( $step['STEP_UID_OBJ'] );

    $n = $step['STEP_POSITION'];
    $TITLE = " - " . $IDF['INP_DOC_TITLE'];
    $INP_DOC_UID = $IDF['INP_DOC_UID'];
    $href = "cases_StepToReviseInputs?type=INPUT_DOCUMENT&ex=$i&PRO_UID=$PRO_UID&INP_DOC_UID=$INP_DOC_UID&APP_UID=$APP_UID&position=" . $step['STEP_POSITION'] . "&DEL_INDEX=$DEL_INDEX";
    $extTreeInputDocs->add( new TreeNode( $INP_DOC_UID, $TITLE, "datasource", true, false, $href, "openCaseFrame" ) );
    $i ++;
    $steps->next();
}
echo $extTreeInputDocs->toJson();
echo "]";