| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807 | <?php/** * @file * Views interface for simplenews. *//** * Implements hook_views_data(). */function simplenews_views_data() {  /* ------------ Definitions for Simplenews mailspool ---------------------- */  $data['simplenews_mail_spool']['table'] = array(    'base' => array(      'field' => 'msid',      'title' => t('Simplenews mailspool'),      'help' => t('Spool for temporary storage of newsletter emails.'),      'weight' => 10,      'database' => 'default',    ),    'group' => t('Simplenews spool'),  );  $data['simplenews_mail_spool']['msid'] = array(    'title' => t('Ms ID'),    'help' => t('The primary identifier for a mail spool record.'),    'field' => array(      'handler' => 'views_handler_field_numeric',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_numeric',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_numeric',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  $data['simplenews_mail_spool']['mail'] = array(    'title' => t('Subscriber'),    'help' => t('The formatted email address of mail message receipient.'),    'field' => array(      'handler' => 'views_handler_field',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_string',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_string',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  $data['simplenews_mail_spool']['nid'] = array(    'title' => t('Node ID'),    'help' => t('The {node}.nid of this newsletter.'),    'field' => array(      'handler' => 'views_handler_field_numeric',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_numeric',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_numeric',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),    'relationship' => array(      'handler' => 'views_handler_relationship',      'base' => 'node',      'base field' => 'nid',      'label' => t('Node'),    ),  );  $data['simplenews_mail_spool']['tid'] = array(    'title' => t('Term ID'),    'help' => t('The {term_data}.tid this newsletter issue belongs to.'),    'field' => array(      'handler' => 'views_handler_field_numeric',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_numeric',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_numeric',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),    'relationship' => array(      'handler' => 'views_handler_relationship',      'base' => 'taxonomy_term_data',      'base field' => 'tid',      'label' => t('Issue'),    ),  );  $data['simplenews_mail_spool']['snid'] = array(    'title' => t('Subscriber ID'),    'help' => t('The {simplenews_subscriber}.snid foreign key for this spool'),    'field' => array(      'handler' => 'views_handler_field_numeric',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_numeric',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_numeric',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),    'relationship' => array(      'handler' => 'views_handler_relationship',      'base' => 'simplenews_subscriber',      'base field' => 'snid',      'label' => t('Subscriber'),    ),  );  $data['simplenews_mail_spool']['status'] = array(    'title' => t('Sent status'),    'help' => t('The sent status of the email (0 = hold, 1 = pending, 2 = done).'),    'field' => array(      'handler' => 'simplenews_handler_field_newsletter_status',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'simplenews_handler_filter_newsletter_status',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_numeric',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  $data['simplenews_mail_spool']['error'] = array(    'title' => t('Error'),    'help' => t('A boolean indicating whether an error occured while sending the email.'),    'field' => array(      'handler' => 'views_handler_field_boolean',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_boolean_operator',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_numeric',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  $data['simplenews_mail_spool']['timestamp'] = array(    'title' => t('Timestamp'),    'help' => t('The time status was set or changed.'),    'field' => array(      'handler' => 'views_handler_field_date',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_date',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_date',    ),    'sort' => array(      'handler' => 'views_handler_sort_date',    ),  );  $data['simplenews_mail_spool']['data'] = array(    'title' => t('Data'),    'help' => t('A serialized array of name value pairs that are related to the email address.'),    'field' => array(      'handler' => 'views_handler_field',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_string',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_string',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  /* ------------ Definitions for Simplenews issue ---------------------- */  $data['simplenews_newsletter']['table'] = array(    // Define the base group of this table. Fields that don't    // have a group defined will go into this field by default.    'group' => t('Simplenews issue'),  );  // Joins  $data['simplenews_newsletter']['table']['join'] = array(    'node' => array(      'left_field' => 'nid',      'field' => 'nid',    ),    'taxonomy_term_data' => array(      'left_field' => 'tid',      'field' => 'tid',    ),  );  $data['simplenews_newsletter']['tid'] = array(    'title' => t('Term ID'),    'help' => t('The {term_data}.tid (= newsletter series) this issue belongs to.'),    'field' => array(      'handler' => 'views_handler_field_numeric',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_numeric',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_numeric',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),    'relationship' => array(      'handler' => 'views_handler_relationship',      'base' => 'taxonomy_term_data',      'base field' => 'tid',      'label' => t('Newsletter'),    ),  );  $data['simplenews_newsletter']['status'] = array(    'title' => t('Sent status'), // The item it appears as on the UI,    'help' => t('Newsletter sent status: 0: Not sent, 1: Pending (being sent or waiting for cron to run), 2: Sent.'), // The help that appears on the UI,    'field' => array(      'handler' => 'simplenews_handler_field_newsletter_status',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'simplenews_handler_filter_newsletter_status',    ),    'argument' => array(      'handler' => 'views_handler_argument_numeric',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  $data['simplenews_newsletter']['sent_subscriber_count'] = array(    'title' => t('Subscriber count'),    'help' => t('The count of subscribers of the newsletter at the time it was sent.'),    'field' => array(      'handler' => 'views_handler_field_numeric',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_numeric',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_numeric',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  $data['simplenews_newsletter']['send'] = array(    'field' => array(      'title' => t('Send newsletter'),      'help' => t('Provides a link to send the simplenews newsletter if not sent yet.'),      'handler' => 'simplenews_handler_field_newsletter_send',    ),  );  /* ------------ Definitions for Simplenews subscriber ---------------------- */  $data['simplenews_subscriber']['table'] = array(    'base' => array(      'field' => 'snid',      'title' => t('Simplenews subscriber'),      'help' => t('Contains subscribers of Simplenews Newsletters.'),      'weight' => 10,      'database' => 'default',    ),    'group' => t('Simplenews subscriber'),  );  // Joins  $data['simplenews_subscriber']['table']['join'] = array(    'users' => array(      'left_field' => 'uid',      'field' => 'uid',    ),  );  $data['simplenews_subscriber']['snid'] = array(    'title' => t('Subscriber ID'),    'help' => t('Primary key: Unique subsciber ID.'),    'field' => array(      'handler' => 'views_handler_field_numeric',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_numeric',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_numeric',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  $data['simplenews_subscriber']['activated'] = array(    'title' => t('Activated'),    'help' => t('Boolean indicating the status of the subscription.'),    'field' => array(      'handler' => 'views_handler_field_boolean',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_boolean_operator',      'label' => t('Activated'),      'type' => 'yes-no',      'accept null' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_numeric',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  $data['simplenews_subscriber']['mail'] = array(    'title' => t('Subscriber'),    'help' => t('The subscription email address.'),    'field' => array(      'handler' => 'views_handler_field',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_string',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_string',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  $data['simplenews_subscriber']['uid'] = array(    'title' => t('User'),    'help' => t('The {users}.uid that has the same email address.'),    'field' => array(      'handler' => 'views_handler_field_numeric',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_numeric',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_numeric',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),    'relationship' => array(      'handler' => 'views_handler_relationship',      'base' => 'users',      'base field' => 'uid',      'label' => t('user'),    ),  );  $data['simplenews_subscriber']['language'] = array(    'title' => t('Language'),    'help' => t('Anonymous subscriber preferred language. Empty for authenticated users.'),    'field' => array(      'handler' => 'views_handler_field',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_string',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_string',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  $data['simplenews_subscriber']['timestamp'] = array(    'title' => t('Timestamp'),    'help' => t('UNIX timestamp of when the user first subscribed to a newsletter.'),    'field' => array(      'handler' => 'views_handler_field_date',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_date',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_date',    ),    'sort' => array(      'handler' => 'views_handler_sort_date',    ),  );  /* ------------ Definitions for Simplenews subscription ---------------------- */  $data['simplenews_subscription']['table'] = array(    'base' => array(      'field' => 'snid',      'title' => t('Simplenews subscription'),      'help' => t('Contains all Subscriptions of every Simplenews Newsletters.'),      'weight' => 10,      'database' => 'default',    ),    'group' => t('Simplenews subscription'),  );  $data['simplenews_subscription']['table']['join'] = array(    'taxonomy_term_data' => array(      'left_field' => 'tid',      'field' => 'tid',    ),    'simplenews_subscriber' => array(      'left_field' => 'snid',      'field' => 'snid',    ),  );  $data['simplenews_subscription']['snid'] = array(    'title' => t('Subscriber ID'),    'help' => t('The {simplenews_subscriptions}.snid who is subscribed.'),    'field' => array(      'label' => 'TEST',      'handler' => 'views_handler_field_numeric',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_numeric',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_numeric',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),    'relationship' => array(      'handler' => 'views_handler_relationship',      'base' => 'simplenews_subscriber',      'base field' => 'snid',      'label' => t('Subscriber'),    ),  );  $data['simplenews_subscription']['tid'] = array(    'title' => t('Term ID'),    'help' => t('The newsletter series ({term_data}.tid) the subscriber is subscribed to.'),    'field' => array(      'handler' => 'views_handler_field_numeric',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_numeric',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_numeric',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),    'relationship' => array(      'handler' => 'views_handler_relationship',      'base' => 'taxonomy_term_data',      'base field' => 'tid',      'label' => t('Term (Newsletter series)'),    ),  );  $data['simplenews_subscription']['status'] = array(    'title' => t('Status'),    'help' => t('A flag indicating whether the user is subscribed (1) or unsubscribed (0).'),    'field' => array(      'handler' => 'views_handler_field_boolean',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_boolean_operator',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_numeric',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  $data['simplenews_subscription']['timestamp'] = array(    'title' => t('Timestamp'),    'help' => t('UNIX timestamp of when the user is (un)subscribed.'),    'field' => array(      'handler' => 'views_handler_field_date',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_date',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_date',    ),    'sort' => array(      'handler' => 'views_handler_sort_date',    ),  );  $data['simplenews_subscription']['source'] = array(    'title' => t('Source'),    'help' => t('The source via which the user is (un)subscribed.'),    'field' => array(      'handler' => 'views_handler_field',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_string',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_string',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  /* ------------ Definitions for Simplenews category ---------------------- */  // Define the base group of this table. Fields that don't  // have a group defined will go into this field by default.  $data['simplenews_category']['table'] = array(    'group' => t('Simplenews category'),  );  // Joins  $data['simplenews_category']['table']['join'] = array(    // Category links directly to taxonomy via tid.    'taxonomy_term_data' => array(      'left_field' => 'tid',      'field' => 'tid',    ),  );  // Fields  $data['simplenews_category']['tid'] = array(    'title' => t('Term ID'),    'help' => t('The newsletter series ({term_data}.tid) the subscriber is subscribed to.'),    'field' => array(      'handler' => 'views_handler_field_numeric',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_numeric',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_numeric',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),    'relationship' => array(      'handler' => 'views_handler_relationship',      'base' => 'taxonomy_term_data',      'base field' => 'tid',      'label' => t('Term (Newsletter series)'),    ),  );  $data['simplenews_category']['format'] = array(    'title' => t('Format'),    'help' => t('Format of the newsletter (plain or html).'),    'field' => array(      'handler' => 'views_handler_field',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_string',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_string',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  $data['simplenews_category']['priority'] = array(    'title' => t('Priority'),    'help' => t('Email priority according to RFC 2156 and RFC 5231 (0 = none; 1 = highest; 2 = high; 3 = normal; 4 = low; 5 = lowest).'),    'field' => array(      'handler' => 'simplenews_handler_field_newsletter_priority',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'simplenews_handler_filter_newsletter_priority',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_numeric',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  $data['simplenews_newsletter']['receipt'] = array(    'title' => t('Receipt'),    'help' => t('Boolean indicating request for email receipt confirmation according to RFC 2822.'),    'field' => array(      'handler' => 'views_handler_field_boolean',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_boolean_operator',      'allow empty' => TRUE,    ),    'argument' => array(      'handler' => 'views_handler_argument_numeric',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  $data['simplenews_category']['from_name'] = array(    'title' => t('From name'),    'help' => t('Sender name for newsletter emails.'),    'field' => array(      'handler' => 'views_handler_field',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_string',    ),    'argument' => array(      'handler' => 'views_handler_argument_string',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  $data['simplenews_category']['email_subject'] = array(    'title' => t('Email Subject'),    'help' => t('Subject of newsletter email. May contain tokens.'),    'field' => array(      'handler' => 'views_handler_field',      'click sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_string',    ),    'argument' => array(      'handler' => 'views_handler_argument_string',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  $data['simplenews_category']['from_address'] = array(    'title' => t('From address'),    'help' => t('Sender address for newsletter emails'),    'field' => array(      'handler' => 'views_handler_field',      'click_sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_string'    ),    'argument' => array(      'handler' => 'views_handler_argument_srting',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  $data['simplenews_category']['hyperlinks'] = array(    'title' => t('Hyperlinks displaymode'),    'help' => t('Flag indicating type of hyperlink conversion (1 = hyperlinks are in-line; 0 = hyperlinks are placed at email bottom).'),    'field' => array(      'handler' => 'simplenews_handler_field_category_hyperlinks',      'click_sortable' => TRUE,    ),    'filter' => array(      'handler' => 'simplenews_handler_filter_category_hyperlinks'    ),    'argument' => array(      'handler' => 'views_handler_argument_numeric'    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  $data['simplenews_category']['new_account'] = array(    'title' => t('New account'),    'help' => t('How to treat subscription at account creation (none = None; on = Default on; off = Default off; silent = Invisible subscription).'),    'field' => array(      'handler' => 'simplenews_handler_field_category_new_account',      'click_sortable' => TRUE,    ),    'filter' => array(      'handler' => 'simplenews_handler_filter_category_new_account'    ),    'argument' => array(      'handler' => 'views_handler_argument_string',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  $data['simplenews_category']['opt_inout'] = array(    'title' => t('Confirmation displaymode'),    'help' => t('How to treat subscription confirmation (hidden = Newsletter is hidden from the user; single = Single opt-in; double = Double opt-in).'),    'field' => array(      'handler' => 'simplenews_handler_field_category_opt_inout',      'click_sortable' => TRUE,    ),    'filter' => array(      'handler' => 'simplenews_handler_filter_category_opt_inout'    ),    'argument' => array(      'handler' => 'views_handler_argument_string',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  $data['simplenews_category']['block'] = array(    'title' => t('Block'),    'help' => t('Indicates wether a subscription block is available for this category'),    'field' => array(      'handler' => 'views_handler_field_numeric',      'click_sortable' => TRUE,    ),    'filter' => array(      'handler' => 'views_handler_filter_numeric',    ),    'argument' => array(      'handler' => 'views_handler_argument_numeric',    ),    'sort' => array(      'handler' => 'views_handler_sort',    ),  );  return $data;}
 |