materio_contactops.module 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. /**
  3. * Implements hook_init().
  4. */
  5. // function materio_contactops_init() {
  6. // drupal_add_js(drupal_get_path('module', 'materio_contactops').'/js/materio_contactops.js');
  7. // }
  8. /**
  9. * Implements hook_permission().
  10. */
  11. function materio_contactops_permission() {
  12. $perms = array(
  13. 'access company export' => array(
  14. 'title' => t('access company export'),
  15. 'description' => t('access company export'),
  16. ),
  17. 'view own company related materials' => array(
  18. 'title' => t('view own company related materials'),
  19. 'description' => t('view own company related materials'),
  20. )
  21. );
  22. return $perms;
  23. }
  24. function materio_contactops_menu(){
  25. $items = array();
  26. $items['admin/content/companies/export'] = array(
  27. 'title' => t('Export Companies'),
  28. 'page callback' => 'materio_companies_export',
  29. 'page arguments' => array(),
  30. 'access arguments' => array('access company export'),
  31. 'type' => MENU_LOCAL_TASK,
  32. 'file' => 'materio_contactops.pages.inc',
  33. );
  34. $items['admin/users/industriels/export'] = array(
  35. 'title' => t('Export Companies Contacts'),
  36. 'page callback' => 'materio_contactops_export',
  37. 'page arguments' => array(),
  38. 'access arguments' => array('access company export'),
  39. 'type' => MENU_LOCAL_TASK,
  40. 'file' => 'materio_contactops.pages.inc',
  41. );
  42. $items['user/%user/materials'] = array(
  43. 'title' => t('Materials'),
  44. 'page callback' => 'materio_contactops_materials',
  45. 'page arguments' => array(1),
  46. 'access arguments' => array('view own company related materials'),
  47. 'type' => MENU_LOCAL_TASK,
  48. 'file' => 'materio_contactops.pages.inc',
  49. );
  50. return $items;
  51. }
  52. /**
  53. * Implements hook_menu_local_tasks_alter().
  54. */
  55. function materio_contactops_menu_local_tasks_alter(&$data, $router_item, $root_path) {
  56. switch($root_path){
  57. case 'admin/content/companies' :
  58. $item = menu_get_item('admin/content/companies/export');
  59. if ($item['access']) {
  60. $data['actions']['output'][] = array(
  61. '#theme' => 'menu_local_action',
  62. '#link' => $item,
  63. );
  64. }
  65. break;
  66. case 'admin/users/industriels':
  67. $item = menu_get_item('admin/users/industriels/export');
  68. if ($item['access']) {
  69. $data['actions']['output'][] = array(
  70. '#theme' => 'menu_local_action',
  71. '#link' => $item,
  72. );
  73. }
  74. break;
  75. }
  76. }
  77. /**
  78. * Implements hook_theme().
  79. */
  80. function materio_contactops_theme($existing, $type, $theme, $path) {
  81. return array(
  82. 'materio_contactops_materials' => array(
  83. 'template' => 'materio-contactops-materials',
  84. 'path' => drupal_get_path('module', 'materio_contactops').'/templates',
  85. 'arguments' => array(
  86. 'items' => array(),
  87. 'view_mode' => "teaser",
  88. 'pager' => NULL,
  89. 'count' => 0,
  90. )
  91. )
  92. );
  93. }
  94. function template_preprocess_materio_contactops_materials(&$vars){
  95. // dsm($vars, 'template_preprocess_materio_contactops_materials | vars');
  96. // $vars['actualities_infos'] = t('Actualities by materiO\'');
  97. $vars['materials_infos'] = t('');
  98. }