12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- /**
- * Field handler which shows the operations for a job item.
- *
- * @todo Remove this once http://drupal.org/node/1435662 is through.
- *
- * @ingroup views_field_handlers
- */
- class tmgmt_handler_field_tmgmt_job_item_operations extends views_handler_field_entity {
- function render($values) {
- $item = $this->get_value($values);
- $element = array();
- $element['#theme'] = 'links';
- $element['#attributes'] = array('class' => array('inline'));
- $uri = $item->uri();
- if ($item->getCountTranslated() > 0 && entity_access('accept', 'tmgmt_job_item', $item)) {
- $element['#links']['review'] = array(
- 'href' => $uri['path'],
- 'query' => array('destination' => current_path()),
- 'title' => t('review'),
- );
- }
- // Do not display view on unprocessed jobs.
- elseif (!$item->getJob()->isUnprocessed()) {
- $element['#links']['view'] = array(
- 'href' => $uri['path'],
- 'query' => array('destination' => current_path()),
- 'title' => t('view'),
- );
- }
- if (user_access('administer tmgmt') && !$item->isAccepted()) {
- $element['#links']['delete'] = array(
- 'href' => 'admin/tmgmt/items/' . $item->tjiid . '/delete',
- 'query' => array('destination' => current_path()),
- 'title' => t('delete'),
- );
- }
- return drupal_render($element);
- }
- }
|