function prepareTableValue($data, XMLElement $link = NULL) { $result = array(); if (!is_array($data) || is_array($data) && !isset($data['relation_id'])) { return parent::prepareTableValue(NULL); } if (!is_array($data['relation_id'])) { $data['relation_id'] = array($data['relation_id']); } foreach ($data['relation_id'] as $relation_id) { if ((int) $relation_id <= 0) { continue; } $primary_field = $this->__findPrimaryFieldValueFromRelationID($relation_id); if (!is_array($primary_field) || empty($primary_field)) { continue; } $result[$relation_id] = $primary_field; } if (!is_null($link)) { $label = NULL; foreach ($result as $item) { $label .= ' ' . $item['value']; } $link->setValue(General::sanitize(trim($label))); return $link->generate(); } $output = NULL; foreach ($result as $relation_id => $item) { $link = Widget::Anchor($item['value'], sprintf('%s/symphony/publish/%s/edit/%d/', URL, $item['section_handle'], $relation_id)); $output .= $link->generate() . ' '; } return trim($output); }
function prepareTableValue($data, XMLElement $link = NULL) { if (!is_array($data) || is_array($data) && !isset($data['relation_id'])) { return parent::prepareTableValue(NULL); } $link = Widget::Anchor($data['value'], URL . '/symphony/extension/nested_cats/overview/edit/' . $data['relation_id']); return $link; }
public function prepareTableValue($data, XMLElement $link = NULL) { if (!is_array($data) || is_array($data) && !isset($data['relation_id'])) { return parent::prepareTableValue(NULL); } if (!is_array($data['relation_id'])) { $data['relation_id'] = array($data['relation_id']); $data['value'] = array($data['value']); $data['handle'] = array($data['handle']); } $output = NULL; foreach ($data['relation_id'] as $k => $v) { $link = Widget::Anchor($data['value'][$k], URL . '/symphony/extension/nestedcats/list/view/' . $data['relation_id'][$k]); $output .= $link->generate() . ' '; } return trim($output); }
public function prepareTableValue($data, XMLElement $link = NULL, $entry_id = NULL) { // build this entry fully $entries = EntryManager::fetch($entry_id); if ($entries === false) { return parent::prepareTableValue(NULL, $link, $entry_id); } $entry = reset(EntryManager::fetch($entry_id)); // get the first field inside this tab $field_id = Symphony::Database()->fetchVar('id', 0, "SELECT `id` FROM `tbl_fields` WHERE `parent_section` = '" . $this->get('parent_section') . "' AND `sortorder` = " . ($this->get('sortorder') + 1) . " ORDER BY `sortorder` LIMIT 1"); if ($field_id === NULL) { return parent::prepareTableValue(NULL, $link, $entry_id); } $field = FieldManager::fetch($field_id); // get the first field's value as a substitude for the tab's return value return $field->prepareTableValue($entry->getData($field_id), $link, $entry_id); }
function prepareTableValue($data, XMLElement $link = NULL) { if (!is_array($data) || empty($data)) { return; } $value = NULL; if (isset($data['username']) && !is_array($data['username'])) { $data['username'] = array($data['username']); $data['member_id'] = array($data['member_id']); } if (!is_null($link)) { return parent::prepareTableValue(array('value' => @implode(', ', $data['username']), $link)); } foreach ($data['username'] as $index => $username) { $a = Widget::Anchor($username, URL . '/symphony/publish/' . self::$_driver->memberSectionHandle() . '/edit/' . $data['member_id'][$index] . '/', "Edit Member '{$username}'"); $value .= $a->generate() . ', '; } return trim($value, ', '); }
function prepareTableValue($data, XMLElement $link = NULL) { return parent::prepareTableValue(array('value' => $data['username']), $link); }
public function prepareTableValue($data, XMLElement $link = NULL, $entry_id = null) { $value = null; if (isset($data['value'])) { $value = DateTimeObj::format($data['value'], DateTimeObj::getSetting('datetime_format'), true); } return parent::prepareTableValue(array('value' => $value), $link, $entry_id = null); }
public function prepareTableValue($data, XMLElement $link = NULL, $entry_id = null) { if (!is_array($data) || empty($data)) { return; } $value = NULL; if (isset($data['value'])) { $value = is_array($data['value']) ? self::__tagArrayToString($data['value']) : $data['value']; } return parent::prepareTableValue(array('value' => General::sanitize($value)), $link, $entry_id = null); }
public function prepareTableValue($data, XMLElement $link = NULL, $entry_id = null) { $value = $this->prepareExportValue($data, ExportableField::LIST_OF + ExportableField::VALUE, $entry_id); return parent::prepareTableValue(array('value' => implode(', ', $value)), $link, $entry_id = null); }
public function prepareTableValue($data, DOMElement $link = NULL) { if (!is_array($data)) { $data = array($data); } $values = array(); foreach ($data as $d) { $values[] = $d->value; } return parent::prepareTableValue((object) array('value' => implode(', ', $values)), $link); }
public function prepareTableValue($data, XMLElement $link = null, $entry_id = null) { $selected = array_map('trim', explode(',', $data['value'])); $options = Extension_Languages::findOptions(); $value = array(); foreach ($selected as $code) { foreach ($options as $details) { if ($details[0] == $code) { $value[] = $details[2]; break; } } } $value = implode(', ', $value); return parent::prepareTableValue(array('value' => $value), $link, $entry_id); }
public function prepareTableValue($data, XMLElement $link = NULL, $entry_id = null) { if (!($file = $data['file'])) { if ($link) { return parent::prepareTableValue(null, $link); } else { return parent::prepareTableValue(null); } } if ($link) { $link->setValue(basename($file)); return $link->generate(); } else { $link = Widget::Anchor(basename($file), URL . '/workspace' . $file); return $link->generate(); } }
public function prepareTableValue(StdClass $data = null, DOMElement $wrapper = null, Entry $entry = null) { $result = (object) array('value' => null); if (isset($data->joined_id)) { try { $document = $wrapper->ownerDocument; $driver = Extension::load('field_join'); $driver->addPublishHeaders($document); $joined = Entry::loadFromId($data->joined_id); $section = Section::loadFromHandle($joined->section); $wrapper->addClass('field-join'); $wrapper->setValue($section->name); /* $more = $document->createElement('span'); $more->addClass('more'); $more->setValue(__('More')); $wrapper->appendChild($more); // Build data array: $content = $document->createElement('div'); $more->appendChild($content); foreach ($section->layout as $column) { foreach ($column->fieldsets as $fieldset) { $group = $document->createElement('div'); $group->addClass('list'); $content->appendChild($group); if ($fieldset->name) $group->appendChild( $document->createElement('h5', $fieldset->name) ); $list = $document->createElement('dl'); $group->appendChild($list); foreach ($fieldset->fields as $field_handle) { $field = $section->fetchFieldByHandle($field_handle); $title = $document->createElement('dt', $field->{'publish-label'}); $list->appendChild($title); $item = $document->createElement('dd'); $list->appendChild($item); $value = $field->prepareTableValue( $joined->data()->{$field_handle}, $item, $joined ); } } } */ return $wrapper; } catch (Exception $e) { // Keep the null value set above. } } return parent::prepareTableValue($result, $link, $entry); }
public function prepareTableValue($data, XMLElement $link = null) { if (empty($data)) { return; } $value = ''; if (isset($data['value'])) { if (!is_array($data['value'])) { $data['value'] = array($data['value']); } $value = implode(', ', $data['value']); } return parent::prepareTableValue(array('value' => General::sanitize(strip_tags($value))), $link); }
public function prepareTableValue($data, XMLElement $link = null) { if (empty($data) or strlen(trim($data['value'])) == 0) { return; } return parent::prepareTableValue(array('value' => General::sanitize($data['compiled'])), $link); }
public function prepareTableValue($data, XMLElement $link = NULL) { if (!is_array($data['author_id'])) { $data['author_id'] = array($data['author_id']); } if (empty($data['author_id'])) { return NULL; } $value = array(); foreach ($data['author_id'] as $author_id) { $author = new Author(); if ($author->loadAuthor($author_id)) { $value[] = $author->getFullName(); } } return parent::prepareTableValue(array('value' => General::sanitize(ucwords(implode(', ', $value)))), $link); }
function prepareTableValue($data, XMLElement $link = NULL) { $value = $data['value']; if (!is_array($value)) { $value = array($value); } return parent::prepareTableValue(array('value' => @implode(', ', $value)), $link); }
public function prepareTableValue(StdClass $data = null, DOMElement $link = null) { $template = ''; if ($data->strength <= Extension_Members::PASSWORD_WEAK) { $template = 'Weak (%d)'; } else { if ($data->strength <= Extension_Members::PASSWORD_GOOD) { $template = 'Good (%d)'; } else { if ($data->strength <= Extension_Members::PASSWORD_STRONG) { $template = 'Strong (%d)'; } } } $data = (object) array('value' => __($template, array($data->strength))); return parent::prepareTableValue($data, $link); }
public function prepareTableValue($data, XMLElement $link = null) { if (empty($data)) { return; } return parent::prepareTableValue(array('value' => ucwords($data['strength']) . " ({$data['length']})"), $link); }
public function prepareTableValue($data, XMLElement $link = null) { $section_id = $this->get('section_id'); $entry_id = @(int) $data['value']; $link_id = $this->Database->fetchVar('id', 0, "\n\t\t\t\tSELECT\n\t\t\t\t\tf.id\n\t\t\t\tFROM\n\t\t\t\t\t`tbl_fields` f\n\t\t\t\tWHERE\n\t\t\t\t\tf.type = 'groupname'\n\t\t\t\t\tAND f.parent_section = {$section_id}\n\t\t\t"); $value = $this->Database->fetchVar('value', 0, "\n\t\t\t\tSELECT\n\t\t\t\t\tf.value\n\t\t\t\tFROM\n\t\t\t\t\t`tbl_entries_data_{$link_id}` f\n\t\t\t\tWHERE\n\t\t\t\t\tf.entry_id = {$entry_id}\n\t\t\t\tLIMIT 1\n\t\t\t"); return parent::prepareTableValue(array('value' => $value), $link); }
public function prepareTableValue($data, XMLElement $link = null) { $child_section_id = $this->get('child_section_id'); $section = self::$sectionManager->fetch($child_section_id); $field = @current($section->fetchVisibleColumns()); $values = array(); $length = 0; $result = ''; $limit = 75; if (!is_array($data['child_entry_id'])) { $data['child_entry_id'] = array($data['child_entry_id']); } $entries = self::$entryManager->fetch($data['child_entry_id'], $child_section_id); if (is_array($entries)) { // Find entry names: foreach ($entries as $entry) { if (empty($entry) or empty($field)) { continue; } $data = $entry->getData($field->get('id')); $value = $field->prepareTableValue($data); if ($value instanceof XMLElement) { $value = $value->generate(); } $length += strlen(strip_tags($value)); if ($length > $limit) { $values[] = (object) array('content' => '...', 'link' => ''); break; } $values[] = (object) array('content' => strip_tags($value), 'link' => URL . '/symphony/publish/' . $section->get('handle') . '/edit/' . $entry->get('id') . '/'); } } // Build final value: foreach ($values as $index => $current) { if ($index) { $result .= ', '; } if ($current->link) { $value = new XMLElement('a'); $value->setAttribute('href', $current->link); $value->setValue(trim($current->content, ', more →')); $result .= $value->generate(); } else { $result .= $current->content; } } if (empty($result)) { return parent::prepareTableValue($result, $link); } if ($link) { $link->setValue(strip_tags($result)); return $link->generate(); } else { return $result; } }
public function prepareTableValue($data, XMLElement $link = null, $entry_id = null) { $sectionManager = new SectionManager(Symphony::Engine()); $section = $sectionManager->fetch($this->get('linked_section_id')); $entryManager = new EntryManager(Symphony::Engine()); $fieldManager = new FieldManager(Symphony::Engine()); $linked = $fieldManager->fetch($this->get('linked_field_id')); $custom_link = null; $more_link = null; // Not setup correctly: if (!$section instanceof Section or !$linked) { return parent::prepareTableValue(array(), $link, $entry_id); } if (!empty($data['linked_entry_id'])) { $field = current($section->fetchVisibleColumns()); $data = $this->prepareData($data); if (!is_null($field) && $data['linked_entry_id']) { if ($this->get('column_mode') != 'count') { if ($this->get('column_mode') == 'last-item') { $data['linked_entry_id'] = array_reverse($data['linked_entry_id']); } $entries = $entryManager->fetch(current($data['linked_entry_id']), $this->get('linked_section_id'), 1); if (is_array($entries) and !empty($entries)) { $entry = current($entries); $value = $field->prepareTableValue($entry->getData($field->get('id')), new XMLElement('span')); $custom_link = new XMLElement('a'); $custom_link->setAttribute('href', sprintf('%s/symphony/publish/%s/edit/%s/', URL, $section->get('handle'), $entry->get('id'))); if ($value instanceof XMLElement) { $value = $value->generate(); } $custom_link->setValue(strip_tags($value)); $more_link = new XMLElement('a'); $more_link->setValue(__('more →')); $more_link->setAttribute('href', sprintf('%s/symphony/publish/%s/?filter=%s:%s', URL, $section->get('handle'), $linked->get('element_name'), $entry_id)); } } else { $joins = null; $where = null; $linked->buildDSRetrivalSQL(array($entry_id), $joins, $where, false); $count = $entryManager->fetchCount($this->get('linked_section_id'), $where, $joins); if ($count > 0) { $custom_link = new XMLElement('a'); $custom_link->setValue($count . __(' →')); $custom_link->setAttribute('href', sprintf('%s/symphony/publish/%s/?filter=%s:%s', URL, $section->get('handle'), $linked->get('element_name'), $entry_id)); } } } } if (is_null($custom_link)) { $custom_link = new XMLElement('a'); $custom_link->setValue(__('0 →')); $custom_link->setAttribute('href', sprintf('%s/symphony/publish/%s/?filter=%s:%s', URL, $section->get('handle'), $linked->get('element_name'), $entry_id)); if ($this->get('column_mode') != 'count') { $more_link = $custom_link; $more_link->setValue(__('more →')); $custom_link = new XMLElement('span'); $custom_link->setAttribute('class', 'inactive'); $custom_link->setValue(__('None')); } } if ($link) { $link->setValue($custom_link->getValue()); return $link->generate(); } if ($this->get('column_mode') != 'count') { $wrapper = new XMLElement('span'); $wrapper->setValue(sprintf('%s, %s', $custom_link->generate(), $more_link->generate())); return $wrapper; } return $custom_link; }
public function prepareTableValue($data, XMLElement $link = null, $entry_id = null) { $value = $this->prepareExportValue($data, ExportableField::LIST_OF + ExportableField::VALUE, $entry_id); if (is_null($value)) { return null; } return parent::prepareTableValue(array('value' => General::sanitize(implode(', ', $value))), $link, $entry_id); }
public function prepareTableValue($data, XMLElement $link = NULL, $entry_id = null) { if (empty($data)) { return __('None'); } return parent::prepareTableValue(array('value' => __(ucwords($data['strength'])) . ' (' . $data['length'] . ')'), $link, $entry_id); }
public function prepareTableValue($data, XMLElement $link = null) { if (empty($data)) { return; } return parent::prepareTableValue(array('value' => $data['value_formatted']), $link); }
/** * Prepare value for the content overview table. * * @param array $data * @param XMLElement $link */ function prepareTableValue($data, XMLElement $link = NULL) { if (empty($data['relation_id'])) { return NULL; } $count = count($data['relation_id']); return parent::prepareTableValue(array('value' => $count > 1 ? $count . ' ' . __('items') : $count . ' ' . __('item')), $link); }
function prepareTableValue($data, XMLElement $link = NULL) { $value = $data['value']; if (!is_array($value)) { $value = array($value); } $labels = $this->getSelectedLabels($data); return parent::prepareTableValue(array('value' => @implode(', ', $labels)), $link); }
/** * Append newsletter status to entry table */ public function prepareTableValue($data, XMLElement $link = NULL) { if (!is_array($data) || empty($data)) { return; } $value = NULL; if (isset($data['newsletter_id'])) { $newsletter = EmailNewsletterManager::get($data['newsletter_id']); $stats = $newsletter->getStats(); $value = $stats['status']; } switch ($value) { case 'sending': $value = __('Sending'); break; case 'stopped': $value = __('Stopped'); break; case 'error': case 'error-template': case 'error-sender': case 'error-recipients': $value = __('Failed'); break; case 'completed': $value = __('Completed'); break; case 'paused': $value = __('Paused'); break; } return parent::prepareTableValue(array('value' => $value), $link); }
public function prepareTableValue(StdClass $data, SymphonyDOMElement $link = NULL) { $value = null; if (isset($data->value) && !is_null($data->value)) { $timestamp = DateTimeObj::toGMT($data->value); $value = DateTimeObj::get(__SYM_DATETIME_FORMAT__, $timestamp); } return parent::prepareTableValue((object) array('value' => $value), $link); }
public function prepareTableValue($data, XMLElement $link = NULL, $entry_id = null) { $value = $data['value']; if (!is_array($value)) { $value = array($value); } return parent::prepareTableValue(array('value' => implode(', ', $value)), $link, $entry_id = null); }