materio_contactops.module 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. );
  18. $perms = array(
  19. 'view own company related materials' => array(
  20. 'title' => t('view own company related materials'),
  21. 'description' => t('view own company related materials'),
  22. )
  23. );
  24. return $perms;
  25. }
  26. function materio_contactops_menu(){
  27. $items = array();
  28. $items['admin/content/companies/export'] = array(
  29. 'title' => t('Export Companies'),
  30. 'page callback' => 'materio_contactops_export',
  31. 'page arguments' => array(),
  32. 'access arguments' => array('access company export'),
  33. 'type' => MENU_LOCAL_TASK,
  34. 'file' => 'materio_contactops.pages.inc',
  35. );
  36. $items['user/%user/materials'] = array(
  37. 'title' => t('Materials'),
  38. 'page callback' => 'materio_contactops_materials',
  39. 'page arguments' => array(1),
  40. 'access arguments' => array('view own company related materials'),
  41. 'type' => MENU_LOCAL_TASK,
  42. 'file' => 'materio_contactops.pages.inc',
  43. );
  44. return $items;
  45. }
  46. /**
  47. * Implements hook_menu_local_tasks_alter().
  48. */
  49. function materio_contactops_menu_local_tasks_alter(&$data, $router_item, $root_path) {
  50. switch($root_path){
  51. case 'admin/content/companies' :
  52. $item = menu_get_item('admin/content/companies/export');
  53. if ($item['access']) {
  54. $data['actions']['output'][] = array(
  55. '#theme' => 'menu_local_action',
  56. '#link' => $item,
  57. );
  58. }
  59. break;
  60. }
  61. }
  62. /**
  63. * Implements hook_theme().
  64. */
  65. function materio_contactops_theme($existing, $type, $theme, $path) {
  66. return array(
  67. 'materio_contactops_materials' => array(
  68. 'template' => 'materio-contactops-materials',
  69. 'path' => drupal_get_path('module', 'materio_contactops').'/templates',
  70. 'arguments' => array(
  71. 'items' => array(),
  72. 'view_mode' => "teaser",
  73. 'pager' => NULL,
  74. 'count' => 0,
  75. )
  76. )
  77. );
  78. }
  79. function template_preprocess_materio_contactops_materials(&$vars){
  80. // dsm($vars, 'template_preprocess_materio_contactops_materials | vars');
  81. // $vars['actualities_infos'] = t('Actualities by materiO\'');
  82. $vars['materials_infos'] = t('');
  83. }