115 lines
3.0 KiB
Plaintext
115 lines
3.0 KiB
Plaintext
<?php
|
|
|
|
|
|
/**
|
|
* Implements hook_init().
|
|
*/
|
|
// function materio_contactops_init() {
|
|
// drupal_add_js(drupal_get_path('module', 'materio_contactops').'/js/materio_contactops.js');
|
|
// }
|
|
|
|
|
|
/**
|
|
* Implements hook_permission().
|
|
*/
|
|
function materio_contactops_permission() {
|
|
$perms = array(
|
|
'access company export' => array(
|
|
'title' => t('access company export'),
|
|
'description' => t('access company export'),
|
|
),
|
|
'view own company related materials' => array(
|
|
'title' => t('view own company related materials'),
|
|
'description' => t('view own company related materials'),
|
|
)
|
|
);
|
|
|
|
return $perms;
|
|
}
|
|
|
|
function materio_contactops_menu(){
|
|
$items = array();
|
|
|
|
$items['admin/content/companies/export'] = array(
|
|
'title' => t('Export Companies'),
|
|
'page callback' => 'materio_companies_export',
|
|
'page arguments' => array(),
|
|
'access arguments' => array('access company export'),
|
|
'type' => MENU_LOCAL_TASK,
|
|
'file' => 'materio_contactops.pages.inc',
|
|
);
|
|
|
|
$items['admin/users/industriels/export'] = array(
|
|
'title' => t('Export Companies Contacts'),
|
|
'page callback' => 'materio_contactops_export',
|
|
'page arguments' => array(),
|
|
'access arguments' => array('access company export'),
|
|
'type' => MENU_LOCAL_TASK,
|
|
'file' => 'materio_contactops.pages.inc',
|
|
);
|
|
|
|
$items['user/%user/materials'] = array(
|
|
'title' => t('Materials'),
|
|
'page callback' => 'materio_contactops_materials',
|
|
'page arguments' => array(1),
|
|
'access arguments' => array('view own company related materials'),
|
|
'type' => MENU_LOCAL_TASK,
|
|
'file' => 'materio_contactops.pages.inc',
|
|
);
|
|
|
|
return $items;
|
|
}
|
|
|
|
/**
|
|
* Implements hook_menu_local_tasks_alter().
|
|
*/
|
|
function materio_contactops_menu_local_tasks_alter(&$data, $router_item, $root_path) {
|
|
switch($root_path){
|
|
case 'admin/content/companies' :
|
|
$item = menu_get_item('admin/content/companies/export');
|
|
if ($item['access']) {
|
|
$data['actions']['output'][] = array(
|
|
'#theme' => 'menu_local_action',
|
|
'#link' => $item,
|
|
);
|
|
}
|
|
break;
|
|
case 'admin/users/industriels':
|
|
$item = menu_get_item('admin/users/industriels/export');
|
|
if ($item['access']) {
|
|
$data['actions']['output'][] = array(
|
|
'#theme' => 'menu_local_action',
|
|
'#link' => $item,
|
|
);
|
|
}
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
* Implements hook_theme().
|
|
*/
|
|
function materio_contactops_theme($existing, $type, $theme, $path) {
|
|
return array(
|
|
'materio_contactops_materials' => array(
|
|
'template' => 'materio-contactops-materials',
|
|
'path' => drupal_get_path('module', 'materio_contactops').'/templates',
|
|
'arguments' => array(
|
|
'items' => array(),
|
|
'view_mode' => "teaser",
|
|
'pager' => NULL,
|
|
'count' => 0,
|
|
)
|
|
)
|
|
);
|
|
}
|
|
|
|
|
|
function template_preprocess_materio_contactops_materials(&$vars){
|
|
// dsm($vars, 'template_preprocess_materio_contactops_materials | vars');
|
|
|
|
// $vars['actualities_infos'] = t('Actualities by materiO\'');
|
|
$vars['materials_infos'] = t('');
|
|
}
|