当前位置: 首页>>代码示例>>PHP>>正文


PHP ajax::error方法代码示例

本文整理汇总了PHP中ajax::error方法的典型用法代码示例。如果您正苦于以下问题:PHP ajax::error方法的具体用法?PHP ajax::error怎么用?PHP ajax::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ajax的用法示例。


在下文中一共展示了ajax::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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())));
     }
 }
开发者ID:artbypravesh,项目名称:morningpages,代码行数:13,代码来源:Roles.php

示例2: action_delete

 public function action_delete()
 {
     $vacation = ORM::factory('Vacation', arr::get($_POST, 'id', ''));
     if (!$vacation->loaded()) {
         ajax::error('Ferien blev ikke fundet. Er den allerede blevet slettet?');
     }
     try {
         $vacation->delete();
         ajax::success();
     } catch (exception $e) {
         ajax::error('Der opstod en fejl: ' . $e->getMessage());
     }
 }
开发者ID:artbypravesh,项目名称:morningpages,代码行数:13,代码来源:Vacations.php

示例3: action_toggleread

 public function action_toggleread()
 {
     $message = ORM::factory('Message', arr::get($_POST, 'id'));
     if (!$message->loaded()) {
         ajax::error(__('The message wasn\'t found. Has it already been deleted?'));
     }
     $message->read = arr::get($_POST, 'read', '0');
     try {
         $message->save();
         ajax::success();
     } catch (exception $e) {
         ajax::error(__('An uncaught error occurred: :error', array(':error' => $e->getMessage())));
     }
 }
开发者ID:artbypravesh,项目名称:morningpages,代码行数:14,代码来源:Messages.php

示例4: action_getautosave

 public function action_getautosave()
 {
     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();
     $content = '';
     if ($autosave->loaded() && $autosave->content != '') {
         $content = $autosave->decode($autosave->content);
         $autosave->delete();
     }
     ajax::success('', array('content' => $content, 'md5' => md5($content)));
 }
开发者ID:artbypravesh,项目名称:morningpages,代码行数:14,代码来源:Write.php

示例5: action_get

 public function action_get()
 {
     $contenttype = ORM::factory('Contenttype', arr::get($_GET, 'id', ''));
     if (!$contenttype->loaded()) {
         ajax::error(__('Contenttype not found. Has it been deleted?'));
     }
     $items = array();
     $contents = $contenttype->contents->find_all();
     if ((bool) $contents->count()) {
         foreach ($contents as $content) {
             $items[] = array('id' => $content->id, 'title' => $content->title());
         }
     }
     ajax::success('', array('id' => $contenttype->id, 'type' => $contenttype->type, 'slug' => $contenttype->slug, 'icon' => $contenttype->icon, 'hierarchical' => $contenttype->hierarchical, 'has_categories' => $contenttype->has_categories, 'has_tags' => $contenttype->has_tags, 'has_timestamp' => $contenttype->has_timestamp, 'has_thumbnail' => $contenttype->has_thumbnail, 'has_author' => $contenttype->has_author, 'display' => $contenttype->display, 'items' => $items));
 }
开发者ID:artbypravesh,项目名称:morningpages,代码行数:15,代码来源:Contenttype.php

示例6: action_twitter

 public function action_twitter()
 {
     $redirect = '';
     try {
         $connection = new TwitterOAuth(arr::get($this->creds, 'key'), arr::get($this->creds, 'secret'));
         $tmp = $connection->getRequestToken('http://morningpages.net/auth/twittercallback');
         Session::instance()->set('twitter_oauth_token', arr::get($tmp, 'oauth_token', ''));
         Session::instance()->set('twitter_oauth_token_secret', arr::get($tmp, 'oauth_token_secret', ''));
         $redirect = $connection->getAuthorizeURL($tmp);
     } catch (exception $e) {
         ajax::error('Oh no! Something went wrong and we couldn\'t get a hold of Twitter! They might be too busy right now. You can either wait a bit and see if Twitter wakes up or use another way of logging in.');
         site::redirect();
     }
     site::redirect($redirect);
 }
开发者ID:artbypravesh,项目名称:morningpages,代码行数:15,代码来源:Auth.php

示例7: action_takechallenge

 public function action_takechallenge()
 {
     if (!user::logged()) {
         ajax::error('You must be logged in to sign up for the challenge!');
     }
     $user = user::get();
     if ($user->doing_challenge()) {
         ajax::error('You are already doing the challenge! Complete it first, then sign up again.');
     }
     $challenge = ORM::factory('User_Challenge');
     $challenge->user_id = $user->id;
     $challenge->start = $user->timestamp();
     $challenge->progress = 0;
     if ($user->wrote_today()) {
         $challenge->progress = 1;
     }
     $challenge->save();
     $user->add_event('Signed up for the 30 day challenge!');
     ajax::success('Awesome! You have signed up for the challenge! Good luck!', array('progress' => $challenge->progress));
 }
开发者ID:artbypravesh,项目名称:morningpages,代码行数:20,代码来源:Games.php

示例8: action_create

 public function action_create()
 {
     $content = ORM::factory('Content', arr::get($_POST, 'parent', ''));
     if (!$content->loaded()) {
         ajax::error('The content wasn\'t found. Has it been deleted?');
     }
     $title = arr::get($_POST, 'title', false);
     if (!$title) {
         $title = $content->title;
     }
     $clone = $content->copy();
     $clone->splittest = $content->id;
     $clone->splittest_title = $title;
     try {
         $clone->save();
         ajax::success('Splittest created', array('splittest' => array('id' => $clone->id, 'title' => $clone->splittest_title)));
     } catch (exception $e) {
         ajax::error('An error occurred and the splittest couldn\'t be created. The site said: ' . $e->getMessage());
     }
 }
开发者ID:artbypravesh,项目名称:morningpages,代码行数:20,代码来源:Splittest.php

示例9: action_add

 public function action_add()
 {
     $title = arr::get($_POST, 'title', false);
     if (!$title || empty($title)) {
         ajax::error('A title is required');
     }
     $option = ORM::factory('Option');
     $option->optiongroup_id = arr::get($_POST, 'group');
     $option->title = $title;
     $option->key = arr::get($_POST, 'key', '');
     $option->type = arr::get($_POST, 'type', 'text');
     $option->description = arr::get($_POST, 'description', '');
     $option->editable = arr::get($_POST, 'editable', '1');
     try {
         $option->save();
         ajax::success('Option added', array('option' => $option->info()));
     } catch (exception $e) {
         ajax::error('Something went wrong: ' . $e->getMessage());
     }
 }
开发者ID:artbypravesh,项目名称:morningpages,代码行数:20,代码来源:Options.php

示例10: action_delete

 public function action_delete()
 {
     if ($_POST) {
         $id = arr::get($_POST, 'id', false);
         if (!$id) {
             ajax:
             error(__('No data recieved'));
         }
         try {
             if (is_array($id)) {
                 foreach ($id as $fid) {
                     ORM::factory('File', $fid)->delete();
                 }
             } else {
                 ORM::factory('File', arr::get($_POST, 'id', false))->delete();
             }
             ajax::success('ok');
         } catch (exception $e) {
             ajax::error(__('An uncaught error occurred and the file couldn\'t be deleted: :error', array(':error' => $e->getMessage())));
         }
     }
 }
开发者ID:artbypravesh,项目名称:morningpages,代码行数:22,代码来源:Filebrowser.php

示例11: action_xml

 public function action_xml()
 {
     if (!user::logged()) {
         ajax::error('You must be logged in to use this feature');
     }
     $user = user::get();
     $pages = $user->pages->where('type', '=', 'page')->find_all();
     $xml = '<?xml version="1.0" encoding="UTF-8"?>';
     $xml .= '<channel>';
     $namelen = strlen($user->username);
     $possessive = $user->username . "'s";
     if (substr($user->username, $namelen - 1, $namelen) == 's') {
         $possessive = $user->username . "'";
     }
     $xml .= '<title>' . $possessive . ' morning pages</title>';
     $xml .= '<language>en-US</language>';
     $xml .= '<author>' . $user->username . '</author>';
     $xml .= '<pages>';
     if ((bool) $pages->count()) {
         foreach ($pages as $page) {
             $xml .= '<page>';
             $xml .= '<published>';
             $xml .= '<date>' . $page->daystamp() . '</date>';
             $xml .= '<timestamp>' . $page->created . '</timestamp>';
             $xml .= '</published>';
             $xml .= '<content><![CDATA[' . $page->rawcontent() . ']]></content>';
             $xml .= '<wordcount>' . $page->wordcount . '</wordcount>';
             $xml .= '</page>';
         }
     }
     $xml .= '</pages>';
     $xml .= '</channel>';
     $this->response->headers('Content-Type', 'text/xml');
     $this->response->body($xml);
     $this->response->send_file(true, 'pages.xml');
 }
开发者ID:artbypravesh,项目名称:morningpages,代码行数:36,代码来源:Export.php

示例12: 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())));
     }
 }
开发者ID:artbypravesh,项目名称:morningpages,代码行数:20,代码来源:Users.php

示例13: action_updateWidgets

 public function action_updateWidgets()
 {
     $dashboard = ORM::factory('Dashboard', arr::get($_POST, 'id'));
     if (!$dashboard->loaded()) {
         ajax::error('he dashboard wasn\'t found. Has it been deleted in the meantime?');
     }
     $widgets = arr::get($_POST, 'widgets', false);
     if ($widgets && (bool) count($widgets)) {
         foreach ($widgets as $w) {
             $widget = ORM::factory('Widget', arr::get($w, 'id'));
             if ($widget->loaded()) {
                 $widget->sizex = arr::get($w, 'sizex');
                 $widget->sizey = arr::get($w, 'sizey');
                 $widget->col = arr::get($w, 'col');
                 $widget->row = arr::get($w, 'row');
                 $widget->save();
             }
         }
     }
     ajax::success('ok');
 }
开发者ID:artbypravesh,项目名称:morningpages,代码行数:21,代码来源:Dashboards.php

示例14: action_delete

 public function action_delete()
 {
     $block = ORM::factory('Block', arr::get($_POST, 'block_id'));
     if (!$block->loaded()) {
         ajax::error('Blokken blev ikke fundet.');
     }
     try {
         $block->delete();
         ajax::success('ok');
     } catch (exception $e) {
         ajax::error('Der opstod en fejl og blokken kunne ikke slettes. Siden sagde: ' . $e->getMessage());
     }
 }
开发者ID:artbypravesh,项目名称:morningpages,代码行数:13,代码来源:Blocks.php

示例15: action_addinternal

 public function action_addinternal()
 {
     $menu = ORM::factory('Menu', arr::get($_POST, 'id', ''));
     if (!$menu->loaded()) {
         ajax::error(__('The menu wasn\'t found. Has it been deleted in the meantime?'));
     }
     $content = ORM::factory('Content', arr::get($_POST, 'content', ''));
     if (!$content->loaded()) {
         ajax::error(__('The content wasn\'t found. Has it been deleted in the meantime?'));
     }
     $item = ORM::factory('Menu_Item');
     $item->menu_id = $menu->id;
     $item->content_id = $content->id;
     $item->linktext = $content->title();
     $item->titletext = $content->title();
     $item->order = $menu->items->count_all();
     try {
         $item->save();
         ajax::success('', array('item' => $item->info()));
     } catch (exception $e) {
         ajax::error(__('An error occurred and the menuitem couldn\'t be added: :error', array(':error' => $e->getMessage())));
     }
 }
开发者ID:artbypravesh,项目名称:morningpages,代码行数:23,代码来源:Navigation.php


注:本文中的ajax::error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。