Beispiel #1
0
 public static function resetAllPriorityByPosition($position)
 {
     $widgets = WidgetObject::loadByPosition($position);
     $activates = self::loadAllActivate($position, true);
     $max = count($activates) + 1;
     foreach ($widgets as $k => $w) {
         if ($w->activate == 1) {
             if ($w->priority == 0) {
                 $w->priority = $max;
                 $max++;
                 $w->save();
             } else {
                 if ($w->priority > $k + 1) {
                     $w->priority = $k + 1;
                     $w->save();
                 }
             }
         } else {
             if ($w->activate == 0 and $w->priority != 0) {
                 $w->priority = 0;
                 $w->save();
             }
         }
     }
 }
Beispiel #2
0
 public static function uninstallWidgetPage($widgetName)
 {
     $widget = new WidgetObject();
     if ($widget->load($widgetName)) {
         if ($widget->uninstall($widget)) {
             header("location: " . Page::url("/admin/view/widget/"));
         } else {
             header("location: " . Page::url("/admin/view/widget/?err=install"));
         }
     } else {
         header("location: " . Page::url("/admin/view/widget/?err=unknown"));
     }
     return;
 }