Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/units/modules/modules_event_handler.php
Show All 37 Lines | |||||
* @return void | * @return void | ||||
* @access protected | * @access protected | ||||
* @see kDBEventHandler::OnListBuild() | * @see kDBEventHandler::OnListBuild() | ||||
*/ | */ | ||||
protected function SetCustomQuery(kEvent $event) | protected function SetCustomQuery(kEvent $event) | ||||
{ | { | ||||
parent::SetCustomQuery($event); | parent::SetCustomQuery($event); | ||||
/** @var kDBList $object */ | |||||
$object = $event->getObject(); | $object = $event->getObject(); | ||||
/* @var $object kDBList */ | |||||
if ( $event->Special ) { | if ( $event->Special ) { | ||||
$object->addFilter('current_module', '%1$s.Name = ' . $event->Special); | $object->addFilter('current_module', '%1$s.Name = ' . $event->Special); | ||||
} | } | ||||
$object->addFilter('not_core', '%1$s.Name <> "Core"'); | $object->addFilter('not_core', '%1$s.Name <> "Core"'); | ||||
} | } | ||||
Show All 19 Lines | |||||
*/ | */ | ||||
function moduleAction($event) | function moduleAction($event) | ||||
{ | { | ||||
if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) { | if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) { | ||||
$event->status = kEvent::erFAIL; | $event->status = kEvent::erFAIL; | ||||
return ; | return ; | ||||
} | } | ||||
/** @var kDBItem $object */ | |||||
$object = $event->getObject( Array('skip_autoload' => true) ); | $object = $event->getObject( Array('skip_autoload' => true) ); | ||||
/* @var $object kDBItem */ | |||||
$ids = $this->StoreSelectedIDs($event); | $ids = $this->StoreSelectedIDs($event); | ||||
if (!$ids) { | if (!$ids) { | ||||
return ; | return ; | ||||
} | } | ||||
$updated = 0; | $updated = 0; | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | |||||
* @param kEvent $event | * @param kEvent $event | ||||
* @return void | * @return void | ||||
* @access protected | * @access protected | ||||
*/ | */ | ||||
protected function OnAfterListQuery(kEvent $event) | protected function OnAfterListQuery(kEvent $event) | ||||
{ | { | ||||
parent::OnAfterListQuery($event); | parent::OnAfterListQuery($event); | ||||
/** @var kModulesHelper $modules_helper */ | |||||
$modules_helper = $this->Application->recallObject('ModulesHelper'); | $modules_helper = $this->Application->recallObject('ModulesHelper'); | ||||
/* @var $modules_helper kModulesHelper */ | |||||
$new_modules = $modules_helper->getModules(kModulesHelper::NOT_INSTALLED); | $new_modules = $modules_helper->getModules(kModulesHelper::NOT_INSTALLED); | ||||
if ( !$new_modules || $this->Application->RecallVar('user_id') != USER_ROOT ) { | if ( !$new_modules || $this->Application->RecallVar('user_id') != USER_ROOT ) { | ||||
return; | return; | ||||
} | } | ||||
require_once FULL_PATH . '/core/install/install_toolkit.php'; | require_once FULL_PATH . '/core/install/install_toolkit.php'; | ||||
$toolkit = new kInstallToolkit(); | $toolkit = new kInstallToolkit(); | ||||
/** @var kDBList $object */ | |||||
$object = $event->getObject(); | $object = $event->getObject(); | ||||
/* @var $object kDBList */ | |||||
foreach ($new_modules as $module) { | foreach ($new_modules as $module) { | ||||
$module_record = Array ( | $module_record = Array ( | ||||
'Name' => $toolkit->getModuleName($module), | 'Name' => $toolkit->getModuleName($module), | ||||
'Path' => 'modules/' . $module . '/', | 'Path' => 'modules/' . $module . '/', | ||||
'Version' => $toolkit->GetMaxModuleVersion('modules/' . $module . '/'), | 'Version' => $toolkit->GetMaxModuleVersion('modules/' . $module . '/'), | ||||
'Loaded' => 0, | 'Loaded' => 0, | ||||
'BuildDate' => null, | 'BuildDate' => null, | ||||
); | ); | ||||
$object->addRecord($module_record); | $object->addRecord($module_record); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
No newline at end of file | No newline at end of file |