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


PHP Draft::save方法代码示例

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


在下文中一共展示了Draft::save方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: move_to_drafts

 public function move_to_drafts($dummy)
 {
     $rules = array('subject' => 'required|max:128', 'emailbody' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Response::json(array('validation' => $validator->messages()->toArray()));
     } else {
         $draft = new Draft();
         $draft->subject = Input::get('subject');
         $draft->message = Input::get('emailbody');
         $draft->save();
         return Response::json(array('success' => 'Email successfully moved to drafts. You can access it by navigating to the drafts tab.'));
     }
 }
开发者ID:shinichi81,项目名称:Laravel4-Newsletter-Application,代码行数:14,代码来源:EmailController.php

示例2: store

 public static function store()
 {
     self::check_logged_in();
     $user_logged_in = self::get_user_logged_in();
     $params = $_POST;
     $attributes = array('name' => $params['name'], 'laatija_id' => $user_logged_in->id, 'hero1' => $params['hero1'], 'hero2' => $params['hero2'], 'hero3' => $params['hero3'], 'hero4' => $params['hero4'], 'hero5' => $params['hero5'], 'vaikeus' => $params['vaikeus'], 'suunnitelma' => $params['suunnitelma']);
     $draft = new Draft($attributes);
     $errors = $draft->errors();
     if (count($errors) == 0) {
         $draft->save();
         Redirect::to('/drafts' . $draft->id, array('message' => 'Drafti on lisätty arkistoon!'));
     } else {
         $heroes = Hero::all();
         View::make('drafts/new.html', array('errors' => $errors, 'attributes' => $attributes, 'heroes' => $heroes));
     }
 }
开发者ID:sasumaki,项目名称:Tsoha-Bootstrap,代码行数:16,代码来源:DraftController.php

示例3: index

 function index()
 {
     list($params, $id) = $this->parse_params(func_get_args());
     $theme = new Theme();
     $themes = $theme->read(true);
     if ($this->method == 'post' && isset($_POST['theme'])) {
         $t = $_POST['theme'];
         if (isset($themes[$t])) {
             $d = new Draft();
             $d->where('draft', 1)->update('draft', 0);
             $d->where('path', $t)->get();
             $d->path = $t;
             $d->draft = 1;
             if (isset($_POST['refresh'])) {
                 $d->init_draft_nav($_POST['refresh']);
             }
             $d->save();
             $this->redirect('/drafts');
         } else {
             // error
         }
     } else {
         if ($this->method == 'delete' && isset($_POST['theme'])) {
             $d = new Draft();
             $d->where('path', $_POST['theme'])->get();
             if ($d->exists()) {
                 $d->delete();
             }
             exit;
         }
     }
     $final = array();
     $d = new Draft();
     $drafts = $d->get_iterated();
     foreach ($drafts as $d) {
         if (isset($themes[$d->path])) {
             $final[] = array('id' => $d->id, 'theme' => $themes[$d->path], 'published' => (bool) $d->current, 'active' => (bool) $d->draft, 'created_on' => (int) $d->created_on, 'modified_on' => (int) $d->modified_on);
         }
     }
     $this->set_response_data($final);
 }
开发者ID:Atomox,项目名称:benhelmerphotography,代码行数:41,代码来源:drafts.php

示例4: publish

 function publish($draft_id = false)
 {
     if (!$draft_id) {
         $this->error('400', 'Draft ID parameter not present.');
         return;
     }
     if ($this->method === 'post') {
         $draft = new Draft();
         $draft->where('id', $draft_id)->get();
         if ($draft->exists()) {
             $draft->where('current', 1)->update('current', 0);
             $draft->live_data = $draft->data;
             $draft->current = 1;
             $draft->save();
             $guid = FCPATH . 'storage' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $draft->path . DIRECTORY_SEPARATOR . 'koken.guid';
             if (file_exists($guid)) {
                 $s = new Setting();
                 $s->where('name', 'uuid')->get();
                 $curl = curl_init();
                 curl_setopt($curl, CURLOPT_URL, KOKEN_STORE_URL . '/register?uuid=' . $s->value . '&theme=' . trim(file_get_contents($guid)));
                 curl_setopt($curl, CURLOPT_HEADER, 0);
                 curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
                 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
                 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
                 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
                 $r = curl_exec($curl);
                 curl_close($curl);
             }
             exit;
         } else {
             $this->error('404', "Draft not found.");
             return;
         }
     } else {
         $this->error('400', 'This endpoint only accepts tokenized POST requests.');
         return;
     }
 }
开发者ID:Caldis,项目名称:htdocs,代码行数:38,代码来源:sites.php

示例5: sendMessage

 public function sendMessage()
 {
     $recipient = Input::get('recipient');
     $subject = Input::get('subject');
     $message = Input::get('message');
     $submit_type = Input::get('submit_type');
     $now = new DateTime();
     $validation = Validator::make(['recipient' => Input::get('recipient'), 'subject' => Input::get('subject'), 'message' => Input::get('message')], ['recipient' => 'required', 'subject' => 'required|max:40|min:4', 'message' => 'required|max:120|min:10']);
     if ($validation->fails()) {
         return 'Error Happend';
     } else {
         try {
             if ($submit_type == "Send") {
                 $inbox = new Inbox();
                 $inbox->sender_id = Auth::id();
                 $inbox->receiver_id = $recipient;
                 $inbox->unread = 1;
                 $inbox->subject = $subject;
                 $inbox->message = $message;
                 $inbox->time = $now;
                 $inbox->save();
                 return Redirect::route('home');
             } elseif ($submit_type == "Draft") {
                 $draft = new Draft();
                 $draft->creator_id = Auth::id();
                 $draft->send_to_id = $recipient;
                 $draft->subject = $subject;
                 $draft->message = $message;
                 $draft->time = $now;
                 $draft->save();
                 return Redirect::route('home');
             }
         } catch (Exception $e) {
             echo $e;
         }
     }
 }
开发者ID:Nabil5352,项目名称:Team-Management-Application,代码行数:37,代码来源:HomeController.php


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