Select Git revision
RangeFoldersCreate.php
Forked from
Stud.IP / Stud.IP
Source project has a limited visibility.
-
Jan-Hendrik Willms authoredJan-Hendrik Willms authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
WidgetHelper.php 12.55 KiB
<?php
/**
* WidgetHelper.php - utility functions for Widget-Parameter Handling
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* @author Nadine Werner <nadine.werner@uni-osnabrueck.de>
* @author André Klaßen <klassen@elan-ev.de>
* @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
* @category Stud.IP
* @package index
* @since 3.1
*/
class WidgetHelper
{
/**
* array of submitted widget parameter values
*/
private static $params = [];
/**
* array of submitted widget parameter values
*/
private static $activeWidget;
/**
* Saves the widget data of a user
*/
private static $userWidgets = [];
/**
* Set the last active Widget
* @param string $activeWidget
*/
public static function setActiveWidget($activeWidget)
{
self::$activeWidget = $activeWidget;
}
/**
* Returns the position in the two column layout on the Startpage
* If no position is stored in UserConfig, the widget will be displayed on the right side.
*
* @param string $pluginid
*
* @return the position as array matrix
*/
public static function getWidgetPosition($pluginid)
{
$query = "SELECT position FROM widget_user where id = ?";
$statement = DBManager::get()->prepare($query);
$statement->execute([$pluginid]);
$pos = $statement->fetchColumn();
return $pos;
}
/**
* storeNewPositions - stores new Widget positions for a given user
*
* @param array $lanes array with column as index and ids array as value
*
* @return void
*/
public static function storeNewPositions(array $lanes): void