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


PHP Draft::lookup方法代码示例

本文整理汇总了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;
 }
开发者ID:CarlosAvilesMx,项目名称:CarlosAviles.Mx,代码行数:20,代码来源:class.faq.php

示例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':
开发者ID:ed00m,项目名称:osTicket-1.8,代码行数:31,代码来源:canned.php

示例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']);
开发者ID:CarlosAvilesMx,项目名称:CarlosAviles.Mx,代码行数:31,代码来源:canned.php

示例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;
 }
开发者ID:KingsleyGU,项目名称:osticket,代码行数:15,代码来源:class.template.php

示例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();
 }
开发者ID:dmiguel92,项目名称:osTicket-1.8,代码行数:12,代码来源:ajax.draft.php


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