You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
11 KiB
Plaintext

<?php /* -*- php -*- */
function fulcrm_campaign_permission() {
return array( 'administer fulcrm campaign' => array( 'title' => t('Administer fulcrm campaign'),
'description' => t('Configure fulcrm Campaign.'),
),
'administer fulcrm campaign templates' => array( 'title' => t('Administer fulcrm Campaign Templates'),
'description' => t('Configure theme templates and variable templates for FMS.'),
),
'build fulcrm campaign' => array( 'title' => t('Build fulcrm Campaign'),
'description' => t('Assemble content together for a Campaign.'),
),
'set fulcrm campaign variables' => array( 'title' => t('Set FMS Mailshot Variables'),
'description' => t('Set/override variables on a Campaign.'),
),
);
}
function fulcrm_campaign_menu() {
$items[ 'admin/content/fulcrm/campaign' ] = array( 'page callback' => 'fulcrm_campaign_admin_campaign',
'title' => 'fulcrm Campaigns',
'description' => 'Administer campaigns created in Drupal and pushed to fulcrm.',
'access arguments' => array('build fulcrm campaign'),
'file' => 'fulcrm_campaign.admin.inc',
'type' => MENU_LOCAL_TASK,
);
$items[ 'admin/content/fulcrm/campaign/new' ] = array( 'page callback' => 'fulcrm_campaign_admin_campaign_new',
'type' => MENU_LOCAL_ACTION,
'title' => 'Create a Campaign',
'description' => 'Create an fulcrm Campaign.',
'access arguments' => array('build fulcrm campaign'),
'file' => 'fulcrm_campaign.admin.inc',
'weight' => 1,
);
$items[ 'admin/content/fulcrm/campaign/%' ] = array( 'page callback' => 'fulcrm_campaign_admin_campaign_settings',
'title' => 'Settings',
'page arguments' => array( 4 ),
'access arguments' => array('build fulcrm campaign'),
'file' => 'fulcrm_campaign.admin.inc',
'weight' => 1,
);
$items[ 'admin/content/fulcrm/campaign/%/settings' ] = array( 'page callback' => 'fulcrm_campaign_admin_campaign_settings',
'title' => 'Settings',
'type' => MENU_DEFAULT_LOCAL_TASK,
'access arguments' => array('build fulcrm campaign'),
'page arguments' => array( 4 ),
'weight' => 1,
);
$items[ 'admin/content/fulcrm/campaign/%/sync' ] = array( 'page callback' => 'fulcrm_campaign_admin_campaign_sync',
'title' => 'Sync to fulcrm',
'type' => MENU_LOCAL_TASK,
'access arguments' => array('build fulcrm campaign'),
'file' => 'fulcrm_campaign.admin.inc',
'page arguments' => array( 4 ),
'weight' => 10,
);
$items[ 'admin/content/fulcrm/campaign/%/edit' ] = array( 'page callback' => 'fulcrm_campaign_admin_campaign_edit',
'title' => 'Edit',
'type' => MENU_LOCAL_TASK,
'page arguments' => array( 4 ),
'access arguments' => array('build fulcrm campaign'),
'file' => 'fulcrm_campaign.admin.inc',
'weight' => 2,
);
$items[ 'admin/content/fulcrm/campaign/%/delete' ] = array( 'page callback' => 'fulcrm_campaign_admin_campaign_delete',
'title' => 'Delete',
'type' => MENU_LOCAL_TASK,
'page arguments' => array( 4 ),
'access arguments' => array('build fulcrm campaign'),
'file' => 'fulcrm_campaign.admin.inc',
'weight' => 5,
);
$items[ 'node/%node/fulcrm/campaign' ] = array( 'title' => 'fulcrm Campaign',
'page callback' => 'fulcrm_campaign_admin_campaign_node',
'page arguments' => array( 1 ),
'access arguments' => array('build fulcrm campaign'),
'file' => 'fulcrm_campaign.admin.inc',
'weight' => 5,
'type' => MENU_LOCAL_TASK
);
$items[ 'admin/config/services/fulcrm/campaign/settings' ] = array( 'page callback' => 'fulcrm_campaign_admin_config_settings',
'title' => 'fulcrm Campaign Settings',
'description' => 'fulcrm campaign system settings.',
'type' => MENU_LOCAL_TASK,
'access arguments' => array('administer fulcrm campaign'),
'file' => 'fulcrm_campaign.admin.inc',
);
$items[ 'admin/config/services/fulcrm/campaign/template' ] = array( 'page callback' => 'fulcrm_campaign_admin_config_template',
'title' => 'Template Configuration',
'description' => 'fulcrm Campaign template settings.',
'type' => MENU_LOCAL_TASK,
'access arguments' => array('administer fulcrm campaign templates'),
'file' => 'fulcrm_campaign.admin.inc',
);
$items[ 'admin/config/services/fulcrm/campaign/template/add' ] = array( 'page callback' => 'fulcrm_campaign_admin_config_template_add',
'title' => 'Create Template',
'description' => 'fulcrm Campaign template settings.',
'type' => MENU_LOCAL_ACTION,
'access arguments' => array('administer fulcrm campaign templates'),
'file' => 'fulcrm_campaign.admin.inc',
);
$items[ 'admin/config/services/fulcrm/campaign/template/%/edit' ] = array( 'page callback' => 'fulcrm_campaign_admin_config_template_edit',
'title' => 'Edit Template',
'description' => 'fulcrm Campaign template settings.',
'access arguments' => array('administer fulcrm campaign templates'),
'page arguments' => array( 6 ),
'file' => 'fulcrm_campaign.admin.inc',
);
return $items;
}
function fulcrm_campaign_theme() {
return array( 'fulcrm_campaign_admin_campaign_edit_form' => array( 'render element' => 'form',
'file' => 'fulcrm_campaign.admin.inc',
),
);
}
function fulcrm_campaign_create_campaign_variables_from_template( $fcid, $tid ) {
db_delete( 'fulcrm_campaign_variable_value' )->condition( 'fulcrm_campaign_variable_value.fcid', $fcid )->execute();
$query = db_select( 'fulcrm_campaign_template_value' )->fields( 'fulcrm_campaign_template_value', array( 'name', 'value' ) )->condition( 'fulcrm_campaign_template_value.tid', $tid );
foreach ( $query->execute() as $row ) {
db_insert( 'fulcrm_campaign_variable_value' )->fields( array( 'fcid' => $fcid,
'name' => $row->name,
'value' => $row->value,
) )->execute();
}
module_invoke_all( 'fulcrm_campaign_prepared', $fcid );
}