id int32 0 241k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
222,000 | claroline/CoreBundle | Controller/ResourcePropertiesController.php | ResourcePropertiesController.checkAccess | private function checkAccess($permission, $collection)
{
if (!$this->authorization->isGranted($permission, $collection)) {
throw new AccessDeniedException(print_r($collection->getErrorsForDisplay(), true));
}
} | php | private function checkAccess($permission, $collection)
{
if (!$this->authorization->isGranted($permission, $collection)) {
throw new AccessDeniedException(print_r($collection->getErrorsForDisplay(), true));
}
} | [
"private",
"function",
"checkAccess",
"(",
"$",
"permission",
",",
"$",
"collection",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"authorization",
"->",
"isGranted",
"(",
"$",
"permission",
",",
"$",
"collection",
")",
")",
"{",
"throw",
"new",
"AccessD... | Checks if the current user has the right to do an action on a ResourceCollection.
Be carrefull, ResourceCollection may need some aditionnal parameters.
- for CREATE: $collection->setAttributes(array('type' => $resourceType))
where $resourceType is the name of the resource type.
- for MOVE / COPY $collection->setAttrib... | [
"Checks",
"if",
"the",
"current",
"user",
"has",
"the",
"right",
"to",
"do",
"an",
"action",
"on",
"a",
"ResourceCollection",
".",
"Be",
"carrefull",
"ResourceCollection",
"may",
"need",
"some",
"aditionnal",
"parameters",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Controller/ResourcePropertiesController.php#L327-L332 |
222,001 | claroline/CoreBundle | Manager/WidgetManager.php | WidgetManager.createInstance | public function createInstance(
Widget $widget,
$isAdmin,
$isDesktop,
User $user = null,
Workspace $ws = null
)
{
if (!$widget->isDisplayableInDesktop()) {
if ($isDesktop || $user) {
throw new \Exception("This widget doesn't support the... | php | public function createInstance(
Widget $widget,
$isAdmin,
$isDesktop,
User $user = null,
Workspace $ws = null
)
{
if (!$widget->isDisplayableInDesktop()) {
if ($isDesktop || $user) {
throw new \Exception("This widget doesn't support the... | [
"public",
"function",
"createInstance",
"(",
"Widget",
"$",
"widget",
",",
"$",
"isAdmin",
",",
"$",
"isDesktop",
",",
"User",
"$",
"user",
"=",
"null",
",",
"Workspace",
"$",
"ws",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"widget",
"->",
"isDispl... | Creates a widget instance.
@param \Claroline\CoreBundle\Entity\Widget\Widget $widget
@param boolean $isAdmin
@param boolean $isDesktop
@param \Claroline\CoreBundle\Entity\User $user
@p... | [
"Creates",
"a",
"widget",
"instance",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/WidgetManager.php#L69-L100 |
222,002 | claroline/CoreBundle | Manager/WorkspaceManager.php | WorkspaceManager.rename | public function rename(Workspace $workspace, $name)
{
$workspace->setName($name);
$root = $this->resourceManager->getWorkspaceRoot($workspace);
$root->setName($name);
$this->om->persist($workspace);
$this->om->persist($root);
$this->om->flush();
} | php | public function rename(Workspace $workspace, $name)
{
$workspace->setName($name);
$root = $this->resourceManager->getWorkspaceRoot($workspace);
$root->setName($name);
$this->om->persist($workspace);
$this->om->persist($root);
$this->om->flush();
} | [
"public",
"function",
"rename",
"(",
"Workspace",
"$",
"workspace",
",",
"$",
"name",
")",
"{",
"$",
"workspace",
"->",
"setName",
"(",
"$",
"name",
")",
";",
"$",
"root",
"=",
"$",
"this",
"->",
"resourceManager",
"->",
"getWorkspaceRoot",
"(",
"$",
"... | Rename a workspace.
@param \Claroline\CoreBundle\Entity\Workspace\Workspace $workspace
@param string $name | [
"Rename",
"a",
"workspace",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/WorkspaceManager.php#L153-L161 |
222,003 | claroline/CoreBundle | Manager/WorkspaceManager.php | WorkspaceManager.create | public function create(Configuration $configuration, User $manager)
{
$transfertManager = $this->container->get('claroline.manager.transfert_manager');
if ($this->logger) $transfertManager->setLogger($this->logger);
$workspace = $transfertManager->createWorkspace($configuration, $manager);
... | php | public function create(Configuration $configuration, User $manager)
{
$transfertManager = $this->container->get('claroline.manager.transfert_manager');
if ($this->logger) $transfertManager->setLogger($this->logger);
$workspace = $transfertManager->createWorkspace($configuration, $manager);
... | [
"public",
"function",
"create",
"(",
"Configuration",
"$",
"configuration",
",",
"User",
"$",
"manager",
")",
"{",
"$",
"transfertManager",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'claroline.manager.transfert_manager'",
")",
";",
"if",
"(",
"$"... | Creates a workspace.
@param \Claroline\CoreBundle\Library\Workspace\Configuration $configuration
@param \Claroline\CoreBundle\Entity\User $manager
@param bool $createUsers
@param bool $importUsers
@re... | [
"Creates",
"a",
"workspace",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/WorkspaceManager.php#L173-L180 |
222,004 | claroline/CoreBundle | Manager/WorkspaceManager.php | WorkspaceManager.importInExistingWorkspace | public function importInExistingWorkspace(Configuration $configuration, Workspace $workspace)
{
$root = $this->resourceManager->getResourceFromNode($this->resourceManager->getWorkspaceRoot($workspace));
$wsRoles = $this->roleManager->getRolesByWorkspace($workspace);
$entityRoles = [];
... | php | public function importInExistingWorkspace(Configuration $configuration, Workspace $workspace)
{
$root = $this->resourceManager->getResourceFromNode($this->resourceManager->getWorkspaceRoot($workspace));
$wsRoles = $this->roleManager->getRolesByWorkspace($workspace);
$entityRoles = [];
... | [
"public",
"function",
"importInExistingWorkspace",
"(",
"Configuration",
"$",
"configuration",
",",
"Workspace",
"$",
"workspace",
")",
"{",
"$",
"root",
"=",
"$",
"this",
"->",
"resourceManager",
"->",
"getResourceFromNode",
"(",
"$",
"this",
"->",
"resourceManag... | Import the content of an archive in a workspace.
@param Configuration $configuration
@param Workspace $workspace
@return Workspace | [
"Import",
"the",
"content",
"of",
"an",
"archive",
"in",
"a",
"workspace",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/WorkspaceManager.php#L861-L880 |
222,005 | claroline/CoreBundle | Manager/WorkspaceManager.php | WorkspaceManager.countResources | public function countResources(Workspace $workspace)
{
//@todo count directory from dql
$root = $this->resourceManager->getWorkspaceRoot($workspace);
if (!$root) return 0;
$descendants = $this->resourceManager->getDescendants($root);
return count($descendants);
} | php | public function countResources(Workspace $workspace)
{
//@todo count directory from dql
$root = $this->resourceManager->getWorkspaceRoot($workspace);
if (!$root) return 0;
$descendants = $this->resourceManager->getDescendants($root);
return count($descendants);
} | [
"public",
"function",
"countResources",
"(",
"Workspace",
"$",
"workspace",
")",
"{",
"//@todo count directory from dql",
"$",
"root",
"=",
"$",
"this",
"->",
"resourceManager",
"->",
"getWorkspaceRoot",
"(",
"$",
"workspace",
")",
";",
"if",
"(",
"!",
"$",
"r... | Count the number of resources in a workspace
@param Workspace $workspace
@return integer | [
"Count",
"the",
"number",
"of",
"resources",
"in",
"a",
"workspace"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/WorkspaceManager.php#L1036-L1044 |
222,006 | claroline/CoreBundle | Listener/Tool/ResourceManagerListener.php | ResourceManagerListener.resourceWorkspace | public function resourceWorkspace($workspaceId)
{
if (!$this->request) {
throw new NoHttpRequestException();
}
$breadcrumbsIds = $this->request->query->get('_breadcrumbs');
if ($breadcrumbsIds != null) {
$ancestors = $this->manager->getByIds($breadcrumbsIds)... | php | public function resourceWorkspace($workspaceId)
{
if (!$this->request) {
throw new NoHttpRequestException();
}
$breadcrumbsIds = $this->request->query->get('_breadcrumbs');
if ($breadcrumbsIds != null) {
$ancestors = $this->manager->getByIds($breadcrumbsIds)... | [
"public",
"function",
"resourceWorkspace",
"(",
"$",
"workspaceId",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"request",
")",
"{",
"throw",
"new",
"NoHttpRequestException",
"(",
")",
";",
"}",
"$",
"breadcrumbsIds",
"=",
"$",
"this",
"->",
"request",
... | Renders the resources page with its layout.
@param integer $workspaceId
@throws \Claroline\CoreBundle\Listener\NoHttpRequestException
@throws \Exception
@return string | [
"Renders",
"the",
"resources",
"page",
"with",
"its",
"layout",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Listener/Tool/ResourceManagerListener.php#L136-L179 |
222,007 | claroline/CoreBundle | Listener/Tool/ResourceManagerListener.php | ResourceManagerListener.resourceDesktop | public function resourceDesktop()
{
$resourceTypes = $this->em->getRepository('ClarolineCoreBundle:Resource\ResourceType')->findAll();
$resourceActions = $this->em->getRepository('ClarolineCoreBundle:Resource\MenuAction')
->findByResourceType(null);
return $this->templating->ren... | php | public function resourceDesktop()
{
$resourceTypes = $this->em->getRepository('ClarolineCoreBundle:Resource\ResourceType')->findAll();
$resourceActions = $this->em->getRepository('ClarolineCoreBundle:Resource\MenuAction')
->findByResourceType(null);
return $this->templating->ren... | [
"public",
"function",
"resourceDesktop",
"(",
")",
"{",
"$",
"resourceTypes",
"=",
"$",
"this",
"->",
"em",
"->",
"getRepository",
"(",
"'ClarolineCoreBundle:Resource\\ResourceType'",
")",
"->",
"findAll",
"(",
")",
";",
"$",
"resourceActions",
"=",
"$",
"this",... | Displays the resource manager.
@return string | [
"Displays",
"the",
"resource",
"manager",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Listener/Tool/ResourceManagerListener.php#L186-L201 |
222,008 | claroline/CoreBundle | Library/Utilities/ZipArchive.php | ZipArchive.extractTo | public function extractTo($extractPath, $files = null)
{
$fs = new FileSystem();
$ds = DIRECTORY_SEPARATOR;
for ($i = 0; $i < $this->numFiles; $i++) {
$oldName = parent::getNameIndex($i);
$newName = mb_convert_encoding(
$this->getNameIndex($i),
... | php | public function extractTo($extractPath, $files = null)
{
$fs = new FileSystem();
$ds = DIRECTORY_SEPARATOR;
for ($i = 0; $i < $this->numFiles; $i++) {
$oldName = parent::getNameIndex($i);
$newName = mb_convert_encoding(
$this->getNameIndex($i),
... | [
"public",
"function",
"extractTo",
"(",
"$",
"extractPath",
",",
"$",
"files",
"=",
"null",
")",
"{",
"$",
"fs",
"=",
"new",
"FileSystem",
"(",
")",
";",
"$",
"ds",
"=",
"DIRECTORY_SEPARATOR",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"... | It actually works but in this code lies madness. | [
"It",
"actually",
"works",
"but",
"in",
"this",
"code",
"lies",
"madness",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Library/Utilities/ZipArchive.php#L19-L57 |
222,009 | claroline/CoreBundle | Repository/ResourceQueryBuilder.php | ResourceQueryBuilder.whereInUserWorkspace | public function whereInUserWorkspace(User $user)
{
$eol = PHP_EOL;
$clause =
"node.workspace IN{$eol}" .
"({$eol}" .
" SELECT aw FROM Claroline\CoreBundle\Entity\Workspace\Workspace aw{$eol}" .
" JOIN aw.roles r{$eol}" .
" WHERE r ... | php | public function whereInUserWorkspace(User $user)
{
$eol = PHP_EOL;
$clause =
"node.workspace IN{$eol}" .
"({$eol}" .
" SELECT aw FROM Claroline\CoreBundle\Entity\Workspace\Workspace aw{$eol}" .
" JOIN aw.roles r{$eol}" .
" WHERE r ... | [
"public",
"function",
"whereInUserWorkspace",
"(",
"User",
"$",
"user",
")",
"{",
"$",
"eol",
"=",
"PHP_EOL",
";",
"$",
"clause",
"=",
"\"node.workspace IN{$eol}\"",
".",
"\"({$eol}\"",
".",
"\" SELECT aw FROM Claroline\\CoreBundle\\Entity\\Workspace\\Workspace aw{$eol}\... | Filters nodes belonging to any of the workspaces a given user has access to.
@param User $user
@return ResourceQueryBuilder | [
"Filters",
"nodes",
"belonging",
"to",
"any",
"of",
"the",
"workspaces",
"a",
"given",
"user",
"has",
"access",
"to",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Repository/ResourceQueryBuilder.php#L228-L247 |
222,010 | claroline/CoreBundle | Repository/ResourceQueryBuilder.php | ResourceQueryBuilder.whereTypeIn | public function whereTypeIn(array $types)
{
if (count($types) > 0) {
$this->joinSingleRelatives = true;
$clause = '';
for ($i = 0, $count = count($types); $i < $count; $i++) {
$clause .= $i === 0 ?
"resourceType.name = :type_{$i}" :
... | php | public function whereTypeIn(array $types)
{
if (count($types) > 0) {
$this->joinSingleRelatives = true;
$clause = '';
for ($i = 0, $count = count($types); $i < $count; $i++) {
$clause .= $i === 0 ?
"resourceType.name = :type_{$i}" :
... | [
"public",
"function",
"whereTypeIn",
"(",
"array",
"$",
"types",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"types",
")",
">",
"0",
")",
"{",
"$",
"this",
"->",
"joinSingleRelatives",
"=",
"true",
";",
"$",
"clause",
"=",
"''",
";",
"for",
"(",
"$",
... | Filters nodes of any of the given types.
@param array[string] $types
@return ResourceQueryBuilder | [
"Filters",
"nodes",
"of",
"any",
"of",
"the",
"given",
"types",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Repository/ResourceQueryBuilder.php#L256-L274 |
222,011 | claroline/CoreBundle | Repository/ResourceQueryBuilder.php | ResourceQueryBuilder.whereRootIn | public function whereRootIn(array $roots)
{
if (0 !== $count = count($roots)) {
$eol = PHP_EOL;
$clause = "{$eol}({$eol}";
for ($i = 0; $i < $count; $i++) {
$clause .= $i > 0 ? ' OR ' : ' ';
$clause .= "node.path LIKE :root_{$i}{$eol... | php | public function whereRootIn(array $roots)
{
if (0 !== $count = count($roots)) {
$eol = PHP_EOL;
$clause = "{$eol}({$eol}";
for ($i = 0; $i < $count; $i++) {
$clause .= $i > 0 ? ' OR ' : ' ';
$clause .= "node.path LIKE :root_{$i}{$eol... | [
"public",
"function",
"whereRootIn",
"(",
"array",
"$",
"roots",
")",
"{",
"if",
"(",
"0",
"!==",
"$",
"count",
"=",
"count",
"(",
"$",
"roots",
")",
")",
"{",
"$",
"eol",
"=",
"PHP_EOL",
";",
"$",
"clause",
"=",
"\"{$eol}({$eol}\"",
";",
"for",
"(... | Filters nodes that are the descendants of any of the given root directory paths.
@param array[string] $roots
@return ResourceQueryBuilder | [
"Filters",
"nodes",
"that",
"are",
"the",
"descendants",
"of",
"any",
"of",
"the",
"given",
"root",
"directory",
"paths",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Repository/ResourceQueryBuilder.php#L283-L299 |
222,012 | claroline/CoreBundle | Repository/ResourceQueryBuilder.php | ResourceQueryBuilder.whereIsShortcut | public function whereIsShortcut()
{
$eol = PHP_EOL;
$this->joinRelativesClause = "JOIN rs.resourceNode node{$eol}" . $this->joinRelativesClause;
$this->joinRelativesClause = "JOIN rs.target target{$eol}" . $this->joinRelativesClause;
$this->fromClause = "FROM Claroline\CoreBundle\Ent... | php | public function whereIsShortcut()
{
$eol = PHP_EOL;
$this->joinRelativesClause = "JOIN rs.resourceNode node{$eol}" . $this->joinRelativesClause;
$this->joinRelativesClause = "JOIN rs.target target{$eol}" . $this->joinRelativesClause;
$this->fromClause = "FROM Claroline\CoreBundle\Ent... | [
"public",
"function",
"whereIsShortcut",
"(",
")",
"{",
"$",
"eol",
"=",
"PHP_EOL",
";",
"$",
"this",
"->",
"joinRelativesClause",
"=",
"\"JOIN rs.resourceNode node{$eol}\"",
".",
"$",
"this",
"->",
"joinRelativesClause",
";",
"$",
"this",
"->",
"joinRelativesClau... | Filters nodes that are shortcuts and selects their target.
@return ResourceQueryBuilder | [
"Filters",
"nodes",
"that",
"are",
"shortcuts",
"and",
"selects",
"their",
"target",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Repository/ResourceQueryBuilder.php#L367-L377 |
222,013 | claroline/CoreBundle | Repository/ResourceQueryBuilder.php | ResourceQueryBuilder.whereIsAccessible | public function whereIsAccessible($user)
{
$currentDate = new \DateTime();
$clause = '(
creator.id = :creatorId
OR (
node.published = true
AND (node.accessibleFrom IS NULL OR node.accessibleFrom <= :currentdate)
AND (node.access... | php | public function whereIsAccessible($user)
{
$currentDate = new \DateTime();
$clause = '(
creator.id = :creatorId
OR (
node.published = true
AND (node.accessibleFrom IS NULL OR node.accessibleFrom <= :currentdate)
AND (node.access... | [
"public",
"function",
"whereIsAccessible",
"(",
"$",
"user",
")",
"{",
"$",
"currentDate",
"=",
"new",
"\\",
"DateTime",
"(",
")",
";",
"$",
"clause",
"=",
"'(\n creator.id = :creatorId\n OR (\n node.published = true\n AND (... | Filters nodes that are published.
@param $user (not typing because we don't want anon. to crash everything)
@return ResourceQueryBuilder | [
"Filters",
"nodes",
"that",
"are",
"published",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Repository/ResourceQueryBuilder.php#L405-L421 |
222,014 | claroline/CoreBundle | Controller/Administration/UsersController.php | UsersController.executeGroupAdminAction | public function executeGroupAdminAction(Group $group, AdditionalAction $action)
{
$event = $this->eventDispatcher->dispatch($action->getType() . '_' . $action->getAction(), 'AdminGroupAction', array('group' => $group));
return $event->getResponse();
} | php | public function executeGroupAdminAction(Group $group, AdditionalAction $action)
{
$event = $this->eventDispatcher->dispatch($action->getType() . '_' . $action->getAction(), 'AdminGroupAction', array('group' => $group));
return $event->getResponse();
} | [
"public",
"function",
"executeGroupAdminAction",
"(",
"Group",
"$",
"group",
",",
"AdditionalAction",
"$",
"action",
")",
"{",
"$",
"event",
"=",
"$",
"this",
"->",
"eventDispatcher",
"->",
"dispatch",
"(",
"$",
"action",
"->",
"getType",
"(",
")",
".",
"'... | This method should be moved
@EXT\Route(
"/{group}/admin/action/{action}",
name="admin_group_action",
options={"expose"=true}
) | [
"This",
"method",
"should",
"be",
"moved"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Controller/Administration/UsersController.php#L622-L627 |
222,015 | claroline/CoreBundle | Manager/CacheManager.php | CacheManager.refresh | public function refresh()
{
$this->removeCache();
$event = $this->eventManager->dispatch('refresh_cache', 'RefreshCache');
$this->writeCache($event->getParameters());
} | php | public function refresh()
{
$this->removeCache();
$event = $this->eventManager->dispatch('refresh_cache', 'RefreshCache');
$this->writeCache($event->getParameters());
} | [
"public",
"function",
"refresh",
"(",
")",
"{",
"$",
"this",
"->",
"removeCache",
"(",
")",
";",
"$",
"event",
"=",
"$",
"this",
"->",
"eventManager",
"->",
"dispatch",
"(",
"'refresh_cache'",
",",
"'RefreshCache'",
")",
";",
"$",
"this",
"->",
"writeCac... | Refresh the claroline cache | [
"Refresh",
"the",
"claroline",
"cache"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/CacheManager.php#L93-L98 |
222,016 | claroline/CoreBundle | Persistence/ObjectManager.php | ObjectManager.endFlushSuite | public function endFlushSuite()
{
if ($this->flushSuiteLevel === 0) {
throw new NoFlushSuiteStartedException('No flush suite has been started');
}
--$this->flushSuiteLevel;
$this->flush();
if ($this->activateLog && $this->showFlushLevel) $this->logFlushLevel();
... | php | public function endFlushSuite()
{
if ($this->flushSuiteLevel === 0) {
throw new NoFlushSuiteStartedException('No flush suite has been started');
}
--$this->flushSuiteLevel;
$this->flush();
if ($this->activateLog && $this->showFlushLevel) $this->logFlushLevel();
... | [
"public",
"function",
"endFlushSuite",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"flushSuiteLevel",
"===",
"0",
")",
"{",
"throw",
"new",
"NoFlushSuiteStartedException",
"(",
"'No flush suite has been started'",
")",
";",
"}",
"--",
"$",
"this",
"->",
"flus... | Ends a previously opened flush suite. If there is no other active suite,
a flush is performed.
@throws NoFlushSuiteStartedException if no flush suite has been started | [
"Ends",
"a",
"previously",
"opened",
"flush",
"suite",
".",
"If",
"there",
"is",
"no",
"other",
"active",
"suite",
"a",
"flush",
"is",
"performed",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Persistence/ObjectManager.php#L117-L126 |
222,017 | claroline/CoreBundle | Persistence/ObjectManager.php | ObjectManager.forceFlush | public function forceFlush()
{
if ($this->allowForceFlush) {
if ($this->activateLog) $this->log('Flush was forced for level ' . $this->flushSuiteLevel. '.');
parent::flush();
}
} | php | public function forceFlush()
{
if ($this->allowForceFlush) {
if ($this->activateLog) $this->log('Flush was forced for level ' . $this->flushSuiteLevel. '.');
parent::flush();
}
} | [
"public",
"function",
"forceFlush",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"allowForceFlush",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"activateLog",
")",
"$",
"this",
"->",
"log",
"(",
"'Flush was forced for level '",
".",
"$",
"this",
"->",
"flush... | Forces a flush. | [
"Forces",
"a",
"flush",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Persistence/ObjectManager.php#L131-L137 |
222,018 | claroline/CoreBundle | Persistence/ObjectManager.php | ObjectManager.findByIds | public function findByIds($class, array $ids)
{
if (count($ids) === 0) {
return array();
}
$dql = "SELECT object FROM {$class} object WHERE object.id IN (:ids)";
$query = $this->wrapped->createQuery($dql);
$query->setParameter('ids', $ids);
$objects = $qu... | php | public function findByIds($class, array $ids)
{
if (count($ids) === 0) {
return array();
}
$dql = "SELECT object FROM {$class} object WHERE object.id IN (:ids)";
$query = $this->wrapped->createQuery($dql);
$query->setParameter('ids', $ids);
$objects = $qu... | [
"public",
"function",
"findByIds",
"(",
"$",
"class",
",",
"array",
"$",
"ids",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"ids",
")",
"===",
"0",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"dql",
"=",
"\"SELECT object FROM {$class} object WHER... | Finds a set of objects by their ids.
@param string $objectClass
@param array $ids
@return array[object]
@throws MissingObjectException if any of the requested objects cannot be found
@todo make this method compatible with odm implementations | [
"Finds",
"a",
"set",
"of",
"objects",
"by",
"their",
"ids",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Persistence/ObjectManager.php#L237-L255 |
222,019 | claroline/CoreBundle | Twig/BaseUriExtension.php | BaseUriExtension.getAssetPath | public function getAssetPath()
{
$path = $this->assetsHelper->getUrl('');
if ($path[strlen($path) - 1] === '/') {
$path = rtrim($path, '/');
}
return $path;
} | php | public function getAssetPath()
{
$path = $this->assetsHelper->getUrl('');
if ($path[strlen($path) - 1] === '/') {
$path = rtrim($path, '/');
}
return $path;
} | [
"public",
"function",
"getAssetPath",
"(",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"assetsHelper",
"->",
"getUrl",
"(",
"''",
")",
";",
"if",
"(",
"$",
"path",
"[",
"strlen",
"(",
"$",
"path",
")",
"-",
"1",
"]",
"===",
"'/'",
")",
"{",
... | Returns the URI under which assets are served, without any trailing slash.
@return string | [
"Returns",
"the",
"URI",
"under",
"which",
"assets",
"are",
"served",
"without",
"any",
"trailing",
"slash",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Twig/BaseUriExtension.php#L50-L59 |
222,020 | claroline/CoreBundle | Twig/UrlAutoDetectorTwigExtension.php | UrlAutoDetectorTwigExtension.callbackReplace | public function callbackReplace($matches)
{
if ($matches[1] !== '') {
return $matches[0]; // don't modify existing <a href="">links</a> and <img src="">
}
$url = $matches[2];
$urlWithPrefix = $matches[2];
if (strpos($url, '@') !== false) {
$urlWithPref... | php | public function callbackReplace($matches)
{
if ($matches[1] !== '') {
return $matches[0]; // don't modify existing <a href="">links</a> and <img src="">
}
$url = $matches[2];
$urlWithPrefix = $matches[2];
if (strpos($url, '@') !== false) {
$urlWithPref... | [
"public",
"function",
"callbackReplace",
"(",
"$",
"matches",
")",
"{",
"if",
"(",
"$",
"matches",
"[",
"1",
"]",
"!==",
"''",
")",
"{",
"return",
"$",
"matches",
"[",
"0",
"]",
";",
"// don't modify existing <a href=\"\">links</a> and <img src=\"\">",
"}",
"$... | For every url match in string encapsulate if needed and return string.
@param array $matches
@return string | [
"For",
"every",
"url",
"match",
"in",
"string",
"encapsulate",
"if",
"needed",
"and",
"return",
"string",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Twig/UrlAutoDetectorTwigExtension.php#L70-L86 |
222,021 | symlex/input-validation | src/Form/Validator.php | Validator.validateRequired | public function validateRequired(string $key, array $def, $value)
{
if (isset($def['required']) && ($def['required'] === true) && ($value === null || $value === '' || $value === false)) {
$this->addError($key, 'form.value_must_not_be_empty');
}
} | php | public function validateRequired(string $key, array $def, $value)
{
if (isset($def['required']) && ($def['required'] === true) && ($value === null || $value === '' || $value === false)) {
$this->addError($key, 'form.value_must_not_be_empty');
}
} | [
"public",
"function",
"validateRequired",
"(",
"string",
"$",
"key",
",",
"array",
"$",
"def",
",",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"def",
"[",
"'required'",
"]",
")",
"&&",
"(",
"$",
"def",
"[",
"'required'",
"]",
"===",
"tru... | Validator for the "required" form field property | [
"Validator",
"for",
"the",
"required",
"form",
"field",
"property"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form/Validator.php#L100-L105 |
222,022 | symlex/input-validation | src/Form/Validator.php | Validator.validateMatches | public function validateMatches(string $key, array $def, $value)
{
if (isset($def['matches'])) {
if ($def['matches'][0] == '!') {
$fieldName = substr($def['matches'], 1);
if ($value == $this->getForm()->$fieldName) {
$this->addError($key, 'form... | php | public function validateMatches(string $key, array $def, $value)
{
if (isset($def['matches'])) {
if ($def['matches'][0] == '!') {
$fieldName = substr($def['matches'], 1);
if ($value == $this->getForm()->$fieldName) {
$this->addError($key, 'form... | [
"public",
"function",
"validateMatches",
"(",
"string",
"$",
"key",
",",
"array",
"$",
"def",
",",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"def",
"[",
"'matches'",
"]",
")",
")",
"{",
"if",
"(",
"$",
"def",
"[",
"'matches'",
"]",
"[... | Validator for the "matches" form field property | [
"Validator",
"for",
"the",
"matches",
"form",
"field",
"property"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form/Validator.php#L110-L124 |
222,023 | symlex/input-validation | src/Form/Validator.php | Validator.validateMin | public function validateMin(string $key, array $def, $value)
{
if (!isset($def['options']) && isset($def['min']) && $value != '') {
if (isset($def['type']) && ($def['type'] == 'int' || $def['type'] == 'numeric' || $def['type'] == 'float')) {
if ($value < $def['min']) {
... | php | public function validateMin(string $key, array $def, $value)
{
if (!isset($def['options']) && isset($def['min']) && $value != '') {
if (isset($def['type']) && ($def['type'] == 'int' || $def['type'] == 'numeric' || $def['type'] == 'float')) {
if ($value < $def['min']) {
... | [
"public",
"function",
"validateMin",
"(",
"string",
"$",
"key",
",",
"array",
"$",
"def",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"def",
"[",
"'options'",
"]",
")",
"&&",
"isset",
"(",
"$",
"def",
"[",
"'min'",
"]",
")",
... | Validator for the "min" form field property | [
"Validator",
"for",
"the",
"min",
"form",
"field",
"property"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form/Validator.php#L129-L159 |
222,024 | symlex/input-validation | src/Form/Validator.php | Validator.validateDepends | public function validateDepends(string $key, array $def, $value)
{
if (isset($def['depends'])) {
if ($this->getForm()->{$def['depends']} != '' && $value == '' && !isset($def['depends_value_empty'])) {
if (isset($def['depends_first_option']) && $this->getDefinition($def['depends']... | php | public function validateDepends(string $key, array $def, $value)
{
if (isset($def['depends'])) {
if ($this->getForm()->{$def['depends']} != '' && $value == '' && !isset($def['depends_value_empty'])) {
if (isset($def['depends_first_option']) && $this->getDefinition($def['depends']... | [
"public",
"function",
"validateDepends",
"(",
"string",
"$",
"key",
",",
"array",
"$",
"def",
",",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"def",
"[",
"'depends'",
"]",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getForm",
"(",
")... | Validator for the "depends" form field property | [
"Validator",
"for",
"the",
"depends",
"form",
"field",
"property"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form/Validator.php#L198-L239 |
222,025 | symlex/input-validation | src/Form/Validator.php | Validator.validateRegex | public function validateRegex(string $key, array $def, $value)
{
if (is_scalar($value) && isset($def['regex']) && !empty($value) && !preg_match($def['regex'], $value)) {
$this->addError($key, 'form.value_not_valid_regex');
}
} | php | public function validateRegex(string $key, array $def, $value)
{
if (is_scalar($value) && isset($def['regex']) && !empty($value) && !preg_match($def['regex'], $value)) {
$this->addError($key, 'form.value_not_valid_regex');
}
} | [
"public",
"function",
"validateRegex",
"(",
"string",
"$",
"key",
",",
"array",
"$",
"def",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_scalar",
"(",
"$",
"value",
")",
"&&",
"isset",
"(",
"$",
"def",
"[",
"'regex'",
"]",
")",
"&&",
"!",
"empty",
... | Validator for the "regex" form field property | [
"Validator",
"for",
"the",
"regex",
"form",
"field",
"property"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form/Validator.php#L244-L249 |
222,026 | symlex/input-validation | src/Form/Validator.php | Validator.validateOptions | public function validateOptions(string $key, array $def, $value)
{
if (isset($def['options']) && $value != '') {
if (isset($def['min']) || isset($def['max'])) {
if (!is_array($value)) {
$this->addError($key, 'form.value_must_be_list');
} else {... | php | public function validateOptions(string $key, array $def, $value)
{
if (isset($def['options']) && $value != '') {
if (isset($def['min']) || isset($def['max'])) {
if (!is_array($value)) {
$this->addError($key, 'form.value_must_be_list');
} else {... | [
"public",
"function",
"validateOptions",
"(",
"string",
"$",
"key",
",",
"array",
"$",
"def",
",",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"def",
"[",
"'options'",
"]",
")",
"&&",
"$",
"value",
"!=",
"''",
")",
"{",
"if",
"(",
"isse... | Validator for the "options" form field property | [
"Validator",
"for",
"the",
"options",
"form",
"field",
"property"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form/Validator.php#L254-L289 |
222,027 | symlex/input-validation | src/Form/Validator.php | Validator.validateField | public function validateField(string $key, array $def, $value)
{
$this->validateRequired($key, $def, $value);
$this->validateMin($key, $def, $value);
$this->validateMax($key, $def, $value);
$this->validateMatches($key, $def, $value);
$this->validateDepends($key, $def, $value)... | php | public function validateField(string $key, array $def, $value)
{
$this->validateRequired($key, $def, $value);
$this->validateMin($key, $def, $value);
$this->validateMax($key, $def, $value);
$this->validateMatches($key, $def, $value);
$this->validateDepends($key, $def, $value)... | [
"public",
"function",
"validateField",
"(",
"string",
"$",
"key",
",",
"array",
"$",
"def",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"validateRequired",
"(",
"$",
"key",
",",
"$",
"def",
",",
"$",
"value",
")",
";",
"$",
"this",
"->",
"valid... | Applies the validators to a form field. Can be extended by inherited classes.
@param string $key The field name
@param array $def The field definition
@param mixed $value The field value | [
"Applies",
"the",
"validators",
"to",
"a",
"form",
"field",
".",
"Can",
"be",
"extended",
"by",
"inherited",
"classes",
"."
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form/Validator.php#L382-L392 |
222,028 | idimensionz/sendgrid-webapi-v3-php | lib/iDimensionz/SendGridWebApiV3/Api/Templates/TemplateVersionDto.php | TemplateVersionDto.validateArray | private function validateArray($templateVersionData)
{
$isValid = true;
$isValid = $isValid && is_array($templateVersionData);
if ($isValid) {
$keys = array_keys($templateVersionData);
$isValid = $isValid &&
in_array('id', $keys) &&
in_... | php | private function validateArray($templateVersionData)
{
$isValid = true;
$isValid = $isValid && is_array($templateVersionData);
if ($isValid) {
$keys = array_keys($templateVersionData);
$isValid = $isValid &&
in_array('id', $keys) &&
in_... | [
"private",
"function",
"validateArray",
"(",
"$",
"templateVersionData",
")",
"{",
"$",
"isValid",
"=",
"true",
";",
"$",
"isValid",
"=",
"$",
"isValid",
"&&",
"is_array",
"(",
"$",
"templateVersionData",
")",
";",
"if",
"(",
"$",
"isValid",
")",
"{",
"$... | Validates template version data is an array with all the expected keys
@param array $templateVersionData | [
"Validates",
"template",
"version",
"data",
"is",
"an",
"array",
"with",
"all",
"the",
"expected",
"keys"
] | f9ae04939c7c21de1486ad4b310bc950ec0d8163 | https://github.com/idimensionz/sendgrid-webapi-v3-php/blob/f9ae04939c7c21de1486ad4b310bc950ec0d8163/lib/iDimensionz/SendGridWebApiV3/Api/Templates/TemplateVersionDto.php#L268-L285 |
222,029 | claroline/CoreBundle | Twig/HomeExtension.php | HomeExtension.getFilters | public function getFilters()
{
return array(
'timeAgo' => new \Twig_Filter_Method($this, 'timeAgo'),
'homeLink' => new \Twig_Filter_Method($this, 'homeLink'),
'activeLink' => new \Twig_Filter_Method($this, 'activeLink'),
'activeRoute' => new \Twig_Filter_Metho... | php | public function getFilters()
{
return array(
'timeAgo' => new \Twig_Filter_Method($this, 'timeAgo'),
'homeLink' => new \Twig_Filter_Method($this, 'homeLink'),
'activeLink' => new \Twig_Filter_Method($this, 'activeLink'),
'activeRoute' => new \Twig_Filter_Metho... | [
"public",
"function",
"getFilters",
"(",
")",
"{",
"return",
"array",
"(",
"'timeAgo'",
"=>",
"new",
"\\",
"Twig_Filter_Method",
"(",
"$",
"this",
",",
"'timeAgo'",
")",
",",
"'homeLink'",
"=>",
"new",
"\\",
"Twig_Filter_Method",
"(",
"$",
"this",
",",
"'h... | Get filters of the service
@return \Twig_Filter_Method | [
"Get",
"filters",
"of",
"the",
"service"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Twig/HomeExtension.php#L45-L55 |
222,030 | claroline/CoreBundle | Twig/HomeExtension.php | HomeExtension.homeLink | public function homeLink($link)
{
if (!(strpos($link, "http://") === 0 or
strpos($link, "https://") === 0 or
strpos($link, "ftp://") === 0 or
strpos($link, "www.") === 0)
) {
$home = $this->container->get("router")->generate('claro_index').$link;
... | php | public function homeLink($link)
{
if (!(strpos($link, "http://") === 0 or
strpos($link, "https://") === 0 or
strpos($link, "ftp://") === 0 or
strpos($link, "www.") === 0)
) {
$home = $this->container->get("router")->generate('claro_index').$link;
... | [
"public",
"function",
"homeLink",
"(",
"$",
"link",
")",
"{",
"if",
"(",
"!",
"(",
"strpos",
"(",
"$",
"link",
",",
"\"http://\"",
")",
"===",
"0",
"or",
"strpos",
"(",
"$",
"link",
",",
"\"https://\"",
")",
"===",
"0",
"or",
"strpos",
"(",
"$",
... | Check if a link is local or external | [
"Check",
"if",
"a",
"link",
"is",
"local",
"or",
"external"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Twig/HomeExtension.php#L131-L146 |
222,031 | claroline/CoreBundle | Twig/HomeExtension.php | HomeExtension.activeLink | public function activeLink($link)
{
$pathinfo = $this->getPathInfo();
if (($pathinfo and '/' . $pathinfo === $link) or (!$pathinfo and $link === '/')) {
return ' active'; //the white space is nedded
}
return '';
} | php | public function activeLink($link)
{
$pathinfo = $this->getPathInfo();
if (($pathinfo and '/' . $pathinfo === $link) or (!$pathinfo and $link === '/')) {
return ' active'; //the white space is nedded
}
return '';
} | [
"public",
"function",
"activeLink",
"(",
"$",
"link",
")",
"{",
"$",
"pathinfo",
"=",
"$",
"this",
"->",
"getPathInfo",
"(",
")",
";",
"if",
"(",
"(",
"$",
"pathinfo",
"and",
"'/'",
".",
"$",
"pathinfo",
"===",
"$",
"link",
")",
"or",
"(",
"!",
"... | Return active if a given link match to the path info | [
"Return",
"active",
"if",
"a",
"given",
"link",
"match",
"to",
"the",
"path",
"info"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Twig/HomeExtension.php#L151-L159 |
222,032 | claroline/CoreBundle | Library/Security/Voter/FacetVoter.php | FacetVoter.vote | public function vote(TokenInterface $token, $object, array $attributes)
{
if ($object instanceof FieldFacet) {
return $this->fieldFacetVote($object, $token, $attributes[0]);
}
return VoterInterface::ACCESS_ABSTAIN;
} | php | public function vote(TokenInterface $token, $object, array $attributes)
{
if ($object instanceof FieldFacet) {
return $this->fieldFacetVote($object, $token, $attributes[0]);
}
return VoterInterface::ACCESS_ABSTAIN;
} | [
"public",
"function",
"vote",
"(",
"TokenInterface",
"$",
"token",
",",
"$",
"object",
",",
"array",
"$",
"attributes",
")",
"{",
"if",
"(",
"$",
"object",
"instanceof",
"FieldFacet",
")",
"{",
"return",
"$",
"this",
"->",
"fieldFacetVote",
"(",
"$",
"ob... | Attributes can either be "open" or "edit"
@param TokenInterface $token
@param $object
@param array $attributes | [
"Attributes",
"can",
"either",
"be",
"open",
"or",
"edit"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Library/Security/Voter/FacetVoter.php#L52-L59 |
222,033 | sam002/yii2-otp | src/behaviors/OtpBehavior.php | OtpBehavior.initSecret | public function initSecret()
{
$secret = $this->owner->{$this->secretAttribute};
if (!empty($secret)) {
$this->otp->setSecret($secret);
}
} | php | public function initSecret()
{
$secret = $this->owner->{$this->secretAttribute};
if (!empty($secret)) {
$this->otp->setSecret($secret);
}
} | [
"public",
"function",
"initSecret",
"(",
")",
"{",
"$",
"secret",
"=",
"$",
"this",
"->",
"owner",
"->",
"{",
"$",
"this",
"->",
"secretAttribute",
"}",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"secret",
")",
")",
"{",
"$",
"this",
"->",
"otp",
"-... | Init secret attribute | [
"Init",
"secret",
"attribute"
] | d98b7398eb64c8ce25560c82c85f7116128c913f | https://github.com/sam002/yii2-otp/blob/d98b7398eb64c8ce25560c82c85f7116128c913f/src/behaviors/OtpBehavior.php#L75-L81 |
222,034 | sam002/yii2-otp | src/behaviors/OtpBehavior.php | OtpBehavior.confirmSecret | public function confirmSecret()
{
$secret = $this->owner->{$this->secretAttribute};
if (empty($secret)) {
$this->owner->addError($this->codeAttribute, Yii::t('yii', 'The secret is empty.'));
} else {
$this->otp->setSecret($secret);
if (!$this->secretConfir... | php | public function confirmSecret()
{
$secret = $this->owner->{$this->secretAttribute};
if (empty($secret)) {
$this->owner->addError($this->codeAttribute, Yii::t('yii', 'The secret is empty.'));
} else {
$this->otp->setSecret($secret);
if (!$this->secretConfir... | [
"public",
"function",
"confirmSecret",
"(",
")",
"{",
"$",
"secret",
"=",
"$",
"this",
"->",
"owner",
"->",
"{",
"$",
"this",
"->",
"secretAttribute",
"}",
";",
"if",
"(",
"empty",
"(",
"$",
"secret",
")",
")",
"{",
"$",
"this",
"->",
"owner",
"->"... | Confirm secret by code | [
"Confirm",
"secret",
"by",
"code"
] | d98b7398eb64c8ce25560c82c85f7116128c913f | https://github.com/sam002/yii2-otp/blob/d98b7398eb64c8ce25560c82c85f7116128c913f/src/behaviors/OtpBehavior.php#L86-L97 |
222,035 | wapmorgan/ImageEditor | ImageEditor.php | ImageEditor.decreaseSide | public function decreaseSide($side, $size) {
$x = $y = 1;
$x2 = $this->width;
$y2 = $this->height;
switch ($side) {
case 'top':
$y = $size;
break;
case 'right':
$x2 -= $size;
break;
case 'bottom':
$y2 -= $size;
break;
case 'left':
$x = $size;
break;
}
$this->crop(... | php | public function decreaseSide($side, $size) {
$x = $y = 1;
$x2 = $this->width;
$y2 = $this->height;
switch ($side) {
case 'top':
$y = $size;
break;
case 'right':
$x2 -= $size;
break;
case 'bottom':
$y2 -= $size;
break;
case 'left':
$x = $size;
break;
}
$this->crop(... | [
"public",
"function",
"decreaseSide",
"(",
"$",
"side",
",",
"$",
"size",
")",
"{",
"$",
"x",
"=",
"$",
"y",
"=",
"1",
";",
"$",
"x2",
"=",
"$",
"this",
"->",
"width",
";",
"$",
"y2",
"=",
"$",
"this",
"->",
"height",
";",
"switch",
"(",
"$",... | Deletes a piece of image from specific side.
For example, if side=top and size=100, 100px from top will be deleted.
@param string $side Side to cut
@param int $size Pixels
@return ImageEditor this object | [
"Deletes",
"a",
"piece",
"of",
"image",
"from",
"specific",
"side",
".",
"For",
"example",
"if",
"side",
"=",
"top",
"and",
"size",
"=",
"100",
"100px",
"from",
"top",
"will",
"be",
"deleted",
"."
] | ff93050ff55754d5c30debdfac37a1b44c3c9ff2 | https://github.com/wapmorgan/ImageEditor/blob/ff93050ff55754d5c30debdfac37a1b44c3c9ff2/ImageEditor.php#L109-L129 |
222,036 | wapmorgan/ImageEditor | ImageEditor.php | ImageEditor.zoomWidthTo | public function zoomWidthTo($size) {
$ratio = round($this->width / $size, 3);
$this->resize($size, $this->height / $ratio);
return $this;
} | php | public function zoomWidthTo($size) {
$ratio = round($this->width / $size, 3);
$this->resize($size, $this->height / $ratio);
return $this;
} | [
"public",
"function",
"zoomWidthTo",
"(",
"$",
"size",
")",
"{",
"$",
"ratio",
"=",
"round",
"(",
"$",
"this",
"->",
"width",
"/",
"$",
"size",
",",
"3",
")",
";",
"$",
"this",
"->",
"resize",
"(",
"$",
"size",
",",
"$",
"this",
"->",
"height",
... | Changes proportionally image width to new size
@param int $size New value of width
@return ImageEditor this object | [
"Changes",
"proportionally",
"image",
"width",
"to",
"new",
"size"
] | ff93050ff55754d5c30debdfac37a1b44c3c9ff2 | https://github.com/wapmorgan/ImageEditor/blob/ff93050ff55754d5c30debdfac37a1b44c3c9ff2/ImageEditor.php#L150-L154 |
222,037 | wapmorgan/ImageEditor | ImageEditor.php | ImageEditor.zoomHeightTo | public function zoomHeightTo($size) {
$ratio = round($this->height / $size, 3);
$this->resize($this->width / $ratio, $size);
return $this;
} | php | public function zoomHeightTo($size) {
$ratio = round($this->height / $size, 3);
$this->resize($this->width / $ratio, $size);
return $this;
} | [
"public",
"function",
"zoomHeightTo",
"(",
"$",
"size",
")",
"{",
"$",
"ratio",
"=",
"round",
"(",
"$",
"this",
"->",
"height",
"/",
"$",
"size",
",",
"3",
")",
";",
"$",
"this",
"->",
"resize",
"(",
"$",
"this",
"->",
"width",
"/",
"$",
"ratio",... | Changes proportionally image height to new size
@param int $size New value of height
@return ImageEditor this object | [
"Changes",
"proportionally",
"image",
"height",
"to",
"new",
"size"
] | ff93050ff55754d5c30debdfac37a1b44c3c9ff2 | https://github.com/wapmorgan/ImageEditor/blob/ff93050ff55754d5c30debdfac37a1b44c3c9ff2/ImageEditor.php#L161-L165 |
222,038 | wapmorgan/ImageEditor | ImageEditor.php | ImageEditor.decreaseTo | public function decreaseTo($size) {
$currentSize = max($this->height, $this->width);
if ($currentSize <= $size)
return;
$ratio = round($currentSize / $size, 3);
$this->resize($this->width / $ratio, $this->height / $ratio);
return $this;
} | php | public function decreaseTo($size) {
$currentSize = max($this->height, $this->width);
if ($currentSize <= $size)
return;
$ratio = round($currentSize / $size, 3);
$this->resize($this->width / $ratio, $this->height / $ratio);
return $this;
} | [
"public",
"function",
"decreaseTo",
"(",
"$",
"size",
")",
"{",
"$",
"currentSize",
"=",
"max",
"(",
"$",
"this",
"->",
"height",
",",
"$",
"this",
"->",
"width",
")",
";",
"if",
"(",
"$",
"currentSize",
"<=",
"$",
"size",
")",
"return",
";",
"$",
... | Decreases proportionally larger side to new size, if needed
@param int $size New max value of sides
@return ImageEditor this object | [
"Decreases",
"proportionally",
"larger",
"side",
"to",
"new",
"size",
"if",
"needed"
] | ff93050ff55754d5c30debdfac37a1b44c3c9ff2 | https://github.com/wapmorgan/ImageEditor/blob/ff93050ff55754d5c30debdfac37a1b44c3c9ff2/ImageEditor.php#L196-L203 |
222,039 | wapmorgan/ImageEditor | ImageEditor.php | ImageEditor.placeImageAt | public function placeImageAt($x, $y, ImageEditor $image) {
imagecopy($this->_image, $image->resource, $x, $y, 0, 0, $image->width, $image->height);
return $this;
} | php | public function placeImageAt($x, $y, ImageEditor $image) {
imagecopy($this->_image, $image->resource, $x, $y, 0, 0, $image->width, $image->height);
return $this;
} | [
"public",
"function",
"placeImageAt",
"(",
"$",
"x",
",",
"$",
"y",
",",
"ImageEditor",
"$",
"image",
")",
"{",
"imagecopy",
"(",
"$",
"this",
"->",
"_image",
",",
"$",
"image",
"->",
"resource",
",",
"$",
"x",
",",
"$",
"y",
",",
"0",
",",
"0",
... | Places another image atop current image
@param int $x X-position
@param int $y Y-position
@param ImageEditor $image Image to place
@return ImageEditor this object | [
"Places",
"another",
"image",
"atop",
"current",
"image"
] | ff93050ff55754d5c30debdfac37a1b44c3c9ff2 | https://github.com/wapmorgan/ImageEditor/blob/ff93050ff55754d5c30debdfac37a1b44c3c9ff2/ImageEditor.php#L273-L276 |
222,040 | wapmorgan/ImageEditor | ImageEditor.php | ImageEditor.rotate | public function rotate($angle, $bgColor = 0) {
if ($angle === true)
$angle = 90;
elseif ($angle === false)
$angle = -90;
$this->_image = imagerotate($this->_image, 360 - $angle, $bgColor);
return $this;
} | php | public function rotate($angle, $bgColor = 0) {
if ($angle === true)
$angle = 90;
elseif ($angle === false)
$angle = -90;
$this->_image = imagerotate($this->_image, 360 - $angle, $bgColor);
return $this;
} | [
"public",
"function",
"rotate",
"(",
"$",
"angle",
",",
"$",
"bgColor",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"angle",
"===",
"true",
")",
"$",
"angle",
"=",
"90",
";",
"elseif",
"(",
"$",
"angle",
"===",
"false",
")",
"$",
"angle",
"=",
"-",
"90... | Rotates an image
@param mixed $angle An angle to rotate in degrees.
Also you can pass true or false to rotate
90 degress and -90 degrees.
@param int $bgColor Color of uncovered zone {@see http://www.php.net/manual/en/function.imagerotate.php}
@return ImageEditor this object | [
"Rotates",
"an",
"image"
] | ff93050ff55754d5c30debdfac37a1b44c3c9ff2 | https://github.com/wapmorgan/ImageEditor/blob/ff93050ff55754d5c30debdfac37a1b44c3c9ff2/ImageEditor.php#L296-L303 |
222,041 | wapmorgan/ImageEditor | ImageEditor.php | ImageEditor.verticalFlip | public function verticalFlip() {
if (function_exists('imageflip')) {
imageflip($this->_image, IMG_FLIP_VERTICAL);
} else {
$image = imagecreatetruecolor($this->width, $this->height);
$dst_x = 0;
$src_x = 0;
$coordinate = ($this->height - 1);
foreach (range($this->height, 0) as $range) {
$src_y... | php | public function verticalFlip() {
if (function_exists('imageflip')) {
imageflip($this->_image, IMG_FLIP_VERTICAL);
} else {
$image = imagecreatetruecolor($this->width, $this->height);
$dst_x = 0;
$src_x = 0;
$coordinate = ($this->height - 1);
foreach (range($this->height, 0) as $range) {
$src_y... | [
"public",
"function",
"verticalFlip",
"(",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'imageflip'",
")",
")",
"{",
"imageflip",
"(",
"$",
"this",
"->",
"_image",
",",
"IMG_FLIP_VERTICAL",
")",
";",
"}",
"else",
"{",
"$",
"image",
"=",
"imagecreatetrueco... | Flips an image vertically.
@return ImageEditor this object | [
"Flips",
"an",
"image",
"vertically",
"."
] | ff93050ff55754d5c30debdfac37a1b44c3c9ff2 | https://github.com/wapmorgan/ImageEditor/blob/ff93050ff55754d5c30debdfac37a1b44c3c9ff2/ImageEditor.php#L389-L406 |
222,042 | wapmorgan/ImageEditor | ImageEditor.php | ImageEditor.createFromResource | static public function createFromResource($resource) {
if (!is_resource($resource))
throw new Exception('Invalid (resource) parameter! This is not a resource!');
if (get_resource_type($resource) != 'gd')
throw new Exception('Invalid (resource) parameter! Resource is not a gd resource!');
return new self($re... | php | static public function createFromResource($resource) {
if (!is_resource($resource))
throw new Exception('Invalid (resource) parameter! This is not a resource!');
if (get_resource_type($resource) != 'gd')
throw new Exception('Invalid (resource) parameter! Resource is not a gd resource!');
return new self($re... | [
"static",
"public",
"function",
"createFromResource",
"(",
"$",
"resource",
")",
"{",
"if",
"(",
"!",
"is_resource",
"(",
"$",
"resource",
")",
")",
"throw",
"new",
"Exception",
"(",
"'Invalid (resource) parameter! This is not a resource!'",
")",
";",
"if",
"(",
... | Creates an instace from gd-resource
@param resource $resource Image resource | [
"Creates",
"an",
"instace",
"from",
"gd",
"-",
"resource"
] | ff93050ff55754d5c30debdfac37a1b44c3c9ff2 | https://github.com/wapmorgan/ImageEditor/blob/ff93050ff55754d5c30debdfac37a1b44c3c9ff2/ImageEditor.php#L479-L485 |
222,043 | claroline/CoreBundle | Manager/HomeManager.php | HomeManager.getRegionContents | public function getRegionContents()
{
$array = array();
$regions = $this->region->findAll();
foreach ($regions as $region) {
$first = $this->contentRegion->findOneBy(array('back' => null, 'region' => $region));
while ($first != null) {
$contentType =... | php | public function getRegionContents()
{
$array = array();
$regions = $this->region->findAll();
foreach ($regions as $region) {
$first = $this->contentRegion->findOneBy(array('back' => null, 'region' => $region));
while ($first != null) {
$contentType =... | [
"public",
"function",
"getRegionContents",
"(",
")",
"{",
"$",
"array",
"=",
"array",
"(",
")",
";",
"$",
"regions",
"=",
"$",
"this",
"->",
"region",
"->",
"findAll",
"(",
")",
";",
"foreach",
"(",
"$",
"regions",
"as",
"$",
"region",
")",
"{",
"$... | Get the content of the regions of the front page.
@return array The content of regions. | [
"Get",
"the",
"content",
"of",
"the",
"regions",
"of",
"the",
"front",
"page",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/HomeManager.php#L184-L214 |
222,044 | claroline/CoreBundle | Manager/HomeManager.php | HomeManager.getRegion | public function getRegion($content)
{
$region = $this->contentRegion->findOneBy(array('content' => $content));
if ($region) {
return $region->getRegion()->getName();
}
} | php | public function getRegion($content)
{
$region = $this->contentRegion->findOneBy(array('content' => $content));
if ($region) {
return $region->getRegion()->getName();
}
} | [
"public",
"function",
"getRegion",
"(",
"$",
"content",
")",
"{",
"$",
"region",
"=",
"$",
"this",
"->",
"contentRegion",
"->",
"findOneBy",
"(",
"array",
"(",
"'content'",
"=>",
"$",
"content",
")",
")",
";",
"if",
"(",
"$",
"region",
")",
"{",
"ret... | Determine in what region a content is. | [
"Determine",
"in",
"what",
"region",
"a",
"content",
"is",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/HomeManager.php#L219-L226 |
222,045 | claroline/CoreBundle | Manager/HomeManager.php | HomeManager.moveContent | public function moveContent($content, $type, $page)
{
$contenType = $this->contentType->findOneBy(array('type' => $type, 'content' => $content));
$contenType->detach();
$contenType->setType($page);
$contenType->setFirst($this->contentType->findOneBy(array('type' => $page, 'back' => ... | php | public function moveContent($content, $type, $page)
{
$contenType = $this->contentType->findOneBy(array('type' => $type, 'content' => $content));
$contenType->detach();
$contenType->setType($page);
$contenType->setFirst($this->contentType->findOneBy(array('type' => $page, 'back' => ... | [
"public",
"function",
"moveContent",
"(",
"$",
"content",
",",
"$",
"type",
",",
"$",
"page",
")",
"{",
"$",
"contenType",
"=",
"$",
"this",
"->",
"contentType",
"->",
"findOneBy",
"(",
"array",
"(",
"'type'",
"=>",
"$",
"type",
",",
"'content'",
"=>",... | Move a content from a type to another
@param content The content to move
@param page The page type where move the content
@return This function doesn't return anything. | [
"Move",
"a",
"content",
"from",
"a",
"type",
"to",
"another"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/HomeManager.php#L364-L374 |
222,046 | claroline/CoreBundle | Manager/HomeManager.php | HomeManager.deleteContent | public function deleteContent($content)
{
$this->deleNodeEntity($this->contentType, array('content' => $content));
$this->deleNodeEntity(
$this->subContent, array('father' => $content),
function ($entity) {
$this->deleteContent($entity->getChild());
... | php | public function deleteContent($content)
{
$this->deleNodeEntity($this->contentType, array('content' => $content));
$this->deleNodeEntity(
$this->subContent, array('father' => $content),
function ($entity) {
$this->deleteContent($entity->getChild());
... | [
"public",
"function",
"deleteContent",
"(",
"$",
"content",
")",
"{",
"$",
"this",
"->",
"deleNodeEntity",
"(",
"$",
"this",
"->",
"contentType",
",",
"array",
"(",
"'content'",
"=>",
"$",
"content",
")",
")",
";",
"$",
"this",
"->",
"deleNodeEntity",
"(... | Delete a content and his childs.
@return This function doesn't return anything. | [
"Delete",
"a",
"content",
"and",
"his",
"childs",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/HomeManager.php#L381-L394 |
222,047 | claroline/CoreBundle | Manager/HomeManager.php | HomeManager.deleteType | public function deleteType($type)
{
$contents = $this->contentType->findBy(array('type' => $type));
foreach ($contents as $content) {
$this->deleteContent($content->getContent());
}
$this->manager->remove($type);
$this->manager->flush();
} | php | public function deleteType($type)
{
$contents = $this->contentType->findBy(array('type' => $type));
foreach ($contents as $content) {
$this->deleteContent($content->getContent());
}
$this->manager->remove($type);
$this->manager->flush();
} | [
"public",
"function",
"deleteType",
"(",
"$",
"type",
")",
"{",
"$",
"contents",
"=",
"$",
"this",
"->",
"contentType",
"->",
"findBy",
"(",
"array",
"(",
"'type'",
"=>",
"$",
"type",
")",
")",
";",
"foreach",
"(",
"$",
"contents",
"as",
"$",
"conten... | Delete a type and his childs.
@return This function doesn't return anything. | [
"Delete",
"a",
"type",
"and",
"his",
"childs",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/HomeManager.php#L449-L459 |
222,048 | claroline/CoreBundle | Manager/HomeManager.php | HomeManager.publishType | public function publishType($type)
{
$publish = true;
if ($type instanceof Type and $type->getName() !== 'home' and $type->getName() !== 'menu') {
if ($type->isPublish()) {
$publish = false;
}
$type->setPublish($publish);
$this->manag... | php | public function publishType($type)
{
$publish = true;
if ($type instanceof Type and $type->getName() !== 'home' and $type->getName() !== 'menu') {
if ($type->isPublish()) {
$publish = false;
}
$type->setPublish($publish);
$this->manag... | [
"public",
"function",
"publishType",
"(",
"$",
"type",
")",
"{",
"$",
"publish",
"=",
"true",
";",
"if",
"(",
"$",
"type",
"instanceof",
"Type",
"and",
"$",
"type",
"->",
"getName",
"(",
")",
"!==",
"'home'",
"and",
"$",
"type",
"->",
"getName",
"(",... | Publish content type page
@param $type a content type
@return boolean | [
"Publish",
"content",
"type",
"page"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/HomeManager.php#L468-L483 |
222,049 | claroline/CoreBundle | Manager/HomeManager.php | HomeManager.contentToRegion | public function contentToRegion($region, $content)
{
$regions = $this->contentRegion->findBy(array('content' => $content));
if (count($regions) === 1 and $regions[0]->getRegion()->getName() === $region->getName()) {
$this->deleteRegions($content, $regions);
} else {
... | php | public function contentToRegion($region, $content)
{
$regions = $this->contentRegion->findBy(array('content' => $content));
if (count($regions) === 1 and $regions[0]->getRegion()->getName() === $region->getName()) {
$this->deleteRegions($content, $regions);
} else {
... | [
"public",
"function",
"contentToRegion",
"(",
"$",
"region",
",",
"$",
"content",
")",
"{",
"$",
"regions",
"=",
"$",
"this",
"->",
"contentRegion",
"->",
"findBy",
"(",
"array",
"(",
"'content'",
"=>",
"$",
"content",
")",
")",
";",
"if",
"(",
"count"... | Put a content in a region of home page as left, right, footer or header, this is useful for menus.
@return string The word "true" useful in ajax. | [
"Put",
"a",
"content",
"in",
"a",
"region",
"of",
"home",
"page",
"as",
"left",
"right",
"footer",
"or",
"header",
"this",
"is",
"useful",
"for",
"menus",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/HomeManager.php#L512-L528 |
222,050 | claroline/CoreBundle | Manager/HomeManager.php | HomeManager.collapse | public function collapse($content, $type)
{
$contentType = $this->contentType->findOneBy(array('content' => $content, 'type' => $type));
$contentType->setCollapse(!$contentType->isCollapse());
$this->manager->persist($contentType);
$this->manager->flush();
} | php | public function collapse($content, $type)
{
$contentType = $this->contentType->findOneBy(array('content' => $content, 'type' => $type));
$contentType->setCollapse(!$contentType->isCollapse());
$this->manager->persist($contentType);
$this->manager->flush();
} | [
"public",
"function",
"collapse",
"(",
"$",
"content",
",",
"$",
"type",
")",
"{",
"$",
"contentType",
"=",
"$",
"this",
"->",
"contentType",
"->",
"findOneBy",
"(",
"array",
"(",
"'content'",
"=>",
"$",
"content",
",",
"'type'",
"=>",
"$",
"type",
")"... | Update the collapse attribute of a content. | [
"Update",
"the",
"collapse",
"attribute",
"of",
"a",
"content",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/HomeManager.php#L622-L629 |
222,051 | claroline/CoreBundle | Manager/FacetManager.php | FacetManager.createFacet | public function createFacet($name, $forceCreationForm = false)
{
$this->om->startFlushSuite();
$facet = new Facet();
$facet->setName($name);
$facet->setForceCreationForm($forceCreationForm);
$facet->setPosition($this->om->count('Claroline\CoreBundle\Entity\Facet\Facet'));
... | php | public function createFacet($name, $forceCreationForm = false)
{
$this->om->startFlushSuite();
$facet = new Facet();
$facet->setName($name);
$facet->setForceCreationForm($forceCreationForm);
$facet->setPosition($this->om->count('Claroline\CoreBundle\Entity\Facet\Facet'));
... | [
"public",
"function",
"createFacet",
"(",
"$",
"name",
",",
"$",
"forceCreationForm",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"om",
"->",
"startFlushSuite",
"(",
")",
";",
"$",
"facet",
"=",
"new",
"Facet",
"(",
")",
";",
"$",
"facet",
"->",
"setN... | Creates a new facet.
@param $name | [
"Creates",
"a",
"new",
"facet",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/FacetManager.php#L73-L85 |
222,052 | claroline/CoreBundle | Manager/FacetManager.php | FacetManager.removeFacet | public function removeFacet(Facet $facet)
{
$this->om->remove($facet);
$this->om->flush();
$this->reorderFacets();
} | php | public function removeFacet(Facet $facet)
{
$this->om->remove($facet);
$this->om->flush();
$this->reorderFacets();
} | [
"public",
"function",
"removeFacet",
"(",
"Facet",
"$",
"facet",
")",
"{",
"$",
"this",
"->",
"om",
"->",
"remove",
"(",
"$",
"facet",
")",
";",
"$",
"this",
"->",
"om",
"->",
"flush",
"(",
")",
";",
"$",
"this",
"->",
"reorderFacets",
"(",
")",
... | Removes an existing facet.
@param Facet $facet | [
"Removes",
"an",
"existing",
"facet",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/FacetManager.php#L92-L97 |
222,053 | claroline/CoreBundle | Manager/FacetManager.php | FacetManager.reorderFacets | public function reorderFacets()
{
$facets = $this->getFacets();
$order = 0;
foreach ($facets as $facet) {
$facet->setPosition($order);
$order++;
$this->om->persist($facet);
}
$this->om->flush();
} | php | public function reorderFacets()
{
$facets = $this->getFacets();
$order = 0;
foreach ($facets as $facet) {
$facet->setPosition($order);
$order++;
$this->om->persist($facet);
}
$this->om->flush();
} | [
"public",
"function",
"reorderFacets",
"(",
")",
"{",
"$",
"facets",
"=",
"$",
"this",
"->",
"getFacets",
"(",
")",
";",
"$",
"order",
"=",
"0",
";",
"foreach",
"(",
"$",
"facets",
"as",
"$",
"facet",
")",
"{",
"$",
"facet",
"->",
"setPosition",
"(... | Fixes gaps beteween facet orders | [
"Fixes",
"gaps",
"beteween",
"facet",
"orders"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/FacetManager.php#L112-L124 |
222,054 | claroline/CoreBundle | Manager/FacetManager.php | FacetManager.reorderFields | public function reorderFields(PanelFacet $panelFacet)
{
$fields = $panelFacet->getFieldsFacet();
$order = 0;
foreach ($fields as $field) {
$field->setPosition($order);
$order++;
$this->om->persist($field);
}
$this->om->flush();
} | php | public function reorderFields(PanelFacet $panelFacet)
{
$fields = $panelFacet->getFieldsFacet();
$order = 0;
foreach ($fields as $field) {
$field->setPosition($order);
$order++;
$this->om->persist($field);
}
$this->om->flush();
} | [
"public",
"function",
"reorderFields",
"(",
"PanelFacet",
"$",
"panelFacet",
")",
"{",
"$",
"fields",
"=",
"$",
"panelFacet",
"->",
"getFieldsFacet",
"(",
")",
";",
"$",
"order",
"=",
"0",
";",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"field",
")",
"{... | Fixes gaps beteween fields orders | [
"Fixes",
"gaps",
"beteween",
"fields",
"orders"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/FacetManager.php#L129-L141 |
222,055 | claroline/CoreBundle | Manager/FacetManager.php | FacetManager.addField | public function addField(PanelFacet $panelFacet, $name, $type)
{
$this->om->startFlushSuite();
$fieldFacet = new FieldFacet();
$fieldFacet->setPanelFacet($panelFacet);
$fieldFacet->setName($name);
$fieldFacet->setType($type);
$fieldFacet->setPosition($this->om->count(... | php | public function addField(PanelFacet $panelFacet, $name, $type)
{
$this->om->startFlushSuite();
$fieldFacet = new FieldFacet();
$fieldFacet->setPanelFacet($panelFacet);
$fieldFacet->setName($name);
$fieldFacet->setType($type);
$fieldFacet->setPosition($this->om->count(... | [
"public",
"function",
"addField",
"(",
"PanelFacet",
"$",
"panelFacet",
",",
"$",
"name",
",",
"$",
"type",
")",
"{",
"$",
"this",
"->",
"om",
"->",
"startFlushSuite",
"(",
")",
";",
"$",
"fieldFacet",
"=",
"new",
"FieldFacet",
"(",
")",
";",
"$",
"f... | Creates a new field for a facet
@param PanelFacet $facet
@param string $name
@param integer $type | [
"Creates",
"a",
"new",
"field",
"for",
"a",
"facet"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/FacetManager.php#L150-L163 |
222,056 | claroline/CoreBundle | Manager/FacetManager.php | FacetManager.editPanel | public function editPanel(PanelFacet $panel)
{
$this->om->persist($panel);
$this->om->flush();
return $panel;
} | php | public function editPanel(PanelFacet $panel)
{
$this->om->persist($panel);
$this->om->flush();
return $panel;
} | [
"public",
"function",
"editPanel",
"(",
"PanelFacet",
"$",
"panel",
")",
"{",
"$",
"this",
"->",
"om",
"->",
"persist",
"(",
"$",
"panel",
")",
";",
"$",
"this",
"->",
"om",
"->",
"flush",
"(",
")",
";",
"return",
"$",
"panel",
";",
"}"
] | Persists and flush a panel.
@param FacetPanel $panel
@return FacetPanel | [
"Persists",
"and",
"flush",
"a",
"panel",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/FacetManager.php#L193-L199 |
222,057 | claroline/CoreBundle | Manager/FacetManager.php | FacetManager.removePanel | public function removePanel(PanelFacet $panel)
{
//some reordering have to happen here...
$panels = $this->panelRepo->findPanelsAfter($panel);
foreach ($panels as $afterPanel) {
$afterPanel->setPosition($afterPanel->getPosition() - 1);
$this->om->persist($afterPanel)... | php | public function removePanel(PanelFacet $panel)
{
//some reordering have to happen here...
$panels = $this->panelRepo->findPanelsAfter($panel);
foreach ($panels as $afterPanel) {
$afterPanel->setPosition($afterPanel->getPosition() - 1);
$this->om->persist($afterPanel)... | [
"public",
"function",
"removePanel",
"(",
"PanelFacet",
"$",
"panel",
")",
"{",
"//some reordering have to happen here...",
"$",
"panels",
"=",
"$",
"this",
"->",
"panelRepo",
"->",
"findPanelsAfter",
"(",
"$",
"panel",
")",
";",
"foreach",
"(",
"$",
"panels",
... | Removes a panel.
@param FacetPanel $panel | [
"Removes",
"a",
"panel",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/FacetManager.php#L206-L224 |
222,058 | claroline/CoreBundle | Manager/FacetManager.php | FacetManager.removeField | public function removeField(FieldFacet $field)
{
$panel = $field->getPanelFacet();
$this->om->remove($field);
$this->om->flush();
$this->reorderFields($panel);
} | php | public function removeField(FieldFacet $field)
{
$panel = $field->getPanelFacet();
$this->om->remove($field);
$this->om->flush();
$this->reorderFields($panel);
} | [
"public",
"function",
"removeField",
"(",
"FieldFacet",
"$",
"field",
")",
"{",
"$",
"panel",
"=",
"$",
"field",
"->",
"getPanelFacet",
"(",
")",
";",
"$",
"this",
"->",
"om",
"->",
"remove",
"(",
"$",
"field",
")",
";",
"$",
"this",
"->",
"om",
"-... | Removes a field from a facet
@param FieldFacet $field | [
"Removes",
"a",
"field",
"from",
"a",
"facet"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/FacetManager.php#L231-L237 |
222,059 | claroline/CoreBundle | Manager/FacetManager.php | FacetManager.setFieldValue | public function setFieldValue(User $user, FieldFacet $field, $value, $force = false)
{
if (!$this->authorization->isGranted('edit', $field) && !$force) {
throw new AccessDeniedException();
}
$fieldFacetValue = $this->om->getRepository('ClarolineCoreBundle:Facet\FieldFacetValue')... | php | public function setFieldValue(User $user, FieldFacet $field, $value, $force = false)
{
if (!$this->authorization->isGranted('edit', $field) && !$force) {
throw new AccessDeniedException();
}
$fieldFacetValue = $this->om->getRepository('ClarolineCoreBundle:Facet\FieldFacetValue')... | [
"public",
"function",
"setFieldValue",
"(",
"User",
"$",
"user",
",",
"FieldFacet",
"$",
"field",
",",
"$",
"value",
",",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"authorization",
"->",
"isGranted",
"(",
"'edit'",
",",
... | Set the value of a field for a user
@param User $user
@param FieldFacet $field
@param mixed $value
@throws \Exception | [
"Set",
"the",
"value",
"of",
"a",
"field",
"for",
"a",
"user"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/FacetManager.php#L248-L285 |
222,060 | claroline/CoreBundle | Manager/FacetManager.php | FacetManager.moveFacetUp | public function moveFacetUp(Facet $facet)
{
$currentPosition = $facet->getPosition();
if ($currentPosition < $this->om->count('Claroline\CoreBundle\Entity\Facet\Facet') - 1) {
$nextPosition = $currentPosition + 1;
$nextFacet = $this->om
->getRepository('Claro... | php | public function moveFacetUp(Facet $facet)
{
$currentPosition = $facet->getPosition();
if ($currentPosition < $this->om->count('Claroline\CoreBundle\Entity\Facet\Facet') - 1) {
$nextPosition = $currentPosition + 1;
$nextFacet = $this->om
->getRepository('Claro... | [
"public",
"function",
"moveFacetUp",
"(",
"Facet",
"$",
"facet",
")",
"{",
"$",
"currentPosition",
"=",
"$",
"facet",
"->",
"getPosition",
"(",
")",
";",
"if",
"(",
"$",
"currentPosition",
"<",
"$",
"this",
"->",
"om",
"->",
"count",
"(",
"'Claroline\\Co... | Moves a facet up
@param Facet $facet | [
"Moves",
"a",
"facet",
"up"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/FacetManager.php#L298-L313 |
222,061 | claroline/CoreBundle | Manager/FacetManager.php | FacetManager.moveFacetDown | public function moveFacetDown(Facet $facet)
{
$currentPosition = $facet->getPosition();
if ($currentPosition > 0) {
$prevPosition = $currentPosition - 1;
$prevFacet = $this->om
->getRepository('ClarolineCoreBundle:Facet\Facet')
->findOneBy(arr... | php | public function moveFacetDown(Facet $facet)
{
$currentPosition = $facet->getPosition();
if ($currentPosition > 0) {
$prevPosition = $currentPosition - 1;
$prevFacet = $this->om
->getRepository('ClarolineCoreBundle:Facet\Facet')
->findOneBy(arr... | [
"public",
"function",
"moveFacetDown",
"(",
"Facet",
"$",
"facet",
")",
"{",
"$",
"currentPosition",
"=",
"$",
"facet",
"->",
"getPosition",
"(",
")",
";",
"if",
"(",
"$",
"currentPosition",
">",
"0",
")",
"{",
"$",
"prevPosition",
"=",
"$",
"currentPosi... | Moves a facet down
@param Facet $facet | [
"Moves",
"a",
"facet",
"down"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/FacetManager.php#L320-L335 |
222,062 | claroline/CoreBundle | Manager/FacetManager.php | FacetManager.setFieldBoolProperty | public function setFieldBoolProperty(FieldFacet $fieldFacet, array $roles, $property)
{
//find each fields sharing the same role as $fieldFacet
$fieldFacetsRole = $fieldFacet->getFieldFacetsRole();
//get the correct setter
$setterFunc = 'set' . ucfirst($property);
//initia... | php | public function setFieldBoolProperty(FieldFacet $fieldFacet, array $roles, $property)
{
//find each fields sharing the same role as $fieldFacet
$fieldFacetsRole = $fieldFacet->getFieldFacetsRole();
//get the correct setter
$setterFunc = 'set' . ucfirst($property);
//initia... | [
"public",
"function",
"setFieldBoolProperty",
"(",
"FieldFacet",
"$",
"fieldFacet",
",",
"array",
"$",
"roles",
",",
"$",
"property",
")",
"{",
"//find each fields sharing the same role as $fieldFacet",
"$",
"fieldFacetsRole",
"=",
"$",
"fieldFacet",
"->",
"getFieldFace... | This function will allow to set on of the boolean property of FieldFacetRole
for a fieldFacet and an array of roles.
@param FieldFacet $fieldFacet
@param array $roles
@param $property (canOpen | canEdit) | [
"This",
"function",
"will",
"allow",
"to",
"set",
"on",
"of",
"the",
"boolean",
"property",
"of",
"FieldFacetRole",
"for",
"a",
"fieldFacet",
"and",
"an",
"array",
"of",
"roles",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/FacetManager.php#L458-L510 |
222,063 | claroline/CoreBundle | Manager/RightsManager.php | RightsManager.create | public function create(
$permissions,
Role $role,
ResourceNode $node,
$isRecursive,
array $creations = array()
)
{
$rights = $this->rightsRepo->findBy(array('role' => $role, 'resourceNode' => $node));
if (count($rights) === 0) {
$isRecursive ?... | php | public function create(
$permissions,
Role $role,
ResourceNode $node,
$isRecursive,
array $creations = array()
)
{
$rights = $this->rightsRepo->findBy(array('role' => $role, 'resourceNode' => $node));
if (count($rights) === 0) {
$isRecursive ?... | [
"public",
"function",
"create",
"(",
"$",
"permissions",
",",
"Role",
"$",
"role",
",",
"ResourceNode",
"$",
"node",
",",
"$",
"isRecursive",
",",
"array",
"$",
"creations",
"=",
"array",
"(",
")",
")",
"{",
"$",
"rights",
"=",
"$",
"this",
"->",
"ri... | Create a new ResourceRight. If the ResourceRight already exists, it's edited instead.
@param array|integer $permissions
@param \Claroline\CoreBundle\Entity\Role $role
@param \Claroline\CoreBundle\Entity\Resource\ResourceNode $node
@param boolean $isRecursive
@param array $creations | [
"Create",
"a",
"new",
"ResourceRight",
".",
"If",
"the",
"ResourceRight",
"already",
"exists",
"it",
"s",
"edited",
"instead",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/RightsManager.php#L107-L124 |
222,064 | claroline/CoreBundle | Manager/RightsManager.php | RightsManager.copy | public function copy(ResourceNode $original, ResourceNode $node)
{
$originalRights = $this->rightsRepo->findBy(array('resourceNode' => $original));
$this->om->startFlushSuite();
foreach ($originalRights as $originalRight) {
$new = $this->om->factory('Claroline\CoreBundle\Entity\... | php | public function copy(ResourceNode $original, ResourceNode $node)
{
$originalRights = $this->rightsRepo->findBy(array('resourceNode' => $original));
$this->om->startFlushSuite();
foreach ($originalRights as $originalRight) {
$new = $this->om->factory('Claroline\CoreBundle\Entity\... | [
"public",
"function",
"copy",
"(",
"ResourceNode",
"$",
"original",
",",
"ResourceNode",
"$",
"node",
")",
"{",
"$",
"originalRights",
"=",
"$",
"this",
"->",
"rightsRepo",
"->",
"findBy",
"(",
"array",
"(",
"'resourceNode'",
"=>",
"$",
"original",
")",
")... | Copy the rights from the parent to its children.
@param \Claroline\CoreBundle\Entity\Resource\ResourceNode $original
@param \Claroline\CoreBundle\Entity\Resource\ResourceNode $node | [
"Copy",
"the",
"rights",
"from",
"the",
"parent",
"to",
"its",
"children",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/RightsManager.php#L238-L256 |
222,065 | claroline/CoreBundle | Manager/RightsManager.php | RightsManager.canEditPwsPerm | public function canEditPwsPerm(TokenInterface $token)
{
if ($this->container->get('security.context')->isGranted('ROLE_ADMIN')) return true;
$roles = $this->roleManager->getStringRolesFromToken($token);
$accesses = $this->om
->getRepository('ClarolineCoreBundle:Resource\PwsRight... | php | public function canEditPwsPerm(TokenInterface $token)
{
if ($this->container->get('security.context')->isGranted('ROLE_ADMIN')) return true;
$roles = $this->roleManager->getStringRolesFromToken($token);
$accesses = $this->om
->getRepository('ClarolineCoreBundle:Resource\PwsRight... | [
"public",
"function",
"canEditPwsPerm",
"(",
"TokenInterface",
"$",
"token",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'security.context'",
")",
"->",
"isGranted",
"(",
"'ROLE_ADMIN'",
")",
")",
"return",
"true",
";",
"$",
"ro... | Check if the permissions can be edited for a resource. This may change in the future
because it's quite heavy ! | [
"Check",
"if",
"the",
"permissions",
"can",
"be",
"edited",
"for",
"a",
"resource",
".",
"This",
"may",
"change",
"in",
"the",
"future",
"because",
"it",
"s",
"quite",
"heavy",
"!"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/RightsManager.php#L670-L684 |
222,066 | claroline/CoreBundle | Library/Utilities/ClaroUtilities.php | ClaroUtilities.getRealFileSize | public function getRealFileSize($fileSize)
{
//B goes at the end because it's always matched otherwise
$validUnits = array('KB', 'MB', 'GB', 'TB');
$value = str_replace(' ', '', $fileSize);
$replacements = array('');
$pattern = '/(\d+)/';
$data = preg_grep($pattern, ... | php | public function getRealFileSize($fileSize)
{
//B goes at the end because it's always matched otherwise
$validUnits = array('KB', 'MB', 'GB', 'TB');
$value = str_replace(' ', '', $fileSize);
$replacements = array('');
$pattern = '/(\d+)/';
$data = preg_grep($pattern, ... | [
"public",
"function",
"getRealFileSize",
"(",
"$",
"fileSize",
")",
"{",
"//B goes at the end because it's always matched otherwise",
"$",
"validUnits",
"=",
"array",
"(",
"'KB'",
",",
"'MB'",
",",
"'GB'",
",",
"'TB'",
")",
";",
"$",
"value",
"=",
"str_replace",
... | Take a formatted file size and returns the number of bytes | [
"Take",
"a",
"formatted",
"file",
"size",
"and",
"returns",
"the",
"number",
"of",
"bytes"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Library/Utilities/ClaroUtilities.php#L220-L248 |
222,067 | claroline/CoreBundle | DataFixtures/Required/Data/LoadHomeTabData.php | LoadHomeTabData.load | public function load(ObjectManager $manager)
{
$translator = $this->container->get('translator');
$infoName = $translator->trans('informations', array(), 'platform');
$desktopHomeTab = new HomeTab();
$desktopHomeTab->setType('admin_desktop');
$desktopHomeTab->setName($infoNa... | php | public function load(ObjectManager $manager)
{
$translator = $this->container->get('translator');
$infoName = $translator->trans('informations', array(), 'platform');
$desktopHomeTab = new HomeTab();
$desktopHomeTab->setType('admin_desktop');
$desktopHomeTab->setName($infoNa... | [
"public",
"function",
"load",
"(",
"ObjectManager",
"$",
"manager",
")",
"{",
"$",
"translator",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'translator'",
")",
";",
"$",
"infoName",
"=",
"$",
"translator",
"->",
"trans",
"(",
"'informations'",... | Loads the core Home Tabs.
@param ObjectManager $manager | [
"Loads",
"the",
"core",
"Home",
"Tabs",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/DataFixtures/Required/Data/LoadHomeTabData.php#L29-L59 |
222,068 | claroline/CoreBundle | Repository/ResourceNodeRepository.php | ResourceNodeRepository.findWorkspaceRoot | public function findWorkspaceRoot(Workspace $workspace)
{
$builder = new ResourceQueryBuilder();
$builder->selectAsEntity()
->whereInWorkspace($workspace)
->whereParentIsNull();
$query = $this->_em->createQuery($builder->getDql());
$query->setParameters($build... | php | public function findWorkspaceRoot(Workspace $workspace)
{
$builder = new ResourceQueryBuilder();
$builder->selectAsEntity()
->whereInWorkspace($workspace)
->whereParentIsNull();
$query = $this->_em->createQuery($builder->getDql());
$query->setParameters($build... | [
"public",
"function",
"findWorkspaceRoot",
"(",
"Workspace",
"$",
"workspace",
")",
"{",
"$",
"builder",
"=",
"new",
"ResourceQueryBuilder",
"(",
")",
";",
"$",
"builder",
"->",
"selectAsEntity",
"(",
")",
"->",
"whereInWorkspace",
"(",
"$",
"workspace",
")",
... | Returns the root directory of a workspace.
@param Workspace $workspace
@return ResourceNode | [
"Returns",
"the",
"root",
"directory",
"of",
"a",
"workspace",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Repository/ResourceNodeRepository.php#L48-L58 |
222,069 | claroline/CoreBundle | Repository/ResourceNodeRepository.php | ResourceNodeRepository.findWorkspaceRootsByUser | public function findWorkspaceRootsByUser(User $user)
{
$builder = new ResourceQueryBuilder();
$dql = $builder->selectAsArray()
->whereParentIsNull()
->whereInUserWorkspace($user)
->orderByPath()
->getDql();
$query = $this->_em->createQuery($dql... | php | public function findWorkspaceRootsByUser(User $user)
{
$builder = new ResourceQueryBuilder();
$dql = $builder->selectAsArray()
->whereParentIsNull()
->whereInUserWorkspace($user)
->orderByPath()
->getDql();
$query = $this->_em->createQuery($dql... | [
"public",
"function",
"findWorkspaceRootsByUser",
"(",
"User",
"$",
"user",
")",
"{",
"$",
"builder",
"=",
"new",
"ResourceQueryBuilder",
"(",
")",
";",
"$",
"dql",
"=",
"$",
"builder",
"->",
"selectAsArray",
"(",
")",
"->",
"whereParentIsNull",
"(",
")",
... | Returns the root directories of workspaces a user is registered to.
@param User $user
@return array[array] An array of resources represented as arrays | [
"Returns",
"the",
"root",
"directories",
"of",
"workspaces",
"a",
"user",
"is",
"registered",
"to",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Repository/ResourceNodeRepository.php#L200-L212 |
222,070 | claroline/CoreBundle | Repository/ResourceNodeRepository.php | ResourceNodeRepository.findWorkspaceRootsByRoles | public function findWorkspaceRootsByRoles(array $roles)
{
$builder = new ResourceQueryBuilder();
$dql = $builder->selectAsArray()
->whereParentIsNull()
->whereHasRoleIn($roles)
->orderByName()
->getDql();
$query = $this->_em->createQuery($dql)... | php | public function findWorkspaceRootsByRoles(array $roles)
{
$builder = new ResourceQueryBuilder();
$dql = $builder->selectAsArray()
->whereParentIsNull()
->whereHasRoleIn($roles)
->orderByName()
->getDql();
$query = $this->_em->createQuery($dql)... | [
"public",
"function",
"findWorkspaceRootsByRoles",
"(",
"array",
"$",
"roles",
")",
"{",
"$",
"builder",
"=",
"new",
"ResourceQueryBuilder",
"(",
")",
";",
"$",
"dql",
"=",
"$",
"builder",
"->",
"selectAsArray",
"(",
")",
"->",
"whereParentIsNull",
"(",
")",... | Returns the roots directories a user is granted access
@param array $roles
@return array[array] An array of resources represented as arrays | [
"Returns",
"the",
"roots",
"directories",
"a",
"user",
"is",
"granted",
"access"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Repository/ResourceNodeRepository.php#L221-L234 |
222,071 | claroline/CoreBundle | Repository/ResourceNodeRepository.php | ResourceNodeRepository.findAncestors | public function findAncestors(ResourceNode $resource)
{
// No need to access DB to get ancestors as they are given by the materialized path.
$regex = '/-(\d+)' . ResourceNode::PATH_SEPARATOR . '/';
$parts = preg_split($regex, $resource->getPath(), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO... | php | public function findAncestors(ResourceNode $resource)
{
// No need to access DB to get ancestors as they are given by the materialized path.
$regex = '/-(\d+)' . ResourceNode::PATH_SEPARATOR . '/';
$parts = preg_split($regex, $resource->getPath(), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO... | [
"public",
"function",
"findAncestors",
"(",
"ResourceNode",
"$",
"resource",
")",
"{",
"// No need to access DB to get ancestors as they are given by the materialized path.",
"$",
"regex",
"=",
"'/-(\\d+)'",
".",
"ResourceNode",
"::",
"PATH_SEPARATOR",
".",
"'/'",
";",
"$",... | Returns the ancestors of a resource, including the resource itself.
@param ResourceNode $resource
@return array[array] An array of resources represented as arrays | [
"Returns",
"the",
"ancestors",
"of",
"a",
"resource",
"including",
"the",
"resource",
"itself",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Repository/ResourceNodeRepository.php#L243-L261 |
222,072 | claroline/CoreBundle | Repository/ResourceNodeRepository.php | ResourceNodeRepository.findWorkspaceInfoByIds | public function findWorkspaceInfoByIds(array $nodesIds)
{
if (count($nodesIds) === 0) {
throw new \InvalidArgumentException('Resource ids array cannot be empty');
}
$dql = '
SELECT r.id AS id, w.code AS code, w.name AS name
FROM Claroline\CoreBundle\Entit... | php | public function findWorkspaceInfoByIds(array $nodesIds)
{
if (count($nodesIds) === 0) {
throw new \InvalidArgumentException('Resource ids array cannot be empty');
}
$dql = '
SELECT r.id AS id, w.code AS code, w.name AS name
FROM Claroline\CoreBundle\Entit... | [
"public",
"function",
"findWorkspaceInfoByIds",
"(",
"array",
"$",
"nodesIds",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"nodesIds",
")",
"===",
"0",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Resource ids array cannot be empty'",
")",
";",... | Returns the workspace name and code of the resources whose ids are passed
as argument.
@param array $resourceIds
@return array
@throws \InvalidArgumentException if the resource ids array is empty | [
"Returns",
"the",
"workspace",
"name",
"and",
"code",
"of",
"the",
"resources",
"whose",
"ids",
"are",
"passed",
"as",
"argument",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Repository/ResourceNodeRepository.php#L349-L366 |
222,073 | claroline/CoreBundle | Manager/ToolManager.php | ToolManager.getDesktopToolsConfigurationArrayForAdmin | public function getDesktopToolsConfigurationArrayForAdmin($type = 0)
{
$orderedToolList = array();
$desktopTools = $this->orderedToolRepo
->findDisplayableDesktopOrderedToolsByTypeForAdmin($type);
foreach ($desktopTools as $desktopTool) {
//this field isn't mapped
... | php | public function getDesktopToolsConfigurationArrayForAdmin($type = 0)
{
$orderedToolList = array();
$desktopTools = $this->orderedToolRepo
->findDisplayableDesktopOrderedToolsByTypeForAdmin($type);
foreach ($desktopTools as $desktopTool) {
//this field isn't mapped
... | [
"public",
"function",
"getDesktopToolsConfigurationArrayForAdmin",
"(",
"$",
"type",
"=",
"0",
")",
"{",
"$",
"orderedToolList",
"=",
"array",
"(",
")",
";",
"$",
"desktopTools",
"=",
"$",
"this",
"->",
"orderedToolRepo",
"->",
"findDisplayableDesktopOrderedToolsByT... | Returns the sorted list of OrderedTools for configuration in admin.
@return \Claroline\CoreBundle\Entity\Tool\OrderedTool | [
"Returns",
"the",
"sorted",
"list",
"of",
"OrderedTools",
"for",
"configuration",
"in",
"admin",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/ToolManager.php#L235-L261 |
222,074 | claroline/CoreBundle | Manager/ToolManager.php | ToolManager.extractFiles | public function extractFiles($archpath, $confTools)
{
$extractPath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid('claro_ws_tmp_', true);
$archive = $this->om->factory('ZipArchive');
$archive->open($archpath);
$archive->extractTo($extractPath);
$realPaths = array();
... | php | public function extractFiles($archpath, $confTools)
{
$extractPath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid('claro_ws_tmp_', true);
$archive = $this->om->factory('ZipArchive');
$archive->open($archpath);
$archive->extractTo($extractPath);
$realPaths = array();
... | [
"public",
"function",
"extractFiles",
"(",
"$",
"archpath",
",",
"$",
"confTools",
")",
"{",
"$",
"extractPath",
"=",
"sys_get_temp_dir",
"(",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"uniqid",
"(",
"'claro_ws_tmp_'",
",",
"true",
")",
";",
"$",
"archive",
"=",... | Extract the files from a the template configuration array
@param string $archpath
@param array $confTools
@return array | [
"Extract",
"the",
"files",
"from",
"a",
"the",
"template",
"configuration",
"array"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Manager/ToolManager.php#L692-L707 |
222,075 | claroline/CoreBundle | Repository/RoleRepository.php | RoleRepository.findWorkspaceRolesForUser | public function findWorkspaceRolesForUser(User $user, Workspace $workspace)
{
$dql = "
SELECT r FROM Claroline\CoreBundle\Entity\Role r
JOIN r.workspace ws
JOIN r.users user
WHERE ws.guid = '{$workspace->getGuid()}'
AND r.name != 'ROLE_ADMIN'
... | php | public function findWorkspaceRolesForUser(User $user, Workspace $workspace)
{
$dql = "
SELECT r FROM Claroline\CoreBundle\Entity\Role r
JOIN r.workspace ws
JOIN r.users user
WHERE ws.guid = '{$workspace->getGuid()}'
AND r.name != 'ROLE_ADMIN'
... | [
"public",
"function",
"findWorkspaceRolesForUser",
"(",
"User",
"$",
"user",
",",
"Workspace",
"$",
"workspace",
")",
"{",
"$",
"dql",
"=",
"\"\n SELECT r FROM Claroline\\CoreBundle\\Entity\\Role r\n JOIN r.workspace ws\n JOIN r.users user\n ... | Returns the roles of a user in a workspace.
@param User $user The subject of the role
@param Workspace $workspace The workspace the role should be bound to
@return null|Role | [
"Returns",
"the",
"roles",
"of",
"a",
"user",
"in",
"a",
"workspace",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Repository/RoleRepository.php#L187-L201 |
222,076 | claroline/CoreBundle | Form/Field/ResourcePickerType.php | ResourcePickerType.getResourceNode | private function getResourceNode(FormInterface $form)
{
if ($form->getData() instanceof ResourceNode) {
return $form->getData();
} else if ($form->getData() and $form->getData() != '') {
return $this->resourceManager->getById($form->getData());
}
} | php | private function getResourceNode(FormInterface $form)
{
if ($form->getData() instanceof ResourceNode) {
return $form->getData();
} else if ($form->getData() and $form->getData() != '') {
return $this->resourceManager->getById($form->getData());
}
} | [
"private",
"function",
"getResourceNode",
"(",
"FormInterface",
"$",
"form",
")",
"{",
"if",
"(",
"$",
"form",
"->",
"getData",
"(",
")",
"instanceof",
"ResourceNode",
")",
"{",
"return",
"$",
"form",
"->",
"getData",
"(",
")",
";",
"}",
"else",
"if",
... | Get resource node | [
"Get",
"resource",
"node"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Form/Field/ResourcePickerType.php#L101-L108 |
222,077 | claroline/CoreBundle | Controller/Administration/FacetController.php | FacetController.fieldFormAction | public function fieldFormAction(PanelFacet $panelFacet)
{
$form = $this->formFactory->create(new FieldFacetType(), new FieldFacet());
return array('form' => $form->createView(), 'panelFacet' => $panelFacet);
} | php | public function fieldFormAction(PanelFacet $panelFacet)
{
$form = $this->formFactory->create(new FieldFacetType(), new FieldFacet());
return array('form' => $form->createView(), 'panelFacet' => $panelFacet);
} | [
"public",
"function",
"fieldFormAction",
"(",
"PanelFacet",
"$",
"panelFacet",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"formFactory",
"->",
"create",
"(",
"new",
"FieldFacetType",
"(",
")",
",",
"new",
"FieldFacet",
"(",
")",
")",
";",
"return",
"... | Returns the facet field creation form in a modal
@EXT\Route("/panel/{panelFacet}/field/form",
name="claro_admin_facet_field_form",
options = {"expose"=true}
)
@EXT\Template | [
"Returns",
"the",
"facet",
"field",
"creation",
"form",
"in",
"a",
"modal"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Controller/Administration/FacetController.php#L168-L173 |
222,078 | claroline/CoreBundle | Controller/Administration/FacetController.php | FacetController.moveFieldFacetsAction | public function moveFieldFacetsAction(PanelFacet $panel)
{
$params = $this->request->query->all();
$ids = [];
foreach ($params['ids'] as $value) {
$ids[] = (int) str_replace('field-', '', $value);
}
$this->facetManager->orderFields($ids, $panel);
return... | php | public function moveFieldFacetsAction(PanelFacet $panel)
{
$params = $this->request->query->all();
$ids = [];
foreach ($params['ids'] as $value) {
$ids[] = (int) str_replace('field-', '', $value);
}
$this->facetManager->orderFields($ids, $panel);
return... | [
"public",
"function",
"moveFieldFacetsAction",
"(",
"PanelFacet",
"$",
"panel",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"request",
"->",
"query",
"->",
"all",
"(",
")",
";",
"$",
"ids",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"params",
"[",... | Ajax method for ordering fields
@EXT\Route("/{panel}/fields/order",
name="claro_admin_field_facet_order",
options = {"expose"=true}
) | [
"Ajax",
"method",
"for",
"ordering",
"fields"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Controller/Administration/FacetController.php#L397-L409 |
222,079 | claroline/CoreBundle | Controller/Administration/FacetController.php | FacetController.facetRolesFormAction | public function facetRolesFormAction(Facet $facet)
{
$roles = $facet->getRoles();
$platformRoles = $this->roleManager->getPlatformNonAdminRoles(true);
return array('roles' => $roles, 'facet' => $facet, 'platformRoles' => $platformRoles);
} | php | public function facetRolesFormAction(Facet $facet)
{
$roles = $facet->getRoles();
$platformRoles = $this->roleManager->getPlatformNonAdminRoles(true);
return array('roles' => $roles, 'facet' => $facet, 'platformRoles' => $platformRoles);
} | [
"public",
"function",
"facetRolesFormAction",
"(",
"Facet",
"$",
"facet",
")",
"{",
"$",
"roles",
"=",
"$",
"facet",
"->",
"getRoles",
"(",
")",
";",
"$",
"platformRoles",
"=",
"$",
"this",
"->",
"roleManager",
"->",
"getPlatformNonAdminRoles",
"(",
"true",
... | Returns the facet role edition in a modal
@EXT\Route("/{facet}/roles/form",
name="claro_admin_facet_role_form",
options = {"expose"=true}
)
@EXT\Template() | [
"Returns",
"the",
"facet",
"role",
"edition",
"in",
"a",
"modal"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Controller/Administration/FacetController.php#L421-L427 |
222,080 | claroline/CoreBundle | Controller/Administration/FacetController.php | FacetController.fieldRolesFormAction | public function fieldRolesFormAction(FieldFacet $field)
{
$fieldFacetsRole = $field->getFieldFacetsRole();
$platformRoles = $this->roleManager->getPlatformNonAdminRoles(true);
return array('fieldFacetsRole' => $fieldFacetsRole, 'field' => $field, 'platformRoles' => $platformRoles);
} | php | public function fieldRolesFormAction(FieldFacet $field)
{
$fieldFacetsRole = $field->getFieldFacetsRole();
$platformRoles = $this->roleManager->getPlatformNonAdminRoles(true);
return array('fieldFacetsRole' => $fieldFacetsRole, 'field' => $field, 'platformRoles' => $platformRoles);
} | [
"public",
"function",
"fieldRolesFormAction",
"(",
"FieldFacet",
"$",
"field",
")",
"{",
"$",
"fieldFacetsRole",
"=",
"$",
"field",
"->",
"getFieldFacetsRole",
"(",
")",
";",
"$",
"platformRoles",
"=",
"$",
"this",
"->",
"roleManager",
"->",
"getPlatformNonAdmin... | Returns the field role edition in a modal
@EXT\Route("/field/{field}/roles/form",
name="claro_admin_field_role_form",
options = {"expose"=true}
)
@EXT\Template() | [
"Returns",
"the",
"field",
"role",
"edition",
"in",
"a",
"modal"
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Controller/Administration/FacetController.php#L453-L459 |
222,081 | claroline/CoreBundle | Controller/Administration/FacetController.php | FacetController.orderPanels | public function orderPanels(Facet $facet)
{
$params = $this->request->query->all();
$ids = [];
foreach ($params['ids'] as $value) {
$ids[] = (int) str_replace('panel-', '', $value);
}
$this->facetManager->orderPanels($ids, $facet);
return new Response('... | php | public function orderPanels(Facet $facet)
{
$params = $this->request->query->all();
$ids = [];
foreach ($params['ids'] as $value) {
$ids[] = (int) str_replace('panel-', '', $value);
}
$this->facetManager->orderPanels($ids, $facet);
return new Response('... | [
"public",
"function",
"orderPanels",
"(",
"Facet",
"$",
"facet",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"request",
"->",
"query",
"->",
"all",
"(",
")",
";",
"$",
"ids",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"params",
"[",
"'ids'",
"... | Reorder panels.
@EXT\Route("/order/panels/facet/{facet}",
name="claro_admin_panel_facet_order",
options = {"expose" = true}
) | [
"Reorder",
"panels",
"."
] | dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3 | https://github.com/claroline/CoreBundle/blob/dec7daea24ec201cd54bfc0d5dd7c7160bbbdef3/Controller/Administration/FacetController.php#L630-L642 |
222,082 | usmanhalalit/strana | src/Strana/ConfigHelper.php | ConfigHelper.setDefaults | protected function setDefaults()
{
$get = $_GET;
$page = isset($get['page']) ? (int) $get['page'] : 1;
$defaults = array(
'perPage' => 20,
'page' => $page,
'maximumPages' => 5,
'infiniteScroll' => false,
... | php | protected function setDefaults()
{
$get = $_GET;
$page = isset($get['page']) ? (int) $get['page'] : 1;
$defaults = array(
'perPage' => 20,
'page' => $page,
'maximumPages' => 5,
'infiniteScroll' => false,
... | [
"protected",
"function",
"setDefaults",
"(",
")",
"{",
"$",
"get",
"=",
"$",
"_GET",
";",
"$",
"page",
"=",
"isset",
"(",
"$",
"get",
"[",
"'page'",
"]",
")",
"?",
"(",
"int",
")",
"$",
"get",
"[",
"'page'",
"]",
":",
"1",
";",
"$",
"defaults",... | Set default config values | [
"Set",
"default",
"config",
"values"
] | 8b4f7221df222ab79e1d0d54ddea29519c8c481b | https://github.com/usmanhalalit/strana/blob/8b4f7221df222ab79e1d0d54ddea29519c8c481b/src/Strana/ConfigHelper.php#L21-L33 |
222,083 | symlex/input-validation | src/Form.php | Form.getParam | protected function getParam(string $name)
{
if (!array_key_exists($name, $this->_params)) {
throw new Exception ('Required parameter "' . $name . '" was not set');
}
return $this->_params[$name];
} | php | protected function getParam(string $name)
{
if (!array_key_exists($name, $this->_params)) {
throw new Exception ('Required parameter "' . $name . '" was not set');
}
return $this->_params[$name];
} | [
"protected",
"function",
"getParam",
"(",
"string",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"_params",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Required parameter \"'",
".",
"$",
"nam... | Returns optional config parameter or throws Exception, if parameter does not exist
@param string $name
@throws Exception
@return mixed | [
"Returns",
"optional",
"config",
"parameter",
"or",
"throws",
"Exception",
"if",
"parameter",
"does",
"not",
"exist"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form.php#L154-L161 |
222,084 | symlex/input-validation | src/Form.php | Form.optionsWithDefault | public function optionsWithDefault(string $listName, string $defaultLabel = ''): array
{
$result = $this->getDefaultOption($defaultLabel) + $this->options($listName);
return $result;
} | php | public function optionsWithDefault(string $listName, string $defaultLabel = ''): array
{
$result = $this->getDefaultOption($defaultLabel) + $this->options($listName);
return $result;
} | [
"public",
"function",
"optionsWithDefault",
"(",
"string",
"$",
"listName",
",",
"string",
"$",
"defaultLabel",
"=",
"''",
")",
":",
"array",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getDefaultOption",
"(",
"$",
"defaultLabel",
")",
"+",
"$",
"this",
... | Returns a list of options with default label for no selection
'country' => array(
'type' => 'string',
'required' => true,
'options' => $this->form->optionsWithDefault('countries')
)
@param string $listName Optional name of options list (shortcut)
@param string $defaultLabel The field label translation token
@return a... | [
"Returns",
"a",
"list",
"of",
"options",
"with",
"default",
"label",
"for",
"no",
"selection"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form.php#L229-L234 |
222,085 | symlex/input-validation | src/Form.php | Form.getDefaultOption | protected function getDefaultOption(string $label = ''): array
{
if ($label == '') {
$label = $this->getDefaultOptionLabel();
}
return array('' => $this->translate($label));
} | php | protected function getDefaultOption(string $label = ''): array
{
if ($label == '') {
$label = $this->getDefaultOptionLabel();
}
return array('' => $this->translate($label));
} | [
"protected",
"function",
"getDefaultOption",
"(",
"string",
"$",
"label",
"=",
"''",
")",
":",
"array",
"{",
"if",
"(",
"$",
"label",
"==",
"''",
")",
"{",
"$",
"label",
"=",
"$",
"this",
"->",
"getDefaultOptionLabel",
"(",
")",
";",
"}",
"return",
"... | Helper function to return default option string like "Please select"
@param string $label The field label token
@return array | [
"Helper",
"function",
"to",
"return",
"default",
"option",
"string",
"like",
"Please",
"select"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form.php#L265-L272 |
222,086 | symlex/input-validation | src/Form.php | Form.addDefinition | public function addDefinition(string $name, array $definition)
{
if (isset($this->_definition[$name])) {
throw new Exception('Definition for "' . $name . '" already exists');
}
$this->_definition[$name] = $definition;
return $this;
} | php | public function addDefinition(string $name, array $definition)
{
if (isset($this->_definition[$name])) {
throw new Exception('Definition for "' . $name . '" already exists');
}
$this->_definition[$name] = $definition;
return $this;
} | [
"public",
"function",
"addDefinition",
"(",
"string",
"$",
"name",
",",
"array",
"$",
"definition",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_definition",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Definitio... | Adds a single form field definition
@param string $name Field name
@param array $definition Field definition array
@throws Exception
@return $this | [
"Adds",
"a",
"single",
"form",
"field",
"definition"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form.php#L444-L453 |
222,087 | symlex/input-validation | src/Form.php | Form.changeDefinition | public function changeDefinition(string $name, array $changes)
{
if (!isset($this->_definition[$name])) {
throw new Exception('Definition for "' . $name . '" does not exist');
}
foreach ($changes as $prop => $val) {
if ($val === null) {
unset($this->_... | php | public function changeDefinition(string $name, array $changes)
{
if (!isset($this->_definition[$name])) {
throw new Exception('Definition for "' . $name . '" does not exist');
}
foreach ($changes as $prop => $val) {
if ($val === null) {
unset($this->_... | [
"public",
"function",
"changeDefinition",
"(",
"string",
"$",
"name",
",",
"array",
"$",
"changes",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_definition",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'De... | Changes a single form field definition
@param string $name Field name
@param array $changes Field definition array
@throws Exception
@return $this | [
"Changes",
"a",
"single",
"form",
"field",
"definition"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form.php#L463-L478 |
222,088 | symlex/input-validation | src/Form.php | Form.getFieldAsArray | public function getFieldAsArray(string $name): array
{
$result = $this->getFieldDefinition($name);
$result['name'] = $name;
if (empty($result['caption'])) {
$result['caption'] = $this->_($result['name']);
}
$value = $this->$name;
$type = @$result['type'... | php | public function getFieldAsArray(string $name): array
{
$result = $this->getFieldDefinition($name);
$result['name'] = $name;
if (empty($result['caption'])) {
$result['caption'] = $this->_($result['name']);
}
$value = $this->$name;
$type = @$result['type'... | [
"public",
"function",
"getFieldAsArray",
"(",
"string",
"$",
"name",
")",
":",
"array",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getFieldDefinition",
"(",
"$",
"name",
")",
";",
"$",
"result",
"[",
"'name'",
"]",
"=",
"$",
"name",
";",
"if",
"(",... | Returns field definition and value as JSON compatible array
@param string $name
@return array | [
"Returns",
"field",
"definition",
"and",
"value",
"as",
"JSON",
"compatible",
"array"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form.php#L486-L517 |
222,089 | symlex/input-validation | src/Form.php | Form.isOptional | protected function isOptional(string $name): bool
{
return ($this->getFieldProperty($name, 'checkbox') == true) || ($this->getFieldProperty($name, 'optional') == true);
} | php | protected function isOptional(string $name): bool
{
return ($this->getFieldProperty($name, 'checkbox') == true) || ($this->getFieldProperty($name, 'optional') == true);
} | [
"protected",
"function",
"isOptional",
"(",
"string",
"$",
"name",
")",
":",
"bool",
"{",
"return",
"(",
"$",
"this",
"->",
"getFieldProperty",
"(",
"$",
"name",
",",
"'checkbox'",
")",
"==",
"true",
")",
"||",
"(",
"$",
"this",
"->",
"getFieldProperty",... | Returns true, if the field is optional
This is a workaround for Web form elements, that do not get submitted, if empty.
In general, this applies to non-checked checkboxes or to empty form elements
submitted by certain JavaScript frameworks (e.g. AngularJS).
@param string $name
@return bool | [
"Returns",
"true",
"if",
"the",
"field",
"is",
"optional"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form.php#L583-L586 |
222,090 | symlex/input-validation | src/Form.php | Form.setOptionalValueInArray | protected function setOptionalValueInArray(string $name, &$values)
{
if ($this->isOptional($name) && !array_key_exists($name, $values)) {
$default = $this->getFieldProperty($name, 'default');
if (is_null($default)) {
$type = $this->getFieldProperty($name, 'type');
... | php | protected function setOptionalValueInArray(string $name, &$values)
{
if ($this->isOptional($name) && !array_key_exists($name, $values)) {
$default = $this->getFieldProperty($name, 'default');
if (is_null($default)) {
$type = $this->getFieldProperty($name, 'type');
... | [
"protected",
"function",
"setOptionalValueInArray",
"(",
"string",
"$",
"name",
",",
"&",
"$",
"values",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isOptional",
"(",
"$",
"name",
")",
"&&",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"values",
"... | Sets the default types for values of form fields marked as optional
@param string $name The field name
@param array $values Reference to the array containing all form values
@return $this | [
"Sets",
"the",
"default",
"types",
"for",
"values",
"of",
"form",
"fields",
"marked",
"as",
"optional"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form.php#L595-L617 |
222,091 | symlex/input-validation | src/Form.php | Form.setDefinedValues | public function setDefinedValues(array $values)
{
foreach ($this->_definition as $key => $value) {
$this->setOptionalValueInArray($key, $values);
if (!array_key_exists($key, $values)) {
throw new Exception ('Value is missing for "' . $key . '"');
}
... | php | public function setDefinedValues(array $values)
{
foreach ($this->_definition as $key => $value) {
$this->setOptionalValueInArray($key, $values);
if (!array_key_exists($key, $values)) {
throw new Exception ('Value is missing for "' . $key . '"');
}
... | [
"public",
"function",
"setDefinedValues",
"(",
"array",
"$",
"values",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_definition",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"setOptionalValueInArray",
"(",
"$",
"key",
",",
"$",
... | Iterates through the form definition and sets the values for fields, that are present in the form definition
@param array $values The values (key must be the field name)
@throws Exception
@return $this | [
"Iterates",
"through",
"the",
"form",
"definition",
"and",
"sets",
"the",
"values",
"for",
"fields",
"that",
"are",
"present",
"in",
"the",
"form",
"definition"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form.php#L642-L655 |
222,092 | symlex/input-validation | src/Form.php | Form.setWritableValues | public function setWritableValues(array $values)
{
foreach ($values as $key => $value) {
if ($this->isWritable($key)) {
$this->$key = $value;
}
}
return $this;
} | php | public function setWritableValues(array $values)
{
foreach ($values as $key => $value) {
if ($this->isWritable($key)) {
$this->$key = $value;
}
}
return $this;
} | [
"public",
"function",
"setWritableValues",
"(",
"array",
"$",
"values",
")",
"{",
"foreach",
"(",
"$",
"values",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isWritable",
"(",
"$",
"key",
")",
")",
"{",
"$",
"this"... | Iterates through the passed value array and sets the values for fields, that are writable by the user
@param array $values The values (key must be the field name)
@return $this | [
"Iterates",
"through",
"the",
"passed",
"value",
"array",
"and",
"sets",
"the",
"values",
"for",
"fields",
"that",
"are",
"writable",
"by",
"the",
"user"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form.php#L663-L672 |
222,093 | symlex/input-validation | src/Form.php | Form.getValuesByPage | public function getValuesByPage(): array
{
$result = array();
foreach ($this->_definition as $key => $value) {
$page = $this->getFieldProperty($key, 'page');
if ($page) {
$result[$page][$key] = $this->$key;
}
}
return $result;
... | php | public function getValuesByPage(): array
{
$result = array();
foreach ($this->_definition as $key => $value) {
$page = $this->getFieldProperty($key, 'page');
if ($page) {
$result[$page][$key] = $this->$key;
}
}
return $result;
... | [
"public",
"function",
"getValuesByPage",
"(",
")",
":",
"array",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_definition",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"page",
"=",
"$",
"this",
"->",... | Returns the form values for all elements grouped by page
@return array | [
"Returns",
"the",
"form",
"values",
"for",
"all",
"elements",
"grouped",
"by",
"page"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form.php#L731-L744 |
222,094 | symlex/input-validation | src/Form.php | Form.getValuesByTag | public function getValuesByTag(string $tag): array
{
$result = array();
foreach ($this->_definition as $key => $value) {
$tags = $this->getFieldProperty($key, 'tags');
if (is_array($tags) && in_array($tag, $tags)) {
$result[$key] = $this->$key;
}... | php | public function getValuesByTag(string $tag): array
{
$result = array();
foreach ($this->_definition as $key => $value) {
$tags = $this->getFieldProperty($key, 'tags');
if (is_array($tags) && in_array($tag, $tags)) {
$result[$key] = $this->$key;
}... | [
"public",
"function",
"getValuesByTag",
"(",
"string",
"$",
"tag",
")",
":",
"array",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_definition",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"tags",
"=... | Returns the form values for all elements by tag
@return array | [
"Returns",
"the",
"form",
"values",
"for",
"all",
"elements",
"by",
"tag"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form.php#L751-L764 |
222,095 | symlex/input-validation | src/Form.php | Form.getValues | public function getValues(): array
{
$result = array();
foreach ($this->_definition as $key => $value) {
$result[$key] = $this->$key;
}
return $result;
} | php | public function getValues(): array
{
$result = array();
foreach ($this->_definition as $key => $value) {
$result[$key] = $this->$key;
}
return $result;
} | [
"public",
"function",
"getValues",
"(",
")",
":",
"array",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_definition",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"result",
"[",
"$",
"key",
"]",
"="... | Returns all form field values
@return array | [
"Returns",
"all",
"form",
"field",
"values"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form.php#L771-L780 |
222,096 | symlex/input-validation | src/Form.php | Form.getWritableValues | public function getWritableValues(): array
{
$result = array();
foreach ($this->_definition as $key => $value) {
if ($this->isWritable($key)) {
$result[$key] = $this->$key;
}
}
return $result;
} | php | public function getWritableValues(): array
{
$result = array();
foreach ($this->_definition as $key => $value) {
if ($this->isWritable($key)) {
$result[$key] = $this->$key;
}
}
return $result;
} | [
"public",
"function",
"getWritableValues",
"(",
")",
":",
"array",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_definition",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isW... | Returns all writable form field values
@return array | [
"Returns",
"all",
"writable",
"form",
"field",
"values"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form.php#L787-L798 |
222,097 | symlex/input-validation | src/Form.php | Form.getFieldCaption | public function getFieldCaption(string $name): string
{
$caption = $this->getFieldProperty($name, 'caption');
if ($caption) {
return $this->translate($caption);
}
return $name;
} | php | public function getFieldCaption(string $name): string
{
$caption = $this->getFieldProperty($name, 'caption');
if ($caption) {
return $this->translate($caption);
}
return $name;
} | [
"public",
"function",
"getFieldCaption",
"(",
"string",
"$",
"name",
")",
":",
"string",
"{",
"$",
"caption",
"=",
"$",
"this",
"->",
"getFieldProperty",
"(",
"$",
"name",
",",
"'caption'",
")",
";",
"if",
"(",
"$",
"caption",
")",
"{",
"return",
"$",
... | Returns a translated field caption
@param string $name The field name
@return string | [
"Returns",
"a",
"translated",
"field",
"caption"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form.php#L935-L944 |
222,098 | symlex/input-validation | src/Form.php | Form.getFirstError | public function getFirstError(): string
{
$result = '';
$errors = $this->getErrors();
$firstField = reset($errors);
if ($firstField && isset($firstField[0])) {
$result = $firstField[0];
}
return $result;
} | php | public function getFirstError(): string
{
$result = '';
$errors = $this->getErrors();
$firstField = reset($errors);
if ($firstField && isset($firstField[0])) {
$result = $firstField[0];
}
return $result;
} | [
"public",
"function",
"getFirstError",
"(",
")",
":",
"string",
"{",
"$",
"result",
"=",
"''",
";",
"$",
"errors",
"=",
"$",
"this",
"->",
"getErrors",
"(",
")",
";",
"$",
"firstField",
"=",
"reset",
"(",
"$",
"errors",
")",
";",
"if",
"(",
"$",
... | Returns the first error as string
@return string | [
"Returns",
"the",
"first",
"error",
"as",
"string"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form.php#L1031-L1042 |
222,099 | symlex/input-validation | src/Form.php | Form.getErrorsAsText | public function getErrorsAsText(): string
{
$result = '';
$fieldCounter = 0;
$fields = $this->getErrors();
foreach ($fields as $fieldName => $fieldErrors) {
$fieldCounter++;
$result .= "$fieldCounter) $fieldName\n";
foreach ($fieldErrors as $erro... | php | public function getErrorsAsText(): string
{
$result = '';
$fieldCounter = 0;
$fields = $this->getErrors();
foreach ($fields as $fieldName => $fieldErrors) {
$fieldCounter++;
$result .= "$fieldCounter) $fieldName\n";
foreach ($fieldErrors as $erro... | [
"public",
"function",
"getErrorsAsText",
"(",
")",
":",
"string",
"{",
"$",
"result",
"=",
"''",
";",
"$",
"fieldCounter",
"=",
"0",
";",
"$",
"fields",
"=",
"$",
"this",
"->",
"getErrors",
"(",
")",
";",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"... | Returns all errors as indented text
@return string | [
"Returns",
"all",
"errors",
"as",
"indented",
"text"
] | a5f20c417d23eafd6be7acf9bad39bcbed24e9ff | https://github.com/symlex/input-validation/blob/a5f20c417d23eafd6be7acf9bad39bcbed24e9ff/src/Form.php#L1049-L1065 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.