Method verifyDashboard
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function verifyDashboard($moduleName)
{
\App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ')');
$currentUser = Users_Record_Model::getCurrentUserModel();
$blockId = Settings_WidgetsManagement_Module_Model::getBlocksFromModule($moduleName, $currentUser->getRole(), $this->get('dashboardId'));
Function verifyDashboard
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function verifyDashboard($moduleName)
{
\App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ')');
$currentUser = Users_Record_Model::getCurrentUserModel();
$blockId = Settings_WidgetsManagement_Module_Model::getBlocksFromModule($moduleName, $currentUser->getRole(), $this->get('dashboardId'));
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Missing class import via use statement (line '129', column '14'). Open
if (!(new App\Db\Query())->from('vtiger_module_dashboard_widgets')
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '184', column '17'). Open
$query = (new \App\Db\Query())->select(['vtiger_module_dashboard_widgets.module', 'vtiger_module_dashboard_blocks.tabid'])
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '116', column '22'). Open
$dataReader = (new App\Db\Query())
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '69', column '17'). Open
$query = (new \App\Db\Query())->select(['vtiger_links.*', 'mdw.userid', 'mdw.data', 'mdw.active', 'mdw.title', 'mdw.size', 'mdw.filterid',
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using static access to class 'Vtiger_Loader' in method 'getInstance'. Open
$modelClassName = Vtiger_Loader::getComponentClassName('Model', 'DashBoard', $moduleName);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Module_Model' in method 'getInstance'. Open
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'verifyDashboard'. Open
\App\Log::trace('Exiting ' . __METHOD__);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Settings_WidgetsManagement_Module_Model' in method 'verifyDashboard'. Open
$blockId = Settings_WidgetsManagement_Module_Model::getBlocksFromModule($moduleName, $currentUser->getRole(), $this->get('dashboardId'));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid assigning values to variables in if clauses and the like (line '201', column '23'). Open
public static function getModulesWithWidgets($moduleName, $dashboard)
{
$currentUser = Users_Privileges_Model::getCurrentUserModel();
$query = (new \App\Db\Query())->select(['vtiger_module_dashboard_widgets.module', 'vtiger_module_dashboard_blocks.tabid'])
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class 'Users_Privileges_Model' in method 'getDashboards'. Open
$userPrivModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Users_Privileges_Model' in method 'getModulesWithWidgets'. Open
$currentUser = Users_Privileges_Model::getCurrentUserModel();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Widget_Model' in method 'getDashboards'. Open
$widget = Vtiger_Widget_Model::getInstanceFromValues($row);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'verifyDashboard'. Open
\App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ')');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Widget_Model' in method 'verifyDashboard'. Open
$widget = Vtiger_Widget_Model::getInstanceFromValues($row);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'verifyDashboard'. Open
\App\Log::trace('Exiting ' . __METHOD__);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Module' in method 'getModulesWithWidgets'. Open
$modules[$tabId] = \App\Module::getModuleName($tabId);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Users_Record_Model' in method 'verifyDashboard'. Open
$currentUser = Users_Record_Model::getCurrentUserModel();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Module' in method 'getModulesWithWidgets'. Open
if ($moduleName && ($tabId = \App\Module::getModuleId($moduleName))) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Define a constant instead of duplicating this literal "linkid" 3 times. Open
$row['linkid'] = $row['id'];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "isdefault" 3 times. Open
$active = $row['isdefault'] ? 1 : 0;
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "userid" 3 times. Open
->where(['userid' => $currentUser->getId(), 'templateid' => $row['id']])
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "vtiger_module_dashboard_widgets" 3 times. Open
if (!(new App\Db\Query())->from('vtiger_module_dashboard_widgets')
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "dashboardId" 3 times. Open
->where(['mdw.userid' => $userPrivModel->getId(), 'vtiger_links.linktype' => 'DASHBOARDWIDGET', 'mdw.module' => $moduleModel->getId(), 'active' => $action, 'mdw.dashboardid' => $this->get('dashboardId')]);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "owners" 4 times. Open
$row['owners'] = htmlspecialchars_decode($row['owners'] ?? '');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Call to undeclared method \App\Db\Query::select
Open
$query = (new \App\Db\Query())->select(['vtiger_links.*', 'mdw.userid', 'mdw.data', 'mdw.active', 'mdw.title', 'mdw.size', 'mdw.filterid',
- Exclude checks
Return type of getDefaultWidgets()
is undeclared type \Vtiger_Widget_Model[]
Open
public function getDefaultWidgets()
- Exclude checks
Call to method getInstanceFromValues
from undeclared class \Vtiger_Widget_Model
Open
$widget = Vtiger_Widget_Model::getInstanceFromValues($row);
- Exclude checks
Call to method getInstanceFromValues
from undeclared class \Vtiger_Widget_Model
Open
$widget = Vtiger_Widget_Model::getInstanceFromValues($row);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
if (!(new App\Db\Query())->from('vtiger_module_dashboard_widgets')
- Exclude checks
Reference to undeclared property \Vtiger_DashBoard_Model->module
Open
return $this->module;
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
App\Db::getInstance()->createCommand()->insert('vtiger_module_dashboard_widgets', [
- Exclude checks
Return type of setModule()
is undeclared type \Vtiger_DetailView_Model
Open
public function setModule($moduleInstance)
- Exclude checks
Reference to undeclared property \Vtiger_DashBoard_Model->module
Open
$this->module = $moduleInstance;
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting ' . __METHOD__);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$dataReader = (new App\Db\Query())
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$query = (new \App\Db\Query())->select(['vtiger_module_dashboard_widgets.module', 'vtiger_module_dashboard_blocks.tabid'])
- Exclude checks
Return type of getDashboards()
is undeclared type \Vtiger_Widget_Model[]
Open
public function getDashboards(int $action = 1)
- Exclude checks
Saw unextractable annotation for comment '* @return <array> $modules'</array>
Open
* @return <Array> $modules
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ')');
- Exclude checks
Returning type \Vtiger_DashBoard_Model
but setModule()
is declared to return \Vtiger_DetailView_Model
Open
return $this;
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting ' . __METHOD__);
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Vtiger_DashBoard_Model extends \App\Base
- Exclude checks
The class Vtiger_DashBoard_Model is not named in CamelCase. Open
class Vtiger_DashBoard_Model extends \App\Base
{
/**
* Get widget special.
*
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
$query = (new \App\Db\Query())->select(['vtiger_links.*', 'mdw.userid', 'mdw.data', 'mdw.active', 'mdw.title', 'mdw.size', 'mdw.filterid',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ')');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row['owners'] = htmlspecialchars_decode($row['owners'] ?? '');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
ksort($modules);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->leftJoin('vtiger_module_dashboard_widgets mdw', 'vtiger_links.linkid = mdw.linkid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($widget->isViewable()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Vtiger_DashBoard_Model
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $instance->setModule($moduleModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->orWhere(['authorized' => $currentUser->getRole()])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$modules[$tabId] = \App\Module::getModuleName($tabId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function returns List of User's selected Dashboard Widgets.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = (new \App\Db\Query())->select(['vtiger_links.*', 'mdw.userid', 'mdw.data', 'mdw.active', 'mdw.title', 'mdw.size', 'mdw.filterid',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['vtiger_module_dashboard.blockid' => $blockId])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row['size'] = htmlspecialchars_decode($row['size']) ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'title' => $row['title'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Vtiger_Module_Model $moduleInstance - module model
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = $this->getModule();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $widgets;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
continue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$active = $row['isdefault'] ? 1 : 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance = new $modelClassName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$widgets[] = $widget;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'module' => $row['tabid'],
- Exclude checks
Line exceeds 120 characters; contains 130 characters Open
$query = (new \App\Db\Query())->select(['vtiger_module_dashboard_widgets.module', 'vtiger_module_dashboard_blocks.tabid'])
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
->leftJoin('vtiger_module_dashboard_blocks', 'vtiger_module_dashboard_blocks.id = vtiger_module_dashboard.blockid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->leftJoin('vtiger_module_dashboard_widgets', 'vtiger_module_dashboard_widgets.templateid = vtiger_module_dashboard.id')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $query->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($modules[$tabId])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get widget special.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Vtiger_Module_Model
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Vtiger_Widget_Model[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'widgetid' => 'mdw.id', 'mdw.position', 'id' => 'vtiger_links.linkid', 'mdw.limit', 'mdw.cache', 'mdw.owners', 'mdw.isdefault', 'mdw.module'])
- Exclude checks
Line exceeds 120 characters; contains 154 characters Open
'widgetid' => 'mdw.id', 'mdw.position', 'id' => 'vtiger_links.linkid', 'mdw.limit', 'mdw.cache', 'mdw.owners', 'mdw.isdefault', 'mdw.module'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('vtiger_module_dashboard')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'size' => $row['size'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName - module name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $dashboard
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['userid' => $currentUser->getId(), 'vtiger_module_dashboard_widgets.dashboardid' => $dashboard])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return ['ChartFilter', 'MiniList', 'Notebook', 'Rss', 'Multifilter', 'Multifilter', 'UpcomingEvents'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get Module instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setModule($moduleInstance)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDashboards(int $action = 1)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Line exceeds 120 characters; contains 217 characters Open
->where(['mdw.userid' => $userPrivModel->getId(), 'vtiger_links.linktype' => 'DASHBOARDWIDGET', 'mdw.module' => $moduleModel->getId(), 'active' => $action, 'mdw.dashboardid' => $this->get('dashboardId')]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row['linkid'] = $row['id'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['userid' => $currentUser->getId(), 'templateid' => $row['id']])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = (new \App\Db\Query())->select(['vtiger_module_dashboard_widgets.module', 'vtiger_module_dashboard_blocks.tabid'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('vtiger_module_dashboard')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['mdw.userid' => $userPrivModel->getId(), 'vtiger_links.linktype' => 'DASHBOARDWIDGET', 'mdw.module' => $moduleModel->getId(), 'active' => $action, 'mdw.dashboardid' => $this->get('dashboardId')]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$widget = Vtiger_Widget_Model::getInstanceFromValues($row);
- Exclude checks
Line exceeds 120 characters; contains 145 characters Open
$blockId = Settings_WidgetsManagement_Module_Model::getBlocksFromModule($moduleName, $currentUser->getRole(), $this->get('dashboardId'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getModulesWithWidgets($moduleName, $dashboard)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to set the module instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string - name of the module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $action
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userPrivModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$blockId = Settings_WidgetsManagement_Module_Model::getBlocksFromModule($moduleName, $currentUser->getRole(), $this->get('dashboardId'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$widget = Vtiger_Widget_Model::getInstanceFromValues($row);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$widget->isViewable()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row['data'] = htmlspecialchars_decode($row['data'] ?? '');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'filterid' => $row['filterid'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'active' => $active,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($modules[$tabId]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getModuleName()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = (new App\Db\Query())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!(new App\Db\Query())->from('vtiger_module_dashboard_widgets')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$modules = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->module;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->getModule()->get('name');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$widgets = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the default widgets(Deprecated).
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Vtiger_Widget_Model[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 == \count($blockId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getModule()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Vtiger_DetailView_Model
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the module name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDefaultWidgets()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->exists()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'templateid' => $row['id'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'cache' => $row['cache'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$modules = array_merge([$tabId => $moduleName], $modules);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function verifyDashboard($moduleName)
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
->leftJoin('vtiger_module_dashboard_widgets', 'vtiger_module_dashboard_widgets.templateid = vtiger_module_dashboard.id')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('vtiger_links')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentUser = Users_Record_Model::getCurrentUserModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
App\Db::getInstance()->createCommand()->insert('vtiger_module_dashboard_widgets', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'userid' => $currentUser->getId(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'limit' => $row['limit'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'isdefault' => $row['isdefault'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'date' => $row['date'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get modules with widgets.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->module = $moduleInstance;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $query->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting ' . __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'data' => $row['data'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting ' . __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getInstance($moduleName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$modelClassName = Vtiger_Loader::getComponentClassName('Model', 'DashBoard', $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return <Array> $modules
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getWidgetSpecial(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Sync widgets on dashboard.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_links', 'vtiger_links.linkid = vtiger_module_dashboard.linkid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkid' => $row['linkid'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'owners' => $row['owners'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'dashboardid' => $this->get('dashboardId'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName - module name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentUser = Users_Privileges_Model::getCurrentUserModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->leftJoin('vtiger_module_dashboard_blocks', 'vtiger_module_dashboard_blocks.id = vtiger_module_dashboard.blockid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->groupBy('module, tabid');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tabId = $row['module'] ?: $row['tabid'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($moduleName && ($tabId = \App\Module::getModuleId($moduleName))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $modules;
- Exclude checks
Class name "Vtiger_DashBoard_Model" is not in camel caps format Open
class Vtiger_DashBoard_Model extends \App\Base
- Exclude checks