Exemplo n.º 1
0
 public function addCrudColumn()
 {
     if ($this->getTwitterBoostrapVersion() == '2.3.*') {
         $iconEdit = 'icon-pencil';
         $iconView = 'icon-eye-open';
         $iconDelete = 'icon-trash';
     } else {
         $iconEdit = 'glyphicon glyphicon-pencil';
         $iconView = 'glyphicon glyphicon-eye-open';
         $iconDelete = 'glyphicon glyphicon-trash';
     }
     $identity = $this->formatIdentityColumns();
     $actionviewCrud = new Column\Action\Icon();
     $actionviewCrud->setIconTheme($this->getTwitterBoostrapVersion());
     $actionviewCrud->setIconClass($iconView);
     $actionviewCrud->setAttribute('id', 'viewCrud');
     $actionviewCrud->setAttribute('href', "?op=v&{$identity}=" . $actionviewCrud->getRowIdPlaceholder());
     if (isset($this->crudOption['viewCrud'])) {
         $actionviewCrud->addShowOnValue($this->crudOption['viewCrud']['field'], $this->crudOption['viewCrud']['filter']);
         if (isset($this->crudOption['viewCrud']['js'])) {
             $actionviewCrud->setAttribute('onclick', "{$this->crudOption['viewCrud']['js']}");
         }
     }
     // $action = new Column\Action\Button ();
     $actionedit = new Column\Action\Icon();
     // $action->setLabel ( $this->getTranslator ()->translate ( 'Edit' ) );
     $actionedit->setIconTheme($this->getTwitterBoostrapVersion());
     $actionedit->setIconClass($iconEdit);
     $actionedit->setAttribute('id', 'editCrud');
     $actionedit->setAttribute('href', "?op=u&{$identity}=" . $actionedit->getRowIdPlaceholder());
     if (isset($this->crudOption['editCrud'])) {
         $actionedit->addShowOnValue($this->crudOption['editCrud']['field'], $this->crudOption['editCrud']['filter']);
         if (isset($this->crudOption['editCrud']['js'])) {
             $actionedit->setAttribute('onclick', "{$this->crudOption['editCrud']['js']}");
         }
     }
     $actiondel = new Column\Action\Icon();
     // $actiondel->setLabel ( $this->getTranslator ()->translate ( 'Delete' ) );
     $actiondel->setIconClass($iconDelete);
     $actiondel->setIconTheme($this->getTwitterBoostrapVersion());
     $actiondel->setAttribute('id', 'deleteCrud');
     $actiondel->setAttribute('href', "?op=d&{$identity}=" . $actiondel->getRowIdPlaceholder());
     // $actiondel->setAttribute ( 'href', "#");
     if (isset($this->crudOption['deleteCrud'])) {
         $actiondel->addShowOnValue($this->crudOption['deleteCrud']['field'], $this->crudOption['deleteCrud']['filter']);
         if (isset($this->crudOption['deleteCrud']['js'])) {
             $actiondel->setAttribute('onclick', "{$this->crudOption['deleteCrud']['js']}");
         }
     }
     $col = new Column\Action();
     $col->setLabel($this->getTranslator()->translate('Operation'));
     $col->setWidth(0.5);
     if ($this->getisAllowView()) {
         $col->addAction($actionviewCrud);
     }
     if ($this->getisAllowEdit()) {
         $col->addAction($actionedit);
     }
     if ($this->getisAllowDelete()) {
         $col->addAction($actiondel);
     }
     $this->prependColumn($col);
 }
Exemplo n.º 2
0
 /**
  * @expectedException  InvalidArgumentException
  */
 public function testException()
 {
     $icon = new Icon();
     $this->setExpectedException('InvalidArgumentException');
     $icon->toHtml(array());
 }