本文整理汇总了PHP中Draft::lookup方法的典型用法代码示例。如果您正苦于以下问题:PHP Draft::lookup方法的具体用法?PHP Draft::lookup怎么用?PHP Draft::lookup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Draft
的用法示例。
在下文中一共展示了Draft::lookup方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
function add($vars, &$errors)
{
if (!($id = self::create($vars, $errors))) {
return false;
}
if ($faq = self::lookup($id)) {
$faq->updateTopics($vars['topics']);
if ($_FILES['attachments'] && ($files = AttachmentFile::format($_FILES['attachments']))) {
$faq->attachments->upload($files);
}
// Inline images (attached to the draft)
if (isset($vars['draft_id']) && $vars['draft_id']) {
if ($draft = Draft::lookup($vars['draft_id'])) {
$faq->attachments->upload($draft->getAttachmentIds(), true);
}
}
$faq->reload();
}
return $faq;
}
示例2: elseif
// Delete drafts for all users for this canned response
Draft::deleteForNamespace('canned.' . $canned->getId());
} elseif (!$errors['err']) {
$errors['err'] = 'Error updating canned response. Try again!';
}
break;
case 'create':
if ($id = Canned::create($_POST, $errors)) {
$msg = 'Canned response added successfully';
$_REQUEST['a'] = null;
//Upload attachments
if ($_FILES['attachments'] && ($c = Canned::lookup($id)) && ($files = AttachmentFile::format($_FILES['attachments']))) {
$c->attachments->upload($files);
}
// Attach inline attachments from the editor
if (isset($_POST['draft_id']) && ($draft = Draft::lookup($_POST['draft_id']))) {
$c->attachments->upload($draft->getAttachmentIds($_POST['response']), true);
}
// Delete this user's drafts for new canned-responses
Draft::deleteForNamespace('canned', $thisstaff->getId());
} elseif (!$errors['err']) {
$errors['err'] = 'Unable to add canned response. Correct error(s) below and try again.';
}
break;
case 'mass_process':
if (!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) {
$errors['err'] = 'You must select at least one canned response';
} else {
$count = count($_POST['ids']);
switch (strtolower($_POST['a'])) {
case 'enable':
示例3: elseif
} elseif(!$errors['err']) {
$errors['err']=sprintf(__('Error updating %s. Try again!'), __('this canned response'));
}
break;
case 'create':
if(($id=Canned::create($_POST, $errors))) {
$msg=sprintf(__('Successfully added %s'), Format::htmlchars($_POST['title']));
$_REQUEST['a']=null;
//Upload attachments
$keepers = $canned_form->getField('attachments')->getClean();
if (($c=Canned::lookup($id)) && $keepers)
$c->attachments->upload($keepers);
// Attach inline attachments from the editor
if ($c && isset($_POST['draft_id'])
&& ($draft = Draft::lookup($_POST['draft_id'])))
$c->attachments->upload(
$draft->getAttachmentIds($_POST['response']), true);
// Delete this user's drafts for new canned-responses
Draft::deleteForNamespace('canned', $thisstaff->getId());
} elseif(!$errors['err']) {
$errors['err']=sprintf(__('Unable to add %s. Correct error(s) below and try again.'),
__('this canned response'));
}
break;
case 'mass_process':
if(!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) {
$errors['err']=sprintf(__('You must select at least %s'), __('one canned response'));
} else {
$count=count($_POST['ids']);
示例4: update
function update($vars, &$errors)
{
if (!$this->save($this->getId(), $vars, $errors)) {
return false;
}
$this->reload();
// Inline images (attached to the draft)
if (isset($vars['draft_id']) && $vars['draft_id']) {
if ($draft = Draft::lookup($vars['draft_id'])) {
$this->attachments->deleteInlines();
$this->attachments->upload($draft->getAttachmentIds($this->getBody()), true);
}
}
return true;
}
示例5: deleteDraft
function deleteDraft($id)
{
global $thisstaff;
if (!$thisstaff) {
Http::response(403, "Login required for draft edits");
} elseif (!($draft = Draft::lookup($id))) {
Http::response(205, "Draft not found. Create one first");
} elseif ($draft->getStaffId() != $thisstaff->getId()) {
Http::response(404, "Draft not found");
}
$draft->delete();
}