Example #1
0
 public function run()
 {
     $this->id = $this->getId();
     FontAwesomeAsset::register($this->getView());
     ActiveAssets::register($this->getView());
     if (self::$counterPanelCount == 1 && $this->format) {
         $this->getView()->registerJs('
             function panelCountFormat(number, decimals, dec_point, thousands_sep ) 
             {
                 var i, j, kw, kd, km;
                 if( isNaN(decimals = Math.abs(decimals)) ){
                     decimals = 2;
                 }
                 if( dec_point == undefined ){
                     dec_point = ",";
                 }
                 if( thousands_sep == undefined ){
                     thousands_sep = ".";
                 }
                 i = parseInt(number = (+number || 0).toFixed(decimals)) + "";
                 if( (j = i.length) > 3 ){
                     j = j % 3;
                 } else{
                     j = 0;
                 }
                 km = (j ? i.substr(0, j) + thousands_sep : "");
                 kw = i.substr(j).replace(/(\\d{3})(?=\\d)/g, "$1" + thousands_sep);
                 kd = (decimals ? dec_point + Math.abs(number - i).toFixed(decimals).replace(/-/, 0).slice(2) : "");
                 return km + kw + kd;
             }
         ', \yii\web\View::POS_BEGIN);
     }
     self::$counterPanelCount++;
     return $this->getView()->render('@keygenqt/panelCount/views/view', ['widget' => $this]);
 }
 public function run()
 {
     FontAwesomeAsset::register($this->getView());
     ActiveAssets::register($this->getView());
     if ($this->backLink) {
         $exist = false;
         $class = \Yii::$app->controller;
         while (($class = get_parent_class($class)) !== false) {
             if ('keygenqt\\lastPage\\LastPage' == $class) {
                 $exist = true;
                 break;
             }
         }
         if (!$exist) {
             $className = preg_replace('/.+\\\\(.+)/ui', '$1', get_class(\Yii::$app->controller));
             $classNamespase = preg_replace('/(.+)\\\\.+/ui', '$1', get_class(\Yii::$app->controller));
             throw new \yii\base\Exception("Сonnect LastPage (more: https://github.com/keygenqt/yii2-last-page)\n\n                    namespace {$classNamespase};\n\n                    class {$className} extends \\keygenqt\\lastPage\\LastPage {\n                    ...\n                ");
         }
     }
     return $this->getView()->render('@keygenqt/breadcrumbsPanel/views/view', ['widget' => $this]);
 }