YetiForceCompany/YetiForceCRM

View on GitHub
modules/OSSEmployees/models/DetailView.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%
<?php

/**
 * OSSEmployees DetailView model class.
 *
 * @copyright YetiForce S.A.
 * @license   YetiForce Public License 6.5 (licenses/LicenseEN.txt or yetiforce.com)
 * @author    Mariusz Krzaczkowski <m.krzaczkowski@yetiforce.com>
 */
class OSSEmployees_DetailView_Model extends Vtiger_DetailView_Model
{
    /** {@inheritdoc} */
    public function getDetailViewLinks(array $linkParams): array
    {
        $linkModelLists = parent::getDetailViewLinks($linkParams);
        if (!$this->getRecord()->isReadOnly()) {
            $linkURL = 'index.php?module=OSSEmployees&view=EmployeeHierarchy&record=' . $this->getRecord()->getId();
            $linkModelLists['DETAIL_VIEW_BASIC'][] = Vtiger_Link_Model::getInstanceFromValues([
                'linktype' => 'DETAIL_VIEW_BASIC',
                'linkhint' => 'LBL_SHOW_EMPLOYEES_HIERARCHY',
                'linkurl' => 'javascript:OSSEmployees_Detail_Js.triggerEmployeeHierarchy("' . $linkURL . '");',
                'linkicon' => 'yfi-hierarchy',
                'linkclass' => 'btn-outline-dark btn-sm',
            ]);
        }
        return $linkModelLists;
    }
}