diff --git a/application/controllers/Backend_api.php b/application/controllers/Backend_api.php
index 0e6e631a..0aede844 100755
--- a/application/controllers/Backend_api.php
+++ b/application/controllers/Backend_api.php
@@ -623,7 +623,7 @@ class Backend_api extends CI_Controller {
$key = $this->db->escape_str($this->input->post('key'));
$key = strtoupper($key);
- $where_clause =
+ $where =
'(first_name LIKE upper("%' . $key . '%") OR ' .
'last_name LIKE upper("%' . $key . '%") OR ' .
'email LIKE upper("%' . $key . '%") OR ' .
@@ -633,7 +633,16 @@ class Backend_api extends CI_Controller {
'zip_code LIKE upper("%' . $key . '%") OR ' .
'notes LIKE upper("%' . $key . '%"))';
- $customers = $this->customers_model->get_batch($where_clause);
+ $order_by = 'first_name ASC, last_name ASC';
+
+ $limit = $this->input->post('limit');
+
+ if ($limit === NULL)
+ {
+ $limit = 1000;
+ }
+
+ $customers = $this->customers_model->get_batch($where, $order_by, $limit);
foreach ($customers as &$customer)
{
diff --git a/application/language/arabic/translations_lang.php b/application/language/arabic/translations_lang.php
index 5eaac0ab..a27e01c6 100755
--- a/application/language/arabic/translations_lang.php
+++ b/application/language/arabic/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/bulgarian/translations_lang.php b/application/language/bulgarian/translations_lang.php
index 1e1298eb..42f41dbe 100755
--- a/application/language/bulgarian/translations_lang.php
+++ b/application/language/bulgarian/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/chinese/translations_lang.php b/application/language/chinese/translations_lang.php
index c12cd862..c48c58b9 100755
--- a/application/language/chinese/translations_lang.php
+++ b/application/language/chinese/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/czech/translations_lang.php b/application/language/czech/translations_lang.php
index 0673c8c1..43ec4df8 100644
--- a/application/language/czech/translations_lang.php
+++ b/application/language/czech/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/danish/translations_lang.php b/application/language/danish/translations_lang.php
index b9f07ee9..12a4236f 100755
--- a/application/language/danish/translations_lang.php
+++ b/application/language/danish/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/dutch/translations_lang.php b/application/language/dutch/translations_lang.php
index 87b1d4ba..f1db0d95 100755
--- a/application/language/dutch/translations_lang.php
+++ b/application/language/dutch/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/english/translations_lang.php b/application/language/english/translations_lang.php
index 44d76bdf..e430de13 100755
--- a/application/language/english/translations_lang.php
+++ b/application/language/english/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/finnish/translations_lang.php b/application/language/finnish/translations_lang.php
index de811ccf..c53ece9a 100755
--- a/application/language/finnish/translations_lang.php
+++ b/application/language/finnish/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/french/translations_lang.php b/application/language/french/translations_lang.php
index cd8b876f..7a7b45be 100755
--- a/application/language/french/translations_lang.php
+++ b/application/language/french/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/german/translations_lang.php b/application/language/german/translations_lang.php
index 0a96dda0..32e1e5c5 100755
--- a/application/language/german/translations_lang.php
+++ b/application/language/german/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/greek/translations_lang.php b/application/language/greek/translations_lang.php
index 331b4c64..1403767f 100755
--- a/application/language/greek/translations_lang.php
+++ b/application/language/greek/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/hindi/translations_lang.php b/application/language/hindi/translations_lang.php
index b8868c05..dd941639 100755
--- a/application/language/hindi/translations_lang.php
+++ b/application/language/hindi/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/hungarian/translations_lang.php b/application/language/hungarian/translations_lang.php
index d8c68e68..a2c18c56 100755
--- a/application/language/hungarian/translations_lang.php
+++ b/application/language/hungarian/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/italian/translations_lang.php b/application/language/italian/translations_lang.php
index be9b22f1..916edfed 100755
--- a/application/language/italian/translations_lang.php
+++ b/application/language/italian/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/japanese/translations_lang.php b/application/language/japanese/translations_lang.php
index 1adb9f99..db5045ce 100755
--- a/application/language/japanese/translations_lang.php
+++ b/application/language/japanese/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/luxembourgish/translations_lang.php b/application/language/luxembourgish/translations_lang.php
index d165ec25..75b16a30 100755
--- a/application/language/luxembourgish/translations_lang.php
+++ b/application/language/luxembourgish/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/marathi/translations_lang.php b/application/language/marathi/translations_lang.php
index b66d1ba2..a374b1b7 100644
--- a/application/language/marathi/translations_lang.php
+++ b/application/language/marathi/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/polish/translations_lang.php b/application/language/polish/translations_lang.php
index 38ea27ce..e832f462 100755
--- a/application/language/polish/translations_lang.php
+++ b/application/language/polish/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/portuguese-br/translations_lang.php b/application/language/portuguese-br/translations_lang.php
index 3a25db50..e08809e4 100755
--- a/application/language/portuguese-br/translations_lang.php
+++ b/application/language/portuguese-br/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/portuguese/translations_lang.php b/application/language/portuguese/translations_lang.php
index 78934cb5..928f138d 100755
--- a/application/language/portuguese/translations_lang.php
+++ b/application/language/portuguese/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/romanian/translations_lang.php b/application/language/romanian/translations_lang.php
index 07659acf..b4e2ea09 100755
--- a/application/language/romanian/translations_lang.php
+++ b/application/language/romanian/translations_lang.php
@@ -313,8 +313,10 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
$lang['api_token_hint'] = 'Set a secret token in order to enable the token based authentication of the Easy!Appointments API.';
$lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/russian/translations_lang.php b/application/language/russian/translations_lang.php
index 4a8b591e..b1e46bd5 100755
--- a/application/language/russian/translations_lang.php
+++ b/application/language/russian/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/slovak/translations_lang.php b/application/language/slovak/translations_lang.php
index 57347496..513b0d6e 100755
--- a/application/language/slovak/translations_lang.php
+++ b/application/language/slovak/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/spanish/translations_lang.php b/application/language/spanish/translations_lang.php
index c017f095..74ec5982 100755
--- a/application/language/spanish/translations_lang.php
+++ b/application/language/spanish/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/language/turkish/translations_lang.php b/application/language/turkish/translations_lang.php
index 5d7fd16b..68599572 100755
--- a/application/language/turkish/translations_lang.php
+++ b/application/language/turkish/translations_lang.php
@@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
+$lang['load_more'] = 'Load More';
diff --git a/application/models/Admins_model.php b/application/models/Admins_model.php
index b6f40c1d..412bfba6 100644
--- a/application/models/Admins_model.php
+++ b/application/models/Admins_model.php
@@ -406,21 +406,28 @@ class Admins_Model extends CI_Model {
/**
* Get all, or specific admin records from database.
*
- * @param string|array $where_clause (OPTIONAL) The WHERE clause of the query to be executed. Use this to get
+ * @param mixed|null $where (OPTIONAL) The WHERE clause of the query to be executed. Use this to get
* specific admin records.
- *
+ * @param mixed|null $order_by
+ * @param int|null $limit
+ * @param int|null $offset
* @return array Returns an array with admin records.
*/
- public function get_batch($where_clause = '')
+ public function get_batch($where = NULL, $order_by = NULL, $limit = NULL, $offset = NULL)
{
$role_id = $this->get_admin_role_id();
- if ($where_clause != '')
+ if ($where !== NULL)
{
- $this->db->where($where_clause);
+ $this->db->where($where);
}
- $batch = $this->db->get_where('ea_users', ['id_roles' => $role_id])->result_array();
+ if ($order_by !== NULL)
+ {
+ $this->db->order_by($order_by);
+ }
+
+ $batch = $this->db->get_where('ea_users', ['id_roles' => $role_id], $limit, $offset)->result_array();
// Get every admin settings.
foreach ($batch as &$admin)
diff --git a/application/models/Appointments_model.php b/application/models/Appointments_model.php
index 9024ba85..9e883f9d 100644
--- a/application/models/Appointments_model.php
+++ b/application/models/Appointments_model.php
@@ -340,23 +340,32 @@ class Appointments_Model extends CI_Model {
/**
* Get all, or specific records from appointment's table.
*
- * @example $this->Model->getBatch('id = ' . $recordId);
+ * Example:
*
- * @param string $where_clause (OPTIONAL) The WHERE clause of the query to be executed. DO NOT INCLUDE 'WHERE'
+ * $this->Model->getBatch('id = ' . $recordId);
+ *
+ * @param mixed|null $where (OPTIONAL) The WHERE clause of the query to be executed. DO NOT INCLUDE 'WHERE'
* KEYWORD.
- *
+ * @param mixed|null $order_by
+ * @param int|null $limit
+ * @param int|null $offset
* @param bool $aggregates (OPTIONAL) Defines whether to add aggregations or not.
*
* @return array Returns the rows from the database.
*/
- public function get_batch($where_clause = '', $aggregates = FALSE)
+ public function get_batch($where = NULL, $order_by = NULL, $limit = NULL, $offset = NULL, $aggregates = FALSE)
{
- if ($where_clause != '')
+ if ($where !== NULL)
{
- $this->db->where($where_clause);
+ $this->db->where($where);
}
- $appointments = $this->db->get('ea_appointments')->result_array();
+ if ($order_by)
+ {
+ $this->db->order_by($order_by);
+ }
+
+ $appointments = $this->db->get('ea_appointments', $limit, $offset)->result_array();
$this->load->model('timezones_model');
diff --git a/application/models/Customers_model.php b/application/models/Customers_model.php
index 111aea50..25ebecbd 100644
--- a/application/models/Customers_model.php
+++ b/application/models/Customers_model.php
@@ -339,25 +339,33 @@ class Customers_Model extends CI_Model {
/**
* Get all, or specific records from appointment's table.
*
- * @example $this->Model->getBatch('id = ' . $recordId);
+ * Example:
*
- * @param string $whereClause (OPTIONAL) The WHERE clause of the query to be executed. DO NOT INCLUDE 'WHERE'
- * KEYWORD.
+ * $this->Model->getBatch('id = ' . $recordId);
*
+ * @param mixed|null $where
+ * @param midex|null $order_by
+ * @param int|null $limit
+ * @param int|null $offset
* @return array Returns the rows from the database.
*/
- public function get_batch($where_clause = '')
+ public function get_batch($where = NULL, $order_by = NULL, $limit = NULL, $offset = NULL)
{
$customers_role_id = $this->get_customers_role_id();
- if ($where_clause != '')
+ if ($where !== NULL)
{
- $this->db->where($where_clause);
+ $this->db->where($where);
+ }
+
+ if ($order_by !== NULL)
+ {
+ $this->db->order_by($order_by);
}
$this->db->where('id_roles', $customers_role_id);
- return $this->db->get('ea_users')->result_array();
+ return $this->db->get('ea_users', $limit, $offset)->result_array();
}
/**
diff --git a/application/models/Providers_model.php b/application/models/Providers_model.php
index 0f91955e..3fc8b98b 100755
--- a/application/models/Providers_model.php
+++ b/application/models/Providers_model.php
@@ -444,27 +444,34 @@ class Providers_Model extends CI_Model {
/**
* Get all, or specific records from provider's table.
*
- * @example $this->Model->get_batch('id = ' . $recordId);
+ * Example:
*
- * @param mixed $where_clause (OPTIONAL) The WHERE clause of the query to be executed.
+ * $this->Model->get_batch('id = ' . $recordId);
*
- * NOTICE: DO NOT INCLUDE 'WHERE' KEYWORD.
*
+ * @param mixed|null $where (OPTIONAL) The WHERE clause of the query to be executed.
+ * @param mixed|null $order_by
+ * @param int|null $limit
+ * @param int|null $offset
* @return array Returns the rows from the database.
*/
- public function get_batch($where_clause = '')
+ public function get_batch($where = NULL, $order_by = NULL, $limit = NULL, $offset = NULL)
{
// CI db class may confuse two where clauses made in the same time, so
// get the role id first and then apply the get_batch() where clause.
$role_id = $this->get_providers_role_id();
- if ($where_clause != '')
+ if ($where !== NULL)
{
- $this->db->where($where_clause);
+ $this->db->where($where);
}
- $batch = $this->db->get_where('ea_users',
- ['id_roles' => $role_id])->result_array();
+ if ($order_by !== NULL)
+ {
+ $this->db->order_by($order_by);
+ }
+
+ $batch = $this->db->get('ea_users', ['id_roles' => $role_id], $limit, $offset)->result_array();
// Include each provider services and settings.
foreach ($batch as &$provider)
diff --git a/application/models/Secretaries_model.php b/application/models/Secretaries_model.php
index 38edef76..34629b78 100644
--- a/application/models/Secretaries_model.php
+++ b/application/models/Secretaries_model.php
@@ -56,8 +56,7 @@ class Secretaries_Model extends CI_Model {
if ( ! isset($secretary['id']))
{
$secretary['id'] = $this->_insert($secretary);
- }
- else
+ } else
{
$secretary['id'] = $this->_update($secretary);
}
@@ -261,7 +260,7 @@ class Secretaries_Model extends CI_Model {
}
}
- // Validate calendar view mode.
+ // Validate calendar view mode.
if (isset($secretary['settings']['calendar_view']) && ($secretary['settings']['calendar_view'] !== CALENDAR_VIEW_DEFAULT
&& $secretary['settings']['calendar_view'] !== CALENDAR_VIEW_TABLE))
{
@@ -403,22 +402,28 @@ class Secretaries_Model extends CI_Model {
/**
* Get all, or specific secretary records from database.
*
- * @param string|array $where_clause (OPTIONAL) The WHERE clause of the query to be executed. Use this to get
+ * @param mixed|null $where (OPTIONAL) The WHERE clause of the query to be executed. Use this to get
* specific secretary records.
- *
+ * @param mixed|null $order_by
+ * @param int|null $limit
+ * @param int|null $offset
* @return array Returns an array with secretary records.
*/
- public function get_batch($where_clause = '')
+ public function get_batch($where = NULL, $order_by = NULL, $limit = NULL, $offset = NULL)
{
$role_id = $this->get_secretary_role_id();
- if ($where_clause != '')
+ if ($where !== NULL)
{
- $this->db->where($where_clause);
+ $this->db->where($where);
}
- $this->db->where('id_roles', $role_id);
- $batch = $this->db->get('ea_users')->result_array();
+ if ($order_by !== NULL)
+ {
+ $this->db->order_by($order_by);
+ }
+
+ $batch = $this->db->get_where('ea_users', ['id_roles' => $role_id], $limit, $offset)->result_array();
// Include every secretary providers.
foreach ($batch as &$secretary)
diff --git a/application/models/Services_model.php b/application/models/Services_model.php
index c2327072..8ee64bde 100644
--- a/application/models/Services_model.php
+++ b/application/models/Services_model.php
@@ -311,14 +311,19 @@ class Services_Model extends CI_Model {
*
* @return array Returns the rows from the database.
*/
- public function get_batch($where_clause = NULL)
+ public function get_batch($where = NULL, $order_by = NULL, $limit = NULL, $offset = NULL)
{
- if ($where_clause != NULL)
+ if ($where !== NULL)
{
- $this->db->where($where_clause);
+ $this->db->where($where);
}
- return $this->db->get('ea_services')->result_array();
+ if ($order_by !== NULL)
+ {
+ $this->db->order_by($order_by);
+ }
+
+ return $this->db->get('ea_services', $limit, $offset)->result_array();
}
/**
@@ -430,13 +435,19 @@ class Services_Model extends CI_Model {
*
* @return array Returns an array that contains all the service category records.
*/
- public function get_all_categories($where = '')
+ public function get_all_categories($where = NULL, $order_by = NULL, $limit = NULL, $offset = NULL)
{
- if ($where !== '')
+ if ($where !== NULL)
{
$this->db->where($where);
}
- return $this->db->get('ea_service_categories')->result_array();
+
+ if ($order_by !== NULL)
+ {
+ $this->db->order_by($order_by);
+ }
+
+ return $this->db->get('ea_service_categories', $limit, $offset)->result_array();
}
/**
diff --git a/assets/js/backend_calendar_default_view.js b/assets/js/backend_calendar_default_view.js
index 1db1bcba..4f1f35cb 100755
--- a/assets/js/backend_calendar_default_view.js
+++ b/assets/js/backend_calendar_default_view.js
@@ -40,7 +40,12 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
* When the user clicks the reload button an the calendar items need to be refreshed.
*/
$('#reload-appointments').click(function () {
- $('#select-filter-item').trigger('change');
+ _refreshCalendarAppointments(
+ $calendar,
+ $selectFilterItem.val(),
+ $selectFilterItem.find('option:selected').attr('type'),
+ $calendar.fullCalendar('getView').start,
+ $calendar.fullCalendar('getView').end);
});
/**
@@ -846,6 +851,9 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
filter_type: filterType
};
+
+ $loading.css('visibility', 'hidden');
+
return $.post(url, data, function (response) {
if (!GeneralFunctions.handleAjaxExceptions(response)) {
return;
@@ -1184,7 +1192,11 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
}
});
}
- }, 'json').fail(GeneralFunctions.ajaxFailureHandler);
+ }, 'json')
+ .fail(GeneralFunctions.ajaxFailureHandler)
+ .always(function() {
+ $loading.css('visibility', '')
+ });
}
@@ -1465,16 +1477,12 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
var $selectFilterItem = $('#select-filter-item');
setInterval(function () {
- $loading.css('visibility', 'hidden');
_refreshCalendarAppointments(
$calendar,
$selectFilterItem.val(),
$selectFilterItem.find('option:selected').attr('type'),
$calendar.fullCalendar('getView').start,
- $calendar.fullCalendar('getView').end)
- .always(function () {
- $loading.css('visibility', '')
- });
+ $calendar.fullCalendar('getView').end);
}, 10000);
};
diff --git a/assets/js/backend_categories_helper.js b/assets/js/backend_categories_helper.js
index 4d2cb2d2..c4b56b6b 100644
--- a/assets/js/backend_categories_helper.js
+++ b/assets/js/backend_categories_helper.js
@@ -23,6 +23,7 @@
*/
function CategoriesHelper() {
this.filterResults = {};
+ this.filterLimit = 20;
}
/**
@@ -171,7 +172,8 @@
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_service_categories';
var postData = {
csrfToken: GlobalVariables.csrfToken,
- key: key
+ key: key,
+ limit: this.filterLimit
};
$.post(postUrl, postData, function (response) {
@@ -189,6 +191,17 @@
if (response.length === 0) {
$('#filter-categories .results').html('' + EALang.no_records_found + '');
+ } else if (response.length === this.filterLimit) {
+ $('', {
+ 'type': 'button',
+ 'class': 'well btn-block load-more text-center',
+ 'text': EALang.load_more,
+ 'click': function () {
+ this.filterLimit += 20;
+ this.filter(key, selectId, display);
+ }.bind(this)
+ })
+ .appendTo('#filter-categories .results');
}
if (selectId !== undefined) {
diff --git a/assets/js/backend_customers_helper.js b/assets/js/backend_customers_helper.js
index 121e2bca..234b4b39 100644
--- a/assets/js/backend_customers_helper.js
+++ b/assets/js/backend_customers_helper.js
@@ -22,6 +22,7 @@
*/
function CustomersHelper() {
this.filterResults = {};
+ this.filterLimit = 20;
}
/**
@@ -36,6 +37,7 @@
$('#filter-customers form').submit(function (event) {
var key = $('#filter-customers .key').val();
$('#filter-customers .selected').removeClass('selected');
+ instance.filterLimit = 20;
instance.resetForm();
instance.filter(key);
return false;
@@ -46,6 +48,7 @@
*/
$('#filter-customers .clear').click(function () {
$('#filter-customers .key').val('');
+ instance.filterLimit = 20;
instance.filter('');
instance.resetForm();
});
@@ -355,7 +358,8 @@
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_customers';
var postData = {
csrfToken: GlobalVariables.csrfToken,
- key: key
+ key: key,
+ limit: this.filterLimit
};
$.post(postUrl, postData, function (response) {
@@ -370,8 +374,20 @@
var html = this.getFilterHtml(customer);
$('#filter-customers .results').append(html);
}.bind(this));
+
if (response.length == 0) {
$('#filter-customers .results').html('' + EALang.no_records_found + '');
+ } else if (response.length === this.filterLimit) {
+ $('', {
+ 'type': 'button',
+ 'class': 'well btn-block load-more text-center',
+ 'text': EALang.load_more,
+ 'click': function () {
+ this.filterLimit += 20;
+ this.filter(key, selectId, display);
+ }.bind(this)
+ })
+ .appendTo('#filter-customers .results');
}
if (selectId != undefined) {
diff --git a/assets/js/backend_services_helper.js b/assets/js/backend_services_helper.js
index 614ad112..1e312ade 100644
--- a/assets/js/backend_services_helper.js
+++ b/assets/js/backend_services_helper.js
@@ -22,6 +22,7 @@
*/
function ServicesHelper() {
this.filterResults = {};
+ this.filterLimit = 20;
}
ServicesHelper.prototype.bindEventHandlers = function () {
@@ -311,7 +312,8 @@
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_services';
var postData = {
csrfToken: GlobalVariables.csrfToken,
- key: key
+ key: key,
+ limit: this.filterLimit
};
$.post(postUrl, postData, function (response) {
@@ -329,6 +331,17 @@
if (response.length === 0) {
$('#filter-services .results').html('' + EALang.no_records_found + '');
+ } else if (response.length === this.filterLimit) {
+ $('', {
+ 'type': 'button',
+ 'class': 'well btn-block load-more text-center',
+ 'text': EALang.load_more,
+ 'click': function () {
+ this.filterLimit += 20;
+ this.filter(key, selectId, display);
+ }.bind(this)
+ })
+ .appendTo('#filter-services .results');
}
if (selectId !== undefined) {
diff --git a/assets/js/backend_users_admins.js b/assets/js/backend_users_admins.js
index 8388295e..573468b1 100644
--- a/assets/js/backend_users_admins.js
+++ b/assets/js/backend_users_admins.js
@@ -22,6 +22,7 @@
*/
var AdminsHelper = function () {
this.filterResults = []; // Store the results for later use.
+ this.filterLimit = 20;
};
/**
@@ -351,7 +352,8 @@
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_admins';
var postData = {
csrfToken: GlobalVariables.csrfToken,
- key: key
+ key: key,
+ limit: this.filterLimit
};
$.post(postUrl, postData, function (response) {
@@ -369,6 +371,17 @@
if (response.length == 0) {
$('#filter-admins .results').html('' + EALang.no_records_found + '')
+ } else if (response.length === this.filterLimit) {
+ $('', {
+ 'type': 'button',
+ 'class': 'well btn-block load-more text-center',
+ 'text': EALang.load_more,
+ 'click': function () {
+ this.filterLimit += 20;
+ this.filter(key, selectId, display);
+ }.bind(this)
+ })
+ .appendTo('#filter-admins .results');
}
if (selectId != undefined) {
diff --git a/assets/js/backend_users_providers.js b/assets/js/backend_users_providers.js
index 826ea3dc..c8974681 100755
--- a/assets/js/backend_users_providers.js
+++ b/assets/js/backend_users_providers.js
@@ -24,6 +24,7 @@
*/
var ProvidersHelper = function () {
this.filterResults = {}; // Store the results for later use.
+ this.filterLimit = 20;
};
/**
@@ -450,7 +451,8 @@
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_providers';
var postData = {
csrfToken: GlobalVariables.csrfToken,
- key: key
+ key: key,
+ limit: this.filterLimit
};
$.post(postUrl, postData, function (response) {
@@ -468,6 +470,17 @@
if (response.length == 0) {
$('#filter-providers .results').html('' + EALang.no_records_found + '')
+ } else if (response.length === this.filterLimit) {
+ $('', {
+ 'type': 'button',
+ 'class': 'well btn-block load-more text-center',
+ 'text': EALang.load_more,
+ 'click': function () {
+ this.filterLimit += 20;
+ this.filter(key, selectId, display);
+ }.bind(this)
+ })
+ .appendTo('#filter-providers .results');
}
if (selectId != undefined) {
diff --git a/assets/js/backend_users_secretaries.js b/assets/js/backend_users_secretaries.js
index bf63e4e6..c3c0bb74 100644
--- a/assets/js/backend_users_secretaries.js
+++ b/assets/js/backend_users_secretaries.js
@@ -24,6 +24,7 @@
*/
var SecretariesHelper = function () {
this.filterResults = {}; // Store the results for later use.
+ this.filterLimit = 20;
};
/**
@@ -375,7 +376,8 @@
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_secretaries';
var postData = {
csrfToken: GlobalVariables.csrfToken,
- key: key
+ key: key,
+ limit: this.filterLimit
};
$.post(postUrl, postData, function (response) {
@@ -393,6 +395,17 @@
if (response.length == 0) {
$('#filter-secretaries .results').html('' + EALang.no_records_found + '')
+ } else if (response.length === this.filterLimit) {
+ $('', {
+ 'type': 'button',
+ 'class': 'well btn-block load-more text-center',
+ 'text': EALang.load_more,
+ 'click': function () {
+ this.filterLimit += 20;
+ this.filter(key, selectId, display);
+ }.bind(this)
+ })
+ .appendTo('#filter-secretaries .results');
}
if (selectId != undefined) {