本文整理汇总了PHP中MediaHelper::getUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP MediaHelper::getUrl方法的具体用法?PHP MediaHelper::getUrl怎么用?PHP MediaHelper::getUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaHelper
的用法示例。
在下文中一共展示了MediaHelper::getUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildXmlElementResponse
/**
* @param form_persistentdocument_file $field
* @param DOMElement $fieldElm
* @param mixed $rawValue
* @return string
*/
public function buildXmlElementResponse($field, $fieldElm, $rawValue)
{
if (f_util_ArrayUtils::isNotEmpty($rawValue) && $rawValue['error'] == 0) {
$media = MediaHelper::addUploadedFile($rawValue['name'], $rawValue['tmp_name'], $field->getMediaFolder());
$mailValue = "<a href=\"" . MediaHelper::getUrl($media) . "\">" . $media->getLabel() . "</a>";
$fieldElm->setAttribute('mailValue', $mailValue);
return $media->getId();
}
return '';
}
示例2: _execute
public function _execute($context, $request)
{
$form = $request->getAttribute('form');
$this->setAttribute('form', $form);
$domDoc = new DOMDocument();
$fieldNames = array('creationdate' => f_Locale::translate('&modules.form.bo.actions.SendDate;'));
$query = f_persistentdocument_PersistentProvider::getInstance()->createQuery('modules_form/response')->add(Restrictions::eq('parentForm.id', $form->getId()))->addOrder(Order::desc('document_creationdate'));
if ($request->getAttribute('all') != 'all') {
$query->add(Restrictions::published());
}
$responses = $query->find();
$responsesAttribute = array();
foreach ($responses as $response) {
$domDoc->loadXML($response->getContents());
$xpath = new DOMXPath($domDoc);
$fieldList = $xpath->query('/response/field');
$fields = array('creationdate' => $response->getUICreationdate());
for ($i = 0; $i < $fieldList->length; $i++) {
$fieldNode = $fieldList->item($i);
$fieldName = $fieldNode->getAttribute('name');
$fieldLabel = $fieldNode->getAttribute('label');
$fieldType = $fieldNode->getAttribute('type');
$fieldValue = $fieldNode->nodeValue;
if ($fieldType == 'file') {
$fieldValue = intval($fieldNode->nodeValue);
if ($fieldValue > 0) {
$fieldValue = MediaHelper::getUrl($fieldValue);
} else {
$fieldValue = '';
}
} else {
if ($fieldType == 'list' && $fieldNode->hasAttribute('mailValue')) {
$fieldValue = $fieldNode->getAttribute('mailValue');
}
}
if (!isset($fieldNames[$fieldName])) {
$fieldNames[$fieldName] = $fieldLabel;
}
$fields[$fieldName] = $fieldValue;
}
$responsesAttribute[] = $fields;
}
$fileName = "export_formulaire_" . f_util_FileUtils::cleanFilename($form->getLabel()) . '_' . date('Ymd_His') . '.csv';
$options = new f_util_CSVUtils_export_options();
$options->separator = ";";
$csv = f_util_CSVUtils::export($fieldNames, $responsesAttribute, $options);
header("Content-type: text/comma-separated-values");
header('Content-length: ' . strlen($csv));
header('Content-disposition: attachment; filename="' . $fileName . '"');
echo $csv;
exit;
}