repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
contributte/datagrid | src/Column/ColumnStatus.php | ColumnStatus.getCurrentOption | public function getCurrentOption(Row $row)
{
foreach ($this->getOptions() as $option) {
if ($option->getValue() == $row->getValue($this->getColumn())) {
return $option;
}
}
return null;
} | php | public function getCurrentOption(Row $row)
{
foreach ($this->getOptions() as $option) {
if ($option->getValue() == $row->getValue($this->getColumn())) {
return $option;
}
}
return null;
} | [
"public",
"function",
"getCurrentOption",
"(",
"Row",
"$",
"row",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getOptions",
"(",
")",
"as",
"$",
"option",
")",
"{",
"if",
"(",
"$",
"option",
"->",
"getValue",
"(",
")",
"==",
"$",
"row",
"->",
"get... | Find selected option for current item/row
@param Row $row
@return Option|NULL | [
"Find",
"selected",
"option",
"for",
"current",
"item",
"/",
"row"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/Column/ColumnStatus.php#L103-L112 |
contributte/datagrid | src/Column/ColumnStatus.php | ColumnStatus.addOption | public function addOption($value, $text)
{
if (!is_scalar($value)) {
throw new DataGridColumnStatusException('Option value has to be scalar');
}
$option = new Option($this, $value, $text);
$this->options[] = $option;
return $option;
} | php | public function addOption($value, $text)
{
if (!is_scalar($value)) {
throw new DataGridColumnStatusException('Option value has to be scalar');
}
$option = new Option($this, $value, $text);
$this->options[] = $option;
return $option;
} | [
"public",
"function",
"addOption",
"(",
"$",
"value",
",",
"$",
"text",
")",
"{",
"if",
"(",
"!",
"is_scalar",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"DataGridColumnStatusException",
"(",
"'Option value has to be scalar'",
")",
";",
"}",
"$",
"o... | Add option to status select
@param mixed $value
@param string $text
@return Option
@throws DataGridColumnStatusException | [
"Add",
"option",
"to",
"status",
"select"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/Column/ColumnStatus.php#L122-L133 |
contributte/datagrid | src/Column/ColumnStatus.php | ColumnStatus.setOptions | public function setOptions(array $options)
{
foreach ($options as $value => $text) {
$this->addOption($value, $text);
}
return $this;
} | php | public function setOptions(array $options)
{
foreach ($options as $value => $text) {
$this->addOption($value, $text);
}
return $this;
} | [
"public",
"function",
"setOptions",
"(",
"array",
"$",
"options",
")",
"{",
"foreach",
"(",
"$",
"options",
"as",
"$",
"value",
"=>",
"$",
"text",
")",
"{",
"$",
"this",
"->",
"addOption",
"(",
"$",
"value",
",",
"$",
"text",
")",
";",
"}",
"return... | Set all options at once
@param array $options
@return static | [
"Set",
"all",
"options",
"at",
"once"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/Column/ColumnStatus.php#L141-L148 |
contributte/datagrid | src/Column/ColumnStatus.php | ColumnStatus.getTemplateVariables | public function getTemplateVariables()
{
return array_merge($this->template_variables, [
'options' => $this->getOptions(),
'column' => $this->getColumn(),
'key' => $this->getKey(),
'status' => $this,
]);
} | php | public function getTemplateVariables()
{
return array_merge($this->template_variables, [
'options' => $this->getOptions(),
'column' => $this->getColumn(),
'key' => $this->getKey(),
'status' => $this,
]);
} | [
"public",
"function",
"getTemplateVariables",
"(",
")",
"{",
"return",
"array_merge",
"(",
"$",
"this",
"->",
"template_variables",
",",
"[",
"'options'",
"=>",
"$",
"this",
"->",
"getOptions",
"(",
")",
",",
"'column'",
"=>",
"$",
"this",
"->",
"getColumn",... | Column can have variables that will be passed to custom template scope
@return array | [
"Column",
"can",
"have",
"variables",
"that",
"will",
"be",
"passed",
"to",
"custom",
"template",
"scope"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/Column/ColumnStatus.php#L169-L177 |
contributte/datagrid | src/GroupAction/GroupActionCollection.php | GroupActionCollection.addToFormContainer | public function addToFormContainer($container)
{
/** @var Nette\Application\UI\Form $form */
$form = $container->lookup('Nette\Application\UI\Form');
$translator = $form->getTranslator();
$main_options = [];
/**
* First foreach for filling "main" select
*/
foreach ($this->group_actions as $id => $ac... | php | public function addToFormContainer($container)
{
/** @var Nette\Application\UI\Form $form */
$form = $container->lookup('Nette\Application\UI\Form');
$translator = $form->getTranslator();
$main_options = [];
/**
* First foreach for filling "main" select
*/
foreach ($this->group_actions as $id => $ac... | [
"public",
"function",
"addToFormContainer",
"(",
"$",
"container",
")",
"{",
"/** @var Nette\\Application\\UI\\Form $form */",
"$",
"form",
"=",
"$",
"container",
"->",
"lookup",
"(",
"'Nette\\Application\\UI\\Form'",
")",
";",
"$",
"translator",
"=",
"$",
"form",
"... | Get assambled form
@param Nette\Forms\Container $container
@return void | [
"Get",
"assambled",
"form"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/GroupAction/GroupActionCollection.php#L46-L131 |
contributte/datagrid | src/GroupAction/GroupActionCollection.php | GroupActionCollection.submitted | public function submitted(Form $form)
{
if (!isset($form['group_action']['submit']) || !$form['group_action']['submit']->isSubmittedBy()) {
return;
}
$values = $form->getValues();
$values = $values['group_action'];
if ($values->group_action === 0 || $values->group_action === null) {
return;
}
/*... | php | public function submitted(Form $form)
{
if (!isset($form['group_action']['submit']) || !$form['group_action']['submit']->isSubmittedBy()) {
return;
}
$values = $form->getValues();
$values = $values['group_action'];
if ($values->group_action === 0 || $values->group_action === null) {
return;
}
/*... | [
"public",
"function",
"submitted",
"(",
"Form",
"$",
"form",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"form",
"[",
"'group_action'",
"]",
"[",
"'submit'",
"]",
")",
"||",
"!",
"$",
"form",
"[",
"'group_action'",
"]",
"[",
"'submit'",
"]",
"->",
... | Pass "sub"-form submission forward to custom submit function
@param Form $form
@return void | [
"Pass",
"sub",
"-",
"form",
"submission",
"forward",
"to",
"custom",
"submit",
"function"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/GroupAction/GroupActionCollection.php#L139-L162 |
contributte/datagrid | src/GroupAction/GroupActionCollection.php | GroupActionCollection.addGroupSelectAction | public function addGroupSelectAction($title, $options)
{
$id = ($s = sizeof($this->group_actions)) ? ($s + 1) : 1;
return $this->group_actions[$id] = new GroupSelectAction($title, $options);
} | php | public function addGroupSelectAction($title, $options)
{
$id = ($s = sizeof($this->group_actions)) ? ($s + 1) : 1;
return $this->group_actions[$id] = new GroupSelectAction($title, $options);
} | [
"public",
"function",
"addGroupSelectAction",
"(",
"$",
"title",
",",
"$",
"options",
")",
"{",
"$",
"id",
"=",
"(",
"$",
"s",
"=",
"sizeof",
"(",
"$",
"this",
"->",
"group_actions",
")",
")",
"?",
"(",
"$",
"s",
"+",
"1",
")",
":",
"1",
";",
"... | Add one group action (select box) to collection of actions
@param string $title
@param array $options
@return GroupAction | [
"Add",
"one",
"group",
"action",
"(",
"select",
"box",
")",
"to",
"collection",
"of",
"actions"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/GroupAction/GroupActionCollection.php#L173-L178 |
contributte/datagrid | src/GroupAction/GroupActionCollection.php | GroupActionCollection.addGroupMultiSelectAction | public function addGroupMultiSelectAction($title, $options)
{
$id = ($s = sizeof($this->group_actions)) ? ($s + 1) : 1;
return $this->group_actions[$id] = new GroupMultiSelectAction($title, $options);
} | php | public function addGroupMultiSelectAction($title, $options)
{
$id = ($s = sizeof($this->group_actions)) ? ($s + 1) : 1;
return $this->group_actions[$id] = new GroupMultiSelectAction($title, $options);
} | [
"public",
"function",
"addGroupMultiSelectAction",
"(",
"$",
"title",
",",
"$",
"options",
")",
"{",
"$",
"id",
"=",
"(",
"$",
"s",
"=",
"sizeof",
"(",
"$",
"this",
"->",
"group_actions",
")",
")",
"?",
"(",
"$",
"s",
"+",
"1",
")",
":",
"1",
";"... | Add one group action (multiselect box) to collection of actions
@param string $title
@param array $options
@return GroupAction | [
"Add",
"one",
"group",
"action",
"(",
"multiselect",
"box",
")",
"to",
"collection",
"of",
"actions"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/GroupAction/GroupActionCollection.php#L189-L194 |
contributte/datagrid | src/GroupAction/GroupActionCollection.php | GroupActionCollection.addGroupTextAction | public function addGroupTextAction($title)
{
$id = ($s = sizeof($this->group_actions)) ? ($s + 1) : 1;
return $this->group_actions[$id] = new GroupTextAction($title);
} | php | public function addGroupTextAction($title)
{
$id = ($s = sizeof($this->group_actions)) ? ($s + 1) : 1;
return $this->group_actions[$id] = new GroupTextAction($title);
} | [
"public",
"function",
"addGroupTextAction",
"(",
"$",
"title",
")",
"{",
"$",
"id",
"=",
"(",
"$",
"s",
"=",
"sizeof",
"(",
"$",
"this",
"->",
"group_actions",
")",
")",
"?",
"(",
"$",
"s",
"+",
"1",
")",
":",
"1",
";",
"return",
"$",
"this",
"... | Add one group action (text input) to collection of actions
@param string $title
@return GroupAction | [
"Add",
"one",
"group",
"action",
"(",
"text",
"input",
")",
"to",
"collection",
"of",
"actions"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/GroupAction/GroupActionCollection.php#L204-L209 |
contributte/datagrid | src/GroupAction/GroupActionCollection.php | GroupActionCollection.addGroupTextareaAction | public function addGroupTextareaAction($title)
{
$id = ($s = sizeof($this->group_actions)) ? ($s + 1) : 1;
return $this->group_actions[$id] = new GroupTextareaAction($title);
} | php | public function addGroupTextareaAction($title)
{
$id = ($s = sizeof($this->group_actions)) ? ($s + 1) : 1;
return $this->group_actions[$id] = new GroupTextareaAction($title);
} | [
"public",
"function",
"addGroupTextareaAction",
"(",
"$",
"title",
")",
"{",
"$",
"id",
"=",
"(",
"$",
"s",
"=",
"sizeof",
"(",
"$",
"this",
"->",
"group_actions",
")",
")",
"?",
"(",
"$",
"s",
"+",
"1",
")",
":",
"1",
";",
"return",
"$",
"this",... | Add one group action (textarea) to collection of actions
@param string $title
@return GroupAction | [
"Add",
"one",
"group",
"action",
"(",
"textarea",
")",
"to",
"collection",
"of",
"actions"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/GroupAction/GroupActionCollection.php#L219-L224 |
contributte/datagrid | src/Components/DataGridPaginator/DataGridPaginator.php | DataGridPaginator.render | public function render()
{
$paginator = $this->getPaginator();
$page = $paginator->page;
if ($paginator->pageCount < 2) {
$steps = [$page];
} else {
$arr = range(max($paginator->firstPage, $page - 2), min($paginator->lastPage, $page + 2));
/**
* Something to do with steps in tempale...
* [D... | php | public function render()
{
$paginator = $this->getPaginator();
$page = $paginator->page;
if ($paginator->pageCount < 2) {
$steps = [$page];
} else {
$arr = range(max($paginator->firstPage, $page - 2), min($paginator->lastPage, $page + 2));
/**
* Something to do with steps in tempale...
* [D... | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"paginator",
"=",
"$",
"this",
"->",
"getPaginator",
"(",
")",
";",
"$",
"page",
"=",
"$",
"paginator",
"->",
"page",
";",
"if",
"(",
"$",
"paginator",
"->",
"pageCount",
"<",
"2",
")",
"{",
"$",
... | Renders paginator.
@return void | [
"Renders",
"paginator",
"."
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/Components/DataGridPaginator/DataGridPaginator.php#L105-L147 |
contributte/datagrid | src/Components/DataGridPaginator/DataGridPaginator.php | DataGridPaginator.loadState | public function loadState(array $params)
{
parent::loadState($params);
if ($this->getParent() instanceof DataGrid) {
$this->getPaginator()->page = $this->getParent()->page;
}
} | php | public function loadState(array $params)
{
parent::loadState($params);
if ($this->getParent() instanceof DataGrid) {
$this->getPaginator()->page = $this->getParent()->page;
}
} | [
"public",
"function",
"loadState",
"(",
"array",
"$",
"params",
")",
"{",
"parent",
"::",
"loadState",
"(",
"$",
"params",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getParent",
"(",
")",
"instanceof",
"DataGrid",
")",
"{",
"$",
"this",
"->",
"getPaginat... | Loads state informations.
@param array
@return void | [
"Loads",
"state",
"informations",
"."
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/Components/DataGridPaginator/DataGridPaginator.php#L155-L162 |
contributte/datagrid | src/InlineEdit/InlineEdit.php | InlineEdit.renderButton | public function renderButton($row)
{
$a = Html::el('a')
->href($this->grid->link('inlineEdit!', ['id' => $row->getId()]));
$this->tryAddIcon($a, $this->getIcon(), $this->getText());
$a->addText($this->text);
if ($this->title) {
$a->title($this->grid->getTranslator()->translate($this->title));
}
if... | php | public function renderButton($row)
{
$a = Html::el('a')
->href($this->grid->link('inlineEdit!', ['id' => $row->getId()]));
$this->tryAddIcon($a, $this->getIcon(), $this->getText());
$a->addText($this->text);
if ($this->title) {
$a->title($this->grid->getTranslator()->translate($this->title));
}
if... | [
"public",
"function",
"renderButton",
"(",
"$",
"row",
")",
"{",
"$",
"a",
"=",
"Html",
"::",
"el",
"(",
"'a'",
")",
"->",
"href",
"(",
"$",
"this",
"->",
"grid",
"->",
"link",
"(",
"'inlineEdit!'",
",",
"[",
"'id'",
"=>",
"$",
"row",
"->",
"getI... | Render row item detail button
@param Row $row
@return Html | [
"Render",
"row",
"item",
"detail",
"button"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/InlineEdit/InlineEdit.php#L140-L159 |
contributte/datagrid | src/InlineEdit/InlineEdit.php | InlineEdit.renderButtonAdd | public function renderButtonAdd()
{
$a = Html::el('a')->href('')->data('datagrid-toggle-inline-add', true);
$this->tryAddIcon($a, $this->getIcon(), $this->getText());
$a->addText($this->text);
if ($this->title) {
$a->title($this->grid->getTranslator()->translate($this->title));
}
if ($this->class) {
... | php | public function renderButtonAdd()
{
$a = Html::el('a')->href('')->data('datagrid-toggle-inline-add', true);
$this->tryAddIcon($a, $this->getIcon(), $this->getText());
$a->addText($this->text);
if ($this->title) {
$a->title($this->grid->getTranslator()->translate($this->title));
}
if ($this->class) {
... | [
"public",
"function",
"renderButtonAdd",
"(",
")",
"{",
"$",
"a",
"=",
"Html",
"::",
"el",
"(",
"'a'",
")",
"->",
"href",
"(",
"''",
")",
"->",
"data",
"(",
"'datagrid-toggle-inline-add'",
",",
"true",
")",
";",
"$",
"this",
"->",
"tryAddIcon",
"(",
... | Render row item detail button
@return Html | [
"Render",
"row",
"item",
"detail",
"button"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/InlineEdit/InlineEdit.php#L166-L182 |
contributte/datagrid | src/DataSource/NextrasDataSource.php | NextrasDataSource.filterOne | public function filterOne(array $condition)
{
$cond = [];
foreach ($condition as $key => $value) {
$cond[$this->prepareColumn($key)] = $value;
}
$this->data_source = $this->data_source->findBy($cond);
return $this;
} | php | public function filterOne(array $condition)
{
$cond = [];
foreach ($condition as $key => $value) {
$cond[$this->prepareColumn($key)] = $value;
}
$this->data_source = $this->data_source->findBy($cond);
return $this;
} | [
"public",
"function",
"filterOne",
"(",
"array",
"$",
"condition",
")",
"{",
"$",
"cond",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"condition",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"cond",
"[",
"$",
"this",
"->",
"prepareColumn",
"(... | Filter data - get one row
@param array $condition
@return static | [
"Filter",
"data",
"-",
"get",
"one",
"row"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataSource/NextrasDataSource.php#L83-L92 |
contributte/datagrid | src/DataSource/NextrasDataSource.php | NextrasDataSource.applyFilterDate | public function applyFilterDate(Filter\FilterDate $filter)
{
foreach ($filter->getCondition() as $column => $value) {
try {
$date = DateTimeHelper::tryConvertToDateTime($value, [$filter->getPhpFormat()]);
$date_end = clone $date;
$this->data_source = $this->data_source->findBy([
$this->prepareCo... | php | public function applyFilterDate(Filter\FilterDate $filter)
{
foreach ($filter->getCondition() as $column => $value) {
try {
$date = DateTimeHelper::tryConvertToDateTime($value, [$filter->getPhpFormat()]);
$date_end = clone $date;
$this->data_source = $this->data_source->findBy([
$this->prepareCo... | [
"public",
"function",
"applyFilterDate",
"(",
"Filter",
"\\",
"FilterDate",
"$",
"filter",
")",
"{",
"foreach",
"(",
"$",
"filter",
"->",
"getCondition",
"(",
")",
"as",
"$",
"column",
"=>",
"$",
"value",
")",
"{",
"try",
"{",
"$",
"date",
"=",
"DateTi... | Filter by date
@param Filter\FilterDate $filter
@return static | [
"Filter",
"by",
"date"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataSource/NextrasDataSource.php#L100-L117 |
contributte/datagrid | src/DataSource/NextrasDataSource.php | NextrasDataSource.applyFilterDateRange | public function applyFilterDateRange(Filter\FilterDateRange $filter)
{
$conditions = $filter->getCondition();
$value_from = $conditions[$filter->getColumn()]['from'];
$value_to = $conditions[$filter->getColumn()]['to'];
$dataCondition = [];
if ($value_from) {
try {
$date_from = DateTimeHelper::tryCo... | php | public function applyFilterDateRange(Filter\FilterDateRange $filter)
{
$conditions = $filter->getCondition();
$value_from = $conditions[$filter->getColumn()]['from'];
$value_to = $conditions[$filter->getColumn()]['to'];
$dataCondition = [];
if ($value_from) {
try {
$date_from = DateTimeHelper::tryCo... | [
"public",
"function",
"applyFilterDateRange",
"(",
"Filter",
"\\",
"FilterDateRange",
"$",
"filter",
")",
"{",
"$",
"conditions",
"=",
"$",
"filter",
"->",
"getCondition",
"(",
")",
";",
"$",
"value_from",
"=",
"$",
"conditions",
"[",
"$",
"filter",
"->",
... | Filter by date range
@param Filter\FilterDateRange $filter
@return void | [
"Filter",
"by",
"date",
"range"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataSource/NextrasDataSource.php#L125-L154 |
contributte/datagrid | src/DataSource/NextrasDataSource.php | NextrasDataSource.applyFilterRange | public function applyFilterRange(Filter\FilterRange $filter)
{
$conditions = $filter->getCondition();
$value_from = $conditions[$filter->getColumn()]['from'];
$value_to = $conditions[$filter->getColumn()]['to'];
$dataCondition = [];
if ($value_from) {
$dataCondition[$this->prepareColumn($filter->getCol... | php | public function applyFilterRange(Filter\FilterRange $filter)
{
$conditions = $filter->getCondition();
$value_from = $conditions[$filter->getColumn()]['from'];
$value_to = $conditions[$filter->getColumn()]['to'];
$dataCondition = [];
if ($value_from) {
$dataCondition[$this->prepareColumn($filter->getCol... | [
"public",
"function",
"applyFilterRange",
"(",
"Filter",
"\\",
"FilterRange",
"$",
"filter",
")",
"{",
"$",
"conditions",
"=",
"$",
"filter",
"->",
"getCondition",
"(",
")",
";",
"$",
"value_from",
"=",
"$",
"conditions",
"[",
"$",
"filter",
"->",
"getColu... | Filter by range
@param Filter\FilterRange $filter
@return void | [
"Filter",
"by",
"range"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataSource/NextrasDataSource.php#L162-L182 |
contributte/datagrid | src/DataSource/NextrasDataSource.php | NextrasDataSource.applyFilterText | public function applyFilterText(Filter\FilterText $filter)
{
$condition = $filter->getCondition();
$expr = '(';
$params = [];
foreach ($condition as $column => $value) {
if ($filter->isExactSearch()) {
$expr .= '%column = %s OR ';
$params[] = $column;
$params[] = "$value";
continue;
}
... | php | public function applyFilterText(Filter\FilterText $filter)
{
$condition = $filter->getCondition();
$expr = '(';
$params = [];
foreach ($condition as $column => $value) {
if ($filter->isExactSearch()) {
$expr .= '%column = %s OR ';
$params[] = $column;
$params[] = "$value";
continue;
}
... | [
"public",
"function",
"applyFilterText",
"(",
"Filter",
"\\",
"FilterText",
"$",
"filter",
")",
"{",
"$",
"condition",
"=",
"$",
"filter",
"->",
"getCondition",
"(",
")",
";",
"$",
"expr",
"=",
"'('",
";",
"$",
"params",
"=",
"[",
"]",
";",
"foreach",
... | Filter by keyword
@param Filter\FilterText $filter
@return void | [
"Filter",
"by",
"keyword"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataSource/NextrasDataSource.php#L190-L222 |
contributte/datagrid | src/DataSource/NextrasDataSource.php | NextrasDataSource.applyFilterMultiSelect | public function applyFilterMultiSelect(Filter\FilterMultiSelect $filter)
{
$this->data_source = $this->data_source->findBy([$this->prepareColumn($filter->getColumn()) => $filter->getValue()]);
} | php | public function applyFilterMultiSelect(Filter\FilterMultiSelect $filter)
{
$this->data_source = $this->data_source->findBy([$this->prepareColumn($filter->getColumn()) => $filter->getValue()]);
} | [
"public",
"function",
"applyFilterMultiSelect",
"(",
"Filter",
"\\",
"FilterMultiSelect",
"$",
"filter",
")",
"{",
"$",
"this",
"->",
"data_source",
"=",
"$",
"this",
"->",
"data_source",
"->",
"findBy",
"(",
"[",
"$",
"this",
"->",
"prepareColumn",
"(",
"$"... | Filter by multi select value
@param Filter\FilterMultiSelect $filter
@return void | [
"Filter",
"by",
"multi",
"select",
"value"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataSource/NextrasDataSource.php#L230-L233 |
contributte/datagrid | src/DataSource/NextrasDataSource.php | NextrasDataSource.applyFilterSelect | public function applyFilterSelect(Filter\FilterSelect $filter)
{
$this->data_source = $this->data_source->findBy([$this->prepareColumn($filter->getColumn()) => $filter->getValue()]);
} | php | public function applyFilterSelect(Filter\FilterSelect $filter)
{
$this->data_source = $this->data_source->findBy([$this->prepareColumn($filter->getColumn()) => $filter->getValue()]);
} | [
"public",
"function",
"applyFilterSelect",
"(",
"Filter",
"\\",
"FilterSelect",
"$",
"filter",
")",
"{",
"$",
"this",
"->",
"data_source",
"=",
"$",
"this",
"->",
"data_source",
"->",
"findBy",
"(",
"[",
"$",
"this",
"->",
"prepareColumn",
"(",
"$",
"filte... | Filter by select value
@param Filter\FilterSelect $filter
@return void | [
"Filter",
"by",
"select",
"value"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataSource/NextrasDataSource.php#L241-L244 |
contributte/datagrid | src/DataSource/NextrasDataSource.php | NextrasDataSource.limit | public function limit($offset, $limit)
{
$this->data_source = $this->data_source->limitBy($limit, $offset);
return $this;
} | php | public function limit($offset, $limit)
{
$this->data_source = $this->data_source->limitBy($limit, $offset);
return $this;
} | [
"public",
"function",
"limit",
"(",
"$",
"offset",
",",
"$",
"limit",
")",
"{",
"$",
"this",
"->",
"data_source",
"=",
"$",
"this",
"->",
"data_source",
"->",
"limitBy",
"(",
"$",
"limit",
",",
"$",
"offset",
")",
";",
"return",
"$",
"this",
";",
"... | Apply limit and offset on data
@param int $offset
@param int $limit
@return static | [
"Apply",
"limit",
"and",
"offset",
"on",
"data"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataSource/NextrasDataSource.php#L253-L258 |
contributte/datagrid | src/DataSource/NextrasDataSource.php | NextrasDataSource.sort | public function sort(Sorting $sorting)
{
if (is_callable($sorting->getSortCallback())) {
call_user_func(
$sorting->getSortCallback(),
$this->data_source,
$sorting->getSort()
);
return $this;
}
$sort = $sorting->getSort();
if (!empty($sort)) {
foreach ($sort as $column => $order) {
... | php | public function sort(Sorting $sorting)
{
if (is_callable($sorting->getSortCallback())) {
call_user_func(
$sorting->getSortCallback(),
$this->data_source,
$sorting->getSort()
);
return $this;
}
$sort = $sorting->getSort();
if (!empty($sort)) {
foreach ($sort as $column => $order) {
... | [
"public",
"function",
"sort",
"(",
"Sorting",
"$",
"sorting",
")",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"sorting",
"->",
"getSortCallback",
"(",
")",
")",
")",
"{",
"call_user_func",
"(",
"$",
"sorting",
"->",
"getSortCallback",
"(",
")",
",",
"$",
... | Sort data
@param Sorting $sorting
@return static | [
"Sort",
"data"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataSource/NextrasDataSource.php#L266-L296 |
contributte/datagrid | src/DataSource/ArrayDataSource.php | ArrayDataSource.filter | public function filter(array $filters)
{
foreach ($filters as $filter) {
if ($filter->isValueSet()) {
if ($filter->hasConditionCallback()) {
$data = (array) call_user_func_array(
$filter->getConditionCallback(),
[$this->data, $filter->getValue()]
);
$this->setData($data);
} else... | php | public function filter(array $filters)
{
foreach ($filters as $filter) {
if ($filter->isValueSet()) {
if ($filter->hasConditionCallback()) {
$data = (array) call_user_func_array(
$filter->getConditionCallback(),
[$this->data, $filter->getValue()]
);
$this->setData($data);
} else... | [
"public",
"function",
"filter",
"(",
"array",
"$",
"filters",
")",
"{",
"foreach",
"(",
"$",
"filters",
"as",
"$",
"filter",
")",
"{",
"if",
"(",
"$",
"filter",
"->",
"isValueSet",
"(",
")",
")",
"{",
"if",
"(",
"$",
"filter",
"->",
"hasConditionCall... | Filter data
@param Filter[] $filters
@return static | [
"Filter",
"data"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataSource/ArrayDataSource.php#L89-L109 |
contributte/datagrid | src/DataSource/ArrayDataSource.php | ArrayDataSource.filterOne | public function filterOne(array $condition)
{
foreach ($this->data as $item) {
foreach ($condition as $key => $value) {
if ($item[$key] == $value) {
$this->setData([$item]);
return $this;
}
}
}
$this->setData([]);
return $this;
} | php | public function filterOne(array $condition)
{
foreach ($this->data as $item) {
foreach ($condition as $key => $value) {
if ($item[$key] == $value) {
$this->setData([$item]);
return $this;
}
}
}
$this->setData([]);
return $this;
} | [
"public",
"function",
"filterOne",
"(",
"array",
"$",
"condition",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"item",
")",
"{",
"foreach",
"(",
"$",
"condition",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
... | Filter data - get one row
@param array $condition
@return ArrayDataSource | [
"Filter",
"data",
"-",
"get",
"one",
"row"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataSource/ArrayDataSource.php#L117-L132 |
contributte/datagrid | src/DataSource/ArrayDataSource.php | ArrayDataSource.limit | public function limit($offset, $limit)
{
$data = array_slice($this->data, $offset, $limit);
$this->setData($data);
return $this;
} | php | public function limit($offset, $limit)
{
$data = array_slice($this->data, $offset, $limit);
$this->setData($data);
return $this;
} | [
"public",
"function",
"limit",
"(",
"$",
"offset",
",",
"$",
"limit",
")",
"{",
"$",
"data",
"=",
"array_slice",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"offset",
",",
"$",
"limit",
")",
";",
"$",
"this",
"->",
"setData",
"(",
"$",
"data",
")",... | Apply limit and offset on data
@param int $offset
@param int $limit
@return static | [
"Apply",
"limit",
"and",
"offset",
"on",
"data"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataSource/ArrayDataSource.php#L141-L147 |
contributte/datagrid | src/DataSource/ArrayDataSource.php | ArrayDataSource.applyFilter | protected function applyFilter($row, Filter $filter)
{
if (is_array($row) || $row instanceof \Traversable) {
if ($filter instanceof FilterDate) {
return $this->applyFilterDate($row, $filter);
} elseif ($filter instanceof FilterMultiSelect) {
return $this->applyFilterMultiSelect($row, $filter);
} els... | php | protected function applyFilter($row, Filter $filter)
{
if (is_array($row) || $row instanceof \Traversable) {
if ($filter instanceof FilterDate) {
return $this->applyFilterDate($row, $filter);
} elseif ($filter instanceof FilterMultiSelect) {
return $this->applyFilterMultiSelect($row, $filter);
} els... | [
"protected",
"function",
"applyFilter",
"(",
"$",
"row",
",",
"Filter",
"$",
"filter",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"row",
")",
"||",
"$",
"row",
"instanceof",
"\\",
"Traversable",
")",
"{",
"if",
"(",
"$",
"filter",
"instanceof",
"Filter... | Apply fitler and tell whether row passes conditions or not
@param mixed $row
@param Filter $filter
@return mixed | [
"Apply",
"fitler",
"and",
"tell",
"whether",
"row",
"passes",
"conditions",
"or",
"not"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataSource/ArrayDataSource.php#L156-L193 |
contributte/datagrid | src/DataSource/ArrayDataSource.php | ArrayDataSource.applyFilterMultiSelect | public function applyFilterMultiSelect($row, FilterMultiSelect $filter)
{
$condition = $filter->getCondition();
$values = $condition[$filter->getColumn()];
return in_array($row[$filter->getColumn()], $values, true);
} | php | public function applyFilterMultiSelect($row, FilterMultiSelect $filter)
{
$condition = $filter->getCondition();
$values = $condition[$filter->getColumn()];
return in_array($row[$filter->getColumn()], $values, true);
} | [
"public",
"function",
"applyFilterMultiSelect",
"(",
"$",
"row",
",",
"FilterMultiSelect",
"$",
"filter",
")",
"{",
"$",
"condition",
"=",
"$",
"filter",
"->",
"getCondition",
"(",
")",
";",
"$",
"values",
"=",
"$",
"condition",
"[",
"$",
"filter",
"->",
... | Filter by multi select value
@param mixed $row
@param FilterMultiSelect $filter
@return void | [
"Filter",
"by",
"multi",
"select",
"value"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataSource/ArrayDataSource.php#L202-L208 |
contributte/datagrid | src/DataSource/ArrayDataSource.php | ArrayDataSource.applyFilterDate | protected function applyFilterDate($row, FilterDate $filter)
{
$format = $filter->getPhpFormat();
$condition = $filter->getCondition();
foreach ($condition as $column => $value) {
$row_value = $row[$column];
$date = DateTimeHelper::tryConvertToDateTime($value, [$format]);
if (!($row_value instanceof ... | php | protected function applyFilterDate($row, FilterDate $filter)
{
$format = $filter->getPhpFormat();
$condition = $filter->getCondition();
foreach ($condition as $column => $value) {
$row_value = $row[$column];
$date = DateTimeHelper::tryConvertToDateTime($value, [$format]);
if (!($row_value instanceof ... | [
"protected",
"function",
"applyFilterDate",
"(",
"$",
"row",
",",
"FilterDate",
"$",
"filter",
")",
"{",
"$",
"format",
"=",
"$",
"filter",
"->",
"getPhpFormat",
"(",
")",
";",
"$",
"condition",
"=",
"$",
"filter",
"->",
"getCondition",
"(",
")",
";",
... | Apply fitler date and tell whether row value matches or not
@param mixed $row
@param Filter $filter
@return mixed | [
"Apply",
"fitler",
"date",
"and",
"tell",
"whether",
"row",
"value",
"matches",
"or",
"not"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataSource/ArrayDataSource.php#L305-L331 |
contributte/datagrid | src/DataSource/ArrayDataSource.php | ArrayDataSource.sort | public function sort(Sorting $sorting)
{
if (is_callable($sorting->getSortCallback())) {
$data = call_user_func(
$sorting->getSortCallback(),
$this->data,
$sorting->getSort()
);
if (!is_array($data)) {
throw new DataGridArrayDataSourceException('Sorting callback has to return array');
}
... | php | public function sort(Sorting $sorting)
{
if (is_callable($sorting->getSortCallback())) {
$data = call_user_func(
$sorting->getSortCallback(),
$this->data,
$sorting->getSort()
);
if (!is_array($data)) {
throw new DataGridArrayDataSourceException('Sorting callback has to return array');
}
... | [
"public",
"function",
"sort",
"(",
"Sorting",
"$",
"sorting",
")",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"sorting",
"->",
"getSortCallback",
"(",
")",
")",
")",
"{",
"$",
"data",
"=",
"call_user_func",
"(",
"$",
"sorting",
"->",
"getSortCallback",
"("... | Sort data
@param Sorting $sorting
@return static | [
"Sort",
"data"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataSource/ArrayDataSource.php#L339-L389 |
contributte/datagrid | src/Filter/FilterDate.php | FilterDate.addToFormContainer | public function addToFormContainer(Nette\Forms\Container $container)
{
$container->addText($this->key, $this->name)
->setAttribute('data-provide', 'datepicker')
->setAttribute('data-date-orientation', 'bottom')
->setAttribute('data-date-format', $this->getJsFormat())
->setAttribute('data-date-today-highl... | php | public function addToFormContainer(Nette\Forms\Container $container)
{
$container->addText($this->key, $this->name)
->setAttribute('data-provide', 'datepicker')
->setAttribute('data-date-orientation', 'bottom')
->setAttribute('data-date-format', $this->getJsFormat())
->setAttribute('data-date-today-highl... | [
"public",
"function",
"addToFormContainer",
"(",
"Nette",
"\\",
"Forms",
"\\",
"Container",
"$",
"container",
")",
"{",
"$",
"container",
"->",
"addText",
"(",
"$",
"this",
"->",
"key",
",",
"$",
"this",
"->",
"name",
")",
"->",
"setAttribute",
"(",
"'da... | Adds select box to filter form
@param Nette\Forms\Container $container | [
"Adds",
"select",
"box",
"to",
"filter",
"form"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/Filter/FilterDate.php#L36-L54 |
contributte/datagrid | src/DataGrid.php | DataGrid.attached | public function attached($presenter)
{
parent::attached($presenter);
if ($presenter instanceof Nette\Application\UI\Presenter) {
/**
* Get session
*/
if ($this->remember_state) {
$this->grid_session = $presenter->getSession($this->getSessionSectionName());
}
}
} | php | public function attached($presenter)
{
parent::attached($presenter);
if ($presenter instanceof Nette\Application\UI\Presenter) {
/**
* Get session
*/
if ($this->remember_state) {
$this->grid_session = $presenter->getSession($this->getSessionSectionName());
}
}
} | [
"public",
"function",
"attached",
"(",
"$",
"presenter",
")",
"{",
"parent",
"::",
"attached",
"(",
"$",
"presenter",
")",
";",
"if",
"(",
"$",
"presenter",
"instanceof",
"Nette",
"\\",
"Application",
"\\",
"UI",
"\\",
"Presenter",
")",
"{",
"/**\n\t\t\t *... | {inheritDoc}
@return void | [
"{",
"inheritDoc",
"}"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L437-L449 |
contributte/datagrid | src/DataGrid.php | DataGrid.render | public function render()
{
/**
* Check whether datagrid has set some columns, initiated data source, etc
*/
if (!($this->dataModel instanceof DataModel)) {
throw new DataGridException('You have to set a data source first.');
}
if (empty($this->columns)) {
throw new DataGridException('You have to a... | php | public function render()
{
/**
* Check whether datagrid has set some columns, initiated data source, etc
*/
if (!($this->dataModel instanceof DataModel)) {
throw new DataGridException('You have to set a data source first.');
}
if (empty($this->columns)) {
throw new DataGridException('You have to a... | [
"public",
"function",
"render",
"(",
")",
"{",
"/**\n\t\t * Check whether datagrid has set some columns, initiated data source, etc\n\t\t */",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"dataModel",
"instanceof",
"DataModel",
")",
")",
"{",
"throw",
"new",
"DataGridException... | Render template
@return void | [
"Render",
"template"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L461-L565 |
contributte/datagrid | src/DataGrid.php | DataGrid.setPrimaryKey | public function setPrimaryKey($primary_key)
{
if ($this->dataModel instanceof DataModel) {
throw new DataGridException('Please set datagrid primary key before setting datasource.');
}
$this->primary_key = $primary_key;
return $this;
} | php | public function setPrimaryKey($primary_key)
{
if ($this->dataModel instanceof DataModel) {
throw new DataGridException('Please set datagrid primary key before setting datasource.');
}
$this->primary_key = $primary_key;
return $this;
} | [
"public",
"function",
"setPrimaryKey",
"(",
"$",
"primary_key",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"dataModel",
"instanceof",
"DataModel",
")",
"{",
"throw",
"new",
"DataGridException",
"(",
"'Please set datagrid primary key before setting datasource.'",
")",
";"... | By default ID, you can change that
@param string $primary_key
@return static | [
"By",
"default",
"ID",
"you",
"can",
"change",
"that"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L596-L605 |
contributte/datagrid | src/DataGrid.php | DataGrid.setDataSource | public function setDataSource($source)
{
$this->dataModel = new DataModel($source, $this->primary_key);
$this->dataModel->onBeforeFilter[] = [$this, 'beforeDataModelFilter'];
$this->dataModel->onAfterFilter[] = [$this, 'afterDataModelFilter'];
$this->dataModel->onAfterPaginated[] = [$this, 'afterDataModelPagi... | php | public function setDataSource($source)
{
$this->dataModel = new DataModel($source, $this->primary_key);
$this->dataModel->onBeforeFilter[] = [$this, 'beforeDataModelFilter'];
$this->dataModel->onAfterFilter[] = [$this, 'afterDataModelFilter'];
$this->dataModel->onAfterPaginated[] = [$this, 'afterDataModelPagi... | [
"public",
"function",
"setDataSource",
"(",
"$",
"source",
")",
"{",
"$",
"this",
"->",
"dataModel",
"=",
"new",
"DataModel",
"(",
"$",
"source",
",",
"$",
"this",
"->",
"primary_key",
")",
";",
"$",
"this",
"->",
"dataModel",
"->",
"onBeforeFilter",
"["... | Set Grid data source
@param DataSource\IDataSource|array|\DibiFluent|\Dibi\Fluent|Nette\Database\Table\Selection|\Doctrine\ORM\QueryBuilder|\Nextras\Orm\Collection\ICollection $source
@return static | [
"Set",
"Grid",
"data",
"source"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L613-L622 |
contributte/datagrid | src/DataGrid.php | DataGrid.setDefaultSort | public function setDefaultSort($sort, $use_on_reset = true)
{
if (is_string($sort)) {
$sort = [$sort => 'ASC'];
} else {
$sort = (array) $sort;
}
$this->default_sort = $sort;
$this->default_sort_use_on_reset = (bool) $use_on_reset;
return $this;
} | php | public function setDefaultSort($sort, $use_on_reset = true)
{
if (is_string($sort)) {
$sort = [$sort => 'ASC'];
} else {
$sort = (array) $sort;
}
$this->default_sort = $sort;
$this->default_sort_use_on_reset = (bool) $use_on_reset;
return $this;
} | [
"public",
"function",
"setDefaultSort",
"(",
"$",
"sort",
",",
"$",
"use_on_reset",
"=",
"true",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"sort",
")",
")",
"{",
"$",
"sort",
"=",
"[",
"$",
"sort",
"=>",
"'ASC'",
"]",
";",
"}",
"else",
"{",
"$"... | Set default sorting
@param array $sort
@param bool $use_on_reset
@return static | [
"Set",
"default",
"sorting"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L703-L715 |
contributte/datagrid | src/DataGrid.php | DataGrid.getColumnDefaultSort | public function getColumnDefaultSort($columnKey)
{
if (isset($this->default_sort[$columnKey])) {
return $this->default_sort[$columnKey];
}
return NULL;
} | php | public function getColumnDefaultSort($columnKey)
{
if (isset($this->default_sort[$columnKey])) {
return $this->default_sort[$columnKey];
}
return NULL;
} | [
"public",
"function",
"getColumnDefaultSort",
"(",
"$",
"columnKey",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"default_sort",
"[",
"$",
"columnKey",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"default_sort",
"[",
"$",
"columnKey",
"]",... | Return default sort for column, if specified
@param string $columnKey
@return string|NULL | [
"Return",
"default",
"sort",
"for",
"column",
"if",
"specified"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L723-L730 |
contributte/datagrid | src/DataGrid.php | DataGrid.findDefaultSort | public function findDefaultSort()
{
if (!empty($this->sort)) {
return;
}
if ($this->getSessionData('_grid_has_sorted')) {
return;
}
if (!empty($this->default_sort)) {
$this->sort = $this->default_sort;
}
$this->saveSessionData('_grid_sort', $this->sort);
} | php | public function findDefaultSort()
{
if (!empty($this->sort)) {
return;
}
if ($this->getSessionData('_grid_has_sorted')) {
return;
}
if (!empty($this->default_sort)) {
$this->sort = $this->default_sort;
}
$this->saveSessionData('_grid_sort', $this->sort);
} | [
"public",
"function",
"findDefaultSort",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"sort",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getSessionData",
"(",
"'_grid_has_sorted'",
")",
")",
"{",
"return",
";... | User may set default sorting, apply it
@return void | [
"User",
"may",
"set",
"default",
"sorting",
"apply",
"it"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L737-L752 |
contributte/datagrid | src/DataGrid.php | DataGrid.setSortable | public function setSortable($sortable = true)
{
if ($this->getItemsDetail()) {
throw new DataGridException('You can not use both sortable datagrid and items detail.');
}
$this->sortable = (bool) $sortable;
return $this;
} | php | public function setSortable($sortable = true)
{
if ($this->getItemsDetail()) {
throw new DataGridException('You can not use both sortable datagrid and items detail.');
}
$this->sortable = (bool) $sortable;
return $this;
} | [
"public",
"function",
"setSortable",
"(",
"$",
"sortable",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getItemsDetail",
"(",
")",
")",
"{",
"throw",
"new",
"DataGridException",
"(",
"'You can not use both sortable datagrid and items detail.'",
")",
";",
... | Set grido to be sortable
@param bool $sortable
@return static | [
"Set",
"grido",
"to",
"be",
"sortable"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L760-L769 |
contributte/datagrid | src/DataGrid.php | DataGrid.setTreeView | public function setTreeView($get_children_callback, $tree_view_has_children_column = 'has_children')
{
if (!is_callable($get_children_callback)) {
throw new DataGridException(
'Parameters to method DataGrid::setTreeView must be of type callable'
);
}
if (is_callable($tree_view_has_children_column)) {
... | php | public function setTreeView($get_children_callback, $tree_view_has_children_column = 'has_children')
{
if (!is_callable($get_children_callback)) {
throw new DataGridException(
'Parameters to method DataGrid::setTreeView must be of type callable'
);
}
if (is_callable($tree_view_has_children_column)) {
... | [
"public",
"function",
"setTreeView",
"(",
"$",
"get_children_callback",
",",
"$",
"tree_view_has_children_column",
"=",
"'has_children'",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"get_children_callback",
")",
")",
"{",
"throw",
"new",
"DataGridException",
... | Setting tree view
@param callable $get_children_callback
@param string|callable $tree_view_has_children_column
@return static | [
"Setting",
"tree",
"view"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L894-L923 |
contributte/datagrid | src/DataGrid.php | DataGrid.addColumnText | public function addColumnText($key, $name, $column = null)
{
$this->addColumnCheck($key);
$column = $column ?: $key;
return $this->addColumn($key, new Column\ColumnText($this, $key, $column, $name));
} | php | public function addColumnText($key, $name, $column = null)
{
$this->addColumnCheck($key);
$column = $column ?: $key;
return $this->addColumn($key, new Column\ColumnText($this, $key, $column, $name));
} | [
"public",
"function",
"addColumnText",
"(",
"$",
"key",
",",
"$",
"name",
",",
"$",
"column",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addColumnCheck",
"(",
"$",
"key",
")",
";",
"$",
"column",
"=",
"$",
"column",
"?",
":",
"$",
"key",
";",
"re... | Add text column with no other formating
@param string $key
@param string $name
@param string|null $column
@return Column\ColumnText | [
"Add",
"text",
"column",
"with",
"no",
"other",
"formating"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L958-L964 |
contributte/datagrid | src/DataGrid.php | DataGrid.addColumnLink | public function addColumnLink($key, $name, $href = null, $column = null, array $params = null)
{
$this->addColumnCheck($key);
$column = $column ?: $key;
$href = $href ?: $key;
if ($params === null) {
$params = [$this->primary_key];
}
return $this->addColumn($key, new Column\ColumnLink($this, $key, $co... | php | public function addColumnLink($key, $name, $href = null, $column = null, array $params = null)
{
$this->addColumnCheck($key);
$column = $column ?: $key;
$href = $href ?: $key;
if ($params === null) {
$params = [$this->primary_key];
}
return $this->addColumn($key, new Column\ColumnLink($this, $key, $co... | [
"public",
"function",
"addColumnLink",
"(",
"$",
"key",
",",
"$",
"name",
",",
"$",
"href",
"=",
"null",
",",
"$",
"column",
"=",
"null",
",",
"array",
"$",
"params",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addColumnCheck",
"(",
"$",
"key",
")",... | Add column with link
@param string $key
@param string $name
@param string|null $column
@return Column\ColumnLink | [
"Add",
"column",
"with",
"link"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L974-L985 |
contributte/datagrid | src/DataGrid.php | DataGrid.addColumnNumber | public function addColumnNumber($key, $name, $column = null)
{
$this->addColumnCheck($key);
$column = $column ?: $key;
return $this->addColumn($key, new Column\ColumnNumber($this, $key, $column, $name));
} | php | public function addColumnNumber($key, $name, $column = null)
{
$this->addColumnCheck($key);
$column = $column ?: $key;
return $this->addColumn($key, new Column\ColumnNumber($this, $key, $column, $name));
} | [
"public",
"function",
"addColumnNumber",
"(",
"$",
"key",
",",
"$",
"name",
",",
"$",
"column",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addColumnCheck",
"(",
"$",
"key",
")",
";",
"$",
"column",
"=",
"$",
"column",
"?",
":",
"$",
"key",
";",
"... | Add column with possible number formating
@param string $key
@param string $name
@param string|null $column
@return Column\ColumnNumber | [
"Add",
"column",
"with",
"possible",
"number",
"formating"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L995-L1001 |
contributte/datagrid | src/DataGrid.php | DataGrid.addColumnDateTime | public function addColumnDateTime($key, $name, $column = null)
{
$this->addColumnCheck($key);
$column = $column ?: $key;
return $this->addColumn($key, new Column\ColumnDateTime($this, $key, $column, $name));
} | php | public function addColumnDateTime($key, $name, $column = null)
{
$this->addColumnCheck($key);
$column = $column ?: $key;
return $this->addColumn($key, new Column\ColumnDateTime($this, $key, $column, $name));
} | [
"public",
"function",
"addColumnDateTime",
"(",
"$",
"key",
",",
"$",
"name",
",",
"$",
"column",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addColumnCheck",
"(",
"$",
"key",
")",
";",
"$",
"column",
"=",
"$",
"column",
"?",
":",
"$",
"key",
";",
... | Add column with date formating
@param string $key
@param string $name
@param string|null $column
@return Column\ColumnDateTime | [
"Add",
"column",
"with",
"date",
"formating"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L1011-L1017 |
contributte/datagrid | src/DataGrid.php | DataGrid.addColumnStatus | public function addColumnStatus($key, $name, $column = null)
{
$this->addColumnCheck($key);
$column = $column ?: $key;
return $this->addColumn($key, new Column\ColumnStatus($this, $key, $column, $name));
} | php | public function addColumnStatus($key, $name, $column = null)
{
$this->addColumnCheck($key);
$column = $column ?: $key;
return $this->addColumn($key, new Column\ColumnStatus($this, $key, $column, $name));
} | [
"public",
"function",
"addColumnStatus",
"(",
"$",
"key",
",",
"$",
"name",
",",
"$",
"column",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addColumnCheck",
"(",
"$",
"key",
")",
";",
"$",
"column",
"=",
"$",
"column",
"?",
":",
"$",
"key",
";",
"... | Add column status
@param string $key
@param string $name
@param string|null $column
@return Column\ColumnStatus | [
"Add",
"column",
"status"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L1027-L1033 |
contributte/datagrid | src/DataGrid.php | DataGrid.getColumn | public function getColumn($key)
{
if (!isset($this->columns[$key])) {
throw new DataGridColumnNotFoundException("There is no column at key [$key] defined.");
}
return $this->columns[$key];
} | php | public function getColumn($key)
{
if (!isset($this->columns[$key])) {
throw new DataGridColumnNotFoundException("There is no column at key [$key] defined.");
}
return $this->columns[$key];
} | [
"public",
"function",
"getColumn",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"columns",
"[",
"$",
"key",
"]",
")",
")",
"{",
"throw",
"new",
"DataGridColumnNotFoundException",
"(",
"\"There is no column at key [$key] defined.\... | Return existing column
@param string $key
@return Column\Column
@throws DataGridException | [
"Return",
"existing",
"column"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L1059-L1066 |
contributte/datagrid | src/DataGrid.php | DataGrid.addAction | public function addAction($key, $name, $href = null, array $params = null)
{
$this->addActionCheck($key);
$href = $href ?: $key;
if ($params === null) {
$params = [$this->primary_key];
}
return $this->actions[$key] = new Column\Action($this, $href, $name, $params);
} | php | public function addAction($key, $name, $href = null, array $params = null)
{
$this->addActionCheck($key);
$href = $href ?: $key;
if ($params === null) {
$params = [$this->primary_key];
}
return $this->actions[$key] = new Column\Action($this, $href, $name, $params);
} | [
"public",
"function",
"addAction",
"(",
"$",
"key",
",",
"$",
"name",
",",
"$",
"href",
"=",
"null",
",",
"array",
"$",
"params",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addActionCheck",
"(",
"$",
"key",
")",
";",
"$",
"href",
"=",
"$",
"href"... | Create action
@param string $key
@param string $name
@param string $href
@param array|null $params
@return Column\Action | [
"Create",
"action"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L1109-L1120 |
contributte/datagrid | src/DataGrid.php | DataGrid.addActionCallback | public function addActionCallback($key, $name, $callback = null)
{
$this->addActionCheck($key);
$params = ['__id' => $this->primary_key];
$this->actions[$key] = $action = new Column\ActionCallback($this, $key, $name, $params);
if ($callback) {
if (!is_callable($callback)) {
throw new DataGridExceptio... | php | public function addActionCallback($key, $name, $callback = null)
{
$this->addActionCheck($key);
$params = ['__id' => $this->primary_key];
$this->actions[$key] = $action = new Column\ActionCallback($this, $key, $name, $params);
if ($callback) {
if (!is_callable($callback)) {
throw new DataGridExceptio... | [
"public",
"function",
"addActionCallback",
"(",
"$",
"key",
",",
"$",
"name",
",",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addActionCheck",
"(",
"$",
"key",
")",
";",
"$",
"params",
"=",
"[",
"'__id'",
"=>",
"$",
"this",
"->",
"... | Create action callback
@param string $key
@param string $name
@return Column\Action | [
"Create",
"action",
"callback"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L1129-L1146 |
contributte/datagrid | src/DataGrid.php | DataGrid.addFilterText | public function addFilterText($key, $name, $columns = null)
{
$columns = $columns === null? [$key] : (is_string($columns) ? [$columns] : $columns);
if (!is_array($columns)) {
throw new DataGridException('Filter Text can accept only array or string.');
}
$this->addFilterCheck($key);
return $this->filter... | php | public function addFilterText($key, $name, $columns = null)
{
$columns = $columns === null? [$key] : (is_string($columns) ? [$columns] : $columns);
if (!is_array($columns)) {
throw new DataGridException('Filter Text can accept only array or string.');
}
$this->addFilterCheck($key);
return $this->filter... | [
"public",
"function",
"addFilterText",
"(",
"$",
"key",
",",
"$",
"name",
",",
"$",
"columns",
"=",
"null",
")",
"{",
"$",
"columns",
"=",
"$",
"columns",
"===",
"null",
"?",
"[",
"$",
"key",
"]",
":",
"(",
"is_string",
"(",
"$",
"columns",
")",
... | Add filter fot text search
@param string $key
@param string $name
@param array|string $columns
@return Filter\FilterText
@throws DataGridException | [
"Add",
"filter",
"fot",
"text",
"search"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L1217-L1228 |
contributte/datagrid | src/DataGrid.php | DataGrid.addFilterSelect | public function addFilterSelect($key, $name, array $options, $column = null)
{
$column = $column ?: $key;
if (!is_string($column)) {
throw new DataGridException('Filter Select can only filter in one column.');
}
$this->addFilterCheck($key);
return $this->filters[$key] = new Filter\FilterSelect($this, $... | php | public function addFilterSelect($key, $name, array $options, $column = null)
{
$column = $column ?: $key;
if (!is_string($column)) {
throw new DataGridException('Filter Select can only filter in one column.');
}
$this->addFilterCheck($key);
return $this->filters[$key] = new Filter\FilterSelect($this, $... | [
"public",
"function",
"addFilterSelect",
"(",
"$",
"key",
",",
"$",
"name",
",",
"array",
"$",
"options",
",",
"$",
"column",
"=",
"null",
")",
"{",
"$",
"column",
"=",
"$",
"column",
"?",
":",
"$",
"key",
";",
"if",
"(",
"!",
"is_string",
"(",
"... | Add select box filter
@param string $key
@param string $name
@param array $options
@param string $column
@return Filter\FilterSelect
@throws DataGridException | [
"Add",
"select",
"box",
"filter"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L1240-L1251 |
contributte/datagrid | src/DataGrid.php | DataGrid.addFilterMultiSelect | public function addFilterMultiSelect($key, $name, array $options, $column = null)
{
$column = $column ?: $key;
if (!is_string($column)) {
throw new DataGridException('Filter MultiSelect can only filter in one column.');
}
$this->addFilterCheck($key);
return $this->filters[$key] = new Filter\FilterMulti... | php | public function addFilterMultiSelect($key, $name, array $options, $column = null)
{
$column = $column ?: $key;
if (!is_string($column)) {
throw new DataGridException('Filter MultiSelect can only filter in one column.');
}
$this->addFilterCheck($key);
return $this->filters[$key] = new Filter\FilterMulti... | [
"public",
"function",
"addFilterMultiSelect",
"(",
"$",
"key",
",",
"$",
"name",
",",
"array",
"$",
"options",
",",
"$",
"column",
"=",
"null",
")",
"{",
"$",
"column",
"=",
"$",
"column",
"?",
":",
"$",
"key",
";",
"if",
"(",
"!",
"is_string",
"("... | Add multi select box filter
@param string $key
@param string $name
@param array $options
@param string $column
@return Filter\FilterSelect
@throws DataGridException | [
"Add",
"multi",
"select",
"box",
"filter"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L1263-L1274 |
contributte/datagrid | src/DataGrid.php | DataGrid.addFilterDate | public function addFilterDate($key, $name, $column = null)
{
$column = $column ?: $key;
if (!is_string($column)) {
throw new DataGridException('FilterDate can only filter in one column.');
}
$this->addFilterCheck($key);
return $this->filters[$key] = new Filter\FilterDate($this, $key, $name, $column);
... | php | public function addFilterDate($key, $name, $column = null)
{
$column = $column ?: $key;
if (!is_string($column)) {
throw new DataGridException('FilterDate can only filter in one column.');
}
$this->addFilterCheck($key);
return $this->filters[$key] = new Filter\FilterDate($this, $key, $name, $column);
... | [
"public",
"function",
"addFilterDate",
"(",
"$",
"key",
",",
"$",
"name",
",",
"$",
"column",
"=",
"null",
")",
"{",
"$",
"column",
"=",
"$",
"column",
"?",
":",
"$",
"key",
";",
"if",
"(",
"!",
"is_string",
"(",
"$",
"column",
")",
")",
"{",
"... | Add datepicker filter
@param string $key
@param string $name
@param string $column
@return Filter\FilterDate
@throws DataGridException | [
"Add",
"datepicker",
"filter"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L1285-L1296 |
contributte/datagrid | src/DataGrid.php | DataGrid.addFilterRange | public function addFilterRange($key, $name, $column = null, $name_second = '-')
{
$column = $column ?: $key;
if (!is_string($column)) {
throw new DataGridException('FilterRange can only filter in one column.');
}
$this->addFilterCheck($key);
return $this->filters[$key] = new Filter\FilterRange($this, $... | php | public function addFilterRange($key, $name, $column = null, $name_second = '-')
{
$column = $column ?: $key;
if (!is_string($column)) {
throw new DataGridException('FilterRange can only filter in one column.');
}
$this->addFilterCheck($key);
return $this->filters[$key] = new Filter\FilterRange($this, $... | [
"public",
"function",
"addFilterRange",
"(",
"$",
"key",
",",
"$",
"name",
",",
"$",
"column",
"=",
"null",
",",
"$",
"name_second",
"=",
"'-'",
")",
"{",
"$",
"column",
"=",
"$",
"column",
"?",
":",
"$",
"key",
";",
"if",
"(",
"!",
"is_string",
... | Add range filter (from - to)
@param string $key
@param string $name
@param string $column
@return Filter\FilterRange
@throws DataGridException | [
"Add",
"range",
"filter",
"(",
"from",
"-",
"to",
")"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L1307-L1318 |
contributte/datagrid | src/DataGrid.php | DataGrid.addFilterDateRange | public function addFilterDateRange($key, $name, $column = null, $name_second = '-')
{
$column = $column ?: $key;
if (!is_string($column)) {
throw new DataGridException('FilterDateRange can only filter in one column.');
}
$this->addFilterCheck($key);
return $this->filters[$key] = new Filter\FilterDateRa... | php | public function addFilterDateRange($key, $name, $column = null, $name_second = '-')
{
$column = $column ?: $key;
if (!is_string($column)) {
throw new DataGridException('FilterDateRange can only filter in one column.');
}
$this->addFilterCheck($key);
return $this->filters[$key] = new Filter\FilterDateRa... | [
"public",
"function",
"addFilterDateRange",
"(",
"$",
"key",
",",
"$",
"name",
",",
"$",
"column",
"=",
"null",
",",
"$",
"name_second",
"=",
"'-'",
")",
"{",
"$",
"column",
"=",
"$",
"column",
"?",
":",
"$",
"key",
";",
"if",
"(",
"!",
"is_string"... | Add datepicker filter (from - to)
@param string $key
@param string $name
@param string $column
@return Filter\FilterDateRange
@throws DataGridException | [
"Add",
"datepicker",
"filter",
"(",
"from",
"-",
"to",
")"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L1329-L1340 |
contributte/datagrid | src/DataGrid.php | DataGrid.assembleFilters | public function assembleFilters()
{
foreach ($this->filter as $key => $value) {
if (!isset($this->filters[$key])) {
$this->deleteSessionData($key);
continue;
}
if (is_array($value) || $value instanceof \Traversable) {
if (!ArraysHelper::testEmpty($value)) {
$this->filters[$key]->setValue(... | php | public function assembleFilters()
{
foreach ($this->filter as $key => $value) {
if (!isset($this->filters[$key])) {
$this->deleteSessionData($key);
continue;
}
if (is_array($value) || $value instanceof \Traversable) {
if (!ArraysHelper::testEmpty($value)) {
$this->filters[$key]->setValue(... | [
"public",
"function",
"assembleFilters",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"filter",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"filters",
"[",
"$",
"key",
"]",
")",
")",
"{",
... | Fill array of Filter\Filter[] with values from $this->filter persistent parameter
Fill array of Column\Column[] with values from $this->sort persistent parameter
@return Filter\Filter[] $this->filters === Filter\Filter[] | [
"Fill",
"array",
"of",
"Filter",
"\\",
"Filter",
"[]",
"with",
"values",
"from",
"$this",
"-",
">",
"filter",
"persistent",
"parameter",
"Fill",
"array",
"of",
"Column",
"\\",
"Column",
"[]",
"with",
"values",
"from",
"$this",
"-",
">",
"sort",
"persistent... | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L1361-L1397 |
contributte/datagrid | src/DataGrid.php | DataGrid.getFilter | public function getFilter($key)
{
if (!isset($this->filters[$key])) {
throw new DataGridException("Filter [{$key}] is not defined");
}
return $this->filters[$key];
} | php | public function getFilter($key)
{
if (!isset($this->filters[$key])) {
throw new DataGridException("Filter [{$key}] is not defined");
}
return $this->filters[$key];
} | [
"public",
"function",
"getFilter",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"filters",
"[",
"$",
"key",
"]",
")",
")",
"{",
"throw",
"new",
"DataGridException",
"(",
"\"Filter [{$key}] is not defined\"",
")",
";",
"}",
... | Get defined filter
@param string $key
@return Filter\Filter | [
"Get",
"defined",
"filter"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L1431-L1438 |
contributte/datagrid | src/DataGrid.php | DataGrid.setDefaultFilter | public function setDefaultFilter(array $default_filter, $use_on_reset = true)
{
foreach ($default_filter as $key => $value) {
$filter = $this->getFilter($key);
if (!$filter) {
throw new DataGridException("Can not set default value to nonexisting filter [$key]");
}
if ($filter instanceof Filter\Filt... | php | public function setDefaultFilter(array $default_filter, $use_on_reset = true)
{
foreach ($default_filter as $key => $value) {
$filter = $this->getFilter($key);
if (!$filter) {
throw new DataGridException("Can not set default value to nonexisting filter [$key]");
}
if ($filter instanceof Filter\Filt... | [
"public",
"function",
"setDefaultFilter",
"(",
"array",
"$",
"default_filter",
",",
"$",
"use_on_reset",
"=",
"true",
")",
"{",
"foreach",
"(",
"$",
"default_filter",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"filter",
"=",
"$",
"this",
"->",
... | If we want to sent some initial filter
@param array $filter
@param bool $use_on_reset
@return static | [
"If",
"we",
"want",
"to",
"sent",
"some",
"initial",
"filter"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L1503-L1540 |
contributte/datagrid | src/DataGrid.php | DataGrid.findDefaultFilter | public function findDefaultFilter()
{
if (!empty($this->filter)) {
return;
}
if ($this->getSessionData('_grid_has_filtered')) {
return;
}
if (!empty($this->default_filter)) {
$this->filter = $this->default_filter;
}
foreach ($this->filter as $key => $value) {
$this->saveSessionData($key, $... | php | public function findDefaultFilter()
{
if (!empty($this->filter)) {
return;
}
if ($this->getSessionData('_grid_has_filtered')) {
return;
}
if (!empty($this->default_filter)) {
$this->filter = $this->default_filter;
}
foreach ($this->filter as $key => $value) {
$this->saveSessionData($key, $... | [
"public",
"function",
"findDefaultFilter",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"filter",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getSessionData",
"(",
"'_grid_has_filtered'",
")",
")",
"{",
"return"... | User may set default filter, find it
@return void | [
"User",
"may",
"set",
"default",
"filter",
"find",
"it"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L1547-L1564 |
contributte/datagrid | src/DataGrid.php | DataGrid.createComponentFilter | public function createComponentFilter()
{
$form = new Form($this, 'filter');
$form->setMethod(static::$form_method);
$form->setTranslator($this->getTranslator());
/**
* InlineEdit part
*/
$inline_edit_container = $form->addContainer('inline_edit');
if ($this->inlineEdit instanceof InlineEdit) {
... | php | public function createComponentFilter()
{
$form = new Form($this, 'filter');
$form->setMethod(static::$form_method);
$form->setTranslator($this->getTranslator());
/**
* InlineEdit part
*/
$inline_edit_container = $form->addContainer('inline_edit');
if ($this->inlineEdit instanceof InlineEdit) {
... | [
"public",
"function",
"createComponentFilter",
"(",
")",
"{",
"$",
"form",
"=",
"new",
"Form",
"(",
"$",
"this",
",",
"'filter'",
")",
";",
"$",
"form",
"->",
"setMethod",
"(",
"static",
"::",
"$",
"form_method",
")",
";",
"$",
"form",
"->",
"setTransl... | FilterAndGroupAction form factory
@return Form | [
"FilterAndGroupAction",
"form",
"factory"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L1571-L1659 |
contributte/datagrid | src/DataGrid.php | DataGrid.filterSucceeded | public function filterSucceeded(Form $form)
{
if ($this->snippets_set) {
return;
}
$values = $form->getValues();
if ($this->getPresenter()->isAjax()) {
if (isset($form['group_action']['submit']) && $form['group_action']['submit']->isSubmittedBy()) {
return;
}
}
/**
* Per page
*/
$th... | php | public function filterSucceeded(Form $form)
{
if ($this->snippets_set) {
return;
}
$values = $form->getValues();
if ($this->getPresenter()->isAjax()) {
if (isset($form['group_action']['submit']) && $form['group_action']['submit']->isSubmittedBy()) {
return;
}
}
/**
* Per page
*/
$th... | [
"public",
"function",
"filterSucceeded",
"(",
"Form",
"$",
"form",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"snippets_set",
")",
"{",
"return",
";",
"}",
"$",
"values",
"=",
"$",
"form",
"->",
"getValues",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->"... | Set $this->filter values after filter form submitted
@param Form $form
@return void | [
"Set",
"$this",
"-",
">",
"filter",
"values",
"after",
"filter",
"form",
"submitted"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L1703-L1817 |
contributte/datagrid | src/DataGrid.php | DataGrid.setOuterFilterColumnsCount | public function setOuterFilterColumnsCount($count)
{
if (!in_array($count, [1, 2, 3, 4, 6, 12], true)) {
throw new \InvalidArgumentException(
"Columns count must be one of following values: 1, 2, 3, 4, 6, 12. Value {$count} given."
);
}
$this->outer_filter_columns_count = (int) $count;
return $this... | php | public function setOuterFilterColumnsCount($count)
{
if (!in_array($count, [1, 2, 3, 4, 6, 12], true)) {
throw new \InvalidArgumentException(
"Columns count must be one of following values: 1, 2, 3, 4, 6, 12. Value {$count} given."
);
}
$this->outer_filter_columns_count = (int) $count;
return $this... | [
"public",
"function",
"setOuterFilterColumnsCount",
"(",
"$",
"count",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"count",
",",
"[",
"1",
",",
"2",
",",
"3",
",",
"4",
",",
"6",
",",
"12",
"]",
",",
"true",
")",
")",
"{",
"throw",
"new",
"... | Set the number of columns in the outer filter
@param int $count
@return static
@throws \InvalidArgumentException | [
"Set",
"the",
"number",
"of",
"columns",
"in",
"the",
"outer",
"filter"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L1849-L1860 |
contributte/datagrid | src/DataGrid.php | DataGrid.findSessionValues | public function findSessionValues()
{
if (!ArraysHelper::testEmpty($this->filter) || ($this->page != 1) || !empty($this->sort)) {
return;
}
if (!$this->remember_state) {
return;
}
if ($page = $this->getSessionData('_grid_page')) {
$this->page = $page;
}
if ($per_page = $this->getSessionData('... | php | public function findSessionValues()
{
if (!ArraysHelper::testEmpty($this->filter) || ($this->page != 1) || !empty($this->sort)) {
return;
}
if (!$this->remember_state) {
return;
}
if ($page = $this->getSessionData('_grid_page')) {
$this->page = $page;
}
if ($per_page = $this->getSessionData('... | [
"public",
"function",
"findSessionValues",
"(",
")",
"{",
"if",
"(",
"!",
"ArraysHelper",
"::",
"testEmpty",
"(",
"$",
"this",
"->",
"filter",
")",
"||",
"(",
"$",
"this",
"->",
"page",
"!=",
"1",
")",
"||",
"!",
"empty",
"(",
"$",
"this",
"->",
"s... | Try to restore session stuff
@return void
@throws DataGridFilterNotFoundException | [
"Try",
"to",
"restore",
"session",
"stuff"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L1895-L1962 |
contributte/datagrid | src/DataGrid.php | DataGrid.addExportCallback | public function addExportCallback($text, $callback, $filtered = false)
{
if (!is_callable($callback)) {
throw new DataGridException('Second parameter of ExportCallback must be callable.');
}
return $this->addToExports(new Export\Export($this, $text, $callback, $filtered));
} | php | public function addExportCallback($text, $callback, $filtered = false)
{
if (!is_callable($callback)) {
throw new DataGridException('Second parameter of ExportCallback must be callable.');
}
return $this->addToExports(new Export\Export($this, $text, $callback, $filtered));
} | [
"public",
"function",
"addExportCallback",
"(",
"$",
"text",
",",
"$",
"callback",
",",
"$",
"filtered",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"callback",
")",
")",
"{",
"throw",
"new",
"DataGridException",
"(",
"'Second paramete... | Add export of type callback
@param string $text
@param callable $callback
@param bool $filtered
@return Export\Export | [
"Add",
"export",
"of",
"type",
"callback"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L1977-L1984 |
contributte/datagrid | src/DataGrid.php | DataGrid.addExportCsv | public function addExportCsv(
$text,
$csv_file_name,
$output_encoding = null,
$delimiter = null,
$include_bom = false
) {
return $this->addToExports(new Export\ExportCsv(
$this,
$text,
$csv_file_name,
false,
$output_encoding,
$delimiter,
$include_bom
));
} | php | public function addExportCsv(
$text,
$csv_file_name,
$output_encoding = null,
$delimiter = null,
$include_bom = false
) {
return $this->addToExports(new Export\ExportCsv(
$this,
$text,
$csv_file_name,
false,
$output_encoding,
$delimiter,
$include_bom
));
} | [
"public",
"function",
"addExportCsv",
"(",
"$",
"text",
",",
"$",
"csv_file_name",
",",
"$",
"output_encoding",
"=",
"null",
",",
"$",
"delimiter",
"=",
"null",
",",
"$",
"include_bom",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"addToExports",
... | Add already implemented csv export
@param string $text
@param string $csv_file_name
@param string|null $output_encoding
@param string|null $delimiter
@param bool $include_bom
@return Export\Export | [
"Add",
"already",
"implemented",
"csv",
"export"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L1996-L2012 |
contributte/datagrid | src/DataGrid.php | DataGrid.addExportCsvFiltered | public function addExportCsvFiltered(
$text,
$csv_file_name,
$output_encoding = null,
$delimiter = null,
$include_bom = false
) {
return $this->addToExports(new Export\ExportCsv(
$this,
$text,
$csv_file_name,
true,
$output_encoding,
$delimiter,
$include_bom
));
} | php | public function addExportCsvFiltered(
$text,
$csv_file_name,
$output_encoding = null,
$delimiter = null,
$include_bom = false
) {
return $this->addToExports(new Export\ExportCsv(
$this,
$text,
$csv_file_name,
true,
$output_encoding,
$delimiter,
$include_bom
));
} | [
"public",
"function",
"addExportCsvFiltered",
"(",
"$",
"text",
",",
"$",
"csv_file_name",
",",
"$",
"output_encoding",
"=",
"null",
",",
"$",
"delimiter",
"=",
"null",
",",
"$",
"include_bom",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"addToExp... | Add already implemented csv export, but for filtered data
@param string $text
@param string $csv_file_name
@param string|null $output_encoding
@param string|null $delimiter
@param bool $include_bom
@return Export\Export | [
"Add",
"already",
"implemented",
"csv",
"export",
"but",
"for",
"filtered",
"data"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2024-L2040 |
contributte/datagrid | src/DataGrid.php | DataGrid.addToExports | protected function addToExports(Export\Export $export)
{
$id = ($s = sizeof($this->exports)) ? ($s + 1) : 1;
$export->setLink(new Link($this, 'export!', ['id' => $id]));
return $this->exports[$id] = $export;
} | php | protected function addToExports(Export\Export $export)
{
$id = ($s = sizeof($this->exports)) ? ($s + 1) : 1;
$export->setLink(new Link($this, 'export!', ['id' => $id]));
return $this->exports[$id] = $export;
} | [
"protected",
"function",
"addToExports",
"(",
"Export",
"\\",
"Export",
"$",
"export",
")",
"{",
"$",
"id",
"=",
"(",
"$",
"s",
"=",
"sizeof",
"(",
"$",
"this",
"->",
"exports",
")",
")",
"?",
"(",
"$",
"s",
"+",
"1",
")",
":",
"1",
";",
"$",
... | Add export to array
@param Export\Export $export
@return Export\Export | [
"Add",
"export",
"to",
"array"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2048-L2055 |
contributte/datagrid | src/DataGrid.php | DataGrid.addToolbarButton | public function addToolbarButton($href, $text = '', $params = [])
{
if (isset($this->toolbar_buttons[$href])) {
throw new DataGridException("There is already toolbar button at key [$href] defined.");
}
return $this->toolbar_buttons[$href] = new ToolbarButton($this, $href, $text, $params);
} | php | public function addToolbarButton($href, $text = '', $params = [])
{
if (isset($this->toolbar_buttons[$href])) {
throw new DataGridException("There is already toolbar button at key [$href] defined.");
}
return $this->toolbar_buttons[$href] = new ToolbarButton($this, $href, $text, $params);
} | [
"public",
"function",
"addToolbarButton",
"(",
"$",
"href",
",",
"$",
"text",
"=",
"''",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"toolbar_buttons",
"[",
"$",
"href",
"]",
")",
")",
"{",
"throw",
"n... | Add toolbar button
@param string $href
@param string $text
@param array $params
@return ToolbarButton
@throws DataGridException | [
"Add",
"toolbar",
"button"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2082-L2089 |
contributte/datagrid | src/DataGrid.php | DataGrid.getToolbarButton | public function getToolbarButton($key)
{
if (!isset($this->toolbar_buttons[$key])) {
throw new DataGridException("There is no toolbar button at key [$key] defined.");
}
return $this->toolbar_buttons[$key];
} | php | public function getToolbarButton($key)
{
if (!isset($this->toolbar_buttons[$key])) {
throw new DataGridException("There is no toolbar button at key [$key] defined.");
}
return $this->toolbar_buttons[$key];
} | [
"public",
"function",
"getToolbarButton",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"toolbar_buttons",
"[",
"$",
"key",
"]",
")",
")",
"{",
"throw",
"new",
"DataGridException",
"(",
"\"There is no toolbar button at key [$key] ... | Get existing toolbar button
@param string $key
@return ToolbarButton
@throws DataGridException | [
"Get",
"existing",
"toolbar",
"button"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2098-L2105 |
contributte/datagrid | src/DataGrid.php | DataGrid.getGroupActionCollection | public function getGroupActionCollection()
{
if (!$this->group_action_collection) {
$this->group_action_collection = new GroupAction\GroupActionCollection($this);
}
return $this->group_action_collection;
} | php | public function getGroupActionCollection()
{
if (!$this->group_action_collection) {
$this->group_action_collection = new GroupAction\GroupActionCollection($this);
}
return $this->group_action_collection;
} | [
"public",
"function",
"getGroupActionCollection",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"group_action_collection",
")",
"{",
"$",
"this",
"->",
"group_action_collection",
"=",
"new",
"GroupAction",
"\\",
"GroupActionCollection",
"(",
"$",
"this",
")"... | Get collection of all group actions
@return GroupAction\GroupActionCollection | [
"Get",
"collection",
"of",
"all",
"group",
"actions"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2188-L2195 |
contributte/datagrid | src/DataGrid.php | DataGrid.handlePage | public function handlePage($page)
{
/**
* Session stuff
*/
$this->page = $page;
$this->saveSessionData('_grid_page', $page);
$this->reload(['table']);
} | php | public function handlePage($page)
{
/**
* Session stuff
*/
$this->page = $page;
$this->saveSessionData('_grid_page', $page);
$this->reload(['table']);
} | [
"public",
"function",
"handlePage",
"(",
"$",
"page",
")",
"{",
"/**\n\t\t * Session stuff\n\t\t */",
"$",
"this",
"->",
"page",
"=",
"$",
"page",
";",
"$",
"this",
"->",
"saveSessionData",
"(",
"'_grid_page'",
",",
"$",
"page",
")",
";",
"$",
"this",
"->"... | Handler for changind page (just refresh site with page as persistent paramter set)
@param int $page
@return void | [
"Handler",
"for",
"changind",
"page",
"(",
"just",
"refresh",
"site",
"with",
"page",
"as",
"persistent",
"paramter",
"set",
")"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2238-L2247 |
contributte/datagrid | src/DataGrid.php | DataGrid.handleSort | public function handleSort(array $sort)
{
if (count($sort) === 0) {
$sort = $this->default_sort;
}
foreach ($sort as $key => $value) {
try {
$column = $this->getColumn($key);
} catch (DataGridColumnNotFoundException $e) {
unset($sort[$key]);
continue;
}
if ($column->sortableResetPag... | php | public function handleSort(array $sort)
{
if (count($sort) === 0) {
$sort = $this->default_sort;
}
foreach ($sort as $key => $value) {
try {
$column = $this->getColumn($key);
} catch (DataGridColumnNotFoundException $e) {
unset($sort[$key]);
continue;
}
if ($column->sortableResetPag... | [
"public",
"function",
"handleSort",
"(",
"array",
"$",
"sort",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"sort",
")",
"===",
"0",
")",
"{",
"$",
"sort",
"=",
"$",
"this",
"->",
"default_sort",
";",
"}",
"foreach",
"(",
"$",
"sort",
"as",
"$",
"key"... | Handler for sorting
@param array $sort
@return void
@throws DataGridColumnNotFoundException | [
"Handler",
"for",
"sorting"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2256-L2284 |
contributte/datagrid | src/DataGrid.php | DataGrid.handleResetFilter | public function handleResetFilter()
{
/**
* Session stuff
*/
$this->deleteSessionData('_grid_page');
if ($this->default_filter_use_on_reset) {
$this->deleteSessionData('_grid_has_filtered');
}
if ($this->default_sort_use_on_reset) {
$this->deleteSessionData('_grid_has_sorted');
}
foreach (... | php | public function handleResetFilter()
{
/**
* Session stuff
*/
$this->deleteSessionData('_grid_page');
if ($this->default_filter_use_on_reset) {
$this->deleteSessionData('_grid_has_filtered');
}
if ($this->default_sort_use_on_reset) {
$this->deleteSessionData('_grid_has_sorted');
}
foreach (... | [
"public",
"function",
"handleResetFilter",
"(",
")",
"{",
"/**\n\t\t * Session stuff\n\t\t */",
"$",
"this",
"->",
"deleteSessionData",
"(",
"'_grid_page'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"default_filter_use_on_reset",
")",
"{",
"$",
"this",
"->",
"delete... | Handler for reseting the filter
@return void | [
"Handler",
"for",
"reseting",
"the",
"filter"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2291-L2323 |
contributte/datagrid | src/DataGrid.php | DataGrid.handleExport | public function handleExport($id)
{
if (!isset($this->exports[$id])) {
throw new Nette\Application\ForbiddenRequestException;
}
if (!empty($this->columns_export_order)) {
$this->setColumnsOrder($this->columns_export_order);
}
$export = $this->exports[$id];
/**
* Invoke possible events
*/
$... | php | public function handleExport($id)
{
if (!isset($this->exports[$id])) {
throw new Nette\Application\ForbiddenRequestException;
}
if (!empty($this->columns_export_order)) {
$this->setColumnsOrder($this->columns_export_order);
}
$export = $this->exports[$id];
/**
* Invoke possible events
*/
$... | [
"public",
"function",
"handleExport",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"exports",
"[",
"$",
"id",
"]",
")",
")",
"{",
"throw",
"new",
"Nette",
"\\",
"Application",
"\\",
"ForbiddenRequestException",
";",
"}",
... | Handler for export
@param int $id Key for particular export class in array $this->exports
@return void | [
"Handler",
"for",
"export"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2387-L2439 |
contributte/datagrid | src/DataGrid.php | DataGrid.handleGetChildren | public function handleGetChildren($parent)
{
$this->setDataSource(
call_user_func($this->tree_view_children_callback, $parent)
);
if ($this->getPresenter()->isAjax()) {
$this->getPresenter()->payload->_datagrid_url = $this->refresh_url;
$this->getPresenter()->payload->_datagrid_tree = $parent;
$thi... | php | public function handleGetChildren($parent)
{
$this->setDataSource(
call_user_func($this->tree_view_children_callback, $parent)
);
if ($this->getPresenter()->isAjax()) {
$this->getPresenter()->payload->_datagrid_url = $this->refresh_url;
$this->getPresenter()->payload->_datagrid_tree = $parent;
$thi... | [
"public",
"function",
"handleGetChildren",
"(",
"$",
"parent",
")",
"{",
"$",
"this",
"->",
"setDataSource",
"(",
"call_user_func",
"(",
"$",
"this",
"->",
"tree_view_children_callback",
",",
"$",
"parent",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"get... | Handler for getting children of parent item (e.g. category)
@param int $parent
@return void | [
"Handler",
"for",
"getting",
"children",
"of",
"parent",
"item",
"(",
"e",
".",
"g",
".",
"category",
")"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2447-L2463 |
contributte/datagrid | src/DataGrid.php | DataGrid.handleGetItemDetail | public function handleGetItemDetail($id)
{
$this->getTemplate()->add('toggle_detail', $id);
$this->redraw_item = [$this->items_detail->getPrimaryWhereColumn() => $id];
if ($this->getPresenter()->isAjax()) {
$this->getPresenter()->payload->_datagrid_toggle_detail = $id;
$this->getPresenter()->payload->_dat... | php | public function handleGetItemDetail($id)
{
$this->getTemplate()->add('toggle_detail', $id);
$this->redraw_item = [$this->items_detail->getPrimaryWhereColumn() => $id];
if ($this->getPresenter()->isAjax()) {
$this->getPresenter()->payload->_datagrid_toggle_detail = $id;
$this->getPresenter()->payload->_dat... | [
"public",
"function",
"handleGetItemDetail",
"(",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"getTemplate",
"(",
")",
"->",
"add",
"(",
"'toggle_detail'",
",",
"$",
"id",
")",
";",
"$",
"this",
"->",
"redraw_item",
"=",
"[",
"$",
"this",
"->",
"items_deta... | Handler for getting item detail
@param mixed $id
@return void | [
"Handler",
"for",
"getting",
"item",
"detail"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2471-L2492 |
contributte/datagrid | src/DataGrid.php | DataGrid.handleEdit | public function handleEdit($id, $key)
{
$column = $this->getColumn($key);
$value = $this->getPresenter()->getRequest()->getPost('value');
/**
* @var mixed Could be NULL of course
*/
$new_value = call_user_func_array($column->getEditableCallback(), [$id, $value]);
$this->getPresenter()->payload->_data... | php | public function handleEdit($id, $key)
{
$column = $this->getColumn($key);
$value = $this->getPresenter()->getRequest()->getPost('value');
/**
* @var mixed Could be NULL of course
*/
$new_value = call_user_func_array($column->getEditableCallback(), [$id, $value]);
$this->getPresenter()->payload->_data... | [
"public",
"function",
"handleEdit",
"(",
"$",
"id",
",",
"$",
"key",
")",
"{",
"$",
"column",
"=",
"$",
"this",
"->",
"getColumn",
"(",
"$",
"key",
")",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"getPresenter",
"(",
")",
"->",
"getRequest",
"(",
... | Handler for inline editing
@param mixed $id
@param mixed $key
@return void | [
"Handler",
"for",
"inline",
"editing"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2501-L2512 |
contributte/datagrid | src/DataGrid.php | DataGrid.reload | public function reload($snippets = [])
{
if ($this->getPresenter()->isAjax()) {
$this->redrawControl('tbody');
$this->redrawControl('pagination');
$this->redrawControl('summary');
$this->redrawControl('thead-group-action');
/**
* manualy reset exports links...
*/
$this->resetExportsLinks()... | php | public function reload($snippets = [])
{
if ($this->getPresenter()->isAjax()) {
$this->redrawControl('tbody');
$this->redrawControl('pagination');
$this->redrawControl('summary');
$this->redrawControl('thead-group-action');
/**
* manualy reset exports links...
*/
$this->resetExportsLinks()... | [
"public",
"function",
"reload",
"(",
"$",
"snippets",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getPresenter",
"(",
")",
"->",
"isAjax",
"(",
")",
")",
"{",
"$",
"this",
"->",
"redrawControl",
"(",
"'tbody'",
")",
";",
"$",
"this",
... | Redraw $this
@return void | [
"Redraw",
"$this"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2519-L2544 |
contributte/datagrid | src/DataGrid.php | DataGrid.handleChangeStatus | public function handleChangeStatus($id, $key, $value)
{
if (empty($this->columns[$key])) {
throw new DataGridException("ColumnStatus[$key] does not exist");
}
$this->columns[$key]->onChange($id, $value);
} | php | public function handleChangeStatus($id, $key, $value)
{
if (empty($this->columns[$key])) {
throw new DataGridException("ColumnStatus[$key] does not exist");
}
$this->columns[$key]->onChange($id, $value);
} | [
"public",
"function",
"handleChangeStatus",
"(",
"$",
"id",
",",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"columns",
"[",
"$",
"key",
"]",
")",
")",
"{",
"throw",
"new",
"DataGridException",
"(",
"\"ColumnS... | Handler for column status
@param string $id
@param string $key
@param string $value
@return void | [
"Handler",
"for",
"column",
"status"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2572-L2579 |
contributte/datagrid | src/DataGrid.php | DataGrid.redrawItem | public function redrawItem($id, $primary_where_column = null)
{
$this->snippets_set = true;
$this->redraw_item = [($primary_where_column ?: $this->primary_key) => $id];
$this->redrawControl('items');
$this->getPresenter()->payload->_datagrid_url = $this->refresh_url;
$this->onRedraw();
} | php | public function redrawItem($id, $primary_where_column = null)
{
$this->snippets_set = true;
$this->redraw_item = [($primary_where_column ?: $this->primary_key) => $id];
$this->redrawControl('items');
$this->getPresenter()->payload->_datagrid_url = $this->refresh_url;
$this->onRedraw();
} | [
"public",
"function",
"redrawItem",
"(",
"$",
"id",
",",
"$",
"primary_where_column",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"snippets_set",
"=",
"true",
";",
"$",
"this",
"->",
"redraw_item",
"=",
"[",
"(",
"$",
"primary_where_column",
"?",
":",
"$",... | Redraw just one row via ajax
@param int $id
@param mixed $primary_where_column
@return void | [
"Redraw",
"just",
"one",
"row",
"via",
"ajax"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2588-L2599 |
contributte/datagrid | src/DataGrid.php | DataGrid.handleShowAllColumns | public function handleShowAllColumns()
{
$this->deleteSessionData('_grid_hidden_columns');
$this->saveSessionData('_grid_hidden_columns_manipulated', true);
$this->redrawControl();
$this->onRedraw();
} | php | public function handleShowAllColumns()
{
$this->deleteSessionData('_grid_hidden_columns');
$this->saveSessionData('_grid_hidden_columns_manipulated', true);
$this->redrawControl();
$this->onRedraw();
} | [
"public",
"function",
"handleShowAllColumns",
"(",
")",
"{",
"$",
"this",
"->",
"deleteSessionData",
"(",
"'_grid_hidden_columns'",
")",
";",
"$",
"this",
"->",
"saveSessionData",
"(",
"'_grid_hidden_columns_manipulated'",
",",
"true",
")",
";",
"$",
"this",
"->",... | Tell datagrid to display all columns
@return void | [
"Tell",
"datagrid",
"to",
"display",
"all",
"columns"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2606-L2614 |
contributte/datagrid | src/DataGrid.php | DataGrid.handleShowDefaultColumns | public function handleShowDefaultColumns()
{
$this->deleteSessionData('_grid_hidden_columns');
$this->saveSessionData('_grid_hidden_columns_manipulated', false);
$this->redrawControl();
$this->onRedraw();
} | php | public function handleShowDefaultColumns()
{
$this->deleteSessionData('_grid_hidden_columns');
$this->saveSessionData('_grid_hidden_columns_manipulated', false);
$this->redrawControl();
$this->onRedraw();
} | [
"public",
"function",
"handleShowDefaultColumns",
"(",
")",
"{",
"$",
"this",
"->",
"deleteSessionData",
"(",
"'_grid_hidden_columns'",
")",
";",
"$",
"this",
"->",
"saveSessionData",
"(",
"'_grid_hidden_columns_manipulated'",
",",
"false",
")",
";",
"$",
"this",
... | Tell datagrid to display default columns
@return void | [
"Tell",
"datagrid",
"to",
"display",
"default",
"columns"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2621-L2629 |
contributte/datagrid | src/DataGrid.php | DataGrid.handleShowColumn | public function handleShowColumn($column)
{
$columns = $this->getSessionData('_grid_hidden_columns');
if (!empty($columns)) {
$pos = array_search($column, $columns, true);
if ($pos !== false) {
unset($columns[$pos]);
}
}
$this->saveSessionData('_grid_hidden_columns', $columns);
$this->saveSes... | php | public function handleShowColumn($column)
{
$columns = $this->getSessionData('_grid_hidden_columns');
if (!empty($columns)) {
$pos = array_search($column, $columns, true);
if ($pos !== false) {
unset($columns[$pos]);
}
}
$this->saveSessionData('_grid_hidden_columns', $columns);
$this->saveSes... | [
"public",
"function",
"handleShowColumn",
"(",
"$",
"column",
")",
"{",
"$",
"columns",
"=",
"$",
"this",
"->",
"getSessionData",
"(",
"'_grid_hidden_columns'",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"columns",
")",
")",
"{",
"$",
"pos",
"=",
"ar... | Reveal particular column
@param string $column
@return void | [
"Reveal",
"particular",
"column"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2637-L2655 |
contributte/datagrid | src/DataGrid.php | DataGrid.handleHideColumn | public function handleHideColumn($column)
{
/**
* Store info about hiding a column to session
*/
$columns = $this->getSessionData('_grid_hidden_columns');
if (empty($columns)) {
$columns = [$column];
} elseif (!in_array($column, $columns, true)) {
array_push($columns, $column);
}
$this->saveS... | php | public function handleHideColumn($column)
{
/**
* Store info about hiding a column to session
*/
$columns = $this->getSessionData('_grid_hidden_columns');
if (empty($columns)) {
$columns = [$column];
} elseif (!in_array($column, $columns, true)) {
array_push($columns, $column);
}
$this->saveS... | [
"public",
"function",
"handleHideColumn",
"(",
"$",
"column",
")",
"{",
"/**\n\t\t * Store info about hiding a column to session\n\t\t */",
"$",
"columns",
"=",
"$",
"this",
"->",
"getSessionData",
"(",
"'_grid_hidden_columns'",
")",
";",
"if",
"(",
"empty",
"(",
"$",... | Notice datagrid to not display particular columns
@param string $column
@return void | [
"Notice",
"datagrid",
"to",
"not",
"display",
"particular",
"columns"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2663-L2682 |
contributte/datagrid | src/DataGrid.php | DataGrid.setItemsPerPageList | public function setItemsPerPageList(array $items_per_page_list, $include_all = true)
{
$this->items_per_page_list = $items_per_page_list;
if ($include_all) {
$this->items_per_page_list[] = 'all';
}
return $this;
} | php | public function setItemsPerPageList(array $items_per_page_list, $include_all = true)
{
$this->items_per_page_list = $items_per_page_list;
if ($include_all) {
$this->items_per_page_list[] = 'all';
}
return $this;
} | [
"public",
"function",
"setItemsPerPageList",
"(",
"array",
"$",
"items_per_page_list",
",",
"$",
"include_all",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"items_per_page_list",
"=",
"$",
"items_per_page_list",
";",
"if",
"(",
"$",
"include_all",
")",
"{",
"$",... | Set options of select "items_per_page"
@param array $items_per_page_list
@return static | [
"Set",
"options",
"of",
"select",
"items_per_page"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2707-L2716 |
contributte/datagrid | src/DataGrid.php | DataGrid.findDefaultPerPage | public function findDefaultPerPage()
{
if (!empty($this->per_page)) {
return;
}
if (!empty($this->default_per_page)) {
$this->per_page = $this->default_per_page;
}
$this->saveSessionData('_grid_per_page', $this->per_page);
} | php | public function findDefaultPerPage()
{
if (!empty($this->per_page)) {
return;
}
if (!empty($this->default_per_page)) {
$this->per_page = $this->default_per_page;
}
$this->saveSessionData('_grid_per_page', $this->per_page);
} | [
"public",
"function",
"findDefaultPerPage",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"per_page",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"default_per_page",
")",
")",
"{",
"$",
"thi... | User may set default "items per page" value, apply it
@return void | [
"User",
"may",
"set",
"default",
"items",
"per",
"page",
"value",
"apply",
"it"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2736-L2747 |
contributte/datagrid | src/DataGrid.php | DataGrid.createComponentPaginator | public function createComponentPaginator()
{
/**
* Init paginator
*/
$component = new Components\DataGridPaginator\DataGridPaginator(
$this->getTranslator(),
static::$icon_prefix
);
$paginator = $component->getPaginator();
$paginator->setPage($this->page);
$paginator->setItemsPerPage($this->ge... | php | public function createComponentPaginator()
{
/**
* Init paginator
*/
$component = new Components\DataGridPaginator\DataGridPaginator(
$this->getTranslator(),
static::$icon_prefix
);
$paginator = $component->getPaginator();
$paginator->setPage($this->page);
$paginator->setItemsPerPage($this->ge... | [
"public",
"function",
"createComponentPaginator",
"(",
")",
"{",
"/**\n\t\t * Init paginator\n\t\t */",
"$",
"component",
"=",
"new",
"Components",
"\\",
"DataGridPaginator",
"\\",
"DataGridPaginator",
"(",
"$",
"this",
"->",
"getTranslator",
"(",
")",
",",
"static",
... | Paginator factory
@return Components\DataGridPaginator\DataGridPaginator | [
"Paginator",
"factory"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2754-L2773 |
contributte/datagrid | src/DataGrid.php | DataGrid.getPerPage | public function getPerPage()
{
$items_per_page_list = array_keys($this->getItemsPerPageList());
$per_page = $this->per_page ?: reset($items_per_page_list);
if (($per_page !== 'all' && !in_array((int) $this->per_page, $items_per_page_list, true))
|| ($per_page === 'all' && !in_array($this->per_page, $items_p... | php | public function getPerPage()
{
$items_per_page_list = array_keys($this->getItemsPerPageList());
$per_page = $this->per_page ?: reset($items_per_page_list);
if (($per_page !== 'all' && !in_array((int) $this->per_page, $items_per_page_list, true))
|| ($per_page === 'all' && !in_array($this->per_page, $items_p... | [
"public",
"function",
"getPerPage",
"(",
")",
"{",
"$",
"items_per_page_list",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"getItemsPerPageList",
"(",
")",
")",
";",
"$",
"per_page",
"=",
"$",
"this",
"->",
"per_page",
"?",
":",
"reset",
"(",
"$",
"items_... | Get parameter per_page
@return int | [
"Get",
"parameter",
"per_page"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2780-L2792 |
contributte/datagrid | src/DataGrid.php | DataGrid.getItemsPerPageList | public function getItemsPerPageList()
{
if (empty($this->items_per_page_list)) {
$this->setItemsPerPageList([10, 20, 50], true);
}
$list = array_flip($this->items_per_page_list);
foreach ($list as $key => $value) {
$list[$key] = $key;
}
if (array_key_exists('all', $list)) {
$list['all'] = $this... | php | public function getItemsPerPageList()
{
if (empty($this->items_per_page_list)) {
$this->setItemsPerPageList([10, 20, 50], true);
}
$list = array_flip($this->items_per_page_list);
foreach ($list as $key => $value) {
$list[$key] = $key;
}
if (array_key_exists('all', $list)) {
$list['all'] = $this... | [
"public",
"function",
"getItemsPerPageList",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"items_per_page_list",
")",
")",
"{",
"$",
"this",
"->",
"setItemsPerPageList",
"(",
"[",
"10",
",",
"20",
",",
"50",
"]",
",",
"true",
")",
";",
... | Get associative array of items_per_page_list
@return array | [
"Get",
"associative",
"array",
"of",
"items_per_page_list"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2799-L2816 |
contributte/datagrid | src/DataGrid.php | DataGrid.setColumnsOrder | public function setColumnsOrder($order)
{
$new_order = [];
foreach ($order as $key) {
if (isset($this->columns[$key])) {
$new_order[$key] = $this->columns[$key];
}
}
if (sizeof($new_order) === sizeof($this->columns)) {
$this->columns = $new_order;
} else {
throw new DataGridException('When ... | php | public function setColumnsOrder($order)
{
$new_order = [];
foreach ($order as $key) {
if (isset($this->columns[$key])) {
$new_order[$key] = $this->columns[$key];
}
}
if (sizeof($new_order) === sizeof($this->columns)) {
$this->columns = $new_order;
} else {
throw new DataGridException('When ... | [
"public",
"function",
"setColumnsOrder",
"(",
"$",
"order",
")",
"{",
"$",
"new_order",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"order",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"columns",
"[",
"$",
"key",
"]",
")"... | Set order of datagrid columns
@param array $order
@return static | [
"Set",
"order",
"of",
"datagrid",
"columns"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2898-L2915 |
contributte/datagrid | src/DataGrid.php | DataGrid.getSessionData | public function getSessionData($key = null, $default_value = null)
{
if (!$this->remember_state) {
return $key ? $default_value : [];
}
return ($key ? $this->grid_session->{$key} : $this->grid_session) ?: $default_value;
} | php | public function getSessionData($key = null, $default_value = null)
{
if (!$this->remember_state) {
return $key ? $default_value : [];
}
return ($key ? $this->grid_session->{$key} : $this->grid_session) ?: $default_value;
} | [
"public",
"function",
"getSessionData",
"(",
"$",
"key",
"=",
"null",
",",
"$",
"default_value",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"remember_state",
")",
"{",
"return",
"$",
"key",
"?",
"$",
"default_value",
":",
"[",
"]",
";"... | Get session data if functionality is enabled
@param string $key
@return mixed | [
"Get",
"session",
"data",
"if",
"functionality",
"is",
"enabled"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L2975-L2982 |
contributte/datagrid | src/DataGrid.php | DataGrid.setItemsDetail | public function setItemsDetail($detail = true, $primary_where_column = null)
{
if ($this->isSortable()) {
throw new DataGridException('You can not use both sortable datagrid and items detail.');
}
$this->items_detail = new Column\ItemDetail(
$this,
$primary_where_column ?: $this->primary_key
);
if... | php | public function setItemsDetail($detail = true, $primary_where_column = null)
{
if ($this->isSortable()) {
throw new DataGridException('You can not use both sortable datagrid and items detail.');
}
$this->items_detail = new Column\ItemDetail(
$this,
$primary_where_column ?: $this->primary_key
);
if... | [
"public",
"function",
"setItemsDetail",
"(",
"$",
"detail",
"=",
"true",
",",
"$",
"primary_where_column",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSortable",
"(",
")",
")",
"{",
"throw",
"new",
"DataGridException",
"(",
"'You can not use both... | Items can have thair detail - toggled
@param mixed $detail callable|string|bool
@param string|null $primary_where_column
@return Column\ItemDetail | [
"Items",
"can",
"have",
"thair",
"detail",
"-",
"toggled"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L3042-L3080 |
contributte/datagrid | src/DataGrid.php | DataGrid.setColumnsSummary | public function setColumnsSummary(array $columns, $rowCallback = null)
{
if ($this->hasSomeAggregationFunction()) {
throw new DataGridException('You can use either ColumnsSummary or AggregationFunctions');
}
if (!empty($rowCallback)) {
if (!is_callable($rowCallback)) {
throw new \InvalidArgumentExcept... | php | public function setColumnsSummary(array $columns, $rowCallback = null)
{
if ($this->hasSomeAggregationFunction()) {
throw new DataGridException('You can use either ColumnsSummary or AggregationFunctions');
}
if (!empty($rowCallback)) {
if (!is_callable($rowCallback)) {
throw new \InvalidArgumentExcept... | [
"public",
"function",
"setColumnsSummary",
"(",
"array",
"$",
"columns",
",",
"$",
"rowCallback",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasSomeAggregationFunction",
"(",
")",
")",
"{",
"throw",
"new",
"DataGridException",
"(",
"'You can use eit... | Set columns to be summarized in the end.
@param array $columns
@param callable $rowCallback
@return \Ublaboo\DataGrid\ColumnsSummary | [
"Set",
"columns",
"to",
"be",
"summarized",
"in",
"the",
"end",
"."
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L3344-L3359 |
contributte/datagrid | src/DataGrid.php | DataGrid.getFilterSubmitButton | public function getFilterSubmitButton()
{
if ($this->hasAutoSubmit()) {
throw new DataGridException(
'DataGrid has auto-submit. Turn it off before setting filter submit button.'
);
}
if ($this->filter_submit_button === null) {
$this->filter_submit_button = new Filter\SubmitButton($this);
}
ret... | php | public function getFilterSubmitButton()
{
if ($this->hasAutoSubmit()) {
throw new DataGridException(
'DataGrid has auto-submit. Turn it off before setting filter submit button.'
);
}
if ($this->filter_submit_button === null) {
$this->filter_submit_button = new Filter\SubmitButton($this);
}
ret... | [
"public",
"function",
"getFilterSubmitButton",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasAutoSubmit",
"(",
")",
")",
"{",
"throw",
"new",
"DataGridException",
"(",
"'DataGrid has auto-submit. Turn it off before setting filter submit button.'",
")",
";",
"}",
"i... | Submit button when no auto-submitting is used
@return Filter\SubmitButton | [
"Submit",
"button",
"when",
"no",
"auto",
"-",
"submitting",
"is",
"used"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L3401-L3414 |
contributte/datagrid | src/DataGrid.php | DataGrid.getColumnsCount | public function getColumnsCount()
{
$count = sizeof($this->getColumns());
if (!empty($this->actions)
|| $this->isSortable()
|| $this->getItemsDetail()
|| $this->getInlineEdit()
|| $this->getInlineAdd()) {
$count++;
}
if ($this->hasGroupActions()) {
$count++;
}
return $count;
} | php | public function getColumnsCount()
{
$count = sizeof($this->getColumns());
if (!empty($this->actions)
|| $this->isSortable()
|| $this->getItemsDetail()
|| $this->getInlineEdit()
|| $this->getInlineAdd()) {
$count++;
}
if ($this->hasGroupActions()) {
$count++;
}
return $count;
} | [
"public",
"function",
"getColumnsCount",
"(",
")",
"{",
"$",
"count",
"=",
"sizeof",
"(",
"$",
"this",
"->",
"getColumns",
"(",
")",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"actions",
")",
"||",
"$",
"this",
"->",
"isSortable",
"... | Get count of columns
@return int | [
"Get",
"count",
"of",
"columns"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L3426-L3443 |
contributte/datagrid | src/DataGrid.php | DataGrid.getColumns | public function getColumns()
{
$return = $this->columns;
try {
$this->getParent();
if (!$this->getSessionData('_grid_hidden_columns_manipulated', false)) {
$columns_to_hide = [];
foreach ($this->columns as $key => $column) {
if ($column->getDefaultHide()) {
$columns_to_hide[] = $key;
... | php | public function getColumns()
{
$return = $this->columns;
try {
$this->getParent();
if (!$this->getSessionData('_grid_hidden_columns_manipulated', false)) {
$columns_to_hide = [];
foreach ($this->columns as $key => $column) {
if ($column->getDefaultHide()) {
$columns_to_hide[] = $key;
... | [
"public",
"function",
"getColumns",
"(",
")",
"{",
"$",
"return",
"=",
"$",
"this",
"->",
"columns",
";",
"try",
"{",
"$",
"this",
"->",
"getParent",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"getSessionData",
"(",
"'_grid_hidden_columns_manipula... | Get set of set columns
@return Column\Column[] | [
"Get",
"set",
"of",
"set",
"columns"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L3460-L3498 |
contributte/datagrid | src/DataGrid.php | DataGrid.handleRefreshState | public function handleRefreshState()
{
$this->findSessionValues();
$this->findDefaultFilter();
$this->findDefaultSort();
$this->findDefaultPerPage();
$this->getPresenter()->payload->_datagrid_url = $this->refresh_url;
$this->redrawControl('non-existing-snippet');
} | php | public function handleRefreshState()
{
$this->findSessionValues();
$this->findDefaultFilter();
$this->findDefaultSort();
$this->findDefaultPerPage();
$this->getPresenter()->payload->_datagrid_url = $this->refresh_url;
$this->redrawControl('non-existing-snippet');
} | [
"public",
"function",
"handleRefreshState",
"(",
")",
"{",
"$",
"this",
"->",
"findSessionValues",
"(",
")",
";",
"$",
"this",
"->",
"findDefaultFilter",
"(",
")",
";",
"$",
"this",
"->",
"findDefaultSort",
"(",
")",
";",
"$",
"this",
"->",
"findDefaultPer... | Simply refresh url
@return void | [
"Simply",
"refresh",
"url"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/DataGrid.php#L3562-L3571 |
contributte/datagrid | src/Column/ActionCallback.php | ActionCallback.createLink | protected function createLink(DataGrid $grid, $href, $params)
{
/**
* Int case of ActionCallback, $this->href is a identifier of user callback
*/
$params = $params + ['__key' => $this->href];
return $this->grid->link('actionCallback!', $params);
} | php | protected function createLink(DataGrid $grid, $href, $params)
{
/**
* Int case of ActionCallback, $this->href is a identifier of user callback
*/
$params = $params + ['__key' => $this->href];
return $this->grid->link('actionCallback!', $params);
} | [
"protected",
"function",
"createLink",
"(",
"DataGrid",
"$",
"grid",
",",
"$",
"href",
",",
"$",
"params",
")",
"{",
"/**\n\t\t * Int case of ActionCallback, $this->href is a identifier of user callback\n\t\t */",
"$",
"params",
"=",
"$",
"params",
"+",
"[",
"'__key'",
... | Create link to datagrid::handleActionCallback() to fire custom callback
@param DataGrid $grid
@param string $href
@param array $params
@return string | [
"Create",
"link",
"to",
"datagrid",
"::",
"handleActionCallback",
"()",
"to",
"fire",
"custom",
"callback"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/Column/ActionCallback.php#L32-L40 |
contributte/datagrid | src/Column/ColumnDateTime.php | ColumnDateTime.getColumnValue | public function getColumnValue(Row $row)
{
$value = parent::getColumnValue($row);
if (!($value instanceof DateTime)) {
/**
* Try to convert string to DateTime object
*/
try {
$date = DateTimeHelper::tryConvertToDateTime($value);
return $date->format($this->format);
} catch (DataGridDateT... | php | public function getColumnValue(Row $row)
{
$value = parent::getColumnValue($row);
if (!($value instanceof DateTime)) {
/**
* Try to convert string to DateTime object
*/
try {
$date = DateTimeHelper::tryConvertToDateTime($value);
return $date->format($this->format);
} catch (DataGridDateT... | [
"public",
"function",
"getColumnValue",
"(",
"Row",
"$",
"row",
")",
"{",
"$",
"value",
"=",
"parent",
"::",
"getColumnValue",
"(",
"$",
"row",
")",
";",
"if",
"(",
"!",
"(",
"$",
"value",
"instanceof",
"DateTime",
")",
")",
"{",
"/**\n\t\t\t * Try to co... | Format row item value as DateTime
@param Row $row
@return string | [
"Format",
"row",
"item",
"value",
"as",
"DateTime"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/Column/ColumnDateTime.php#L34-L55 |
contributte/datagrid | src/Traits/TLink.php | TLink.createLink | protected function createLink(DataGrid $grid, $href, $params)
{
$targetComponent = $grid;
if (strpos($href, ':') !== false) {
return $grid->getPresenter()->link($href, $params);
}
for ($iteration = 0; $iteration < 10; $iteration++) {
$targetComponent = $targetComponent->getParent();
if ($targetComp... | php | protected function createLink(DataGrid $grid, $href, $params)
{
$targetComponent = $grid;
if (strpos($href, ':') !== false) {
return $grid->getPresenter()->link($href, $params);
}
for ($iteration = 0; $iteration < 10; $iteration++) {
$targetComponent = $targetComponent->getParent();
if ($targetComp... | [
"protected",
"function",
"createLink",
"(",
"DataGrid",
"$",
"grid",
",",
"$",
"href",
",",
"$",
"params",
")",
"{",
"$",
"targetComponent",
"=",
"$",
"grid",
";",
"if",
"(",
"strpos",
"(",
"$",
"href",
",",
"':'",
")",
"!==",
"false",
")",
"{",
"r... | Create link to custom destination
@param DataGrid $grid
@param string $href
@param array $params
@return string
@throws DataGridHasToBeAttachedToPresenterComponentException
@throws \InvalidArgumentException
@throws DataGridLinkCreationException | [
"Create",
"link",
"to",
"custom",
"destination"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/Traits/TLink.php#L31-L77 |
contributte/datagrid | src/Export/ExportCsv.php | ExportCsv.invoke | public function invoke(array $data)
{
$columns = $this->getColumns() ?: $this->grid->getColumns();
$csv_data_model = new CsvDataModel($data, $columns, $this->grid->getTranslator());
if ($this->grid->getPresenter() instanceof Nette\Application\UI\Presenter) {
$this->grid->getPresenter()->sendResponse(new CSV... | php | public function invoke(array $data)
{
$columns = $this->getColumns() ?: $this->grid->getColumns();
$csv_data_model = new CsvDataModel($data, $columns, $this->grid->getTranslator());
if ($this->grid->getPresenter() instanceof Nette\Application\UI\Presenter) {
$this->grid->getPresenter()->sendResponse(new CSV... | [
"public",
"function",
"invoke",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"columns",
"=",
"$",
"this",
"->",
"getColumns",
"(",
")",
"?",
":",
"$",
"this",
"->",
"grid",
"->",
"getColumns",
"(",
")",
";",
"$",
"csv_data_model",
"=",
"new",
"CsvDataMo... | Call export callback
@param array $data
@return void | [
"Call",
"export",
"callback"
] | train | https://github.com/contributte/datagrid/blob/a4e392e1ddef6a442eaea8dfa9bffaeef96a45d1/src/Export/ExportCsv.php#L92-L109 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.