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


PHP Draft::create方法代码示例

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


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

示例1: _createDraft

 function _createDraft($vars)
 {
     $field_list = array('response', 'note', 'answer', 'body', 'message', 'issue');
     foreach ($field_list as $field) {
         if (isset($_POST[$field])) {
             $vars['body'] = urldecode($_POST[$field]);
             break;
         }
     }
     if (!isset($vars['body'])) {
         return Http::response(422, "Draft body not found in request");
     }
     $errors = array();
     if (!($draft = Draft::create($vars, $errors))) {
         Http::response(500, print_r($errors, true));
     }
     // If the draft is created from an existing document, ensure inline
     // attachments from the cloned document are attachned to the draft
     // XXX: Actually, I think this is just wasting time, because the
     //     other object already has the items attached, so the database
     //     won't clean up the files. They don't have to be attached to
     //     the draft for Draft::getAttachmentIds to return the id of the
     //     attached file
     //$draft->syncExistingAttachments();
     echo JsonDataEncoder::encode(array('draft_id' => $draft->getId()));
 }
开发者ID:dmiguel92,项目名称:osTicket-1.8,代码行数:26,代码来源:ajax.draft.php

示例2: create_draft

	/**
	 * save the proposal as a draft
	 */
	public function create_draft() {

		$draft = new Draft;
		$draft->proposal = $this->id;
		$draft->title   = $this->title;
		$draft->content = $this->content;
		$draft->reason  = $this->reason;
		if (Login::$member) {
			$draft->author = Login::$member->id;
		} else {
			// admin
			$draft->author = null;
		}
		$draft->create();

	}
开发者ID:ppschweiz,项目名称:basisentscheid,代码行数:19,代码来源:Proposal.php


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