示例#1
0
 /**
  * Generates the toolbar for the top of the view
  *
  * @return    string    Toolbar with buttons
  */
 protected function getToolbar()
 {
     $id = empty($this->item) || empty($this->item->id) ? null : $this->item->id;
     $access = PFprojectsHelper::getActions($id);
     $uid = JFactory::getUser()->get('id');
     if (!empty($id)) {
         $slug = $this->item->id . ':' . $this->item->alias;
         $return = base64_encode(PFprojectsHelperRoute::getDashboardRoute($slug));
         PFToolbar::button('COM_PROJECTFORK_ACTION_EDIT', '', false, array('access' => $access->get('core.edit') || $access->get('core.edit.own') && $uid == $this->item->created_by, 'href' => JRoute::_(PFprojectsHelperRoute::getProjectsRoute() . '&task=form.edit&id=' . $slug . '&return=' . $return)));
     }
     return PFToolbar::render();
 }
示例#2
0
 /**
  * Generates the toolbar for the top of the view
  *
  * @return    string    Toolbar with buttons
  */
 protected function getToolbar()
 {
     $access = PFmilestonesHelper::getActions($this->item->id);
     $uid = JFactory::getUser()->get('id');
     $app = JFactory::getApplication();
     if ($this->item->id) {
         $slug = $this->item->id . ':' . $this->item->alias;
         $project_slug = $app->input->getCmd('filter_project');
         $return = base64_encode(PFmilestonesHelperRoute::getMilestoneRoute($slug, $project_slug));
         PFToolbar::button('COM_PROJECTFORK_ACTION_EDIT', '', false, array('access' => $access->get('core.edit') || $access->get('core.edit.own') && $uid == $this->item->created_by, 'href' => JRoute::_(PFmilestonesHelperRoute::getMilestonesRoute() . '&task=form.edit&id=' . $slug . '&return=' . $return)));
     }
     if (PFApplicationHelper::enabled('com_pftasks')) {
         PFToolbar::button(JText::sprintf('JGRID_HEADING_TASKLISTS_AND_TASKS', intval($this->item->lists), intval($this->item->tasks)), '', false, array('href' => JRoute::_(PFtasksHelperRoute::getTasksRoute($this->item->project_id, $this->item->id)), 'icon' => 'icon-chevron-right', 'class' => ''));
     }
     return PFToolbar::render();
 }
 /**
  * Generates the toolbar for the top of the view
  *
  * @return    string    Toolbar with buttons
  */
 protected function getToolbar()
 {
     $access = PFforumHelper::getActions();
     $state = $this->get('State');
     PFToolbar::button('COM_PROJECTFORK_ACTION_NEW', 'topicform.add', false, array('access' => $access->get('core.create')));
     $options = array();
     if ($access->get('core.edit.state')) {
         $options[] = array('text' => 'COM_PROJECTFORK_ACTION_PUBLISH', 'task' => $this->getName() . '.publish');
         $options[] = array('text' => 'COM_PROJECTFORK_ACTION_UNPUBLISH', 'task' => $this->getName() . '.unpublish');
         $options[] = array('text' => 'COM_PROJECTFORK_ACTION_ARCHIVE', 'task' => $this->getName() . '.archive');
         $options[] = array('text' => 'COM_PROJECTFORK_ACTION_CHECKIN', 'task' => $this->getName() . '.checkin');
     }
     if ($state->get('filter.published') == -2 && $access->get('core.delete')) {
         $options[] = array('text' => 'COM_PROJECTFORK_ACTION_DELETE', 'task' => $this->getName() . '.delete');
     } elseif ($access->get('core.edit.state')) {
         $options[] = array('text' => 'COM_PROJECTFORK_ACTION_TRASH', 'task' => $this->getName() . '.trash');
     }
     if (count($options)) {
         PFToolbar::listButton($options);
     }
     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()
 {
     $access = PFrepoHelper::getActions('note', $this->item->id);
     $link = PFrepoHelperRoute::getRepositoryRoute($this->item->project_id, $this->item->dir_id, $this->item->path);
     $back_opts = array('access' => true, 'href' => $link);
     $edit_opts = array('access' => $access->get('core.edit'));
     PFToolbar::button('COM_PROJECTFORK_ACTION_BACK', '', false, $back_opts);
     PFToolbar::button('COM_PROJECTFORK_ACTION_EDIT', 'noteform.edit', false, $edit_opts);
     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();
 }
示例#8
0
文件: view.html.php 项目: MrJookie/pm
 /**
  * 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();
 }
 /**
  * Generates the toolbar for the top of the view
  *
  * @return    string    Toolbar with buttons
  */
 protected function getToolbar()
 {
     $options = array();
     $topic = $this->state->get($this->get('Name') . '.topic');
     $access = PFforumHelper::getReplyActions($this->item->id, $topic);
     if ($access->get('core.create')) {
         PFToolbar::button('JSAVE', $this->getName() . '.save', false, 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()
 {
     $access = PFtasksHelper::getActions($this->item->id);
     $uid = JFactory::getUser()->get('id');
     $slug = $this->item->id . ':' . $this->item->alias;
     PFToolbar::button('COM_PROJECTFORK_ACTION_EDIT', '', false, array('access' => $access->get('core.edit') || $access->get('core.edit.own') && $uid == $this->item->created_by, 'href' => JRoute::_(PFtasksHelperRoute::getTasksRoute() . '&task=taskform.edit&id=' . $slug)));
     return PFToolbar::render();
 }