PageRenderTime 25ms CodeModel.GetById 29ms RepoModel.GetById 1ms app.codeStats 0ms

/modules/Meetings/SubPanelViewInvitees.php

https://gitlab.com/tjaafar/SuiteCRM
PHP | 153 lines | 78 code | 23 blank | 52 comment | 9 complexity | 13637b4aea79fc4ffa1bf89cb066dfec MD5 | raw file
  1. <?php
  2. if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
  3. /*********************************************************************************
  4. * SugarCRM Community Edition is a customer relationship management program developed by
  5. * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
  6. * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd.
  7. * Copyright (C) 2011 - 2014 Salesagility Ltd.
  8. *
  9. * This program is free software; you can redistribute it and/or modify it under
  10. * the terms of the GNU Affero General Public License version 3 as published by the
  11. * Free Software Foundation with the addition of the following permission added
  12. * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
  13. * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
  14. * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
  15. *
  16. * This program is distributed in the hope that it will be useful, but WITHOUT
  17. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  18. * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
  19. * details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License along with
  22. * this program; if not, see http://www.gnu.org/licenses or write to the Free
  23. * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  24. * 02110-1301 USA.
  25. *
  26. * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
  27. * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
  28. *
  29. * The interactive user interfaces in modified source and object code versions
  30. * of this program must display Appropriate Legal Notices, as required under
  31. * Section 5 of the GNU Affero General Public License version 3.
  32. *
  33. * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
  34. * these Appropriate Legal Notices must retain the display of the "Powered by
  35. * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
  36. * reasonably feasible for technical reasons, the Appropriate Legal Notices must
  37. * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
  38. ********************************************************************************/
  39. /*********************************************************************************
  40. * Description: TODO: To be written.
  41. * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
  42. * All Rights Reserved.
  43. * Contributor(s): ______________________________________..
  44. ********************************************************************************/
  45. global $currentModule;
  46. global $mod_strings;
  47. global $app_strings;
  48. global $theme;
  49. global $focus;
  50. global $action;
  51. global $locale;
  52. // focus_list is the means of passing data to a SubPanelView.
  53. global $focus_list;
  54. $button = "<table cellspacing='0' cellpadding='1' border='0'><form border='0' action='index.php' method='post' name='form' id='form'>\n";
  55. $button .= "<input type='hidden' name='module' value='Contacts'>\n";
  56. if ($currentModule == 'Accounts') $button .= "<input type='hidden' name='account_id' value='$focus->id'>\n<input type='hidden' name='account_name' value='$focus->name'>\n";
  57. $button .= "<input type='hidden' name='return_module' value='".$currentModule."'>\n";
  58. $button .= "<input type='hidden' name='return_action' value='".$action."'>\n";
  59. $button .= "<input type='hidden' name='return_id' value='".$focus->id."'>\n";
  60. $button .= "<input type='hidden' name='action'>\n";
  61. $button .= "<tr><td>&nbsp;</td>";
  62. if ($focus->parent_type == "Accounts") $button .= "<td><input title='".$app_strings['LBL_SELECT_CONTACT_BUTTON_TITLE']."' type='button' class='button' value='".$app_strings['LBL_SELECT_CONTACT_BUTTON_LABEL']."' name='button' LANGUAGE=javascript onclick='window.open(\"index.php?module=Contacts&action=Popup&html=Popup_picker&form=DetailView&form_submit=true&query=true&account_id=$focus->parent_id&account_name=".urlencode($focus->parent_name)."\",\"new\",\"width=600,height=400,resizable=1,scrollbars=1\");'></td>\n";
  63. else $button .= "<td><input title='".$app_strings['LBL_SELECT_CONTACT_BUTTON_TITLE']."' type='button' class='button' value='".$app_strings['LBL_SELECT_CONTACT_BUTTON_LABEL']."' name='button' LANGUAGE=javascript onclick='window.open(\"index.php?module=Contacts&action=Popup&html=Popup_picker&form=DetailView&form_submit=true\",\"new\",\"width=600,height=400,resizable=1,scrollbars=1\");'></td>\n";
  64. $button .= "<td><input title='".$app_strings['LBL_SELECT_USER_BUTTON_TITLE']."' type='button' class='button' value='".$app_strings['LBL_SELECT_USER_BUTTON_LABEL']."' name='button' LANGUAGE=javascript onclick='window.open(\"index.php?module=Users&action=Popup&html=Popup_picker&form=DetailView&form_submit=true\",\"new\",\"width=600,height=400,resizable=1,scrollbars=1\");'></td>\n";
  65. $button .= "</tr></form></table>\n";
  66. // Stick the form header out there.
  67. echo get_form_header($mod_strings['LBL_INVITEE'], $button, false);
  68. $xtpl=new XTemplate ('modules/Meetings/SubPanelViewInvitees.html');
  69. $xtpl->assign("MOD", $mod_strings);
  70. $xtpl->assign("APP", $app_strings);
  71. $xtpl->assign("RETURN_URL", "&return_module=$currentModule&return_action=DetailView&return_id=$focus->id");
  72. $xtpl->assign("MEETING_ID", $focus->id);
  73. $oddRow = true;
  74. foreach($focus_users_list as $user)
  75. {
  76. $user_fields = array(
  77. 'USER_NAME' => $user->user_name,
  78. 'FULL_NAME' => $locale->getLocaleFormattedName($user->first_name, $user->last_name),
  79. 'ID' => $user->id,
  80. 'EMAIL' => $user->email1,
  81. 'PHONE_WORK' => $user->phone_work
  82. );
  83. $xtpl->assign("USER", $user_fields);
  84. if($oddRow)
  85. {
  86. //todo move to themes
  87. $xtpl->assign("ROW_COLOR", 'oddListRow');
  88. }
  89. else
  90. {
  91. //todo move to themes
  92. $xtpl->assign("ROW_COLOR", 'evenListRow');
  93. }
  94. $oddRow = !$oddRow;
  95. $xtpl->parse("users.row");
  96. // Put the rows in.
  97. }
  98. $xtpl->parse("users");
  99. $xtpl->out("users");
  100. $oddRow = true;
  101. foreach($focus_contacts_list as $contact)
  102. {
  103. $contact_fields = array(
  104. 'FIRST_NAME' => $contact->first_name,
  105. 'LAST_NAME' => $contact->last_name,
  106. 'ACCOUNT_NAME' => $contact->account_name,
  107. 'ID' => $contact->id,
  108. 'EMAIL' => $contact->email1,
  109. 'PHONE_WORK' => $contact->phone_work
  110. );
  111. $xtpl->assign("CONTACT", $contact_fields);
  112. if($oddRow)
  113. {
  114. //todo move to themes
  115. $xtpl->assign("ROW_COLOR", 'oddListRow');
  116. }
  117. else
  118. {
  119. //todo move to themes
  120. $xtpl->assign("ROW_COLOR", 'evenListRow');
  121. }
  122. $oddRow = !$oddRow;
  123. $xtpl->parse("contacts.row");
  124. // Put the rows in.
  125. }
  126. $xtpl->parse("contacts");
  127. $xtpl->out("contacts");
  128. ?>