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


PHP Attachment::getName方法代码示例

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


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

示例1: edit

 /**
  * Show and process edit attachment form
  *
  * @param void
  * @return null
  */
 function edit()
 {
     $this->wireframe->print_button = false;
     if ($this->active_attachment->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     $parent = $this->active_attachment->getParent();
     if (!instance_of($parent, 'ProjectObject')) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     $attachment_data = $this->request->post('attachment');
     if (!is_array($attachment_data)) {
         $attachment_data = array('name' => $this->active_attachment->getName());
     }
     // if
     $this->smarty->assign('attachment_data', $attachment_data);
     if ($this->request->isSubmitted()) {
         db_begin_work();
         $old_name = $this->active_attachment->getName();
         $this->active_attachment->setName(array_var($attachment_data, 'name'));
         $save = $this->active_attachment->save();
         if ($save && !is_error($save)) {
             db_commit();
             $this->active_attachment->ready();
             if ($this->request->getFormat() == FORMAT_HTML) {
                 flash_success('File :filename has been updated', array('filename' => $old_name));
                 $this->redirectToUrl($parent->getViewUrl());
             } else {
                 $this->serveData($this->active_attachment);
             }
             // if
         } else {
             db_rollback();
             if ($this->request->getFormat() == FORMAT_HTML) {
                 flash_error('Failed to update :filename', array('filename' => $old_name));
                 $this->redirectToUrl($parent->getViewUrl());
             } else {
                 $this->serveData($save);
             }
             // if
         }
         // if
     }
     // if
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:53,代码来源:AttachmentsController.class.php

示例2: createAttachmentFromAttachment

 /**
  * @param string $issueId The issue id
  * @param Attachment $attachment The attachment
  * @return array
  */
 public function createAttachmentFromAttachment($issueId, Attachment $attachment)
 {
     $params = $this->getAttachmentParams($attachment->getName(), $attachment->getAuthorLogin(), $attachment->getCreated(), $attachment->getGroup());
     return $this->request('POST', '/issue/' . rawurlencode($issueId) . '/attachment?' . http_build_query($params), $attachment->getUrl());
 }
开发者ID:stingmu,项目名称:youtrack,代码行数:10,代码来源:Connection.php

示例3: testContstruct

 /**
  * @covers ::__construct
  * @group  Email
  */
 public function testContstruct()
 {
     $name = 'name';
     $contents = 'Test content';
     $mime = 'text/plain';
     $object = new Attachment($name, $contents, $mime);
     $this->assertEquals($name, $object->getName());
     $this->assertEquals($contents, $object->getContents());
     $this->assertEquals($mime, $object->getMime());
     $this->assertEquals(md5($name), $object->getCid());
     $this->assertFalse($object->isInline());
 }
开发者ID:fuelphp,项目名称:email,代码行数:16,代码来源:AttachmentTest.php


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