本文整理汇总了PHP中Ajax::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Ajax::get方法的具体用法?PHP Ajax::get怎么用?PHP Ajax::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ajax
的用法示例。
在下文中一共展示了Ajax::get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ajax
/**
* Process ajax request
*
* @return array
*/
public function ajax()
{
if (!$this->is_ajaxed) {
return NULL;
}
$result = array();
$action = Ajax::get('action', 'replace');
$result['action'] = $action;
$result['id'] = $this->getId();
switch ($action) {
case 'replace':
$this->setValue(NULL);
$result['code'] = $this->render();
break;
}
event('form.element.ajax', $this, $result);
return $result;
}
示例2: edit_action
/**
* Edit action
*
* @param string $login
*/
public function edit_action($id = NULL)
{
$id or $id = $this->user->id;
$user = new User_Object();
$this->db->where('id', $id);
if (!$user->find()) {
return _404();
}
if (!access('user edit_all') && $this->id != $user->id) {
return _403();
}
$this->renderUserInfo($user);
$user = new User_Object();
$user->where('id', $id);
$user->find();
$form = new Form('User.profile');
$user->password = '';
$form->object($user->object());
if ($form->elements->avatar->is_ajaxed && Ajax::get('action') == 'replace') {
$user->avatar = '';
$user->update();
}
if ($result = $form->result()) {
if ($user->login != $result['login']) {
$redirect = Url::gear('user') . $result['login'];
}
if ($result->delete && access('users delete_all')) {
$user->delete();
flash_success(t('User <b>%s</b> was deleted!'));
redirect(Url::link('/users'));
}
$user->merge($result);
if ($result->password) {
$user->hashPassword();
} else {
unset($user->password);
}
if ($user->update()) {
d('User edit');
flash_success(t('User data saved!'), t('Success'));
d();
if ($user->id == $this->id) {
$this->store($user->object()->toArray());
}
redirect(Url::gear('user') . $user->login);
}
}
append('content', $form->render());
}
示例3: result
/**
* Result
*
* @return NULL|Core_ArrayObject — filtered and validated data
*/
public function result()
{
$this->init();
event('form.result.before', $this);
event('form.' . $this->name . '.result.before', $this);
$this->request = $this->method == 'POST' ? $_POST : $_GET;
$result = array();
$is_valid = TRUE;
if (sizeof($this->request) > 0) {
foreach ($this->elements as $name => $element) {
$value = $element->result();
if ($value !== FALSE) {
$result[$name] = $value;
} else {
$is_valid = FALSE;
}
}
}
if ($this->is_ajaxed) {
$response = array();
foreach ($this->elements as $name => $element) {
if ($name == Ajax::get('element')) {
if ($result = $element->ajax()) {
$response[$name] = $result;
}
}
}
event('form.ajax.before', $this, $response);
event('form.' . $this->name . '.ajax.before', $this, $response);
$response && Ajax::json($response);
}
event('form.result.after', $this, $is_valid, $result);
event('form.' . $this->name . '.result.after', $this, $is_valid, $result);
return $is_valid && $result ? Core_ArrayObject::transform($result) : FALSE;
}