本文整理汇总了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
}
示例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());
}
示例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());
}