1: <?php
  2:     /**
  3:      * The QDroppableBase class defined here provides an interface between the generated
  4:      * QDroppableGen class, and QCubed. This file is part of the core and will be overwritten
  5:      * when you update QCubed. To override, make your changes to the QDroppable.class.php file instead.
  6:      *
  7:      */
  8: 
  9:     /**
 10:      * Implements the Droppable capabilities of JQuery UI in a QControl
 11:      * 
 12:      * This class is designed to work as a kind of add-on class to a QControl, giving its capabilities
 13:      * to the control. To make a QControl droppable, simply set $ctl->Droppable = true. You can then 
 14:      * get to this class to further manipulate the aspects of the droppable through $ctl->DropObj.
 15:      *
 16:      * @property String $DroppedId ControlId of a control that was dropped onto this
 17:      * 
 18:      * @link http://jqueryui.com/droppable/
 19:      * @package Controls\Base
 20:      */
 21:     class QDroppableBase extends QDroppableGen
 22:     {
 23: 
 24:         /** @var string */
 25:         protected $strDroppedId = null;
 26: 
 27:         // redirect all js requests to the parent control
 28:         public function getJqControlId() {
 29:             return $this->objParentControl->ControlId;
 30:         }
 31:         
 32:         public function Render($blnDisplayOutput = true) {}
 33:         protected function GetControlHtml() {}
 34:         public function Validate() {return true;}
 35:         public function ParsePostData() {}
 36: 
 37:         // These functions are used to keep track of the selected value, and to implement 
 38:         // optional autocomplete functionality.
 39:         
 40: 
 41:         // These functions are used to keep track of the selected value, and to implement 
 42:         // optional autocomplete functionality.
 43:         
 44:         public function GetEndScript() {
 45:             $strJS = parent::GetEndScript();
 46:             QApplication::ExecuteJsFunction('qcubed.droppable', $this->GetJqControlId(), $this->ControlId, QJsPriority::High);
 47:             return $strJS;
 48:         }
 49: 
 50:         /**
 51:          * PHP __set magic method implementation
 52:          * @param string $strName Name of the property
 53:          * @param string $mixValue Value of the property
 54:          *
 55:          * @throws QCallerException|QInvalidCastException
 56:          */
 57:         public function __set($strName, $mixValue) {
 58:             switch ($strName) {
 59:                 case '_DroppedId': // Internal only. Do not use. Used by JS above to track user actions.
 60:                     try {
 61:                         $this->strDroppedId = QType::Cast($mixValue, QType::String);
 62:                     } catch (QInvalidCastException $objExc) {
 63:                         $objExc->IncrementOffset();
 64:                         throw $objExc;
 65:                     }
 66:                     break;
 67:                     
 68:                 default:
 69:                     try {
 70:                         parent::__set($strName, $mixValue);
 71:                     } catch (QCallerException $objExc) {
 72:                         $objExc->IncrementOffset();
 73:                         throw $objExc;
 74:                     }
 75:                     break;
 76:             }
 77:             
 78:         }
 79: 
 80:         /**
 81:          * PHP __get magic method implementation
 82:          * @param string $strName Property Name
 83:          *
 84:          * @return mixed
 85:          * @throws QCallerException
 86:          */
 87:         public function __get($strName) {
 88:             switch ($strName) {
 89:                 case 'DroppedId': return $this->strDroppedId;
 90:                 
 91:                 default: 
 92:                     try { 
 93:                         return parent::__get($strName); 
 94:                     } catch (QCallerException $objExc) { 
 95:                         $objExc->IncrementOffset(); 
 96:                         throw $objExc; 
 97:                     }
 98:             }
 99:         }
100:         
101:     }