Exemple #1
0
 /**
  * Generates databrowser for listing available users for managing.
  *
  * @param string $formName name of control to use (e.g. as class name)
  * @param browseable $list list of users
  * @param object $urls URLs to use in properties edit, add and delete (containing %s to be replaced by a user's ID)
  * @return databrowser
  */
 protected function createBrowser($formName, browseable $list, $urls)
 {
     $this->setPanelControl('add', markup::link($urls->add, \de\toxa\txf\_L('add user')));
     return databrowser::create($list, \de\toxa\txf\_L('There is no user to be listed here.'), $formName)->addColumn('loginname', \de\toxa\txf\_L('login name'), true)->addColumn('name', \de\toxa\txf\_L('name'), true)->addColumn('email', \de\toxa\txf\_L('email'), true)->setRowCommander(function ($id, $record) use($urls) {
         return implode(' ', array_filter(array(markup::link(sprintf($urls->edit, $id), \de\toxa\txf\_L('edit')), $record['uuid'] !== user::current()->getUuid() ? markup::link(sprintf($urls->delete, $id), \de\toxa\txf\_L('delete')) : '')));
     })->setPagerVolatility('none');
 }
Exemple #2
0
 protected function prepareControl()
 {
     if (is_null($this->browser) && is_null($this->editor)) {
         if ($this->isListing()) {
             $this->browser = databrowser::create($this->modelClass->getMethod('browse')->invoke(null, $this->source));
         } else {
             if ($this->item) {
                 $this->editor = model_editor::createOnItem($this->source, $this->item);
             } else {
                 $this->editor = model_editor::createOnModel($this->source, $this->modelClass);
             }
         }
     }
     return $this;
 }