YetiForceCompany/YetiForceCRM

View on GitHub
modules/Reservations/models/Module.php

Summary

Maintainability
A
0 mins
Test Coverage
B
81%
<?php

/**
 * Reservations module model class.
 * @package   Model
 * @copyright YetiForce S.A.
 * @license   YetiForce Public License 6.5 (licenses/LicenseEN.txt or yetiforce.com)
 */
class Reservations_Module_Model extends Vtiger_Module_Model
{
    public function getCalendarViewUrl()
    {
        return 'index.php?module=' . $this->get('name') . '&view=Calendar';
    }

    /** {@inheritdoc} */
    public function getSideBarLinks($linkParams)
    {
        $links = parent::getSideBarLinks($linkParams);
        array_unshift($links['SIDEBARLINK'], Vtiger_Link_Model::getInstanceFromValues([
            'linktype' => 'SIDEBARLINK',
            'linklabel' => 'LBL_CALENDAR',
            'linkurl' => $this->getCalendarViewUrl(),
            'linkicon' => 'fas fa-calendar-alt'
        ]));
        return $links;
    }

    /**
     * Function to get the Default View Component Name.
     *
     * @return string
     */
    public function getDefaultViewName()
    {
        return 'Calendar';
    }

    /** {@inheritdoc} */
    public function getLayoutTypeForQuickCreate(): string
    {
        return 'standard';
    }
}