13 $arGadgetParams = $arGadget[
"SETTINGS"];
14 $id = $arGadget[
"ID"];
17 include($arGadget[
"PATH"].
"/index.php");
18 return ob_get_clean();
21 public static function GetList($bWithParameters =
false, $arAllCurrentValues =
false)
30 foreach ($folders as $folder)
33 $arGdNS = static::getNamespaces(
$_SERVER[
"DOCUMENT_ROOT"] . $folder);
36 foreach ($arGdNS as
$NS)
39 if (is_dir($gdDir) && (
$handle = opendir($gdDir)))
41 while (
false !== ($file = readdir(
$handle)))
43 if ($file==
"." || $file==
"..")
47 $arGadgets[$file] = $arGadgetParams;
49 unset($arGadgets[$file]);
56 uasort($arGadgets, [
"BXGadget",
"_sort"]);
64 if (is_dir($gdDir) && (
$handle = opendir($gdDir)))
66 while (($item = readdir(
$handle)) !==
false)
68 if (is_dir($gdDir .
"/" . $item) && $item !=
"." && $item !=
".." && $item !=
"bitrix")
78 public static function _sort($ar1, $ar2)
80 return strcmp($ar1[
"NAME"], $ar2[
"NAME"]);
83 public static function GetById($id, $bWithParameters =
false, $arAllCurrentValues =
false)
93 if ((
$p = mb_strpos($id,
"/")) > 0)
96 $namespace = mb_substr($id, 0,
$p);
97 $id = mb_substr($id,
$p + 1);
102 foreach ($folders as $folder)
105 if ($namespace !=
'')
107 $arGdNS = [$namespace];
111 $arGdNS = static::getNamespaces(
$_SERVER[
"DOCUMENT_ROOT"] . $folder);
114 foreach ($arGdNS as
$NS)
116 $gdDir =
$_SERVER[
"DOCUMENT_ROOT"].$folder.
"/".
$NS;
117 $gdDirSiteRoot = $folder.
"/".
$NS;
118 if (is_dir($gdDir.
"/".$id))
124 if (!file_exists($gdDir.
"/".$id.
"/.description.php"))
127 if (!@include($gdDir.
"/".$id.
"/.description.php"))
133 if (isset($arDescription[
"LANG_ONLY"]) && $arDescription[
"LANG_ONLY"]!=LANGUAGE_ID)
139 if ($bWithParameters)
141 $arCurrentValues = [];
142 if (is_array($arAllCurrentValues))
144 foreach ($arAllCurrentValues as
$k => $v)
146 $pref =
"G_".mb_strtoupper($id).
"_";
147 if(str_starts_with(
$k, $pref))
148 $arCurrentValues[substr(
$k, strlen($pref))] = $v;
151 $pref =
"GU_".mb_strtoupper($id).
"_";
152 if(str_starts_with(
$k, $pref))
153 $arCurrentValues[substr(
$k, strlen($pref))] = $v;
162 if (file_exists($gdDir.
"/".$id.
"/.parameters.php"))
164 include($gdDir.
"/".$id.
"/.parameters.php");
166 $arDescription[
"PARAMETERS"] = $arParameters[
"PARAMETERS"] ?? [];
167 $arDescription[
"USER_PARAMETERS"] =
array(
168 "TITLE_STD" =>
array(
169 "NAME" =>
GetMessage(
"CMDESKTOP_UP_TITLE_STD"),
174 if (isset($arParameters[
"USER_PARAMETERS"]) && is_array($arParameters[
"USER_PARAMETERS"]))
176 $arDescription[
"USER_PARAMETERS"] = array_merge($arDescription[
"USER_PARAMETERS"], $arParameters[
"USER_PARAMETERS"]);
179 $arDescription[
"PATH"] = $gdDir.
"/".$id;
180 $arDescription[
"PATH_SITEROOT"] = $gdDirSiteRoot.
"/".$id;
182 $arDescription[
"ID"] = mb_strtoupper($id);
183 if ($arDescription[
"ICON"] && !str_starts_with($arDescription[
"ICON"],
"/"))
184 $arDescription[
"ICON"] =
"/bitrix/gadgets/".$NS.
"/".$id.
"/".$arDescription[
"ICON"];
186 unset($arDescription[
"NOPARAMS"]);
188 $arGadget = $arDescription;
201 $arNewUserOptions = [
"GADGETS" => []];
203 if (isset($arUserOptions[
"COLS"]))
205 $arNewUserOptions[
"COLS"] = $arUserOptions[
"COLS"];
207 if (isset($arUserOptions[
"arCOLUMN_WIDTH"]))
209 $arNewUserOptions[
"arCOLUMN_WIDTH"] = $arUserOptions[
"arCOLUMN_WIDTH"];
211 if (isset($arUserOptions[
"NAME"]))
213 $arNewUserOptions[
"NAME"] = $arUserOptions[
"NAME"];
218 foreach (
$items as $row => $gdId)
220 if(mb_substr($gdId, -2, 2) ==
"*H")
222 $gdId = mb_substr($gdId, 0, -2);
230 $arNewUserOptions[
"GADGETS"][$gdId] = $arUserOptions[
"GADGETS"][$gdId] ?? [];
231 $arNewUserOptions[
"GADGETS"][$gdId][
"COLUMN"] = $col;
232 $arNewUserOptions[
"GADGETS"][$gdId][
"ROW"] = $row;
233 $arNewUserOptions[
"GADGETS"][$gdId][
"HIDE"] = ($hidden?
"Y" :
"N");
263 $arUserOptionsDefault = CUserOptions::GetOption(
"intranet",
"~gadgets_".
$arParams[
"DEFAULT_ID"],
false, $user_option_id);
267 $user_option_id =
false;
268 $arUserOptionsDefault =
false;
271 $arUserOptions = CUserOptions::GetOption(
"intranet",
"~gadgets_".
$arParams[
"ID"], $arUserOptionsDefault, $user_option_id);
279 $desktopId =
"mainpage";
283 $desktopId =
"dashboard";
286 if ($desktopId !==
false)
288 $arUserOptions = CUserOptions::GetOption(
"intranet",
"~gadgets_".$desktopId);
292 if (!is_array($arUserOptions))
297 return $arUserOptions;
302 $arUserOptions = static::readSettings(
$arParams);
306 $arUserOptions = $arUserOptions[
$arParams[
"DESKTOP_PAGE"]];
309 return $arUserOptions[
"GADGETS"][$id][
"SETTINGS"] ?? [];
315 "DEFAULT_ID" => (
$arParams[
"DEFAULT_ID"] ?:
''),
317 "MULTIPLE" =>
$arParams[
"MULTIPLE"] ??
null,
318 "DESKTOP_PAGE" => (
int)(
$arParams[
"DESKTOP_PAGE"] ?? 0),
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
static getGadgetSettings($id, $arParams)
static readSettings(array $arParams)
static getNamespaces($gdDir)
static GetList($bWithParameters=false, $arAllCurrentValues=false)
static getDesktopParams($arParams)
static GetGadgetContent(&$arGadget, $arParams)
static SavePositions($arParams, $positions)
static writeSettings(array $options, array $arParams)
static GetById($id, $bWithParameters=false, $arAllCurrentValues=false)
static __IncludeLang($filePath, $fileName, $lang=false)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
while($row=$res->fetch()) $allOptions[]
$_SERVER["DOCUMENT_ROOT"]
const SITE_DIR(!defined('LANG'))
if(!defined('NOT_CHECK_PERMISSIONS')) $NS
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
GetMessage($name, $aReplace=null)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)