本文整理汇总了PHP中SectionManager类的典型用法代码示例。如果您正苦于以下问题:PHP SectionManager类的具体用法?PHP SectionManager怎么用?PHP SectionManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SectionManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: findFields
public function findFields()
{
$sectionManager = new SectionManager($this->_engine);
$sections = $sectionManager->fetch(null, 'ASC', 'name');
$groups = $options = array();
if (is_array($sections) and !empty($sections)) {
foreach ($sections as $section) {
$groups[$section->get('id')] = array('fields' => $section->fetchFields(), 'section' => $section);
}
}
foreach ($groups as $group) {
if (!is_array($group['fields'])) {
continue;
}
$fields = array();
foreach ($group['fields'] as $field) {
if ($field->get('type') == 'groupname') {
$selected = $this->get('child_field_id') == $field->get('id');
$fields[] = array($field->get('id'), $selected, $field->get('label'));
}
}
if (empty($fields)) {
continue;
}
$options[] = array('label' => $group['section']->get('name'), 'options' => $fields);
}
return $options;
}
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:28,代码来源:field.membergroup.php
示例2: view
function view()
{
$this->_Parent->Page->addStylesheetToHead(URL . '/extensions/members/assets/styles.css', 'screen', 70);
$create_button = Widget::Anchor('Create a New Role', extension_members::baseURL() . 'new/', 'Create a new role', 'create button');
$this->setPageType('table');
$this->appendSubheading('Member Roles ' . $create_button->generate(false));
$aTableHead = array(array('Name', 'col'), array('Members', 'col'));
$roles = $this->_driver->fetchRoles();
$aTableBody = array();
if (!is_array($roles) || empty($roles)) {
$aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', NULL, count($aTableHead)))));
} else {
$sectionManager = new SectionManager($this->_Parent);
$section = $sectionManager->fetch($this->_Parent->Database->fetchVar('parent_section', 0, "SELECT `parent_section` FROM `tbl_fields` WHERE `id` = '" . $this->_driver->usernameAndPasswordField() . "' LIMIT 1"));
$bEven = true;
$role_field_name = $this->_Parent->Database->fetchVar('element_name', 0, "SELECT `element_name` FROM `tbl_fields` WHERE `id` = '" . $this->_driver->roleField() . "' LIMIT 1");
foreach ($roles as $role) {
$member_count = $this->_Parent->Database->fetchVar('count', 0, "SELECT COUNT(*) AS `count` FROM `tbl_entries_data_" . $this->_driver->roleField() . "` WHERE `role_id` = '" . $role->id() . "'");
## Setup each cell
$td1 = Widget::TableData(Widget::Anchor($role->name(), extension_members::baseURL() . 'edit/' . $role->id() . '/', NULL, 'content'));
$td2 = Widget::TableData(Widget::Anchor("{$member_count}", URL . '/symphony/publish/' . $section->get('handle') . '/?filter=' . $role_field_name . ':' . $role->id()));
## Add a row to the body array, assigning each cell to the row
$aTableBody[] = Widget::TableRow(array($td1, $td2), $bEven ? 'odd' : NULL);
$bEven = !$bEven;
}
}
$table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody));
$this->Form->appendChild($table);
}
开发者ID:bauhouse,项目名称:sym-spectrum-members,代码行数:29,代码来源:content.roles.php
示例3: __viewIndex
public function __viewIndex()
{
$sm = new SectionManager($this->_Parent);
$section = $sm->fetch($sm->fetchIDFromHandle($_GET['section']));
$field_id = $_GET['field'];
$fields = $section->fetchFields();
foreach ($fields as $field) {
if ($field->get('id') == $field_id) {
$upload_field = $field;
}
}
if (!$upload_field) {
die('0|Invalid Field ID');
}
$status = $upload_field->checkPostFieldData($_FILES['Filedata'], $message);
if ($status != Field::__OK__) {
die($status . '|' . $message);
}
$processData = $upload_field->processRawFieldData($_FILES['Filedata'], $status, $message);
if ($status != Field::__OK__) {
die($status . '|' . $message);
}
echo Field::__OK__ . '|' . $processData['file'];
die;
}
开发者ID:nickdunn,项目名称:uploadify,代码行数:25,代码来源:content.upload.php
示例4: saveVersion
public function saveVersion(&$context)
{
$section = $context['section'];
$entry = $context['entry'];
$fields = $context['fields'];
// if saved from an event, no section is passed, so resolve
// section object from the entry
if (is_null($section)) {
$sm = new SectionManager(Symphony::Engine());
$section = $sm->fetch($entry->get('section_id'));
}
// if we *still* can't resolve a section then something is
// probably quite wrong, so don't try and save version history
if (is_null($section)) {
return;
}
// does this section have en Entry Version field, should we store the version?
$has_entry_versions_field = FALSE;
// is this an update to an existing version, or create a new version?
$is_update = $fields['entry-versions'] != 'yes';
// find the Entry Versions field in the section and remove its presence from
// the copied POST array, so that its value is not saved against the version
foreach ($section->fetchFields() as $field) {
if ($field->get('type') == 'entry_versions') {
unset($fields[$field->get('element_name')]);
$has_entry_versions_field = TRUE;
}
}
if (!$has_entry_versions_field) {
return;
}
$version = EntryVersionsManager::saveVersion($entry, $fields, $is_update, $entry_version_field_name);
$context['messages'][] = array('version', 'passed', $version);
}
开发者ID:andrewminton,项目名称:entry_versions,代码行数:34,代码来源:extension.driver.php
示例5: generate
function generate($items, $subsection_field, $subsection_id, $entry_id = NULL, $full = false)
{
if (!is_array($items)) {
$items = array($items);
}
$this->_Items = $items;
// Fetch subsection meta data
$meta = Administration::instance()->Database->fetch("SELECT filter_tags, caption, show_preview\n\t\t\t\tFROM tbl_fields_subsectionmanager\n\t\t\t\tWHERE field_id = '{$subsection_field}'\n\t\t\t\tLIMIT 1");
// Get display mode
if ($meta[0]['show_preview'] == 'yes') {
$mode = 'preview';
} else {
$mode = 'plain';
}
// Fetch entry data
$sectionManager = new SectionManager($this->_Parent);
$subsection = $sectionManager->fetch($subsection_id, 'ASC', 'name');
$fields = $subsection->fetchFields();
$entries = $this->__filterEntries($subsection_id, $fields, $meta[0]['filter_tags'], $entry_id);
// Check caption
$caption = $meta[0]['caption'];
if ($caption == '') {
// Fetch name of primary field in subsection
$primary = Administration::instance()->Database->fetch("SELECT element_name\n\t\t\t\t\tFROM tbl_fields\n\t\t\t\t\tWHERE parent_section = '{$subsection_id}'\n\t\t\t\t\tAND sortorder = '0'\n\t\t\t\t\tLIMIT 1");
$caption = '{$' . $primary[0]['element_name'] . '}';
}
// Layout subsection data
$data = $this->__layoutSubsection($entries, $fields, $caption, $mode, $full);
return $data;
}
开发者ID:bauhouse,项目名称:subsectionmanager,代码行数:30,代码来源:class.subsectionmanager.php
示例6: entrySaved
public function entrySaved($context)
{
require_once MANIFEST . '/jit-recipes.php';
require_once MANIFEST . '/jit-precaching.php';
require_once TOOLKIT . '/class.fieldmanager.php';
$fm = new FieldManager(Symphony::Engine());
$section = $context['section'];
if (!$section) {
require_once TOOLKIT . '/class.sectionmanager.php';
$sm = new SectionManager(Symphony::Engine());
$section = $sm->fetch($context['entry']->get('section_id'));
}
// iterate over each field in this entry
foreach ($context['entry']->getData() as $field_id => $data) {
// get the field meta data
$field = $fm->fetch($field_id);
// iterate over the field => recipe mapping
foreach ($cached_recipes as $cached_recipe) {
// check a mapping exists for this section/field combination
if ($section->get('handle') != $cached_recipe['section']) {
continue;
}
if ($field->get('element_name') != $cached_recipe['field']) {
continue;
}
// iterate over the recipes mapped for this section/field combination
foreach ($cached_recipe['recipes'] as $cached_recipe_name) {
// get the file name, includes path relative to workspace
$file = $data['file'];
if (!isset($file) || is_null($file)) {
continue;
}
// trim the filename from path
$uploaded_file_path = explode('/', $file);
array_pop($uploaded_file_path);
// image path relative to workspace
if (is_array($uploaded_file_path)) {
$uploaded_file_path = implode('/', $uploaded_file_path);
}
// iterate over all JIT recipes
foreach ($recipes as $recipe) {
// only process if the recipe has a URL Parameter (name)
if (is_null($recipe['url-parameter'])) {
continue;
}
// if not using wildcard, only process specified recipe names
if ($cached_recipe_name != '*' && $cached_recipe_name != $recipe['url-parameter']) {
continue;
}
// process the image using the usual JIT URL and get the result
$image_data = file_get_contents(URL . '/image/' . $recipe['url-parameter'] . $file);
// create a directory structure that matches the JIT URL structure
General::realiseDirectory(WORKSPACE . '/image-cache/' . $recipe['url-parameter'] . $uploaded_file_path);
// save the image to disk
file_put_contents(WORKSPACE . '/image-cache/' . $recipe['url-parameter'] . $file, $image_data);
}
}
}
}
}
开发者ID:nickdunn,项目名称:jit_precaching,代码行数:60,代码来源:extension.driver.php
示例7: displaySettingsPanel
public function displaySettingsPanel(&$wrapper, $errors = NULL)
{
parent::displaySettingsPanel($wrapper, $errors);
$sectionManager = new SectionManager($this->_engine);
$sections = $sectionManager->fetch(NULL, 'ASC', 'sortorder');
$options = array();
// iterate over sections to build list of fields
if (is_array($sections) && !empty($sections)) {
foreach ($sections as $section) {
$section_fields = $section->fetchFields();
if (!is_array($section_fields)) {
continue;
}
$fields = array();
foreach ($section_fields as $f) {
// only show select box link fields
if ($f->get('type') == 'selectbox_link') {
$fields[] = array($f->get('id'), $this->get('related_sbl_id') == $f->get('id'), $f->get('label'));
}
}
if (!empty($fields)) {
$options[] = array('label' => $section->get('name'), 'options' => $fields);
}
}
}
$group = new XMLElement('div', NULL, array('class' => 'group'));
$label = Widget::Label(__('Child Select Box Link'));
$label->appendChild(Widget::Select('fields[' . $this->get('sortorder') . '][related_sbl_id]', $options));
if (isset($errors['related_sbl_id'])) {
$group->appendChild(Widget::wrapFormElementWithError($label, $errors['related_sbl_id']));
} else {
$group->appendChild($label);
}
$wrapper->appendChild($group);
}
开发者ID:nickdunn,项目名称:member_replies,代码行数:35,代码来源:field.member_replies.php
示例8: initaliseAdminPageHead
public function initaliseAdminPageHead($context)
{
$page = Administration::instance()->Page;
if ($page instanceof contentPublish) {
$callback = Administration::instance()->getPageCallback();
if ($callback['context']['page'] !== 'edit') {
return;
}
$sm = new SectionManager(Administration::instance());
$current_section = $sm->fetch($sm->fetchIDFromHandle($callback['context']['section_handle']));
$current_section_hash = $this->serialiseSectionSchema($current_section);
$duplicate_sections = array();
foreach ($sm->fetch() as $section) {
$section_hash = $this->serialiseSectionSchema($section);
if ($section_hash == $current_section_hash && $section->get('handle')) {
$duplicate_sections[$section->get('handle')] = $section->get('name');
}
}
if (count($duplicate_sections) < 2) {
$duplicate_sections = NULL;
}
Administration::instance()->Page->addElementToHead(new XMLElement('script', "Symphony.Context.add('duplicate-entry', " . json_encode(array('current-section' => $callback['context']['section_handle'], 'duplicate-sections' => $duplicate_sections)) . ");", array('type' => 'text/javascript')), time());
$page->addScriptToHead(URL . '/extensions/duplicate_entry/assets/duplicate_entry.js', 10001);
// add particular css for SSM
Administration::instance()->Page->addElementToHead(new XMLElement('style', "body.inline.subsection #duplicate-entry { display: none; visibility: collapse }", array('type' => 'text/css')), time() + 101);
}
}
开发者ID:symphonists,项目名称:duplicate_entry,代码行数:27,代码来源:extension.driver.php
示例9: fetchVisibleFieldID
function fetchVisibleFieldID($section)
{
$sectionManager = new SectionManager($this->_Parent);
$linked_section = $sectionManager->fetch($section);
$li_field = current($linked_section->fetchVisibleColumns());
return $li_field->get('id');
}
开发者ID:6ui11em,项目名称:export_entry,代码行数:7,代码来源:extension.driver.php
示例10: view
public function view()
{
$this->_driver = $this->_Parent->ExtensionManager->create('export_entry');
$this->target = $_GET['section'];
$this->fieldID = $_GET['field'];
if (!$this->validate()) {
$this->_status = self::STATUS_BAD;
$this->generate();
return false;
}
$sectionManager = new SectionManager($this->_Parent);
$entryManager = new EntryManager($this->_Parent);
$section = $sectionManager->fetch($this->target);
$fields = $section->fetchFields();
/* Get all the fields from the target section
** Loop them for the section Link field
*/
foreach ($fields as $field) {
if ($field->get("id") == $this->fieldID) {
if ($field->get('type') == "bilink") {
$linked_section_id = $field->get("linked_section_id");
$linked_field_id = $field->get("linked_field_id");
} else {
if ($field->get('type') == "selectbox_link") {
$linked_section_id = Symphony::Database()->fetchVar("parent_section_id", 0, "SELECT parent_section_id \n\t\t\t\t\t\t\tFROM `tbl_sections_association` \n\t\t\t\t\t\t\tWHERE `child_section_field_id` = {$field->get("id")}\n\t\t\t\t\t\t\tLIMIT 1");
$linked_field_id = $field->get("related_field_id");
} else {
if ($field->get('type') == "checkbox") {
$linked_section_id = false;
$el = new XMLElement("entry", 'Yes');
$el->setAttribute('id', 'yes');
$this->_Result->appendChild($el);
$el = new XMLElement("entry", 'No');
$el->setAttribute('id', 'no');
$this->_Result->appendChild($el);
}
}
}
}
}
if ($linked_section_id) {
/* Got the linked field, now get the other end of the
** link. Use the first Visible column as the output handle
*/
$linked_field_id = $this->_driver->fetchVisibleFieldID($linked_section_id);
/* Foreach entry in the linked section, display the first
** column to be selected
*/
$entries = $entryManager->fetch(null, $linked_section_id);
foreach ($entries as $entry) {
$data = current($entryManager->fetch($entry->get('id'), $linked_section_id));
$values = $data->getData($linked_field_id);
$el = new XMLElement("entry", General::sanitize($values['value']));
$el->setAttribute('id', $entry->get('id'));
$this->_Result->appendChild($el);
}
}
}
开发者ID:6ui11em,项目名称:export_entry,代码行数:58,代码来源:content.ajaxentries.php
示例11: __viewIndex
public function __viewIndex()
{
$this->setPageType('table');
$this->setTitle(__('%1$s – %2$s', array(__('Symphony'), __('Member Roles'))));
if (is_null(extension_Members::getFieldHandle('role')) && !is_null(extension_Members::getMembersSection())) {
$this->pageAlert(__('There is no Member: Role field in the active Members section. <a href="%s%d/">Add Member: Role field?</a>', array(SYMPHONY_URL . '/blueprints/sections/edit/', extension_Members::getMembersSection())), Alert::NOTICE);
}
$this->appendSubheading(__('Member Roles'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . 'new/', __('Create a Role'), 'create button', NULL, array('accesskey' => 'c')));
$roles = RoleManager::fetch();
$aTableHead = array(array(__('Name'), 'col'), array(__('Members'), 'col'));
$aTableBody = array();
if (!is_array($roles) || empty($roles)) {
$aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead)))));
} else {
if (is_null(extension_Members::getMembersSection())) {
$aTableBody = array(Widget::TableRow(array(Widget::TableData(__('No Member section has been specified in <a href="%s">Preferences</a>. Please do this first.', array(SYMPHONY_URL . '/system/preferences/')), 'inactive', NULL, count($aTableHead)))));
} else {
$sectionManager = new SectionManager(Administration::instance());
$section = $sectionManager->fetch(extension_Members::getMembersSection());
$with_selected_roles = array();
$hasRoles = !is_null(extension_Members::getFieldHandle('role'));
foreach ($roles as $role) {
// Setup each cell
$td1 = Widget::TableData(Widget::Anchor($role->get('name'), Administration::instance()->getCurrentPageURL() . 'edit/' . $role->get('id') . '/', null, 'content'));
if ($role->get('id') != Role::PUBLIC_ROLE) {
$td1->appendChild(Widget::Input("items[{$role->get('id')}]", null, 'checkbox'));
}
// Get the number of members for this role, as long as it's not the Public Role.
if ($hasRoles && $role->get('id') != Role::PUBLIC_ROLE) {
$member_count = Symphony::Database()->fetchVar('count', 0, sprintf("SELECT COUNT(*) AS `count` FROM `tbl_entries_data_%d` WHERE `role_id` = %d", extension_Members::getField('role')->get('id'), $role->get('id')));
$td2 = Widget::TableData(Widget::Anchor("{$member_count}", SYMPHONY_URL . '/publish/' . $section->get('handle') . '/?filter=' . extension_Members::getFieldHandle('role') . ':' . $role->get('id')));
} else {
if ($role->get('id') == Role::PUBLIC_ROLE) {
$td2 = Widget::TableData(__('This is the role assumed by the general public.'));
} else {
$td2 = Widget::TableData(__('None'), 'inactive');
}
}
// Add cells to a row
$aTableBody[] = Widget::TableRow(array($td1, $td2));
if ($hasRoles && $role->get('id') != Role::PUBLIC_ROLE) {
$with_selected_roles[] = array("move::" . $role->get('id'), false, $role->get('name'));
}
}
}
}
$table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'selectable');
$this->Form->appendChild($table);
$tableActions = new XMLElement('div');
$tableActions->setAttribute('class', 'actions');
$options = array(0 => array(null, false, __('With Selected...')), 2 => array('delete', false, __('Delete'), 'confirm'), 3 => array('delete-members', false, __('Delete Members'), 'confirm'));
if (count($with_selected_roles) > 0) {
$options[1] = array('label' => __('Move Members To'), 'options' => $with_selected_roles);
}
$tableActions->appendChild(Widget::Select('with-selected', $options));
$tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
$this->Form->appendChild($tableActions);
}
开发者ID:brendo,项目名称:members,代码行数:58,代码来源:content.roles.php
示例12: displaySettingsPanel
public function displaySettingsPanel(&$wrapper, $errors = NULL)
{
Field::displaySettingsPanel($wrapper, $errors);
$div = new XMLElement('div', NULL, array('class' => 'group'));
$label = Widget::Label('Options');
$sectionManager = new SectionManager($this->_engine);
$sections = $sectionManager->fetch(NULL, 'ASC', 'name');
$field_groups = array();
if (is_array($sections) && !empty($sections)) {
foreach ($sections as $section) {
$field_groups[$section->get('id')] = array('fields' => $section->fetchFields(), 'section' => $section);
}
}
$options = array();
foreach ($field_groups as $group) {
if (!is_array($group['fields'])) {
continue;
}
$fields = array();
foreach ($group['fields'] as $f) {
if ($f->get('id') != $this->get('id') && $f->canPrePopulate() && !is_null($this->get('related_field_id'))) {
$fields[] = array($f->get('id'), in_array($f->get('id'), $this->get('related_field_id')), $f->get('label'));
}
}
if (is_array($fields) && !empty($fields)) {
$options[] = array('label' => $group['section']->get('name'), 'options' => $fields);
}
}
$label->appendChild(Widget::Select('fields[' . $this->get('sortorder') . '][related_field_id][]', $options, array('multiple' => 'multiple')));
$div->appendChild($label);
// set field type
$label = Widget::Label('Field Type');
$type_options = array(array('select', $this->get('field_type') == 'select', 'Select Box'), array('autocomplete', $this->get('field_type') == 'autocomplete', 'Autocomplete Input'));
$label->appendChild(Widget::Select('fields[' . $this->get('sortorder') . '][field_type]', $type_options));
$div->appendChild($label);
// Allow selection of multiple items
$label = Widget::Label();
$input = Widget::Input('fields[' . $this->get('sortorder') . '][allow_multiple_selection]', 'yes', 'checkbox');
if ($this->get('allow_multiple_selection') == 'yes') {
$input->setAttribute('checked', 'checked');
}
$label->setValue($input->generate() . ' Allow selection of multiple options');
$div->appendChild($label);
if (isset($errors['related_field_id'])) {
$wrapper->appendChild(Widget::wrapFormElementWithError($div, $errors['related_field_id']));
} else {
$wrapper->appendChild($div);
}
## Maximum entries
$label = Widget::Label();
$input = Widget::Input('fields[' . $this->get('sortorder') . '][limit]', $this->get('limit'));
$input->setAttribute('size', '3');
$label->setValue('Limit to the ' . $input->generate() . ' most recent entries');
$wrapper->appendChild($label);
$this->appendShowColumnCheckbox($wrapper);
$this->appendRequiredCheckbox($wrapper);
}
开发者ID:brendo,项目名称:referencelink,代码行数:57,代码来源:field.referencelink.php
示例13: __doit
private function __doit($source, $fields, &$result, $entry_id = NULL, $cookie = NULL)
{
include_once TOOLKIT . '/class.sectionmanager.php';
include_once TOOLKIT . '/class.entrymanager.php';
$sectionManager = new SectionManager($this->_Parent);
if (!($section = $sectionManager->fetch($source))) {
$result->setAttribute('result', 'error');
$result->appendChild(new XMLElement('message', 'Section is invalid'));
return false;
}
$entryManager = new EntryManager($this->_Parent);
if (isset($entry_id) && $entry_id != NULL) {
$entry =& $entryManager->fetch($entry_id);
$entry = $entry[0];
if (!is_object($entry)) {
$result->setAttribute('result', 'error');
$result->appendChild(new XMLElement('message', 'Invalid Entry ID specified. Could not create Entry object.'));
return false;
}
} else {
$entry =& $entryManager->create();
$entry->set('section_id', $source);
}
if (__ENTRY_FIELD_ERROR__ == $entry->checkPostData($fields, $errors, $entry->get('id') ? true : false)) {
$result->setAttribute('result', 'error');
$result->appendChild(new XMLElement('message', 'Entry encountered errors when saving.'));
foreach ($errors as $field_id => $message) {
$field = $entryManager->fieldManager->fetch($field_id);
$result->appendChild(new XMLElement($field->get('element_name'), NULL, array('type' => $fields[$field->get('element_name')] == '' ? 'missing' : 'invalid')));
}
if (isset($cookie) && is_object($cookie)) {
$result->appendChild($cookie);
}
return false;
} elseif (__ENTRY_OK__ != $entry->setDataFromPost($fields, $errors, false, $entry->get('id') ? true : false)) {
$result->setAttribute('result', 'error');
$result->appendChild(new XMLElement('message', 'Entry encountered errors when saving.'));
foreach ($errors as $err) {
$field = $entryManager->fieldManager->fetch($err['field_id']);
$result->appendChild(new XMLElement($field->get('element_name'), NULL, array('type' => 'invalid')));
}
if (isset($cookie) && is_object($cookie)) {
$result->appendChild($cookie);
}
return false;
} else {
if (!$entry->commit()) {
$result->setAttribute('result', 'error');
$result->appendChild(new XMLElement('message', 'Unknown errors where encountered when saving.'));
if (isset($cookie) && is_object($cookie)) {
$result->appendChild($cookie);
}
return false;
}
}
return $entry;
}
开发者ID:bauhouse,项目名称:sym-forum-ensemble,代码行数:57,代码来源:event.forum_post.php
示例14: __construct
public function __construct(&$parent)
{
parent::__construct($parent);
$this->_uri = URL . '/symphony/extension/search_index';
$sectionManager = new SectionManager($this->_Parent);
$this->_sections = $sectionManager->fetch(NULL, 'ASC', 'name');
$this->_indexes = SearchIndex::getIndexes();
$this->_section = NULL;
$this->_index = NULL;
}
开发者ID:TwistedInteractive,项目名称:search_index,代码行数:10,代码来源:content.indexes.php
示例15: getSectionId
public function getSectionId()
{
$sectionManager = new SectionManager(Frontend::instance());
$section_id = $sectionManager->fetchIDFromHandle(General::sanitize($_REQUEST['MUUsource']));
if (!($section = $sectionManager->fetch($section_id))) {
return NULL;
} else {
return $section_id;
}
}
开发者ID:scottkf,项目名称:massuploadutility,代码行数:10,代码来源:content.index.php
示例16: view
public function view()
{
$sectionManager = new SectionManager(Administration::instance());
$fieldManager = new FieldManager(Administration::instance());
// Fetch sections & populate a dropdown with the available upload fields
$section = $sectionManager->fetch($_GET['section']);
foreach ($section->fetchFields() as $field) {
if (!preg_match(Extension_BulkImporter::$supported_fields['upload'], $field->get('type'))) {
continue;
}
$element = new XMLElement("field", General::sanitize($field->get('label')), array('id' => $field->get('id'), 'type' => $field->get('type')));
$this->_Result->appendChild($element);
}
// Check to see if any Sections link to this using the Section Associations table
$associations = Symphony::Database()->fetch(sprintf("\n\t\t\t\t\tSELECT\n\t\t\t\t\t\t`child_section_field_id`\n\t\t\t\t\tFROM\n\t\t\t\t\t\t`tbl_sections_association`\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t`parent_section_id` = %d\n\t\t\t\t", Symphony::Database()->cleanValue($_GET['section'])));
if (is_array($associations) && !empty($associations)) {
foreach ($associations as $related_field) {
$field = $fieldManager->fetch($related_field['child_section_field_id']);
if (!preg_match(Extension_BulkImporter::$supported_fields['section'], $field->get('type'))) {
continue;
}
$element = new XMLElement("section", General::sanitize($field->get('label')), array('id' => $field->get('id'), 'type' => $field->get('type'), 'section' => $sectionManager->fetch($field->get('parent_section'))->get('name')));
$this->_Result->appendChild($element);
}
}
// Check for Subsection Manager
if (Symphony::ExtensionManager()->fetchStatus('subsectionmanager') == EXTENSION_ENABLED) {
$associations = Symphony::Database()->fetch(sprintf("\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t`field_id`\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t`tbl_fields_subsectionmanager`\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t`subsection_id` = %d\n\t\t\t\t\t", Symphony::Database()->cleanValue($_GET['section'])));
if (is_array($associations) && !empty($associations)) {
foreach ($associations as $related_field) {
$field = $fieldManager->fetch($related_field['field_id']);
if (!preg_match(Extension_BulkImporter::$supported_fields['section'], $field->get('type'))) {
continue;
}
$element = new XMLElement("section", General::sanitize($field->get('label')), array('id' => $field->get('id'), 'type' => $field->get('type'), 'section' => $sectionManager->fetch($field->get('parent_section'))->get('name')));
$this->_Result->appendChild($element);
}
}
}
// Check for BiLink
if (Symphony::ExtensionManager()->fetchStatus('bilinkfield') == EXTENSION_ENABLED) {
$associations = Symphony::Database()->fetch(sprintf("\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t`field_id`\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t`tbl_fields_bilink`\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t`linked_section_id` = %d\n\t\t\t\t\t", Symphony::Database()->cleanValue($_GET['section'])));
if (is_array($associations) && !empty($associations)) {
foreach ($associations as $related_field) {
$field = $fieldManager->fetch($related_field['field_id']);
if (!preg_match(Extension_BulkImporter::$supported_fields['section'], $field->get('type'))) {
continue;
}
$element = new XMLElement("section", General::sanitize($field->get('label')), array('id' => $field->get('id'), 'type' => $field->get('type'), 'section' => $sectionManager->fetch($field->get('parent_section'))->get('name')));
$this->_Result->appendChild($element);
}
}
}
}
开发者ID:brendo,项目名称:bulkimporter,代码行数:54,代码来源:content.ajaxsectioninfo.php
示例17: updateSections
public static function updateSections()
{
$files = General::listStructure(WORKSPACE . '/sections', array(), false);
$engine =& Symphony::Engine();
$sectionManager = new SectionManager($engine);
$fieldManager = new FieldManager($engine);
if (is_array($files['filelist']) && !empty($files['filelist'])) {
foreach ($files['filelist'] as $filename) {
$data = @file_get_contents(WORKSPACE . "/sections/{$filename}");
// Create DOMDocument instance
$xml = new DOMDocument();
$xml->preserveWhiteSpace = false;
$xml->formatOutput = true;
$xml->loadXML($data);
// XPath for querying nodes
$xpath = new DOMXPath($xml);
$editing = false;
$section_guid = $xpath->query('/section/@guid')->item(0)->value;
$sections = Symphony::Database()->fetchCol('guid', "SELECT * FROM `tbl_sections`");
if (in_array($section_guid, $sections)) {
$editing = true;
}
// Meta data
$meta = array();
$meta_nodes = $xpath->query('/section/meta/*');
foreach ($meta_nodes as $node) {
$meta[$node->tagName] = $node->textContent;
}
if ($editing) {
Symphony::Database()->update($meta, 'tbl_sections', "guid = {$section_guid}");
} else {
$section_id = $sectionManager->add($meta);
}
// Fields
$fields = array();
$field_nodes = $xpath->query('/section/fields/entry');
foreach ($field_nodes as $node) {
$field = array();
foreach ($node->childNodes as $childNode) {
$field[$childNode->tagName] = $childNode->textContent;
}
$fields[] = $field;
}
self::removeMissingFields($fields, $fieldManager);
if (is_array($fields) && !empty($fields)) {
foreach ($fields as $data) {
$field = $fieldManager->create($data['type']);
$field->setFromPOST($data);
$field->commit();
}
}
}
}
}
开发者ID:rainerborene,项目名称:schema_migration,代码行数:54,代码来源:class.synchronizer.php
示例18: fetchVisibleFieldID
function fetchVisibleFieldID($section)
{
if (isset(Extension_export_entry::$section_visible[$section])) {
return Extension_export_entry::$section_visible[$section];
}
$sectionManager = new SectionManager($this->_Parent);
$linked_section = $sectionManager->fetch($section);
$li_field = current($linked_section->fetchVisibleColumns());
Extension_export_entry::$section_visible[$section] = $li_field->get('id');
return Extension_export_entry::$section_visible[$section];
}
开发者ID:brendo,项目名称:export_entry,代码行数:11,代码来源:extension.driver.php
示例19: __construct
public function __construct(&$parent)
{
parent::__construct($parent);
$sectionManager = new SectionManager(Administration::instance());
$this->_entryManager = new EntryManager(Administration::instance());
// cache array of all sections
$this->_sections = $sectionManager->fetch(NULL, 'ASC', 'name');
$this->_section = null;
// cache array of all indexes
$this->_indexes = SearchIndex::getIndexes();
$this->_index = null;
}
开发者ID:6ui11em,项目名称:search_index,代码行数:12,代码来源:content.reindex.php
示例20: displaySettingsPanel
function displaySettingsPanel(&$wrapper, $errors = NULL)
{
parent::displaySettingsPanel($wrapper, $errors);
$label = Widget::Label(__('Connected Upload Field'));
$sectionManager = new SectionManager($this->_engine);
$sections = $sectionManager->fetch(NULL, 'ASC', 'name');
$field_groups = array();
if (is_array($sections) && !empty($sections)) {
foreach ($sections as $section) {
$field_groups[$section->get('id')] = array('fields' => $section->fetchFields(), 'section' => $section);
}
}
$options = array(array('', false, __('None Selected')));
foreach ($field_groups as $group) {
if (!is_array($group['fields'])) {
continue;
}
$fields = array();
foreach ($group['fields'] as $f) {
if (
|
请发表评论