/** * factory to grid component * @param string $name * @return \Ublaboo\DataGrid\DataGrid */ public function createComponentGrid($name) { $datasource = $this->model->getQuery()->study()->setDestination($this->remoteAet)->setRequestedFields($this->tableRows); if ($this->isExternist) { $datasource->addCondition("ReferringPhysicianName", $this->externistKey); } //create grid and set data source $grid = new \Ublaboo\DataGrid\DataGrid($this, $name); // setting datasource $grid->setPrimaryKey('StudyInstanceUID'); $grid->setDataSource($datasource); // setting outer filter rendering $grid->setOuterFilterRendering(TRUE); // set columns hidable $grid->setColumnsHideable(); //add collumn Patient ID which is sortable and may be filtered $grid->addColumnText('PatientID', _("PatientID"))->setSortable()->setFilterText(); //add collumn Patient Name which is sortable and may be filtered $grid->addColumnText('PatientName', _("Patient name"))->setSortable()->setFilterText(); //add collumn Study description Name which is sortable and may be filtered $grid->addColumnText('StudyDescription', _("Study description"))->setRenderer(function ($item) { return $this->model->query->encodeDicomName($item["StudyDescription"]); })->setSortable()->setFilterText(); //add collumn Patient Name which is sortable and may be filtered $grid->addColumnText('PatientSex', _("Patient sex"))->setSortable()->setRenderer(function ($item) { $sexItems = $this->model->query->getConfig()["patientSexItems"]; return $sexItems[\Nette\Utils\Strings::normalize($item["PatientSex"])]; })->setFilterSelect($this->model->query->getConfig()["patientSexItems"]); //add collumn Study modality which is sortable and may be filtered $grid->addColumnText('Modality', _("Study modality"))->setSortable()->setFilterText(); //add collumn Study date which is sortable and may be filtered $grid->addColumnDateTime('StudyDate', _("Study date"))->setFormat('Y-m-d')->setSortable()->setFilterDateRange(); $grid->addColumnDateTime('StudyTime', _("Study time"))->setSortable()->setRenderer(function ($item) { return $this->model->query->encodeTime($item["StudyTime"]); }); if ($this->isLocal) { // add action show $grid->addAction(':Data:Viewer:default', _('Open'))->setClass('btn btn-xs btn-default')->setIcon('folder-open-o'); // add action send # $grid->addAction('sendStudyForm!', _('Send'))->setIcon('upload')->setClass('btn btn-xs btn-default ajax modalOpen')->setDataAttribute("toggle", "modal")->setDataAttribute("target", "#sendFormModal"); // add action export $grid->addAction('export!', _('Export'))->setIcon('share-square-o')->setDataAttribute("toggle", "modal")->setDataAttribute("target", "#exportModal"); // add action delete if ($this->user->isAllowed("data", "delete")) { $grid->addAction('deleteStudy!', _('Delete'))->setIcon('trash-o')->setClass('btn btn-xs btn-default')->setConfirm(_('Do you really want to delete this study?')); } } else { // add action show $grid->addAction('open!', _('Open'))->setIcon('folder-open-o'); // add action retrieve # $grid->addAction('retrieve!', _('Retrieve'))->setDataAttribute("toggle", "modal")->setDataAttribute("target", "#retrieveModal")->setIcon('download'); } // setting pagination $grid->setItemsPerPageList([20, 50, 100, 500]); // return grid return $grid; }