Exemplo n.º 1
0
 /**
  * Gets the URL arguments to append to an item redirect.
  *
  * @param     integer    $id         The primary key id for the item.
  * @param     string     $url_var    The name of the URL variable for the id.
  *
  * @return    string                 The arguments to append to the redirect URL.
  */
 protected function getRedirectToItemAppend($id = null, $url_var = 'id')
 {
     $tmpl = JRequest::getCmd('tmpl');
     $layout = JRequest::getCmd('layout', 'edit');
     $project = JRequest::getUint('filter_project', 0);
     $context = JRequest::getCmd('filter_context');
     $item_id = JRequest::getUint('filter_item_id');
     $append = '';
     // Setup redirect info.
     if ($tmpl) {
         $append .= '&tmpl=' . $tmpl;
     }
     if ($layout) {
         $append .= '&layout=' . $layout;
     }
     if ($id) {
         $append .= '&' . $url_var . '=' . $id;
     }
     if ($project) {
         $append .= '&filter_project=' . $project;
     }
     if ($context) {
         $append .= '&filter_context=' . $context;
     }
     if ($item_id) {
         $append .= '&filter_item_id=' . $item_id;
     }
     return $append;
 }
Exemplo n.º 2
0
 /**
  * Method to auto-populate the model state.
  * Note. Calling getState in this method will result in recursion.
  *
  * @return    void
  */
 protected function populateState($ordering = 'title', $direction = 'ASC')
 {
     // Item type
     $value = str_replace('form', '', JRequest::getCmd('view', 'taskform'));
     $this->setState('item.type', $value);
     // Item id
     $value = JRequest::getUint('id');
     $this->setState('item.id');
 }
Exemplo n.º 3
0
 /**
  * Method to display a view.
  *
  * @param     boolean        If true, the view output will be cached
  * @param     array          An array of safe url parameters
  *
  * @return    jcontroller    This object to support chaining.
  */
 public function display($cachable = false, $urlparams = false)
 {
     $view = JRequest::getCmd('view', $this->default_view);
     $layout = JRequest::getCmd('layout');
     $id = JRequest::getUint('id');
     // Inject default view if not set
     if (empty($view)) {
         JRequest::setVar('view', $this->default_view);
         $view = $this->default_view;
     }
     if ($view == $this->default_view) {
         $parent_id = JRequest::getUInt('filter_parent_id');
         $project = PFApplicationHelper::getActiveProjectId('filter_project');
         if ($parent_id && $project === "") {
             $this->setRedirect('index.php?option=com_pfrepo&view=' . $this->default_view);
             return $this;
         } elseif ($parent_id > 1 && $project > 0) {
             // Check if the folder belongs to the project
             $db = JFactory::getDbo();
             $query = $db->getQuery(true);
             $query->select('project_id')->from('#__pf_repo_dirs')->where('id = ' . (int) $parent_id);
             $db->setQuery($query);
             $pid = $db->loadResult();
             if ($pid != $project) {
                 // No match, redirect to the project root dir
                 $query->clear();
                 $query->select('id, path')->from('#__pf_repo_dirs')->where('parent_id = 1')->where('project_id = ' . (int) $project);
                 $db->setQuery($query, 0, 1);
                 $dir = $db->loadObject();
                 if ($dir) {
                     $this->setRedirect('index.php?option=com_pfrepo&view=' . $this->default_view . '&filter_project=' . $project . '&filter_parent_id=' . $dir->id);
                     return $this;
                 }
             }
         }
     }
     // Check form edit access
     if ($layout == 'edit' && !$this->checkEditId('com_pfrepo.edit.' . $view, $id)) {
         $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
         $this->setMessage($this->getError(), 'error');
         $this->setRedirect(JRoute::_('index.php?option=com_pfrepo&view=' . $this->default_view, false));
         return false;
     }
     // Add the sub-menu
     PFrepoHelper::addSubmenu($view);
     // Display the view
     parent::display($cachable, $urlparams);
     return $this;
 }
Exemplo n.º 4
0
 public function migrate()
 {
     $app = JFactory::getApplication();
     $passed = JRequest::getUint('check_passed');
     if (!$passed) {
         $app->enqueueMessage(JText::_('COM_PFMIGRATOR_WARNING_CHECK'), 'error');
         $app->redirect('index.php?option=com_pfmigrator&view=intro');
         return $this;
     }
     $data = PFmigratorHelper::getCustomData();
     if ($data->get('run')) {
         $app->enqueueMessage(JText::_('COM_PFMIGRATOR_WARNING_RERUN'), 'error');
         $app->redirect('index.php?option=com_pfmigrator&view=intro');
         return $this;
     }
     $data->set('run', 1);
     PFmigratorHelper::setCustomData($data);
     $app->enqueueMessage(JText::_('COM_PFMIGRATOR_WARNING_NO_LEAVE'));
     $app->redirect('index.php?option=com_pfmigrator&view=migrate');
     return $this;
 }
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 = null, $direction = null)
 {
     // Get potential form data
     $form = JRequest::getVar('jform', array(), 'post', 'array');
     // Item id
     $value = JRequest::getUint('id');
     if (!$value) {
         if (isset($form['id'])) {
             $value = (int) $form['id'];
         }
     }
     $this->setState('item.id', $value);
     // Project id
     $value = (int) $this->getUserStateFromRequest('com_projectfork.project.active.id', 'filter_project', '');
     if (!$value) {
         if (isset($form['project_id'])) {
             $value = (int) $form['project_id'];
         }
     }
     $this->setState('item.project', $value);
 }
Exemplo n.º 6
0
 /**
  * Gets the URL arguments to append to a list redirect.
  *
  * @return    string    The arguments to append to the redirect URL.
  */
 protected function getRedirectToListAppend()
 {
     $tmpl = JRequest::getCmd('tmpl');
     $project = JRequest::getUint('filter_project');
     $parent = JRequest::getUint('filter_parent_id');
     $id = JRequest::getUint('id');
     $rev = JRequest::getUint('rev');
     $append = '';
     // Setup redirect info.
     if ($project) {
         $append .= '&filter_project=' . $project;
     }
     if ($parent) {
         $append .= '&filter_parent_id=' . $parent;
     }
     if ($id && $rev) {
         $append .= '&id=' . $id;
     }
     if ($tmpl) {
         $append .= '&tmpl=' . $tmpl;
     }
     return $append;
 }
 /**
  * Method to auto-populate the model state.
  * Note: Calling getState in this method will result in recursion.
  *
  * @return    void
  */
 protected function populateState($ordering = 'a.ordering', $direction = 'desc')
 {
     // Initialise variables.
     $params = JComponentHelper::getParams('com_pfrepo');
     $app = JFactory::getApplication();
     // Adjust the context to support modal layouts.
     if ($layout = JRequest::getVar('layout')) {
         $this->context .= '.' . $layout;
     }
     // Filter - Search
     $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
     $this->setState('filter.search', $search);
     // Filter - Author
     $author_id = $app->getUserStateFromRequest($this->context . '.filter.author_id', 'filter_author_id');
     $this->setState('filter.author_id', $author_id);
     // Filter - File id
     $id = JRequest::getUint('id');
     $this->setState('filter.id', $id);
     // List state information.
     parent::populateState($ordering, $direction);
 }
Exemplo n.º 8
0
 /**
  * Gets the URL arguments to append to a list redirect.
  *
  * @return    string    The arguments to append to the redirect URL.
  */
 protected function getRedirectToListAppend()
 {
     // Need to override the parent method completely.
     $tmpl = JRequest::getCmd('tmpl');
     $project = JRequest::getUint('filter_project', 0);
     $topic = JRequest::getUint('filter_topic', 0);
     $append = '';
     // Setup redirect info.
     if ($project) {
         $append .= '&filter_project=' . $project;
     }
     if ($topic) {
         $append .= '&filter_topic=' . $topic;
     }
     if ($tmpl) {
         $append .= '&tmpl=' . $tmpl;
     }
     return $append;
 }
Exemplo n.º 9
0
 /**
  * Gets the URL arguments to append to a list redirect.
  *
  * @return    string    The arguments to append to the redirect URL.
  */
 protected function getRedirectToListAppend()
 {
     $tmpl = JRequest::getCmd('tmpl');
     $project = JRequest::getUint('filter_project');
     $parent = JRequest::getUint('filter_parent_id');
     $layout = JRequest::getCmd('layout');
     $func = JRequest::getCmd('function');
     $append = '';
     // Setup redirect info.
     if ($project) {
         $append .= '&filter_project=' . $project;
     }
     if ($parent) {
         $append .= '&filter_parent_id=' . $parent;
     }
     if ($tmpl) {
         $append .= '&tmpl=' . $tmpl;
     }
     if ($layout) {
         $append .= '&layout=' . $layout;
     }
     if ($func) {
         $append .= '&function=' . $func;
     }
     return $append;
 }
 /**
  * Get the return URL.
  * If a "return" variable has been passed in the request
  *
  * @return    string    The return URL.
  */
 protected function getReturnPage()
 {
     $return = JRequest::getVar('return', null, 'default', 'base64');
     $parent = JRequest::getUint('filter_parent_id');
     $project = JRequest::getUint('filter_project');
     $append = '';
     if ($project) {
         $append .= '&filter_project=' . $project;
     }
     if ($parent) {
         $append .= '&filter_parent_id=' . $parent;
     }
     if (empty($return) || !JUri::isInternal(base64_decode($return))) {
         return JRoute::_('index.php?option=com_pfrepo&view=' . $this->view_list . $append, false);
     } else {
         return base64_decode($return);
     }
 }
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::getUint('id');
     $this->setState($this->getName() . '.id', $pk);
     // Load the parameters.
     $params = JFactory::getApplication('site')->getParams();
     $this->setState('params', $params);
 }
Exemplo n.º 12
0
 /**
  * Gets the URL arguments to append to a list redirect.
  *
  * @return  string  The arguments to append to the redirect URL.
  */
 protected function getRedirectToListAppend()
 {
     $tmpl = JRequest::getCmd('tmpl');
     $parent = JRequest::getUint('filter_parent_id', 0);
     $append = '';
     // Setup redirect info.
     if ($parent) {
         $append .= '&filter_parent_id=' . $parent;
     }
     if ($tmpl) {
         $append .= '&tmpl=' . $tmpl;
     }
     return $append;
 }
 /**
  * Method to remove items from the recorder
  *
  * @return    void
  */
 public function delete()
 {
     $data = array();
     $data['success'] = "true";
     $data['messages'] = array();
     $data['data'] = array();
     // Check for request forgeries
     if (!JSession::checkToken()) {
         $data['success'] = "false";
         $data['messages'][] = JText::_('JINVALID_TOKEN');
         $this->sendResponse($data);
     }
     // Get the input
     $pks = JRequest::getVar('cid', null, 'post', 'array');
     $c = JRequest::getUint('complete');
     if (empty($pks)) {
         $data['success'] = "false";
         $data['messages'][] = JText::_($this->text_prefix . '_NO_ITEM_SELECTED');
     } else {
         // Get the model.
         $model = $this->getModel();
         // Make sure the item ids are integers
         JArrayHelper::toInteger($pks);
         // Publish the items.
         if (!$model->delete($pks, $c)) {
             $data['success'] = "false";
             $data['messages'][] = $model->getError();
         } else {
             $data['success'] = "true";
         }
     }
     $this->sendResponse($data);
 }
Exemplo n.º 14
0
 /**
  * Gets the URL arguments to append to an item redirect.
  *
  * @param     int       $id         The primary key id for the item.
  * @param     string    $url_var    The name of the URL variable for the id.
  *
  * @return    string                The arguments to append to the redirect URL.
  */
 protected function getRedirectToItemAppend($id = null, $url_var = 'id')
 {
     // Need to override the parent method completely.
     $tmpl = JRequest::getCmd('tmpl');
     $layout = JRequest::getCmd('layout', 'edit');
     $item_id = JRequest::getUInt('Itemid');
     $project = JRequest::getUint('filter_project', 0);
     $parent = JRequest::getUint('filter_parent_id', 0);
     $return = $this->getReturnPage();
     $append = '';
     // Setup redirect info.
     if ($tmpl) {
         $append .= '&tmpl=' . $tmpl;
     }
     $append .= '&layout=edit';
     if ($id) {
         $append .= '&' . $url_var . '=' . $id;
     }
     if ($project) {
         $append .= '&filter_project=' . $project;
     }
     if ($parent) {
         $append .= '&filter_parent_id=' . $parent;
     }
     if ($item_id) {
         $append .= '&Itemid=' . $item_id;
     }
     if ($return) {
         $append .= '&return=' . base64_encode($return);
     }
     return $append;
 }
Exemplo n.º 15
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')
 {
     // Initialise variables.
     $params = JComponentHelper::getParams('com_pfrepo');
     $app = JFactory::getApplication();
     // Adjust the context to support modal layouts.
     if ($layout = JRequest::getVar('layout')) {
         $this->context .= '.' . $layout;
     }
     // Config - Count elements
     $this->setState('list.count_elements', (int) $params->get('show_element_count'));
     // Filter - Search
     $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
     $this->setState('filter.search', $search);
     // Filter - Author
     $author_id = $app->getUserStateFromRequest($this->context . '.filter.author_id', 'filter_author_id');
     $this->setState('filter.author_id', $author_id);
     // Filter - Access
     $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', '');
     $this->setState('filter.access', $access);
     // Filter - Project
     $project = PFApplicationHelper::getActiveProjectId('filter_project');
     $this->setState('filter.project', $project);
     // Filter - Directory
     $parent_id = JRequest::getUint('filter_parent_id', 1);
     $this->setState('filter.parent_id', $parent_id);
     // List state information.
     parent::populateState($ordering, $direction);
 }
Exemplo n.º 16
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')
 {
     // Initialise variables.
     $app = JFactory::getApplication();
     $params = $app->getParams();
     // Adjust the context to support modal layouts.
     if ($layout = JRequest::getVar('layout')) {
         $this->context .= '.' . $layout;
     }
     // Set Params
     $this->setState('params', $params);
     // Config - Count elements
     $this->setState('list.count_elements', (int) $params->get('show_element_count'));
     // Filter - Search
     $search = JRequest::getString('filter_search', '');
     $this->setState('filter.search', $search);
     // Filter - Author
     $author_id = $app->getUserStateFromRequest($this->context . '.filter.author_id', 'filter_author_id');
     $this->setState('filter.author_id', $author_id);
     // Filter - Access
     $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', '');
     $this->setState('filter.access', $access);
     // Filter - Project
     $project = PFApplicationHelper::getActiveProjectId('filter_project');
     $this->setState('filter.project', $project);
     // Filter - Directory
     $parent_id = JRequest::getUint('filter_parent_id', 1);
     $this->setState('filter.parent_id', $parent_id);
     // Filter - Labels
     $labels = (array) JRequest::getVar('filter_label', array(), 'post', 'array');
     $this->setState('filter.labels', $labels);
     // Do not allow to filter by author if no project is selected
     if ($project <= 0) {
         $this->setState('filter.author', '');
         $this->setState('filter.labels', array());
         $author_id = '';
         $labels = array();
     }
     // Filter - Is set
     $this->setState('filter.isset', !empty($search) || is_numeric($author_id) || count($labels));
     // Call parent method
     parent::populateState($ordering, $direction);
 }