function saveAsNote($recipients, $message) { $GLOBALS['system']->includeDBClass('person_note'); $subject = ifdef('SMS_SAVE_TO_NOTE_SUBJECT', 'SMS Sent'); foreach ($recipients as $id => $details) { // Add a note containing the SMS to the user $note = new Person_Note(); $note->setValue('subject', $subject); $note->setvalue('details', '"' . $message . '"'); $note->setValue('personid', $id); if (!$note->create()) { add_message('Failed to save SMS as a note.'); } } }
function printView() { $num_cols = 1; if ($GLOBALS['user_system']->havePerm(PERM_VIEWNOTE)) { $num_cols++; } if ($GLOBALS['user_system']->havePerm(PERM_VIEWROSTER)) { $num_cols++; } ?> <div class="homepage homepage-<?php echo $num_cols; ?> -col"> <div class="homepage-box search-forms"> <h3> <a class="pull-right hide-phone" href="javascript:if (sp = prompt('Search <?php echo SYSTEM_NAME; ?> for: ')) window.location='<?php echo BASE_URL; ?> ?view=_mixed_search&search='+sp" onclick="prompt('To create a search-jethro button in your browser, save the following code as a bookmark/favourite: ', this.href); return false" > <small>Bookmark</small> </a> <?php echo _('System-Wide Search'); ?> </h3> <label class="msie-only">Enter a person, family or group name, or phone number or email:</label> <form method="get"> <input type="hidden" name="view" value="_mixed_search" /> <span class="input-prepend input-append"> <span class="add-on"><i class="icon-search"></i></span> <input type="text" name="search" class="" placeholder=<?php echo _('"Name, Phone or Email"'); ?> /> <button type="submit" class="btn">Go</button> </span> </form> </div> <?php if ($GLOBALS['user_system']->havePerm(PERM_VIEWNOTE)) { $user =& $GLOBALS['system']->getDBObject('staff_member', $GLOBALS['user_system']->getCurrentUser('id')); $tasks = $user->getTasks('now'); ?> <div class="homepage-box my-notes"> <h3><?php echo _('Notes '); ?> <span><?php echo _('for immediate action'); ?> </span></h3> <?php if ($tasks) { ?> <table class="table table-condensed table-striped table-hover clickable-rows" width="100%"> <thead> <tr> <th><?php echo _('For'); ?> </th> <th><?php echo _('Subject'); ?> </th> </tr> </thead> <tbody> <?php foreach ($tasks as $id => $task) { $icon = $task['type'] == 'person' ? 'user' : 'home'; $view = $task['type'] == 'person' ? 'persons' : 'families'; $url = ifdef('NOTES_LINK_TO_EDIT') ? '?view=_edit_note¬e_type=' . ents($task['type']) . '¬eid=' . (int) $id : '?view=' . $view . '&' . $task['type'] . 'id=' . $task[$task['type'] . 'id'] . '#note_' . $id; ?> <tr> <td class="narrow"><i class="icon-<?php echo $icon; ?> "></i> <?php echo ents($task['name']); ?> </td> <td><a href="<?php echo $url; ?> "><?php echo ents($task['subject']); ?> </a></td> </tr> <?php } ?> </tbody> </table> <?php } else { ?> <p><i>None</i></p> <?php } $later = $user->getTasks('later'); $count = count($later); if ($count) { ?> <p class="align-right"><?php echo _('You have '); ?> <a href="<?php echo build_url(array('view' => 'notes__for_future_action', 'assignee' => $user->id)); ?> "><?php echo count($later); ?> note<?php echo $count > 1 ? 's' : ''; ?> <?php echo _('for future action'); ?> </a></p> <?php } ?> </div> <?php } if ($GLOBALS['user_system']->havePerm(PERM_VIEWROSTER)) { ?> <div class="homepage-box my-roster"> <h3> <a href="?view=_manage_ical" class="pull-right hidden-phone"><small>Subscribe</small></a> Upcoming roster<span> allocations</span> </h3> <?php $GLOBALS['system']->includeDBClass('roster_role_assignment'); $rallocs = Roster_Role_Assignment::getUpcomingAssignments($GLOBALS['user_system']->getCurrentUser('id')); if ($rallocs) { foreach ($rallocs as $date => $allocs) { ?> <h5><?php echo date('j M', strtotime($date)); ?> </h5> <?php foreach ($allocs as $alloc) { echo $alloc['cong'] . ' ' . $alloc['title'] . '<br />'; } } ?> <div class="pull-right"><a href="./?view=persons&personid=<?php echo $GLOBALS['user_system']->getCurrentUser('id'); ?> #rosters">See all</a></div> <?php } else { ?> <p><i>None</i></p> <?php } ?> </div> <?php } ?> </div> <?php }
<input type="submit" class="btn bulk-sms-submit" value="Send" data-set-form-action="<?php echo BASE_URL; ?> ?view=_send_sms_http" /> <span id="smscharactercount"><?php echo SMS_MAX_LENGTH; ?> characters remaining.</span> </div> </div> <div class="control-group"> <label class="control-label">After sending:</label> <div class="controls"> <label class="checkbox"> <input type="checkbox" name="saveasnote" accesskey="n" <?php if (ifdef('SMS_SAVE_TO_NOTE_BY_DEFAULT')) { echo 'checked="checked"'; } ?> /> save as note </label> </div> </div> </div> <?php } ?> <div class="bulk-action well" id="csv"> <p>Get a CSV file of:</p> <label class="radio"><input class="compulsory" type="radio" name="merge_type" value="person" id="merge_type_person" checked="checked" /><?php
public function printView() { ?> <p>Some of the following settings can be edited on this page. Other settings are read only on this page, but can be adjusted by getting your <?php if (defined('SYSADMIN_HREF')) { echo '<a href="' . SYSADMIN_HREF . '">'; } ?> system administrator <?php if (defined('SYSADMIN_HREF')) { echo '</a>'; } ?> to edit the Jethro configuration file.</p> <table class="table no-autofocus system-config"> <tr> <td colspan="2"><h3>Overall system settings</h3></td> </tr> <tr> <th>System Name</th> <td><?php echo SYSTEM_NAME; ?> </td> </tr> <tr> <th>Base URL</th> <td><?php echo BASE_URL; ?> </td> </tr> <tr> <th>Require HTTPS</th> <td><?php echo REQUIRE_HTTPS ? 'Yes' : 'No'; ?> </td> </tr> <tr> <td colspan="2"><h3>Jethro behaviour settings</h3></td> </tr> <tr> <th>Enabled Features</th> <td> <?php $enabled = explode(',', ENABLED_FEATURES); foreach (explode(',', 'NOTES,PHOTOS,DATES,ATTENDANCE,ROSTERS&SERVICES,SERVICEDETAILS,DOCUMENTS,SERVICEDOCUMENTS') as $feature) { echo '<i class="icon-' . (in_array($feature, $enabled) ? 'ok-sign' : 'ban-circle') . '"></i>' . $feature . '<br />'; } ?> </td> </tr> <tr> <th>Require note when adding new family?</th> <td><?php echo REQUIRE_INITIAL_NOTE ? 'Yes' : 'No'; ?> </td> </tr> <tr> <th>Attendance list order</th> <td><?php echo ATTENDANCE_LIST_ORDER; ?> <br /><small>When recording attendance, persons will be listed in this order</small> </td> </tr> <tr> <th>Chunk size for listings</th> <td> <?php echo CHUNK_SIZE; ?> <br /><small>When listing all persons or families, Jethro will paginate the results and aim for this number per page (up to a maximum of 26 pages).</small> </td> </tr> <tr> <th>Lock length for editing objects</th> <td><?php echo LOCK_LENGTH; ?> <br /><small>When you open an object for editing, Jethro will prevent other users from editing the object for this long. You will need to save your changes within this timeframe.</small> </td> </tr> <tr> <td colspan="2"><h3>Security settings</h3></td> </tr> <tr> <th>Default Permissions</th> <td> <?php $GLOBALS['system']->includeDBClass('staff_member'); $sm = new Staff_Member(); $sm->printFieldValue('permissions', DEFAULT_PERMISSIONS); ?> </td> </tr> <tr> <th>Session Inactivity Timeout</th> <td> <?php echo defined('SESSION_TIMEOUT_MINS') && SESSION_TIMEOUT_MINS > 0 ? SESSION_TIMEOUT_MINS : 90; ?> mins <br /><small>Users will be asked to log in again if they haven't done anything for this length of time. This is important for security, especially on mobile devices.</small> </td> </tr> <tr> <th>Maximum Session Length</th> <td> <?php $val = defined('SESSION_MAXLENGTH_MINS') && SESSION_MAXLENGTH_MINS > 0 ? SESSION_MAXLENGTH_MINS : 8 * 60; if ($val % 60 == 0 && $val > 60) { echo $val / 60 . ' hours'; } else { echo $val . ' mins'; } ?> <br /><small>Active users will be asked to log in again after this length of time. This is important for security, especially on mobile devices.</small> </td> </tr> <tr> <td colspan="2"><h3>Jethro data structure settings</h3></td> </tr> <tr> <th>Person Status Options</th> <td><?php echo PERSON_STATUS_OPTIONS; ?> (Default <?php echo PERSON_STATUS_DEFAULT; ?> )</td> </tr> <tr> <th>Age Bracket Options</th> <td> <?php echo AGE_BRACKET_OPTIONS; ?> <br /><small>This list must always begin with 'adult'</small> </td> </tr> <tr> <th>Group Membership Status Options</th> <td> <form method="post"> <input type="hidden" name="group_membership_statuses_submitted" value="1" /> <table class="table-condensed expandable table-bordered table-auto-width"> <thead> <tr> <th>ID</th> <th>Label</th> <th>Default?</th> <th>Re-order</th> <th>Delete?</th> </tr> </thead> <tbody> <?php $GLOBALS['system']->includeDBClass('person_group'); list($options, $default) = Person_Group::getMembershipStatusOptionsAndDefault(); $options[null] = ''; $i = 0; foreach ($options as $id => $label) { ?> <tr> <td> <?php if ($id) { echo $id; echo '<input type="hidden" name="membership_status_' . $i . '_id" value="' . $id . '" />'; } echo '<input type="hidden" name="membership_status_ranking[]" value="' . $i . '" />'; ?> </td> <td><input type="text" name="membership_status_<?php echo $i; ?> _label" value="<?php echo ents($label); ?> " /></td> <td><input type="radio" name="membership_status_default_rank" value="<?php echo $i; ?> " <?php if ($id == $default) { echo 'checked="checked"'; } ?> /></td> <td> <img src="<?php echo BASE_URL; ?> /resources/img/arrow_up_thin_black.png" class="icon move-row-up" title="Move this role up" /> <img src="<?php echo BASE_URL; ?> /resources/img/arrow_down_thin_black.png" class="icon move-row-down" title="Move this role down" /> </td> <td> <?php if ($id) { ?> <input type="checkbox" name="membership_status_delete[]" data-toggle="strikethrough" data-target="row" value="<?php echo $id; ?> " /> <?php } ?> </td> </tr> <?php $i++; } ?> </table> <input type="submit" value="Save" class="btn" /> </form> </td> </tr> <tr> <td colspan="2"><h3>Rosters and Services</h3></td> </tr> <tr> <th>Roster Weeks Default</th> <td> <?php echo ROSTER_WEEKS_DEFAULT; ?> <br /><small>By default, rosters will display this number of weeks in the future.</small> </td> </tr> <tr> <th>Roster repeat date threshold</th> <td> <?php echo REPEAT_DATE_THRESHOLD; ?> <br /><small>If a roster has more than this number of columns, the date column will be repeated on the right hand side</small> </td> </tr> <tr> <th>Service Documents: Folders to populate</th> <td> <?php if (SERVICE_DOCS_TO_POPULATE_DIRS) { echo implode('<br />', explode('|', SERVICE_DOCS_TO_POPULATE_DIRS)); } ?> </td> </tr> <tr> <th>Service Documents: Folders to expand</th> <td> <?php if (SERVICE_DOCS_TO_EXPAND_DIRS) { echo implode('<br />', explode('|', SERVICE_DOCS_TO_POPULATE_DIRS)); } ?> </td> </tr> <tr> <td colspan="2"><h3>External tools</h3></td> </tr> <tr> <th>Bible reference URL</th> <td> <?php echo BIBLE_URL; ?> <br /><small>Bible references in rosters will be linked using this URL template</small> </td> </tr> <tr> <th>Maps URL</th> <td> <?php echo MAP_LOOKUP_URL; ?> <br /><small>The "map" link displayed next to a family's address uses this URL template</small> </td> </tr> <tr> <th>Email chunk size</th> <td> <?php echo EMAIL_CHUNK_SIZE; ?> <br /><small>Email servers can only handle a limited number of recipients per email. When constructing email links to multiple persons, Jethro will divide the list into several links if there are more than this number of recipients.</small> </td> </tr> <tr> <th>SMS Gateway</th> <td> <?php echo SMS_HTTP_URL; ?> <br /> <?php echo SMS_HTTP_POST_TEMPLATE && SMS_HTTP_RESPONSE_OK_REGEX ? 'See details in config file' : '<b>Not fully configured.<b>'; ?> <?php echo ifdef('SMS_HTTP_HEADER_TEMPLATE') ? '' : ' No additional headers configured.'; ?> </tr> <tr> <th>Max length for SMS messages</th> <td> <?php echo SMS_MAX_LENGTH; ?> <br /><small>160 characters is generally a one-part SMS. Longer messages will be sent in several parts and will cost more.</small> </td> </tr> <tr> <th>Default to saving sent SMS as note</th> <td> <?php echo ifdef('SMS_SAVE_TO_NOTE_BY_DEFAULT', 0); ?> <br /> </td> </tr> <tr> <th>Default Subject for SMS saved as a note</th> <td> <?php echo ifdef('SMS_SAVE_TO_NOTE_SUBJECT', ''); ?> <br /> </td> </tr> <tr> <th>Logging of SMS sending</th> <td> <?php echo SMS_SEND_LOGFILE ? 'Configured' : 'Not configured'; ?> <br /><small>This allows you to track how many SMSes each user is sending via Jethro.</small> </td> </tr> <tr> <td colspan="2"><h3>Locale settings</h3></td> </tr> <tr> <th>Timezone</th> <td><?php echo defined('TIMEZONE') ? TIMEZONE : '(Server default)'; ?> </td> </tr> <tr> <th>Label for the Address 'suburb' field</th> <td><?php echo defined('ADDRESS_SUBURB_LABEL') ? ADDRESS_SUBURB_LABEL : 'Suburb'; ?> </td> </tr> <tr> <th>Label for the address 'state' field</th> <td> <?php if (!defined('ADDRESS_STATE_LABEL')) { echo 'State'; } else { if (ADDRESS_STATE_LABEL) { echo ADDRESS_STATE_LABEL; } else { echo '(State field disabled)'; } } echo '<br /><small>The state field can be hidden altogether by setting this to blank</small>'; ?> </td> </tr> <tr> <th>Options for the Address 'state' field</th> <td><?php echo ADDRESS_STATE_OPTIONS; ?> (Default: <?php echo ADDRESS_STATE_DEFAULT; ?> )</td> </tr> <tr> <th>Label for the address 'postcode' field</th> <td><?php echo defined('ADDRESS_POSTCODE_LABEL') ? ADDRESS_POSTCODE_LABEL : 'Postcode'; ?> </td> </tr> <tr> <th>Valid formats for the address 'postcode' field</th> <td><?php echo ADDRESS_POSTCODE_WIDTH . ' characters matching the expression ' . ADDRESS_POSTCODE_REGEX; ?> </td> </tr> <tr> <th>Postcode lookup URL</th> <td> <?php echo POSTCODE_LOOKUP_URL; ?> <br /><small>When editing an address, the "look up <?php echo defined('ADDRESS_POSTCODE_LABEL') ? ADDRESS_POSTCODE_LABEL : 'postcode'; ?> " link uses this URL</small> </td> </tr> <tr> <th>Envelope Size</th> <td><?php echo ENVELOPE_WIDTH_MM . 'mm x ' . ENVELOPE_HEIGHT_MM . 'mm'; ?> </td> </tr> <tr> <th>Formats for the home phone field</th> <td> <?php echo nl2br(HOME_TEL_FORMATS); ?> <br /><small>When a phone number is displayed, it is laid out using these formats. When a phone number is entered, Jethro makes sure it has the right number of digits to match one of these formats.</small> </td> </tr> <tr> <th>Formats for the work phone field</th> <td><?php echo nl2br(HOME_TEL_FORMATS); ?> </td> </tr> <tr> <th>Formats for the mobile phone field</th> <td><?php echo nl2br(MOBILE_TEL_FORMATS); ?> </td> </tr> <tr> <td colspan="2"><h3>Appearance Settings</h3></td> </tr> <tr> <th>Custom Colours</th> <td><?php $customLessVars = defined('CUSTOM_LESS_VARS') ? constant('CUSTOM_LESS_VARS') : NULL; $customCSSFile = 'jethro-' . JETHRO_VERSION . '-custom.css'; if (file_exists(JETHRO_ROOT . '/' . $customCSSFile)) { ?> Jethro is using the custom CSS file <?php echo $customCSSFile; ?> <br /> <?php if ($customLessVars) { ?> The following <a href="http://lesscss.org/">LESS</a> variables are set in the conf file: <?php bam($customLessVars); ?> To adjust these colours, first delete <?php echo $customCSSFile; ?> from your jethro directory. Then edit your conf.php file, and when happy with the changes, come back to this page to re-save the custom CSS file. <?php } } else { if ($customLessVars) { ?> The following <a href="http://lesscss.org/">LESS</a> variables are set in the conf file: <?php bam($customLessVars); ?> <b>These changes have not been saved to a custom CSS file, so Jethro is building the CSS on every page load.</b> For production environments you should <span class="clickable" onclick="TBLib.downloadText($(document.head).find('style[id^=less]').get(0).innerHTML, '<?php echo $customCSSFile; ?> ')">download the compiled CSS</span> and save it in your main Jethro folder. <?php } } ?> </td> </tr> </table> <?php }
/** * Returns the international version of the supplied number * @see config: SMS_LOCAL_PREFIX SMS_INTERNATIONAL_PREFIX * @param string $number Number in local format * @return string Nummber in international format, if prefixes configured, else unchanged number */ private static function internationalizeNumber($number) { if (strlen(ifdef('SMS_LOCAL_PREFIX')) && strlen(ifdef('SMS_INTERNATIONAL_PREFIX')) && 0 === strpos($number, SMS_LOCAL_PREFIX)) { $number = SMS_INTERNATIONAL_PREFIX . substr($number, strlen(SMS_LOCAL_PREFIX)); } return $number; }