easyappointments/doc/code-docs/php/class-Appointments_Model.html

602 lines
13 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="ApiGen 2.8.0" />
<title>Class Appointments_Model</title>
<script type="text/javascript" src="resources/combined.js?955602237"></script>
<script type="text/javascript" src="elementlist.js?1576614342"></script>
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360" />
</head>
<body>
<div id="left">
<div id="menu">
<a href="index.html" title="Overview"><span>Overview</span></a>
<div id="groups">
</div>
<div id="elements">
<h3>Classes</h3>
<ul>
<li><a href="class-Appointments.html">Appointments</a></li>
<li class="active"><a href="class-Appointments_Model.html">Appointments_Model</a></li>
<li><a href="class-Customers_Model.html">Customers_Model</a></li>
<li><a href="class-Google.html">Google</a></li>
<li><a href="class-Providers_Model.html">Providers_Model</a></li>
<li><a href="class-Roles_Model.html">Roles_Model</a></li>
<li><a href="class-Services_Model.html">Services_Model</a></li>
<li><a href="class-Settings_Model.html">Settings_Model</a></li>
<li><a href="class-Test.html">Test</a></li>
</ul>
</div>
</div>
</div>
<div id="splitter"></div>
<div id="right">
<div id="rightInner">
<form id="search">
<input type="hidden" name="cx" value="" />
<input type="hidden" name="ie" value="UTF-8" />
<input type="text" name="q" class="text" />
<input type="submit" value="Search" />
</form>
<div id="navigation">
<ul>
<li>
<a href="index.html" title="Overview"><span>Overview</span></a>
</li>
<li class="active">
<span>Class</span> </li>
</ul>
<ul>
<li>
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
</li>
</ul>
<ul>
</ul>
</div>
<div id="content" class="class">
<h1>Class Appointments_Model</h1>
<dl class="tree">
<dd style="padding-left:0px">
CI_Model
</dd>
<dd style="padding-left:30px">
<img src="resources/inherit.png" alt="Extended by" />
<b><span>Appointments_Model</span></b>
</dd>
</dl>
<div class="info">
<b>Located at</b> <a href="source-class-Appointments_Model.html#3-332" title="Go to source code">appointments_model.php</a><br />
</div>
<table class="summary" id="methods">
<caption>Methods summary</caption>
<tr data-order="__construct" id="___construct">
<td class="attributes"><code>
public
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#___construct">#</a>
<code><a href="source-class-Appointments_Model.html#4-9" title="Go to source code">__construct</a>( )</code>
<div class="description short">
<p>Class Constructor</p>
</div>
<div class="description detailed hidden">
<p>Class Constructor</p>
</div>
</div></td>
</tr>
<tr data-order="add" id="_add">
<td class="attributes"><code>
public
integer
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_add">#</a>
<code><a href="source-class-Appointments_Model.html#11-41" title="Go to source code">add</a>( <span>array <var>$appointment_data</var></span> )</code>
<div class="description short">
<p>Add an appointment record to the database.</p>
</div>
<div class="description detailed hidden">
<p>Add an appointment record to the database.</p>
<p>This method adds a new appointment to the database. If the appointment
doesn't exists it is going to be inserted, otherwise the record is going to be
updated.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$appointment_data</var></dt>
<dd><code>array</code><br>$appointment_data Associative array with the appointment data. Each key has the
same name with the database fields.</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
<code>integer</code><br>Returns the appointments id.<br />
</div>
<h4>ExpectedException</h4>
<div class="list">
ValidationException Raises when the appointment data are invalid.<br />
DatabaseException Raises when the insert or update operation fail to complete
successfully.<br />
</div>
</div>
</div></td>
</tr>
<tr data-order="exists" id="_exists">
<td class="attributes"><code>
public
boolean
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_exists">#</a>
<code><a href="source-class-Appointments_Model.html#43-77" title="Go to source code">exists</a>( <span>array <var>$appointment_data</var></span> )</code>
<div class="description short">
<p>Check if a particular appointment record already exists.</p>
</div>
<div class="description detailed hidden">
<p>Check if a particular appointment record already exists.</p>
<p>This method checks wether the given appointment already exists in the
database. It doesn't search with the id, but by using the following fields:
"start_datetime", "end_datetime", "id_users_provider", "id_users_customer",
"id_services".</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$appointment_data</var></dt>
<dd><code>array</code><br>$appointment_data Associative array with the appointment's data. Each key has
the same name with the database fields.</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
<code>boolean</code><br>Returns wether the record exists or not.<br />
</div>
<h4>ExpectedException</h4>
<div class="list">
InvalidArgumentException When the $appointment_data array does not contain the
necessary field.<br />
</div>
</div>
</div></td>
</tr>
<tr data-order="find_record_id" id="_find_record_id">
<td class="attributes"><code>
public
integer
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_find_record_id">#</a>
<code><a href="source-class-Appointments_Model.html#119-153" title="Go to source code">find_record_id</a>( <span>array <var>$appointment_data</var></span> )</code>
<div class="description short">
<p>Find the database id of an appointment record.</p>
</div>
<div class="description detailed hidden">
<p>Find the database id of an appointment record.</p>
<p>The appointment data should include the following fields in order to get the
unique id from the database: "start_datetime", "end_datetime",
"id_users_provider", "id_users_customer", "id_services".</p>
<p>&lt;strong&gt;IMPORTANT!&lt;/strong&gt; The record must already exists in the
database, otherwise an exception is raised.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$appointment_data</var></dt>
<dd><code>array</code><br>$appointment_data Array with the appointment data. The keys of the array should
have the same names as the db fields.</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
<code>integer</code><br>Returns the db id of the record that matches the apppointment data.<br />
</div>
<h4>ExpectedException</h4>
<div class="list">
DatabaseException Raises when this method cannot find any record that matches
the given data.<br />
</div>
</div>
</div></td>
</tr>
<tr data-order="validate_data" id="_validate_data">
<td class="attributes"><code>
public
boolean
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_validate_data">#</a>
<code><a href="source-class-Appointments_Model.html#155-221" title="Go to source code">validate_data</a>( <span>array <var>$appointment_data</var></span> )</code>
<div class="description short">
<p>Validate appointment data before the insert or update operations are
executed.</p>
</div>
<div class="description detailed hidden">
<p>Validate appointment data before the insert or update operations are
executed.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$appointment_data</var></dt>
<dd><code>array</code><br>$appointment_data Contains the appointment data.</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
<code>boolean</code><br>Returns the validation result.<br />
</div>
</div>
</div></td>
</tr>
<tr data-order="delete" id="_delete">
<td class="attributes"><code>
public
boolean
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_delete">#</a>
<code><a href="source-class-Appointments_Model.html#223-247" title="Go to source code">delete</a>( <span>integer <var>$appointment_id</var></span> )</code>
<div class="description short">
<p>Delete an existing appointment record from the database.</p>
</div>
<div class="description detailed hidden">
<p>Delete an existing appointment record from the database.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$appointment_id</var></dt>
<dd><code>integer</code><br>$appointment_id The record id to be deleted.</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
<code>boolean</code><br>Returns the delete operation result.<br />
</div>
<h4>ExpectedException</h4>
<div class="list">
InvalidArgumentException Raises when the $appointment_id is not an integer.<br />
</div>
</div>
</div></td>
</tr>
<tr data-order="get_row" id="_get_row">
<td class="attributes"><code>
public
array
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_get_row">#</a>
<code><a href="source-class-Appointments_Model.html#249-264" title="Go to source code">get_row</a>( <span>integer <var>$appointment_id</var></span> )</code>
<div class="description short">
<p>Get a specific row from the appointments table.</p>
</div>
<div class="description detailed hidden">
<p>Get a specific row from the appointments table.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$appointment_id</var></dt>
<dd><code>integer</code><br>$appointment_id The record's id to be returned.</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
<code>array</code><br>Returns an associative array with the selected record's data. Each key has the
same name as the database field names.<br />
</div>
</div>
</div></td>
</tr>
<tr data-order="get_value" id="_get_value">
<td class="attributes"><code>
public
string
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_get_value">#</a>
<code><a href="source-class-Appointments_Model.html#266-299" title="Go to source code">get_value</a>( <span>string <var>$field_name</var></span>, <span>integer <var>$appointment_id</var></span> )</code>
<div class="description short">
<p>Get a specific field value from the database.</p>
</div>
<div class="description detailed hidden">
<p>Get a specific field value from the database.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$field_name</var></dt>
<dd><code>string</code><br>$field_name The field name of the value to be returned.</dd>
<dt><var>$appointment_id</var></dt>
<dd><code>integer</code><br>$appointment_id The selected record's id.</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
<code>string</code><br>Returns the records value from the database.<br />
</div>
</div>
</div></td>
</tr>
<tr data-order="get_batch" id="_get_batch">
<td class="attributes"><code>
public
array
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_get_batch">#</a>
<code><a href="source-class-Appointments_Model.html#301-316" title="Go to source code">get_batch</a>( <span>string <var>$where_clause</var> = <span class="php-quote">''</span></span> )</code>
<div class="description short">
<p>Get all, or specific records from appointment's table.</p>
</div>
<div class="description detailed hidden">
<p>Get all, or specific records from appointment's table.</p>
<h4>Parameters</h4>
<div class="list"><dl>
<dt><var>$where_clause</var></dt>
<dd><code>string</code><br>$where_clause (OPTIONAL) The WHERE clause of the query to be executed. DO NOT
INCLUDE 'WHERE' KEYWORD.</dd>
</dl></div>
<h4>Returns</h4>
<div class="list">
<code>array</code><br>Returns the rows from the database.<br />
</div>
<h4>Example</h4>
<div class="list">
$this-&gt;Model-&gt;getBatch('id = ' . $recordId);<br />
</div>
</div>
</div></td>
</tr>
<tr data-order="generate_hash" id="_generate_hash">
<td class="attributes"><code>
public
string
</code>
</td>
<td class="name"><div>
<a class="anchor" href="#_generate_hash">#</a>
<code><a href="source-class-Appointments_Model.html#318-331" title="Go to source code">generate_hash</a>( )</code>
<div class="description short">
<p>Generate a unique hash for the given appointment data.</p>
</div>
<div class="description detailed hidden">
<p>Generate a unique hash for the given appointment data.</p>
<p>This method uses the current date-time to generate a unique hash string that
is later used to identify this appointment. Hash is needed when the email is
send to the user with an edit link.</p>
<h4>Returns</h4>
<div class="list">
<code>string</code><br>Returns the unique appointment hash.<br />
</div>
</div>
</div></td>
</tr>
</table>
</div>
<div id="footer">
API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a>
</div>
</div>
</div>
</body>
</html>