当前位置: 首页>>代码示例>>PHP>>正文


PHP Widget::Select方法代码示例

本文整理汇总了PHP中Widget::Select方法的典型用法代码示例。如果您正苦于以下问题:PHP Widget::Select方法的具体用法?PHP Widget::Select怎么用?PHP Widget::Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Widget的用法示例。


在下文中一共展示了Widget::Select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: displayPublishPanel

 public function displayPublishPanel(&$wrapper, $data = null, $error = null, $prefix = null, $postfix = null)
 {
     $this->_driver->addPublishHeaders($this->_engine->Page);
     $sortorder = $this->get('sortorder');
     $element_name = $this->get('element_name');
     $container = new XMLElement('div', $this->get('label'));
     $container->setAttribute('class', 'label');
     $container->appendChild(new XMLElement('i', __('Optional')));
     $group = new XMLElement('div');
     // From:
     $label = Widget::Label(__('Date'));
     $from = Widget::Input("fields{$prefix}[{$element_name}]{$postfix}[from]", General::sanitize($data['from_value']));
     $label->appendChild($from);
     $group->appendChild($label);
     // To:
     $label = Widget::Label(__('Until Date'));
     $from = Widget::Input("fields{$prefix}[{$element_name}]{$postfix}[to]", General::sanitize($data['to_value']));
     $label->appendChild($from);
     $group->appendChild($label);
     // Mode:
     $options = array(array('entire-day', false, 'Entire Day'), array('entire-week', false, 'Entire Week'), array('entire-month', false, 'Entire Month'), array('entire-year', false, 'Entire Year'), array('until-date', false, 'Until Date'));
     foreach ($options as &$option) {
         if ($option[0] != $data['mode']) {
             continue;
         }
         $option[1] = true;
         break;
     }
     $label = Widget::Label(__('Mode'));
     $from = Widget::Select("fields{$prefix}[{$element_name}]{$postfix}[mode]", $options);
     $label->appendChild($from);
     $group->appendChild($label);
     $container->appendChild($group);
     $wrapper->appendChild($container);
 }
开发者ID:psychoticmeowArchives,项目名称:daterangefield,代码行数:35,代码来源:field.daterange.php

示例2: buildEditor

 public static function buildEditor(XMLElement $wrapper, array &$errors = array(), array $settings = null, $handle = null)
 {
     Administration::instance()->Page->addScriptToHead(URL . '/extensions/section_schemas/assets/section_schemas.datasource.js', 100);
     if (is_null($settings[self::getClass()]['fields'])) {
         $settings[self::getClass()]['fields'] = array();
     }
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings contextual ' . __CLASS__);
     $fieldset->setAttribute('data-context', General::createHandle(self::getName()));
     $fieldset->appendChild(new XMLElement('legend', self::getName()));
     $group = new XMLElement('div');
     $group->setAttribute('class', 'two columns');
     $options = array();
     $sections = SectionManager::fetch();
     foreach ($sections as $section) {
         $options[] = array($section->get('handle'), $settings[self::getClass()]['section'] == $section->get('handle'), $section->get('name'));
     }
     $label = Widget::Label(__('Section'));
     $label->setAttribute('class', 'column');
     $label->appendChild(Widget::Select('fields[' . self::getClass() . '][section]', $options));
     $group->appendChild($label);
     foreach ($sections as $section) {
         $fields = $section->fetchFields();
         $options = array();
         foreach ($fields as $field) {
             $options[] = array($field->get('element_name'), in_array($field->get('element_name'), $settings[self::getClass()]['fields']), $field->get('label') . ' (' . $field->get('type') . ')');
         }
         $label = Widget::Label(__('Fields'));
         $label->setAttribute('class', 'column fields fields-for-' . $section->get('handle'));
         $label->appendChild(Widget::Select('fields[' . self::getClass() . '][fields][]', $options, array('multiple' => 'multiple')));
         $group->appendChild($label);
     }
     $fieldset->appendChild($group);
     $wrapper->appendChild($fieldset);
 }
开发者ID:symphonists,项目名称:section_schemas,代码行数:35,代码来源:datasource.section_schema.php

示例3: __addPreferences

 /**
  * Add site preferences
  */
 public function __addPreferences($context)
 {
     // Get selected languages
     $selection = Symphony::Configuration()->get('datetime');
     if (empty($selection)) {
         $selection = array();
     }
     // Build default options
     $options = array();
     foreach ($this->languages as $name => $codes) {
         $options[$name] = array($name . '::' . $codes, array_key_exists($name, $selection) ? true : false, __(ucfirst($name)));
     }
     // Add custom options
     foreach (array_diff_key($selection, $this->languages) as $name => $codes) {
         $options[$name] = array($name . '::' . $codes, true, __(ucfirst($name)));
     }
     // Sort options
     ksort($options);
     // Add fieldset
     $group = new XMLElement('fieldset', '<legend>' . __('Date and Time') . '</legend>', array('class' => 'settings'));
     $select = Widget::Select('settings[datetime][]', $options, array('multiple' => 'multiple'));
     $label = Widget::Label('Languages included in the Date and Time Data Source', $select);
     $group->appendChild($label);
     $help = new XMLElement('p', __('You can add more languages in you configuration file.'), array('class' => 'help'));
     $group->appendChild($help);
     $context['wrapper']->appendChild($group);
 }
开发者ID:brendo,项目名称:datetime,代码行数:30,代码来源:extension.driver.php

示例4: dashboardPanelOptions

 public function dashboardPanelOptions($context)
 {
     if ($context['type'] != 'piwik') {
         return;
     }
     $config = $context['existing_config'];
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings');
     $fieldset->appendChild(new XMLElement('legend', __('Piwik')));
     $label = Widget::Label(__('Module'));
     $select = Widget::Select('config[module]', $this->getModuleOptions(isset($config['module']) ? $config['module'] : null));
     $label->appendChild($select);
     $fieldset->appendChild($label);
     $input = Widget::Input('config[columns]', isset($config['columns']) ? $config['columns'] : null);
     $input->setAttribute('type', 'number');
     $input->setAttribute('size', '3');
     $label = Widget::Label(__('Show the first %s columns in table.', array($input->generate())));
     $fieldset->appendChild($label);
     $input = Widget::Input('config[entries]', isset($config['entries']) ? $config['entries'] : null);
     $input->setAttribute('type', 'number');
     $input->setAttribute('size', '3');
     $label = Widget::Label(__('Show the first %s entries in table.', array($input->generate())));
     $fieldset->appendChild($label);
     $context['form'] = $fieldset;
 }
开发者ID:henrysingleton,项目名称:piwik,代码行数:25,代码来源:extension.driver.php

示例5: displaySettingsPanel

 public function displaySettingsPanel(&$wrapper, $errors = null)
 {
     parent::displaySettingsPanel($wrapper, $errors);
     $order = $this->get('sortorder');
     // Destination --------------------------------------------------------
     $ignore = array('events', 'data-sources', 'text-formatters', 'pages', 'utilities');
     $directories = General::listDirStructure(WORKSPACE, true, 'asc', DOCROOT, $ignore);
     $label = Widget::Label('Destination Directory');
     $options = array(array('/workspace', false, '/workspace'));
     if (!empty($directories) and is_array($directories)) {
         foreach ($directories as $d) {
             $d = '/' . trim($d, '/');
             if (!in_array($d, $ignore)) {
                 $options[] = array($d, $this->get('destination') == $d, $d);
             }
         }
     }
     $label->appendChild(Widget::Select("fields[{$order}][destination]", $options));
     if (isset($errors['destination'])) {
         $label = Widget::wrapFormElementWithError($label, $errors['destination']);
     }
     $wrapper->appendChild($label);
     // Validator ----------------------------------------------------------
     $this->buildValidationSelect($wrapper, $this->get('validator'), "fields[{$order}][validator]", 'upload');
     $this->appendRequiredCheckbox($wrapper);
     $this->appendShowColumnCheckbox($wrapper);
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:27,代码来源:field.advancedupload.php

示例6: __viewIndex

 public function __viewIndex()
 {
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Symphony'), __('Utilities'))));
     $this->appendSubheading(__('Utilities'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . '/new/', array('title' => __('Create a new utility'), 'class' => 'create button')));
     $utilities = General::listStructure(UTILITIES, array('xsl'), false, 'asc', UTILITIES);
     $utilities = $utilities['filelist'];
     $uTableHead = array(array(__('Name'), 'col'));
     $uTableBody = array();
     $colspan = count($uTableHead);
     if (!is_array($utilities) or empty($utilities)) {
         $uTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), array('class' => 'inactive', 'colspan' => $colspan))), array('class' => 'odd')));
     } else {
         foreach ($utilities as $util) {
             $uRow = Widget::TableData(Widget::Anchor($util, ADMIN_URL . '/blueprints/utilities/edit/' . str_replace('.xsl', '', $util) . '/'));
             $uRow->appendChild(Widget::Input("items[{$util}]", null, 'checkbox'));
             $uTableBody[] = Widget::TableRow(array($uRow));
         }
     }
     $table = Widget::Table(Widget::TableHead($uTableHead), null, Widget::TableBody($uTableBody), array('id' => 'utilities-list'));
     $this->Form->appendChild($table);
     $tableActions = $this->createElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(null, false, __('With Selected...')), array('delete', false, __('Delete')));
     $tableActions->appendChild(Widget::Select('with-selected', $options));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($tableActions);
 }
开发者ID:brendo,项目名称:symphony-3,代码行数:27,代码来源:content.blueprintsutilities.php

示例7: view

 public function view()
 {
     $this->setPageType('table');
     $this->appendSubheading(__('Templated Text Formatters'), Widget::Anchor(__('Create New'), URL . '/symphony/extension/templatedtextformatters/edit/', __('Create a new hub'), 'create button'));
     $aTableHead = array(array(__('Title'), 'col'), array(__('Type'), 'col'), array(__('Description'), 'col'));
     $aTableBody = array();
     $formatters = $this->_driver->listAll();
     if (!is_array($formatters) || empty($formatters)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead)))));
     } else {
         $tfm = new TextformatterManager($this->_Parent);
         foreach ($formatters as $id => $data) {
             $formatter = $tfm->create($id);
             $about = $formatter->about();
             $td1 = Widget::TableData(Widget::Anchor($about['name'], URL . "/symphony/extension/templatedtextformatters/edit/{$id}/", $about['name']));
             $td2 = Widget::TableData($about['templatedtextformatters-type']);
             $td3 = Widget::TableData($about['description']);
             $td1->appendChild(Widget::Input('items[' . $id . ']', NULL, 'checkbox'));
             // Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3));
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody));
     $this->Form->appendChild($table);
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $options = array(array(NULL, false, __('With Selected...')), array('delete', false, __('Delete')));
     $div->appendChild(Widget::Select('with-selected', $options));
     $div->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($div);
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:31,代码来源:content.index.php

示例8: append_preferences

 public function append_preferences($context)
 {
     # Add new fieldset
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', 'PayPal Payments'));
     # Add Merchant Email field
     $label = Widget::Label('Merchant Email/Account ID');
     $label->appendChild(Widget::Input('settings[paypal-payments][business]', General::Sanitize($this->_get_paypal_business())));
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'The merchant email address or account ID of the payment recipient.', array('class' => 'help')));
     # Country <select>
     $countries = array('Australia', 'United Kingdom', 'United States');
     $selected_country = $this->_get_country();
     foreach ($countries as $country) {
         $selected = $country == $selected_country ? TRUE : FALSE;
         $options[] = array($country, $selected);
     }
     $label = Widget::Label();
     $select = Widget::Select('settings[paypal-payments][country]', $options);
     $label->setValue('PayPal Country' . $select->generate());
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'Country you want to target.', array('class' => 'help')));
     # Sandbox
     $label = Widget::Label();
     $input = Widget::Input('settings[paypal-payments][sandbox]', 'yes', 'checkbox');
     if ($this->_Parent->Configuration->get('sandbox', 'paypal-payments') == 'yes') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue($input->generate() . ' Enable testing mode');
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', 'Directs payments to PayPal’s Sandbox: <code>http://www.sandbox.paypal.com/</code>', array('class' => 'help')));
     $context['wrapper']->appendChild($group);
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:34,代码来源:extension.driver.php

示例9: buildSelectField

 function buildSelectField($field, $start, $current, $parent = NULL, $element_name, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL, $exclude = NULL, $settingsPannel = NULL)
 {
     if (!($tree = $this->getTree($field, $start, $exclude))) {
         return Widget::Select(NULL, NULL, array('disabled' => 'true'));
     }
     $right = array($tree[0]['rgt']);
     if (!$settingsPannel) {
         $options = array(array(NULL, NULL, 'None'));
     } elseif ($settingsPannel && count($tree) == 1) {
         return new XMLElement('p', __('It looks like youre trying to create a field. Perhaps you want categories first? <br/><a href="%s">Click here to create some.</a>', array(URL . '/symphony/extension/nested_cats/overview/new/')));
     } else {
         $options = array(array($tree[0]['id'], NULL, 'Full Tree'));
     }
     array_shift($tree);
     $selected = isset($parent) ? $parent : $current;
     foreach ($tree as $o) {
         while ($right[count($right) - 1] < $o['rgt']) {
             array_pop($right);
         }
         $options[] = array($o['id'], $o['id'] == $selected, str_repeat('- ', count($right) - 1) . $o['title']);
         $right[] = $o['rgt'];
     }
     $select = Widget::Select('fields' . $fieldnamePrefix . '[' . $element_name . ']' . $fieldnamePostfix, $options, count($tree) > 0 ? NULL : array('disabled' => 'true'));
     return $select;
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:25,代码来源:extension.driver.php

示例10: __viewIndex

 public function __viewIndex()
 {
     $this->_driver = $this->_Parent->ExtensionManager->create('section_schemas');
     $this->setPageType('form');
     $this->setTitle('Symphony &ndash; Section Schema data sources');
     $this->appendSubheading('Section Schema data sources');
     $container = new XMLElement('fieldset');
     $container->setAttribute('class', 'settings');
     $container->appendChild(new XMLElement('legend', 'Sections'));
     $group = new XMLElement('div');
     $group->setAttribute('class', 'group');
     $sm = new SectionManager($this->_Parent);
     $sections = $sm->fetch();
     $options = array();
     $dsm = new DatasourceManager($this->_Parent);
     $datasources = $dsm->listAll();
     foreach ($sections as $section) {
         $selected = in_array('section_schema_' . str_replace('-', '_', $section->_data['handle']), array_keys($datasources));
         $options[] = array($section->_data['handle'], $selected, $section->_data['name']);
     }
     $section = Widget::Label('Create data sources for these sections:');
     $section->appendChild(Widget::Select('sections[]', $options, array('multiple' => 'multiple')));
     $group->appendChild($section);
     $container->appendChild($group);
     $this->Form->appendChild($container);
     //---------------------------------------------------------------------
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $attr = array('accesskey' => 's');
     $div->appendChild(Widget::Input('action[save]', 'Save Changes', 'submit', $attr));
     $this->Form->appendChild($div);
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:32,代码来源:content.list.php

示例11: 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

示例12: __viewIndex

 public function __viewIndex()
 {
     $this->setPageType('table');
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Symphony'), __('Sections'))));
     $this->appendSubheading(__('Sections'), Widget::Anchor(__('Create New'), $this->_Parent->getCurrentPageURL() . 'new/', __('Create a section'), 'create button'));
     $sectionManager = new SectionManager($this->_Parent);
     $sections = $sectionManager->fetch(NULL, 'ASC', 'sortorder');
     $aTableHead = array(array(__('Name'), 'col'), array(__('Entries'), 'col'), array(__('Navigation Group'), 'col'));
     $aTableBody = array();
     if (!is_array($sections) || empty($sections)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead))), 'odd'));
     } else {
         $bOdd = true;
         foreach ($sections as $s) {
             $entry_count = intval(Symphony::Database()->fetchVar('count', 0, "SELECT count(*) AS `count` FROM `tbl_entries` WHERE `section_id` = '" . $s->get('id') . "' "));
             ## Setup each cell
             $td1 = Widget::TableData(Widget::Anchor($s->get('name'), $this->_Parent->getCurrentPageURL() . 'edit/' . $s->get('id') . '/', NULL, 'content'));
             $td2 = Widget::TableData(Widget::Anchor("{$entry_count}", URL . '/symphony/publish/' . $s->get('handle') . '/'));
             $td3 = Widget::TableData($s->get('navigation_group'));
             $td3->appendChild(Widget::Input('items[' . $s->get('id') . ']', 'on', 'checkbox'));
             ## Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3), $bOdd ? 'odd' : NULL);
             $bOdd = !$bOdd;
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'orderable');
     $this->Form->appendChild($table);
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(NULL, false, __('With Selected...')), array('delete', false, __('Delete'), 'confirm'), array('delete-entries', false, __('Delete Entries'), 'confirm'));
     $tableActions->appendChild(Widget::Select('with-selected', $options));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($tableActions);
 }
开发者ID:klaftertief,项目名称:sym-forum,代码行数:34,代码来源:content.blueprintssections.php

示例13: documentation

    public static function documentation()
    {
        // Fetch all the Email Templates available and add to the end of the documentation
        $templates = extension_Members::fetchEmailTemplates();
        $div = new XMLElement('div');
        if (!empty($templates)) {
            $label = new XMLElement('label', __('Regenerate Activation Code Email Template'));
            $regenerate_activation_code_templates = extension_Members::setActiveTemplate($templates, 'regenerate-activation-code-template');
            $label->appendChild(Widget::Select('members[regenerate-activation-code-template][]', $regenerate_activation_code_templates, array('multiple' => 'multiple')));
            $div->appendChild($label);
            $div->appendChild(Widget::Input('members[event]', 'reset-password', 'hidden'));
            $div->appendChild(Widget::Input(null, __('Save Changes'), 'submit', array('accesskey' => 's')));
        }
        return '
				<p>This event will regenerate an activation code for a user and is useful if their current
				activation code has expired. The activation code can be sent to a Member\'s email after
				this event has executed.</p>
				<h3>Example Front-end Form Markup</h3>
				<p>This is an example of the form markup you can use on your front end. An input field
				accepts either the member\'s email address or username.</p>
				<pre class="XML"><code>
				&lt;form method="post"&gt;
					&lt;label&gt;Username: &lt;input name="fields[username]" type="text" value="{$username}"/&gt;&lt;/label&gt;
					or
					&lt;label&gt;Email: &lt;input name="fields[email]" type="text" value="{$email}"/&gt;&lt;/label&gt;
					&lt;input type="submit" name="action[' . self::ROOTELEMENT . ']" value="Regenerate Activation Code"/&gt;
					&lt;input type="hidden" name="redirect" value="{$root}/"/&gt;
				&lt;/form&gt;
				</code></pre>
				<h3>More Information</h3>
				<p>For further information about this event, including response and error XML, please refer to the
				<a href="https://github.com/symphonycms/members/wiki/Members%3A-Regenerate-Activation-Code">wiki</a>.</p>
				' . $div->generate() . '
			';
    }
开发者ID:brendo,项目名称:members,代码行数:35,代码来源:event.members_regenerate_activation_code.php

示例14: generateView

 /**
  * Generates the view on the publish page
  *
  * @param XMLElement               $wrapper
  *	 The XMLElement wrapper in which the view is placed
  * @param string                   $fieldname
  *	 The name of the field
  * @param array                    $options
  *	 The options
  * @param fieldSelectBox_Link_image $field
  *	 The field instance
  *
  * @return void
  */
 public function generateView(XMLElement &$wrapper, $fieldname, $options, fieldSelectBox_Link_image $field)
 {
     $attributes['class'] = 'target';
     if ($field->get('allow_multiple_selection')) {
         $attributes['multiple'] = 'multiple';
     }
     $wrapper->appendChild(Widget::Select($fieldname, $options, $attributes));
 }
开发者ID:korelogic,项目名称:selectbox_link_field_image,代码行数:22,代码来源:view.php

示例15: view

 public function view()
 {
     //Page options
     $this->setPageType('table');
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Symphony'), __('Campaign Monitor Subscribers'))));
     $this->appendSubheading(__('Campaign Monitor Subscribers'));
     //Form action
     $this->Form->setAttribute('action', $this->_Parent->getCurrentPageURL());
     //Get Campaign Monitor preferences
     $api_key = $this->_Parent->Configuration->get('api_key', 'campaign_monitor');
     $list_id = $this->_Parent->Configuration->get('list_id', 'campaign_monitor');
     //New Campaign Monitor instance
     $cm = new CampaignMonitor($api_key);
     //Get subscriber list
     $result = $cm->subscribersGetActive(0, $list_id);
     $subscribers = $result['anyType']['Subscriber'];
     //Subscriber table headers
     $aTableHead = array(array(__('Name'), 'col'), array(__('Email Address'), 'col'), array(__('Date Subscribed'), 'col'), array(__('Status'), 'col'));
     $aTableBody = array();
     if (!is_array($subscribers) || empty($subscribers)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('You currently have no subscribers.'), 'inactive', NULL, count($aTableHead))), 'odd'));
     } else {
         if (is_array($subscribers[0])) {
             //Check if the subscriber list is longer than one, in which case it's an array of arrays
             foreach ($subscribers as $subscriber) {
                 $td1 = Widget::TableData($subscriber["Name"]);
                 $td2 = Widget::TableData($subscriber["EmailAddress"]);
                 $td2->appendChild(Widget::Input('items[' . $subscriber["EmailAddress"] . ']', 'on', 'checkbox'));
                 $td3 = Widget::TableData(date("d F Y H:i", strtotime($subscriber["Date"])));
                 $td4 = Widget::TableData($subscriber["State"]);
                 //Add table data to row and body
                 $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3, $td4));
             }
         } else {
             //Single subscriber
             $td1 = Widget::TableData($subscribers["Name"]);
             $td2 = Widget::TableData($subscribers["EmailAddress"]);
             $td2->appendChild(Widget::Input('items[' . $subscribers["EmailAddress"] . ']', 'on', 'checkbox'));
             $td3 = Widget::TableData(date("d F Y H:i", strtotime($subscribers["Date"])));
             $td4 = Widget::TableData($subscribers["State"]);
             //Add table data to row and body
             $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3, $td4));
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'orderable');
     //Append the subscriber table to the page
     $this->Form->appendChild($table);
     //Actions for this page
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(NULL, false, __('With Selected...')), array('unsubscribe', false, __('Unsubscribe')));
     $tableActions->appendChild(Widget::Select('with-selected', $options));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     //Append actions to the page
     $this->Form->appendChild($tableActions);
 }
开发者ID:neilalbrock,项目名称:campaign_monitor,代码行数:56,代码来源:content.cmadmin.php


注:本文中的Widget::Select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。