public static function create_from_reflection_method(\ReflectionMethod $m) { $args = new ArgumentList(); foreach ($m->getParameters() as $p) { $args->push(Argument::create_from_reflection_parameter($p)); } return $args; }
function setPosition(ArgumentList $args) { // $this->updateParams(); $id = $args->getInt("id"); $move = $args->getArgument("move"); if ($move == "up") { $this->getStatement()->update('sc_news', array("position=position+1"), "id=" . $id); } if ($move == "down") { $this->getStatement()->update('sc_news', array("position=position-1"), "id=" . $id); } $this->callSelfComponent(); }
private function renderHead() { if ($this->no_op) { return $this->head; } $this->parseDocblock(); $arglist = new ArgumentList($this->param_types); $in_args = false; $out = []; foreach ($this->head as $token) { if ($token->is('(')) { $in_args = true; $out[] = $token; continue; } elseif ($token->is(')')) { $out = array_merge($out, $arglist->getTokens()); $in_args = false; $out[] = $token; $out[] = $this->buildReturnType(); continue; } if ($in_args) { $arglist->addToken($token); } else { $out[] = $token; } } return $out; }
function onSubmit(ArgumentList $args, ArgumentList $post) { if ($post->exists('name') && $post->exists('save')) { if ($post->getArgument('fields')) { $fields = explode(',', $post->getArgument('fields')); $config = array(); foreach ($fields as $f) { list($name, $desc) = explode(':', $f); if ($post->exists($name)) { $config[$name] = $post->getArgument($name); } } $vals['config'] = serialize($config); } $fields = explode(',', $post->getArgument('error_codes')); $config = array(); foreach ($fields as $f) { if ($post->exists("e" . $f)) { $config[$f] = $post->getArgument("e" . $f); } } $vals['error_desc'] = serialize($config); $vals['description'] = $post->getArgument('description'); $vals['text'] = $post->getArgument('text'); $this->getStatement()->update('sc_pay_system', $vals, "name='" . $post->getArgument('name') . "'"); } $this->callSelfComponent(); }
function setPosition(ArgumentList $args) { $id = $args->getInt('id'); $move = $args->getArgument('move'); $rs = $this->getStatement()->execute("select * from sc_module where mod_id=" . $id); if ($rs->next()) { if ($move == "up") { $this->getStatement()->up('sc_module', $id, "mod_parent_id='" . $rs->get("mod_parent_id") . "'", 'mod_id', 'mod_position'); } if ($move == "down") { $this->getStatement()->down('sc_module', $id, "mod_parent_id='" . $rs->get("mod_parent_id") . "'", 'mod_id', 'mod_position'); } } //Очистим кеш // $this->getStatement()->delete('sc_cache',"name='ModuleManager::module'"); $this->callSelfComponent(); }
function onChangeStatus(ArgumentList $args) { global $ST; $ST->update('sc_shop_item', array('status' => $args->getInt('status')), "id=" . $args->getInt('id')); $this->callSelfComponent(); }
function onRemove(ArgumentList $args) { $q = "delete from sc_users where u_id =" . $args->getArgument("id"); $this->getStatement()->executeDelete($q); $this->callSelfComponent(); }
/** * Creates a Method which, when called, will delegate to a given instance variable */ public static function create_delegate_for_reflection(\ReflectionMethod $method, $variable) { $method_name = $method->getName(); $m = new Method($method_name); $m->set_arg_list(ArgumentList::create_from_reflection_method($method)); if ($method->returnsReference()) { $m->set_reference_returned(true); } if ($method->isPublic()) { $m->set_access_public(); } elseif ($method->isProtected()) { $m->set_access_protected(); } elseif ($method->isPrivate()) { $m->set_access_private(); } $body = ' return call_user_func_array( array($this->' . $variable . ', "' . $method_name . '"), func_get_args() ); '; $m->set_body(trim(preg_replace('/\\s+/', ' ', $body))); return $m; }
function onSubmit(ArgumentList $args, ArgumentList $post) { $this->callComponentPage('/search/' . ($post->exists('search') ? urlencode($post->getArgument('search')) . '/' : '') . ($post->exists('type_search') && $post->getArgument('type_search') ? 'type/' . $post->getArgument('type_search') . '/' : '')); }