aggregator_categorize_items

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

modules/aggregator/aggregator.pages.inc, строка 142

Версии
6
aggregator_categorize_items($items, $feed_source = '')

Form builder; build the page list form.

ingroup forms

See also

aggregator_categorize_items_validate()

@see aggregator_categorize_items_submit()

Параметры

$items An array of the feed items.

$feed_source The feed source URL.

Возвращаемое значение

The form structure.

Код

<?php
function aggregator_categorize_items($items, $feed_source = '') {
  $form['#submit'][] = 'aggregator_categorize_items_submit';
  $form['#validate'][] = 'aggregator_categorize_items_validate';
  $form['#theme'] = 'aggregator_categorize_items';
  $form['feed_source'] = array('#value' => $feed_source);
  $categories = array();
  $done = FALSE;
  $form['items'] = array();
  $form['categories'] = array('#tree' => TRUE);
  foreach ($items as $item) {
    $form['items'][$item->iid] = array('#value' => theme('aggregator_item', $item));
    $form['categories'][$item->iid] = array();
    $categories_result = db_query('SELECT c.cid, c.title, ci.iid FROM {aggregator_category} c LEFT JOIN {aggregator_category_item} ci ON c.cid = ci.cid AND ci.iid = %d', $item->iid);
    $selected = array();
    while ($category = db_fetch_object($categories_result)) {
      if (!$done) {
        $categories[$category->cid] = check_plain($category->title);
      }
      if ($category->iid) {
        $selected[] = $category->cid;
      }
    }
    $done = TRUE;
    $form['categories'][$item->iid] = array(
      '#type' => variable_get('aggregator_category_selector', 'checkboxes'),
      '#default_value' => $selected,
      '#options' => $categories,
      '#size' => 10,
      '#multiple' => TRUE
    );
  }
  $form['submit'] = array('#type' => 'submit', '#value' => t('Save categories'));

  return $form;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему