public function __index($page = 1) { $me = _G('ME'); $group = _G('GROUP'); if (!$me->id || !$group->id || !$me->isAllowedTo('设置')) { $this->redirect('error/401'); } $rpc = \Gini\Module\HazardousControlOrders::getRPC('chemical-limits'); $limits = $rpc->admin->inventory->getGroupLimits($group->id); $page = (int) $page; $vars = ['limits' => $limits, 'requestsHTML' => \Gini\CGI::request("ajax/settings/chemical-limits/requests-more/{$page}", $this->env)->execute()->content()]; $this->view->body = V('settings/chemical-limits', $vars); }
public function actionRequest($args) { if (count($args) < 1) { die("Usage: gini cgi request <URL>\n"); } $route = array_shift($args); array_map(function ($arg) { list($k, $v) = explode('=', $arg); $_GET[$k] = $v; }, $args); $env = ['get' => $_GET, 'post' => $_POST, 'files' => $_FILES, 'route' => $route]; echo "Requesting {$route}...\n"; $content = \Gini\CGI::request($route, $env)->execute()->content(); if (is_string($content)) { echo $content; } else { echo yaml_emit($content, YAML_UTF8_ENCODING); } }