public function AddControlToMove($objTargetControl = null) { $this->strJavaScripts = __JQUERY_EFFECTS__; if ($objTargetControl && $objTargetControl->ControlId != $this->ControlId) { QApplication::ExecuteJavascript(sprintf('var pos_%s = $j("#%s").offset()', $objTargetControl->ControlId, $objTargetControl->ControlId)); QApplication::ExecuteJavascript(sprintf('$j("#%s").on("drag", function (ev, ui) { p = $j("#%s").offset(); p.left = pos_%s.left + ui.position.left; p.top = pos_%s.top + ui.position.top; $j("#%s").offset(p); } );', $this->strControlId, $objTargetControl->ControlId, $objTargetControl->ControlId, $objTargetControl->ControlId, $objTargetControl->ControlId)); $this->objMovesControlsArray[$objTargetControl->ControlId] = true; // TODO: // Replace ExecuteJavascript with this: //$this->AddAttributeScript('qcubed', 'ctrlToMove', $objTargetControl->ControlId); } return; }
public function __set($strName, $mixValue) { switch ($strName) { case '_SelectedItems': // Internal only. Do not use. Used by JS above to keep track of selections. try { $strItems = QType::Cast($mixValue, QType::String); $this->arySelectedItems = explode(",", $strItems); } catch (QInvalidCastException $objExc) { $objExc->IncrementOffset(); throw $objExc; } break; case 'SelectedItems': // Set the selected items to an array of object ids try { $aValues = QType::Cast($mixValue, QType::ArrayType); $aJqIds = array(); foreach ($aValues as $val) { $aJqIds[] = '"#' . $val . '"'; } $strJqItems = join(',', $aJqIds); $strJS = <<<FUNC \t\t\t\t\t\t\tvar item = jQuery("#{$this->ControlId}"); \t\t\t\t\t\t\t \t\t\t\t\t\t\tjQuery(".ui-selectee", item).each(function() { \t\t\t\t\t\t\t\tjQuery(this).removeClass('ui-selected'); \t\t\t\t\t\t\t}); \t\t\t\t\t\t\t \t\t\t\t\t\t\tjQuery({$strJqItems}).each(function() { \t\t\t\t\t\t\t\tjQuery(this).addClass('ui-selected'); \t\t\t\t\t\t\t}); FUNC; $this->arySelectedItems = $aValues; QApplication::ExecuteJavascript($strJS); } catch (QInvalidCastException $objExc) { $objExc->IncrementOffset(); throw $objExc; } break; default: try { parent::__set($strName, $mixValue); break; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
public function dtgPersonsRow_Click($strFormId, $strControlId, $strParameter) { $intPersonId = intval($strParameter); $objPerson = Person::Load($intPersonId); QApplication::ExecuteJavascript("alert('You clicked on a person with ID #" . $intPersonId . ": " . $objPerson->FirstName . " " . $objPerson->LastName . "');"); }
protected function Polling_Process($strFormId, $strControlId, $strParameter) { if ($this->strPollingMethod) { $objObject = $this->objPollingParentObject ? $this->objPollingParentObject : $this; $strMethod = $this->strPollingMethod; $objObject->{$strMethod}(); QApplication::ExecuteJavascript(sprintf('qc.regPP("%s", %s);', $this->pxyPollingProxy->ControlId, $this->intPollingInterval)); } }
public function chkHoldAtLocationFlag_Click($strFormId, $strControlId, $strParameter) { if ($this->chkHoldAtLocationFlag->Checked) { QApplication::ExecuteJavascript('document.getElementById("HAL").style.display="";'); } else { QApplication::ExecuteJavascript('document.getElementById("HAL").style.display="none";'); } }
public function RemoveAllDropZones() { QApplication::ExecuteJavascript(sprintf('$j("#%s").draggable("option", "revert", "invalid");', $this->strControlId)); foreach ($this->objDropsControlsArray as $strControlId => $blnValue) { if ($blnValue) { $objControl = $this->objForm->GetControl($strControlId); if ($objControl) { $objControl->objIsDropZoneFor[$this->ControlId] = false; } } } $this->objDropsControlsArray = array(); }