Add sample service and provider after the installation completes successfully.
This commit is contained in:
parent
2953b3e492
commit
e69f7ca634
2 changed files with 62 additions and 0 deletions
|
@ -100,6 +100,16 @@ class Installation extends CI_Controller {
|
||||||
$this->settings_model->set_setting('company_email', $company['company_email']);
|
$this->settings_model->set_setting('company_email', $company['company_email']);
|
||||||
$this->settings_model->set_setting('company_link', $company['company_link']);
|
$this->settings_model->set_setting('company_link', $company['company_link']);
|
||||||
|
|
||||||
|
// Create sample records.
|
||||||
|
$this->load->model('services_model');
|
||||||
|
$this->load->model('providers_model');
|
||||||
|
|
||||||
|
$sample_service = get_sample_service();
|
||||||
|
$sample_service['id'] = $this->services_model->add($sample_service);
|
||||||
|
$sample_provider = get_sample_provider();
|
||||||
|
$sample_provider['services'][] = $sample_service['id'];
|
||||||
|
$this->providers_model->add($sample_provider);
|
||||||
|
|
||||||
echo json_encode(AJAX_SUCCESS);
|
echo json_encode(AJAX_SUCCESS);
|
||||||
|
|
||||||
} catch (Exception $exc) {
|
} catch (Exception $exc) {
|
||||||
|
|
|
@ -1,5 +1,16 @@
|
||||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* Easy!Appointments - Open Source Web Scheduler
|
||||||
|
*
|
||||||
|
* @package EasyAppointments
|
||||||
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||||
|
* @copyright Copyright (c) 2013 - 2015, Alex Tselegidis
|
||||||
|
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||||
|
* @link http://easyappointments.org
|
||||||
|
* @since v1.1.0
|
||||||
|
* ---------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if Easy!Appointments is installed.
|
* Check if Easy!Appointments is installed.
|
||||||
*
|
*
|
||||||
|
@ -16,3 +27,44 @@ function is_ea_installed() {
|
||||||
$ci =& get_instance();
|
$ci =& get_instance();
|
||||||
return $ci->db->table_exists('ea_users');
|
return $ci->db->table_exists('ea_users');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the data of a sample service.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function get_sample_service() {
|
||||||
|
return array(
|
||||||
|
'name' => 'Test Service',
|
||||||
|
'duration' => 30,
|
||||||
|
'price' => 50.0,
|
||||||
|
'currency' => 'Euro',
|
||||||
|
'description' => 'This is a test service automatically inserted by the installer.',
|
||||||
|
'id_service_categories' => NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the data of a sample provider.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function get_sample_provider() {
|
||||||
|
return array(
|
||||||
|
'first_name' => 'John',
|
||||||
|
'last_name' => 'Doe',
|
||||||
|
'email' => 'john@doe.com',
|
||||||
|
'phone_number' => '0123456789',
|
||||||
|
'services' => array(),
|
||||||
|
'settings' => array(
|
||||||
|
'username' => 'johndoe',
|
||||||
|
'password' => '59fe9d073a9c3c606a7e01e402dca4b49b6aa517bd0fdf940c46cb13a7b63dd0',
|
||||||
|
'salt' => 'dc5570debc71fc1fe94b1b0aee444fcde5b8cb83d62a6a2b736ead6557d7a2e1',
|
||||||
|
'working_plan' => '{"monday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"tuesday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"wednesday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"thursday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"friday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"saturday":null,"sunday":null}',
|
||||||
|
'notifications' => FALSE,
|
||||||
|
'google_sync' => FALSE,
|
||||||
|
'sync_past_days' => 5,
|
||||||
|
'sync_future_days' => 5
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue