本文整理汇总了PHP中Entry::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP Entry::getData方法的具体用法?PHP Entry::getData怎么用?PHP Entry::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entry
的用法示例。
在下文中一共展示了Entry::getData方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEntryValue
public function getEntryValue(Entry $entry)
{
if (!$this->initialize()) {
return '';
}
$section = $this->getSection($entry->get('section_id'));
$field = @array_shift($section->fetchVisibleColumns());
$span = new XMLElement('span');
if (is_null($field)) {
return '';
}
$data = $entry->getData($field->get('id'));
if (empty($data)) {
return '';
}
$data = $field->prepareTableValue($data, $span);
if ($data instanceof XMLElement) {
$data = $data->generate();
}
return strip_tags($data);
}
示例2: edit
/**
* Update an existing Entry object given an Entry object
*
* @param Entry $entry
* An Entry object
* @return boolean
*/
public function edit(Entry $entry)
{
foreach ($entry->getData() as $field_id => $field) {
if (empty($field_id)) {
continue;
}
try {
Symphony::Database()->delete('tbl_entries_data_' . $field_id, " `entry_id` = '" . $entry->get('id') . "'");
} catch (Exception $e) {
// Discard?
}
if (!is_array($field) || empty($field)) {
continue;
}
$data = array('entry_id' => $entry->get('id'));
$fields = array();
foreach ($field as $key => $value) {
if (is_array($value)) {
foreach ($value as $ii => $v) {
$fields[$ii][$key] = $v;
}
} else {
$fields[max(0, count($fields) - 1)][$key] = $value;
}
}
foreach ($fields as $index => $field_data) {
$fields[$index] = array_merge($data, $field_data);
}
Symphony::Database()->insert($fields, 'tbl_entries_data_' . $field_id);
}
return true;
}
示例3: processEntry
/**
* Given an Entry object, this function will generate an XML representation
* of the Entry to be returned. It will also add any parameters selected
* by this datasource to the parameter pool.
*
* @param Entry $entry
* @return XMLElement|boolean
* Returns boolean when only parameters are to be returned.
*/
public function processEntry(Entry $entry)
{
$data = $entry->getData();
$xEntry = new XMLElement('entry');
$xEntry->setAttribute('id', $entry->get('id'));
if (!empty($this->_associated_sections)) {
$this->setAssociatedEntryCounts($xEntry, $entry);
}
if ($this->_can_process_system_parameters) {
$this->processSystemParameters($entry);
}
foreach ($data as $field_id => $values) {
if (!isset(self::$_fieldPool[$field_id]) || !is_object(self::$_fieldPool[$field_id])) {
self::$_fieldPool[$field_id] =& FieldManager::fetch($field_id);
}
$this->processOutputParameters($entry, $field_id, $values);
if (!$this->_param_output_only) {
foreach ($this->dsParamINCLUDEDELEMENTS as $handle) {
list($handle, $mode) = preg_split('/\\s*:\\s*/', $handle, 2);
if (self::$_fieldPool[$field_id]->get('element_name') == $handle) {
self::$_fieldPool[$field_id]->appendFormattedElement($xEntry, $values, $this->dsParamHTMLENCODE ? true : false, $mode, $entry->get('id'));
}
}
}
}
if ($this->_param_output_only) {
return true;
}
if (in_array('system:date', $this->dsParamINCLUDEDELEMENTS)) {
$xEntry->appendChild(General::createXMLDateObject(DateTimeObj::get('U', $entry->creationDate), 'system-date'));
}
return $xEntry;
}
示例4: __wrapFieldWithDiv
/**
* Given a Field and Entry object, this function will wrap
* the Field's displayPublishPanel result with a div that
* contains some contextual information such as the Field ID,
* the Field handle and whether it is required or not.
*
* @param Field $field
* @param Entry $entry
* @return XMLElement
*/
private function __wrapFieldWithDiv(Field $field, Entry $entry)
{
$div = new XMLElement('div', NULL, array('id' => 'field-' . $field->get('id'), 'class' => 'field field-' . $field->handle() . ($field->get('required') == 'yes' ? ' required' : '')));
$field->displayPublishPanel($div, $entry->getData($field->get('id')), isset($this->_errors[$field->get('id')]) ? $this->_errors[$field->get('id')] : NULL, null, null, is_numeric($entry->get('id')) ? $entry->get('id') : NULL);
return $div;
}
示例5: prepareAssociationsDrawerXMLElement
/**
* Format this field value for display in the Associations Drawer publish index.
* By default, Symphony will use the return value of the `prepareReadableValue` function.
*
* @since Symphony 2.4
* @since Symphony 2.5.0 The prepopulate parameter was added.
*
* @param Entry $e
* The associated entry
* @param array $parent_association
* An array containing information about the association
* @param string $prepopulate
* A string containing prepopulate parameter to append to the association url
*
* @return XMLElement
* The XMLElement must be a li node, since it will be added an ul node.
*/
public function prepareAssociationsDrawerXMLElement(Entry $e, array $parent_association, $prepopulate = '')
{
$value = $this->prepareReadableValue($e->getData($this->get('id')), $e->get('id'));
// fallback for compatibility since the default
// `preparePlainTextValue` is not compatible with all fields
// this should be removed in Symphony 3.0
if (empty($value)) {
$value = strip_tags($this->prepareTableValue($e->getData($this->get('id')), null, $e->get('id')));
}
// use our factory method to create the html
$li = self::createAssociationsDrawerXMLElement($value, $e, $parent_association, $prepopulate);
$li->setAttribute('class', 'field-' . $this->get('type'));
return $li;
}
示例6: prepareAssociationsDrawerXMLElement
public function prepareAssociationsDrawerXMLElement(Entry $e, array $parent_association, $prepolutate = '')
{
$currentSection = SectionManager::fetch($parent_association['child_section_id']);
$visibleCols = $currentSection->fetchVisibleColumns();
$outputFieldId = current(array_keys($visibleCols));
$outputField = FieldManager::fetch($outputFieldId);
$value = $outputField->prepareReadableValue($e->getData($outputFieldId), $e->get('id'), true, __('None'));
$li = new XMLElement('li');
$li->setAttribute('class', 'field-' . $this->get('type'));
$a = new XMLElement('a', strip_tags($value));
$a->setAttribute('href', SYMPHONY_URL . '/publish/' . $parent_association['handle'] . '/edit/' . $e->get('id') . '/');
$li->appendChild($a);
return $li;
}
示例7: prepareAssociationsDrawerXMLElement
/**
* Format this field value for display in the Associations Drawer publish index.
* By default, Symphony will use the return value of the `prepareTableValue` function.
*
* @param Entry $e
* The associated entry
* @param array $parent_association
* An array containing information about the parent
*
* return XMLElement
* The XMLElement must be a li node, since it will be added an ul node.
*/
public function prepareAssociationsDrawerXMLElement(Entry $e, array $parent_association)
{
$value = $this->prepareTableValue($e->getData($this->get('id')), null, $e->get('id'));
$li = new XMLElement('li');
$li->setAttribute('class', 'field-' . $this->get('type'));
$a = new XMLElement('a', strip_tags($value));
$a->setAttribute('href', SYMPHONY_URL . '/publish/' . $parent_association['handle'] . '/edit/' . $e->get('id') . '/');
$li->appendChild($a);
return $li;
}
示例8: __wrapFieldWithDiv
/**
* Given a Field and Entry object, this function will wrap
* the Field's displayPublishPanel result with a div that
* contains some contextual information such as the Field ID,
* the Field handle and whether it is required or not.
*
* @param Field $field
* @param Entry $entry
* @return XMLElement
*/
private function __wrapFieldWithDiv(Field $field, Entry $entry)
{
$is_hidden = $this->isFieldHidden($field);
$div = new XMLElement('div', null, array('id' => 'field-' . $field->get('id'), 'class' => 'field field-' . $field->handle() . ($field->get('required') == 'yes' ? ' required' : '') . ($is_hidden === true ? ' irrelevant' : '')));
$field->setAssociationContext($div);
$field->displayPublishPanel($div, $entry->getData($field->get('id')), isset($this->_errors[$field->get('id')]) ? $this->_errors[$field->get('id')] : null, null, null, is_numeric($entry->get('id')) ? $entry->get('id') : null);
/**
* Allows developers modify the field before it is rendered in the publish
* form. Passes the `Field` object, `Entry` object, the `XMLElement` div and
* any errors for the entire `Entry`. Only the `$div` element
* will be altered before appending to the page, the rest are read only.
*
* @since Symphony 2.5.0
* @delegate ModifyFieldPublishWidget
* @param string $context
* '/backend/'
* @param Field $field
* @param Entry $entry
* @param array $errors
* @param Widget $widget
*/
Symphony::ExtensionManager()->notifyMembers('ModifyFieldPublishWidget', '/backend/', array('field' => $field, 'entry' => $entry, 'errors' => $this->_errors, 'widget' => &$div));
return $div;
}
示例9: edit
/**
* Update an existing Entry object given an Entry object
*
* @param Entry $entry
* An Entry object
* @throws DatabaseException
* @return boolean
*/
public static function edit(Entry $entry)
{
// Update modification date.
Symphony::Database()->update(array('modification_date' => $entry->get('modification_date'), 'modification_date_gmt' => $entry->get('modification_date_gmt')), 'tbl_entries', sprintf(' `id` = %d', $entry->get('id')));
// Iterate over all data for this entry, deleting existing data first
// then inserting a new row for the data
foreach ($entry->getData() as $field_id => $field) {
if (empty($field_id)) {
continue;
}
try {
Symphony::Database()->delete('tbl_entries_data_' . $field_id, sprintf("\n `entry_id` = %d", $entry->get('id')));
} catch (Exception $e) {
// Discard?
}
if (!is_array($field) || empty($field)) {
continue;
}
$data = array('entry_id' => $entry->get('id'));
$fields = array();
foreach ($field as $key => $value) {
if (is_array($value)) {
foreach ($value as $ii => $v) {
$fields[$ii][$key] = $v;
}
} else {
$fields[max(0, count($fields) - 1)][$key] = $value;
}
}
foreach ($fields as $index => $field_data) {
$fields[$index] = array_merge($data, $field_data);
}
Symphony::Database()->insert($fields, 'tbl_entries_data_' . $field_id);
}
return true;
}
示例10: __replaceFieldsInString
private function __replaceFieldsInString($string, Entry $entry)
{
$fields = $this->__findFieldsInString($string, true);
if (is_array($fields) && !empty($fields)) {
$FieldManager = new FieldManager($this->_Parent);
foreach ($fields as $element_name => $field_id) {
if ($field_id == NULL) {
continue;
}
$field_data = $entry->getData($field_id);
$fieldObj = $FieldManager->fetch($field_id);
$value = $fieldObj->prepareTableValue($field_data);
$string = str_replace('{$' . $element_name . '}', $value, $string);
$string = str_replace('{$' . $element_name . '::handle}', Lang::createHandle($value), $string);
}
}
return $string;
}
示例11: equals
public function equals(Entry $e) : bool
{
return $this->criteria['data'] == $e->getData();
}