summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.php
blob: 69139e9d105f6932d8df307bd3a42ddba5e94dac (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php

class Home extends TPage
{
	public function drop1_ondrop($sender, $param)
	{
		$draggable=$param->DraggableControl;
		/* Equals to:
		 * $draggable=$param->getControl($param->getCallbackParameter()->draggable);
		 */
		$offset=$param->getCallbackParameter()->offset;
		$target=$param->getCallbackParameter()->target->offset;
		$top=$offset->top - $target->top;
		$left=$offset->left - $target->left;
		$this->label1b->Text="Dropped ".$draggable->ID." at: <br/>Top=".$top." Left=".$left;
		$this->label3->Text="Dropped into yellow droppable!";
	}

	public function drop2_ondrop($sender, $param)
	{
		$draggable=$param->DraggableControl;
		/* Equals to:
		 * $draggable=$param->getControl($param->getCallbackParameter()->draggable);
		 */
		$offset=$param->getCallbackParameter()->offset;
		$target=$param->getCallbackParameter()->target->offset;
		$top=$offset->top - $target->top;
		$left=$offset->left - $target->left;
		$this->label2b->Text="Dropped ".$draggable->ID." at: <br/>Top=".$top." Left=".$left;
		$this->label3->Text="Dropped into red droppable!";
	}

	public function drop1_changed($sender, $param) {
	  if ($sender->getChecked()) {
	    $this->drop1->getOptions()->accept = '.drag-lime';
	    $this->label1a->Text="is accepting lime draggable";
	  }
	  else {
	    $this->drop1->getOptions()->accept = '';
	    $this->label1a->Text="is NOT accepting lime draggable";
	  }
	}

	public function drop2_changed($sender, $param) {
	  if ($sender->getChecked()) {
	    $this->drop2->getOptions()->activeClass = 'active';
	    $this->label2a->Text="is highlighted while dragging";
	  }
	  else {
	    $this->drop2->getOptions()->activeClass = '';
	    $this->label2a->Text="is NOT highlighted while dragging";
	  }
	}
}