public function execute() { // Get parameters $params = $this->extractRequestParams(); $result = $this->getResult(); $queryObj = new ApiQuery($this->getMain(), 'query'); $r = array(); if (is_array($params['modules'])) { $modArr = $this->getMain()->getModules(); $r['modules'] = array(); foreach ($params['modules'] as $m) { if (!isset($modArr[$m])) { $r['modules'][] = array('name' => $m, 'missing' => ''); continue; } $obj = new $modArr[$m]($this->getMain(), $m); $a = $this->getClassInfo($obj); $a['name'] = $m; $r['modules'][] = $a; } $result->setIndexedTagName($r['modules'], 'module'); } if (is_array($params['querymodules'])) { $qmodArr = $queryObj->getModules(); $r['querymodules'] = array(); foreach ($params['querymodules'] as $qm) { if (!isset($qmodArr[$qm])) { $r['querymodules'][] = array('name' => $qm, 'missing' => ''); continue; } $obj = new $qmodArr[$qm]($this, $qm); $a = $this->getClassInfo($obj); $a['name'] = $qm; $a['querytype'] = $queryObj->getModuleType($qm); $r['querymodules'][] = $a; } $result->setIndexedTagName($r['querymodules'], 'module'); } if ($params['mainmodule']) { $r['mainmodule'] = $this->getClassInfo($this->getMain()); } if ($params['pagesetmodule']) { $pageSet = new ApiPageSet($queryObj); $r['pagesetmodule'] = $this->getClassInfo($pageSet); } $result->addValue(null, $this->getModuleName(), $r); }
/** * Module for displaying help */ public function execute() { // Get parameters $params = $this->extractRequestParams(); if (!isset($params['modules']) && !isset($params['querymodules'])) { $this->dieUsage('', 'help'); } $this->getMain()->setHelp(); $result = $this->getResult(); $queryObj = new ApiQuery($this->getMain(), 'query'); $r = array(); if (is_array($params['modules'])) { $modArr = $this->getMain()->getModules(); foreach ($params['modules'] as $m) { if (!isset($modArr[$m])) { $r[] = array('name' => $m, 'missing' => ''); continue; } $module = new $modArr[$m]($this->getMain(), $m); $r[] = $this->buildModuleHelp($module, 'action'); } } if (is_array($params['querymodules'])) { $qmodArr = $queryObj->getModules(); foreach ($params['querymodules'] as $qm) { if (!isset($qmodArr[$qm])) { $r[] = array('name' => $qm, 'missing' => ''); continue; } $module = new $qmodArr[$qm]($this, $qm); $type = $queryObj->getModuleType($qm); if ($type === null) { $r[] = array('name' => $qm, 'missing' => ''); continue; } $r[] = $this->buildModuleHelp($module, $type); } } $result->setIndexedTagName($r, 'module'); $result->addValue(null, $this->getModuleName(), $r); }
public function execute() { // Get parameters $params = $this->extractRequestParams(); $result = $this->getResult(); $res = array(); if (is_array($params['modules'])) { $modules = $this->getMain()->getModules(); $res['modules'] = array(); foreach ($params['modules'] as $mod) { if (!isset($modules[$mod])) { $res['modules'][] = array('name' => $mod, 'missing' => ''); continue; } $obj = new $modules[$mod]($this->getMain(), $mod); $item = $this->getClassInfo($obj); $item['name'] = $mod; $res['modules'][] = $item; } $result->setIndexedTagName($res['modules'], 'module'); } if (is_array($params['querymodules'])) { $queryModules = $this->queryObj->getModules(); $res['querymodules'] = array(); foreach ($params['querymodules'] as $qm) { if (!isset($queryModules[$qm])) { $res['querymodules'][] = array('name' => $qm, 'missing' => ''); continue; } $obj = new $queryModules[$qm]($this, $qm); $item = $this->getClassInfo($obj); $item['name'] = $qm; $item['querytype'] = $this->queryObj->getModuleType($qm); $res['querymodules'][] = $item; } $result->setIndexedTagName($res['querymodules'], 'module'); } if ($params['mainmodule']) { $res['mainmodule'] = $this->getClassInfo($this->getMain()); } if ($params['pagesetmodule']) { $pageSet = new ApiPageSet($this->queryObj); $res['pagesetmodule'] = $this->getClassInfo($pageSet); } if (is_array($params['formatmodules'])) { $formats = $this->getMain()->getFormats(); $res['formatmodules'] = array(); foreach ($params['formatmodules'] as $f) { if (!isset($formats[$f])) { $res['formatmodules'][] = array('name' => $f, 'missing' => ''); continue; } $obj = new $formats[$f]($this, $f); $item = $this->getClassInfo($obj); $item['name'] = $f; $res['formatmodules'][] = $item; } $result->setIndexedTagName($res['formatmodules'], 'module'); } $result->addValue(null, $this->getModuleName(), $res); }