Пример #1
0
 public function numericComp($arg = null)
 {
     if ($arg === null) {
         return false;
     }
     //if ($this->compfield == 'assetdebtratio')  pkdebug("YES: SUCCESSFULLY GOT TO NUMERIC, ARG:", $arg,$this);
     //pkdebug("ArG",$arg,'this', $this);
     if (!is_numeric($this->val) || !is_numeric($arg)) {
         //throw new Exception ("[{$this->val}] or [$arg] is not numeric");
         return pkwarn("A PROBLEM: For thisMatch;", $this, 'this->val', $this->val, " or [arg] ", $arg, " is not numeric");
     }
     /** Restore to this clean state when debugged...
           if ($this->crit === '<' ) return $arg <  $this->val;
     
           if ($this->crit === '<=') return $arg <=  $this->val;
     
           if ($this->crit === '>=') return $arg >=  $this->val;
     
           if ($this->crit === '>')   return $arg >  $this->val;
           if ($this->crit === '=' ) return $arg == $this->val;
           if ($this->crit === '!=' ) return $arg != $this->val;
          * 
          */
     if ($this->crit === '<') {
         $res = $arg < $this->val;
         //if ($this->compfield == 'assetdebtratio')  pkdebug("adet: THIS:", $this, 'ARG', $arg, 'res', $res);
         return $res;
     }
     if ($this->crit === '<=') {
         $res = $arg <= $this->val;
         //if ($this->compfield == 'assetdebtratio') pkdebug("adet: THIS:", $this, 'ARG', $arg, 'res', $res);
         return $res;
     }
     if ($this->crit === '>=') {
         $res = $arg >= $this->val;
         //if ($this->compfield == 'assetdebtratio') pkdebug("adet: THIS:", $this, 'ARG', $arg, 'res', $res);
         return $res;
     }
     if ($this->crit === '>') {
         $res = $arg > $this->val;
         //if ($this->compfield == 'assetdebtratio') pkdebug("adet: THIS:", $this, 'ARG', $arg, 'res', $res);
         return $res;
     }
     if ($this->crit === '=') {
         $res = $arg == $this->val;
         //if ($this->compfield == 'assetdebtratio') pkdebug("adet: THIS:", $this, 'ARG', $arg, 'res', $res);
         return $res;
     }
     if ($this->crit === '!=') {
         $res = $arg != $this->val;
         //if ($this->compfield == 'assetdebtratio') pkdebug("adet: THIS:", $this, 'ARG', $arg, 'res', $res);
         return $res;
     }
     throw new Exception("Unknown [{$this->crit}] for comptype: {$this->comptype}");
 }
Пример #2
0
 /** Examines session('errorBag') - if empty, nothing, else creates pop up
  * qQuery dialog box with error content
  */
 public static function mkErrorPopUp()
 {
     //$errorMsgBag = session('errorBag');
     //$errorMsgBag = session('errors');
     $errorSet = session('errors');
     if (!$errorSet) {
         return null;
     }
     if ($errorSet instanceof ViewErrorBag) {
         $errorBags = $errorSet->getBags();
     } else {
         if ($errorSet instanceof MessageBag) {
             $errorBags = [$errorSet];
         }
     }
     $allMsgs = [];
     foreach ($errorBags as $errorBag) {
         foreach ($errorBag->all() as $msg) {
             $allMsgs[] = $msg;
         }
     }
     //    $errors = $errorMsgBag->get('error');
     if (!$allMsgs || !is_array($allMsgs)) {
         pkwarn("Got an Error Msg bag with invalid 'errors':", $allMsgs);
         return null;
     }
     $errorItems = new PkHtmlRenderer();
     foreach ($allMsgs as $error) {
         $errorItems->rawli($error);
     }
     $errorList = PkRenderer::ul($errorItems, 'popup error-list');
     $errorMsgOut = PkRenderer::div($errorList, ['class' => "error-popup-box", 'data-title' => "Notice:", 'data-dialogClass' => 'pk-warn-dlg error-dlg-box']);
     /*
             [
             PkRenderer::div("The following errors occurred",'error-head'),
             $errorList,
         ]
     * 
             $errorList,
             ,['class'=>"error-popup-box", 'data-title'=>"The following Errors Occurred", 'data-dialogClass'=>'error-dlg-box']);
     */
     return static::mkPopUp($errorMsgOut);
 }