コード例 #1
0
 /**
  * Get the file icons
  *
  * @param \MUtil_Model_Bridge_TableBridge $bridge
  * @return array $icon => $menuItem or array($menuItem, $other)
  */
 protected function getFileIcons(\MUtil_Model_Bridge_TableBridge $bridge)
 {
     $onDelete = new \MUtil_Html_OnClickArrayAttribute();
     $onDelete->addConfirm(\MUtil_Lazy::call('sprintf', $this->_("Are you sure you want to delete '%s'?"), $bridge->relpath));
     return array('process.png' => $this->findMenuItem($this->request->getControllerName(), 'import'), 'download.png' => $this->findMenuItem($this->request->getControllerName(), 'download'), 'eye.png' => $this->findMenuItem($this->request->getControllerName(), 'show'), 'edit.png' => $this->findMenuItem($this->request->getControllerName(), 'edit'), 'delete.png' => array($this->findMenuItem($this->request->getControllerName(), 'delete'), $onDelete));
 }
コード例 #2
0
 /**
  * Add a file upload/download page to the menu
  *
  * @param string $label         The label to display for the menu item, null for access without display
  * @param string $privilege     The privilege for the item, null is always, 'pr.islogin' must be logged in, 'pr.nologin' only when not logged in.
  * @param string $controller    What controller to use
  * @param string $action        The name of the action
  * @param array  $other         Array of extra options for this item, e.g. 'visible', 'allowed', 'class', 'icon', 'target', 'type', 'button_only'
  * @return \Gems_Menu_SubMenuItem
  */
 public function addFilePage($label, $privilege, $controller, array $other = array())
 {
     $page = $this->addPage($label, $privilege, $controller, 'index', $other);
     $page->addAutofilterAction();
     // $page->addCreateAction();
     // $page->addExcelAction();
     $page = $page->addShowAction();
     $page->addEditAction();
     $onDelete = new \MUtil_Html_OnClickArrayAttribute();
     $onDelete->addConfirm($this->_("Are you sure you want to delete this file?"));
     $page->addButtonOnly($this->_('Delete'), $privilege . '.delete', $controller, 'delete', array('onclick' => $onDelete))->setModelParameters(1);
     $page->addButtonOnly($this->_('Download'), $privilege . '.download', $controller, 'download')->setModelParameters(1);
     return $page;
 }