method sort documentation in bbn\Appui\Dashboard
Sorts the widgets' order
function(array $order)
  {
    if (!empty($order) && (bool)$this->id) {
      $changed = 0;
      if ($uDash = $this->getUserDashboard($this->id)) {
        $uCfg = Str::isJson($uDash[$this->archPref['cfg']]) ? json_decode($uDash[$this->archPref['cfg']], true) : [];
        if (!isset($uCfg['widgets'])) {
          $uCfg['widgets'] = [];
        }
        foreach ($order as $i => $k) {
          if (!isset($uCfg['widgets'][$k])) {
            $uCfg['widgets'][$k] = [];
          }
          if (!isset($uCfg['widgets'][$k][$this->archBits['num']])) {
            $uCfg['widgets'][$k][$this->archBits['num']] = 0;
          }
          if ($uCfg['widgets'][$k][$this->archBits['num']] !== $i + 1) {
            $uCfg['widgets'][$k][$this->archBits['num']] = $i + 1;
            $changed++;
          }
        }
        if ($changed && $this->pref->setCfg($uDash[$this->archPref['id']], $uCfg)) {
          return $changed;
        }
      } else {
        $cfg = ['widgets' => []];
        foreach ($order as $i => $k) {
          $cfg['widgets'][$k] = [$this->archBits['num'] => $i + 1];
        }
        if ($this->pref->shareWithUser($this->id, $this->user->getId())) {
          $idUsrDash = $this->db->lastId();
          if ($this->pref->setCfg($idUsrDash, $cfg)) {
            return count($cfg['widgets']);
          }
        }
      }
      return $changed;
    }
    return null;
  }
  Sorts the widgets' order BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
  
  
    
    
      
        
        
      
    
    
    
      
      
      
      
      
        
          
          
          
          
          
          
          
          
            
              
                
              
            
            
              
              This website uses cookies to ensure you get the best experience on our website.                
                
              
              
                
                
              
             
           
          
          
          
            
            © 2011-2025 
BBN Solutions