easyappointments/doc/code/php/classes/Notifications.html

696 lines
41 KiB
HTML
Raw Normal View History

2015-01-22 00:17:16 +02:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<meta charset="utf-8"/>
<title>API Documentation</title>
<meta name="author" content=""/>
<meta name="description" content=""/>
<link href="../css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
<link href="../css/font-awesome.min.css" rel="stylesheet">
<link href="../css/prism.css" rel="stylesheet" media="all"/>
<link href="../css/template.css" rel="stylesheet" media="all"/>
<!--[if lt IE 9]>
<script src="../js/html5.js"></script>
<![endif]-->
<script src="../js/jquery-1.11.0.min.js"></script>
<script src="../js/ui/1.10.4/jquery-ui.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script src="../js/jquery.smooth-scroll.js"></script>
<script src="../js/prism.min.js"></script>
<!-- TODO: Add http://jscrollpane.kelvinluck.com/ to style the scrollbars for browsers not using webkit-->
<script type="text/javascript">
function loadExternalCodeSnippets() {
Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) {
var src = pre.getAttribute('data-src');
var extension = (src.match(/\.(\w+)$/) || [, ''])[1];
var language = 'php';
var code = document.createElement('code');
code.className = 'language-' + language;
pre.textContent = '';
code.textContent = 'Loading…';
pre.appendChild(code);
var xhr = new XMLHttpRequest();
xhr.open('GET', src, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status < 400 && xhr.responseText) {
code.textContent = xhr.responseText;
Prism.highlightElement(code);
}
else if (xhr.status >= 400) {
code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
}
else {
code.textContent = '✖ Error: File does not exist or is empty';
}
}
};
xhr.send(null);
});
}
$(document).ready(function(){
loadExternalCodeSnippets();
});
$('#source-view').on('shown', function () {
loadExternalCodeSnippets();
})
</script>
<link rel="shortcut icon" href="../images/favicon.ico"/>
<link rel="apple-touch-icon" href="../images/apple-touch-icon.png"/>
<link rel="apple-touch-icon" sizes="72x72" href="../images/apple-touch-icon-72x72.png"/>
<link rel="apple-touch-icon" sizes="114x114" href="../images/apple-touch-icon-114x114.png"/>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<i class="icon-ellipsis-vertical"></i>
</a>
<a class="brand" href="../index.html">API Documentation</a>
<div class="nav-collapse">
<ul class="nav pull-right">
<li class="dropdown" id="charts-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Charts <b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li>
<a href="../graphs/class.html">
<i class="icon-list-alt"></i>&#160;Class hierarchy diagram
</a>
</li>
</ul>
</li>
<li class="dropdown" id="reports-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Reports <b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li>
<a href="../reports/errors.html">
<i class="icon-list-alt"></i>&#160;Errors <span class="label label-info pull-right">368</span>
</a>
</li>
<li>
<a href="../reports/markers.html">
<i class="icon-list-alt"></i>&#160;Markers <span class="label label-info pull-right">0</span>
</a>
</li>
<li>
<a href="../reports/deprecated.html">
<i class="icon-list-alt"></i>&#160;Deprecated <span class="label label-info pull-right">1</span>
</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<!--<div class="go_to_top">-->
<!--<a href="#___" style="color: inherit">Back to top&#160;&#160;<i class="icon-upload icon-white"></i></a>-->
<!--</div>-->
</div>
<div id="___" class="container-fluid">
<section class="row-fluid">
<div class="span2 sidebar">
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1109178672"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1109178672" class="accordion-body collapse in">
<div class="accordion-inner">
<ul>
<li class="class"><a href="../classes/Admins_Model.html">Admins_Model</a></li>
<li class="class"><a href="../classes/Appointments.html">Appointments</a></li>
<li class="class"><a href="../classes/Appointments_Model.html">Appointments_Model</a></li>
<li class="class"><a href="../classes/Backend.html">Backend</a></li>
<li class="class"><a href="../classes/Backend_api.html">Backend_api</a></li>
<li class="class"><a href="../classes/Customers_Model.html">Customers_Model</a></li>
<li class="class"><a href="../classes/Errors.html">Errors</a></li>
<li class="class"><a href="../classes/Google.html">Google</a></li>
<li class="class"><a href="../classes/Google_Sync.html">Google_Sync</a></li>
<li class="class"><a href="../classes/Notifications.html">Notifications</a></li>
<li class="class"><a href="../classes/Providers_Model.html">Providers_Model</a></li>
<li class="class"><a href="../classes/Roles_Model.html">Roles_Model</a></li>
<li class="class"><a href="../classes/Secretaries_Model.html">Secretaries_Model</a></li>
<li class="class"><a href="../classes/Services_Model.html">Services_Model</a></li>
<li class="class"><a href="../classes/Settings_Model.html">Settings_Model</a></li>
<li class="class"><a href="../classes/Test.html">Test</a></li>
<li class="class"><a href="../classes/Unit_tests.html">Unit_tests</a></li>
<li class="class"><a href="../classes/Unit_tests_admins_model.html">Unit_tests_admins_model</a></li>
<li class="class"><a href="../classes/Unit_tests_appointments_model.html">Unit_tests_appointments_model</a></li>
<li class="class"><a href="../classes/Unit_tests_customers_model.html">Unit_tests_customers_model</a></li>
<li class="class"><a href="../classes/Unit_tests_providers_model.html">Unit_tests_providers_model</a></li>
<li class="class"><a href="../classes/Unit_tests_secretaries_model.html">Unit_tests_secretaries_model</a></li>
<li class="class"><a href="../classes/Unit_tests_services_model.html">Unit_tests_services_model</a></li>
<li class="class"><a href="../classes/Unit_tests_settings_model.html">Unit_tests_settings_model</a></li>
<li class="class"><a href="../classes/User.html">User</a></li>
<li class="class"><a href="../classes/User_Model.html">User_Model</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="row-fluid">
<div class="span10 offset2">
<div class="row-fluid">
<div class="span8 content class">
<nav>
<a href="../namespaces/default.html">\</a> <i class="icon-level-up"></i>
</nav>
<a href="#source-view" role="button" class="pull-right btn" data-toggle="modal"><i class="icon-code"></i></a>
<h1><small>\</small>Notifications</h1>
<p><em>This library handles all the notification email deliveries
on the system.</em></p>
<p>Custom system settings for the notification section are loaded
during the execution of each class methods.</p>
<section id="summary">
<h2>Summary</h2>
<section class="row-fluid heading">
<section class="span4">
<a href="#methods">Methods</a>
</section>
<section class="span4">
<a href="#properties">Properties</a>
</section>
<section class="span4">
<a href="#constants">Constants</a>
</section>
</section>
<section class="row-fluid public">
<section class="span4">
<a href="../classes/Notifications.html#method___construct" class="">__construct()</a><br />
<a href="../classes/Notifications.html#method_send_appointment_details" class="">send_appointment_details()</a><br />
<a href="../classes/Notifications.html#method_send_delete_appointment" class="">send_delete_appointment()</a><br />
<a href="../classes/Notifications.html#method_send_password" class="">send_password()</a><br />
<a href="../classes/Notifications.html#method_send_new_installation" class="">send_new_installation()</a><br />
</section>
<section class="span4">
<em>No public properties found</em>
</section>
<section class="span4">
<em>No constants found</em>
</section>
</section>
<section class="row-fluid protected">
<section class="span4">
<em>No protected methods found</em>
</section>
<section class="span4">
<em>No protected properties found</em>
</section>
<section class="span4">
<em>N/A</em>
</section>
</section>
<section class="row-fluid private">
<section class="span4">
<a href="../classes/Notifications.html#method_replace_template_variables" class="">replace_template_variables()</a><br />
</section>
<section class="span4">
<a href="../classes/Notifications.html#property_ci" class="">$ci</a><br />
</section>
<section class="span4">
<em>N/A</em>
</section>
</section>
</section>
</div>
<aside class="span4 detailsbar">
<dl>
<dt>File</dt>
<dd><a href="../files/libraries.notifications.html"><div class="path-wrapper">libraries/notifications.php</div></a></dd>
<dt>Package</dt>
<dd><div class="namespace-wrapper">Default</div></dd>
<dt>Class hierarchy</dt>
<dd class="hierarchy">
<div class="namespace-wrapper">\Notifications</div>
</dd>
</dl>
<h2>Tags</h2>
<table class="table table-condensed">
<tr><td colspan="2"><em>None found</em></td></tr>
</table>
</aside>
</div>
<a id="properties" name="properties"></a>
<div class="row-fluid">
<div class="span8 content class">
<h2>Properties</h2>
</div>
<aside class="span4 detailsbar"></aside>
</div>
<div class="row-fluid">
<div class="span8 content class">
<a id="property_ci" name="property_ci" class="anchor"></a>
<article class="property">
<h3 class="private ">$ci</h3>
<pre class="signature">$ci : </pre>
<p><em></em></p>
<h4>Type</h4>
</article>
</div>
<aside class="span4 detailsbar">
<h1><i class="icon-arrow-down"></i></h1>
<dl>
</dl>
<h2>Tags</h2>
<table class="table table-condensed">
<tr><td colspan="2"><em>None found</em></td></tr>
</table>
</aside>
</div>
<a id="methods" name="methods"></a>
<div class="row-fluid">
<div class="span8 content class"><h2>Methods</h2></div>
<aside class="span4 detailsbar"></aside>
</div>
<div class="row-fluid">
<div class="span8 content class">
<a id="method___construct" name="method___construct" class="anchor"></a>
<article class="method">
<h3 class="public ">__construct()</h3>
<a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a>
<pre class="signature" style="margin-right: 54px;">__construct() </pre>
<p><em>Class Constructor</em></p>
</article>
</div>
<aside class="span4 detailsbar">
<h1><i class="icon-arrow-down"></i></h1>
<dl>
</dl>
<h2>Tags</h2>
<table class="table table-condensed">
<tr><td colspan="2"><em>None found</em></td></tr>
</table>
</aside>
</div>
<div class="row-fluid">
<div class="span8 content class">
<a id="method_send_appointment_details" name="method_send_appointment_details" class="anchor"></a>
<article class="method">
<h3 class="public ">send_appointment_details()</h3>
<a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a>
<pre class="signature" style="margin-right: 54px;">send_appointment_details(array <span class="argument">$appointment_data</span>, array <span class="argument">$provider_data</span>, array <span class="argument">$service_data</span>, <span class="argument">$customer_data</span>, array <span class="argument">$company_settings</span>, string <span class="argument">$title</span>, string <span class="argument">$message</span>, string <span class="argument">$appointment_link</span>, string <span class="argument">$receiver_address</span>) : boolean</pre>
<p><em>Send an email with the appointment details.</em></p>
<p>This email template also needs an email title and an email text in order to complete
the appointment details.</p>
<h4>Parameters</h4>
<table class="table table-condensed table-hover">
<tr>
<td>array</td>
<td>$appointment_data </td>
<td><p>Contains the appointment data.</p></td>
</tr>
<tr>
<td>array</td>
<td>$provider_data </td>
<td><p>Contains the provider data.</p></td>
</tr>
<tr>
<td>array</td>
<td>$service_data </td>
<td><p>Contains the service data.</p></td>
</tr>
<tr>
<td></td>
<td>$customer_data </td>
<td></td>
</tr>
<tr>
<td>array</td>
<td>$company_settings </td>
<td><p>Contains settings of the company. By the time the
"company_name", "company_link" and "company_email" values are required in the array.</p></td>
</tr>
<tr>
<td>string</td>
<td>$title </td>
<td><p>The email title may vary depending the receiver.</p></td>
</tr>
<tr>
<td>string</td>
<td>$message </td>
<td><p>The email message may vary depending the receiver.</p></td>
</tr>
<tr>
<td>string</td>
<td>$appointment_link </td>
<td><p>This link is going to enable the receiver to make changes
to the appointment record.</p></td>
</tr>
<tr>
<td>string</td>
<td>$receiver_address </td>
<td><p>The receiver email address.</p></td>
</tr>
</table>
<h4>Returns</h4>
boolean
&mdash; <p>Returns the operation result.</p>
</article>
</div>
<aside class="span4 detailsbar">
<h1><i class="icon-arrow-down"></i></h1>
<dl>
</dl>
<h2>Tags</h2>
<table class="table table-condensed">
<tr>
<th>
expectedException
</th>
<td>
<p>Exception Raises when an unexpected error occures.</p>
</td>
</tr>
</table>
</aside>
</div>
<div class="row-fluid">
<div class="span8 content class">
<a id="method_send_delete_appointment" name="method_send_delete_appointment" class="anchor"></a>
<article class="method">
<h3 class="public ">send_delete_appointment()</h3>
<a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a>
<pre class="signature" style="margin-right: 54px;">send_delete_appointment(array <span class="argument">$appointment_data</span>, array <span class="argument">$provider_data</span>, array <span class="argument">$service_data</span>, array <span class="argument">$customer_data</span>, array <span class="argument">$company_settings</span>, string <span class="argument">$to_address</span>, string <span class="argument">$reason</span>) </pre>
<p><em>Send an email notification to both provider and customer on appointment removal.</em></p>
<p>Whenever an appointment is cancelled or removed, both the provider and customer
need to be informed. This method sends the same email twice.</p>
<p><strong>IMPORTANT!</strong> This method's arguments should be taken
from database before the appointment record is deleted.</p>
<h4>Parameters</h4>
<table class="table table-condensed table-hover">
<tr>
<td>array</td>
<td>$appointment_data </td>
<td><p>The record data of the removed appointment.</p></td>
</tr>
<tr>
<td>array</td>
<td>$provider_data </td>
<td><p>The record data of the appointment provider.</p></td>
</tr>
<tr>
<td>array</td>
<td>$service_data </td>
<td><p>The record data of the appointment service.</p></td>
</tr>
<tr>
<td>array</td>
<td>$customer_data </td>
<td><p>The record data of the appointment customer.</p></td>
</tr>
<tr>
<td>array</td>
<td>$company_settings </td>
<td><p>Some settings that are required for this function.
By now this array must contain the following values: "company_link",
"company_name", "company_email".</p></td>
</tr>
<tr>
<td>string</td>
<td>$to_address </td>
<td><p>The email address of the email receiver.</p></td>
</tr>
<tr>
<td>string</td>
<td>$reason </td>
<td><p>The reason why the appointment is deleted.</p></td>
</tr>
</table>
</article>
</div>
<aside class="span4 detailsbar">
<h1><i class="icon-arrow-down"></i></h1>
<dl>
</dl>
<h2>Tags</h2>
<table class="table table-condensed">
<tr><td colspan="2"><em>None found</em></td></tr>
</table>
</aside>
</div>
<div class="row-fluid">
<div class="span8 content class">
<a id="method_send_password" name="method_send_password" class="anchor"></a>
<article class="method">
<h3 class="public ">send_password()</h3>
<a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a>
<pre class="signature" style="margin-right: 54px;">send_password(string <span class="argument">$password</span>, string <span class="argument">$email</span>, <span class="argument">$company_settings</span>) </pre>
<p><em>This method sends an email with the new password of a user.</em></p>
<h4>Parameters</h4>
<table class="table table-condensed table-hover">
<tr>
<td>string</td>
<td>$password </td>
<td><p>Contains the new password.</p></td>
</tr>
<tr>
<td>string</td>
<td>$email </td>
<td><p>The receiver's email address.</p></td>
</tr>
<tr>
<td></td>
<td>$company_settings </td>
<td></td>
</tr>
</table>
</article>
</div>
<aside class="span4 detailsbar">
<h1><i class="icon-arrow-down"></i></h1>
<dl>
</dl>
<h2>Tags</h2>
<table class="table table-condensed">
<tr><td colspan="2"><em>None found</em></td></tr>
</table>
</aside>
</div>
<div class="row-fluid">
<div class="span8 content class">
<a id="method_send_new_installation" name="method_send_new_installation" class="anchor"></a>
<article class="method">
<h3 class="public ">send_new_installation()</h3>
<a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a>
<pre class="signature" style="margin-right: 54px;">send_new_installation( <span class="argument">$company_name</span>, <span class="argument">$company_email</span>, <span class="argument">$company_link</span>) </pre>
<p><em>Sends a simple email to notify for a new installation.</em></p>
<p>This method will be only used for tracking the number of installations. No personal
data will be retrieved for any other cause.</p>
<h4>Parameters</h4>
<table class="table table-condensed table-hover">
<tr>
<td></td>
<td>$company_name </td>
<td></td>
</tr>
<tr>
<td></td>
<td>$company_email </td>
<td></td>
</tr>
<tr>
<td></td>
<td>$company_link </td>
<td></td>
</tr>
</table>
</article>
</div>
<aside class="span4 detailsbar">
<h1><i class="icon-arrow-down"></i></h1>
<dl>
</dl>
<h2>Tags</h2>
<table class="table table-condensed">
<tr>
<th>
returns
</th>
<td>
<p>bool Returns the "send()" method result.</p>
</td>
</tr>
</table>
</aside>
</div>
<div class="row-fluid">
<div class="span8 content class">
<a id="method_replace_template_variables" name="method_replace_template_variables" class="anchor"></a>
<article class="method">
<h3 class="private ">replace_template_variables()</h3>
<a href="#source-view" role="button" class="pull-right btn" data-toggle="modal" style="font-size: 1.1em; padding: 9px 14px"><i class="icon-code"></i></a>
<pre class="signature" style="margin-right: 54px;">replace_template_variables(array <span class="argument">$replace_array</span>, string <span class="argument">$email_html</span>) : string</pre>
<p><em>Replace the email template variables.</em></p>
<p>This method finds and replaces the html variables of an email
template. It is used to generate dynamic HTML emails that are
send as notifications to the system users.</p>
<h4>Parameters</h4>
<table class="table table-condensed table-hover">
<tr>
<td>array</td>
<td>$replace_array </td>
<td><p>Array that contains the variables
to be replaced.</p></td>
</tr>
<tr>
<td>string</td>
<td>$email_html </td>
<td><p>The email template hmtl.</p></td>
</tr>
</table>
<h4>Returns</h4>
string
&mdash; <p>Returns the new email html that contain the
variables of the $replace_array.</p>
</article>
</div>
<aside class="span4 detailsbar">
<h1><i class="icon-arrow-down"></i></h1>
<dl>
</dl>
<h2>Tags</h2>
<table class="table table-condensed">
<tr><td colspan="2"><em>None found</em></td></tr>
</table>
</aside>
</div>
</div>
</section>
<div id="source-view" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="source-view-label" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="source-view-label">notifications.php</h3>
</div>
<div class="modal-body">
<pre data-src="../files/libraries/notifications.php.txt" class="language-php line-numbers"></pre>
</div>
</div>
<footer class="row-fluid">
<section class="span10 offset2">
<section class="row-fluid">
<section class="span10 offset1">
<section class="row-fluid footer-sections">
<section class="span4">
<h1><i class="icon-code"></i></h1>
<div>
<ul>
</ul>
</div>
</section>
<section class="span4">
<h1><i class="icon-bar-chart"></i></h1>
<div>
<ul>
<li><a href="../graphs/class.html">Class Hierarchy Diagram</a></li>
</ul>
</div>
</section>
<section class="span4">
<h1><i class="icon-pushpin"></i></h1>
<div>
<ul>
<li><a href="../reports/errors.html">Errors</a></li>
<li><a href="../reports/markers.html">Markers</a></li>
</ul>
</div>
</section>
</section>
</section>
</section>
<section class="row-fluid">
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on January 21st, 2015 at 23:15.
</section>
</section>
</section>
</footer>
</div>
</body>
</html>