/** * Generates the toolbar for the top of the view * * @return string Toolbar with buttons */ protected function getToolbar() { $access = PFtasksHelper::getActions(); $state = $this->get('State'); $create = $access->get('core.create'); if ($create) { $items = array(); $items[] = array('text' => 'COM_PROJECTFORK_ACTION_NEW_TASK', 'task' => 'taskform.add'); $items[] = array('text' => 'COM_PROJECTFORK_ACTION_NEW_TASKLIST', 'task' => 'tasklistform.add'); PFToolbar::dropdownButton($items); } $items = array(); if ($access->get('core.edit.state')) { $items[] = array('text' => 'COM_PROJECTFORK_ACTION_PUBLISH', 'task' => $this->getName() . '.publish'); $items[] = array('text' => 'COM_PROJECTFORK_ACTION_UNPUBLISH', 'task' => $this->getName() . '.unpublish'); $items[] = array('text' => 'COM_PROJECTFORK_ACTION_ARCHIVE', 'task' => $this->getName() . '.archive'); $items[] = array('text' => 'COM_PROJECTFORK_ACTION_CHECKIN', 'task' => $this->getName() . '.checkin'); } if ($state->get('filter.published') == -2 && $access->get('core.delete')) { $items[] = array('text' => 'COM_PROJECTFORK_ACTION_DELETE', 'task' => $this->getName() . '.delete'); } elseif ($access->get('core.edit.state')) { $items[] = array('text' => 'COM_PROJECTFORK_ACTION_TRASH', 'task' => $this->getName() . '.trash'); } if (count($items)) { PFToolbar::listButton($items); } PFToolbar::filterButton($this->state->get('filter.isset')); return PFToolbar::render(); }
/** * Generates the toolbar for the top of the view * * @return string Toolbar with buttons */ protected function getToolbar() { $options = array(); $user = JFactory::getUser(); $create_list = true; $create_ms = $user->authorise('core.create', 'com_pfmilestones'); $options[] = array('text' => 'JSAVE', 'task' => $this->getName() . '.save'); $options[] = array('text' => 'COM_PROJECTFORK_ACTION_2NEW', 'task' => $this->getName() . '.save2new'); $options[] = array('text' => 'COM_PROJECTFORK_ACTION_2COPY', 'task' => $this->getName() . '.save2copy', 'options' => array('access' => $this->item->id > 0)); if ($create_list || $create_ms) { $options[] = array('text' => 'divider'); } $options[] = array('text' => 'COM_PROJECTFORK_ACTION_2MILESTONE', 'task' => $this->getName() . '.save2milestone', 'options' => array('access' => $create_ms)); $options[] = array('text' => 'COM_PROJECTFORK_ACTION_2TASKLIST', 'task' => $this->getName() . '.save2tasklist', 'options' => array('access' => $create_list)); PFToolbar::dropdownButton($options, array('icon' => 'icon-white icon-ok')); PFToolbar::button('JCANCEL', $this->getName() . '.cancel', false, array('class' => '', 'icon' => '')); return PFToolbar::render(); }
/** * Generates the toolbar for the top of the view * * @return string Toolbar with buttons */ protected function getToolbar() { $options = array(); $options[] = array('text' => 'JSAVE', 'task' => $this->getName() . '.save'); $options[] = array('text' => 'COM_PROJECTFORK_ACTION_2NEW', 'task' => $this->getName() . '.save2new'); PFToolbar::dropdownButton($options, array('icon' => 'icon-white icon-ok')); PFToolbar::button('JCANCEL', $this->getName() . '.cancel', false, array('class' => '', 'icon' => '')); return PFToolbar::render(); }
/** * Generates the toolbar for the top of the view * * @return string Toolbar with buttons */ protected function getToolbar() { $options = array(); $options[] = array('text' => 'JSAVE', 'task' => $this->getName() . '.save'); $options[] = array('text' => 'COM_PROJECTFORK_ACTION_2NEW', 'task' => $this->getName() . '.save2new'); $options[] = array('text' => 'COM_PROJECTFORK_ACTION_2COPY', 'task' => $this->getName() . '.save2copy', 'options' => array('access' => $this->item->id > 0)); if (PFApplicationHelper::enabled('com_pftasks') && JFactory::getUser()->authorise('core.create', 'com_pftasks')) { $options[] = array('text' => 'divider'); $options[] = array('text' => 'COM_PROJECTFORK_ACTION_2TASKLIST', 'task' => $this->getName() . '.save2tasklist'); $options[] = array('text' => 'COM_PROJECTFORK_ACTION_2TASK', 'task' => $this->getName() . '.save2task'); } PFToolbar::dropdownButton($options, array('icon' => 'icon-white icon-ok')); PFToolbar::button('JCANCEL', $this->getName() . '.cancel', false, array('class' => '', 'icon' => '')); return PFToolbar::render(); }
/** * Generates the toolbar for the top of the view * * @return string Toolbar with buttons */ protected function getToolbar() { $dir = $this->items['directory']; $access = PFrepoHelper::getActions('directory', $dir->id); if ($dir->id > 1) { $items = array(); $items[] = array('text' => 'COM_PROJECTFORK_ACTION_NEW_FILE', 'task' => 'fileform.add', 'options' => array('access' => $access->get('core.create') && !defined('PFDEMO'))); $items[] = array('text' => 'COM_PROJECTFORK_ACTION_NEW_DIRECTORY', 'task' => 'directoryform.add', 'options' => array('access' => $access->get('core.create'))); $items[] = array('text' => 'COM_PROJECTFORK_ACTION_NEW_NOTE', 'task' => 'noteform.add', 'options' => array('access' => $access->get('core.create'))); PFToolbar::dropdownButton($items); $items = array(); $items[] = array('text' => 'COM_PROJECTFORK_ACTION_DELETE', 'task' => $this->getName() . '.delete', 'options' => array('access' => $access->get('core.delete'))); $items[] = array('text' => 'COM_PROJECTFORK_ACTION_CHECKIN', 'task' => $this->getName() . '.checkin'); if (count($items)) { PFToolbar::listButton($items); } } PFToolbar::filterButton($this->state->get('filter.isset')); return PFToolbar::render(); }
/** * Generates the toolbar for the top of the view * * @return string Toolbar with buttons */ protected function getToolbar() { $config = JComponentHelper::getParams('com_pfdesigns', true); $uid = JFactory::getUser()->get('id'); $slug = $this->item->id . ':' . $this->item->alias; $return = base64_encode(JFactory::getURI()->toString()); $rev = $this->item->revision; $access = PFdesignsHelper::getActions($this->item->id); $access2 = $rev ? PFdesignsHelper::getRevisionActions($rev->id) : null; // Get the permissions $is_owner = $uid == $this->item->created_by; $can_add = $access->get('core.create'); $can_edit = $access->get('core.edit') || $access->get('core.edit.own') && $is_owner; $can_dl = $access->get('core.download'); $can_zip = class_exists('ZipArchive'); $can_edit_state = $access->get('core.edit.state'); $can_delete = $access->get('core.delete'); $can_approve = $access->get('core.approve'); $has_approved = array_key_exists($uid, $this->item->approved); $has_declined = array_key_exists($uid, $this->item->declined); $list_view = 'designs'; // Overwrite permissions when looking at a revision if ($rev) { $is_owner = $uid == $rev->created_by; $can_edit = $access2->get('core.edit') || $access2->get('core.edit.own') && $is_owner; $can_dl = $access2->get('core.download'); $can_edit_state = $access2->get('core.edit.state'); $can_delete = $access2->get('core.delete'); $can_approve = $access2->get('core.approve'); $has_approved = array_key_exists($uid, $rev->approved); $has_declined = array_key_exists($uid, $rev->declined); $list_view = 'revisions'; } $options = array(); if ($access->get('core.create')) { $options[] = array('text' => 'JACTION_ADD', 'task' => 'revisionform.add', 'access' => $access->get('core.create')); } if ($can_edit) { $options[] = array('text' => 'COM_PROJECTFORK_ACTION_EDIT', 'task' => $rev ? 'revisionform.edit' : 'designform.edit', 'access' => $can_edit); } PFToolbar::dropdownButton($options, array('icon' => 'icon-white icon-plus')); // Download button if ($can_dl) { $link = PFdesignsHelperRoute::getDesignRoute($this->item->slug, $this->item->project_slug, $this->item->album_slug, $rev ? $rev->slug : '0:original'); PFToolbar::button('JACTION_DOWNLOAD', null, false, array('access' => true, 'icon' => 'icon-download', 'href' => $link . '&tmpl=component&layout=download&format=raw')); } // Approve and Decline buttons if ($can_approve) { $behavior = $config->get('approval_behavior', 'changeable'); $final = $behavior == 'final'; PFToolbar::group(); if ($final && !$has_declined || !$final) { PFToolbar::button($has_approved ? 'COM_PFDESIGNS_ACTION_APPROVED' : 'COM_PFDESIGNS_ACTION_APPROVE', $has_approved || $final ? '' : ($rev ? 'revisionform.approve' : 'designform.approve'), false, array('access' => true, 'icon' => 'icon-thumbs-up', 'class' => 'btn' . ($has_approved ? ' btn-success active' . ($final ? ' disabled' : '') : ''), 'href' => !$final || $has_approved ? null : "javascript:confirmApprove('approve-design');", 'id' => 'approve-design')); } if (!$has_declined && !$has_approved) { PFToolbar::button('COM_PFDESIGNS_UNDECIDED', '', false, array('access' => true, 'href' => '#', 'icon' => '', 'class' => 'btn active')); } if ($final && !$has_approved || !$final) { PFToolbar::button($has_declined ? 'COM_PFDESIGNS_ACTION_DECLINED' : 'COM_PFDESIGNS_ACTION_DECLINE', $has_declined || $final ? '' : ($rev ? 'revisionform.decline' : 'designform.decline'), false, array('access' => true, 'icon' => 'icon-thumbs-down', 'class' => 'btn' . ($has_declined ? ' btn-danger active' . ($final ? ' disabled' : '') : ''), 'href' => !$final || $has_declined ? null : "javascript:confirmDecline('decline-design');", 'id' => 'decline-design')); } PFToolbar::group(); } return PFToolbar::render(); }