/**
  * Method to get item data.
  *
  * @param     integer    $pk      The id of the item.
  * @return    mixed      $item    Item data object on success, false on failure.
  */
 public function getItem($pk = null)
 {
     // Get the record from the parent class method
     $item = parent::getItem($pk);
     if ($item === false) {
         return false;
     }
     // Compute selected asset permissions.
     $user = JFactory::getUser();
     $uid = $user->get('id');
     $access = PFtasksHelper::getListActions($item->id);
     $view_access = true;
     if ($item->access && !$user->authorise('core.admin')) {
         $view_access = in_array($item->access, $user->getAuthorisedViewLevels());
     }
     $item->params->set('access-view', $view_access);
     if (!$view_access) {
         $item->params->set('access-edit', false);
         $item->params->set('access-change', false);
     } else {
         // Check general edit permission first.
         if ($access->get('core.edit')) {
             $item->params->set('access-edit', true);
         } elseif (!empty($uid) && $access->get('core.edit.own')) {
             // Check for a valid user and that they are the owner.
             if ($uid == $item->created_by) {
                 $item->params->set('access-edit', true);
             }
         }
         // Check edit state permission.
         $item->params->set('access-change', $access->get('core.edit.state'));
     }
     return $item;
 }
Пример #2
0
 /**
  * Add the page title and toolbar.
  *
  */
 protected function addToolbar()
 {
     JRequest::setVar('hidemainmenu', true);
     $uid = JFactory::getUser()->get('id');
     $access = PFtasksHelper::getListActions($this->item->id);
     $checked_out = !($this->item->checked_out == 0 || $this->item->checked_out == $uid);
     $is_new = $this->item->id == 0;
     JToolBarHelper::title(JText::_('COM_PROJECTFORK_PAGE_' . ($checked_out ? 'VIEW_TASKLIST' : ($is_new ? 'ADD_TASKLIST' : 'EDIT_TASKLIST'))), 'article-add.png');
     // Built the actions for new and existing records.
     // For new records, check the create permission.
     if ($is_new) {
         JToolBarHelper::apply('tasklist.apply');
         JToolBarHelper::save('tasklist.save');
         JToolBarHelper::save2new('tasklist.save2new');
         JToolBarHelper::cancel('tasklist.cancel');
     } else {
         // Can't save the record if it's checked out.
         if (!$checked_out) {
             if ($access->get('core.edit') || $access->get('core.edit.own') && $this->item->created_by == $uid) {
                 JToolBarHelper::apply('tasklist.apply');
                 JToolBarHelper::save('tasklist.save');
                 JToolBarHelper::save2new('tasklist.save2new');
             }
         }
         JToolBarHelper::save2copy('tasklist.save2copy');
         JToolBarHelper::cancel('tasklist.cancel', 'JTOOLBAR_CLOSE');
     }
 }
Пример #3
0
                    <div class="clearfix"> </div>

                </div>
            </div>
            <div id="list-reorder">
               <?php 
$k = 0;
$x = 0;
$current_list = '';
$list_open = false;
$item_order = array();
foreach ($this->items as $i => $item) {
    if ($current_list !== $item->list_title) {
        if ($item->list_title) {
            $access = PFtasksHelper::getListActions($item->list_id);
            $can_create = $access->get('core.create');
            $can_edit = $access->get('core.edit');
            $can_checkin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out_list == $uid || $item->checked_out_list == 0;
            $can_edit_own = $access->get('core.edit.own') && $item->list_created_by == $uid;
            $can_change = $access->get('core.edit.state') && $can_checkin;
        }
        ?>
                        <?php 
        if ($list_open) {
            ?>
                                </ul>
                                <input type="hidden" name="item-order-<?php 
            echo $k;
            ?>
" id="item_order_<?php 
Пример #4
0
 /**
  * Generates the toolbar for the top of the view
  *
  * @return    string    Toolbar with buttons
  */
 protected function getToolbar()
 {
     $options = array();
     $user = JFactory::getUser();
     $access = PFtasksHelper::getListActions();
     $create_task = 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_task || $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_2TASK', 'task' => $this->getName() . '.save2task', 'options' => array('access' => $create_task));
     PFToolbar::dropdownButton($options, array('icon' => 'icon-white icon-ok'));
     PFToolbar::button('JCANCEL', $this->getName() . '.cancel', false, array('class' => '', 'icon' => ''));
     return PFToolbar::render();
 }