materio_contactops.module 2.4 KB

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