コード例 #1
0
ファイル: BrowserPresenter.php プロジェクト: OCC2/occ2pacs
 /**
  * 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;
 }
コード例 #2
0
 /**
  * factory to create a grid
  * @param string $name
  * @return \Ublaboo\DataGrid\DataGrid
  */
 public function createComponentRemoteNodesGrid($name)
 {
     // create object
     $grid = new \Ublaboo\DataGrid\DataGrid($this, $name);
     // set data source
     $grid->setDataSource($this->model->getTable());
     // set columns hidable
     $grid->setColumnsHideable();
     //add collumn name which is sortable and may be filtered
     $grid->addFilterText('name', _("Node name"));
     $colName = $grid->addColumnText('name', _("Node name"))->setSortable();
     if ($this->user->isAllowed("config", "edit")) {
         $colName->setEditableCallback(function ($id, $value) {
             $this->model->saveChanges($id, array("name" => $value, "activated" => 0));
             $this->flashMessage(_("Name was updated"), "success");
             $this->redirect("this");
         });
     }
     // add collumn Comment which is sortable and may be filtered
     $grid->addFilterText('comment', _("Comment"));
     $colComment = $grid->addColumnText('comment', _("Comment"))->setSortable();
     if ($this->user->isAllowed("config", "edit")) {
         $colComment->setEditableCallback(function ($id, $value) {
             $this->model->saveChanges($id, array("comment" => $value, "activated" => 0));
             $this->flashMessage(_("Comment was updated"), "success");
             $this->redirect("this");
         });
     }
     // add collumn AET which is sortable and may be filtered
     $grid->addFilterText('aet', _("AE title"));
     $colAet = $grid->addColumnText('aet', _("AE title"))->setSortable();
     if ($this->user->isAllowed("config", "edit")) {
         $colAet->setEditableCallback(function ($id, $value) {
             $this->model->saveChanges($id, array("aet" => $value, "activated" => 0));
             $this->flashMessage(_("AE title was updated"), "success");
             $this->redirect("this");
         });
     }
     // add collumn IP address which is sortable and may be filtered
     $grid->addFilterText('ip_address', _("IP address"));
     $colIp = $grid->addColumnText('ip_address', _("IP address"))->setSortable();
     if ($this->user->isAllowed("config", "edit")) {
         $colIp->setEditableCallback(function ($id, $value) {
             $this->model->saveChanges($id, array("ip_address" => $value, "activated" => 0));
             $this->flashMessage(_("IP address was updated"), "success");
             $this->redirect("this");
         });
     }
     // add collumn port which is sortable and may be filtered
     $grid->addFilterText('port', _("Port number"));
     $colPort = $grid->addColumnText('port', _("Port number"))->setSortable();
     if ($this->user->isAllowed("config", "edit")) {
         $colPort->setEditableCallback(function ($id, $value) {
             $this->model->saveChanges($id, array("port" => $value, "activated" => 0));
             $this->flashMessage(_("Port number was updated"), "success");
             $this->redirect("this");
         });
     }
     // add collumn group which is sortable and may be filtered
     $grid->addFilterSelect('group', _("Group"), $this->groups);
     $grid->addColumnText('group', _("Group"))->setSortable();
     // add collumn compression
     $grid->addFilterSelect('compression', _("Compression"), $this->compressions);
     $grid->addColumnText('compression', _("Compression"));
     // add column active which may be sortable and filtered
     if (!$this->user->isAllowed("config", "edit")) {
         $grid->addFilterSelect('active', _('Active?'), [1 => $this->answers[1], 0 => $this->answers[0], '' => _("All")]);
     } else {
         $grid->addColumnStatus('active', _("Active?"))->addOption(1, _("Yes"))->setIcon('check')->setClass('btn-success')->endOption()->addOption(0, _("No"))->setIcon('close')->setClass('btn-danger')->endOption()->onChange[] = function ($id, $newValue) {
             if (!$this->user->isAllowed("config", "edit")) {
                 $this->flashMessage(_("You are not allowed to do this action."), "danger");
                 $this->redirect("this");
             }
             try {
                 $this->model->changeActive($id, $newValue);
                 $this->redirect("this");
             } catch (RemoteNodesException $exc) {
                 $this->getPresenter()->flashMessage($exc->getMessage(), "danger");
                 $this->redirect("this");
             }
         };
     }
     // add action - delete if is allowed
     if ($this->user->isAllowed("config", "delete")) {
         $grid->addAction("delete!", _("Delete"))->setClass('btn btn-xs btn-danger')->setIcon("trash")->setConfirm(_('Do you really want to delete row') . ' %s?', 'comment');
     }
     $grid->setItemsPerPageList([10, 50, 100, 9999]);
     return $grid;
 }
コード例 #3
0
ファイル: PacsConfigPresenter.php プロジェクト: OCC2/occ2pacs
 /**
  * factory to create a grid
  * @param string $name
  * @return \Ublaboo\DataGrid\DataGrid
  */
 public function createComponentPacsConfigGrid($name)
 {
     // create object
     $grid = new \Ublaboo\DataGrid\DataGrid($this, $name);
     // set data source
     $grid->setDataSource($this->model->getTable());
     // set columns hidable
     $grid->setColumnsHideable();
     // add collumn Comment which is sortable and may be filtered
     $grid->addFilterText('comment', _('Comment'));
     $grid->addColumnText('comment', _('Comment'))->setSortable();
     // add collumn group which is sortable and may be filtered
     $grid->addFilterSelect('group', _('Group'), $this->groups);
     $grid->addColumnText('group', _('Group'))->setSortable();
     // add collumn item (dicom.ini key) which is sortable and may be filtered
     $grid->addFilterText('item', _('Item'));
     $grid->addColumnText('item', _('Item'))->setSortable();
     // add collumn value (dicom.ini value) which is sortable and may be filtered and if os authorized allowed inline editing
     $grid->addFilterText('value', _('Value'));
     $colValue = $grid->addColumnText('value', _('Value'))->setSortable();
     if ($this->user->isAllowed("config", "edit")) {
         $colValue->setEditableCallback(function ($id, $value) {
             if (!$this->user->isAllowed("config", "edit")) {
                 $this->flashMessage(_("You are not allowed to do this action."), "danger");
                 $this->redirect("this");
             }
             if ($this->model->isEditable($id) == true) {
                 $this->model->saveChanges($id, $value);
                 $this->flashMessage(_("Value was updated"), "success");
                 $this->redirect("this");
             } else {
                 $this->flashMessage(_("Sorry this is not editable value"), "warning");
                 $this->redirect("this");
             }
         });
     }
     // all non editable columns are grey
     $grid->setRowCallback(function ($item, $row) {
         if ($item->editable == 0) {
             $row->addClass("nonEditable");
         }
     });
     // add column active which may be sortable and filtered
     if (!$this->user->isAllowed("config", "edit")) {
         $grid->addFilterSelect('active', _('Active?'), [1 => $this->answers[1], 0 => $this->answers[0], '' => _("All")]);
     } else {
         $grid->addColumnStatus('active', _("Active?"))->addOption(1, _("Yes"))->setIcon('check')->setClass('btn-success')->endOption()->addOption(0, _("No"))->setIcon('close')->setClass('btn-danger')->endOption()->onChange[] = function ($id, $newValue) {
             if (!$this->user->isAllowed("config", "edit")) {
                 $this->flashMessage(_("You are not allowed to do this action."), "danger");
                 $this->redirect("this");
             }
             try {
                 $this->model->changeActive($id, $newValue);
                 $this->redirect("this");
             } catch (PacsConfigException $exc) {
                 $this->flashMessage($exc->getMessage(), "danger");
                 $this->redirect("this");
             }
         };
     }
     // add action - delete if is allowed
     if ($this->user->isAllowed("config", "delete")) {
         $grid->addAction("delete!", _("Delete"))->setClass('btn btn-xs btn-danger')->setIcon("trash")->setConfirm(_('Do you really want to delete row') . '%s?', 'comment');
         $grid->allowRowsAction('delete!', function ($item) {
             return $item->editable == 1;
         });
     }
     $grid->setItemsPerPageList([10, 50, 100, 9999]);
     return $grid;
 }
コード例 #4
0
ファイル: UseradminPresenter.php プロジェクト: OCC2/occ2pacs
 /**
  * factory to grid
  * @return UseradminGrid
  */
 public function createComponentUseradminGrid($name)
 {
     $grid = new \Ublaboo\DataGrid\DataGrid($this, $name);
     // set data source
     $grid->setDataSource($this->model->getTable());
     // set columns hidable
     $grid->setColumnsHideable();
     $grid->addFilterText('username', _("Login name"));
     $grid->addColumnText('username', _("Login name"))->setSortable();
     $grid->addFilterText('name', _("Real name"));
     $grid->addColumnText('name', _("Real name"))->setSortable()->setEditableCallback(function ($id, $value) {
         if (!$this->user->isAllowed("useradmin", "edit")) {
             $this->flashMessage(_("You are not allowed to do this action.", "danger"));
             $this->redirect("this");
         }
         $this->model->saveChanges($id, "name", $value);
         $this->getPresenter()->flashMessage(_("Real name was updated"), "success");
         $this->redirect("this");
     });
     $grid->addFilterText('email', _("Email"));
     $grid->addColumnText('email', _("Email"))->setSortable()->setEditableCallback(function ($id, $value) {
         if (!$this->user->isAllowed("useradmin", "edit")) {
             $this->flashMessage(_("You are not allowed to do this action.", "danger"));
             $this->redirect("this");
         }
         $this->model->saveChanges($id, "email", $value);
         $this->getPresenter()->flashMessage(_("Email was updated"), "success");
         $this->redirect("this");
     });
     $grid->addFilterText('refer_phys_key', _("Reference physician key"));
     $grid->addColumnText('refer_phys_key', _("Reference physician key"))->setSortable()->setEditableCallback(function ($id, $value) {
         if (!$this->user->isAllowed("useradmin", "edit")) {
             $this->flashMessage(_("You are not allowed to do this action.", "danger"));
             $this->redirect("this");
         }
         $this->model->saveChanges($id, "refer_phys_key", $value);
         $this->getPresenter()->flashMessage(_("Reference physician key was updated"), "success");
         $this->redirect("this");
     });
     $role = $grid->addColumnStatus('role', _("Users role"));
     foreach ($this->roles as $key => $value) {
         $role->addOption($key, $value)->setIcon('group')->setClass('btn-success')->endOption();
     }
     $role->onChange[] = function ($id, $newValue) {
         if (!$this->user->isAllowed("useradmin", "edit")) {
             $this->flashMessage(_("You are not allowed to do this action.", "danger"));
             $this->redirect("this");
         }
         try {
             $this->model->changeRole($id, $newValue);
             $this->flashMessage(_("Users's role was changed."), "success");
             $this->redirect("this");
         } catch (RemoteNodesException $exc) {
             $this->getPresenter()->flashMessage($exc->getMessage(), "danger");
             $this->redirect("this");
         }
     };
     $grid->addColumnStatus('enable', _("Enabled"))->addOption(1, _("Yes"))->setIcon('check')->setClass('btn-success')->endOption()->addOption(0, _("No"))->setIcon('close')->setClass('btn-danger')->endOption()->onChange[] = function ($id, $newValue) {
         if (!$this->user->isAllowed("useradmin", "edit")) {
             $this->flashMessage(_("You are not allowed to do this action.", "danger"));
             $this->redirect("this");
         }
         try {
             $this->model->changeStatus($id, $newValue);
             $this->flashMessage(_("User's status was changed"), "success");
             $this->redirect("this");
         } catch (RemoteNodesException $exc) {
             $this->getPresenter()->flashMessage($exc->getMessage(), "danger");
             $this->redirect("this");
         }
     };
     $lang = $grid->addColumnStatus('lang', _("Language"));
     foreach ($this->translator->getLanguages() as $key => $value) {
         $lang->addOption($key, $value)->endOption();
     }
     $lang->onChange[] = function ($id, $value) {
         if (!$this->user->isAllowed("useradmin", "edit")) {
             $this->flashMessage(_("You are not allowed to do this action.", "danger"));
             $this->redirect("this");
         }
         try {
             $this->model->saveChanges($id, "lang", $value);
             $this->flashMessage(_("User's language was changed"), "success");
             $this->redirect("this");
         } catch (RemoteNodesException $exc) {
             $this->flashMessage($exc->getMessage(), "danger");
             $this->redirect("this");
         }
     };
     // add action - delete if is allowed
     if ($this->user->isAllowed("useradmin", "edit")) {
         $grid->addAction("changePassword", _("Change password"))->setClass('btn btn-xs btn-warning')->setIcon("edit");
     }
     // add action - delete if is allowed
     if ($this->user->isAllowed("useradmin", "delete")) {
         $grid->addAction("delete!", _("Delete"))->setClass('btn btn-xs btn-danger')->setIcon("trash")->setConfirm(_('Do you really want to delete row ') . ' %s?', 'username');
     }
     return $grid;
 }
コード例 #5
0
ファイル: SopClassPresenter.php プロジェクト: OCC2/occ2pacs
 /**
  * factory to create grid
  * @param string $name
  * @return \Ublaboo\DataGrid\DataGrid
  */
 public function createComponentSopClassGrid($name)
 {
     // create object
     $grid = new \Ublaboo\DataGrid\DataGrid($this, $name);
     // set data source
     $grid->setDataSource($this->model->getTable());
     // set columns hidable
     $grid->setColumnsHideable();
     //add collumn SOP class name which is sortable and may be filtered
     $grid->addFilterText('name', _("SOP class name"));
     $colName = $grid->addColumnText('name', _("SOP class name"))->setSortable();
     if ($this->user->isAllowed("config", "edit")) {
         $colName->setEditableCallback(function ($id, $value) {
             $this->model->saveChanges($id, array("name" => $value, "activated" => 0));
             $this->flashMessage(_("SOP class name was updated"), "success");
             $this->redirect("this");
         });
     }
     // add collumn SOP class UIS which is sortable and may be filtered
     $grid->addFilterText('sop', _("SOP class UID"));
     $colSop = $grid->addColumnText('sop', _("SOP class UID"))->setSortable();
     if ($this->user->isAllowed("config", "edit")) {
         $colSop->setEditableCallback(function ($id, $value) {
             $this->model->saveChanges($id, array("sop" => $value, "activated" => 0));
             $this->flashMessage(_("SOP class UID was updated"), "success");
             $this->redirect("this");
         });
     }
     // add collumn aaplication type which is sortable and may be filtered
     $grid->addFilterText('application', _("SOP type"));
     $colApp = $grid->addColumnText('application', _("SOP type"))->setSortable();
     if ($this->user->isAllowed("config", "edit")) {
         $colApp->setEditableCallback(function ($id, $value) {
             $this->model->saveChanges($id, array("application" => $value, "activated" => 0));
             $this->flashMessage(_("Application type was updated"), "success");
             $this->redirect("this");
         });
     }
     // add collumn transfer which is sortable and may be filtered
     $grid->addFilterText('transfer', _("Transfer syntax (optional)"));
     $colTra = $grid->addColumnText('transfer', _("Transfer syntax (optional)"))->setSortable();
     if ($this->user->isAllowed("config", "edit")) {
         $colTra->setEditableCallback(function ($id, $value) {
             $this->model->saveChanges($id, array("transfer" => $value, "activated" => 0));
             $this->flashMessage(_("Transfer syntax was updated"), "success");
             $this->redirect("this");
         });
     }
     // add column active which may be sortable and filtered
     if (!$this->user->isAllowed("config", "edit")) {
         $grid->addFilterSelect('active', _('Active?'), [1 => $this->answers[1], 0 => $this->answers[0], '' => _("All")]);
     } else {
         $grid->addColumnStatus('active', _("Active?"))->addOption(1, _("Yes"))->setIcon('check')->setClass('btn-success')->endOption()->addOption(0, _("No"))->setIcon('close')->setClass('btn-danger')->endOption()->onChange[] = function ($id, $newValue) {
             if (!$this->user->isAllowed("config", "edit")) {
                 $this->flashMessage(_("You are not allowed to do this action."), "danger");
                 $this->redirect("this");
             }
             try {
                 $this->model->changeActive($id, $newValue);
                 $this->redirect("this");
             } catch (SopClassException $exc) {
                 $this->flashMessage($exc->getMessage(), "danger");
                 $this->redirect("this");
             }
         };
     }
     // add action - delete if is allowed
     if ($this->user->isAllowed("config", "delete")) {
         $grid->addAction("delete!", _("Delete"))->setClass('btn btn-xs btn-danger')->setIcon("trash")->setConfirm(_('Do you really want to delete row') . ' %s?', 'name');
     }
     $grid->setItemsPerPageList([10, 50, 100, 9999]);
     return $grid;
 }