本文整理汇总了PHP中RSFormProHelper::getDate方法的典型用法代码示例。如果您正苦于以下问题:PHP RSFormProHelper::getDate方法的具体用法?PHP RSFormProHelper::getDate怎么用?PHP RSFormProHelper::getDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSFormProHelper
的用法示例。
在下文中一共展示了RSFormProHelper::getDate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTemplate
public function getTemplate()
{
$app = JFactory::getApplication();
$Itemid = $this->getItemId();
$has_suffix = JFactory::getConfig()->get('sef') && JFactory::getConfig()->get('sef_suffix');
$layout = $app->input->getCmd('layout', 'default');
// Templates
$template_module = $this->params->def('template_module', '');
$template_formdatarow = $this->params->def('template_formdatarow', '');
$template_formdetail = $this->params->def('template_formdetail', '');
if ($layout == 'default') {
$formdata = '';
$submissions = $this->getSubmissions();
$headers = $this->getHeaders();
$pagination = $this->getPagination();
$i = 0;
foreach ($submissions as $SubmissionId => $submission) {
list($replace, $with) = $this->getReplacements($submission['UserId']);
$pdf_link = JRoute::_('index.php?option=com_rsform&view=submissions&layout=view&cid=' . $SubmissionId . '&format=pdf' . $Itemid);
if ($has_suffix) {
$pdf_link .= strpos($pdf_link, '?') === false ? '?' : '&';
$pdf_link .= 'format=pdf';
}
$details_link = JRoute::_('index.php?option=com_rsform&view=submissions&layout=view&cid=' . $SubmissionId . $Itemid);
$replacements = array('{global:userip}' => $submission['UserIp'], '{global:date_added}' => RSFormProHelper::getDate($submission['DateSubmitted']), '{global:submissionid}' => $SubmissionId, '{global:submission_id}' => $SubmissionId, '{global:counter}' => $pagination->getRowOffset($i), '{global:confirmed}' => $submission['confirmed'], '{details}' => '<a href="' . $details_link . '">', '{details_link}' => $details_link, '{detailspdf}' => '<a href="' . $pdf_link . '">', '{detailspdf_link}' => $pdf_link, '{_STATUS:value}' => isset($submission['SubmissionValues']['_STATUS']) ? JText::_('RSFP_PAYPAL_STATUS_' . $submission['SubmissionValues']['_STATUS']['Value']) : '');
$replace = array_merge($replace, array_keys($replacements));
$with = array_merge($with, array_values($replacements));
foreach ($headers as $header) {
if (!isset($submission['SubmissionValues'][$header]['Value'])) {
$submission['SubmissionValues'][$header]['Value'] = '';
}
if (!empty($submission['SubmissionValues'][$header]['Path'])) {
$replace[] = '{' . $header . ':path}';
$with[] = $submission['SubmissionValues'][$header]['Path'];
}
}
list($replace2, $with2) = RSFormProHelper::getReplacements($SubmissionId, true);
$replace = array_merge($replace, $replace2);
$with = array_merge($with, $with2);
$rowdata = $template_formdatarow;
// Add scripting
if (strpos($rowdata, '{/if}') !== false) {
require_once JPATH_ADMINISTRATOR . '/components/com_rsform/helpers/scripting.php';
RSFormProScripting::compile($rowdata, $replace, $with);
}
$formdata .= str_replace($replace, $with, $rowdata);
$i++;
}
$html = str_replace('{formdata}', $formdata, $template_module);
} else {
$cid = $app->input->getInt('cid');
$format = $app->input->getCmd('format');
$user = JFactory::getUser();
$userId = $this->params->def('userId', 0);
if ($userId != 'login' && $userId != 0) {
$userId = explode(',', $userId);
JArrayHelper::toInteger($userId);
}
// Grab submission
$this->_db->setQuery("SELECT * FROM #__rsform_submissions WHERE SubmissionId='" . $cid . "'");
$submission = $this->_db->loadObject();
// Submission doesn't exist
if (!$submission) {
JError::raiseWarning(500, JText::sprintf('RSFP_SUBMISSION_DOES_NOT_EXIST', $cid));
return $app->redirect(JURI::root());
}
// Submission doesn't belong to the configured form ID OR
// can view only own submissions and not his own OR
// can view only specified user IDs and this doesn't belong to any of the IDs
if ($submission->FormId != $this->params->get('formId') || $userId == 'login' && $submission->UserId != $user->get('id') || is_array($userId) && !in_array($user->get('id'), $userId)) {
JError::raiseWarning(500, JText::sprintf('RSFP_SUBMISSION_NOT_ALLOWED', $cid));
return $app->redirect(JURI::root());
}
if ($this->params->get('show_confirmed', 0) && !$submission->confirmed) {
JError::raiseWarning(500, JText::sprintf('RSFP_SUBMISSION_NOT_CONFIRMED', $cid));
return $app->redirect(JURI::root());
}
$pdf_link = JRoute::_('index.php?option=com_rsform&view=submissions&layout=view&cid=' . $cid . '&format=pdf' . $Itemid);
if ($has_suffix) {
$pdf_link .= strpos($pdf_link, '?') === false ? '?' : '&';
$pdf_link .= 'format=pdf';
}
list($replace, $with) = RSFormProHelper::getReplacements($cid, true);
list($replace2, $with2) = $this->getReplacements($submission->UserId);
$replacements = array('{global:userip}' => $submission->UserIp, '{global:date_added}' => RSFormProHelper::getDate($submission->DateSubmitted), '{global:submissionid}' => $cid, '{global:submission_id}' => $cid, '{global:confirmed}' => $submission->confirmed ? JText::_('RSFP_YES') : JText::_('RSFP_NO'), '{detailspdf}' => '<a href="' . $pdf_link . '">', '{detailspdf_link}' => $pdf_link);
$replace = array_merge($replace, $replace2, array_keys($replacements));
$with = array_merge($with, $with2, array_values($replacements));
if ($format == 'pdf' && preg_match_all('#{detailspdf}(.*?){\\/detailspdf}#is', $template_formdetail, $matches)) {
foreach ($matches[0] as $fullmatch) {
$template_formdetail = str_replace($fullmatch, '', $template_formdetail);
}
}
// Add scripting
if (strpos($template_formdetail, '{/if}') !== false) {
require_once JPATH_ADMINISTRATOR . '/components/com_rsform/helpers/scripting.php';
RSFormProScripting::compile($template_formdetail, $replace, $with);
}
$html = str_replace($replace, $with, $template_formdetail);
}
return $html;
//.........这里部分代码省略.........
示例2: getValue
protected function getValue($item, $field)
{
if (in_array($field->FieldName, $this->unescapedFields)) {
return $item->{$field->FieldName};
} else {
// Static header?
if ($field->componentId < 0 && isset($this->headers[$field->componentId])) {
$header = $this->headers[$field->componentId];
if ($header == 'DateSubmitted') {
$value = RSFormProHelper::getDate($item->{$header});
} else {
$value = $item->{$header};
}
} else {
// Dynamic header.
$value = $item->{$field->FieldName};
}
return $this->escape($value);
}
}
示例3: getSubmissions
function getSubmissions()
{
$option = JRequest::getVar('option', 'com_rsform');
if (empty($this->_data)) {
$formId = $this->getFormId();
$this->_db->setQuery("SELECT MultipleSeparator, TextareaNewLines FROM #__rsform_forms WHERE FormId='" . $formId . "'");
$form = $this->_db->loadObject();
if (empty($form)) {
return $this->_data;
}
$this->_db->setQuery("SELECT c.ComponentTypeId, p.ComponentId, p.PropertyName, p.PropertyValue FROM #__rsform_components c LEFT JOIN #__rsform_properties p ON (c.ComponentId=p.ComponentId) WHERE c.FormId='" . $formId . "' AND c.Published='1' AND p.PropertyName IN ('NAME', 'WYSIWYG')");
$components = $this->_db->loadObjectList();
$uploadFields = array();
$multipleFields = array();
$textareaFields = array();
foreach ($components as $component) {
// Upload fields
if ($component->ComponentTypeId == 9) {
$uploadFields[] = $component->PropertyValue;
} elseif (in_array($component->ComponentTypeId, array(3, 4))) {
$multipleFields[] = $component->PropertyValue;
} elseif ($component->ComponentTypeId == 2) {
if ($component->PropertyName == 'WYSIWYG' && $component->PropertyValue == 'NO') {
$textareaFields[] = $component->ComponentId;
}
}
}
if (!empty($textareaFields)) {
$this->_db->setQuery("SELECT p.PropertyValue FROM #__rsform_components c LEFT JOIN #__rsform_properties p ON (c.ComponentId=p.ComponentId) WHERE c.ComponentId IN (" . implode(',', $textareaFields) . ")");
$textareaFields = $this->_db->loadColumn();
}
$this->_db->setQuery("SET SQL_BIG_SELECTS=1");
$this->_db->execute();
$submissionIds = array();
$results = $this->_getList($this->_query, $this->getState($option . '.submissions.limitstart'), $this->getState($option . '.submissions.limit'));
$this->_db->setQuery("SELECT FOUND_ROWS();");
$this->_total = $this->_db->loadResult();
foreach ($results as $result) {
$submissionIds[] = $result->SubmissionId;
$this->_data[$result->SubmissionId]['FormId'] = $result->FormId;
$this->_data[$result->SubmissionId]['DateSubmitted'] = RSFormProHelper::getDate($result->DateSubmitted);
$this->_data[$result->SubmissionId]['UserIp'] = $result->UserIp;
$this->_data[$result->SubmissionId]['Username'] = $result->Username;
$this->_data[$result->SubmissionId]['UserId'] = $result->UserId;
$this->_data[$result->SubmissionId]['Lang'] = $result->Lang;
$this->_data[$result->SubmissionId]['confirmed'] = $result->confirmed ? JText::_('RSFP_YES') : JText::_('RSFP_NO');
$this->_data[$result->SubmissionId]['SubmissionValues'] = array();
}
if (!empty($submissionIds)) {
$layout = JRequest::getVar('layout');
$view = JRequest::getVar('view');
$must_escape = $view == 'submissions' && $layout == 'default';
$results = $this->_getList("SELECT * FROM `#__rsform_submission_values` WHERE `SubmissionId` IN (" . implode(',', $submissionIds) . ")");
foreach ($results as $result) {
// Check if this is an upload field
if (in_array($result->FieldName, $uploadFields) && !empty($result->FieldValue) && !$this->export) {
$result->FieldValue = '<a href="index.php?option=com_rsform&task=submissions.view.file&id=' . $result->SubmissionValueId . '">' . basename($result->FieldValue) . '</a>';
} else {
// Check if this is a multiple field
if (in_array($result->FieldName, $multipleFields)) {
$result->FieldValue = str_replace("\n", $form->MultipleSeparator, $result->FieldValue);
} elseif ($form->TextareaNewLines && in_array($result->FieldName, $textareaFields)) {
if ($must_escape) {
$result->FieldValue = RSFormProHelper::htmlEscape($result->FieldValue);
}
$result->FieldValue = nl2br($result->FieldValue);
} elseif ($result->FieldName == '_STATUS') {
$result->FieldValue = JText::_('RSFP_PAYPAL_STATUS_' . $result->FieldValue);
} elseif ($result->FieldName == '_ANZ_STATUS') {
$result->FieldValue = JText::_('RSFP_ANZ_STATUS_' . $result->FieldValue);
} else {
if ($must_escape) {
$result->FieldValue = RSFormProHelper::htmlEscape($result->FieldValue);
}
}
}
$this->_data[$result->SubmissionId]['SubmissionValues'][$result->FieldName] = array('Value' => $result->FieldValue, 'Id' => $result->SubmissionValueId);
}
}
unset($results);
}
return $this->_data;
}
示例4: getTemplate
function getTemplate()
{
$mainframe = JFactory::getApplication();
$Itemid = '';
if ($Itemid = JRequest::getInt('Itemid')) {
$Itemid = '&Itemid=' . $Itemid;
}
$template_module = $this->params->def('template_module', '');
$template_formdatarow = $this->params->def('template_formdatarow', '');
$template_formdetail = $this->params->def('template_formdetail', '');
$formdata = '';
$has_suffix = $mainframe->getCfg('sef') && $mainframe->getCfg('sef_suffix');
$layout = JRequest::getVar('layout', 'default');
if ($layout == 'default') {
$submissions = $this->getSubmissions();
$headers = $this->getHeaders();
$pagination = $this->getPagination();
$i = 0;
foreach ($submissions as $SubmissionId => $submission) {
list($replace, $with) = $this->getReplacements($submission['UserId']);
$pdf_link = JRoute::_('index.php?option=com_rsform&view=submissions&layout=view&cid=' . $SubmissionId . '&format=pdf' . $Itemid);
if ($has_suffix) {
$pdf_link .= strpos($pdf_link, '?') === false ? '?' : '&';
$pdf_link .= 'format=pdf';
}
$details_link = JRoute::_('index.php?option=com_rsform&view=submissions&layout=view&cid=' . $SubmissionId . $Itemid);
$replace = array_merge($replace, array('{global:userip}', '{global:date_added}', '{global:submissionid}', '{global:submission_id}', '{global:counter}', '{details}', '{detailspdf}', '{global:confirmed}', '{details_link}', '{detailspdf_link}'));
$with = array_merge($with, array($submission['UserIp'], $submission['DateSubmitted'], $SubmissionId, $SubmissionId, $pagination->getRowOffset($i), '<a href="' . $details_link . '">', '<a href="' . $pdf_link . '">', $submission['confirmed'], $details_link, $pdf_link));
$replace[] = '{_STATUS:value}';
$with[] = isset($submission['SubmissionValues']['_STATUS']) ? JText::_('RSFP_PAYPAL_STATUS_' . $submission['SubmissionValues']['_STATUS']['Value']) : '';
foreach ($headers as $header) {
if (!isset($submission['SubmissionValues'][$header]['Value'])) {
$submission['SubmissionValues'][$header]['Value'] = '';
}
/* $replace[] = '{'.$header.':value}';
$with[] = $submission['SubmissionValues'][$header]['Value']; */
if (!empty($submission['SubmissionValues'][$header]['Path'])) {
$replace[] = '{' . $header . ':path}';
$with[] = $submission['SubmissionValues'][$header]['Path'];
}
}
list($replace2, $with2) = RSFormProHelper::getReplacements($SubmissionId, true);
$replace = array_merge($replace, $replace2);
$with = array_merge($with, $with2);
$formdata .= str_replace($replace, $with, $template_formdatarow);
$i++;
}
$html = str_replace('{formdata}', $formdata, $template_module);
} else {
$cid = JRequest::getInt('cid');
$user = JFactory::getUser();
$userId = $this->params->def('userId', 0);
if ($userId != 'login' && $userId != 0) {
$userId = explode(',', $userId);
JArrayHelper::toInteger($userId);
}
$this->_db->setQuery("SELECT * FROM #__rsform_submissions WHERE SubmissionId='" . $cid . "'");
$submission = $this->_db->loadObject();
if (!$submission || $submission->FormId != $this->params->get('formId') || $userId == 'login' && $submission->UserId != $user->get('id') || is_array($userId) && !in_array($user->get('id'), $userId)) {
JError::raiseWarning(500, JText::_('ALERTNOTAUTH'));
$mainframe->redirect(JURI::root());
return;
}
if ($this->params->get('show_confirmed', 0) && !$submission->confirmed) {
JError::raiseWarning(500, JText::_('ALERTNOTAUTH'));
$mainframe->redirect(JURI::root());
return;
}
$format = JRequest::getVar('format');
$pdf_link = JRoute::_('index.php?option=com_rsform&view=submissions&layout=view&cid=' . $cid . '&format=pdf' . $Itemid);
if ($has_suffix) {
$pdf_link .= strpos($pdf_link, '?') === false ? '?' : '&';
$pdf_link .= 'format=pdf';
}
$confirmed = $submission->confirmed ? JText::_('RSFP_YES') : JText::_('RSFP_NO');
list($replace, $with) = RSFormProHelper::getReplacements($cid, true);
list($replace2, $with2) = $this->getReplacements($submission->UserId);
$replace = array_merge($replace, $replace2, array('{global:userip}', '{global:date_added}', '{global:submissionid}', '{global:submission_id}', '{detailspdf}', '{global:confirmed}', '{detailspdf_link}'));
$with = array_merge($with, $with2, array($submission->UserIp, RSFormProHelper::getDate($submission->DateSubmitted), $cid, $cid, '<a href="' . $pdf_link . '">', $confirmed, $pdf_link));
if ($format == 'pdf' && preg_match_all('#{detailspdf}(.*?){\\/detailspdf}#is', $template_formdetail, $matches)) {
foreach ($matches[0] as $fullmatch) {
$template_formdetail = str_replace($fullmatch, '', $template_formdetail);
}
}
$html = str_replace($replace, $with, $template_formdetail);
}
return $html;
}
示例5: sendSubmissionEmails
//.........这里部分代码省略.........
// {component:filename}
if (in_array($property['NAME'], $uploadFields)) {
$placeholders[] = '{' . $property['NAME'] . ':path}';
$placeholders[] = '{' . $property['NAME'] . ':localpath}';
$placeholders[] = '{' . $property['NAME'] . ':filename}';
if (isset($submission->values[$property['NAME']])) {
$filepath = $submission->values[$property['NAME']];
$filepath = substr_replace($filepath, JURI::root(), 0, strlen(JPATH_SITE) + 1);
$filepath = str_replace(array('\\', '\\/', '//\\'), '/', $filepath);
$values[] = $filepath;
$values[] = $submission->values[$property['NAME']];
$values[] = basename($submission->values[$property['NAME']]);
} else {
$values[] = '';
$values[] = '';
$values[] = '';
}
}
}
$placeholders[] = '{_STATUS:value}';
$values[] = isset($submission->values['_STATUS']) ? JText::_('RSFP_PAYPAL_STATUS_' . $submission->values['_STATUS']) : '';
$placeholders[] = '{_ANZ_STATUS:value}';
$values[] = isset($submission->values['_ANZ_STATUS']) ? JText::_('RSFP_ANZ_STATUS_' . $submission->values['_ANZ_STATUS']) : '';
$user = JFactory::getUser($submission->UserId);
if (empty($user->id)) {
$user = JFactory::getUser(0);
}
$root = $mainframe->isAdmin() ? JURI::root() : $u->toString(array('scheme', 'host', 'port'));
$confirmation_hash = md5($submission->SubmissionId . $formId . $submission->DateSubmitted);
$hash_link = 'index.php?option=com_rsform&task=confirm&hash=' . $confirmation_hash;
$confirmation = $root . ($mainframe->isAdmin() ? $hash_link : JRoute::_($hash_link));
if (!$skip_globals) {
array_push($placeholders, '{global:username}', '{global:userid}', '{global:useremail}', '{global:fullname}', '{global:userip}', '{global:date_added}', '{global:sitename}', '{global:siteurl}', '{global:confirmation}', '{global:submissionid}', '{global:submission_id}');
array_push($values, $user->username, $user->id, $user->email, $user->name, $submission->UserIp, RSFormProHelper::getDate($submission->DateSubmitted), $config->get('sitename'), JURI::root(), $confirmation, $submission->SubmissionId, $submission->SubmissionId);
}
$mainframe->triggerEvent('rsfp_onAfterCreatePlaceholders', array(array('form' => &$form, 'placeholders' => &$placeholders, 'values' => &$values, 'submission' => $submission)));
if ($only_return_replacements) {
return array($placeholders, $values);
}
// RSForm! Pro Scripting - User Email Text
// performance check
if (strpos($form->UserEmailText, '{if ') !== false && strpos($form->UserEmailText, '{/if}') !== false) {
require_once dirname(__FILE__) . '/scripting.php';
RSFormProScripting::compile($form->UserEmailText, $placeholders, $values);
}
$userEmail = array('to' => str_replace($placeholders, $values, $form->UserEmailTo), 'cc' => str_replace($placeholders, $values, $form->UserEmailCC), 'bcc' => str_replace($placeholders, $values, $form->UserEmailBCC), 'from' => str_replace($placeholders, $values, $form->UserEmailFrom), 'replyto' => str_replace($placeholders, $values, $form->UserEmailReplyTo), 'fromName' => str_replace($placeholders, $values, $form->UserEmailFromName), 'text' => str_replace($placeholders, $values, $form->UserEmailText), 'subject' => str_replace($placeholders, $values, $form->UserEmailSubject), 'mode' => $form->UserEmailMode, 'files' => array());
// user cc
if (strpos($userEmail['cc'], ',') !== false) {
$userEmail['cc'] = explode(',', $userEmail['cc']);
}
// user bcc
if (strpos($userEmail['bcc'], ',') !== false) {
$userEmail['bcc'] = explode(',', $userEmail['bcc']);
}
jimport('joomla.filesystem.file');
$file = str_replace($placeholders, $values, $form->UserEmailAttachFile);
if ($form->UserEmailAttach && JFile::exists($file)) {
$userEmail['files'][] = $file;
}
// Need to attach files
// User Email
foreach ($userEmailUploads as $componentId) {
$name = $properties[$componentId]['NAME'];
if (!empty($submission->values[$name])) {
$userEmail['files'][] = $submission->values[$name];
}
示例6:
</td>
<td>
<?php
if ($header == 'confirmed') {
?>
<?php
echo JHTML::_('select.booleanlist', 'formStatic[' . $header . ']', 'class="inputbox"', $this->staticFields->{$header});
?>
<?php
} else {
?>
<input class="rs_inp rs_80" type="text" name="formStatic[<?php
echo $header;
?>
]" value="<?php
echo $header == 'DateSubmitted' ? RSFormProHelper::getDate($this->staticFields->{$header}) : $this->staticFields->{$header};
?>
" size="105" />
<?php
}
?>
</td>
</tr>
<?php
}
?>
<?php
foreach ($this->fields as $field) {
?>
<tr>
<td width="200" style="width: 200px;" align="right" class="key">
示例7: getTemplate
public function getTemplate()
{
$cid = $this->_app->input->getInt('id', 0);
$format = $this->_app->input->get('format');
$user = JFactory::getUser();
$userId = $this->params->def('userId', 0);
$directory = $this->getDirectory();
$template = $directory->ViewLayout;
if ($userId != 'login' && $userId != 0) {
$userId = explode(',', $userId);
JArrayHelper::toInteger($userId);
}
// Grab submission
$this->_db->setQuery("SELECT * FROM #__rsform_submissions WHERE SubmissionId='" . $cid . "'");
$submission = $this->_db->loadObject();
// Submission doesn't exist
if (!$submission) {
JError::raiseWarning(500, JText::sprintf('RSFP_SUBMISSION_DOES_NOT_EXIST', $cid));
return $this->_app->redirect(JURI::root());
}
// Submission doesn't belong to the configured form ID OR
// can view only own submissions and not his own OR
// can view only specified user IDs and this doesn't belong to any of the IDs
if ($submission->FormId != $this->params->get('formId') || $userId == 'login' && $submission->UserId != $user->get('id') || is_array($userId) && !in_array($user->get('id'), $userId)) {
JError::raiseWarning(500, JText::sprintf('RSFP_SUBMISSION_NOT_ALLOWED', $cid));
return $this->_app->redirect(JURI::root());
}
if ($this->params->get('show_confirmed', 0) && !$submission->confirmed) {
JError::raiseWarning(500, JText::sprintf('RSFP_SUBMISSION_NOT_CONFIRMED', $cid));
return $this->_app->redirect(JURI::root());
}
$confirmed = $submission->confirmed ? JText::_('RSFP_YES') : JText::_('RSFP_NO');
list($replace, $with) = RSFormProHelper::getReplacements($cid, true);
list($replace2, $with2) = $this->getReplacements($submission->UserId);
$replace = array_merge($replace, $replace2, array('{global:userip}', '{global:date_added}', '{global:submissionid}', '{global:submission_id}', '{global:confirmed}', '{global:lang}'));
$with = array_merge($with, $with2, array($submission->UserIp, RSFormProHelper::getDate($submission->DateSubmitted), $cid, $cid, $confirmed, $submission->Lang));
if ($format == 'pdf') {
if (strpos($template, ':path}') !== false) {
$template = str_replace(':path}', ':localpath}', $template);
}
}
if (strpos($template, '{/if}') !== false) {
require_once JPATH_ADMINISTRATOR . '/components/com_rsform/helpers/scripting.php';
RSFormProScripting::compile($template, $replace, $with);
}
$detailsLayout = str_replace($replace, $with, $template);
eval($directory->DetailsScript);
return $detailsLayout;
}