本文整理汇总了PHP中APY\DataGridBundle\Grid\Source\Entity::setData方法的典型用法代码示例。如果您正苦于以下问题:PHP Entity::setData方法的具体用法?PHP Entity::setData怎么用?PHP Entity::setData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类APY\DataGridBundle\Grid\Source\Entity
的用法示例。
在下文中一共展示了Entity::setData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
/**
* @Route("/")
*/
public function indexAction(Request $request)
{
$source = new Entity('ChamiloNotebookBundle:CNotebook');
$course = $this->getCourse();
/* @var $grid \APY\DataGridBundle\Grid\Grid */
$grid = $this->get('grid');
/*$tableAlias = $source->getTableAlias();
$source->manipulateQuery(function (QueryBuilder $query) use ($tableAlias, $course) {
$query->andWhere($tableAlias . '.cId = '.$course->getId());
//$query->resetDQLPart('orderBy');
}
);*/
/** @var NotebookRepository $repository */
$repository = $this->getRepository();
$resources = $repository->getResourceByCourse($course);
$source->setData($resources);
$grid->setSource($source);
//$grid->hideFilters();
$grid->setLimits(5);
//$grid->isReadyForRedirect();
//$grid->setMaxResults(1);
//$grid->setLimits(2);
/*$grid->getColumn('id')->manipulateRenderCell(
function ($value, $row, $router) use ($course) {
//$router = $this->get('router');
return $router->generate(
'chamilo_notebook_show',
array('id' => $row->getField('id'), 'course' => $course)
);
}
);*/
if ($this->isGranted(ResourceNodeVoter::ROLE_CURRENT_COURSE_TEACHER)) {
$deleteMassAction = new MassAction('Delete', 'chamilo.controller.notebook:deleteMassAction', true, array('course' => $request->get('course')));
$grid->addMassAction($deleteMassAction);
}
$myRowAction = new RowAction($this->trans('View'), 'chamilo_notebook_show', false, '_self', array('class' => 'btn btn-default'));
$myRowAction->setRouteParameters(array('course' => $course, 'id'));
$grid->addRowAction($myRowAction);
if ($this->isGranted(ResourceNodeVoter::ROLE_CURRENT_COURSE_TEACHER)) {
$myRowAction = new RowAction($this->trans('Edit'), 'chamilo_notebook_edit', false, '_self', array('class' => 'btn btn-info'));
$myRowAction->setRouteParameters(array('course' => $course, 'id'));
$grid->addRowAction($myRowAction);
$myRowAction = new RowAction($this->trans('Delete'), 'chamilo_notebook_delete', false, '_self', array('class' => 'btn btn-danger', 'form_delete' => true));
$myRowAction->setRouteParameters(array('course' => $course, 'id'));
$grid->addRowAction($myRowAction);
}
$grid->addExport(new CSVExport($this->trans('CSV Export'), 'export', array('course' => $course)));
$grid->addExport(new ExcelExport($this->trans('Excel Export'), 'export', array('course' => $course)));
return $grid->getGridResponse('ChamiloNotebookBundle:Notebook:index.html.twig');
}
示例2: indexAction
/**
* @Route("/")
*/
public function indexAction(Request $request)
{
$source = new Entity('ChamiloNotebookBundle:CNotebook');
$course = $this->getCourse();
/* @var $grid \APY\DataGridBundle\Grid\Grid */
$grid = $this->get('grid');
/** @var NotebookRepository $repository */
$repository = $this->getRepository();
$resources = $repository->getResourceByCourse($course);
$source->setData($resources);
$grid->setSource($source);
//$grid->hideFilters();
$grid->setLimits(5);
//$grid->isReadyForRedirect();
// Delete Mass
if ($this->isGranted(ResourceNodeVoter::ROLE_CURRENT_COURSE_TEACHER)) {
$deleteMassAction = new MassAction('Delete', 'chamilo_notebook.controller.notebook:deleteMassAction', true, array('course' => $request->get('course')));
$grid->addMassAction($deleteMassAction);
}
// Show
$myRowAction = new RowAction($this->trans('View'), 'chamilo_notebook_show', false, '_self', array('class' => 'btn btn-default'));
$myRowAction->setRouteParameters(array('course' => $course, 'id'));
$grid->addRowAction($myRowAction);
if ($this->isGranted(ResourceNodeVoter::ROLE_CURRENT_COURSE_TEACHER)) {
// Edit
$myRowAction = new RowAction($this->trans('Edit'), 'chamilo_notebook_edit', false, '_self', array('class' => 'btn btn-info'));
$myRowAction->setRouteParameters(array('course' => $course, 'id'));
$grid->addRowAction($myRowAction);
// Delete
$myRowAction = new RowAction($this->trans('Delete'), 'chamilo_notebook_delete', false, '_self', array('class' => 'btn btn-danger', 'form_delete' => true));
$myRowAction->setRouteParameters(array('course' => $course, 'id'));
$grid->addRowAction($myRowAction);
}
// Exports
$grid->addExport(new CSVExport($this->trans('CSV Export'), 'export', array('course' => $course)));
$grid->addExport(new ExcelExport($this->trans('Excel Export'), 'export', array('course' => $course)));
return $grid->getGridResponse('ChamiloNotebookBundle:Notebook:index.html.twig');
}