Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion src/components/com_tjucm/site/controllers/item.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,28 @@ public function __construct()
$tjUcmModelType = JModelLegacy::getInstance('Type', 'TjucmModel');
$this->ucmTypeId = $tjUcmModelType->getTypeId($this->client);

// If client is empty then get client from menu params
if (empty($this->client))
{
// Get the active item
$menuitem = $app->getMenu()->getActive();

// Get the params
$this->menuparams = $menuitem->params;

if (!empty($this->menuparams))
{
$this->ucm_type = $this->menuparams->get('ucm_type');

if (!empty($this->ucm_type))
{
JLoader::import('components.com_tjfields.tables.type', JPATH_ADMINISTRATOR);
$ucmTypeTable = JTable::getInstance('Type', 'TjucmTable', array('dbo', JFactory::getDbo()));
$ucmTypeTable->load(array('alias' => $this->ucm_type));
$this->client = $ucmTypeTable->unique_identifier;
}
}
}
parent::__construct();
}

Expand All @@ -70,6 +92,7 @@ public function edit()

// Get the model.
$model = $this->getModel('Item', 'TjucmModel');


// Check out the item
if ($editId)
Expand Down Expand Up @@ -113,6 +136,7 @@ public function publish()
$canEdit = $user->authorise('core.type.edititem', 'com_tjucm.type.edititem' . $this->ucmTypeId);
$canChange = $user->authorise('core.type.edititemstate', 'com_tjucm.type.' . $this->ucmTypeId);


Comment thread
ChavanAnkitaMahesh marked this conversation as resolved.
if ($canEdit || $canChange)
{
$model = $this->getModel('Item', 'TjucmModel');
Expand Down Expand Up @@ -140,7 +164,7 @@ public function publish()
$this->setMessage(JText::_('COM_TJUCM_ITEM_SAVED_SUCCESSFULLY'));

// If there isn't any menu item active, redirect to list view
$itemId = $tjUcmFrontendHelper->getItemId('index.php?option=com_tjucm&view=items' . $this->appendUrl);
$itemId = $tjUcmFrontendHelper->getItemId('index.php?option=com_tjucm&view=items' . $this->client);
$this->setRedirect(JRoute::_('index.php?option=com_tjucm&view=items' . $this->appendUrl . '&Itemid=' . $itemId, false));
}
else
Expand Down