/**
  * 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;
 }
Exemplo n.º 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');
     }
 }
Exemplo n.º 3
0
 public function display($tpl = null)
 {
     // Initialise variables.
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     // Get model data.
     $this->state = $this->get('State');
     $this->item = $this->get('Item');
     $this->form = $this->get('Form');
     $this->return_page = $this->get('ReturnPage');
     $this->toolbar = $this->getToolbar();
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     // Permission check.
     if ($this->item->id <= 0) {
         $access = PFtasksHelper::getActions();
         $authorised = $access->get('core.create');
     } else {
         $authorised = $this->item->params->get('access-edit');
     }
     if ($authorised !== true) {
         JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
         return false;
     }
     //Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($this->state->params->get('pageclass_sfx'));
     $this->params = $this->state->params;
     $this->user = $user;
     // Prepare the document
     $this->_prepareDocument();
     // Display the view
     parent::display($tpl);
 }
Exemplo n.º 4
0
        ?>
                            <ul class="list-tasks list-striped list-condensed unstyled" id="tasklist_<?php 
        echo $i;
        ?>
">
                        <?php 
        $k = 1 - $k;
        $list_open = true;
        $current_list = $item->list_title;
        $x++;
        // End of Task List
    }
    ?>
                    <?php 
    // Start task item
    $access = PFtasksHelper::getActions($item->id);
    $item_order[] = $item->ordering;
    $can_create = $access->get('core.create');
    $can_edit = $access->get('core.edit');
    $can_checkin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $uid || $item->checked_out == 0;
    $can_edit_own = $access->get('core.edit.own') && $item->created_by == $uid;
    $can_change = $access->get('core.edit.state') && $can_checkin;
    // Task completed javascript
    $cbjs = '';
    $disabled = ' disabled = disabled';
    $checked = $item->complete ? ' checked="checked"' : '';
    if ($can_change) {
        $cbjs = ' onclick="setTaskComplete(' . intval($item->id) . ', this.checked);"';
        $disabled = '';
    }
    // list item class
Exemplo n.º 5
0
 /**
  * Method to auto-populate the model state.
  * Note. Calling getState in this method will result in recursion.
  *
  * @return    void
  */
 protected function populateState($ordering = 'a.title', $direction = 'ASC')
 {
     $app = JFactory::getApplication();
     $access = PFtasksHelper::getActions();
     $user = JFactory::getUser();
     // Adjust the context to support modal layouts.
     $layout = JRequest::getCmd('layout');
     // View Layout
     $this->setState('layout', $layout);
     if ($layout && $layout != 'print') {
         $this->context .= '.' . $layout;
     }
     // Params
     $value = $app->getParams();
     $this->setState('params', $value);
     // State
     $state = $app->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
     $this->setState('filter.published', $state);
     // Filter on published for those who do not have edit or edit.state rights.
     if (!$access->get('core.edit.state') && !$access->get('core.edit')) {
         $this->setState('filter.published', 1);
         $state = '';
     }
     // Filter - Search
     $search = JRequest::getString('filter_search', '');
     $this->setState('filter.search', $search);
     // Filter - Project
     $project = PFApplicationHelper::getActiveProjectId('filter_project');
     $this->setState('filter.project', $project);
     // Filter - Milestone
     $milestone = $app->getUserStateFromRequest($this->context . '.filter.milestone', 'filter_milestone', '');
     $this->setState('filter.milestone', $milestone);
     // Filter - Task list
     $list = $app->getUserStateFromRequest($this->context . '.filter.tasklist', 'filter_tasklist', '');
     $this->setState('filter.tasklist', $list);
     // Filter - Author
     $author = $app->getUserStateFromRequest($this->context . '.filter.author', 'filter_author', '');
     $this->setState('filter.author', $author);
     // Filter - Assigned User
     $assigned = $app->getUserStateFromRequest($this->context . '.filter.assigned', 'filter_assigned', '');
     $this->setState('filter.assigned', $assigned);
     // Filter - Priority
     $priority = $app->getUserStateFromRequest($this->context . '.filter.priority', 'filter_priority', '');
     $this->setState('filter.priority', $priority);
     // Filter - Complete
     $complete = $app->getUserStateFromRequest($this->context . '.filter.complete', 'filter_complete', '');
     $this->setState('filter.complete', $complete);
     // Filter - Labels
     $labels = JRequest::getVar('filter_label', array());
     $this->setState('filter.labels', $labels);
     // Do not allow some filters if no project is selected
     if (!is_numeric($project) || intval($project) == 0) {
         $this->setState('filter.tasklist', '');
         $this->setState('filter.milestone', '');
         $this->setState('filter.labels', array());
         $milestone = '';
         $list = '';
         $labels = array();
         if ($author != $user->id) {
             $this->setState('filter.author', '');
             $author = '';
         }
         if ($assigned != $user->id) {
             $this->setState('filter.assigned', '');
             $assigned = '';
         }
     }
     if (!is_array($labels)) {
         $labels = array();
     }
     // Filter - Is set
     $this->setState('filter.isset', is_numeric($state) || !empty($search) || is_numeric($author) || is_numeric($assigned) || is_numeric($list) && $list > 0 || is_numeric($milestone) && $milestone > 0 || count($labels) || is_numeric($complete));
     // Call parent method
     parent::populateState($ordering, $direction);
 }
Exemplo n.º 6
0
function prepareData()
{
    $module = JModuleHelper::getModule('mod_pf_time');
    $params = new JRegistry();
    $params->loadString($module->params);
    $action = JRequest::getVar('action', null);
    $filter_author = $params->get('filter_own', null);
    $filter_start_date = JRequest::getVar('filter_start_date', null);
    $filter_end_date = JRequest::getVar('filter_end_date', null);
    $filter_project = JRequest::getVar('filter_project', null);
    $app = JFactory::getApplication();
    $db = JFactory::getDBO();
    $query = $db->getQuery(true);
    $user = JFactory::getUser();
    $access = PFtasksHelper::getActions();
    $taskdata = null;
    // Select the required fields from the table.
    $query->select('a.id, a.project_id, a.task_id, a.task_title, a.description, ' . 'a.checked_out, a.checked_out_time, a.state, a.access, a.rate, a.billable,' . 'a.created, a.created_by, a.log_date, a.log_time ');
    $query->from('#__pf_timesheet AS a');
    // Join over the users for the checked out user.
    $query->select('uc.name AS editor');
    $query->join('LEFT', '#__users AS uc ON uc.id = a.checked_out');
    // Join over the asset groups.
    $query->select('ag.title AS access_level');
    $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
    // Join over the users for the author.
    $query->select('ua.name AS author_name');
    $query->join('LEFT', '#__users AS ua ON ua.id = a.created_by');
    // Join over the projects for the project title.
    $query->select('p.title AS project_title, p.alias AS project_alias');
    $query->join('LEFT', '#__pf_projects AS p ON p.id = a.project_id');
    // Join over the tasks for the task title.
    $query->select('t.id AS task_exists, t.alias AS task_alias, t.estimate');
    $query->join('LEFT', '#__pf_tasks AS t ON t.id = a.task_id');
    // Join over the milestones for the milestone alias.
    $query->select('m.id AS milestone_id, m.alias AS milestone_alias');
    $query->join('LEFT', '#__pf_milestones AS m ON m.id = t.milestone_id');
    // Join over the task lists for the list alias.
    $query->select('l.id AS list_id, l.alias AS list_alias');
    $query->join('LEFT', '#__pf_task_lists AS l ON l.id = t.list_id');
    // Implement View Level Access
    if (!$user->authorise('core.admin')) {
        $levels = implode(',', $user->getAuthorisedViewLevels());
        $query->where('a.access IN (' . $levels . ')');
    }
    // Calculate billable amount
    $query->select('CASE WHEN (a.billable = 1 AND a.rate > 0 AND a.log_time > 0) ' . 'THEN ((a.log_time / 60) * (a.rate / 60)) ' . 'ELSE "0.00"' . 'END AS billable_total');
    // Filter fields
    $filters = array();
    $filters['a.project_id'] = array('INT-NOTZERO', $filter_project);
    if ($filter_author == 1) {
        $filters['a.created_by'] = array('INT-NOTZERO', $user->get('id'));
    }
    // Apply Filter
    PFQueryHelper::buildFilter($query, $filters);
    //finally add our own date range filter
    if ($filter_start_date && $filter_end_date) {
        $query->where("a.log_date between '{$filter_start_date}' AND '{$filter_end_date}'");
    } else {
        if ($filter_start_date) {
            $query->where("a.log_date >= '{$filter_start_date}'");
        } else {
            if ($filter_end_date) {
                $query->where("a.log_date <= '{$filter_end_date}'");
            }
        }
    }
    // Add the list ordering clause.
    $order_col = 'a.log_date';
    $order_dir = 'desc';
    $query->order($db->escape($order_col . ' ' . $order_dir));
    $query->group('a.id');
    $db->setQuery($query);
    $taskdata = $db->loadObjectList();
    if ($action == 'export') {
        exportData($taskdata);
    } else {
        displayData($taskdata);
    }
}
Exemplo n.º 7
0
 public static function translateValue($field, $value)
 {
     static $access_titles = array();
     static $cat_titles = array();
     static $project_titles = array();
     static $ms_titles = array();
     static $list_titles = array();
     static $topic_titles = array();
     static $task_titles = array();
     static $dir_titles = array();
     static $note_titles = array();
     static $file_titles = array();
     static $user_names = array();
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     switch ($field) {
         case 'description':
             $data = strip_tags($value);
             break;
         case 'start_date':
         case 'end_date':
             $data = JHtml::_('date', $value, JText::_('DATE_FORMAT_LC3'));
             break;
         case 'access':
             if (array_key_exists($value, $access_titles)) {
                 $data = $access_titles[$value];
             } else {
                 $query->clear();
                 $query->select('title')->from('#__viewlevels')->where('id = ' . $db->quote((int) $value));
                 $db->setQuery($query);
                 $title = $db->loadResult();
                 $access_titles[$value] = $title;
                 $data = $access_titles[$value];
             }
             break;
         case 'catid':
             if (array_key_exists($value, $cat_titles)) {
                 $data = $cat_titles[$value];
             } else {
                 if ($value > 0) {
                     $query->clear();
                     $query->select('title')->from('#__categories')->where('id = ' . $db->quote((int) $value));
                     $db->setQuery($query);
                     $title = $db->loadResult();
                 } else {
                     $title = '-';
                 }
                 $cat_titles[$value] = $title;
                 $data = $cat_titles[$value];
             }
             break;
         case 'project_id':
             if (array_key_exists($value, $project_titles)) {
                 $data = $project_titles[$value];
             } else {
                 if ($value > 0) {
                     $query->clear();
                     $query->select('title')->from('#__pf_projects')->where('id = ' . $db->quote((int) $value));
                     $db->setQuery($query);
                     $title = $db->loadResult();
                 } else {
                     $title = '-';
                 }
                 $project_titles[$value] = $title;
                 $data = $project_titles[$value];
             }
             break;
         case 'milestone_id':
             if (array_key_exists($value, $ms_titles)) {
                 $data = $ms_titles[$value];
             } else {
                 if ($value > 0) {
                     $query->clear();
                     $query->select('title')->from('#__pf_milestones')->where('id = ' . $db->quote((int) $value));
                     $db->setQuery($query);
                     $title = $db->loadResult();
                 } else {
                     $title = '-';
                 }
                 $ms_titles[$value] = $title;
                 $data = $ms_titles[$value];
             }
             break;
         case 'list_id':
             if (array_key_exists($value, $list_titles)) {
                 $data = $list_titles[$value];
             } else {
                 if ($value > 0) {
                     $query->clear();
                     $query->select('title')->from('#__pf_task_lists')->where('id = ' . $db->quote((int) $value));
                     $db->setQuery($query);
                     $title = $db->loadResult();
                 } else {
                     $title = '-';
                 }
                 $list_titles[$value] = $title;
                 $data = $list_titles[$value];
             }
             break;
         case 'task_id':
             if (array_key_exists($value, $task_titles)) {
                 $data = $task_titles[$value];
             } else {
                 if ($value > 0) {
                     $query->clear();
                     $query->select('title')->from('#__pf_tasks')->where('id = ' . $db->quote((int) $value));
                     $db->setQuery($query);
                     $title = $db->loadResult();
                 } else {
                     $title = '-';
                 }
                 $task_titles[$value] = $title;
                 $data = $task_titles[$value];
             }
             break;
         case 'topic_id':
             if (array_key_exists($value, $topic_titles)) {
                 $data = $topic_titles[$value];
             } else {
                 if ($value > 0) {
                     $query->clear();
                     $query->select('title')->from('#__pf_topics')->where('id = ' . $db->quote((int) $value));
                     $db->setQuery($query);
                     $title = $db->loadResult();
                 } else {
                     $title = '-';
                 }
                 $topic_titles[$value] = $title;
                 $data = $topic_titles[$value];
             }
             break;
         case 'directory_id':
             if (array_key_exists($value, $dir_titles)) {
                 $data = $dir_titles[$value];
             } else {
                 if ($value > 0) {
                     $query->clear();
                     $query->select('title')->from('#__pf_repo_dirs')->where('id = ' . $db->quote((int) $value));
                     $db->setQuery($query);
                     $title = $db->loadResult();
                 } else {
                     $title = '-';
                 }
                 $dir_titles[$value] = $title;
                 $data = $dir_titles[$value];
             }
             break;
         case 'file_id':
             if (array_key_exists($value, $file_titles)) {
                 $data = $file_titles[$value];
             } else {
                 if ($value > 0) {
                     $query->clear();
                     $query->select('title')->from('#__pf_repo_files')->where('id = ' . $db->quote((int) $value));
                     $db->setQuery($query);
                     $title = $db->loadResult();
                 } else {
                     $title = '-';
                 }
                 $file_titles[$value] = $title;
                 $data = $file_titles[$value];
             }
             break;
         case 'note_id':
             if (array_key_exists($value, $note_titles)) {
                 $data = $note_titles[$value];
             } else {
                 if ($value > 0) {
                     $query->clear();
                     $query->select('title')->from('#__pf_repo_notes')->where('id = ' . $db->quote((int) $value));
                     $db->setQuery($query);
                     $title = $db->loadResult();
                 } else {
                     $title = '-';
                 }
                 $note_titles[$value] = $title;
                 $data = $note_titles[$value];
             }
             break;
         case 'created_by':
             if (array_key_exists($value, $user_names)) {
                 $data = $user_names[$value];
             } else {
                 if ($value > 0) {
                     $query->clear();
                     $query->select('name')->from('#__users')->where('id = ' . $db->quote((int) $value));
                     $db->setQuery($query);
                     $name = $db->loadResult();
                 } else {
                     $name = '-';
                 }
                 $user_names[$value] = $name;
                 $data = $user_names[$value];
             }
             break;
         case 'priority':
             if (class_exists('PFtasksHelper')) {
                 $data = PFtasksHelper::priority2string($value);
             } else {
                 $data = $value;
             }
             break;
         default:
             $data = $value;
             break;
     }
     return $data;
 }
Exemplo n.º 8
0
 /**
  * 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();
 }
Exemplo n.º 9
0
 public function display($cachable = false, $urlparams = false)
 {
     PFtasksHelper::addSubmenu(JFactory::getApplication()->input->get('view', $this->default_view));
     parent::display();
     return $this;
 }
Exemplo n.º 10
0
 /**
  * Method to auto-populate the model state.
  * Note. Calling getState in this method will result in recursion.
  *
  * @return    void
  */
 protected function populateState($ordering = 'a.title', $direction = 'ASC')
 {
     $app = JFactory::getApplication();
     $access = PFtasksHelper::getActions();
     $user = JFactory::getUser();
     // Adjust the context to support modal layouts.
     $layout = JRequest::getCmd('layout');
     $params = $app->getParams();
     $itemid = $app->input->get('Itemid', 0, 'int');
     $menu = $app->getMenu()->getActive();
     // Merge app params with menu item params
     if ($menu) {
         $menu_params = new JRegistry();
         $menu_params->loadString($menu->params);
         $clone_params = clone $menu_params;
         $clone_params->merge($params);
         if (!$itemid) {
             $itemid = (int) $menu->id;
         }
     }
     // View Layout
     $this->setState('layout', $layout);
     if ($layout && $layout != 'print') {
         $this->context .= '.' . $layout;
     }
     $this->context .= '.' . $itemid;
     // Set Params
     $this->setState('params', $params);
     // State
     $state = $app->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', $params->get('filter_published'));
     $this->setState('filter.published', $state);
     // Filter on published for those who do not have edit or edit.state rights.
     if (!$access->get('core.edit.state') && !$access->get('core.edit')) {
         $this->setState('filter.published', 1);
         $state = '';
     }
     // Filter - Search
     $search = JRequest::getString('filter_search', '');
     $this->setState('filter.search', $search);
     // Filter - Project
     $project = PFApplicationHelper::getActiveProjectId('filter_project');
     $this->setState('filter.project', $project);
     // Filter - Milestone
     $milestone = $app->getUserStateFromRequest($this->context . '.filter.milestone', 'filter_milestone', '');
     $this->setState('filter.milestone', $milestone);
     // Filter - Task list
     $list = $app->getUserStateFromRequest($this->context . '.filter.tasklist', 'filter_tasklist', '');
     $this->setState('filter.tasklist', $list);
     // Filter - Author
     $author = $app->getUserStateFromRequest($this->context . '.filter.author', 'filter_author', '');
     $this->setState('filter.author', $author);
     // Filter - Assigned User
     $assigned = $app->getUserStateFromRequest($this->context . '.filter.assigned', 'filter_assigned', '');
     $this->setState('filter.assigned', $assigned);
     // Filter - Priority
     $priority = $app->getUserStateFromRequest($this->context . '.filter.priority', 'filter_priority', '');
     $this->setState('filter.priority', $priority);
     // Filter - Complete
     $complete = $app->getUserStateFromRequest($this->context . '.filter.complete', 'filter_complete', '');
     $this->setState('filter.complete', $complete);
     // Filter - Labels
     $labels = JRequest::getVar('filter_label', array());
     $this->setState('filter.labels', $labels);
     // Do not allow some filters if no project is selected
     if (!is_numeric($project) || intval($project) == 0) {
         $this->setState('filter.tasklist', '');
         $this->setState('filter.milestone', '');
         $this->setState('filter.labels', array());
         $milestone = '';
         $list = '';
         $labels = array();
         if ($author != $user->id) {
             $this->setState('filter.author', '');
             $author = '';
         }
         if ($assigned != $user->id) {
             $this->setState('filter.assigned', '');
             $assigned = '';
         }
     }
     if (!is_array($labels)) {
         $labels = array();
     }
     // Filter - Is set
     $this->setState('filter.isset', is_numeric($state) || !empty($search) || is_numeric($author) || is_numeric($assigned) || is_numeric($list) && $list > 0 || is_numeric($milestone) && $milestone > 0 || count($labels) || is_numeric($complete));
     // Set list limit
     $cfg = JFactory::getConfig();
     $limit = $app->getUserStateFromRequest($this->context . '.list.limit', 'limit', $params->get('display_num', $cfg->get('list_limit')), 'uint');
     $this->setState('list.limit', $limit);
     $app->set('list_limit', $limit);
     JRequest::setVar('list_limit', $limit);
     // Set sorting order
     $ordering = $app->getUserStateFromRequest($this->context . '.list.ordering', 'filter_order', $params->get('filter_order'));
     $this->setState('list.ordering', $ordering);
     $app->set('filter_order', $ordering);
     JRequest::setVar('filter_order', $ordering);
     // Set order direction
     $direction = $app->getUserStateFromRequest($this->context . '.list.direction', 'filter_order_Dir', $params->get('filter_order_Dir'));
     $this->setState('list.direction', $direction);
     $app->set('filter_order_Dir', $direction);
     JRequest::setVar('filter_order_Dir', $direction);
     // Call parent method
     parent::populateState($ordering, $direction);
 }
Exemplo n.º 11
0
 /**
  * Method to auto-populate the model state.
  * Note. Calling getState in this method will result in recursion.
  *
  * @return    void
  */
 protected function populateState()
 {
     // Load state from the request.
     $pk = JRequest::getInt('id');
     $this->setState($this->getName() . '.id', $pk);
     $offset = JRequest::getUInt('limitstart');
     $this->setState('list.offset', $offset);
     // Load the parameters.
     $params = JFactory::getApplication('site')->getParams();
     $this->setState('params', $params);
     $access = PFtasksHelper::getActions();
     if (!$access->get('core.edit.state') && !$access->get('core.edit')) {
         $this->setState('filter.published', 1);
         $this->setState('filter.archived', 2);
     }
 }
Exemplo n.º 12
0
 /**
  * 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();
 }
Exemplo n.º 13
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();
 }