本文整理匯總了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());
}
}