modules/MultiCompany/views/Hierarchy.php
<?php
/**
* Class to show hierarchy.
*
* @copyright YetiForce S.A.
* @license YetiForce Public License 6.5 (licenses/LicenseEN.txt or yetiforce.com)
* @author Mariusz Krzaczkowski <m.krzaczkowski@yetiforce.com>
*/
class MultiCompany_Hierarchy_View extends \App\Controller\View\Page
{
use App\Controller\ClearProcess;
/** {@inheritdoc} */
public function checkPermission(App\Request $request)
{
$recordId = $request->getInteger('record');
if (!$recordId) {
throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
}
if (!\App\Privilege::isPermitted($request->getModule(), 'DetailView', $recordId)) {
throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
}
}
/** {@inheritdoc} */
public function process(App\Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$recordId = $request->getInteger('record');
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
$hierarchy = $recordModel->getHierarchy();
$viewer->assign('MODULE', $moduleName);
$viewer->assign('HIERARCHY', $hierarchy);
$viewer->view('Hierarchy.tpl', $moduleName);
}
}