| 1 |
<?php // $Id: news.module,v 1.15 2009/05/15 14:35:15 vauxia Exp $ |
<?php // $Id: news.module,v 1.16 2009/05/20 21:06:53 vauxia Exp $ |
| 2 |
|
|
| 3 |
/** |
/** |
| 4 |
* @file |
* @file |
| 22 |
} |
} |
| 23 |
|
|
| 24 |
/** |
/** |
| 25 |
|
* Implementation of hook_elements(). |
| 26 |
|
*/ |
| 27 |
|
function news_elements() { |
| 28 |
|
// Add send element to select from available mailing list(s) |
| 29 |
|
return array( 'news_mlm' => send_element_defaults() ); |
| 30 |
|
} |
| 31 |
|
|
| 32 |
|
/** |
| 33 |
* Implementation of Send module's hook_send_profile_info(). |
* Implementation of Send module's hook_send_profile_info(). |
| 34 |
*/ |
*/ |
| 35 |
function news_send_profile_info() { |
function news_send_profile_info() { |
| 36 |
return array( |
return array( |
| 37 |
'news' => array( |
'news' => array( |
| 38 |
'title' => t('News'), |
'title' => t('News'), |
| 39 |
'mode' => 'mlm', |
'mode' => 'news', |
| 40 |
|
), |
| 41 |
|
); |
| 42 |
|
} |
| 43 |
|
|
| 44 |
|
/** |
| 45 |
|
* Implementation of Send module's hook_send_mode_info(). |
| 46 |
|
* Provide a "mailing list" delivery mode. |
| 47 |
|
*/ |
| 48 |
|
function news_send_mode_info() { |
| 49 |
|
return array( |
| 50 |
|
'news' => array( |
| 51 |
|
'callback' => 'news_send_deliver', |
| 52 |
|
'database columns' => array( |
| 53 |
|
'lid' => array('type' => 'int', 'unsigned' => TRUE), |
| 54 |
|
), |
| 55 |
|
'unique keys' => array('lid' => array('lid')), |
| 56 |
|
'user only' => FALSE, |
| 57 |
), |
), |
| 58 |
); |
); |
| 59 |
} |
} |
| 60 |
|
|
| 61 |
/** |
/** |
| 62 |
|
* Delivery callback for MLM module's send handler. |
| 63 |
|
*/ |
| 64 |
|
function news_send_deliver($profile, $contact, $nids, &$message, $mode) { |
| 65 |
|
if ($mlm = mlm_load($contact->lid)) { |
| 66 |
|
$mlm->post($message); |
| 67 |
|
} |
| 68 |
|
} |
| 69 |
|
|
| 70 |
|
/** |
| 71 |
* Implementation of hook_views_api(). |
* Implementation of hook_views_api(). |
| 72 |
*/ |
*/ |
| 73 |
function news_views_api() { |
function news_views_api() { |