PageRenderTime 41ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/contacts/pages/main/template_main.php

http://phreedom.googlecode.com/
PHP | 95 lines | 70 code | 2 blank | 23 comment | 12 complexity | e91d1109d5c8fb80007629313a98eaaf MD5 | raw file
Possible License(s): GPL-3.0, LGPL-3.0
  1. <?php
  2. // +-----------------------------------------------------------------+
  3. // | PhreeBooks Open Source ERP |
  4. // +-----------------------------------------------------------------+
  5. // | Copyright (c) 2008, 2009, 2010, 2011, 2012 PhreeSoft, LLC |
  6. // | http://www.PhreeSoft.com |
  7. // +-----------------------------------------------------------------+
  8. // | This program is free software: you can redistribute it and/or |
  9. // | modify it under the terms of the GNU General Public License as |
  10. // | published by the Free Software Foundation, either version 3 of |
  11. // | the License, or any later version. |
  12. // | |
  13. // | This program is distributed in the hope that it will be useful, |
  14. // | but WITHOUT ANY WARRANTY; without even the implied warranty of |
  15. // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
  16. // | GNU General Public License for more details. |
  17. // +-----------------------------------------------------------------+
  18. // Path: /modules/contacts/pages/main/template_main.php
  19. //
  20. echo html_form('contacts', FILENAME_DEFAULT, gen_get_all_get_params(array('action'))) . chr(10);
  21. // include hidden fields
  22. echo html_hidden_field('todo', '') . chr(10);
  23. echo html_hidden_field('rowSeq', '') . chr(10);
  24. // customize the toolbar actions
  25. $toolbar->icon_list['cancel']['params'] = 'onclick="location.href = \'' . html_href_link(FILENAME_DEFAULT, '', 'SSL') . '\'"';
  26. $toolbar->icon_list['open']['show'] = false;
  27. $toolbar->icon_list['save']['show'] = false;
  28. $toolbar->icon_list['delete']['show'] = false;
  29. $toolbar->icon_list['print']['show'] = false;
  30. if ($security_level > 1) $toolbar->add_icon('new', 'onclick="submitToDo(\'new\')"', $order = 10);
  31. if (count($extra_toolbar_buttons) > 0) foreach ($extra_toolbar_buttons as $key => $value) $toolbar->icon_list[$key] = $value;
  32. if (!$cInfo->help == '') $toolbar->add_help($cInfo->help);
  33. if ($search_text) $toolbar->search_text = $search_text;
  34. echo $toolbar->build_toolbar($add_search = true);
  35. // Build the page
  36. ?>
  37. <h1><?php echo constant('ACT_' . strtoupper($type) . '_HEADING_TITLE'); ?></h1>
  38. <div id="filter_bar">
  39. <table class="ui-widget" style="border-style:none;">
  40. <tbody class="ui-widget-content">
  41. <tr>
  42. <td><?php echo TEXT_FILTERS . '&nbsp;' . TEXT_SHOW_INACTIVE . '&nbsp;' . html_checkbox_field('f0', '1', $f0); ?></td>
  43. <td><?php echo '&nbsp;' . html_button_field('apply', TEXT_APPLY, 'onclick="document.forms[0].submit();"'); ?></td>
  44. </tr>
  45. </tbody>
  46. </table>
  47. </div>
  48. <div style="float:right"><?php echo $query_split->display_links($query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['list']); ?></div>
  49. <div><?php echo $query_split->display_count($query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['list'], TEXT_DISPLAY_NUMBER . constant('ACT_' . strtoupper($type) . '_TYPE_NAME')); ?></div>
  50. <table class="ui-widget" style="border-collapse:collapse;width:100%">
  51. <thead class="ui-widget-header">
  52. <tr><?php echo $list_header; ?></tr>
  53. </thead>
  54. <tbody class="ui-widget-content">
  55. <?php
  56. $odd = true;
  57. while (!$query_result->EOF) {
  58. $bkgnd = ($query_result->fields['inactive']) ? ' style="background-color:pink"' : '';
  59. $attach_exists = $query_result->fields['attachments'] ? true : false;
  60. ?>
  61. <tr class="<?php echo $odd?'odd':'even'; ?>" style="cursor:pointer">
  62. <td<?php echo $bkgnd; ?> onclick="submitSeq(<?php echo $query_result->fields['id']; ?>, 'edit')"><?php echo htmlspecialchars($query_result->fields['short_name']); ?></td>
  63. <td<?php echo $bkgnd; ?> onclick="submitSeq(<?php echo $query_result->fields['id']; ?>, 'edit')"><?php echo htmlspecialchars($type == 'e' ? $query_result->fields['contact_first'] . ' ' . $query_result->fields['contact_last'] : $query_result->fields['primary_name']); ?></td>
  64. <td onclick="submitSeq(<?php echo $query_result->fields['id']; ?>, 'edit')"><?php echo htmlspecialchars($query_result->fields['address1']); ?></td>
  65. <td onclick="submitSeq(<?php echo $query_result->fields['id']; ?>, 'edit')"><?php echo htmlspecialchars($query_result->fields['city_town']); ?></td>
  66. <td onclick="submitSeq(<?php echo $query_result->fields['id']; ?>, 'edit')"><?php echo htmlspecialchars($query_result->fields['state_province']); ?></td>
  67. <td onclick="submitSeq(<?php echo $query_result->fields['id']; ?>, 'edit')"><?php echo htmlspecialchars($query_result->fields['postal_code']); ?></td>
  68. <td onclick="submitSeq(<?php echo $query_result->fields['id']; ?>, 'edit')"><?php echo htmlspecialchars($query_result->fields['telephone1']); ?></td>
  69. <td align="right">
  70. <?php
  71. // build the action toolbar
  72. // first pull in any extra buttons, this is dynamic since each row can have different buttons
  73. if (function_exists('add_extra_action_bar_buttons')) echo add_extra_action_bar_buttons($query_result->fields);
  74. if ($security_level > 1) echo html_icon('mimetypes/x-office-presentation.png', TEXT_SALES, 'small', 'onclick="contactChart(\'annual_sales\', '.$query_result->fields['id'].')"') . chr(10);
  75. if ($security_level > 1) echo html_icon('actions/edit-find-replace.png', TEXT_EDIT, 'small', 'onclick="submitSeq(' . $query_result->fields['id'] . ', \'edit\')"') . chr(10);
  76. if ($attach_exists) {
  77. echo html_icon('status/mail-attachment.png', TEXT_DOWNLOAD_ATTACHMENT,'small', 'onclick="submitSeq(' . $query_result->fields['id'] . ', \'dn_attach\', true)"') . chr(10);
  78. }
  79. if ($security_level > 3) echo html_icon('emblems/emblem-unreadable.png', TEXT_DELETE, 'small', 'onclick="if (confirm(\'' . ACT_WARN_DELETE_ACCOUNT . '\')) submitSeq(' . $query_result->fields['id'] . ', \'delete\')"') . chr(10);
  80. ?>
  81. </td>
  82. </tr>
  83. <?php
  84. $query_result->MoveNext();
  85. $odd = !$odd;
  86. }
  87. ?>
  88. </tbody>
  89. </table>
  90. <div style="float:right"><?php echo $query_split->display_links($query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['list']); ?></div>
  91. <div><?php echo $query_split->display_count($query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['list'], TEXT_DISPLAY_NUMBER . constant('ACT_' . strtoupper($type) . '_TYPE_NAME')); ?></div>
  92. <div id="contact_chart" title="">&nbsp;</div>
  93. </form>