|
|
@ -18,10 +18,10 @@ function fulcrm_campaign_admin_campaign() {
|
|
|
|
$result = $query->orderByHeader( $header )->execute();
|
|
|
|
$result = $query->orderByHeader( $header )->execute();
|
|
|
|
$rows = array();
|
|
|
|
$rows = array();
|
|
|
|
foreach ( $result as $row ) {
|
|
|
|
foreach ( $result as $row ) {
|
|
|
|
$rows[] = array( array( 'data' => '<a href="' . url('admin/config/services/fulcrm/campaign/' . $row->fcid) . '">' . $row->fcid . '</a>' ),
|
|
|
|
$rows[] = array( array( 'data' => '<a href="' . url('admin/content/fulcrm/campaign/' . $row->fcid) . '">' . $row->fcid . '</a>' ),
|
|
|
|
array( 'data' => $row->name ),
|
|
|
|
array( 'data' => $row->name ),
|
|
|
|
array( 'data' => $row->subject ),
|
|
|
|
array( 'data' => $row->subject ),
|
|
|
|
array( 'data' => '<a href="' . url('admin/config/services/fulcrm/campaign/' . $row->fcid . '/edit') . '">arrange</a>' ),
|
|
|
|
array( 'data' => '<a href="' . url('admin/content/fulcrm/campaign/' . $row->fcid . '/edit') . '">arrange</a>' ),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -55,7 +55,7 @@ function fulcrm_campaign_admin_campaign_settings_form( $form, &$form_state, $fci
|
|
|
|
'#default_value' => ( ( array_key_exists( 'values', $form_state ) && $form_state[ 'values' ][ 'name' ] ) ? $form_state[ 'values' ][ 'name' ] : $campaign->name ),
|
|
|
|
'#default_value' => ( ( array_key_exists( 'values', $form_state ) && $form_state[ 'values' ][ 'name' ] ) ? $form_state[ 'values' ][ 'name' ] : $campaign->name ),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
$form[ 'subject' ] = array( '#type' => 'textfield',
|
|
|
|
$form[ 'subject' ] = array( '#type' => 'textfield',
|
|
|
|
'#title' => 'Subject (on email)',
|
|
|
|
'#title' => 'Subject (of email)',
|
|
|
|
'#default_value' => ( ( array_key_exists( 'values', $form_state ) && $form_state[ 'values' ][ 'subject' ] ) ? $form_state[ 'values' ][ 'subject' ] : $campaign->subject ),
|
|
|
|
'#default_value' => ( ( array_key_exists( 'values', $form_state ) && $form_state[ 'values' ][ 'subject' ] ) ? $form_state[ 'values' ][ 'subject' ] : $campaign->subject ),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
@ -80,7 +80,7 @@ function fulcrm_campaign_admin_campaign_new_form_submit( $form, &$form_state ) {
|
|
|
|
if ( $tid )
|
|
|
|
if ( $tid )
|
|
|
|
fulcrm_campaign_create_campaign_variables_from_template( $fcid, $tid );
|
|
|
|
fulcrm_campaign_create_campaign_variables_from_template( $fcid, $tid );
|
|
|
|
drupal_set_message( t( 'Mailshot created!' ) );
|
|
|
|
drupal_set_message( t( 'Mailshot created!' ) );
|
|
|
|
drupal_goto( 'admin/config/services/fulcrm/campaign/' . $fcid . '/edit' );
|
|
|
|
drupal_goto( 'admin/content/fulcrm/campaign/' . $fcid . '/edit' );
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
drupal_set_message( t( 'There was an error creating the campaign.' ), $type = 'error' );
|
|
|
|
drupal_set_message( t( 'There was an error creating the campaign.' ), $type = 'error' );
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -103,7 +103,7 @@ function fulcrm_campaign_admin_campaign_new_form( $form, &$form_state ) {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
$form[ 'subject' ] = array( '#type' => 'textfield',
|
|
|
|
$form[ 'subject' ] = array( '#type' => 'textfield',
|
|
|
|
'#default_value' => '',
|
|
|
|
'#default_value' => '',
|
|
|
|
'#title' => 'Subject (on email)',
|
|
|
|
'#title' => 'Subject (of email)',
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
$form[ 'actions' ] = array( '#type' => 'actions' );
|
|
|
|
$form[ 'actions' ] = array( '#type' => 'actions' );
|
|
|
@ -181,7 +181,7 @@ function fulcrm_campaign_admin_campaign_node_form( $form, &$form_state, $node )
|
|
|
|
$query->condition( 'fulcrm_campaign_node.nid', $node->nid );
|
|
|
|
$query->condition( 'fulcrm_campaign_node.nid', $node->nid );
|
|
|
|
foreach ( $query->execute() as $row ) {
|
|
|
|
foreach ( $query->execute() as $row ) {
|
|
|
|
$in_campaigns[ $row->fcid ] = array( 'name' => ( check_plain( $row->name ) . ' (<a href="' .
|
|
|
|
$in_campaigns[ $row->fcid ] = array( 'name' => ( check_plain( $row->name ) . ' (<a href="' .
|
|
|
|
url('admin/config/services/fulcrm/campaign/template/' . $row->fcid . '/edit') .
|
|
|
|
url('admin/content/fulcrm/campaign/' . $row->fcid . '/edit') .
|
|
|
|
'">configure</a>)' ),
|
|
|
|
'">configure</a>)' ),
|
|
|
|
'subject' => check_plain( $row->subject ) );
|
|
|
|
'subject' => check_plain( $row->subject ) );
|
|
|
|
if ( array_key_exists( $row->fcid, $campaigns ) )
|
|
|
|
if ( array_key_exists( $row->fcid, $campaigns ) )
|
|
|
@ -191,7 +191,7 @@ function fulcrm_campaign_admin_campaign_node_form( $form, &$form_state, $node )
|
|
|
|
$form[ 'nid' ] = array( '#type' => 'hidden',
|
|
|
|
$form[ 'nid' ] = array( '#type' => 'hidden',
|
|
|
|
'#value' => $node->nid );
|
|
|
|
'#value' => $node->nid );
|
|
|
|
|
|
|
|
|
|
|
|
$header = array( 'name' => array( 'data' => t('Name') ), 'subject' => array( 'data' => t('Subject') ) );
|
|
|
|
$header = array( 'name' => array( 'data' => t('Name (for internal use)') ), 'subject' => array( 'data' => t('Subject (of email)') ) );
|
|
|
|
|
|
|
|
|
|
|
|
if ( $campaigns ) {
|
|
|
|
if ( $campaigns ) {
|
|
|
|
$form[ 'add_to_campaigns' ] = array( '#type' => 'fieldset',
|
|
|
|
$form[ 'add_to_campaigns' ] = array( '#type' => 'fieldset',
|
|
|
@ -288,7 +288,7 @@ function theme_fulcrm_campaign_admin_campaign_edit_form( $variables ) {
|
|
|
|
$form = $variables['form'];
|
|
|
|
$form = $variables['form'];
|
|
|
|
$rows = array();
|
|
|
|
$rows = array();
|
|
|
|
foreach ( element_children( $form[ 'content' ] ) as $id ) {
|
|
|
|
foreach ( element_children( $form[ 'content' ] ) as $id ) {
|
|
|
|
$form[ 'content' ][ $id ][ 'weight' ][ '#attributes' ][ 'class' ] = array( 'fms-content-item-weight' );
|
|
|
|
$form[ 'content' ][ $id ][ 'weight' ][ '#attributes' ][ 'class' ] = array( 'fulcrm-campaign-content-item-weight' );
|
|
|
|
$rows[] = array( 'data' => array( drupal_render( $form[ 'content' ][ $id ][ 'title' ] ),
|
|
|
|
$rows[] = array( 'data' => array( drupal_render( $form[ 'content' ][ $id ][ 'title' ] ),
|
|
|
|
drupal_render( $form[ 'content' ][ $id ][ 'weight' ] ),
|
|
|
|
drupal_render( $form[ 'content' ][ $id ][ 'weight' ] ),
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -296,9 +296,9 @@ function theme_fulcrm_campaign_admin_campaign_edit_form( $variables ) {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$header = array( t('Title'), t('Weight') );
|
|
|
|
$header = array( t('Title'), t('Weight') );
|
|
|
|
$output = theme( 'table', array( 'header' => $header, 'rows' => $rows, 'attributes' => array( 'id' => 'fms-content-items-table' ) ) );
|
|
|
|
$output = theme( 'table', array( 'header' => $header, 'rows' => $rows, 'attributes' => array( 'id' => 'fulcrm-campaign-content-items-table' ) ) );
|
|
|
|
$output .= drupal_render_children( $form );
|
|
|
|
$output .= drupal_render_children( $form );
|
|
|
|
drupal_add_tabledrag( 'fms-content-items-table', 'order', 'sibling', 'fms-content-item-weight' );
|
|
|
|
drupal_add_tabledrag( 'fulcrm-campaign-content-items-table', 'order', 'sibling', 'fulcrm-campaign-content-item-weight' );
|
|
|
|
|
|
|
|
|
|
|
|
return $output;
|
|
|
|
return $output;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -484,7 +484,7 @@ function fulcrm_campaign_admin_campaign_delete_form_submit( $form, &$form_state
|
|
|
|
db_delete( 'fulcrm_campaign' )->condition( 'fcid', $fcid )->execute();
|
|
|
|
db_delete( 'fulcrm_campaign' )->condition( 'fcid', $fcid )->execute();
|
|
|
|
drupal_set_message( t('Campaign deleted.'), 'status', FALSE );
|
|
|
|
drupal_set_message( t('Campaign deleted.'), 'status', FALSE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$form_state[ 'redirect' ] = 'admin/config/services/fulcrm/campaign';
|
|
|
|
$form_state[ 'redirect' ] = 'admin/content/fulcrm/campaign';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function fulcrm_campaign_admin_campaign_delete_form( $form, &$form_state, $fcid ) {
|
|
|
|
function fulcrm_campaign_admin_campaign_delete_form( $form, &$form_state, $fcid ) {
|
|
|
@ -506,7 +506,7 @@ function fulcrm_campaign_admin_campaign_delete_form( $form, &$form_state, $fcid
|
|
|
|
'#value' => t('Delete'),
|
|
|
|
'#value' => t('Delete'),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
$form[ 'actions' ][ 'cancel' ] = array( '#type' => 'link',
|
|
|
|
$form[ 'actions' ][ 'cancel' ] = array( '#type' => 'link',
|
|
|
|
'#href' => 'admin/config/services/fulcrm/campaign',
|
|
|
|
'#href' => 'admin/content/fulcrm/campaign',
|
|
|
|
'#title' => 'Cancel',
|
|
|
|
'#title' => 'Cancel',
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|