本文整理汇总了PHP中ajax::info方法的典型用法代码示例。如果您正苦于以下问题:PHP ajax::info方法的具体用法?PHP ajax::info怎么用?PHP ajax::info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ajax
的用法示例。
在下文中一共展示了ajax::info方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_delete
public function action_delete()
{
$role = ORM::factory('Role', arr::get($_POST, 'id'));
if (!$role->loaded()) {
ajax::error(__('Role not found. Has it been deleted already?'));
}
try {
$role->delete();
ajax::info(__('Deleted'));
} catch (exception $e) {
ajax::error(__('An uncaught error occurred: :error', array(':error' => $e->getMessage())));
}
}
示例2: action_autosave
public function action_autosave()
{
if (!user::logged()) {
ajax::error('You must be logged in');
}
$user = user::get();
$autosave = ORM::factory('Page')->where('user_id', '=', $user->id)->where('type', '=', 'autosave')->find();
if (!$autosave->loaded()) {
$autosave->user_id = $user->id;
$autosave->type = 'autosave';
}
$content = arr::get($_POST, 'content', '');
$autosave->content = $content;
try {
$autosave->save();
ajax::success('Page saved!');
} catch (ORM_Validation_Exception $e) {
ajax::error('Validation error');
$errors = $e->errors('models');
}
ajax::info('Nothing to do');
}
示例3: action_delete
public function action_delete()
{
$user = $this->post();
if (arr::get($_POST, 'action') == 'transfer') {
$newowner = arr::get($_POST, 'newowner', 3);
$content = $user->contents->find_all();
if ((bool) $content->count()) {
foreach ($content as $cont) {
$cont->user_id = $newowner;
$cont->save();
}
}
}
try {
$user->delete();
ajax::info(__('User deleted'));
} catch (exception $e) {
ajax::error(__('An uncaught error occurred: :error', array(':error' => $e->getMessage())));
}
}
示例4: action_deletepost
public function action_deletepost()
{
if (!user::logged()) {
ajax::error('You must be logged in to do that.');
}
$id = arr::get($_POST, 'id', false);
$object = ORM::factory('Talkreply', $id);
if (!$object->loaded()) {
ajax::error('I couldn\'t find that post. Has it already been deleted? Please contact us if you think this is a mistake');
}
if (!user::can_edit($object)) {
ajax::error('That doesn\'t seem to be your post to delete. Please contact us if you think this is a mistake');
}
$object->deleted = time();
$object->deleted_by = user::get()->id;
try {
$object->talk->deleted = 0;
$object->talk->save();
$object->save();
if ($object->op == 1) {
$talk = $object->talk;
$talk->deleted = 1;
$talk->save();
}
ajax::info('Your post has been deleted.');
} catch (exception $e) {
Kohana::$log->add(Log::CRITICAL, 'Couldn\'t delete Model_Talkreply: :message. User_id: :userid, postreply_id: :replyid', array(':message' => $e->getMessage(), ':userid' => user::get()->id, ':replyid' => $object->id));
ajax::error('Something went wrong and your post couln\'t be deleted. Please try again or contact us if you think this is a mistake.');
}
}
示例5: action_delete
public function action_delete()
{
$dashboard = ORM::factory('Dashboard', arr::get($_POST, 'id'));
if (!$dashboard->loaded()) {
ajax::error('The dashboard wasn\'t found. Has it been deleted in the meantime?');
}
try {
$user = $dashboard->user;
$dashboard->delete();
$dashboards = $user->dashboards->count_all();
if ((bool) $dashboards) {
$current = $user->dashboards->find();
$current->current = 1;
$current->save();
}
ajax::info('Dashboard deleted', array('dashboard' => dashboards::get_current()->info()));
} catch (exception $e) {
ajax::error('An error occurred and the panel could not be deleted: ' . $e->getMessage());
}
}