コード例 #1
0
 public function __set($strName, $mixValue)
 {
     switch ($strName) {
         case '_ResizeData':
             // Internal only. Do not use. Called by JS above to keep track of user selection.
             try {
                 $data = QType::Cast($mixValue, QType::String);
                 $a = explode(",", $data);
                 $this->aryOriginalSize['width'] = $a[0];
                 $this->aryOriginalSize['height'] = $a[1];
                 $this->aryNewSize['width'] = $a[2];
                 $this->aryNewSize['height'] = $a[3];
                 // update dimensions
                 $this->strWidth = $this->aryNewSize['width'];
                 $this->strHeight = $this->aryNewSize['height'];
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         default:
             try {
                 parent::__set($strName, $mixValue);
                 break;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
コード例 #2
0
 public function __set($strName, $mixValue)
 {
     switch ($strName) {
         case "Lat":
             try {
                 return $this->fltLat = QType::Cast($mixValue, QType::Float);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case "Long":
             try {
                 return $this->fltLong = QType::Cast($mixValue, QType::Float);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         default:
             try {
                 return parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
コード例 #3
0
 public function __set($strName, $mixValue)
 {
     switch ($strName) {
         case '_ResizeData':
             // Internal only. Do not use. Called by qcubed.resizable to keep track of changes.
             try {
                 $data = QType::Cast($mixValue, QType::ArrayType);
                 $this->aryOriginalSize = $data['originalSize'];
                 $this->aryNewSize = $data['size'];
                 // update dimensions
                 $this->Width = $this->aryNewSize['width'];
                 $this->Height = $this->aryNewSize['height'];
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         default:
             try {
                 parent::__set($strName, $mixValue);
                 break;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
コード例 #4
0
ファイル: QTypeTests.php プロジェクト: tomVertuoz/framework
 public function testCasting()
 {
     define('_FAIL_', 'fail');
     $cases = array(array("25.0", "25.0", (double) 25.0, QType::Float), array("25.1", "25.1", (double) 25.1, QType::Float), array(25.0, "25.0", (double) 25.0, QType::Float), array(25.1, "25.1", (double) 25.1, QType::Float), array(true, "true", _FAIL_, QType::Float), array("true", "true", _FAIL_, QType::Float), array(false, "false", _FAIL_, QType::Float), array("false", "false", _FAIL_, QType::Float), array(1, "1", (double) 1, QType::Float), array(0, "0", (double) 0, QType::Float), array("1", "1", (double) 1, QType::Float), array("0", "0", (double) 0, QType::Float), array("25", "25", (double) 25, QType::Float), array(25, "25", (double) 25, QType::Float), array(34.51666666667, "34.51666666667", (double) 34.51666666667, QType::Float), array(2147483648, "2147483648", (double) 2147483648, QType::Float), array(-2147483648, "-2147483648", (double) -2147483648, QType::Float), array(-2147483649, "-2147483649", (double) -2147483649, QType::Float), array("34.51666666667", "34.51666666667", (double) 34.51666666667, QType::Float), array("2147483648", "2147483648", (double) 2147483648.0, QType::Float), array("-2147483648", "-2147483648", (double) -2147483648.0, QType::Float), array("-2147483649", "-2147483649", (double) -2147483649.0, QType::Float), array("25.0", "25.0", _FAIL_, QType::Integer), array("25.1", "25.1", _FAIL_, QType::Integer), array(25.0, "25.0", (int) 25, QType::Integer), array(25.1, "25.1", _FAIL_, QType::Integer), array(true, "true", _FAIL_, QType::Integer), array("true", "true", _FAIL_, QType::Integer), array(false, "false", _FAIL_, QType::Integer), array("false", "false", _FAIL_, QType::Integer), array(1, "1", 1, QType::Integer), array(0, "0", 0, QType::Integer), array("1", "1", 1, QType::Integer), array("0", "0", 0, QType::Integer), array("25", "25", 25, QType::Integer), array(25, "25", 25, QType::Integer), array(34.51666666667, "34.51666666667", _FAIL_, QType::Integer), array(2147483648, "2147483648", 2147483648, QType::Integer), array(-2147483648, "-2147483648", (int) -2147483648, QType::Integer), array(-2147483649, "-2147483649", -2147483649, QType::Integer), array("34.51666666667", "34.51666666667", _FAIL_, QType::Integer), array("2147483648", "2147483648", 2147483648, QType::Integer), array("-2147483648", "-2147483648", (int) -2147483648, QType::Integer), array("-2147483649", "-2147483649", -2147483649, QType::Integer), array(1.8446744073709552E+21, "1844674407370955161616", (double) 1.8446744073709552E+21, QType::Float), array(1.8446744073709552E+21, "1844674407370955161616", "fail", QType::Integer), array("1844674407370955161616", "1844674407370955161616", "1844674407370955161616", QType::Float), array("1844674407370955161616", "1844674407370955161616", "1844674407370955161616", QType::Integer), array(6, '6', '6', QType::String), array(6.94, '6.94', '6.94', QType::String), array(0.694 * 10, '6.94', '6.94', QType::String));
     foreach ($cases as $case) {
         $value = (string) $case[1] . '(' . gettype($case[0]) . ')';
         if ($case[2] === _FAIL_) {
             try {
                 QType::Cast($case[0], $case[3]);
                 $this->fail("Excepted exception was not thrown casting " . $value . " to " . $case[3]);
             } catch (QInvalidCastException $e) {
                 $this->pass("Casting " . $value . " to " . $case[3] . " caused a QInvalidCastException");
                 unset($e);
             }
         } else {
             try {
                 $castValue = QType::Cast($case[0], $case[3]);
                 $newValue = $castValue . '(' . gettype($castValue) . ')';
                 $this->assertIdentical($castValue, $case[2], "{$value} cast as a " . $case[3] . " is {$newValue}");
             } catch (Exception $e) {
                 $this->fail("Exception caused when casting {$value} to " . $case[3] . ": {$e->getMessage()}");
             }
         }
     }
 }
コード例 #5
0
 public function __set($strName, $mixValue)
 {
     $this->blnModified = true;
     switch ($strName) {
         // APPEARANCE
         case "Text":
             try {
                 $this->strText = QType::Cast($mixValue, QType::String);
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case "HtmlEntities":
             try {
                 $this->blnHtmlEntities = QType::Cast($mixValue, QType::Boolean);
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         default:
             try {
                 parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
     }
 }
コード例 #6
0
ファイル: _events.php プロジェクト: schematical/MJax-Includes
 public function __set($strName, $mixValue)
 {
     switch ($strName) {
         case "Once":
             try {
                 return $this->blnOnce = QType::Cast($mixValue, QType::Boolean);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case "Rendered":
             try {
                 return $this->blnRendered = QType::Cast($mixValue, QType::Boolean);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case "KeyCode":
             try {
                 return $this->strKeyCode = $mixValue;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         default:
             try {
                 return parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
コード例 #7
0
 public function __set($strName, $mixValue)
 {
     $this->blnModified = true;
     switch ($strName) {
         case "Query":
             try {
                 $this->strQuery = QType::Cast($mixValue, QType::String);
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case "TotalQuery":
             try {
                 $this->strTotalQuery = QType::Cast($mixValue, QType::String);
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         default:
             try {
                 parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
     }
 }
コード例 #8
0
 public function __set($strName, $mixValue)
 {
     switch ($strName) {
         case '_SelectedIndex':
             // Internal Only. Used by JS above. Do Not Call.
             try {
                 $this->mixActive = QType::Cast($mixValue, QType::Integer);
                 // will cause ->Active getter to always return index of content item that is currently active
             } catch (QInvalidCastException $objExc) {
                 try {
                     $this->mixActive = QType::Cast($mixValue, QType::Boolean);
                 } catch (QInvalidCastException $objExc) {
                     $objExc->IncrementOffset();
                     throw $objExc;
                 }
             }
             break;
         default:
             try {
                 parent::__set($strName, $mixValue);
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
     }
 }
コード例 #9
0
 public function __set($strName, $mixValue)
 {
     switch ($strName) {
         case "Value":
             try {
                 return $this->strValue = QType::Cast($mixValue, QType::String);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case "Text":
             try {
                 return $this->strText = QType::Cast($mixValue, QType::String);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case "Selected":
             try {
                 return $this->blnSelected = QType::Cast($mixValue, QType::Boolean);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         default:
             try {
                 return parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
コード例 #10
0
 public function __set($strName, $mixValue)
 {
     //$this->blnModified = true;
     switch ($strName) {
         case "ReadyFunction":
             // The name of a javascript function to call after the CKEditor instance is ready, so that you can do further initialization
             // This function will receive the formId and controlId as parameters, and "this" will be the ckeditor instance.
             try {
                 $this->strJsReadyFunc = \QType::Cast($mixValue, \QType::String);
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
         case "Configuration":
             // The configuration string. Could be a name of an object, or a javascript object (sourrounded by braces {})
             try {
                 $this->strConfiguration = \QType::Cast($mixValue, \QType::String);
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
         default:
             try {
                 parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
     }
 }
コード例 #11
0
 /**
  * Sets up the base-level configuration properties for this database,
  * namely DB Profiling and Database Index
  *
  * @param integer $intDatabaseIndex
  * @return void
  */
 protected function ConfigureBaseProperties($intDatabaseIndex)
 {
     // Setup DatabaseIndex
     $this->intDatabaseIndex = $intDatabaseIndex;
     // Setup Profiling Array (if applicable)
     $this->blnEnableProfiling = QType::Cast(QApplication::$ConnectionStringArray[$intDatabaseIndex]['profiling'], QType::Boolean);
     if ($this->blnEnableProfiling) {
         $this->strProfileArray = array();
     }
 }
コード例 #12
0
 public function __construct($strKey = null, $blnBase64 = null, $strCipher = null, $strMode = null)
 {
     // Get the Key
     if (is_null($strKey)) {
         $strKey = self::$Key;
     }
     // Get the Base64 Flag
     try {
         if (is_null($blnBase64)) {
             $this->blnBase64 = QType::Cast(self::$Base64, QType::Boolean);
         } else {
             $this->blnBase64 = QType::Cast($blnBase64, QType::Boolean);
         }
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
     // Get the Cipher
     if (is_null($strCipher)) {
         $strCipher = self::$Cipher;
     }
     // Get the Mode
     if (is_null($strMode)) {
         $strMode = self::$Mode;
     }
     $this->objMcryptModule = mcrypt_module_open($strCipher, null, $strMode, null);
     if (!$this->objMcryptModule) {
         throw new QCryptographyException('Unable to open LibMcrypt Module');
     }
     // Determine IV Size
     $intIvSize = mcrypt_enc_get_iv_size($this->objMcryptModule);
     // Create the IV
     if (self::$RandomSource != MCRYPT_RAND) {
         // Ignore All Warnings
         set_error_handler('QcodoHandleError', 0);
         $intCurrentLevel = error_reporting();
         error_reporting(0);
         $strIv = mcrypt_create_iv($intIvSize, self::$RandomSource);
         error_reporting($intCurrentLevel);
         restore_error_handler();
         // If the RandomNumGenerator didn't work, we revert back to using MCRYPT_RAND
         if (strlen($strIv) != $intIvSize) {
             srand();
             $strIv = mcrypt_create_iv($intIvSize, MCRYPT_RAND);
         }
     } else {
         srand();
         $strIv = mcrypt_create_iv($intIvSize, MCRYPT_RAND);
     }
     $this->strIv = $strIv;
     // Determine KeySize length
     $intKeySize = mcrypt_enc_get_key_size($this->objMcryptModule);
     // Create the Key Based on Key Passed In
     $this->strKey = substr(md5($strKey), 0, $intKeySize);
 }
コード例 #13
0
 public function ParsePostData()
 {
     // Check to see if this Control's Value was passed in via the POST data
     if (array_key_exists($this->strControlId, $_FILES) && $_FILES[$this->strControlId]['tmp_name']) {
         // It was -- update this Control's value with the new value passed in via the POST arguments
         $this->strFileName = $_FILES[$this->strControlId]['name'];
         $this->strType = $_FILES[$this->strControlId]['type'];
         $this->intSize = QType::Cast($_FILES[$this->strControlId]['size'], QType::Integer);
         $this->strFile = $_FILES[$this->strControlId]['tmp_name'];
     }
 }
コード例 #14
0
 private static function Initialize()
 {
     self::$intDbIndex = QType::Cast(self::$intDbIndex, QType::Integer);
     self::$strTableName = QType::Cast(self::$strTableName, QType::String);
     // If the database index exists
     if (!array_key_exists(self::$intDbIndex, QApplication::$Database)) {
         throw new QCallerException('No database defined at DB_CONNECTION index ' . self::$intDbIndex . '. Correct your settings in configuration.inc.php.');
     }
     $objDatabase = QApplication::$Database[self::$intDbIndex];
     // see if the database contains a table with desired name
     if (!in_array(self::$strTableName, $objDatabase->GetTables())) {
         throw new QCallerException('Table ' . self::$strTableName . ' not found in database at DB_CONNECTION index ' . self::$intDbIndex . '. Correct your settings in configuration.inc.php.');
     }
 }
コード例 #15
0
    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;
                }
        }
    }
コード例 #16
0
 public function __set($strName, $mixValue)
 {
     switch ($strName) {
         case '_DragData':
             // Internal only. Do not use. Used by JS above to keep track of user selection.
             try {
                 $data = QType::Cast($mixValue, QType::String);
                 $a = explode(",", $data);
                 $this->aryOriginalPosition['left'] = $a[0];
                 $this->aryOriginalPosition['top'] = $a[1];
                 $this->aryNewPosition['left'] = $a[2];
                 $this->aryNewPosition['top'] = $a[3];
                 // update parent's coordinates
                 $this->objParentControl->strTop = $this->aryNewPosition['top'];
                 $this->objParentControl->strLeft = $this->aryNewPosition['left'];
                 break;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Handle':
             // Override to let you set the handle to:
             //	a QControl, or selector, or array of QControls or selectors
             if ($mixValue instanceof QControl) {
                 parent::__set($strName, '#' . $mixValue->ControlId);
             } elseif (is_array($mixValue)) {
                 $aHandles = array();
                 foreach ($mixValue as $mixItem) {
                     if ($mixItem instanceof QControl) {
                         $aHandles[] = '#' . $mixItem->ControlId;
                     } elseif (is_string($mixItem)) {
                         $aHandles[] = $mixItem;
                     }
                 }
                 parent::__set($strName, join(',', $aHandles));
             } else {
                 parent::__set($strName, $mixValue);
             }
             break;
         default:
             try {
                 parent::__set($strName, $mixValue);
                 break;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
コード例 #17
0
 public function __set($strName, $mixValue)
 {
     switch ($strName) {
         case "Target":
             try {
                 return $this->objTarget = $mixValue;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case "Function":
             try {
                 return $this->strFunction = QType::Cast($mixValue, QType::String);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case "UseAjax":
             try {
                 $this->blnUseAjax = QType::Cast($mixValue, QType::Boolean);
                 if ($this->blnUseAjax) {
                     $this->AddAction(new MJaxKeyUpEvent(), new MJaxServerControlAction($this, "txtAutoComplete_change"));
                 } else {
                     $this->RemoveAllActions('keyup');
                 }
                 return;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case "Data":
             try {
                 if (!$this->blnUseAjax) {
                     $this->ApplyPlugin(new MJaxAutoCompletePlugin($this->objForm, $mixValue));
                 }
                 return;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         default:
             try {
                 return parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
コード例 #18
0
ファイル: NarroPlugin.class.php プロジェクト: Jobava/narro
 public function __get($strName)
 {
     switch ($strName) {
         case "Errors":
             return $this->arrErrors;
         case "Error":
             return QType::Cast(count($this->arrErrors), QType::Boolean);
         case "Name":
             return $this->strName;
         case "Enable":
             return $this->blnEnable;
         default:
             throw new QUndefinedPropertyException("GET", __CLASS__, $strName);
     }
 }
コード例 #19
0
 /**
  * @param QQColumnNode $objQueryNode
  * @param string       $strValue
  *
  * @throws Exception
  * @throws QCallerException
  * @throws QInvalidCastException
  */
 public function __construct(QQColumnNode $objQueryNode, $strValue)
 {
     parent::__construct($objQueryNode);
     if ($strValue instanceof QQNamedValue) {
         $this->mixOperand = $strValue;
     } else {
         try {
             $this->mixOperand = QType::Cast($strValue, QType::String);
         } catch (QCallerException $objExc) {
             $objExc->IncrementOffset();
             $objExc->IncrementOffset();
             throw $objExc;
         }
     }
 }
コード例 #20
0
 public function ParsePostData()
 {
     // Check to see if this Control's Value was passed in via the POST data
     // Added the tmp_name condition because it was submitting the Control even when empty
     // Mike Ho recognized it as a bug and will be fixing it in the next release
     if (array_key_exists($this->strControlId, $_FILES) && $_FILES[$this->strControlId]['tmp_name']) {
         // It was -- update this Control's value with the new value passed in via the POST arguments
         if ($_FILES[$this->strControlId]['name']) {
             $this->strFileName = $_FILES[$this->strControlId]['name'];
             $this->strType = $_FILES[$this->strControlId]['type'];
             $this->intSize = QType::Cast($_FILES[$this->strControlId]['size'], QType::Integer);
             $this->strFile = $_FILES[$this->strControlId]['tmp_name'];
         }
     }
 }
コード例 #21
0
 /**
  * 
  */
 protected function GetTimeProfilingInfo()
 {
     if ($this->IsProfilingSupported() && $this->blnEnableProfiling) {
         $objProfilingResult = $this->Query('SHOW PROFILE;');
         $arrTimeInfo = array();
         $fltQueryTime = 0;
         while ($mixRow = $objProfilingResult->FetchRow()) {
             $arrTimeInfo[$mixRow[0]] = $mixRow[1];
             $fltQueryTime += QType::Cast($mixRow[1], QType::Float);
         }
         $arrTimeInfo['total time'] = round($fltQueryTime, 4);
         return $arrTimeInfo;
     } else {
         return null;
     }
 }
コード例 #22
0
 public function testCasting()
 {
     define('_FAIL_', 'fail');
     $cases = array(array("25.0", "25.0", (double) 25.0, QType::Float), array("25.1", "25.1", (double) 25.1, QType::Float), array(25.0, "25.0", (double) 25.0, QType::Float), array(25.1, "25.1", (double) 25.1, QType::Float), array(true, "true", _FAIL_, QType::Float), array("true", "true", _FAIL_, QType::Float), array(false, "false", _FAIL_, QType::Float), array("false", "false", _FAIL_, QType::Float), array(1, "1", (double) 1, QType::Float), array(0, "0", (double) 0, QType::Float), array("1", "1", (double) 1, QType::Float), array("0", "0", (double) 0, QType::Float), array("25", "25", (double) 25, QType::Float), array(25, "25", (double) 25, QType::Float), array(34.51666666667, "34.51666666667", (double) 34.51666666667, QType::Float), array(2147483648, "2147483648", (double) 2147483648, QType::Float), array(-2147483648, "-2147483648", (double) -2147483648, QType::Float), array(-2147483649, "-2147483649", (double) -2147483649, QType::Float), array("34.51666666667", "34.51666666667", (double) 34.51666666667, QType::Float), array("2147483648", "2147483648", (double) 2147483648.0, QType::Float), array("-2147483648", "-2147483648", (double) -2147483648.0, QType::Float), array("-2147483649", "-2147483649", (double) -2147483649.0, QType::Float), array("25.0", "25.0", _FAIL_, QType::Integer), array("25.1", "25.1", _FAIL_, QType::Integer), array(25.0, "25.0", (int) 25, QType::Integer), array(25.1, "25.1", _FAIL_, QType::Integer), array(true, "true", _FAIL_, QType::Integer), array("true", "true", _FAIL_, QType::Integer), array(false, "false", _FAIL_, QType::Integer), array("false", "false", _FAIL_, QType::Integer), array(1, "1", 1, QType::Integer), array(0, "0", 0, QType::Integer), array("1", "1", 1, QType::Integer), array("0", "0", 0, QType::Integer), array("25", "25", 25, QType::Integer), array(25, "25", 25, QType::Integer), array(34.51666666667, "34.51666666667", _FAIL_, QType::Integer), array(2147483648, "2147483648", 2147483648, QType::Integer), array(-2147483648, "-2147483648", (int) -2147483648, QType::Integer), array(-2147483649, "-2147483649", -2147483649, QType::Integer), array("34.51666666667", "34.51666666667", _FAIL_, QType::Integer), array("2147483648", "2147483648", 2147483648, QType::Integer), array("-2147483648", "-2147483648", (int) -2147483648, QType::Integer), array("-2147483649", "-2147483649", -2147483649, QType::Integer), array(1.8446744073709552E+21, "1844674407370955161616", (double) 1.8446744073709552E+21, QType::Float), array(1.8446744073709552E+21, "1844674407370955161616", "fail", QType::Integer), array("1844674407370955161616", "1844674407370955161616", "1844674407370955161616", QType::Float), array("1844674407370955161616", "1844674407370955161616", "1844674407370955161616", QType::Integer), array(6, '6', '6', QType::String), array(6.94, '6.94', '6.94', QType::String), array(0.694 * 10, '6.94', '6.94', QType::String));
     foreach ($cases as $case) {
         $value = (string) $case[1] . '(' . gettype($case[0]) . ')';
         if ($case[2] === _FAIL_) {
             $this->setExpectedException('QInvalidCastException');
             QType::Cast($case[0], $case[3]);
             $this->setExpectedException(null);
         } else {
             $castValue = QType::Cast($case[0], $case[3]);
             $newValue = $castValue . '(' . gettype($castValue) . ')';
             $this->assertTrue($castValue === $case[2], "{$value} cast as a " . $case[3] . " is {$newValue}");
         }
     }
 }
コード例 #23
0
ファイル: _events.inc.php プロジェクト: hiptc/dle2wordpress
 public function __construct($intDelay = 0, $strCondition = null)
 {
     try {
         if ($intDelay) {
             $this->intDelay = QType::Cast($intDelay, QType::Integer);
         }
         if ($strCondition) {
             if ($this->strCondition) {
                 $this->strCondition = sprintf('(%s) && (%s)', $this->strCondition, $strCondition);
             } else {
                 $this->strCondition = QType::Cast($strCondition, QType::String);
             }
         }
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }
コード例 #24
0
 /**
  * A checkbox in the column was clicked. The parent datagrid routes checkbox clicks to this function. Not for
  * general consumption.
  *
  * We are detecting every click, rather than using ParsePostData, because in a multi-user environment,
  * post data can be stale. Also, post data only tells us what is turned on, not what is turned off, and
  * so we would need to query the database to see what is missing from the post data to know what should be
  * turned off. This could be tricky, as the list of visible items might have changed.
  *
  * Known issue: If you do the following things, the check all box is not checked:
  * 	- Click check all, then uncheck one item, then recheck that item. To fix would require querying the entire
  *    list every time one item is checked. Not important enough to slow things down like that.
  * - Click check all, then refresh the page. This is actually by design, because in a multi-user environment,
  *   if you refresh the page, you may get new items in the list which the previous check all click would not have
  *   checked.
  *
  * @param $strParameter
  */
 public function Click($strParameter)
 {
     $blnChecked = QType::Cast($strParameter['checked'], QType::Boolean);
     $idItems = explode('_', $strParameter['id']);
     $strItemId = end($idItems);
     if ($strItemId == 'all') {
         $this->CheckAll($blnChecked);
         $this->blnAllChecked = $blnChecked;
     } else {
         $this->SetItemCheckedState($strItemId, $blnChecked);
         if (!$blnChecked) {
             $this->blnAllChecked = false;
         }
         // since we are in a datagrid, we would have to query all the data to know whether checking one item
         // leaves the control in a state where all the items are checked. This is a lot of work to save the
         // user one extra click.
     }
 }
コード例 #25
0
 public function __set($strName, $mixValue)
 {
     switch ($strName) {
         case "Href":
             try {
                 return $this->Attr('href', QType::Cast($mixValue, QType::String));
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         default:
             try {
                 return parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
コード例 #26
0
 public function __set($strName, $mixValue)
 {
     switch ($strName) {
         case 'CodeCssClass':
             try {
                 return $this->strCodeCssClass = QType::Cast($mixValue, QType::String);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 return $objExc;
             }
         default:
             try {
                 return parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 return $objExc;
             }
     }
 }
コード例 #27
0
 public function __set($strName, $mixValue)
 {
     switch ($strName) {
         case "TriggerNow":
             try {
                 return $this->blnTriggerNow = QType::Cast($mixValue, QType::Boolean);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         default:
             try {
                 return parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
コード例 #28
0
ファイル: QCalendar.class.php プロジェクト: sigeal/qcodo
 public function __set($strName, $mixValue)
 {
     $this->blnModified = true;
     switch ($strName) {
         case 'CalendarImageSource':
             try {
                 return $this->strCalendarImageSource = QType::Cast($mixValue, QType::Integer);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         default:
             try {
                 return parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
コード例 #29
0
 public function __set($strName, $mixValue)
 {
     $this->blnModified = true;
     switch ($strName) {
         case "Checked":
             try {
                 return $this->blnChecked = QType::Cast($mixValue, QType::Boolean);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         default:
             try {
                 return parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
コード例 #30
0
ファイル: QIndex.class.php プロジェクト: RCorbet/zf-codo
 /**
  * Override method to perform a property "Set"
  * This will set the property $strName to be $mixValue
  *
  * @param string strName Name of the property to set
  * @param string mixValue New value of the property
  * @return mixed
  */
 public function __set($strName, $mixValue)
 {
     try {
         switch ($strName) {
             case 'KeyName':
                 return $this->strKeyName = QType::Cast($mixValue, QType::String);
             case 'Unique':
                 return $this->blnUnique = QType::Cast($mixValue, QType::Boolean);
             case 'PrimaryKey':
                 return $this->blnPrimaryKey = QType::Cast($mixValue, QType::Boolean);
             case 'ColumnNameArray':
                 return $this->strColumnNameArray = QType::Cast($mixValue, QType::ArrayType);
             default:
                 return parent::__set($strName, $mixValue);
         }
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }