repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1 value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplayGroup.php | XiboDisplayGroup.delete | public function delete()
{
$this->getLogger()->info('Deleting Display Group ID ' . $this->displayGroupId);
$this->doDelete('/displaygroup/' . $this->displayGroupId);
return true;
} | php | public function delete()
{
$this->getLogger()->info('Deleting Display Group ID ' . $this->displayGroupId);
$this->doDelete('/displaygroup/' . $this->displayGroupId);
return true;
} | [
"public",
"function",
"delete",
"(",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Deleting Display Group ID '",
".",
"$",
"this",
"->",
"displayGroupId",
")",
";",
"$",
"this",
"->",
"doDelete",
"(",
"'/displaygroup/'",
".",
"$"... | Delete the display group.
@return bool | [
"Delete",
"the",
"display",
"group",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplayGroup.php#L148-L154 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplayGroup.php | XiboDisplayGroup.assignDisplay | public function assignDisplay($displayId)
{
$this->getLogger()->info('Assigning display ID ' . json_encode($displayId) . ' To display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/display/assign', [
'displayId' => $displayId
]);
return $this;
} | php | public function assignDisplay($displayId)
{
$this->getLogger()->info('Assigning display ID ' . json_encode($displayId) . ' To display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/display/assign', [
'displayId' => $displayId
]);
return $this;
} | [
"public",
"function",
"assignDisplay",
"(",
"$",
"displayId",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Assigning display ID '",
".",
"json_encode",
"(",
"$",
"displayId",
")",
".",
"' To display Group ID '",
".",
"$",
"this",
... | Assign display to the display group.
@param array|int $displayId Display ID to assign
@return XiboDisplayGroup | [
"Assign",
"display",
"to",
"the",
"display",
"group",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplayGroup.php#L162-L170 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplayGroup.php | XiboDisplayGroup.unassignDisplay | public function unassignDisplay($displayId)
{
$this->getLogger()->info('Unassigning display ID ' . json_encode($displayId) . ' From display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/display/unassign', [
'displayId' => $displayId
]);
return $this;
} | php | public function unassignDisplay($displayId)
{
$this->getLogger()->info('Unassigning display ID ' . json_encode($displayId) . ' From display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/display/unassign', [
'displayId' => $displayId
]);
return $this;
} | [
"public",
"function",
"unassignDisplay",
"(",
"$",
"displayId",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Unassigning display ID '",
".",
"json_encode",
"(",
"$",
"displayId",
")",
".",
"' From display Group ID '",
".",
"$",
"thi... | Unassign display from display group.
@param array|int $displayId The Display ID to unassign
@return XiboDisplayGroup | [
"Unassign",
"display",
"from",
"display",
"group",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplayGroup.php#L178-L186 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplayGroup.php | XiboDisplayGroup.assignDisplayGroup | public function assignDisplayGroup($displayGroupId)
{
$this->getLogger()->info('Assigning display Group ID ' . json_encode($displayGroupId) . ' To display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/displayGroup/assign', [
'displayGroupId' => $displayGroupId
]);
return $this;
} | php | public function assignDisplayGroup($displayGroupId)
{
$this->getLogger()->info('Assigning display Group ID ' . json_encode($displayGroupId) . ' To display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/displayGroup/assign', [
'displayGroupId' => $displayGroupId
]);
return $this;
} | [
"public",
"function",
"assignDisplayGroup",
"(",
"$",
"displayGroupId",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Assigning display Group ID '",
".",
"json_encode",
"(",
"$",
"displayGroupId",
")",
".",
"' To display Group ID '",
"."... | Assign display group to a display group.
@param array|int $displayGroupId The Display Group ID to assign
@return XiboDisplayGroup | [
"Assign",
"display",
"group",
"to",
"a",
"display",
"group",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplayGroup.php#L194-L201 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplayGroup.php | XiboDisplayGroup.unassignDisplayGroup | public function unassignDisplayGroup($displayGroupId)
{
$this->getLogger()->info('Unassigning display Group ID ' . json_encode($displayGroupId) . ' From display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/displayGroup/unassign', [
'displayGroupId' => $displayGroupId
]);
return $this;
} | php | public function unassignDisplayGroup($displayGroupId)
{
$this->getLogger()->info('Unassigning display Group ID ' . json_encode($displayGroupId) . ' From display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/displayGroup/unassign', [
'displayGroupId' => $displayGroupId
]);
return $this;
} | [
"public",
"function",
"unassignDisplayGroup",
"(",
"$",
"displayGroupId",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Unassigning display Group ID '",
".",
"json_encode",
"(",
"$",
"displayGroupId",
")",
".",
"' From display Group ID '",... | Unassign display group from display group.
@param array|int $displayGroupId The Display Group ID to unassign
@return XiboDisplayGroup | [
"Unassign",
"display",
"group",
"from",
"display",
"group",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplayGroup.php#L209-L216 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplayGroup.php | XiboDisplayGroup.assignLayout | public function assignLayout($layoutId)
{
$this->getLogger()->info('Assigning Layout ID ' . json_encode($layoutId) . ' To display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/layout/assign', [
'layoutId' => $layoutId
]);
return $this;
} | php | public function assignLayout($layoutId)
{
$this->getLogger()->info('Assigning Layout ID ' . json_encode($layoutId) . ' To display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/layout/assign', [
'layoutId' => $layoutId
]);
return $this;
} | [
"public",
"function",
"assignLayout",
"(",
"$",
"layoutId",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Assigning Layout ID '",
".",
"json_encode",
"(",
"$",
"layoutId",
")",
".",
"' To display Group ID '",
".",
"$",
"this",
"->"... | Assign layout to display Group.
@param array|int $layoutId The Layout ID to assign
@return XiboDisplayGroup | [
"Assign",
"layout",
"to",
"display",
"Group",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplayGroup.php#L224-L232 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplayGroup.php | XiboDisplayGroup.unassignLayout | public function unassignLayout($layoutId)
{
$this->getLogger()->info('Unassigning Layout ID ' . json_encode($layoutId) . ' From display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/layout/unassign', [
'layoutId' => $layoutId
]);
return $this;
} | php | public function unassignLayout($layoutId)
{
$this->getLogger()->info('Unassigning Layout ID ' . json_encode($layoutId) . ' From display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/layout/unassign', [
'layoutId' => $layoutId
]);
return $this;
} | [
"public",
"function",
"unassignLayout",
"(",
"$",
"layoutId",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Unassigning Layout ID '",
".",
"json_encode",
"(",
"$",
"layoutId",
")",
".",
"' From display Group ID '",
".",
"$",
"this",
... | Unassign layout from display group.
@param array|int $layoutId The Layout ID to unassign
@return XiboDisplayGroup | [
"Unassign",
"layout",
"from",
"display",
"group",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplayGroup.php#L240-L248 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplayGroup.php | XiboDisplayGroup.assignMedia | public function assignMedia($mediaId)
{
$this->getLogger()->info('Assigning media ID ' . json_encode($mediaId) . ' To display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/media/assign', [
'mediaId' => $mediaId
]);
return $this;
} | php | public function assignMedia($mediaId)
{
$this->getLogger()->info('Assigning media ID ' . json_encode($mediaId) . ' To display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/media/assign', [
'mediaId' => $mediaId
]);
return $this;
} | [
"public",
"function",
"assignMedia",
"(",
"$",
"mediaId",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Assigning media ID '",
".",
"json_encode",
"(",
"$",
"mediaId",
")",
".",
"' To display Group ID '",
".",
"$",
"this",
"->",
... | Assign media to display group.
@param array|int $mediaId Media ID to assign
@return XiboDisplayGroup | [
"Assign",
"media",
"to",
"display",
"group",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplayGroup.php#L256-L264 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplayGroup.php | XiboDisplayGroup.unassignMedia | public function unassignMedia($mediaId)
{
$this->getLogger()->info('Unassigning media ID ' . json_encode($mediaId) . ' From display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/media/unassign', [
'mediaId' => $mediaId
]);
return $this;
} | php | public function unassignMedia($mediaId)
{
$this->getLogger()->info('Unassigning media ID ' . json_encode($mediaId) . ' From display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/media/unassign', [
'mediaId' => $mediaId
]);
return $this;
} | [
"public",
"function",
"unassignMedia",
"(",
"$",
"mediaId",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Unassigning media ID '",
".",
"json_encode",
"(",
"$",
"mediaId",
")",
".",
"' From display Group ID '",
".",
"$",
"this",
"-... | Unassign media from display group.
@param array|int $mediaId Media ID to unassign
@return XiboDisplayGroup | [
"Unassign",
"media",
"from",
"display",
"group",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplayGroup.php#L272-L280 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplayGroup.php | XiboDisplayGroup.collectNow | public function collectNow()
{
$this->getLogger()->info('Sending Collect Now action to display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/action/collectNow');
return $this;
} | php | public function collectNow()
{
$this->getLogger()->info('Sending Collect Now action to display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/action/collectNow');
return $this;
} | [
"public",
"function",
"collectNow",
"(",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Sending Collect Now action to display Group ID '",
".",
"$",
"this",
"->",
"displayGroupId",
")",
";",
"$",
"this",
"->",
"doPost",
"(",
"'/displa... | Collect Now.
Issue a CollectNow action to the displayGroup | [
"Collect",
"Now",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplayGroup.php#L287-L293 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplayGroup.php | XiboDisplayGroup.clear | public function clear()
{
$this->getLogger()->info('Sending Clear All stats and logs action to display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/action/clearStatsAndLogs');
return $this;
} | php | public function clear()
{
$this->getLogger()->info('Sending Clear All stats and logs action to display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/action/clearStatsAndLogs');
return $this;
} | [
"public",
"function",
"clear",
"(",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Sending Clear All stats and logs action to display Group ID '",
".",
"$",
"this",
"->",
"displayGroupId",
")",
";",
"$",
"this",
"->",
"doPost",
"(",
"... | Clear Stats and logs.
Issue a clearStatsAndLogs action to the displayGroup | [
"Clear",
"Stats",
"and",
"logs",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplayGroup.php#L300-L306 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplayGroup.php | XiboDisplayGroup.revertToSchedule | public function revertToSchedule()
{
$this->getLogger()->info('Sending Revert to Schedule action to display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/action/revertToSchedule');
return $this;
} | php | public function revertToSchedule()
{
$this->getLogger()->info('Sending Revert to Schedule action to display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/action/revertToSchedule');
return $this;
} | [
"public",
"function",
"revertToSchedule",
"(",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Sending Revert to Schedule action to display Group ID '",
".",
"$",
"this",
"->",
"displayGroupId",
")",
";",
"$",
"this",
"->",
"doPost",
"("... | Revert to Schedule.
Issue revertToSchedule action to the display Group | [
"Revert",
"to",
"Schedule",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplayGroup.php#L336-L342 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplayGroup.php | XiboDisplayGroup.overlayLayout | public function overlayLayout($layoutId, $duration, $downloadRequired)
{
$this->getLogger()->info('Sending Overlay Layout action to display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/action/overlayLayout', [
'layoutId' => $layoutId,
'duration' => $duration,
'downloadRequired' => $downloadRequired
]);
return $this;
} | php | public function overlayLayout($layoutId, $duration, $downloadRequired)
{
$this->getLogger()->info('Sending Overlay Layout action to display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/action/overlayLayout', [
'layoutId' => $layoutId,
'duration' => $duration,
'downloadRequired' => $downloadRequired
]);
return $this;
} | [
"public",
"function",
"overlayLayout",
"(",
"$",
"layoutId",
",",
"$",
"duration",
",",
"$",
"downloadRequired",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Sending Overlay Layout action to display Group ID '",
".",
"$",
"this",
"->"... | Overlay Layout.
Issue overLayout action to the display group
@param int $layoutId Layout ID
@param int $duration Duration in seconds for this layout change to remain in effect
@param int $downloadRequired Flag indicating whether the player should perform a collect before playing the layout
@return XiboDisplayGroup | [
"Overlay",
"Layout",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplayGroup.php#L354-L364 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplayGroup.php | XiboDisplayGroup.command | public function command($commandId)
{
$this->getLogger()->info('Sending predefined Command to display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/action/command', [
'commandId' => $commandId,
]);
return $this;
} | php | public function command($commandId)
{
$this->getLogger()->info('Sending predefined Command to display Group ID ' . $this->displayGroupId);
$this->doPost('/displaygroup/' . $this->displayGroupId . '/action/command', [
'commandId' => $commandId,
]);
return $this;
} | [
"public",
"function",
"command",
"(",
"$",
"commandId",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Sending predefined Command to display Group ID '",
".",
"$",
"this",
"->",
"displayGroupId",
")",
";",
"$",
"this",
"->",
"doPost",... | Send a command to the display group.
@param int $commandId The Command ID
@return XiboDisplayGroup | [
"Send",
"a",
"command",
"to",
"the",
"display",
"group",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplayGroup.php#L372-L380 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboText.php | XiboText.create | public function create($name, $duration, $useDuration, $effect, $speed, $backgroundColor, $marqueeInlineSelector, $text, $javaScript, $playlistId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->effect = $effect;
$this->speed = $speed;
$this->backgroundColor = $backgroundColor;
$this->marqueeInlineSelector = $marqueeInlineSelector;
$this->text = $text;
$this->javaScript = $javaScript;
$this->playlistId = $playlistId;
$this->getLogger()->info('Creating a new Text widget in playlist ID ' . $playlistId);
$response = $this->doPost('/playlist/widget/text/' . $playlistId , $this->toArray());
return $this->hydrate($response);
} | php | public function create($name, $duration, $useDuration, $effect, $speed, $backgroundColor, $marqueeInlineSelector, $text, $javaScript, $playlistId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->effect = $effect;
$this->speed = $speed;
$this->backgroundColor = $backgroundColor;
$this->marqueeInlineSelector = $marqueeInlineSelector;
$this->text = $text;
$this->javaScript = $javaScript;
$this->playlistId = $playlistId;
$this->getLogger()->info('Creating a new Text widget in playlist ID ' . $playlistId);
$response = $this->doPost('/playlist/widget/text/' . $playlistId , $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"create",
"(",
"$",
"name",
",",
"$",
"duration",
",",
"$",
"useDuration",
",",
"$",
"effect",
",",
"$",
"speed",
",",
"$",
"backgroundColor",
",",
"$",
"marqueeInlineSelector",
",",
"$",
"text",
",",
"$",
"javaScript",
",",
"$",
... | Create new Text Widget.
@param string $name Optional widget name
@param int $duration Widget Duration
@param int $useDuration Flag indicating whether to use custom duration
@param string $effect Effect that will be used to transitions between items, available options: fade, fadeout, scrollVert, scollHorz, flipVert, flipHorz, shuffle, tileSlide, tileBlind, marqueeUp, marqueeDown, marqueeRight, marqueeLeft
@param int $speed The transition speed of the selected effect in milliseconds (1000 = normal) or the Marquee speed in a low to high scale (normal = 1)
@param string $backgroundColor A HEX color to use as the background color of this widget
@param string $marqueeInlineSelector The selector to use for stacking marquee items in a line when scrolling left/right
@param string $text The Text to display in the widget
@param string $javaScript Optional JavaScript
@param int $playlistId Playlist ID
@return XiboText | [
"Create",
"new",
"Text",
"Widget",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboText.php#L88-L105 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboText.php | XiboText.edit | public function edit($name, $duration, $useDuration, $effect, $speed, $backgroundColor, $marqueeInlineSelector, $text, $javaScript, $widgetId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->effect = $effect;
$this->speed = $speed;
$this->backgroundColor = $backgroundColor;
$this->marqueeInlineSelector = $marqueeInlineSelector;
$this->text = $text;
$this->javaScript = $javaScript;
$this->widgetId = $widgetId;
$this->getLogger()->info('Editing widget ID ' . $widgetId);
$response = $this->doPut('/playlist/widget/' . $widgetId , $this->toArray());
return $this->hydrate($response);
} | php | public function edit($name, $duration, $useDuration, $effect, $speed, $backgroundColor, $marqueeInlineSelector, $text, $javaScript, $widgetId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->effect = $effect;
$this->speed = $speed;
$this->backgroundColor = $backgroundColor;
$this->marqueeInlineSelector = $marqueeInlineSelector;
$this->text = $text;
$this->javaScript = $javaScript;
$this->widgetId = $widgetId;
$this->getLogger()->info('Editing widget ID ' . $widgetId);
$response = $this->doPut('/playlist/widget/' . $widgetId , $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"edit",
"(",
"$",
"name",
",",
"$",
"duration",
",",
"$",
"useDuration",
",",
"$",
"effect",
",",
"$",
"speed",
",",
"$",
"backgroundColor",
",",
"$",
"marqueeInlineSelector",
",",
"$",
"text",
",",
"$",
"javaScript",
",",
"$",
"w... | Edit existing Text Widget.
@param string $name Optional widget name
@param int $duration Widget Duration
@param int $useDuration Flag indicating whether to use custom duration
@param string $effect Effect that will be used to transitions between items, available options: fade, fadeout, scrollVert, scollHorz, flipVert, flipHorz, shuffle, tileSlide, tileBlind, marqueeUp, marqueeDown, marqueeRight, marqueeLeft
@param int $speed The transition speed of the selected effect in milliseconds (1000 = normal) or the Marquee speed in a low to high scale (normal = 1)
@param string $backgroundColor A HEX color to use as the background color of this widget
@param string $marqueeInlineSelector The selector to use for stacking marquee items in a line when scrolling left/right
@param string $text The Text to display in the widget
@param string $javaScript Optional JavaScript
@param int $widgetId the Widget ID
@return XiboText | [
"Edit",
"existing",
"Text",
"Widget",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboText.php#L122-L139 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboSchedule.php | XiboSchedule.getEvents | public function getEvents($displayGroupId, $date)
{
$this->getLogger()->info('Getting list of events for specified display group ' . $displayGroupId . ' and date ' . $date);
$response = $this->doGet('/schedule/' . $displayGroupId . '/events', [
'date' => $date
]);
return clone $this->hydrate($response);
} | php | public function getEvents($displayGroupId, $date)
{
$this->getLogger()->info('Getting list of events for specified display group ' . $displayGroupId . ' and date ' . $date);
$response = $this->doGet('/schedule/' . $displayGroupId . '/events', [
'date' => $date
]);
return clone $this->hydrate($response);
} | [
"public",
"function",
"getEvents",
"(",
"$",
"displayGroupId",
",",
"$",
"date",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Getting list of events for specified display group '",
".",
"$",
"displayGroupId",
".",
"' and date '",
".",
... | Get events for specified display Group ID.
@param int $displayGroupId The display group ID
@param string $date Date in Y-m-d H:i:s
@return array|XiboSchedule | [
"Get",
"events",
"for",
"specified",
"display",
"Group",
"ID",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboSchedule.php#L110-L118 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboSchedule.php | XiboSchedule.getById | public function getById(array $params = [], $id)
{
$this->getLogger()->info('Getting event with ID ' . $id);
$entries = [];
# need at least display group (always events) and to, from (other dayparts)
$response = $this->doGet('/schedule/data/events', $params);
foreach ($response['result'] as $item) {
if($item['id'] === $id){
$entries[] = clone $this->hydrate($item);
}
else
throw new XiboApiException('Provided eventId not found ' . $id);
}
return $entries;
} | php | public function getById(array $params = [], $id)
{
$this->getLogger()->info('Getting event with ID ' . $id);
$entries = [];
# need at least display group (always events) and to, from (other dayparts)
$response = $this->doGet('/schedule/data/events', $params);
foreach ($response['result'] as $item) {
if($item['id'] === $id){
$entries[] = clone $this->hydrate($item);
}
else
throw new XiboApiException('Provided eventId not found ' . $id);
}
return $entries;
} | [
"public",
"function",
"getById",
"(",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Getting event with ID '",
".",
"$",
"id",
")",
";",
"$",
"entries",
"=",
"[",
"]",... | Get a list of scheduled events for the specified display Group.
@param array $params
@param int $id The Event ID
@return array $entries require displayGroupId additionally to and from can be added for dayparts other than always
@throws XiboApiException | [
"Get",
"a",
"list",
"of",
"scheduled",
"events",
"for",
"the",
"specified",
"display",
"Group",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboSchedule.php#L128-L143 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboSchedule.php | XiboSchedule.createEventCommand | public function createEventCommand($fromDt, $commandId, $displayGroupIds, $recurrenceType, $recurrenceDetail, $recurrenceRange, $displayOrder, $isPriority, $syncTimezone)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->eventTypeId = 2;
$this->fromDt = $fromDt;
$this->commandId = $commandId;
$this->displayGroupIds = $displayGroupIds;
$this->recurrenceType = $recurrenceType;
$this->recurrenceDetail = $recurrenceDetail;
$this->recurrenceRange = $recurrenceRange;
$this->displayOrder = $displayOrder;
$this->isPriority = $isPriority;
$this->syncTimezone = $syncTimezone;
$this->getLogger()->info('Creating new scheduled command ');
$response = $this->doPost('/schedule', $this->toArray());
$this->getLogger()->debug('Passing the response to Hydrate ');
return $this->hydrate($response);
} | php | public function createEventCommand($fromDt, $commandId, $displayGroupIds, $recurrenceType, $recurrenceDetail, $recurrenceRange, $displayOrder, $isPriority, $syncTimezone)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->eventTypeId = 2;
$this->fromDt = $fromDt;
$this->commandId = $commandId;
$this->displayGroupIds = $displayGroupIds;
$this->recurrenceType = $recurrenceType;
$this->recurrenceDetail = $recurrenceDetail;
$this->recurrenceRange = $recurrenceRange;
$this->displayOrder = $displayOrder;
$this->isPriority = $isPriority;
$this->syncTimezone = $syncTimezone;
$this->getLogger()->info('Creating new scheduled command ');
$response = $this->doPost('/schedule', $this->toArray());
$this->getLogger()->debug('Passing the response to Hydrate ');
return $this->hydrate($response);
} | [
"public",
"function",
"createEventCommand",
"(",
"$",
"fromDt",
",",
"$",
"commandId",
",",
"$",
"displayGroupIds",
",",
"$",
"recurrenceType",
",",
"$",
"recurrenceDetail",
",",
"$",
"recurrenceRange",
",",
"$",
"displayOrder",
",",
"$",
"isPriority",
",",
"$... | Create Command event.
@param string $fromDt the FROM date for this event
@param int $commandId The Command ID to use for this Event
@param array[int] $displayGroupIds Array of display Group IDs for this event, Display specific Display Group IDs should be used to schedule on single displays.
@param string $recurrenceType The type of recurrence to apply to this event, Available values : , Minute, Hour, Day, Week, Month, Year
@param int $recurrenceDetail The interval for the recurrence
@param string $recurrenceRange The end date for this events recurrence
@param int $displayOrder The display order for this event.
@param int $isPriority An integer indicating the priority of this event. Normal events have a priority of 0
@param int $syncTimezone Flag Should this schedule be synced to the resulting Display timezone
@return XiboSchedule | [
"Create",
"Command",
"event",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboSchedule.php#L198-L217 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboSchedule.php | XiboSchedule.delete | public function delete()
{
$this->getLogger()->info('Deleting scheduled event ID ' . $this->eventId);
$this->doDelete('/schedule/' . $this->eventId);
return true;
} | php | public function delete()
{
$this->getLogger()->info('Deleting scheduled event ID ' . $this->eventId);
$this->doDelete('/schedule/' . $this->eventId);
return true;
} | [
"public",
"function",
"delete",
"(",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Deleting scheduled event ID '",
".",
"$",
"this",
"->",
"eventId",
")",
";",
"$",
"this",
"->",
"doDelete",
"(",
"'/schedule/'",
".",
"$",
"this... | Delete the scheduled event.
@return bool | [
"Delete",
"the",
"scheduled",
"event",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboSchedule.php#L305-L311 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboCommand.php | XiboCommand.create | public function create($name, $description, $code)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->command = $name;
$this->description = $description;
$this->code = $code;
$this->getLogger()->info('Creating new display command ' . $name);
$response = $this->doPost('/command', $this->toArray());
return $this->hydrate($response);
} | php | public function create($name, $description, $code)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->command = $name;
$this->description = $description;
$this->code = $code;
$this->getLogger()->info('Creating new display command ' . $name);
$response = $this->doPost('/command', $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"create",
"(",
"$",
"name",
",",
"$",
"description",
",",
"$",
"code",
")",
"{",
"$",
"this",
"->",
"userId",
"=",
"$",
"this",
"->",
"getEntityProvider",
"(",
")",
"->",
"getMe",
"(",
")",
"->",
"getId",
"(",
")",
";",
"$",
... | Create a new command.
@param string $name Name of the command
@param string $description Command description
@param string $code Unique code for this command
@return XiboCommand | [
"Create",
"a",
"new",
"command",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboCommand.php#L92-L102 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboCommand.php | XiboCommand.edit | public function edit($name, $description, $code)
{
$this->command = $name;
$this->description = $description;
$this->code = $code;
$this->getLogger()->info('Editing display command ID ' . $this->commandId);
$response = $this->doPut('/command/' . $this->commandId, $this->toArray());
return $this->hydrate($response);
} | php | public function edit($name, $description, $code)
{
$this->command = $name;
$this->description = $description;
$this->code = $code;
$this->getLogger()->info('Editing display command ID ' . $this->commandId);
$response = $this->doPut('/command/' . $this->commandId, $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"edit",
"(",
"$",
"name",
",",
"$",
"description",
",",
"$",
"code",
")",
"{",
"$",
"this",
"->",
"command",
"=",
"$",
"name",
";",
"$",
"this",
"->",
"description",
"=",
"$",
"description",
";",
"$",
"this",
"->",
"code",
"="... | Edit the Command.
@param string $name Name of the command
@param string $description Command description
@param string $code Unique code for this command
@return XiboCommand | [
"Edit",
"the",
"Command",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboCommand.php#L113-L122 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboCommand.php | XiboCommand.delete | public function delete()
{
$this->getLogger()->info('Deleting display command ID ' . $this->commandId);
$this->doDelete('/command/' . $this->commandId);
return true;
} | php | public function delete()
{
$this->getLogger()->info('Deleting display command ID ' . $this->commandId);
$this->doDelete('/command/' . $this->commandId);
return true;
} | [
"public",
"function",
"delete",
"(",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Deleting display command ID '",
".",
"$",
"this",
"->",
"commandId",
")",
";",
"$",
"this",
"->",
"doDelete",
"(",
"'/command/'",
".",
"$",
"thi... | Delete the command.
@return bool | [
"Delete",
"the",
"command",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboCommand.php#L129-L135 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboClock.php | XiboClock.create | public function create($name, $duration, $useDuration, $themeId, $clockTypeId, $offset, $format, $showSeconds, $clockFace, $playlistId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->themeId = $themeId;
$this->clockTypeId = $clockTypeId;
$this->offset = $offset;
$this->format = $format;
$this->showSeconds = $showSeconds;
$this->clockFace = $clockFace;
$this->playlistId = $playlistId;
$this->getLogger()->info('Creating Clock widget and assigning it to playlist ID ' . $playlistId);
$response = $this->doPost('/playlist/widget/clock/' . $playlistId, $this->toArray());
return $this->hydrate($response);
} | php | public function create($name, $duration, $useDuration, $themeId, $clockTypeId, $offset, $format, $showSeconds, $clockFace, $playlistId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->themeId = $themeId;
$this->clockTypeId = $clockTypeId;
$this->offset = $offset;
$this->format = $format;
$this->showSeconds = $showSeconds;
$this->clockFace = $clockFace;
$this->playlistId = $playlistId;
$this->getLogger()->info('Creating Clock widget and assigning it to playlist ID ' . $playlistId);
$response = $this->doPost('/playlist/widget/clock/' . $playlistId, $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"create",
"(",
"$",
"name",
",",
"$",
"duration",
",",
"$",
"useDuration",
",",
"$",
"themeId",
",",
"$",
"clockTypeId",
",",
"$",
"offset",
",",
"$",
"format",
",",
"$",
"showSeconds",
",",
"$",
"clockFace",
",",
"$",
"playlistId... | Create a new Clock Widget.
@param string $name widget name
@param int $duration widget duration
@param int $useDuration flag (0, 1) set to 1 if the duration parameter is passed as well
@param int $themeId For Analogue clock, light and dark themes
@param int $clockTypeId Type of the clock 1- Analogue, 2- Digital, 3- Flip Clock
@param string $offset The offset in minutes that should be applied to the current time, if a counter is selected then date/time to run from in format Y-m-d H:i:s
@param string $format For digital clock, format in which the time should be displayed
@param int $showSeconds For Flip Clock, should the clock show seconds or not
@param string $clockFace For Flip Clock, supported options are: TwelveHourClock, TwentyFourHourClock, DailyCounter, HourlyCounter, MinuteCounter
@param int $playlistId Playlist ID to which the clock widget should be added
@return XiboClock | [
"Create",
"a",
"new",
"Clock",
"Widget",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboClock.php#L91-L108 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboClock.php | XiboClock.edit | public function edit($name, $duration, $useDuration, $themeId, $clockTypeId, $offset, $format, $showSeconds, $clockFace, $widgetId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->themeId = $themeId;
$this->clockTypeId = $clockTypeId;
$this->offset = $offset;
$this->format = $format;
$this->showSeconds = $showSeconds;
$this->clockFace = $clockFace;
$this->widgetId = $widgetId;
$this->getLogger()->info('Editing widget ID ' . $widgetId);
$response = $this->doPut('/playlist/widget/' . $widgetId , $this->toArray());
return $this->hydrate($response);
} | php | public function edit($name, $duration, $useDuration, $themeId, $clockTypeId, $offset, $format, $showSeconds, $clockFace, $widgetId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->themeId = $themeId;
$this->clockTypeId = $clockTypeId;
$this->offset = $offset;
$this->format = $format;
$this->showSeconds = $showSeconds;
$this->clockFace = $clockFace;
$this->widgetId = $widgetId;
$this->getLogger()->info('Editing widget ID ' . $widgetId);
$response = $this->doPut('/playlist/widget/' . $widgetId , $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"edit",
"(",
"$",
"name",
",",
"$",
"duration",
",",
"$",
"useDuration",
",",
"$",
"themeId",
",",
"$",
"clockTypeId",
",",
"$",
"offset",
",",
"$",
"format",
",",
"$",
"showSeconds",
",",
"$",
"clockFace",
",",
"$",
"widgetId",
... | Edit the Clock widget.
@param string $name widget name
@param int $duration widget duration
@param int $useDuration flag (0, 1) set to 1 if the duration parameter is passed as well
@param int $themeId For Analogue clock, light and dark themes
@param int $clockTypeId Type of the clock 1- Analogue, 2- Digital, 3- Flip Clock
@param string $offset The offset in minutes that should be applied to the current time, if a counter is selected then date/time to run from in format Y-m-d H:i:s
@param string $format For digital clock, format in which the time should be displayed
@param int $showSeconds For Flip Clock, should the clock show seconds or not
@param string $clockFace For Flip Clock, supported options are: TwelveHourClock, TwentyFourHourClock, DailyCounter, HourlyCounter, MinuteCounter
@param int $widgetId Widget Id to Edit
@return XiboClock | [
"Edit",
"the",
"Clock",
"widget",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboClock.php#L125-L142 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboCurrencies.php | XiboCurrencies.create | public function create($templateId, $name, $duration, $useDuration, $base, $items, $reverseConversion, $effect, $speed, $backgroundColor, $noRecordsMessage, $dateFormat, $updateInterval, $durationIsPerPage, $playlistId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->overrideTemplate = 0;
$this->templateId = $templateId;
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->base = $base;
$this->items = $items;
$this->reverseConversion = $reverseConversion;
$this->effect = $effect;
$this->speed = $speed;
$this->backgroundColor = $backgroundColor;
$this->noRecordsMessage = $noRecordsMessage;
$this->dateFormat = $dateFormat;
$this->updateInterval = $updateInterval;
$this->durationIsPerPage = $durationIsPerPage;
$this->playlistId = $playlistId;
$this->getLogger()->info('Creating Currencies widget and assigning it to playlist ID ' . $playlistId);
$response = $this->doPost('/playlist/widget/currencies/' . $playlistId , $this->toArray());
return $this->hydrate($response);
} | php | public function create($templateId, $name, $duration, $useDuration, $base, $items, $reverseConversion, $effect, $speed, $backgroundColor, $noRecordsMessage, $dateFormat, $updateInterval, $durationIsPerPage, $playlistId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->overrideTemplate = 0;
$this->templateId = $templateId;
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->base = $base;
$this->items = $items;
$this->reverseConversion = $reverseConversion;
$this->effect = $effect;
$this->speed = $speed;
$this->backgroundColor = $backgroundColor;
$this->noRecordsMessage = $noRecordsMessage;
$this->dateFormat = $dateFormat;
$this->updateInterval = $updateInterval;
$this->durationIsPerPage = $durationIsPerPage;
$this->playlistId = $playlistId;
$this->getLogger()->info('Creating Currencies widget and assigning it to playlist ID ' . $playlistId);
$response = $this->doPost('/playlist/widget/currencies/' . $playlistId , $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"create",
"(",
"$",
"templateId",
",",
"$",
"name",
",",
"$",
"duration",
",",
"$",
"useDuration",
",",
"$",
"base",
",",
"$",
"items",
",",
"$",
"reverseConversion",
",",
"$",
"effect",
",",
"$",
"speed",
",",
"$",
"backgroundCol... | Create Currencies Widget.
@param string $templateId The template ID, currencies1, currencies2
@param string $name Optional widget name
@param int $duration Widget Duration
@param int $useDuration Flag Select 1 only if you will provide duration parameter as well
@param string $base The base currency
@param string $items The comma separated string of wanted items
@param int $reverseConversion Flag Select 1 if you’d like your base currency to be used as the comparison currency you’ve entered
@param string $effect Effect that will be used to transitions between items, available options: fade, fadeout, scrollVert, scollHorz, flipVert, flipHorz, shuffle, tileSlide, tileBlind
@param int $speed The transition speed of the selected effect in milliseconds (1000 = normal)
@param string $backgroundColor A HEX color to use as the background color of this widget
@param string $noRecordsMessage A message to display when there are no records returned by the search query
@param string $dateFormat The format to apply to all dates returned by he widget
@param int $updateInterval Update interval in minutes, should be kept as high as possible, if data change once per hour, this should be set to 60
@param int $durationIsPerPage Flag The duration specified is per page/item, otherwise the widget duration is divided between the number of pages/items
@param int $playlistId The Playlist ID
@return XiboCurrencies | [
"Create",
"Currencies",
"Widget",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboCurrencies.php#L133-L157 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboEntity.php | XiboEntity.hydrate | public function hydrate(array $properties, $options = [])
{
$this->getLogger()->debug('Hydrating the response');
$intProperties = (array_key_exists('intProperties', $options)) ? $options['intProperties'] : [];
$stringProperties = (array_key_exists('stringProperties', $options)) ? $options['stringProperties'] : [];
$htmlStringProperties = (array_key_exists('htmlStringProperties', $options)) ? $options['htmlStringProperties'] : [];
foreach ($properties as $prop => $val) {
if (property_exists($this, $prop)) {
if (stripos(strrev($prop), 'dI') === 0 || in_array($prop, $intProperties))
$val = intval($val);
else if (in_array($prop, $stringProperties))
$val = filter_var($val, FILTER_SANITIZE_STRING);
else if (in_array($prop, $htmlStringProperties))
$val = htmlentities($val);
$this->{$prop} = $val;
}
}
return $this;
} | php | public function hydrate(array $properties, $options = [])
{
$this->getLogger()->debug('Hydrating the response');
$intProperties = (array_key_exists('intProperties', $options)) ? $options['intProperties'] : [];
$stringProperties = (array_key_exists('stringProperties', $options)) ? $options['stringProperties'] : [];
$htmlStringProperties = (array_key_exists('htmlStringProperties', $options)) ? $options['htmlStringProperties'] : [];
foreach ($properties as $prop => $val) {
if (property_exists($this, $prop)) {
if (stripos(strrev($prop), 'dI') === 0 || in_array($prop, $intProperties))
$val = intval($val);
else if (in_array($prop, $stringProperties))
$val = filter_var($val, FILTER_SANITIZE_STRING);
else if (in_array($prop, $htmlStringProperties))
$val = htmlentities($val);
$this->{$prop} = $val;
}
}
return $this;
} | [
"public",
"function",
"hydrate",
"(",
"array",
"$",
"properties",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"debug",
"(",
"'Hydrating the response'",
")",
";",
"$",
"intProperties",
"=",
"(",
"array_key... | Hydrate an entity with properties
@param array $properties
@param array $options
@return self | [
"Hydrate",
"an",
"entity",
"with",
"properties"
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboEntity.php#L52-L74 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboUserGroup.php | XiboUserGroup.create | public function create($group, $libraryQuota = 0, $isSystemNotification = 0, $isDisplayNotification = 0)
{
$this->group = $group;
$this->libraryQuota = $libraryQuota;
$this->isSystemNotification = $isSystemNotification;
$this->isDisplayNotification = $isDisplayNotification;
$this->getLogger()->info('Creating User Group ' . $this->group);
$response = $this->doPost('/group', $this->toArray());
$this->getLogger()->debug('Passing the response to Hydrate');
/** @var XiboUserGroup $userGroup */
$userGroup = $this->hydrate($response);
return $userGroup;
} | php | public function create($group, $libraryQuota = 0, $isSystemNotification = 0, $isDisplayNotification = 0)
{
$this->group = $group;
$this->libraryQuota = $libraryQuota;
$this->isSystemNotification = $isSystemNotification;
$this->isDisplayNotification = $isDisplayNotification;
$this->getLogger()->info('Creating User Group ' . $this->group);
$response = $this->doPost('/group', $this->toArray());
$this->getLogger()->debug('Passing the response to Hydrate');
/** @var XiboUserGroup $userGroup */
$userGroup = $this->hydrate($response);
return $userGroup;
} | [
"public",
"function",
"create",
"(",
"$",
"group",
",",
"$",
"libraryQuota",
"=",
"0",
",",
"$",
"isSystemNotification",
"=",
"0",
",",
"$",
"isDisplayNotification",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"group",
"=",
"$",
"group",
";",
"$",
"this",
... | Create a new User Group.
@param string $group The Group Name
@param int $libraryQuota The User Group library quota in kilobytes
@param int $isSystemNotification Flag (0, 1), should members of this Group receive system notifications?
@param int $isDisplayNotification Flag (0, 1), should members of this Group receive Display notifications for Displays they have permissions to see
@return XiboUserGroup | [
"Create",
"a",
"new",
"User",
"Group",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboUserGroup.php#L117-L132 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboUserGroup.php | XiboUserGroup.edit | public function edit($groupId, $group, $libraryQuota = 0, $isSystemNotification = 0, $isDisplayNotification = 0)
{
$this->groupId = $groupId;
$this->group = $group;
$this->libraryQuota = $libraryQuota;
$this->isSystemNotification = $isSystemNotification;
$this->isDisplayNotification = $isDisplayNotification;
$this->getLogger()->info('Editing User Group ID ' . $this->groupId);
$response = $this->doPut('/group/' . $groupId, $this->toArray());
$this->getLogger()->debug('Passing the response to Hydrate');
/** @var XiboUserGroup $userGroup */
$userGroup = $this->hydrate($response);
return $userGroup;
} | php | public function edit($groupId, $group, $libraryQuota = 0, $isSystemNotification = 0, $isDisplayNotification = 0)
{
$this->groupId = $groupId;
$this->group = $group;
$this->libraryQuota = $libraryQuota;
$this->isSystemNotification = $isSystemNotification;
$this->isDisplayNotification = $isDisplayNotification;
$this->getLogger()->info('Editing User Group ID ' . $this->groupId);
$response = $this->doPut('/group/' . $groupId, $this->toArray());
$this->getLogger()->debug('Passing the response to Hydrate');
/** @var XiboUserGroup $userGroup */
$userGroup = $this->hydrate($response);
return $userGroup;
} | [
"public",
"function",
"edit",
"(",
"$",
"groupId",
",",
"$",
"group",
",",
"$",
"libraryQuota",
"=",
"0",
",",
"$",
"isSystemNotification",
"=",
"0",
",",
"$",
"isDisplayNotification",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"groupId",
"=",
"$",
"groupI... | Edit an existing User Group.
@param int $groupId The ID of the group to edit
@param string $group The Group Name
@param int $libraryQuota The User Group library quota in kilobytes
@param int $isSystemNotification Flag (0, 1), should members of this Group receive system notifications?
@param int $isDisplayNotification Flag (0, 1), should members of this Group receive Display notifications for Displays they have permissions to see
@return XiboUserGroup | [
"Edit",
"an",
"existing",
"User",
"Group",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboUserGroup.php#L144-L160 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboUserGroup.php | XiboUserGroup.delete | public function delete()
{
$this->getLogger()->info('Deleting User Group ID ' . $this->groupId);
$this->doDelete('/group/' . $this->groupId);
return true;
} | php | public function delete()
{
$this->getLogger()->info('Deleting User Group ID ' . $this->groupId);
$this->doDelete('/group/' . $this->groupId);
return true;
} | [
"public",
"function",
"delete",
"(",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Deleting User Group ID '",
".",
"$",
"this",
"->",
"groupId",
")",
";",
"$",
"this",
"->",
"doDelete",
"(",
"'/group/'",
".",
"$",
"this",
"->... | Delete the User Group
@return bool | [
"Delete",
"the",
"User",
"Group"
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboUserGroup.php#L167-L173 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboUserGroup.php | XiboUserGroup.assignUser | public function assignUser($userGroupId, $userId = [])
{
$this->groupId = $userGroupId;
$this->getLogger()->info('Assigning User IDs ' . json_encode($userId) . ' To User Group ID ' . $this->groupId);
$response = $this->doPost('/group/members/assign/' . $userGroupId, [
'userId' => $userId
]);
/** @var XiboUserGroup $userGroup */
$userGroup = $this->hydrate($response);
return $userGroup;
} | php | public function assignUser($userGroupId, $userId = [])
{
$this->groupId = $userGroupId;
$this->getLogger()->info('Assigning User IDs ' . json_encode($userId) . ' To User Group ID ' . $this->groupId);
$response = $this->doPost('/group/members/assign/' . $userGroupId, [
'userId' => $userId
]);
/** @var XiboUserGroup $userGroup */
$userGroup = $this->hydrate($response);
return $userGroup;
} | [
"public",
"function",
"assignUser",
"(",
"$",
"userGroupId",
",",
"$",
"userId",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"groupId",
"=",
"$",
"userGroupId",
";",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Assigning User IDs '",
... | Assign User to a User Group.
@param int $userGroupId The ID of the user group
@param array|int $userId The ID of the user
@return XiboUserGroup | [
"Assign",
"User",
"to",
"a",
"User",
"Group",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboUserGroup.php#L183-L196 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboUserGroup.php | XiboUserGroup.copy | public function copy($userGroupId, $group, $copyMembers = 0)
{
$this->groupId = $userGroupId;
$this->copyMembers = $copyMembers;
$this->getLogger()->info('Creating a copy of User Group ID ' . $userGroupId);
$response = $this->doPost('/group/' . $userGroupId . '/copy', [
'group' => $group,
'copyMembers' => $copyMembers
]);
/** @var XiboUserGroup $userGroup */
$userGroup = $this->hydrate($response);
return $userGroup;
} | php | public function copy($userGroupId, $group, $copyMembers = 0)
{
$this->groupId = $userGroupId;
$this->copyMembers = $copyMembers;
$this->getLogger()->info('Creating a copy of User Group ID ' . $userGroupId);
$response = $this->doPost('/group/' . $userGroupId . '/copy', [
'group' => $group,
'copyMembers' => $copyMembers
]);
/** @var XiboUserGroup $userGroup */
$userGroup = $this->hydrate($response);
return $userGroup;
} | [
"public",
"function",
"copy",
"(",
"$",
"userGroupId",
",",
"$",
"group",
",",
"$",
"copyMembers",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"groupId",
"=",
"$",
"userGroupId",
";",
"$",
"this",
"->",
"copyMembers",
"=",
"$",
"copyMembers",
";",
"$",
"t... | Copy User Group.
@param int $userGroupId The ID of the user group
@param string $group Group Name
@param int $copyMembers Flag indicating whether to copy group members
@return XiboUserGroup | [
"Copy",
"User",
"Group",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboUserGroup.php#L230-L245 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboDaypart.php | XiboDaypart.create | public function create($name, $description, $startTime, $endTime, $exceptionDays = [], $exceptionStartTimes = [], $exceptionEndTimes = [])
{
$this->name = $name;
$this->description = $description;
$this->startTime = $startTime;
$this->endTime = $endTime;
$this->exceptionDays = $exceptionDays;
$this->exceptionStartTimes = $exceptionStartTimes;
$this->exceptionEndTimes = $exceptionEndTimes;
$this->getLogger()->info('Creating dayPart ' . $name);
$response = $this->doPost('/daypart', $this->toArray());
return $this->hydrate($response);
} | php | public function create($name, $description, $startTime, $endTime, $exceptionDays = [], $exceptionStartTimes = [], $exceptionEndTimes = [])
{
$this->name = $name;
$this->description = $description;
$this->startTime = $startTime;
$this->endTime = $endTime;
$this->exceptionDays = $exceptionDays;
$this->exceptionStartTimes = $exceptionStartTimes;
$this->exceptionEndTimes = $exceptionEndTimes;
$this->getLogger()->info('Creating dayPart ' . $name);
$response = $this->doPost('/daypart', $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"create",
"(",
"$",
"name",
",",
"$",
"description",
",",
"$",
"startTime",
",",
"$",
"endTime",
",",
"$",
"exceptionDays",
"=",
"[",
"]",
",",
"$",
"exceptionStartTimes",
"=",
"[",
"]",
",",
"$",
"exceptionEndTimes",
"=",
"[",
"]... | Create a new DayPrt.
@param string $name The name for the daypart
@param string $description The description for the daypart
@param string $startTime The start time for this daypart
@param string $endTime The end time for this daypart
@param array[string] $exceptionDays String array of exception days
@param array[string] $exceptionStartTimes String array of start times to match the exception days
@param array[string] $exceptionEndTimes String array of end times to match the exception days
@return XiboDaypart | [
"Create",
"a",
"new",
"DayPrt",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDaypart.php#L108-L122 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboDaypart.php | XiboDaypart.edit | public function edit($name, $description, $startTime, $endTime, $exceptionDays = [], $exceptionStartTimes = [], $exceptionEndTimes = [])
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->description = $description;
$this->startTime = $startTime;
$this->endTime = $endTime;
$this->exceptionDays = $exceptionDays;
$this->exceptionStartTimes = $exceptionStartTimes;
$this->exceptionEndTimes = $exceptionEndTimes;
$this->getLogger()->info('Editing dayPart ID ' . $this->dayPartId);
$response = $this->doPut('/daypart/' . $this->dayPartId, $this->toArray());
return $this->hydrate($response);
} | php | public function edit($name, $description, $startTime, $endTime, $exceptionDays = [], $exceptionStartTimes = [], $exceptionEndTimes = [])
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->description = $description;
$this->startTime = $startTime;
$this->endTime = $endTime;
$this->exceptionDays = $exceptionDays;
$this->exceptionStartTimes = $exceptionStartTimes;
$this->exceptionEndTimes = $exceptionEndTimes;
$this->getLogger()->info('Editing dayPart ID ' . $this->dayPartId);
$response = $this->doPut('/daypart/' . $this->dayPartId, $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"edit",
"(",
"$",
"name",
",",
"$",
"description",
",",
"$",
"startTime",
",",
"$",
"endTime",
",",
"$",
"exceptionDays",
"=",
"[",
"]",
",",
"$",
"exceptionStartTimes",
"=",
"[",
"]",
",",
"$",
"exceptionEndTimes",
"=",
"[",
"]",... | Edit Daypart.
@param string $name The name for the daypart
@param string $description The description for the daypart
@param string $startTime The start time for this daypart
@param string $endTime The end time for this daypart
@param array[string] $exceptionDays String array of exception days
@param array[string] $exceptionStartTimes String array of start times to match the exception days
@param array[string] $exceptionEndTimes String array of end times to match the exception days
@return XiboDaypart | [
"Edit",
"Daypart",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDaypart.php#L136-L151 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboDaypart.php | XiboDaypart.delete | public function delete()
{
$this->getLogger()->info('Deleting dayPart ID ' . $this->dayPartId);
$this->doDelete('/daypart/' . $this->dayPartId);
return true;
} | php | public function delete()
{
$this->getLogger()->info('Deleting dayPart ID ' . $this->dayPartId);
$this->doDelete('/daypart/' . $this->dayPartId);
return true;
} | [
"public",
"function",
"delete",
"(",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Deleting dayPart ID '",
".",
"$",
"this",
"->",
"dayPartId",
")",
";",
"$",
"this",
"->",
"doDelete",
"(",
"'/daypart/'",
".",
"$",
"this",
"-... | Delete the daypart.
@return bool | [
"Delete",
"the",
"daypart",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDaypart.php#L158-L164 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboUser.php | XiboUser.edit | public function edit($userId, $userName, $userTypeId, $homePageId, $newUserWizard, $hideNavigation, $newPassword = '', $retypeNewPassword = '', $email= '', $libraryQuota = 0, $isPasswordChangeRequired = 0, $firstName = '', $lastName = '', $phone = '', $ref1 = '', $ref2 = '', $ref3 = '', $ref4 = '', $ref5 = '')
{
$this->userId = $userId;
$this->userName = $userName;
$this->userTypeId = $userTypeId;
$this->homePageId = $homePageId;
$this->newPassword = $newPassword;
$this->retypeNewPassword = $retypeNewPassword;
$this->newUserWizard = $newUserWizard;
$this->hideNavigation = $hideNavigation;
$this->email = $email;
$this->libraryQuota = $libraryQuota;
$this->isPasswordChangeRequired = $isPasswordChangeRequired;
$this->firstName = $firstName;
$this->lastName = $lastName;
$this->phone = $phone;
$this->ref1 = $ref1;
$this->ref2 = $ref2;
$this->ref3 = $ref3;
$this->ref4 = $ref4;
$this->ref5 = $ref5;
$this->getLogger()->info('Editing User ID ' . $userId);
$response = $this->doPut('/user/' . $userId, $this->toArray());
$this->getLogger()->debug('Passing the response to Hydrate');
/** @var XiboUser $user */
$user = $this->hydrate($response);
return $user;
} | php | public function edit($userId, $userName, $userTypeId, $homePageId, $newUserWizard, $hideNavigation, $newPassword = '', $retypeNewPassword = '', $email= '', $libraryQuota = 0, $isPasswordChangeRequired = 0, $firstName = '', $lastName = '', $phone = '', $ref1 = '', $ref2 = '', $ref3 = '', $ref4 = '', $ref5 = '')
{
$this->userId = $userId;
$this->userName = $userName;
$this->userTypeId = $userTypeId;
$this->homePageId = $homePageId;
$this->newPassword = $newPassword;
$this->retypeNewPassword = $retypeNewPassword;
$this->newUserWizard = $newUserWizard;
$this->hideNavigation = $hideNavigation;
$this->email = $email;
$this->libraryQuota = $libraryQuota;
$this->isPasswordChangeRequired = $isPasswordChangeRequired;
$this->firstName = $firstName;
$this->lastName = $lastName;
$this->phone = $phone;
$this->ref1 = $ref1;
$this->ref2 = $ref2;
$this->ref3 = $ref3;
$this->ref4 = $ref4;
$this->ref5 = $ref5;
$this->getLogger()->info('Editing User ID ' . $userId);
$response = $this->doPut('/user/' . $userId, $this->toArray());
$this->getLogger()->debug('Passing the response to Hydrate');
/** @var XiboUser $user */
$user = $this->hydrate($response);
return $user;
} | [
"public",
"function",
"edit",
"(",
"$",
"userId",
",",
"$",
"userName",
",",
"$",
"userTypeId",
",",
"$",
"homePageId",
",",
"$",
"newUserWizard",
",",
"$",
"hideNavigation",
",",
"$",
"newPassword",
"=",
"''",
",",
"$",
"retypeNewPassword",
"=",
"''",
"... | Edit an existing User.
@param int $userId The User ID to edit
@param string $userName The User Name
@param int $userTypeId The user type id
@param int $homePageId The homepage ID to use for this User
@param string $newPassword New Password for the User
@param string $retypeNewPassword New Password for the User retyped
@param int $newUserWizard Flag indicating whether to show the new user guide
@param int $hideNavigation Flag indicating whether to hide the navigation
@param string $email The User email address
@param int $libraryQuota The Users library quota in kilobytes
@param int $isPasswordChangeRequired A flag indicating whether password change should be forced for this user
@param string $firstName The User first name
@param string $lastName The User Last name
@param string $phone The user phone number
@param string $ref1 Reference 1
@param string $ref2 Reference 2
@param string $ref3 Reference 3
@param string $ref4 Reference 4
@param string $ref5 Reference 5
@return XiboUser | [
"Edit",
"an",
"existing",
"User",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboUser.php#L325-L355 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboUser.php | XiboUser.delete | public function delete($deleteAllItems = 0, $reassignUserId = null)
{
$this->getLogger()->info('Deleting User ID ' . $this->userId);
$this->doDelete('/user/' . $this->userId, [
'deleteAllItems' => $deleteAllItems,
'reassignUserId' => $reassignUserId
]);
return true;
} | php | public function delete($deleteAllItems = 0, $reassignUserId = null)
{
$this->getLogger()->info('Deleting User ID ' . $this->userId);
$this->doDelete('/user/' . $this->userId, [
'deleteAllItems' => $deleteAllItems,
'reassignUserId' => $reassignUserId
]);
return true;
} | [
"public",
"function",
"delete",
"(",
"$",
"deleteAllItems",
"=",
"0",
",",
"$",
"reassignUserId",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Deleting User ID '",
".",
"$",
"this",
"->",
"userId",
")",
";",
"$"... | Delete the User.
@param int $deleteAllItems Flag indicating whether to delete all items owned by that user
@param int $reassignUserId Reassign all items owned by this user to the specified user ID
@return bool | [
"Delete",
"the",
"User",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboUser.php#L364-L373 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplay.php | XiboDisplay.delete | public function delete()
{
$this->getLogger()->info('Deleting display ID ' . $this->displayId);
$this->doDelete('/display/' . $this->displayId);
return true;
} | php | public function delete()
{
$this->getLogger()->info('Deleting display ID ' . $this->displayId);
$this->doDelete('/display/' . $this->displayId);
return true;
} | [
"public",
"function",
"delete",
"(",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Deleting display ID '",
".",
"$",
"this",
"->",
"displayId",
")",
";",
"$",
"this",
"->",
"doDelete",
"(",
"'/display/'",
".",
"$",
"this",
"-... | Delete the display.
@return bool | [
"Delete",
"the",
"display",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplay.php#L256-L262 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplay.php | XiboDisplay.screenshot | public function screenshot()
{
$this->getLogger()->info('Requesting a screenshot from display ID ' . $this->displayId);
$this->doPut('/display/requestscreenshot/' . $this->displayId);
} | php | public function screenshot()
{
$this->getLogger()->info('Requesting a screenshot from display ID ' . $this->displayId);
$this->doPut('/display/requestscreenshot/' . $this->displayId);
} | [
"public",
"function",
"screenshot",
"(",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Requesting a screenshot from display ID '",
".",
"$",
"this",
"->",
"displayId",
")",
";",
"$",
"this",
"->",
"doPut",
"(",
"'/display/requestscre... | Request screenshot from this display. | [
"Request",
"screenshot",
"from",
"this",
"display",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplay.php#L268-L272 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplay.php | XiboDisplay.wol | public function wol()
{
$this->getLogger()->info('Sending WoL request to display ID ' . $this->displayId);
$this->doPost('/display/wol/' . $this->displayId);
} | php | public function wol()
{
$this->getLogger()->info('Sending WoL request to display ID ' . $this->displayId);
$this->doPost('/display/wol/' . $this->displayId);
} | [
"public",
"function",
"wol",
"(",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Sending WoL request to display ID '",
".",
"$",
"this",
"->",
"displayId",
")",
";",
"$",
"this",
"->",
"doPost",
"(",
"'/display/wol/'",
".",
"$",
... | Wake On Lan. | [
"Wake",
"On",
"Lan",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplay.php#L278-L282 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplay.php | XiboDisplay.authorise | public function authorise()
{
$this->getLogger()->info('Setting Authorise for display ID ' . $this->displayId);
$this->doPut('/display/authorise/' . $this->displayId);
} | php | public function authorise()
{
$this->getLogger()->info('Setting Authorise for display ID ' . $this->displayId);
$this->doPut('/display/authorise/' . $this->displayId);
} | [
"public",
"function",
"authorise",
"(",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Setting Authorise for display ID '",
".",
"$",
"this",
"->",
"displayId",
")",
";",
"$",
"this",
"->",
"doPut",
"(",
"'/display/authorise/'",
"."... | Authorise the display. | [
"Authorise",
"the",
"display",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplay.php#L289-L293 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboDisplay.php | XiboDisplay.defaultLayout | public function defaultLayout($layoutId)
{
$this->getLogger()->info('Setting Default layout ID ' . $layoutId . ' for display ID ' . $this->displayId);
$this->doPut('/display/defaultlayout/' . $this->displayId, [
'layoutId' => $layoutId
]);
} | php | public function defaultLayout($layoutId)
{
$this->getLogger()->info('Setting Default layout ID ' . $layoutId . ' for display ID ' . $this->displayId);
$this->doPut('/display/defaultlayout/' . $this->displayId, [
'layoutId' => $layoutId
]);
} | [
"public",
"function",
"defaultLayout",
"(",
"$",
"layoutId",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Setting Default layout ID '",
".",
"$",
"layoutId",
".",
"' for display ID '",
".",
"$",
"this",
"->",
"displayId",
")",
";"... | Set the default layout for the display.
@param int $layoutId The ID of the default layout | [
"Set",
"the",
"default",
"layout",
"for",
"the",
"display",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboDisplay.php#L301-L307 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboNotification.php | XiboNotification.create | public function create($subject, $body, $releaseDt, $isEmail, $isInterrupt, $displayGroupIds = [], $userGroupIds = [])
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->subject = $subject;
$this->body = $body;
$this->releaseDt = $releaseDt;
$this->isEmail = $isEmail;
$this->isInterrupt = $isInterrupt;
$this->displayGroupIds = $displayGroupIds;
$this->userGroupIds = $userGroupIds;
$this->getLogger()->info('Creating Notification ' . $subject);
$response = $this->doPost('/notification', $this->toArray());
return $this->hydrate($response);
} | php | public function create($subject, $body, $releaseDt, $isEmail, $isInterrupt, $displayGroupIds = [], $userGroupIds = [])
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->subject = $subject;
$this->body = $body;
$this->releaseDt = $releaseDt;
$this->isEmail = $isEmail;
$this->isInterrupt = $isInterrupt;
$this->displayGroupIds = $displayGroupIds;
$this->userGroupIds = $userGroupIds;
$this->getLogger()->info('Creating Notification ' . $subject);
$response = $this->doPost('/notification', $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"create",
"(",
"$",
"subject",
",",
"$",
"body",
",",
"$",
"releaseDt",
",",
"$",
"isEmail",
",",
"$",
"isInterrupt",
",",
"$",
"displayGroupIds",
"=",
"[",
"]",
",",
"$",
"userGroupIds",
"=",
"[",
"]",
")",
"{",
"$",
"this",
... | Create new Notification.
@param string $subject The Notification Subject
@param string $body The Notification message
@param string $releaseDt ISO date representing the release date for this notification
@param int $isEmail Flag indicating whether this notification should be emailed
@param int $isInterrupt Flag indicating whether this notification should interrupt the web portal nativation/login
@param array[int] $displayGroupIds The display group ids to assign this notification to
@param array[int] $userGroupIds The user group ids to assign to this notification
@return XiboNotification | [
"Create",
"new",
"Notification",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboNotification.php#L96-L111 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboNotification.php | XiboNotification.edit | public function edit($notificationId, $subject, $body, $releaseDt, $isEmail, $isInterrupt, $displayGroupIds = [], $userGroupIds = [])
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->notificationId = $notificationId;
$this->subject = $subject;
$this->body = $body;
$this->releaseDt = $releaseDt;
$this->isEmail = $isEmail;
$this->isInterrupt = $isInterrupt;
$this->displayGroupIds = $displayGroupIds;
$this->userGroupIds = $userGroupIds;
$this->getLogger()->info('Editing Notification ID' . $notificationId);
$response = $this->doPut('/notification', $this->toArray());
return $this->hydrate($response);
} | php | public function edit($notificationId, $subject, $body, $releaseDt, $isEmail, $isInterrupt, $displayGroupIds = [], $userGroupIds = [])
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->notificationId = $notificationId;
$this->subject = $subject;
$this->body = $body;
$this->releaseDt = $releaseDt;
$this->isEmail = $isEmail;
$this->isInterrupt = $isInterrupt;
$this->displayGroupIds = $displayGroupIds;
$this->userGroupIds = $userGroupIds;
$this->getLogger()->info('Editing Notification ID' . $notificationId);
$response = $this->doPut('/notification', $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"edit",
"(",
"$",
"notificationId",
",",
"$",
"subject",
",",
"$",
"body",
",",
"$",
"releaseDt",
",",
"$",
"isEmail",
",",
"$",
"isInterrupt",
",",
"$",
"displayGroupIds",
"=",
"[",
"]",
",",
"$",
"userGroupIds",
"=",
"[",
"]",
... | Edit the Notification.
@param int $notificationId Notification ID
@param string $subject The Notification Subject
@param string $body The Notification message
@param string $releaseDt ISO date representing the release date for this notification
@param int $isEmail Flag indicating whether this notification should be emailed
@param int $isInterrupt Flag indicating whether this notification should interrupt the web portal nativation/login
@param array[int] $displayGroupIds The display group ids to assign this notification to
@param array[int] $userGroupIds The user group ids to assign to this notification
@return XiboNotification | [
"Edit",
"the",
"Notification",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboNotification.php#L126-L142 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboWeather.php | XiboWeather.create | public function create($name, $duration, $useDuration, $useDisplayLocation, $longitude, $latitude, $templateId, $units, $updateInterval, $lang, $dayConditionsOnly, $playlistId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->useDisplayLocation = $useDisplayLocation;
$this->longitude = $longitude;
$this->latitude = $latitude;
$this->templateId = $templateId;
$this->units = $units;
$this->updateInterval = $updateInterval;
$this->lang = $lang;
$this->dayConditionsOnly = $dayConditionsOnly;
$this->playlistId = $playlistId;
$this->getLogger()->info('Creating Weather widget in playlist ID ' . $playlistId);
$response = $this->doPost('/playlist/widget/forecastIo/' . $playlistId , $this->toArray());
return $this->hydrate($response);
} | php | public function create($name, $duration, $useDuration, $useDisplayLocation, $longitude, $latitude, $templateId, $units, $updateInterval, $lang, $dayConditionsOnly, $playlistId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->useDisplayLocation = $useDisplayLocation;
$this->longitude = $longitude;
$this->latitude = $latitude;
$this->templateId = $templateId;
$this->units = $units;
$this->updateInterval = $updateInterval;
$this->lang = $lang;
$this->dayConditionsOnly = $dayConditionsOnly;
$this->playlistId = $playlistId;
$this->getLogger()->info('Creating Weather widget in playlist ID ' . $playlistId);
$response = $this->doPost('/playlist/widget/forecastIo/' . $playlistId , $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"create",
"(",
"$",
"name",
",",
"$",
"duration",
",",
"$",
"useDuration",
",",
"$",
"useDisplayLocation",
",",
"$",
"longitude",
",",
"$",
"latitude",
",",
"$",
"templateId",
",",
"$",
"units",
",",
"$",
"updateInterval",
",",
"$",... | Create Weather Widget.
@param string $name Optional widget name
@param int $duration Widget Duration
@param int $useDuration Flag indicating whether to use custom duration
@param int $useDisplayLocation Flag Use the location configured on the Display?
@param double $longitude The longitude for this Google Traffic widget, only pass if useDisplayLocation set to 0
@param double $latitude he latitude for this Google Traffic widget, only pass if useDisplayLocation set to 0
@param string $templateId Use pre-configured templates, available options: weather-module0-5day, weather-module0-singleday, weather-module0-singleday2, weather-module1l, weather-module1p, weather-module2l, weather-module2p, weather-module3l, weather-module3p, weather-module4l, weather-module4p, weather-module5l, weather-module6v, weather-module6h
@param string $units Units you would like to use, available options: auto, ca, si, uk2, us
@param int $updateInterval Update interval in minutes, should be kept as high as possible, if data change once per hour, this should be set to 60
@param string $lang Language you’d like to use, supported languages ar, az, be, bs, cs, de, en, el, es, fr, hr, hu, id, it, is, kw, nb, nl, pl, pt, ru, sk, sr, sv, tet, tr, uk, x-pig-latin, zh, zh-tw
@param int $dayConditionsOnly Flag (0, 1) Would you like to only show the Daytime weather conditions
@param int $playlistId Playlist ID
@return XiboWeather | [
"Create",
"Weather",
"Widget",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboWeather.php#L96-L116 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboWeather.php | XiboWeather.edit | public function edit($name, $duration, $useDuration, $useDisplayLocation, $longitude, $latitude, $templateId, $units, $updateInterval, $lang, $dayConditionsOnly, $widgetId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->useDisplayLocation = $useDisplayLocation;
$this->longitude = $longitude;
$this->latitude = $latitude;
$this->templateId = $templateId;
$this->units = $units;
$this->updateInterval = $updateInterval;
$this->lang = $lang;
$this->dayConditionsOnly = $dayConditionsOnly;
$this->widgetId = $widgetId;
$this->getLogger()->info('Editing Weather widget ID ' . $widgetId);
$response = $this->doPut('/playlist/widget/' . $widgetId , $this->toArray());
return $this->hydrate($response);
} | php | public function edit($name, $duration, $useDuration, $useDisplayLocation, $longitude, $latitude, $templateId, $units, $updateInterval, $lang, $dayConditionsOnly, $widgetId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->useDisplayLocation = $useDisplayLocation;
$this->longitude = $longitude;
$this->latitude = $latitude;
$this->templateId = $templateId;
$this->units = $units;
$this->updateInterval = $updateInterval;
$this->lang = $lang;
$this->dayConditionsOnly = $dayConditionsOnly;
$this->widgetId = $widgetId;
$this->getLogger()->info('Editing Weather widget ID ' . $widgetId);
$response = $this->doPut('/playlist/widget/' . $widgetId , $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"edit",
"(",
"$",
"name",
",",
"$",
"duration",
",",
"$",
"useDuration",
",",
"$",
"useDisplayLocation",
",",
"$",
"longitude",
",",
"$",
"latitude",
",",
"$",
"templateId",
",",
"$",
"units",
",",
"$",
"updateInterval",
",",
"$",
... | Edit Weather widget
@param string $name Optional widget name
@param int $duration Widget Duration
@param int $useDuration Flag indicating whether to use custom duration
@param int $useDisplayLocation Flag Use the location configured on the Display?
@param double $longitude The longitude for this Google Traffic widget, only pass if useDisplayLocation set to 0
@param double $latitude he latitude for this Google Traffic widget, only pass if useDisplayLocation set to 0
@param string $templateId Use pre-configured templates, available options: weather-module0-5day, weather-module0-singleday, weather-module0-singleday2, weather-module1l, weather-module1p, weather-module2l, weather-module2p, weather-module3l, weather-module3p, weather-module4l, weather-module4p, weather-module5l, weather-module6v, weather-module6h
@param string $units Units you would like to use, available options: auto, ca, si, uk2, us
@param int $updateInterval Update interval in minutes, should be kept as high as possible, if data change once per hour, this should be set to 60
@param string $lang Language you’d like to use, supported languages ar, az, be, bs, cs, de, en, el, es, fr, hr, hu, id, it, is, kw, nb, nl, pl, pt, ru, sk, sr, sv, tet, tr, uk, x-pig-latin, zh, zh-tw
@param int $dayConditionsOnly Flag (0, 1) Would you like to only show the Daytime weather conditions
@param int $widgetId Widget ID
@return XiboWeather | [
"Edit",
"Weather",
"widget"
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboWeather.php#L134-L153 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboWebpage.php | XiboWebpage.create | public function create($name, $duration, $useDuration, $transparency, $uri, $scaling, $offsetLeft, $offsetTop, $pageWidth, $pageHeight, $modeId, $playlistId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->transparency = $transparency;
$this->uri = $uri;
$this->scaling = $scaling;
$this->offsetLeft = $offsetLeft;
$this->offsetTop = $offsetTop;
$this->pageWidth = $pageWidth;
$this->pageHeight = $pageHeight;
$this->modeId = $modeId;
$this->playlistId = $playlistId;
$this->getLogger()->info('Creating a new Webpage widget in playlist ID ' .$playlistId);
$response = $this->doPost('/playlist/widget/webpage/' . $playlistId , $this->toArray());
return $this->hydrate($response);
} | php | public function create($name, $duration, $useDuration, $transparency, $uri, $scaling, $offsetLeft, $offsetTop, $pageWidth, $pageHeight, $modeId, $playlistId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->transparency = $transparency;
$this->uri = $uri;
$this->scaling = $scaling;
$this->offsetLeft = $offsetLeft;
$this->offsetTop = $offsetTop;
$this->pageWidth = $pageWidth;
$this->pageHeight = $pageHeight;
$this->modeId = $modeId;
$this->playlistId = $playlistId;
$this->getLogger()->info('Creating a new Webpage widget in playlist ID ' .$playlistId);
$response = $this->doPost('/playlist/widget/webpage/' . $playlistId , $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"create",
"(",
"$",
"name",
",",
"$",
"duration",
",",
"$",
"useDuration",
",",
"$",
"transparency",
",",
"$",
"uri",
",",
"$",
"scaling",
",",
"$",
"offsetLeft",
",",
"$",
"offsetTop",
",",
"$",
"pageWidth",
",",
"$",
"pageHeight... | Create new Webpage Widget.
@param string $name Optional Widget
@param int $duration The Widget Duration
@param int $useDuration Flag indicating whether to use custom duration
@param int $transparency Flag should the HTML be shown with a transparent background?
@param string $uri String containing the location (URL) of the web page
@param int $scaling For Manual position the percentage to scale the Web page (0-100)
@param int $offsetLeft For Manual position, the starting point from the left in pixels
@param int $offsetTop For Manual position, the starting point from the Top in pixels
@param int $pageWidth For Manual Position and Best Fit, The width of the page - if empty it will use region width
@param int $pageHeight For Manual Position and Best Fit, The height of the page - if empty it will use region height
@param int $modeId The mode option for Web page, 1- Open Natively, 2- Manual Position, 3- Best Ft
@param int $playlistId The Playlist ID
@return XiboWebpage | [
"Create",
"new",
"Webpage",
"Widget",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboWebpage.php#L97-L116 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboWebpage.php | XiboWebpage.edit | public function edit($name, $duration, $useDuration, $transparency, $uri, $scaling, $offsetLeft, $offsetTop, $pageWidth, $pageHeight, $modeId, $widgetId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->transparency = $transparency;
$this->uri = $uri;
$this->scaling = $scaling;
$this->offsetLeft = $offsetLeft;
$this->offsetTop = $offsetTop;
$this->pageWidth = $pageWidth;
$this->pageHeight = $pageHeight;
$this->modeId = $modeId;
$this->widgetId = $widgetId;
$this->getLogger()->info('Editing widget ID ' . $widgetId);
$response = $this->doPut('/playlist/widget/' . $widgetId , $this->toArray());
return $this->hydrate($response);
} | php | public function edit($name, $duration, $useDuration, $transparency, $uri, $scaling, $offsetLeft, $offsetTop, $pageWidth, $pageHeight, $modeId, $widgetId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->transparency = $transparency;
$this->uri = $uri;
$this->scaling = $scaling;
$this->offsetLeft = $offsetLeft;
$this->offsetTop = $offsetTop;
$this->pageWidth = $pageWidth;
$this->pageHeight = $pageHeight;
$this->modeId = $modeId;
$this->widgetId = $widgetId;
$this->getLogger()->info('Editing widget ID ' . $widgetId);
$response = $this->doPut('/playlist/widget/' . $widgetId , $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"edit",
"(",
"$",
"name",
",",
"$",
"duration",
",",
"$",
"useDuration",
",",
"$",
"transparency",
",",
"$",
"uri",
",",
"$",
"scaling",
",",
"$",
"offsetLeft",
",",
"$",
"offsetTop",
",",
"$",
"pageWidth",
",",
"$",
"pageHeight",... | Edit existing Webpage Widget.
@param string $name Optional Widget
@param int $duration The Widget Duration
@param int $useDuration Flag indicating whether to use custom duration
@param int $transparency Flag should the HTML be shown with a transparent background?
@param string $uri String containing the location (URL) of the web page
@param int $scaling For Manual position the percentage to scale the Web page (0-100)
@param int $offsetLeft For Manual position, the starting point from the left in pixels
@param int $offsetTop For Manual position, the starting point from the Top in pixels
@param int $pageWidth For Manual Position and Best Fit, The width of the page - if empty it will use region width
@param int $pageHeight For Manual Position and Best Fit, The height of the page - if empty it will use region height
@param int $modeId The mode option for Web page, 1- Open Natively, 2- Manual Position, 3- Best Ft
@param int $widgetId The Widget ID
@return XiboWebpage | [
"Edit",
"existing",
"Webpage",
"Widget",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboWebpage.php#L135-L154 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboPlayerSoftware.php | XiboPlayerSoftware.edit | public function edit($versionId, $playerShowVersion, $version, $code)
{
$this->playerShowVersion = $playerShowVersion;
$this->version = $version;
$this->code = $code;
$this->getLogger()->info('Editing Player Software version ID ' . $versionId);
$response = $this->doPut('/playersoftware/' . $versionId, $this->toArray());
$this->getLogger()->debug('Passing the response to Hydrate');
return $this->hydrate($response);
} | php | public function edit($versionId, $playerShowVersion, $version, $code)
{
$this->playerShowVersion = $playerShowVersion;
$this->version = $version;
$this->code = $code;
$this->getLogger()->info('Editing Player Software version ID ' . $versionId);
$response = $this->doPut('/playersoftware/' . $versionId, $this->toArray());
$this->getLogger()->debug('Passing the response to Hydrate');
return $this->hydrate($response);
} | [
"public",
"function",
"edit",
"(",
"$",
"versionId",
",",
"$",
"playerShowVersion",
",",
"$",
"version",
",",
"$",
"code",
")",
"{",
"$",
"this",
"->",
"playerShowVersion",
"=",
"$",
"playerShowVersion",
";",
"$",
"this",
"->",
"version",
"=",
"$",
"vers... | Edit an existing Player Version.
@param int $versionId The Version ID of the installer file to edit
@param string $playerShowVersion Player version to show
@param string $version Version of the installer file
@param int $code Code of the installer file
@return XiboPlayerSoftware | [
"Edit",
"an",
"existing",
"Player",
"Version",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboPlayerSoftware.php#L127-L137 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboPlayerSoftware.php | XiboPlayerSoftware.delete | public function delete()
{
$this->getLogger()->info('Deleting Player Version version ID ' . $this->versionId);
$this->doDelete('/playersoftware/' . $this->versionId);
return true;
} | php | public function delete()
{
$this->getLogger()->info('Deleting Player Version version ID ' . $this->versionId);
$this->doDelete('/playersoftware/' . $this->versionId);
return true;
} | [
"public",
"function",
"delete",
"(",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Deleting Player Version version ID '",
".",
"$",
"this",
"->",
"versionId",
")",
";",
"$",
"this",
"->",
"doDelete",
"(",
"'/playersoftware/'",
".",... | Delete the Player Version
@return bool | [
"Delete",
"the",
"Player",
"Version"
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboPlayerSoftware.php#L144-L150 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboFinance.php | XiboFinance.create | public function create($templateId, $name, $duration, $useDuration, $item, $effect, $speed, $backgroundColor, $noRecordsMessage, $dateFormat, $updateInterval, $durationIsPerItem, $overrideTemplate, $yql, $resultIdentifier, $playlistId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->overrideTemplate = 0;
$this->templateId = $templateId;
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->item = $item;
$this->effect = $effect;
$this->speed = $speed;
$this->backgroundColor = $backgroundColor;
$this->noRecordsMessage = $noRecordsMessage;
$this->dateFormat = $dateFormat;
$this->updateInterval = $updateInterval;
$this->durationIsPerItem = $durationIsPerItem;
$this->overrideTemplate = $overrideTemplate;
$this->yql = $yql;
$this->resultIdentifier = $resultIdentifier;
$this->playlistId = $playlistId;
$this->getLogger()->info('Creating Finance widget in playlist ID ' . $playlistId);
$response = $this->doPost('/playlist/widget/finance/' . $playlistId , $this->toArray());
return $this->hydrate($response);
} | php | public function create($templateId, $name, $duration, $useDuration, $item, $effect, $speed, $backgroundColor, $noRecordsMessage, $dateFormat, $updateInterval, $durationIsPerItem, $overrideTemplate, $yql, $resultIdentifier, $playlistId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->overrideTemplate = 0;
$this->templateId = $templateId;
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->item = $item;
$this->effect = $effect;
$this->speed = $speed;
$this->backgroundColor = $backgroundColor;
$this->noRecordsMessage = $noRecordsMessage;
$this->dateFormat = $dateFormat;
$this->updateInterval = $updateInterval;
$this->durationIsPerItem = $durationIsPerItem;
$this->overrideTemplate = $overrideTemplate;
$this->yql = $yql;
$this->resultIdentifier = $resultIdentifier;
$this->playlistId = $playlistId;
$this->getLogger()->info('Creating Finance widget in playlist ID ' . $playlistId);
$response = $this->doPost('/playlist/widget/finance/' . $playlistId , $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"create",
"(",
"$",
"templateId",
",",
"$",
"name",
",",
"$",
"duration",
",",
"$",
"useDuration",
",",
"$",
"item",
",",
"$",
"effect",
",",
"$",
"speed",
",",
"$",
"backgroundColor",
",",
"$",
"noRecordsMessage",
",",
"$",
"date... | Create Finance Widget.
@param string $templateId Use pre-configured templates, available options: currency-simple, stock-simple
@param string $name Widget Name
@param int $duration Widget Duration
@param int $useDuration Flag Select 1 only if you will provide duration parameter as well
@param string $item Items wanted, can be comma separated (example EURUSD, GBPUSD)
@param string $effect Effect that will be used to transitions between items, available options: fade, fadeout, scrollVert, scollHorz, flipVert, flipHorz, shuffle, tileSlide, tileBlind, marqueeUp, marqueeDown, marqueeRight, marqueeLeft
@param int $speed The transition speed of the selected effect in milliseconds (1000 = normal) or the Marquee speed in a low to high scale (normal = 1)
@param string $backgroundColor A HEX color to use as the background color of this widget
@param string $noRecordsMessage A message to display when there are no records returned by the search query
@param string $dateFormat The format to apply to all dates returned by he widget
@param int $updateInterval Update interval in minutes, should be kept as high as possible, if data change once per hour, this should be set to 60
@param int $durationIsPerItem Flag The duration specified is per item, otherwise the widget duration is divided between the number of items
@param int $overrideTemplate flag (0, 1) set to 0 and use templateId or set to 1 and provide whole template in the next parameters
@param string $yql The YQL query to use for data, pass only with overrideTemplate set to 1
@param string $resultIdentifier The name of the result identifier returned by the YQL, pass only with overrideTemplate set to 1
@param int $playlistId Playlist ID
@return XiboFinance | [
"Create",
"Finance",
"Widget",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboFinance.php#L121-L145 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboWidget.php | XiboWidget.getById | public function getById($widgetId)
{
$this->getLogger()->info('Getting widget ID ' . $widgetId);
$response = $this->doGet('/playlist/widget', [
'widgetId' => $widgetId
]);
$resonse = clone $this->hydrate($response[0]);
if ($response[0]['type'] != $this->type)
throw new XiboApiException('Invalid widget type');
return $this;
} | php | public function getById($widgetId)
{
$this->getLogger()->info('Getting widget ID ' . $widgetId);
$response = $this->doGet('/playlist/widget', [
'widgetId' => $widgetId
]);
$resonse = clone $this->hydrate($response[0]);
if ($response[0]['type'] != $this->type)
throw new XiboApiException('Invalid widget type');
return $this;
} | [
"public",
"function",
"getById",
"(",
"$",
"widgetId",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Getting widget ID '",
".",
"$",
"widgetId",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"doGet",
"(",
"'/playlist/widge... | Get by Id
@param int $widgetId Widget ID
@return $this|XiboWidget
@throws XiboApiException | [
"Get",
"by",
"Id"
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboWidget.php#L85-L97 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboNotificationView.php | XiboNotificationView.create | public function create($name, $duration, $useDuration, $age, $noDataMessage, $effect, $speed, $durationIsPerItem, $embedStyle = null, $playlistId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->age = $age;
$this->noDataMessage = $noDataMessage;
$this->effect = $effect;
$this->speed = $speed;
$this->durationIsPerItem = $durationIsPerItem;
$this->embedStyle = $embedStyle;
$this->playlistId = $playlistId;
$this->getLogger()->info('Creating Notification widget in playlist ID ' . $playlistId);
$response = $this->doPost('/playlist/widget/notificationview/' . $playlistId, $this->toArray());
return $this->hydrate($response);
} | php | public function create($name, $duration, $useDuration, $age, $noDataMessage, $effect, $speed, $durationIsPerItem, $embedStyle = null, $playlistId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->age = $age;
$this->noDataMessage = $noDataMessage;
$this->effect = $effect;
$this->speed = $speed;
$this->durationIsPerItem = $durationIsPerItem;
$this->embedStyle = $embedStyle;
$this->playlistId = $playlistId;
$this->getLogger()->info('Creating Notification widget in playlist ID ' . $playlistId);
$response = $this->doPost('/playlist/widget/notificationview/' . $playlistId, $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"create",
"(",
"$",
"name",
",",
"$",
"duration",
",",
"$",
"useDuration",
",",
"$",
"age",
",",
"$",
"noDataMessage",
",",
"$",
"effect",
",",
"$",
"speed",
",",
"$",
"durationIsPerItem",
",",
"$",
"embedStyle",
"=",
"null",
",",... | Create NotificationView widget.
@param string $name Optional widget name
@param int $duration Widget duration
@param int $useDuration Flag indicating whether to use custom duration
@param int $age The maximum notification age in minutes, 0 for all
@param string $noDataMessage Message to show when no notifications are available
@param string $effect Effect that will be used to transitions between items, available options: fade, fadeout, scrollVert, scollHorz, flipVert, flipHorz, shuffle, tileSlide, tileBlind
@param int $speed The transition speed of the selected effect in milliseconds
@param int $durationIsPerItem Flag The duration specified is per page/item, otherwise the widget duration is divided between the number of pages/items
@param string $embedStyle Custom Style Sheets (CSS)
@param int $playlistId Playlist ID
@return XiboNotificationView | [
"Create",
"NotificationView",
"widget",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboNotificationView.php#L88-L105 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboNotificationView.php | XiboNotificationView.edit | public function edit($name, $duration, $useDuration, $age, $noDataMessage, $effect, $speed, $durationIsPerItem, $embedStyle = null, $widgetId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->age = $age;
$this->noDataMessage = $noDataMessage;
$this->effect = $effect;
$this->speed = $speed;
$this->durationIsPerItem = $durationIsPerItem;
$this->embedStyle = $embedStyle;
$this->widgetId = $widgetId;
$this->getLogger()->info('Editing widget ID ' . $widgetId);
$response = $this->doPut('/playlist/widget/' . $widgetId , $this->toArray());
return $this->hydrate($response);
} | php | public function edit($name, $duration, $useDuration, $age, $noDataMessage, $effect, $speed, $durationIsPerItem, $embedStyle = null, $widgetId)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->duration = $duration;
$this->useDuration = $useDuration;
$this->age = $age;
$this->noDataMessage = $noDataMessage;
$this->effect = $effect;
$this->speed = $speed;
$this->durationIsPerItem = $durationIsPerItem;
$this->embedStyle = $embedStyle;
$this->widgetId = $widgetId;
$this->getLogger()->info('Editing widget ID ' . $widgetId);
$response = $this->doPut('/playlist/widget/' . $widgetId , $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"edit",
"(",
"$",
"name",
",",
"$",
"duration",
",",
"$",
"useDuration",
",",
"$",
"age",
",",
"$",
"noDataMessage",
",",
"$",
"effect",
",",
"$",
"speed",
",",
"$",
"durationIsPerItem",
",",
"$",
"embedStyle",
"=",
"null",
",",
... | Edit Existing NotificationView Widget.
@param string $name Optional widget name
@param int $duration Widget duration
@param int $useDuration Flag indicating whether to use custom duration
@param int $age The maximum notification age in minutes, 0 for all
@param string $noDataMessage Message to show when no notifications are available
@param string $effect Effect that will be used to transitions between items, available options: fade, fadeout, scrollVert, scollHorz, flipVert, flipHorz, shuffle, tileSlide, tileBlind
@param int $speed The transition speed of the selected effect in milliseconds
@param int $durationIsPerItem Flag The duration specified is per page/item, otherwise the widget duration is divided between the number of pages/items
@param string $embedStyle Custom Style Sheets (CSS)
@param int $widgetId Widget ID
@return XiboNotificationView | [
"Edit",
"Existing",
"NotificationView",
"Widget",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboNotificationView.php#L122-L139 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboLayout.php | XiboLayout.get | public function get(array $params = [])
{
$this->getLogger()->info('Getting list of layouts ');
$entries = [];
$hydratedRegions = [];
$hydratedWidgets = [];
$response = $this->doGet($this->url, $params);
if (isset($params['embed']))
$embed = ($params['embed'] != null) ? explode(',', $params['embed']) : [];
foreach ($response as $item) {
/** @var XiboLayout $layout */
$layout = new XiboLayout($this->getEntityProvider());
$layout->hydrate($item);
foreach ($layout->regions as $reg) {
/** @var XiboRegion $region */
$region = new XiboRegion($this->getEntityProvider());
$region->hydrate($reg);
if (in_array('playlists', $embed) === true) {
/** @var XiboPlaylist $playlist */
$playlist = new XiboPlaylist($this->getEntityProvider());
$playlist->hydrate($reg['regionPlaylist']);
foreach ($playlist->widgets as $widget) {
/** @var XiboWidget $widgetObject */
$widgetObject = new XiboWidget($this->getEntityProvider());
$widgetObject->hydrate($widget);
$hydratedWidgets[] = $widgetObject;
}
$playlist->widgets = $hydratedWidgets;
$region->regionPlaylist = $playlist;
}
// Add to parent object
$hydratedRegions[] = $region;
}
$layout->regions = $hydratedRegions;
$entries[] = clone $layout;
}
return $entries;
} | php | public function get(array $params = [])
{
$this->getLogger()->info('Getting list of layouts ');
$entries = [];
$hydratedRegions = [];
$hydratedWidgets = [];
$response = $this->doGet($this->url, $params);
if (isset($params['embed']))
$embed = ($params['embed'] != null) ? explode(',', $params['embed']) : [];
foreach ($response as $item) {
/** @var XiboLayout $layout */
$layout = new XiboLayout($this->getEntityProvider());
$layout->hydrate($item);
foreach ($layout->regions as $reg) {
/** @var XiboRegion $region */
$region = new XiboRegion($this->getEntityProvider());
$region->hydrate($reg);
if (in_array('playlists', $embed) === true) {
/** @var XiboPlaylist $playlist */
$playlist = new XiboPlaylist($this->getEntityProvider());
$playlist->hydrate($reg['regionPlaylist']);
foreach ($playlist->widgets as $widget) {
/** @var XiboWidget $widgetObject */
$widgetObject = new XiboWidget($this->getEntityProvider());
$widgetObject->hydrate($widget);
$hydratedWidgets[] = $widgetObject;
}
$playlist->widgets = $hydratedWidgets;
$region->regionPlaylist = $playlist;
}
// Add to parent object
$hydratedRegions[] = $region;
}
$layout->regions = $hydratedRegions;
$entries[] = clone $layout;
}
return $entries;
} | [
"public",
"function",
"get",
"(",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Getting list of layouts '",
")",
";",
"$",
"entries",
"=",
"[",
"]",
";",
"$",
"hydratedRegions",
"=",
"... | Get an array of layouts.
@param array $params can be filtered by: layoutId, layout, userId, retired, tags, exactTags, ownerUserGroupId and embeddable parameter embed=regions, playlists, widgets, tags
@return array|XiboLayout | [
"Get",
"an",
"array",
"of",
"layouts",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboLayout.php#L130-L170 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboLayout.php | XiboLayout.getById | public function getById($id, $embed = '')
{
$this->getLogger()->info('Getting layout ID ' . $id);
$hydratedRegions = [];
$hydratedWidgets = [];
$response = $this->doGet($this->url, [
'layoutId' => $id, 'retired' => -1, 'embed' => $embed
]);
if (count($response) <= 0)
throw new XiboApiException('Expecting a single record, found ' . count($response));
/** @var XiboLayout $layout */
$layout = $this->hydrate($response[0]);
foreach ($layout->regions as $item) {
/** @var XiboRegion $region */
$region = new XiboRegion($this->getEntityProvider());
$region->hydrate($item);
if (strpos($embed, 'playlists') !== false) {
/** @var XiboPlaylist $playlist */
$playlist = new XiboPlaylist($this->getEntityProvider());
$playlist->hydrate($item['regionPlaylist']);
foreach ($playlist->widgets as $widget) {
/** @var XiboWidget $widgetObject */
$widgetObject = new XiboWidget($this->getEntityProvider());
$widgetObject->hydrate($widget);
$hydratedWidgets[] = $widgetObject;
}
$playlist->widgets = $hydratedWidgets;
$region->regionPlaylist = $playlist;
}
// Add to parent object
$hydratedRegions[] = $region;
}
$layout->regions = $hydratedRegions;
return clone $layout;
} | php | public function getById($id, $embed = '')
{
$this->getLogger()->info('Getting layout ID ' . $id);
$hydratedRegions = [];
$hydratedWidgets = [];
$response = $this->doGet($this->url, [
'layoutId' => $id, 'retired' => -1, 'embed' => $embed
]);
if (count($response) <= 0)
throw new XiboApiException('Expecting a single record, found ' . count($response));
/** @var XiboLayout $layout */
$layout = $this->hydrate($response[0]);
foreach ($layout->regions as $item) {
/** @var XiboRegion $region */
$region = new XiboRegion($this->getEntityProvider());
$region->hydrate($item);
if (strpos($embed, 'playlists') !== false) {
/** @var XiboPlaylist $playlist */
$playlist = new XiboPlaylist($this->getEntityProvider());
$playlist->hydrate($item['regionPlaylist']);
foreach ($playlist->widgets as $widget) {
/** @var XiboWidget $widgetObject */
$widgetObject = new XiboWidget($this->getEntityProvider());
$widgetObject->hydrate($widget);
$hydratedWidgets[] = $widgetObject;
}
$playlist->widgets = $hydratedWidgets;
$region->regionPlaylist = $playlist;
}
// Add to parent object
$hydratedRegions[] = $region;
}
$layout->regions = $hydratedRegions;
return clone $layout;
} | [
"public",
"function",
"getById",
"(",
"$",
"id",
",",
"$",
"embed",
"=",
"''",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Getting layout ID '",
".",
"$",
"id",
")",
";",
"$",
"hydratedRegions",
"=",
"[",
"]",
";",
"$",... | Get the layout by its ID.
@param int $id LayoutId to search for
@param string $embed A comma separated list of related data tp embed such as regions, playlists, widgets, tags, etc
@return XiboLayout
@throws XiboApiException | [
"Get",
"the",
"layout",
"by",
"its",
"ID",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboLayout.php#L180-L218 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboLayout.php | XiboLayout.create | public function create($name, $description, $layoutId, $resolutionId)
{
$this->getLogger()->debug('Getting Resource Owner');
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->description = $description;
$this->layoutId = $layoutId;
$this->resolutionId = $resolutionId;
$this->getLogger()->info('Creating Layout ' . $this->layout);
$response = $this->doPost('/layout', $this->toArray());
$layout = $this->constructLayoutFromResponse($response);
return $layout;
} | php | public function create($name, $description, $layoutId, $resolutionId)
{
$this->getLogger()->debug('Getting Resource Owner');
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->name = $name;
$this->description = $description;
$this->layoutId = $layoutId;
$this->resolutionId = $resolutionId;
$this->getLogger()->info('Creating Layout ' . $this->layout);
$response = $this->doPost('/layout', $this->toArray());
$layout = $this->constructLayoutFromResponse($response);
return $layout;
} | [
"public",
"function",
"create",
"(",
"$",
"name",
",",
"$",
"description",
",",
"$",
"layoutId",
",",
"$",
"resolutionId",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"debug",
"(",
"'Getting Resource Owner'",
")",
";",
"$",
"this",
"->",
... | Create a new layout.
Creates new layout with the specified parameters
@param string $name Name of the layout
@param string $description Optional description of the layout
@param int $layoutId If layout should be created from the template, provide the layoutId of the template
@param int $resolutionId If template is not provided, provide resolutionId
@return XiboLayout
@throws InvalidArgumentException | [
"Create",
"a",
"new",
"layout",
".",
"Creates",
"new",
"layout",
"with",
"the",
"specified",
"parameters"
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboLayout.php#L231-L246 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboLayout.php | XiboLayout.edit | public function edit($name, $description, $tags, $retired, $backgroundColor,$backgroundImageId, $backgroundzIndex, $resolutionId)
{
$this->name = $name;
$this->description = $description;
$this->tags = $tags;
$this->retired = $retired;
$this->backgroundColor = $backgroundColor;
$this->backgroundImageId = $backgroundImageId;
$this->backgroundzIndex = $backgroundzIndex;
$this->resolutionId = $resolutionId;
$this->getLogger()->info('Editing Layout ID ' . $this->layoutId);
$response = $this->doPut('/layout/' . $this->layoutId, $this->toArray());
$layout = $this->constructLayoutFromResponse($response);
return $layout;
} | php | public function edit($name, $description, $tags, $retired, $backgroundColor,$backgroundImageId, $backgroundzIndex, $resolutionId)
{
$this->name = $name;
$this->description = $description;
$this->tags = $tags;
$this->retired = $retired;
$this->backgroundColor = $backgroundColor;
$this->backgroundImageId = $backgroundImageId;
$this->backgroundzIndex = $backgroundzIndex;
$this->resolutionId = $resolutionId;
$this->getLogger()->info('Editing Layout ID ' . $this->layoutId);
$response = $this->doPut('/layout/' . $this->layoutId, $this->toArray());
$layout = $this->constructLayoutFromResponse($response);
return $layout;
} | [
"public",
"function",
"edit",
"(",
"$",
"name",
",",
"$",
"description",
",",
"$",
"tags",
",",
"$",
"retired",
",",
"$",
"backgroundColor",
",",
"$",
"backgroundImageId",
",",
"$",
"backgroundzIndex",
",",
"$",
"resolutionId",
")",
"{",
"$",
"this",
"->... | Edit an existing Layout.
@param string $name new name of the layout
@param string $description new description of the layout
@param string $tags comma separated list of tags
@param int $retired flag indicating whether this layout is retired
@param string $backgroundColor A HEX color to use as layout background
@param int $backgroundImageId Media ID to use as a layout background
@param int $backgroundzIndex The layer number to use for the background
@param int $resolutionId new Resolution to use for this layout
@return XiboLayout | [
"Edit",
"an",
"existing",
"Layout",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboLayout.php#L261-L278 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboLayout.php | XiboLayout.retire | public function retire()
{
$this->getLogger()->info('Retiring layout ID ' . $this->layoutId);
$this->doPut('/layout/retire/' . $this->layoutId);
return true;
} | php | public function retire()
{
$this->getLogger()->info('Retiring layout ID ' . $this->layoutId);
$this->doPut('/layout/retire/' . $this->layoutId);
return true;
} | [
"public",
"function",
"retire",
"(",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Retiring layout ID '",
".",
"$",
"this",
"->",
"layoutId",
")",
";",
"$",
"this",
"->",
"doPut",
"(",
"'/layout/retire/'",
".",
"$",
"this",
"... | Retire the specified layout.
@return bool | [
"Retire",
"the",
"specified",
"layout",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboLayout.php#L300-L306 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboLayout.php | XiboLayout.copy | public function copy($name, $description, $copyMediaFiles)
{
$this->name = $name;
$this->description = $description;
$this->copyMediaFiles = $copyMediaFiles;
$this->getLogger()->info('Copy Layout ID ' . $this->layoutId);
$response = $this->doPost('/layout/copy/' . $this->layoutId, $this->toArray());
$this->getLogger()->debug('Passing the response to Hydrate');
$layout = $this->constructLayoutFromResponse($response);
return $layout;
} | php | public function copy($name, $description, $copyMediaFiles)
{
$this->name = $name;
$this->description = $description;
$this->copyMediaFiles = $copyMediaFiles;
$this->getLogger()->info('Copy Layout ID ' . $this->layoutId);
$response = $this->doPost('/layout/copy/' . $this->layoutId, $this->toArray());
$this->getLogger()->debug('Passing the response to Hydrate');
$layout = $this->constructLayoutFromResponse($response);
return $layout;
} | [
"public",
"function",
"copy",
"(",
"$",
"name",
",",
"$",
"description",
",",
"$",
"copyMediaFiles",
")",
"{",
"$",
"this",
"->",
"name",
"=",
"$",
"name",
";",
"$",
"this",
"->",
"description",
"=",
"$",
"description",
";",
"$",
"this",
"->",
"copyM... | Copy the layout.
@param string $name Name of the copied layout
@param string $description Description of the copied layout
@param int $copyMediaFiles Flag indicating whether to make copies of all media files assigned to the layout being copied
@return XiboLayout | [
"Copy",
"the",
"layout",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboLayout.php#L316-L328 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboLayout.php | XiboLayout.getByTemplateId | public function getByTemplateId($id)
{
$this->getLogger()->info('Getting template ID ' . $this->templateId);
$response = $this->doGet('/template', [
'templateId' => $id
]);
if (count($response) <= 0)
throw new XiboApiException('Expecting a single record, found ' . count($response));
$this->getLogger()->debug('Passing the response to Hydrate');
return $this->hydrate($response[0]);
} | php | public function getByTemplateId($id)
{
$this->getLogger()->info('Getting template ID ' . $this->templateId);
$response = $this->doGet('/template', [
'templateId' => $id
]);
if (count($response) <= 0)
throw new XiboApiException('Expecting a single record, found ' . count($response));
$this->getLogger()->debug('Passing the response to Hydrate');
return $this->hydrate($response[0]);
} | [
"public",
"function",
"getByTemplateId",
"(",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Getting template ID '",
".",
"$",
"this",
"->",
"templateId",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"doGet",
... | Get the template by ID
@param int $id template ID
@return XiboLayout
@throws XiboApiException | [
"Get",
"the",
"template",
"by",
"ID"
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboLayout.php#L463-L475 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboLayout.php | XiboLayout.createTemplate | public function createTemplate($layoutId, $includeWidgets, $name, $tags, $description)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->layoutId = $layoutId;
$this->includeWidgets = $includeWidgets;
$this->name = $name;
$this->tags = $tags;
$this->description = $description;
$this->getLogger()->info('Creating Template ' . $name . ' from layout ID ' . $layoutId);
$response = $this->doPost('/template/' . $layoutId, $this->toArray());
return $this->hydrate($response);
} | php | public function createTemplate($layoutId, $includeWidgets, $name, $tags, $description)
{
$this->userId = $this->getEntityProvider()->getMe()->getId();
$this->layoutId = $layoutId;
$this->includeWidgets = $includeWidgets;
$this->name = $name;
$this->tags = $tags;
$this->description = $description;
$this->getLogger()->info('Creating Template ' . $name . ' from layout ID ' . $layoutId);
$response = $this->doPost('/template/' . $layoutId, $this->toArray());
return $this->hydrate($response);
} | [
"public",
"function",
"createTemplate",
"(",
"$",
"layoutId",
",",
"$",
"includeWidgets",
",",
"$",
"name",
",",
"$",
"tags",
",",
"$",
"description",
")",
"{",
"$",
"this",
"->",
"userId",
"=",
"$",
"this",
"->",
"getEntityProvider",
"(",
")",
"->",
"... | Create Template from provided layout ID.
@param int $layoutId The layout ID to create a template from
@param int $includeWidgets Flag indicating whether to include widgets in the template
@param string $name name of the template
@param string $tags comma separeted list of tags for the template
@param string $description description of the template
@return XiboLayout | [
"Create",
"Template",
"from",
"provided",
"layout",
"ID",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboLayout.php#L487-L499 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboLayout.php | XiboLayout.addTag | public function addTag($tag)
{
$this->tag = $tag;
$this->getLogger()->info('Adding tag: ' . $tag . ' to layout ID ' . $this->layoutId);
$response = $this->doPost('/layout/' . $this->layoutId . '/tag', [
'tag' => [$tag]
]);
$tags = $this->hydrate($response);
foreach ($response['tags'] as $item) {
$tag = new XiboLayout($this->getEntityProvider());
$tag->hydrate($item);
$tags->tags[] = $tag;
}
return $this;
} | php | public function addTag($tag)
{
$this->tag = $tag;
$this->getLogger()->info('Adding tag: ' . $tag . ' to layout ID ' . $this->layoutId);
$response = $this->doPost('/layout/' . $this->layoutId . '/tag', [
'tag' => [$tag]
]);
$tags = $this->hydrate($response);
foreach ($response['tags'] as $item) {
$tag = new XiboLayout($this->getEntityProvider());
$tag->hydrate($item);
$tags->tags[] = $tag;
}
return $this;
} | [
"public",
"function",
"addTag",
"(",
"$",
"tag",
")",
"{",
"$",
"this",
"->",
"tag",
"=",
"$",
"tag",
";",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Adding tag: '",
".",
"$",
"tag",
".",
"' to layout ID '",
".",
"$",
"this",
"-... | Add tag.
Adds specified tag to the specified layout
@param string $tag name of the tag to add
@return XiboLayout | [
"Add",
"tag",
".",
"Adds",
"specified",
"tag",
"to",
"the",
"specified",
"layout"
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboLayout.php#L508-L522 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboLayout.php | XiboLayout.removeTag | public function removeTag($tag)
{
$this->tag = $tag;
$this->getLogger()->info('Removing tag: ' . $tag . ' from layout ID ' . $this->layoutId);
$this->doPost('/layout/' . $this->layoutId . '/untag', [
'tag' => [$tag]
]);
return $this;
} | php | public function removeTag($tag)
{
$this->tag = $tag;
$this->getLogger()->info('Removing tag: ' . $tag . ' from layout ID ' . $this->layoutId);
$this->doPost('/layout/' . $this->layoutId . '/untag', [
'tag' => [$tag]
]);
return $this;
} | [
"public",
"function",
"removeTag",
"(",
"$",
"tag",
")",
"{",
"$",
"this",
"->",
"tag",
"=",
"$",
"tag",
";",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Removing tag: '",
".",
"$",
"tag",
".",
"' from layout ID '",
".",
"$",
"this... | Remove tag.
Removes specified tag from the specified layout
@param string $tag name of the taf to remove
@return XiboLayout | [
"Remove",
"tag",
".",
"Removes",
"specified",
"tag",
"from",
"the",
"specified",
"layout"
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboLayout.php#L530-L539 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboLayout.php | XiboLayout.getStatus | public function getStatus()
{
$this->getLogger()->info('Getting status for layout ID ' . $this->layoutId);
$response = $this->doGet('/layout/status/' . $this->layoutId);
if (count($response) <= 0)
throw new XiboApiException('Expecting a single record, found ' . count($response));
$this->getLogger()->debug('Passing the response to Hydrate');
return $this->hydrate($response);
} | php | public function getStatus()
{
$this->getLogger()->info('Getting status for layout ID ' . $this->layoutId);
$response = $this->doGet('/layout/status/' . $this->layoutId);
if (count($response) <= 0)
throw new XiboApiException('Expecting a single record, found ' . count($response));
$this->getLogger()->debug('Passing the response to Hydrate');
return $this->hydrate($response);
} | [
"public",
"function",
"getStatus",
"(",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Getting status for layout ID '",
".",
"$",
"this",
"->",
"layoutId",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"doGet",
"(",
"'/layo... | Get Layout status.
@param int layoutId The ID of the layout to get the status
@return XiboLayout
@throws XiboApiException | [
"Get",
"Layout",
"status",
"."
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboLayout.php#L549-L559 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboLayout.php | XiboLayout.checkout | public function checkout($layoutId)
{
$this->getLogger()->info('Checking out layout ID ' . $layoutId);
$response = $this->doPut('/layout/checkout/' . $layoutId);
$layout = $this->constructLayoutFromResponse($response);
$this->getLogger()->info('LayoutId is now: ' . $layout->layoutId);
return $layout;
} | php | public function checkout($layoutId)
{
$this->getLogger()->info('Checking out layout ID ' . $layoutId);
$response = $this->doPut('/layout/checkout/' . $layoutId);
$layout = $this->constructLayoutFromResponse($response);
$this->getLogger()->info('LayoutId is now: ' . $layout->layoutId);
return $layout;
} | [
"public",
"function",
"checkout",
"(",
"$",
"layoutId",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Checking out layout ID '",
".",
"$",
"layoutId",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"doPut",
"(",
"'/layout/c... | Checkout a layout
@param int layoutId The ID of the layout to checkout
@return XiboLayout | [
"Checkout",
"a",
"layout"
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboLayout.php#L566-L576 | train |
xibosignage/oauth2-xibo-cms | src/Entity/XiboLayout.php | XiboLayout.discard | public function discard($layoutId)
{
$this->getLogger()->info('Discarding draft of layout ID ' . $layoutId);
$response = $this->doPut('/layout/discard/' . $layoutId);
$layout = $this->constructLayoutFromResponse($response);
$this->getLogger()->debug('LayoutId is now: ' . $layout->layoutId);
return $layout;
} | php | public function discard($layoutId)
{
$this->getLogger()->info('Discarding draft of layout ID ' . $layoutId);
$response = $this->doPut('/layout/discard/' . $layoutId);
$layout = $this->constructLayoutFromResponse($response);
$this->getLogger()->debug('LayoutId is now: ' . $layout->layoutId);
return $layout;
} | [
"public",
"function",
"discard",
"(",
"$",
"layoutId",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"info",
"(",
"'Discarding draft of layout ID '",
".",
"$",
"layoutId",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"doPut",
"(",
"'/la... | Discard a layouts draft
@param int layoutId The ID of the layout to checkout
@return XiboLayout | [
"Discard",
"a",
"layouts",
"draft"
] | 8e6ddb4be070257233c225f8829b8117f9d978c3 | https://github.com/xibosignage/oauth2-xibo-cms/blob/8e6ddb4be070257233c225f8829b8117f9d978c3/src/Entity/XiboLayout.php#L600-L610 | train |
seatgeek/djjob | DJJob.php | DJBase.getConnection | protected static function getConnection() {
if (self::$db === null) {
try {
self::$db = new PDO(self::$dsn, self::$user, self::$password);
self::$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
throw new Exception("DJJob couldn't connect to the database. PDO said [{$e->getMessage()}]");
}
}
return self::$db;
} | php | protected static function getConnection() {
if (self::$db === null) {
try {
self::$db = new PDO(self::$dsn, self::$user, self::$password);
self::$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
throw new Exception("DJJob couldn't connect to the database. PDO said [{$e->getMessage()}]");
}
}
return self::$db;
} | [
"protected",
"static",
"function",
"getConnection",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"db",
"===",
"null",
")",
"{",
"try",
"{",
"self",
"::",
"$",
"db",
"=",
"new",
"PDO",
"(",
"self",
"::",
"$",
"dsn",
",",
"self",
"::",
"$",
"user",... | Returns the connection DJBase knows about.
Tries to connect if no connection is present.
@return null|PDO The connection if a valid connection is present.
@throws Exception | [
"Returns",
"the",
"connection",
"DJBase",
"knows",
"about",
"."
] | bc83642f9e28cf06bbadcd783d3d5ae1162c714b | https://github.com/seatgeek/djjob/blob/bc83642f9e28cf06bbadcd783d3d5ae1162c714b/DJJob.php#L203-L213 | train |
seatgeek/djjob | DJJob.php | DJBase.runQuery | public static function runQuery($sql, $params = array()) {
for ($attempts = 0; $attempts < self::$retries; $attempts++) {
try {
$stmt = self::getConnection()->prepare($sql);
$stmt->execute($params);
$ret = array();
if ($stmt->rowCount()) {
// calling fetchAll on a result set with no rows throws a
// "general error" exception
foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $r) $ret []= $r;
}
$stmt->closeCursor();
return $ret;
}
catch (PDOException $e) {
// Catch "MySQL server has gone away" error.
if ($e->errorInfo[1] == 2006) {
self::$db = null;
}
// Throw all other errors as expected.
else {
throw $e;
}
}
}
throw new DJException("DJJob exhausted retries connecting to database");
} | php | public static function runQuery($sql, $params = array()) {
for ($attempts = 0; $attempts < self::$retries; $attempts++) {
try {
$stmt = self::getConnection()->prepare($sql);
$stmt->execute($params);
$ret = array();
if ($stmt->rowCount()) {
// calling fetchAll on a result set with no rows throws a
// "general error" exception
foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $r) $ret []= $r;
}
$stmt->closeCursor();
return $ret;
}
catch (PDOException $e) {
// Catch "MySQL server has gone away" error.
if ($e->errorInfo[1] == 2006) {
self::$db = null;
}
// Throw all other errors as expected.
else {
throw $e;
}
}
}
throw new DJException("DJJob exhausted retries connecting to database");
} | [
"public",
"static",
"function",
"runQuery",
"(",
"$",
"sql",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"for",
"(",
"$",
"attempts",
"=",
"0",
";",
"$",
"attempts",
"<",
"self",
"::",
"$",
"retries",
";",
"$",
"attempts",
"++",
")",
"{... | Runs a query with a resultset against the database.
@param string $sql The query to execute.
@param array $params The params necessary for a prepared statement.
@return array Returns the complete resultset.
@throws DJException Throws if the query couldn't be executed. | [
"Runs",
"a",
"query",
"with",
"a",
"resultset",
"against",
"the",
"database",
"."
] | bc83642f9e28cf06bbadcd783d3d5ae1162c714b | https://github.com/seatgeek/djjob/blob/bc83642f9e28cf06bbadcd783d3d5ae1162c714b/DJJob.php#L224-L253 | train |
seatgeek/djjob | DJJob.php | DJBase.runUpdate | public static function runUpdate($sql, $params = array()) {
for ($attempts = 0; $attempts < self::$retries; $attempts++) {
try {
$stmt = self::getConnection()->prepare($sql);
$stmt->execute($params);
return $stmt->rowCount();
}
catch (PDOException $e) {
// Catch "MySQL server has gone away" error.
if ($e->errorInfo[1] == 2006) {
self::$db = null;
}
// Throw all other errors as expected.
else {
throw $e;
}
}
}
throw new DJException("DJJob exhausted retries connecting to database");
} | php | public static function runUpdate($sql, $params = array()) {
for ($attempts = 0; $attempts < self::$retries; $attempts++) {
try {
$stmt = self::getConnection()->prepare($sql);
$stmt->execute($params);
return $stmt->rowCount();
}
catch (PDOException $e) {
// Catch "MySQL server has gone away" error.
if ($e->errorInfo[1] == 2006) {
self::$db = null;
}
// Throw all other errors as expected.
else {
throw $e;
}
}
}
throw new DJException("DJJob exhausted retries connecting to database");
} | [
"public",
"static",
"function",
"runUpdate",
"(",
"$",
"sql",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"for",
"(",
"$",
"attempts",
"=",
"0",
";",
"$",
"attempts",
"<",
"self",
"::",
"$",
"retries",
";",
"$",
"attempts",
"++",
")",
"... | Runs an update query against the database.
@param string $sql The query to execute.
@param array $params The params necessary for the prepared statement.
@return int The amount of affected rows.
@throws DJException Throws if the query couldn't be executed. | [
"Runs",
"an",
"update",
"query",
"against",
"the",
"database",
"."
] | bc83642f9e28cf06bbadcd783d3d5ae1162c714b | https://github.com/seatgeek/djjob/blob/bc83642f9e28cf06bbadcd783d3d5ae1162c714b/DJJob.php#L264-L284 | train |
seatgeek/djjob | DJJob.php | DJBase.log | protected static function log($mesg, $severity=self::CRITICAL) {
if ($severity >= self::$log_level) {
printf("[%s] %s\n", date('c'), $mesg);
}
} | php | protected static function log($mesg, $severity=self::CRITICAL) {
if ($severity >= self::$log_level) {
printf("[%s] %s\n", date('c'), $mesg);
}
} | [
"protected",
"static",
"function",
"log",
"(",
"$",
"mesg",
",",
"$",
"severity",
"=",
"self",
"::",
"CRITICAL",
")",
"{",
"if",
"(",
"$",
"severity",
">=",
"self",
"::",
"$",
"log_level",
")",
"{",
"printf",
"(",
"\"[%s] %s\\n\"",
",",
"date",
"(",
... | Logs a message to the output.
@param string $mesg The message to log.
@param int $severity The log level necessary for this message to display. | [
"Logs",
"a",
"message",
"to",
"the",
"output",
"."
] | bc83642f9e28cf06bbadcd783d3d5ae1162c714b | https://github.com/seatgeek/djjob/blob/bc83642f9e28cf06bbadcd783d3d5ae1162c714b/DJJob.php#L292-L296 | train |
seatgeek/djjob | DJJob.php | DJWorker.handleSignal | public function handleSignal($signo) {
$signals = array(
SIGTERM => "SIGTERM",
SIGINT => "SIGINT"
);
$signal = $signals[$signo];
$this->log("[WORKER] Received received {$signal}... Shutting down", self::INFO);
$this->releaseLocks();
die(0);
} | php | public function handleSignal($signo) {
$signals = array(
SIGTERM => "SIGTERM",
SIGINT => "SIGINT"
);
$signal = $signals[$signo];
$this->log("[WORKER] Received received {$signal}... Shutting down", self::INFO);
$this->releaseLocks();
die(0);
} | [
"public",
"function",
"handleSignal",
"(",
"$",
"signo",
")",
"{",
"$",
"signals",
"=",
"array",
"(",
"SIGTERM",
"=>",
"\"SIGTERM\"",
",",
"SIGINT",
"=>",
"\"SIGINT\"",
")",
";",
"$",
"signal",
"=",
"$",
"signals",
"[",
"$",
"signo",
"]",
";",
"$",
"... | Handles a signal from the operating system.
@param string $signo The signal received from the OS. | [
"Handles",
"a",
"signal",
"from",
"the",
"operating",
"system",
"."
] | bc83642f9e28cf06bbadcd783d3d5ae1162c714b | https://github.com/seatgeek/djjob/blob/bc83642f9e28cf06bbadcd783d3d5ae1162c714b/DJJob.php#L343-L353 | train |
seatgeek/djjob | DJJob.php | DJWorker.getNewJob | public function getNewJob() {
# we can grab a locked job if we own the lock
$rs = $this->runQuery("
SELECT id
FROM " . self::$jobsTable . "
WHERE queue = ?
AND (run_at IS NULL OR NOW() >= run_at)
AND (locked_at IS NULL OR locked_by = ?)
AND failed_at IS NULL
AND attempts < ?
ORDER BY created_at DESC
LIMIT 10
", array($this->queue, $this->name, $this->max_attempts));
// randomly order the 10 to prevent lock contention among workers
shuffle($rs);
foreach ($rs as $r) {
$job = new DJJob($this->name, $r["id"], array(
"max_attempts" => $this->max_attempts,
"fail_on_output" => $this->fail_on_output
));
if ($job->acquireLock()) return $job;
}
return false;
} | php | public function getNewJob() {
# we can grab a locked job if we own the lock
$rs = $this->runQuery("
SELECT id
FROM " . self::$jobsTable . "
WHERE queue = ?
AND (run_at IS NULL OR NOW() >= run_at)
AND (locked_at IS NULL OR locked_by = ?)
AND failed_at IS NULL
AND attempts < ?
ORDER BY created_at DESC
LIMIT 10
", array($this->queue, $this->name, $this->max_attempts));
// randomly order the 10 to prevent lock contention among workers
shuffle($rs);
foreach ($rs as $r) {
$job = new DJJob($this->name, $r["id"], array(
"max_attempts" => $this->max_attempts,
"fail_on_output" => $this->fail_on_output
));
if ($job->acquireLock()) return $job;
}
return false;
} | [
"public",
"function",
"getNewJob",
"(",
")",
"{",
"# we can grab a locked job if we own the lock",
"$",
"rs",
"=",
"$",
"this",
"->",
"runQuery",
"(",
"\"\n SELECT id\n FROM \"",
".",
"self",
"::",
"$",
"jobsTable",
".",
"\"\n WHERE que... | Returns a new job ordered by most recent first
why this?
run newest first, some jobs get left behind
run oldest first, all jobs get left behind
@return \DJJob|false A job if one was successfully locked. Otherwise false. | [
"Returns",
"a",
"new",
"job",
"ordered",
"by",
"most",
"recent",
"first",
"why",
"this?",
"run",
"newest",
"first",
"some",
"jobs",
"get",
"left",
"behind",
"run",
"oldest",
"first",
"all",
"jobs",
"get",
"left",
"behind"
] | bc83642f9e28cf06bbadcd783d3d5ae1162c714b | https://github.com/seatgeek/djjob/blob/bc83642f9e28cf06bbadcd783d3d5ae1162c714b/DJJob.php#L375-L401 | train |
seatgeek/djjob | DJJob.php | DJWorker.start | public function start() {
$this->log("[JOB] Starting worker {$this->name} on queue::{$this->queue}", self::INFO);
$count = 0;
$job_count = 0;
try {
while ($this->count == 0 || $count < $this->count) {
if (function_exists("pcntl_signal_dispatch")) pcntl_signal_dispatch();
$count += 1;
$job = $this->getNewJob($this->queue);
if (!$job) {
$this->log("[JOB] Failed to get a job, queue::{$this->queue} may be empty", self::DEBUG);
sleep($this->sleep);
continue;
}
$job_count += 1;
$job->run();
}
} catch (Exception $e) {
$this->log("[JOB] unhandled exception::\"{$e->getMessage()}\"", self::ERROR);
}
$this->log("[JOB] worker shutting down after running {$job_count} jobs, over {$count} polling iterations", self::INFO);
} | php | public function start() {
$this->log("[JOB] Starting worker {$this->name} on queue::{$this->queue}", self::INFO);
$count = 0;
$job_count = 0;
try {
while ($this->count == 0 || $count < $this->count) {
if (function_exists("pcntl_signal_dispatch")) pcntl_signal_dispatch();
$count += 1;
$job = $this->getNewJob($this->queue);
if (!$job) {
$this->log("[JOB] Failed to get a job, queue::{$this->queue} may be empty", self::DEBUG);
sleep($this->sleep);
continue;
}
$job_count += 1;
$job->run();
}
} catch (Exception $e) {
$this->log("[JOB] unhandled exception::\"{$e->getMessage()}\"", self::ERROR);
}
$this->log("[JOB] worker shutting down after running {$job_count} jobs, over {$count} polling iterations", self::INFO);
} | [
"public",
"function",
"start",
"(",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"\"[JOB] Starting worker {$this->name} on queue::{$this->queue}\"",
",",
"self",
"::",
"INFO",
")",
";",
"$",
"count",
"=",
"0",
";",
"$",
"job_count",
"=",
"0",
";",
"try",
"{",
... | Starts the worker process. | [
"Starts",
"the",
"worker",
"process",
"."
] | bc83642f9e28cf06bbadcd783d3d5ae1162c714b | https://github.com/seatgeek/djjob/blob/bc83642f9e28cf06bbadcd783d3d5ae1162c714b/DJJob.php#L406-L432 | train |
seatgeek/djjob | DJJob.php | DJJob.run | public function run() {
# pull the handler from the db
$handler = $this->getHandler();
if (!is_object($handler)) {
$msg = "[JOB] bad handler for job::{$this->job_id}";
$this->finishWithError($msg);
return false;
}
# run the handler
try {
if ($this->fail_on_output) {
ob_start();
}
$handler->perform();
if ($this->fail_on_output) {
$output = ob_get_contents();
ob_end_clean();
if (!empty($output)) {
throw new Exception("Job produced unexpected output: $output");
}
}
# cleanup
$this->finish();
return true;
} catch (DJRetryException $e) {
if ($this->fail_on_output) {
ob_end_flush();
}
# attempts hasn't been incremented yet.
$attempts = $this->getAttempts()+1;
$msg = "Caught DJRetryException \"{$e->getMessage()}\" on attempt $attempts/{$this->max_attempts}.";
if($attempts == $this->max_attempts) {
$msg = "[JOB] job::{$this->job_id} $msg Giving up.";
$this->finishWithError($msg, $handler);
} else {
$this->log("[JOB] job::{$this->job_id} $msg Try again in {$e->getDelay()} seconds.", self::WARN);
$this->retryLater($e->getDelay());
}
return false;
} catch (Exception $e) {
if ($this->fail_on_output) {
ob_end_flush();
}
$this->finishWithError($e->getMessage(), $handler);
return false;
}
} | php | public function run() {
# pull the handler from the db
$handler = $this->getHandler();
if (!is_object($handler)) {
$msg = "[JOB] bad handler for job::{$this->job_id}";
$this->finishWithError($msg);
return false;
}
# run the handler
try {
if ($this->fail_on_output) {
ob_start();
}
$handler->perform();
if ($this->fail_on_output) {
$output = ob_get_contents();
ob_end_clean();
if (!empty($output)) {
throw new Exception("Job produced unexpected output: $output");
}
}
# cleanup
$this->finish();
return true;
} catch (DJRetryException $e) {
if ($this->fail_on_output) {
ob_end_flush();
}
# attempts hasn't been incremented yet.
$attempts = $this->getAttempts()+1;
$msg = "Caught DJRetryException \"{$e->getMessage()}\" on attempt $attempts/{$this->max_attempts}.";
if($attempts == $this->max_attempts) {
$msg = "[JOB] job::{$this->job_id} $msg Giving up.";
$this->finishWithError($msg, $handler);
} else {
$this->log("[JOB] job::{$this->job_id} $msg Try again in {$e->getDelay()} seconds.", self::WARN);
$this->retryLater($e->getDelay());
}
return false;
} catch (Exception $e) {
if ($this->fail_on_output) {
ob_end_flush();
}
$this->finishWithError($e->getMessage(), $handler);
return false;
}
} | [
"public",
"function",
"run",
"(",
")",
"{",
"# pull the handler from the db",
"$",
"handler",
"=",
"$",
"this",
"->",
"getHandler",
"(",
")",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"handler",
")",
")",
"{",
"$",
"msg",
"=",
"\"[JOB] bad handler for jo... | Runs this job.
First retrieves the handler fro the database. Then perform the job.
@return bool Whether or not the job succeeded. | [
"Runs",
"this",
"job",
"."
] | bc83642f9e28cf06bbadcd783d3d5ae1162c714b | https://github.com/seatgeek/djjob/blob/bc83642f9e28cf06bbadcd783d3d5ae1162c714b/DJJob.php#L469-L528 | train |
seatgeek/djjob | DJJob.php | DJJob.acquireLock | public function acquireLock() {
$this->log("[JOB] attempting to acquire lock for job::{$this->job_id} on {$this->worker_name}", self::INFO);
$lock = $this->runUpdate("
UPDATE " . self::$jobsTable . "
SET locked_at = NOW(), locked_by = ?
WHERE id = ? AND (locked_at IS NULL OR locked_by = ?) AND failed_at IS NULL
", array($this->worker_name, $this->job_id, $this->worker_name));
if (!$lock) {
$this->log("[JOB] failed to acquire lock for job::{$this->job_id}", self::INFO);
return false;
}
return true;
} | php | public function acquireLock() {
$this->log("[JOB] attempting to acquire lock for job::{$this->job_id} on {$this->worker_name}", self::INFO);
$lock = $this->runUpdate("
UPDATE " . self::$jobsTable . "
SET locked_at = NOW(), locked_by = ?
WHERE id = ? AND (locked_at IS NULL OR locked_by = ?) AND failed_at IS NULL
", array($this->worker_name, $this->job_id, $this->worker_name));
if (!$lock) {
$this->log("[JOB] failed to acquire lock for job::{$this->job_id}", self::INFO);
return false;
}
return true;
} | [
"public",
"function",
"acquireLock",
"(",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"\"[JOB] attempting to acquire lock for job::{$this->job_id} on {$this->worker_name}\"",
",",
"self",
"::",
"INFO",
")",
";",
"$",
"lock",
"=",
"$",
"this",
"->",
"runUpdate",
"(",
... | Acquires lock on this job.
@return bool Whether or not acquiring the lock succeeded. | [
"Acquires",
"lock",
"on",
"this",
"job",
"."
] | bc83642f9e28cf06bbadcd783d3d5ae1162c714b | https://github.com/seatgeek/djjob/blob/bc83642f9e28cf06bbadcd783d3d5ae1162c714b/DJJob.php#L535-L550 | train |
seatgeek/djjob | DJJob.php | DJJob.finish | public function finish() {
$this->runUpdate(
"DELETE FROM " . self::$jobsTable . " WHERE id = ?",
array($this->job_id)
);
$this->log("[JOB] completed job::{$this->job_id}", self::INFO);
} | php | public function finish() {
$this->runUpdate(
"DELETE FROM " . self::$jobsTable . " WHERE id = ?",
array($this->job_id)
);
$this->log("[JOB] completed job::{$this->job_id}", self::INFO);
} | [
"public",
"function",
"finish",
"(",
")",
"{",
"$",
"this",
"->",
"runUpdate",
"(",
"\"DELETE FROM \"",
".",
"self",
"::",
"$",
"jobsTable",
".",
"\" WHERE id = ?\"",
",",
"array",
"(",
"$",
"this",
"->",
"job_id",
")",
")",
";",
"$",
"this",
"->",
"lo... | Finishes this job. Will delete it from the jobs table. | [
"Finishes",
"this",
"job",
".",
"Will",
"delete",
"it",
"from",
"the",
"jobs",
"table",
"."
] | bc83642f9e28cf06bbadcd783d3d5ae1162c714b | https://github.com/seatgeek/djjob/blob/bc83642f9e28cf06bbadcd783d3d5ae1162c714b/DJJob.php#L567-L573 | train |
seatgeek/djjob | DJJob.php | DJJob.finishWithError | public function finishWithError($error, $handler = null) {
$this->runUpdate("
UPDATE " . self::$jobsTable . "
SET attempts = attempts + 1,
failed_at = IF(attempts >= ?, NOW(), NULL),
error = IF(attempts >= ?, ?, NULL)
WHERE id = ?",
array(
$this->max_attempts,
$this->max_attempts,
$error,
$this->job_id
)
);
$this->log($error, self::ERROR);
$this->log("[JOB] failure in job::{$this->job_id}", self::ERROR);
$this->releaseLock();
if ($handler && ($this->getAttempts() == $this->max_attempts) && method_exists($handler, '_onDjjobRetryError')) {
$handler->_onDjjobRetryError($error);
}
} | php | public function finishWithError($error, $handler = null) {
$this->runUpdate("
UPDATE " . self::$jobsTable . "
SET attempts = attempts + 1,
failed_at = IF(attempts >= ?, NOW(), NULL),
error = IF(attempts >= ?, ?, NULL)
WHERE id = ?",
array(
$this->max_attempts,
$this->max_attempts,
$error,
$this->job_id
)
);
$this->log($error, self::ERROR);
$this->log("[JOB] failure in job::{$this->job_id}", self::ERROR);
$this->releaseLock();
if ($handler && ($this->getAttempts() == $this->max_attempts) && method_exists($handler, '_onDjjobRetryError')) {
$handler->_onDjjobRetryError($error);
}
} | [
"public",
"function",
"finishWithError",
"(",
"$",
"error",
",",
"$",
"handler",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"runUpdate",
"(",
"\"\n UPDATE \"",
".",
"self",
"::",
"$",
"jobsTable",
".",
"\"\n SET attempts = attempts + 1,\n ... | Finishes this job, but with an error. Keeps the job in the jobs table.
@param string $error The error message to write to the job.
@param null|object $handler The handler that ran this job. | [
"Finishes",
"this",
"job",
"but",
"with",
"an",
"error",
".",
"Keeps",
"the",
"job",
"in",
"the",
"jobs",
"table",
"."
] | bc83642f9e28cf06bbadcd783d3d5ae1162c714b | https://github.com/seatgeek/djjob/blob/bc83642f9e28cf06bbadcd783d3d5ae1162c714b/DJJob.php#L581-L602 | train |
seatgeek/djjob | DJJob.php | DJJob.retryLater | public function retryLater($delay) {
$this->runUpdate("
UPDATE " . self::$jobsTable . "
SET run_at = DATE_ADD(NOW(), INTERVAL ? SECOND),
attempts = attempts + 1
WHERE id = ?",
array(
$delay,
$this->job_id
)
);
$this->releaseLock();
} | php | public function retryLater($delay) {
$this->runUpdate("
UPDATE " . self::$jobsTable . "
SET run_at = DATE_ADD(NOW(), INTERVAL ? SECOND),
attempts = attempts + 1
WHERE id = ?",
array(
$delay,
$this->job_id
)
);
$this->releaseLock();
} | [
"public",
"function",
"retryLater",
"(",
"$",
"delay",
")",
"{",
"$",
"this",
"->",
"runUpdate",
"(",
"\"\n UPDATE \"",
".",
"self",
"::",
"$",
"jobsTable",
".",
"\"\n SET run_at = DATE_ADD(NOW(), INTERVAL ? SECOND),\n attempts = attempts ... | Saves a retry date to this job.
@param int $delay The amount of seconds to delay this job. | [
"Saves",
"a",
"retry",
"date",
"to",
"this",
"job",
"."
] | bc83642f9e28cf06bbadcd783d3d5ae1162c714b | https://github.com/seatgeek/djjob/blob/bc83642f9e28cf06bbadcd783d3d5ae1162c714b/DJJob.php#L609-L621 | train |
seatgeek/djjob | DJJob.php | DJJob.getHandler | public function getHandler() {
$rs = $this->runQuery(
"SELECT handler FROM " . self::$jobsTable . " WHERE id = ?",
array($this->job_id)
);
foreach ($rs as $r) return unserialize($r["handler"]);
return false;
} | php | public function getHandler() {
$rs = $this->runQuery(
"SELECT handler FROM " . self::$jobsTable . " WHERE id = ?",
array($this->job_id)
);
foreach ($rs as $r) return unserialize($r["handler"]);
return false;
} | [
"public",
"function",
"getHandler",
"(",
")",
"{",
"$",
"rs",
"=",
"$",
"this",
"->",
"runQuery",
"(",
"\"SELECT handler FROM \"",
".",
"self",
"::",
"$",
"jobsTable",
".",
"\" WHERE id = ?\"",
",",
"array",
"(",
"$",
"this",
"->",
"job_id",
")",
")",
";... | Returns the handler for this job.
@return bool|object The handler object for this job. Or false if it failed. | [
"Returns",
"the",
"handler",
"for",
"this",
"job",
"."
] | bc83642f9e28cf06bbadcd783d3d5ae1162c714b | https://github.com/seatgeek/djjob/blob/bc83642f9e28cf06bbadcd783d3d5ae1162c714b/DJJob.php#L628-L635 | train |
seatgeek/djjob | DJJob.php | DJJob.getAttempts | public function getAttempts() {
$rs = $this->runQuery(
"SELECT attempts FROM " . self::$jobsTable . " WHERE id = ?",
array($this->job_id)
);
foreach ($rs as $r) return $r["attempts"];
return false;
} | php | public function getAttempts() {
$rs = $this->runQuery(
"SELECT attempts FROM " . self::$jobsTable . " WHERE id = ?",
array($this->job_id)
);
foreach ($rs as $r) return $r["attempts"];
return false;
} | [
"public",
"function",
"getAttempts",
"(",
")",
"{",
"$",
"rs",
"=",
"$",
"this",
"->",
"runQuery",
"(",
"\"SELECT attempts FROM \"",
".",
"self",
"::",
"$",
"jobsTable",
".",
"\" WHERE id = ?\"",
",",
"array",
"(",
"$",
"this",
"->",
"job_id",
")",
")",
... | Returns the amount of attempts left for this job.
@return bool The amount of attempts left. | [
"Returns",
"the",
"amount",
"of",
"attempts",
"left",
"for",
"this",
"job",
"."
] | bc83642f9e28cf06bbadcd783d3d5ae1162c714b | https://github.com/seatgeek/djjob/blob/bc83642f9e28cf06bbadcd783d3d5ae1162c714b/DJJob.php#L642-L649 | train |
seatgeek/djjob | DJJob.php | DJJob.enqueue | public static function enqueue($handler, $queue = "default", $run_at = null) {
$affected = self::runUpdate(
"INSERT INTO " . self::$jobsTable . " (handler, queue, run_at, created_at) VALUES(?, ?, ?, NOW())",
array(serialize($handler), (string) $queue, $run_at)
);
if ($affected < 1) {
self::log("[JOB] failed to enqueue new job", self::ERROR);
return false;
}
return self::getConnection()->lastInsertId(); // return the job ID, for manipulation later
} | php | public static function enqueue($handler, $queue = "default", $run_at = null) {
$affected = self::runUpdate(
"INSERT INTO " . self::$jobsTable . " (handler, queue, run_at, created_at) VALUES(?, ?, ?, NOW())",
array(serialize($handler), (string) $queue, $run_at)
);
if ($affected < 1) {
self::log("[JOB] failed to enqueue new job", self::ERROR);
return false;
}
return self::getConnection()->lastInsertId(); // return the job ID, for manipulation later
} | [
"public",
"static",
"function",
"enqueue",
"(",
"$",
"handler",
",",
"$",
"queue",
"=",
"\"default\"",
",",
"$",
"run_at",
"=",
"null",
")",
"{",
"$",
"affected",
"=",
"self",
"::",
"runUpdate",
"(",
"\"INSERT INTO \"",
".",
"self",
"::",
"$",
"jobsTable... | Enqueues a job to the database.
@param object $handler The handler that can execute this job.
@param string $queue The queue to enqueue this job to. All queues are saved in the same table.
@param string $run_at A valid mysql DATETIME string at which to run the jobs.
@return bool|string Returns the last inserted ID or false if enqueuing failed. | [
"Enqueues",
"a",
"job",
"to",
"the",
"database",
"."
] | bc83642f9e28cf06bbadcd783d3d5ae1162c714b | https://github.com/seatgeek/djjob/blob/bc83642f9e28cf06bbadcd783d3d5ae1162c714b/DJJob.php#L660-L672 | train |
seatgeek/djjob | DJJob.php | DJJob.bulkEnqueue | public static function bulkEnqueue($handlers, $queue = "default", $run_at = null) {
$sql = "INSERT INTO " . self::$jobsTable . " (handler, queue, run_at, created_at) VALUES";
$sql .= implode(",", array_fill(0, count($handlers), "(?, ?, ?, NOW())"));
$parameters = array();
foreach ($handlers as $handler) {
$parameters []= serialize($handler);
$parameters []= (string) $queue;
$parameters []= $run_at;
}
$affected = self::runUpdate($sql, $parameters);
if ($affected < 1) {
self::log("[JOB] failed to enqueue new jobs", self::ERROR);
return false;
}
if ($affected != count($handlers))
self::log("[JOB] failed to enqueue some new jobs", self::ERROR);
return true;
} | php | public static function bulkEnqueue($handlers, $queue = "default", $run_at = null) {
$sql = "INSERT INTO " . self::$jobsTable . " (handler, queue, run_at, created_at) VALUES";
$sql .= implode(",", array_fill(0, count($handlers), "(?, ?, ?, NOW())"));
$parameters = array();
foreach ($handlers as $handler) {
$parameters []= serialize($handler);
$parameters []= (string) $queue;
$parameters []= $run_at;
}
$affected = self::runUpdate($sql, $parameters);
if ($affected < 1) {
self::log("[JOB] failed to enqueue new jobs", self::ERROR);
return false;
}
if ($affected != count($handlers))
self::log("[JOB] failed to enqueue some new jobs", self::ERROR);
return true;
} | [
"public",
"static",
"function",
"bulkEnqueue",
"(",
"$",
"handlers",
",",
"$",
"queue",
"=",
"\"default\"",
",",
"$",
"run_at",
"=",
"null",
")",
"{",
"$",
"sql",
"=",
"\"INSERT INTO \"",
".",
"self",
"::",
"$",
"jobsTable",
".",
"\" (handler, queue, run_at,... | Bulk enqueues a lot of jobs to the database.
@param object[] $handlers An array of handlers to enqueue.
@param string $queue The queue to enqueue the handlers to.
@param string $run_at A valid mysql DATETIME string at which to run the jobs.
@return bool | [
"Bulk",
"enqueues",
"a",
"lot",
"of",
"jobs",
"to",
"the",
"database",
"."
] | bc83642f9e28cf06bbadcd783d3d5ae1162c714b | https://github.com/seatgeek/djjob/blob/bc83642f9e28cf06bbadcd783d3d5ae1162c714b/DJJob.php#L683-L704 | train |
seatgeek/djjob | DJJob.php | DJJob.status | public static function status($queue = "default") {
$rs = self::runQuery("
SELECT COUNT(*) as total, COUNT(failed_at) as failed, COUNT(locked_at) as locked
FROM `" . self::$jobsTable . "`
WHERE queue = ?
", array($queue));
$rs = $rs[0];
$failed = $rs["failed"];
$locked = $rs["locked"];
$total = $rs["total"];
$outstanding = $total - $locked - $failed;
return array(
"outstanding" => $outstanding,
"locked" => $locked,
"failed" => $failed,
"total" => $total
);
} | php | public static function status($queue = "default") {
$rs = self::runQuery("
SELECT COUNT(*) as total, COUNT(failed_at) as failed, COUNT(locked_at) as locked
FROM `" . self::$jobsTable . "`
WHERE queue = ?
", array($queue));
$rs = $rs[0];
$failed = $rs["failed"];
$locked = $rs["locked"];
$total = $rs["total"];
$outstanding = $total - $locked - $failed;
return array(
"outstanding" => $outstanding,
"locked" => $locked,
"failed" => $failed,
"total" => $total
);
} | [
"public",
"static",
"function",
"status",
"(",
"$",
"queue",
"=",
"\"default\"",
")",
"{",
"$",
"rs",
"=",
"self",
"::",
"runQuery",
"(",
"\"\n SELECT COUNT(*) as total, COUNT(failed_at) as failed, COUNT(locked_at) as locked\n FROM `\"",
".",
"self",
"... | Returns the general status of the jobs table.
@param string $queue The queue of which to see the status for.
@return array Information about the status. | [
"Returns",
"the",
"general",
"status",
"of",
"the",
"jobs",
"table",
"."
] | bc83642f9e28cf06bbadcd783d3d5ae1162c714b | https://github.com/seatgeek/djjob/blob/bc83642f9e28cf06bbadcd783d3d5ae1162c714b/DJJob.php#L713-L732 | train |
symbiote/silverstripe-multivaluefield | src/Fields/MultiValueCheckboxField.php | MultiValueCheckboxField.dataValue | public function dataValue()
{
if ($this->value && is_array($this->value)) {
$filtered = [];
foreach ($this->value as $item) {
if ($item) {
$filtered[] = str_replace(",", "{comma}", $item);
}
}
return implode(',', $filtered);
}
return '';
} | php | public function dataValue()
{
if ($this->value && is_array($this->value)) {
$filtered = [];
foreach ($this->value as $item) {
if ($item) {
$filtered[] = str_replace(",", "{comma}", $item);
}
}
return implode(',', $filtered);
}
return '';
} | [
"public",
"function",
"dataValue",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"value",
"&&",
"is_array",
"(",
"$",
"this",
"->",
"value",
")",
")",
"{",
"$",
"filtered",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"value",
"as",
"$",... | Return the CheckboxSetField value as a string
selected item keys.
@return string | [
"Return",
"the",
"CheckboxSetField",
"value",
"as",
"a",
"string",
"selected",
"item",
"keys",
"."
] | 7b0d579530a8914ddf8fc7c912d9559d59d1582a | https://github.com/symbiote/silverstripe-multivaluefield/blob/7b0d579530a8914ddf8fc7c912d9559d59d1582a/src/Fields/MultiValueCheckboxField.php#L212-L226 | train |
symbiote/silverstripe-multivaluefield | src/Fields/MultiValueCheckboxField.php | MultiValueCheckboxField.performReadonlyTransformation | public function performReadonlyTransformation()
{
$values = '';
$data = [];
$items = $this->value;
if ($this->source) {
foreach ($this->source as $source) {
if (is_object($source)) {
$sourceTitles[$source->ID] = $source->Title;
}
}
}
if ($items) {
// Items is a DO Set
if (is_a($items, 'DataList')) {
foreach ($items as $item) {
$data[] = $item->Title;
}
if ($data) $values = implode(', ', $data);
// Items is an array or single piece of string (including comma seperated string)
} else {
if (!is_array($items)) {
$items = preg_split('/ *, */', trim($items));
}
foreach ($items as $item) {
if (is_array($item)) {
$data[] = $item['Title'];
} elseif (is_array($this->source) && !empty($this->source[$item])) {
$data[] = $this->source[$item];
} elseif (is_a($this->source, 'DataList')) {
$data[] = $sourceTitles[$item];
} else {
$data[] = $item;
}
}
$values = implode(', ', $data);
}
}
$title = ($this->title) ? $this->title : '';
$field = new ReadonlyField($this->name, $title, $values);
$field->setForm($this->form);
return $field;
} | php | public function performReadonlyTransformation()
{
$values = '';
$data = [];
$items = $this->value;
if ($this->source) {
foreach ($this->source as $source) {
if (is_object($source)) {
$sourceTitles[$source->ID] = $source->Title;
}
}
}
if ($items) {
// Items is a DO Set
if (is_a($items, 'DataList')) {
foreach ($items as $item) {
$data[] = $item->Title;
}
if ($data) $values = implode(', ', $data);
// Items is an array or single piece of string (including comma seperated string)
} else {
if (!is_array($items)) {
$items = preg_split('/ *, */', trim($items));
}
foreach ($items as $item) {
if (is_array($item)) {
$data[] = $item['Title'];
} elseif (is_array($this->source) && !empty($this->source[$item])) {
$data[] = $this->source[$item];
} elseif (is_a($this->source, 'DataList')) {
$data[] = $sourceTitles[$item];
} else {
$data[] = $item;
}
}
$values = implode(', ', $data);
}
}
$title = ($this->title) ? $this->title : '';
$field = new ReadonlyField($this->name, $title, $values);
$field->setForm($this->form);
return $field;
} | [
"public",
"function",
"performReadonlyTransformation",
"(",
")",
"{",
"$",
"values",
"=",
"''",
";",
"$",
"data",
"=",
"[",
"]",
";",
"$",
"items",
"=",
"$",
"this",
"->",
"value",
";",
"if",
"(",
"$",
"this",
"->",
"source",
")",
"{",
"foreach",
"... | Transforms the source data for this CheckboxSetField
into a comma separated list of values.
@return ReadonlyField | [
"Transforms",
"the",
"source",
"data",
"for",
"this",
"CheckboxSetField",
"into",
"a",
"comma",
"separated",
"list",
"of",
"values",
"."
] | 7b0d579530a8914ddf8fc7c912d9559d59d1582a | https://github.com/symbiote/silverstripe-multivaluefield/blob/7b0d579530a8914ddf8fc7c912d9559d59d1582a/src/Fields/MultiValueCheckboxField.php#L242-L292 | train |
symbiote/silverstripe-multivaluefield | src/ORM/FieldType/MultiValueField.php | MultiValueField.getValue | public function getValue()
{
$value = $this->value;
if (is_null($value)) {
$value = $this->getField('Value');
}
$this->value = is_string($value) ? $this->unserializeData($value) : $value;
return $this->value;
} | php | public function getValue()
{
$value = $this->value;
if (is_null($value)) {
$value = $this->getField('Value');
}
$this->value = is_string($value) ? $this->unserializeData($value) : $value;
return $this->value;
} | [
"public",
"function",
"getValue",
"(",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"value",
";",
"if",
"(",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getField",
"(",
"'Value'",
")",
";",
"}",
"$",
"... | Returns the value of this field.
@return mixed | [
"Returns",
"the",
"value",
"of",
"this",
"field",
"."
] | 7b0d579530a8914ddf8fc7c912d9559d59d1582a | https://github.com/symbiote/silverstripe-multivaluefield/blob/7b0d579530a8914ddf8fc7c912d9559d59d1582a/src/ORM/FieldType/MultiValueField.php#L35-L43 | train |
symbiote/silverstripe-multivaluefield | src/ORM/FieldType/MultiValueField.php | MultiValueField.setValue | public function setValue($value, $record = null, $markChanged = true)
{
$this->changed = $this->changed || $markChanged;
if (!is_null($value)) {
// so that subsequent getValue calls re-load the value item correctly
$this->value = null;
if (!is_string($value)) {
$value = $this->serializeValue($value);
}
$value = ['Value' => $value];
}
return parent::setValue($value, $record, $markChanged);
} | php | public function setValue($value, $record = null, $markChanged = true)
{
$this->changed = $this->changed || $markChanged;
if (!is_null($value)) {
// so that subsequent getValue calls re-load the value item correctly
$this->value = null;
if (!is_string($value)) {
$value = $this->serializeValue($value);
}
$value = ['Value' => $value];
}
return parent::setValue($value, $record, $markChanged);
} | [
"public",
"function",
"setValue",
"(",
"$",
"value",
",",
"$",
"record",
"=",
"null",
",",
"$",
"markChanged",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"changed",
"=",
"$",
"this",
"->",
"changed",
"||",
"$",
"markChanged",
";",
"if",
"(",
"!",
"i... | Set the value on the field. Ensures the underlying composite field
logic that looks for Value will trigger if the value set is
For a multivalue field, this will deserialise the value if it is a string
@param mixed $value
@param array $record
@return $this | [
"Set",
"the",
"value",
"on",
"the",
"field",
".",
"Ensures",
"the",
"underlying",
"composite",
"field",
"logic",
"that",
"looks",
"for",
"Value",
"will",
"trigger",
"if",
"the",
"value",
"set",
"is"
] | 7b0d579530a8914ddf8fc7c912d9559d59d1582a | https://github.com/symbiote/silverstripe-multivaluefield/blob/7b0d579530a8914ddf8fc7c912d9559d59d1582a/src/ORM/FieldType/MultiValueField.php#L61-L73 | train |
symbiote/silverstripe-multivaluefield | src/ORM/FieldType/MultiValueField.php | MultiValueField.serializeValue | protected function serializeValue($value)
{
if (is_string($value)) {
return $value;
}
if (is_object($value) || is_array($value)) {
return json_encode($value);
}
} | php | protected function serializeValue($value)
{
if (is_string($value)) {
return $value;
}
if (is_object($value) || is_array($value)) {
return json_encode($value);
}
} | [
"protected",
"function",
"serializeValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"value",
";",
"}",
"if",
"(",
"is_object",
"(",
"$",
"value",
")",
"||",
"is_array",
"(",
"$",
"value",
... | Serializes a value object to a json string
@param array|object $value
@return string | [
"Serializes",
"a",
"value",
"object",
"to",
"a",
"json",
"string"
] | 7b0d579530a8914ddf8fc7c912d9559d59d1582a | https://github.com/symbiote/silverstripe-multivaluefield/blob/7b0d579530a8914ddf8fc7c912d9559d59d1582a/src/ORM/FieldType/MultiValueField.php#L81-L89 | train |
symbiote/silverstripe-multivaluefield | src/ORM/FieldType/MultiValueField.php | MultiValueField.unserializeData | protected function unserializeData($data)
{
$value = null;
// if we're not deserialised yet, do so
if (is_string($data) && strlen($data) > 1) {
// are we json encoded?
if ($data{1} === ':') {
$value = \unserialize($data);
} else {
$value = \json_decode($data, true);
}
}
return $value;
} | php | protected function unserializeData($data)
{
$value = null;
// if we're not deserialised yet, do so
if (is_string($data) && strlen($data) > 1) {
// are we json encoded?
if ($data{1} === ':') {
$value = \unserialize($data);
} else {
$value = \json_decode($data, true);
}
}
return $value;
} | [
"protected",
"function",
"unserializeData",
"(",
"$",
"data",
")",
"{",
"$",
"value",
"=",
"null",
";",
"// if we're not deserialised yet, do so",
"if",
"(",
"is_string",
"(",
"$",
"data",
")",
"&&",
"strlen",
"(",
"$",
"data",
")",
">",
"1",
")",
"{",
"... | Unserialises data, depending on new or old format
@param string $data
@return array | [
"Unserialises",
"data",
"depending",
"on",
"new",
"or",
"old",
"format"
] | 7b0d579530a8914ddf8fc7c912d9559d59d1582a | https://github.com/symbiote/silverstripe-multivaluefield/blob/7b0d579530a8914ddf8fc7c912d9559d59d1582a/src/ORM/FieldType/MultiValueField.php#L98-L111 | train |
ochi51/cybozu-http | src/Api/User/Csv.php | Csv.get | public function get($type): string
{
if (!in_array($type, self::$type, true)) {
throw new \InvalidArgumentException('Invalid type parameter');
}
$content = (string)$this->client
->get(UserApi::generateUrl("csv/{$type}.csv"))
->getBody();
return $content;
} | php | public function get($type): string
{
if (!in_array($type, self::$type, true)) {
throw new \InvalidArgumentException('Invalid type parameter');
}
$content = (string)$this->client
->get(UserApi::generateUrl("csv/{$type}.csv"))
->getBody();
return $content;
} | [
"public",
"function",
"get",
"(",
"$",
"type",
")",
":",
"string",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"type",
",",
"self",
"::",
"$",
"type",
",",
"true",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Invalid type para... | Get csv file
@param string $type
@return string
@throws \InvalidArgumentException | [
"Get",
"csv",
"file"
] | dd137ef775099d7ab2734b6a3764433c18d7937b | https://github.com/ochi51/cybozu-http/blob/dd137ef775099d7ab2734b6a3764433c18d7937b/src/Api/User/Csv.php#L42-L53 | train |
ochi51/cybozu-http | src/Api/User/Csv.php | Csv.post | public function post($type, $filename): int
{
return $this->postKey($type, $this->file($filename));
} | php | public function post($type, $filename): int
{
return $this->postKey($type, $this->file($filename));
} | [
"public",
"function",
"post",
"(",
"$",
"type",
",",
"$",
"filename",
")",
":",
"int",
"{",
"return",
"$",
"this",
"->",
"postKey",
"(",
"$",
"type",
",",
"$",
"this",
"->",
"file",
"(",
"$",
"filename",
")",
")",
";",
"}"
] | Post csv file
@param string $type
@param string $filename
@return int
@throws \InvalidArgumentException | [
"Post",
"csv",
"file"
] | dd137ef775099d7ab2734b6a3764433c18d7937b | https://github.com/ochi51/cybozu-http/blob/dd137ef775099d7ab2734b6a3764433c18d7937b/src/Api/User/Csv.php#L63-L66 | train |
ochi51/cybozu-http | src/Api/User/Csv.php | Csv.postKey | public function postKey($type, $fileKey): int
{
if (!in_array($type, self::$type, true)) {
throw new \InvalidArgumentException('Invalid type parameter');
}
$options = ['json' => ['fileKey' => $fileKey]];
/** @var JsonStream $stream */
$stream = $this->client
->post(UserApi::generateUrl("csv/{$type}.json"), $options)
->getBody();
return $stream->jsonSerialize()['id'];
} | php | public function postKey($type, $fileKey): int
{
if (!in_array($type, self::$type, true)) {
throw new \InvalidArgumentException('Invalid type parameter');
}
$options = ['json' => ['fileKey' => $fileKey]];
/** @var JsonStream $stream */
$stream = $this->client
->post(UserApi::generateUrl("csv/{$type}.json"), $options)
->getBody();
return $stream->jsonSerialize()['id'];
} | [
"public",
"function",
"postKey",
"(",
"$",
"type",
",",
"$",
"fileKey",
")",
":",
"int",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"type",
",",
"self",
"::",
"$",
"type",
",",
"true",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
... | Post file key
@param string $type
@param string $fileKey
@return int
@throws \InvalidArgumentException | [
"Post",
"file",
"key"
] | dd137ef775099d7ab2734b6a3764433c18d7937b | https://github.com/ochi51/cybozu-http/blob/dd137ef775099d7ab2734b6a3764433c18d7937b/src/Api/User/Csv.php#L76-L90 | train |
ScriptFUSION/Porter | src/Connector/ImportConnector.php | ImportConnector.findBaseConnector | public function findBaseConnector()
{
$connector = $this->connector;
while ($connector instanceof ConnectorWrapper) {
$connector = $connector->getWrappedConnector();
}
return $connector;
} | php | public function findBaseConnector()
{
$connector = $this->connector;
while ($connector instanceof ConnectorWrapper) {
$connector = $connector->getWrappedConnector();
}
return $connector;
} | [
"public",
"function",
"findBaseConnector",
"(",
")",
"{",
"$",
"connector",
"=",
"$",
"this",
"->",
"connector",
";",
"while",
"(",
"$",
"connector",
"instanceof",
"ConnectorWrapper",
")",
"{",
"$",
"connector",
"=",
"$",
"connector",
"->",
"getWrappedConnecto... | Finds the base connector by traversing the stack of wrapped connectors.
@return Connector Base connector. | [
"Finds",
"the",
"base",
"connector",
"by",
"traversing",
"the",
"stack",
"of",
"wrapped",
"connectors",
"."
] | c50bc62e56993c4860b1d62819679a6c6e9ec913 | https://github.com/ScriptFUSION/Porter/blob/c50bc62e56993c4860b1d62819679a6c6e9ec913/src/Connector/ImportConnector.php#L49-L58 | train |
FriendsOfPHP/Sismo | src/Sismo/Contrib/WallpaperNotifier.php | WallpaperNotifier.updateBackground | private function updateBackground($data)
{
$this->updatedAt = microtime(true);
$this->image = imagecreatetruecolor($this->get('image_width'), $this->get('image_height'));
imageantialias($this->image, true);
$this->initializeColors();
imagefill($this->image, 0, 0, $this->get('background_color'));
$numProject = 0;
foreach ($data['projects'] as $project => $builds) {
// the most recent build is always shown on top
rsort($builds);
$x1 = $this->get('horizontal_padding') + (($this->get('bar_width') + $this->get('horizontal_gutter')) * $numProject);
$x2 = $x1 + $this->get('bar_width');
// plot each project slug
$this->addTextToImage(
substr($project, 0, $this->get('max_number_letters')),
$x1,
$this->get('vertical_padding') - 0.2 * $this->get('font_size')
);
foreach ($builds as $i => $build) {
$y1 = $this->get('vertical_padding') + $this->get('font_size') + (($this->get('bar_height') + $this->get('vertical_gutter')) * $i);
$y2 = $y1 + $this->get('bar_height');
$color = 'ok' == $build ? $this->get('success_color') : $this->get('failure_color');
// plot a bar for each project build
imageFilledRectangle($this->image, $x1, $y1, $x2, $y2, $color);
}
$numProject++;
}
$this->addTextToImage(
'Last update: '.$data['last_update'],
$this->get('horizontal_padding'),
$this->get('image_height') - $this->get('font_size')
);
// Hack: two different images are needed to update the wallpaper
// One holds the current wallpaper and the other is the new one
// If you use just one image and modify it, the OS doesn't reload it
if (file_exists($this->evenBackgroundImagePath)) {
$this->imagePath = $this->oddBackgroundImagePath;
unlink($this->evenBackgroundImagePath);
} elseif (file_exists($this->oddBackgroundImagePath)) {
$this->imagePath = $this->evenBackgroundImagePath;
unlink($this->oddBackgroundImagePath);
} else {
$this->imagePath = $this->oddBackgroundImagePath;
}
imagepng($this->image, $this->imagePath);
imagedestroy($this->image);
// Wallpaper is reloaded via AppleScript
$scriptPath = $this->dir.'/update-background.scpt';
file_put_contents($scriptPath, <<<END
tell application "System Events"
tell current desktop
set picture to POSIX file "file://localhost/$this->imagePath"
end tell
end tell
END
);
system("osascript $scriptPath");
} | php | private function updateBackground($data)
{
$this->updatedAt = microtime(true);
$this->image = imagecreatetruecolor($this->get('image_width'), $this->get('image_height'));
imageantialias($this->image, true);
$this->initializeColors();
imagefill($this->image, 0, 0, $this->get('background_color'));
$numProject = 0;
foreach ($data['projects'] as $project => $builds) {
// the most recent build is always shown on top
rsort($builds);
$x1 = $this->get('horizontal_padding') + (($this->get('bar_width') + $this->get('horizontal_gutter')) * $numProject);
$x2 = $x1 + $this->get('bar_width');
// plot each project slug
$this->addTextToImage(
substr($project, 0, $this->get('max_number_letters')),
$x1,
$this->get('vertical_padding') - 0.2 * $this->get('font_size')
);
foreach ($builds as $i => $build) {
$y1 = $this->get('vertical_padding') + $this->get('font_size') + (($this->get('bar_height') + $this->get('vertical_gutter')) * $i);
$y2 = $y1 + $this->get('bar_height');
$color = 'ok' == $build ? $this->get('success_color') : $this->get('failure_color');
// plot a bar for each project build
imageFilledRectangle($this->image, $x1, $y1, $x2, $y2, $color);
}
$numProject++;
}
$this->addTextToImage(
'Last update: '.$data['last_update'],
$this->get('horizontal_padding'),
$this->get('image_height') - $this->get('font_size')
);
// Hack: two different images are needed to update the wallpaper
// One holds the current wallpaper and the other is the new one
// If you use just one image and modify it, the OS doesn't reload it
if (file_exists($this->evenBackgroundImagePath)) {
$this->imagePath = $this->oddBackgroundImagePath;
unlink($this->evenBackgroundImagePath);
} elseif (file_exists($this->oddBackgroundImagePath)) {
$this->imagePath = $this->evenBackgroundImagePath;
unlink($this->oddBackgroundImagePath);
} else {
$this->imagePath = $this->oddBackgroundImagePath;
}
imagepng($this->image, $this->imagePath);
imagedestroy($this->image);
// Wallpaper is reloaded via AppleScript
$scriptPath = $this->dir.'/update-background.scpt';
file_put_contents($scriptPath, <<<END
tell application "System Events"
tell current desktop
set picture to POSIX file "file://localhost/$this->imagePath"
end tell
end tell
END
);
system("osascript $scriptPath");
} | [
"private",
"function",
"updateBackground",
"(",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"updatedAt",
"=",
"microtime",
"(",
"true",
")",
";",
"$",
"this",
"->",
"image",
"=",
"imagecreatetruecolor",
"(",
"$",
"this",
"->",
"get",
"(",
"'image_width'",
... | Generates a wallpaper with the latest data and updates desktop background
@param array $data Array with the latest build history per project | [
"Generates",
"a",
"wallpaper",
"with",
"the",
"latest",
"data",
"and",
"updates",
"desktop",
"background"
] | 0b35bd0033a6c3b509ce7bf417ddc83bccfb2f68 | https://github.com/FriendsOfPHP/Sismo/blob/0b35bd0033a6c3b509ce7bf417ddc83bccfb2f68/src/Sismo/Contrib/WallpaperNotifier.php#L68-L138 | train |
FriendsOfPHP/Sismo | src/Sismo/Contrib/WallpaperNotifier.php | WallpaperNotifier.addTextToImage | private function addTextToImage($text, $x, $y)
{
imagettftext($this->image, $this->get('font_size'), 0, $x, $y, $this->get('text_color'), $this->dir.'/instruction.ttf', $text);
} | php | private function addTextToImage($text, $x, $y)
{
imagettftext($this->image, $this->get('font_size'), 0, $x, $y, $this->get('text_color'), $this->dir.'/instruction.ttf', $text);
} | [
"private",
"function",
"addTextToImage",
"(",
"$",
"text",
",",
"$",
"x",
",",
"$",
"y",
")",
"{",
"imagettftext",
"(",
"$",
"this",
"->",
"image",
",",
"$",
"this",
"->",
"get",
"(",
"'font_size'",
")",
",",
"0",
",",
"$",
"x",
",",
"$",
"y",
... | Convenience method to add text to a GD image.
@param string $text The string to be plotted
@param int $x The x coordinate where the string will be plotted
@param int $y The y coordinate where the string will be plotted | [
"Convenience",
"method",
"to",
"add",
"text",
"to",
"a",
"GD",
"image",
"."
] | 0b35bd0033a6c3b509ce7bf417ddc83bccfb2f68 | https://github.com/FriendsOfPHP/Sismo/blob/0b35bd0033a6c3b509ce7bf417ddc83bccfb2f68/src/Sismo/Contrib/WallpaperNotifier.php#L147-L150 | train |
FriendsOfPHP/Sismo | src/Sismo/Contrib/WallpaperNotifier.php | WallpaperNotifier.initializeImageOptions | private function initializeImageOptions($userOptions)
{
$this->imageOptions = array_merge(array(
'bar_width' => 80,
'bar_height' => 10,
'horizontal_gutter' => 20,
'vertical_gutter' => 10,
'horizontal_padding' => 20,
'vertical_padding' => 50,
'image_width' => 1920,
'image_height' => 1080,
'background_color' => '#161616',
'text_color' => '#CCCCCC',
'success_color' => '#267326',
'failure_color' => '#B30F00',
'font_size' => 10,
), $userOptions);
$this->set('max_number_bars', ($this->get('image_height') - $this->get('vertical_padding') - (2 * $this->get('font_size')) - (2 * $this->get('vertical_gutter'))) / ($this->get('bar_height') + $this->get('vertical_gutter')));
$this->set('max_number_letters', floor($this->get('bar_width') / (0.7 * $this->get('font_size'))));
$this->image = null;
} | php | private function initializeImageOptions($userOptions)
{
$this->imageOptions = array_merge(array(
'bar_width' => 80,
'bar_height' => 10,
'horizontal_gutter' => 20,
'vertical_gutter' => 10,
'horizontal_padding' => 20,
'vertical_padding' => 50,
'image_width' => 1920,
'image_height' => 1080,
'background_color' => '#161616',
'text_color' => '#CCCCCC',
'success_color' => '#267326',
'failure_color' => '#B30F00',
'font_size' => 10,
), $userOptions);
$this->set('max_number_bars', ($this->get('image_height') - $this->get('vertical_padding') - (2 * $this->get('font_size')) - (2 * $this->get('vertical_gutter'))) / ($this->get('bar_height') + $this->get('vertical_gutter')));
$this->set('max_number_letters', floor($this->get('bar_width') / (0.7 * $this->get('font_size'))));
$this->image = null;
} | [
"private",
"function",
"initializeImageOptions",
"(",
"$",
"userOptions",
")",
"{",
"$",
"this",
"->",
"imageOptions",
"=",
"array_merge",
"(",
"array",
"(",
"'bar_width'",
"=>",
"80",
",",
"'bar_height'",
"=>",
"10",
",",
"'horizontal_gutter'",
"=>",
"20",
",... | Initializes the options that control wallpaper design
@param array $userOptions The options given by the user,
which override default values | [
"Initializes",
"the",
"options",
"that",
"control",
"wallpaper",
"design"
] | 0b35bd0033a6c3b509ce7bf417ddc83bccfb2f68 | https://github.com/FriendsOfPHP/Sismo/blob/0b35bd0033a6c3b509ce7bf417ddc83bccfb2f68/src/Sismo/Contrib/WallpaperNotifier.php#L179-L202 | train |
FriendsOfPHP/Sismo | src/Sismo/Contrib/WallpaperNotifier.php | WallpaperNotifier.initializeTempDirectory | private function initializeTempDirectory()
{
$this->dir = __DIR__.'/.wallpaperNotifier';
if (!file_exists($this->dir)) {
try {
mkdir($this->dir);
} catch (Exception $e) {
throw new \RuntimeException(sprintf(
"Wallpaper notifier requires a directory to hold its contents\n"
."'%s' directory couldn't be created",
$this->dir
));
}
}
// Hack: two different images are needed to reload the desktop background
// One holds the current wallpaper, the other one is the new background
// If you have just one image and modify it, the OS doesn't reload it
$this->evenBackgroundImagePath = realpath($this->dir).'/even-background.png';
$this->oddBackgroundImagePath = realpath($this->dir).'/odd-background.png';
} | php | private function initializeTempDirectory()
{
$this->dir = __DIR__.'/.wallpaperNotifier';
if (!file_exists($this->dir)) {
try {
mkdir($this->dir);
} catch (Exception $e) {
throw new \RuntimeException(sprintf(
"Wallpaper notifier requires a directory to hold its contents\n"
."'%s' directory couldn't be created",
$this->dir
));
}
}
// Hack: two different images are needed to reload the desktop background
// One holds the current wallpaper, the other one is the new background
// If you have just one image and modify it, the OS doesn't reload it
$this->evenBackgroundImagePath = realpath($this->dir).'/even-background.png';
$this->oddBackgroundImagePath = realpath($this->dir).'/odd-background.png';
} | [
"private",
"function",
"initializeTempDirectory",
"(",
")",
"{",
"$",
"this",
"->",
"dir",
"=",
"__DIR__",
".",
"'/.wallpaperNotifier'",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"dir",
")",
")",
"{",
"try",
"{",
"mkdir",
"(",
"$",
"t... | This notifier requires a directory to save several files. This method
creates a hidden directory called `.wallpaperNotifier` if it doesn't exist. | [
"This",
"notifier",
"requires",
"a",
"directory",
"to",
"save",
"several",
"files",
".",
"This",
"method",
"creates",
"a",
"hidden",
"directory",
"called",
".",
"wallpaperNotifier",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | 0b35bd0033a6c3b509ce7bf417ddc83bccfb2f68 | https://github.com/FriendsOfPHP/Sismo/blob/0b35bd0033a6c3b509ce7bf417ddc83bccfb2f68/src/Sismo/Contrib/WallpaperNotifier.php#L208-L229 | train |
FriendsOfPHP/Sismo | src/Sismo/Contrib/WallpaperNotifier.php | WallpaperNotifier.initializeLogFile | private function initializeLogFile()
{
$this->log = $this->dir.'/builds.log';
if (!file_exists($this->log)) {
$data = array(
'last_update' => null,
'projects' => array(),
);
file_put_contents($this->log, serialize($data));
}
} | php | private function initializeLogFile()
{
$this->log = $this->dir.'/builds.log';
if (!file_exists($this->log)) {
$data = array(
'last_update' => null,
'projects' => array(),
);
file_put_contents($this->log, serialize($data));
}
} | [
"private",
"function",
"initializeLogFile",
"(",
")",
"{",
"$",
"this",
"->",
"log",
"=",
"$",
"this",
"->",
"dir",
".",
"'/builds.log'",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"log",
")",
")",
"{",
"$",
"data",
"=",
"array",
"... | This method checks that the build history log file exists.
If it doesn't exist, the method creates and initializes it. | [
"This",
"method",
"checks",
"that",
"the",
"build",
"history",
"log",
"file",
"exists",
".",
"If",
"it",
"doesn",
"t",
"exist",
"the",
"method",
"creates",
"and",
"initializes",
"it",
"."
] | 0b35bd0033a6c3b509ce7bf417ddc83bccfb2f68 | https://github.com/FriendsOfPHP/Sismo/blob/0b35bd0033a6c3b509ce7bf417ddc83bccfb2f68/src/Sismo/Contrib/WallpaperNotifier.php#L235-L247 | train |
FriendsOfPHP/Sismo | src/Sismo/Contrib/WallpaperNotifier.php | WallpaperNotifier.initializeColors | private function initializeColors()
{
$rgb = $this->hex2rgb($this->get('background_color'));
$this->set('background_color', imagecolorallocate($this->image, $rgb[0], $rgb[1], $rgb[2]));
$rgb = $this->hex2rgb($this->get('text_color'));
$this->set('text_color', imagecolorallocate($this->image, $rgb[0], $rgb[1], $rgb[2]));
$rgb = $this->hex2rgb($this->get('success_color'));
$this->set('success_color', imagecolorallocate($this->image, $rgb[0], $rgb[1], $rgb[2]));
$rgb = $this->hex2rgb($this->get('failure_color'));
$this->set('failure_color', imagecolorallocate($this->image, $rgb[0], $rgb[1], $rgb[2]));
} | php | private function initializeColors()
{
$rgb = $this->hex2rgb($this->get('background_color'));
$this->set('background_color', imagecolorallocate($this->image, $rgb[0], $rgb[1], $rgb[2]));
$rgb = $this->hex2rgb($this->get('text_color'));
$this->set('text_color', imagecolorallocate($this->image, $rgb[0], $rgb[1], $rgb[2]));
$rgb = $this->hex2rgb($this->get('success_color'));
$this->set('success_color', imagecolorallocate($this->image, $rgb[0], $rgb[1], $rgb[2]));
$rgb = $this->hex2rgb($this->get('failure_color'));
$this->set('failure_color', imagecolorallocate($this->image, $rgb[0], $rgb[1], $rgb[2]));
} | [
"private",
"function",
"initializeColors",
"(",
")",
"{",
"$",
"rgb",
"=",
"$",
"this",
"->",
"hex2rgb",
"(",
"$",
"this",
"->",
"get",
"(",
"'background_color'",
")",
")",
";",
"$",
"this",
"->",
"set",
"(",
"'background_color'",
",",
"imagecolorallocate"... | Transforms hexadecimal colors to the color format used by GD images. | [
"Transforms",
"hexadecimal",
"colors",
"to",
"the",
"color",
"format",
"used",
"by",
"GD",
"images",
"."
] | 0b35bd0033a6c3b509ce7bf417ddc83bccfb2f68 | https://github.com/FriendsOfPHP/Sismo/blob/0b35bd0033a6c3b509ce7bf417ddc83bccfb2f68/src/Sismo/Contrib/WallpaperNotifier.php#L853-L866 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.