本文整理汇总了PHP中Attachment::getAttachmentId方法的典型用法代码示例。如果您正苦于以下问题:PHP Attachment::getAttachmentId方法的具体用法?PHP Attachment::getAttachmentId怎么用?PHP Attachment::getAttachmentId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attachment
的用法示例。
在下文中一共展示了Attachment::getAttachmentId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Article
if (!$g_user->hasPermission("DeleteFile")) {
camp_html_display_error(getGS("You do not have the right to delete file attachments."), null, true);
exit;
}
$articleObj = new Article($f_language_selected, $f_article_number);
if (!$articleObj->exists()) {
camp_html_display_error(getGS("Article does not exist."), null, true);
exit;
}
$attachmentObj = new Attachment($f_attachment_id);
if (!$attachmentObj->exists()) {
camp_html_display_error(getGS('Attachment does not exist.'), null, true);
exit;
}
$filePath = dirname($attachmentObj->getStorageLocation()) . '/' . $attachmentObj->getFileName();
ArticleAttachment::RemoveAttachmentFromArticle($f_attachment_id, $f_article_number);
$logtext = getGS('File #$1 "$2" unattached',
$attachmentObj->getAttachmentId(), $attachmentObj->getFileName());
Log::ArticleMessage($articleObj, $logtext, null, 39);
$attachmentFileName = $attachmentObj->getFileName();
// Go back to article.
camp_html_add_msg(getGS("File '$1' unattached.", $attachmentFileName), "ok");
camp_html_goto_page(camp_html_article_url($articleObj, $f_language_id, 'edit.php'));
?>
示例2: array
$f_article_number = Input::Get('f_article_number', 'int', 0);
$f_attachment_id = Input::Get('f_attachment_id', 'int', 0);
// Check input
if (!Input::IsValid()) {
camp_html_display_error($translator->trans('Invalid input: $1', array('$1' => Input::GetErrorString())), null, true);
exit;
}
if (!$g_user->hasPermission("DeleteFile")) {
camp_html_display_error($translator->trans("You do not have the right to delete file attachments.", array(), 'article_files'), null, true);
exit;
}
$articleObj = new Article($f_language_selected, $f_article_number);
if (!$articleObj->exists()) {
camp_html_display_error($translator->trans("Article does not exist."), null, true);
exit;
}
$attachmentObj = new Attachment($f_attachment_id);
if (!$attachmentObj->exists()) {
camp_html_display_error($translator->trans('Attachment does not exist.', array(), 'article_files'), null, true);
exit;
}
$filePath = dirname($attachmentObj->getStorageLocation()) . '/' . $attachmentObj->getFileName();
ArticleAttachment::RemoveAttachmentFromArticle($f_attachment_id, $f_article_number);
$logtext = $translator->trans('File #$1 "$2" unattached', array('$1' => $attachmentObj->getAttachmentId(), '$2' => $attachmentObj->getFileName()), 'article_files');
Log::ArticleMessage($articleObj, $logtext, null, 39);
$attachmentFileName = $attachmentObj->getFileName();
$cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
$cacheService->clearNamespace('attachments');
// Go back to article.
camp_html_add_msg($translator->trans("File \$1 unattached.", array('$1' => $attachmentFileName), 'article_files'), "ok");
camp_html_goto_page(camp_html_article_url($articleObj, $f_language_id, 'edit.php'));
示例3: addAttachment
/**
* Adds an attachment to this entry.
* @param Attachment $attachment The attachment to add.
*/
public function addAttachment(Attachment $attachment)
{
$query = Database::connection()->prepare('INSERT INTO entry_attachment (entryid, attachmentid) VALUES (?, ?)');
$query->bindValue(1, $this->getEntryId(), PDO::PARAM_INT);
$query->bindValue(2, $attachment->getAttachmentId(), PDO::PARAM_INT);
$query->execute();
$this->attachments = null;
$this->changed();
}
示例4:
</dd>
<?php
}
?>
</dl>
<form name="edit" method="POST" action="/<?php
echo $ADMIN;
?>
/media-archive/do_edit-attachment.php">
<?php
echo SecurityToken::FormParameter();
?>
<input type="hidden" name="f_attachment_id" value="<?php
echo $object->getAttachmentId();
?>
" />
<div class="ui-widget-content big-block block-shadow padded-strong">
<fieldset class="plain">
<legend><?php
putGS('Change attachment information');
?>
</legend>
<ul>
<li>
<label for="description"><?php
putGS("Description");
示例5: Attachment
<?php
camp_load_translation_strings("media_archive");
require_once($GLOBALS['g_campsiteDir'].'/classes/Input.php');
require_once($GLOBALS['g_campsiteDir'].'/classes/Attachment.php');
require_once($GLOBALS['g_campsiteDir'].'/classes/Log.php');
if (!SecurityToken::isValid()) {
camp_html_display_error(getGS('Invalid security token!'));
exit;
}
// check input
$f_attachment_id = Input::Get('f_attachment_id', 'int', 0);
$f_description = Input::Get('f_description', 'string', '');
$f_content_disposition = Input::Get('f_content_disposition', 'string', '');
if (!Input::IsValid() || ($f_attachment_id <= 0)) {
camp_html_goto_page("/$ADMIN/media-archive/index.php#files");
}
$object = new Attachment($f_attachment_id);
$object->setDescription($object->getLanguageId(), $f_description);
$object->setContentDisposition($f_content_disposition);
camp_html_add_msg(getGS('Attachment updated.'), 'ok');
camp_html_goto_page("/$ADMIN/media-archive/edit-attachment.php?f_attachment_id=".$object->getAttachmentId());
示例6: setAvatar
/**
* Sets the avatar for this user given the attachment it is.
* @param Attachment $attachment
*/
public function setAvatar(Attachment $attachment)
{
// Make sure the attachment is an image
if ($attachment->getAttachmentType() != Attachment::ATTACHMENT_TYPE_IMAGE) {
throw new Exception('Avatars must be images.');
}
// Turn the image into a png
$attachment->convertToPNG();
// Turn the new attachment into a thubmnail
$attachment->convertIntoThubmnail();
// See if we need to delete an old one
if ($this->hasAvatar()) {
$oldAvatar = Attachment::fromId($this->getAvatarAttachmentId());
$oldAvatar->delete();
}
// Update the database
$query = Database::connection()->prepare('UPDATE user SET avatar_attachmentid = ? WHERE userid = ?');
$query->bindValue(1, $attachment->getAttachmentId(), PDO::PARAM_INT);
$query->bindValue(2, $this->getUserId(), PDO::PARAM_INT);
$query->execute();
// Update the local value
$this->row['avatar_attachmentid'] = $attachment->getAttachmentId();
}
示例7: putGS
<dt><?php putGS('Type'); ?>:</dt>
<dd><?php echo $object->getMimeType(); ?></dd>
<dt><?php putGS('Size'); ?>:</dt>
<dd><?php echo MediaList::FormatFileSize($object->getSizeInBytes()); ?></dd>
<?php if ($object->getCharset()) { ?>
<dt><?php putGS('Charset'); ?>:</dt>
<dd><?php echo $object->getCharset(); ?></dd>
<?php } ?>
</dl>
<form name="edit" method="POST" action="do_edit-attachment.php">
<?php echo SecurityToken::FormParameter(); ?>
<input type="hidden" name="f_attachment_id" value="<?php echo $object->getAttachmentId(); ?>" />
<div class="ui-widget-content big-block block-shadow padded-strong">
<fieldset class="plain">
<legend><?php putGS('Change attachment information'); ?></legend>
<ul>
<li>
<label for="description"><?php putGS("Description"); ?>:</label>
<input id="description" type="text" name="f_description" value="<?php echo htmlspecialchars($object->getDescription($object->getLanguageId())); ?>" size="50" maxlength="255" class="input_text" />
</li>
<li>
<label><?php putGS("Do you want this file to open in the user's browser, or to automatically download?"); ?></label>
<input id="disposition0" class="input_radio" type="radio" name="f_content_disposition" value=""<?php if ($object->getContentDisposition() == NULL) { echo ' checked="checked"'; } ?> />
<label for="disposition0" class="inline-style left-floated" style="padding-right:15px"><?php putGS("Open in the browser"); ?></label>