Mobile_policy::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php defined('BASEPATH') OR exit('No direct script access allowed');
2
3
class Mobile_policy extends My_Force_Login {
4
5
    public function __construct() {
6
        parent::__construct();
7
        $this->load->library('grocery_CRUD');
8
        $this->load->model('computing-support/Mobile_policy_model', 'mobile_policy_model');
9
    }
10
11
    public function index() {
12
13
        $this->load->helper('form');
14
        $this->load->library('form_validation');
15
16
        // validation rules
17
        $this->form_validation->set_rules('mobile', 'Mobile Number', 'trim|required|numeric|min_length[11]');
18
19
        if ($this->form_validation->run() === false) {
20
21
            $this->load->view('templates/header');
22
            $this->load->view('computing-support/mobile-policy/view');
23
            $this->load->view('templates/footer');
24
        } else {
25
26
            $full_name = $this->input->post('full_name');
27
            $email = $this->input->post('email');
28
            $mobile = $this->input->post('mobile');
29
30
            if ($this->mobile_policy_model->accept($full_name, $email, $mobile)) {
31
32
                $this->email->from('[email protected]', 'Mobile Phone Policy');
33
                $this->email->to($_SESSION['ldap']['email']);
34
                $this->email->subject('Mobile Phone Policy');
35
                $this->email->message(
36
                       'Name: ' . $_SESSION['ldap']['fll_name']. '
37
                           
38
                       Has accepted the Canterbury College mobile phone policy.
39
40
                       Mobile Phone Policy
41
                        1.	Introduction
42
                        1.1	If you use or, are responsible for, a Canterbury College mobile phone, this document is important. Please ensure you read and comply with it.
43
                        1.2 	Canterbury College will provide mobile telephones for business use. These will be provided upon written (email) request, outlining the business need, to the IT Manager from the Operational Manager (budget holder) of the member of staff.
44
                        1.3	Costs of operating the mobile phone(s) provided will be re-charged to individual department(s) and must therefore be planned for annually in Business Plans/budgets.
45
46
                        2.	Legal Requirements
47
                        2.1	Driving while using a hand-held device became an offence on 1 December 2003. Examples of interactive communication functions are; Making and receiving calls, texting, accessing the internet and sending and receiving still or moving images. This includes periods when the vehicle is stationery but, the engine is running – e.g.  In standing traffic (jams). 
48
                        2.2	In addition, the Dept. for Transport has strongly advised that a driver will risk prosecution for failing to have proper control of a vehicle if the driver uses a hands-free phone when driving and there is an incident/accident. The use of any phone or similar device might justify charges of careless or dangerous driving. 
49
                        2.3	It is therefore Canterbury College Policy, taking account of 2.1 & 2.2 above, that the use of mobile phones while driving, either hand-held or hands-free models, is prohibited. All phones must be switched off whilst driving, with voicemail activated to allow messages to be left as necessary.
50
51
                        3.	Acceptable Use
52
                        3.1	All mobile phones must be purchased through the Computing Support Department, who will obtain the best value for the service required.
53
                        3.2	A responsible person is to be identified for each Canterbury College mobile phone and this person will be responsible for the safekeeping of the telephone.  The name of the responsible person must be given to the IT Manager
54
                        3.4	Loss or theft of a mobile phone must be reported to the Computing Support Team immediately to allow the account to be closed and the service stopped/phone blocked.
55
                        3.5	If the responsible person identified with the College Mobile phone leaves the post they are in and no longer requires the mobile phone, they must ensure that the IT Manager and relevant operational manager is informed.
56
                        3.6	It is the responsibility of the staff member to ensure that the phone is secure and that they use security features built into the phone, specifically pin codes to stop unauthorised use.
57
                        3.7	Private use of College business mobile phones is permitted but, the cost of all personal calls must be paid back to the College by the user, every month. You will be provided with a copy of the mobile phone bill to check your calls, declare all personal calls and costs thereof and, authorise the College to deduct that amount from your next salary. Please refer to the “paying for personal calls� procedure on the Computing Support intranet page. 
58
59
                        4.      Other Information
60
                        4.1	Members of staff should be aware of the possible health risks associated with the excessive use of mobile telephones.  Use of any mobile phone should be kept to the minimum and landlines used where possible.
61
                        4.2	Invoices for the use of Canterbury College mobile phones are to be in the name of the Canterbury College and addressed to the Computing Support Department.  The summary invoice will be submitted to the Finance Office for payment.
62
                        4.3	All costs of mobile phone provision and use will be re-charged to relevant cost centres.');
63
                $this->email->send();
64
                
65
                $this->email->from('[email protected]', 'Mobile Phone Policy');
66
                $this->email->to('[email protected]');
67
                $this->email->subject('Mobile Phone Policy Accepted');
68
                $this->email->message(
69
                       'Name: ' . $_SESSION['ldap']['full_name'] . '
70
                           
71
                       Has accepted the Canterbury College mobile phone policy.
72
                       
73
                       ' . date("d/m/Y") . ' ' . date("h:i"));
74
                $this->email->send();
75
                
76
                $function = 'mobile_policy_accepted';
77
                $this->user_model->function_log($function);
78
79
                // user created
80
                $this->load->view('templates/header');
81
                $this->load->view('computing-support/mobile-policy/complete');
82
                $this->load->view('templates/footer');
83
            } else {
84
                
85
                $function = 'mobile_policy_error';
86
                $this->user_model->function_log($function);
87
88
                $data = new stdClass();
89
                $data->error = 'There was a problem accepting the terms. Please try again.';
90
91
                // failed to create user
92
                $this->load->view('templates/header');
93
                $this->load->view('computing-support/mobile-policy/view', $data);
94
                $this->load->view('templates/footer');
95
            }
96
        }
97
    }
98
    
99
    public function accepted() {
100
        
101
        if (in_array('CN=Dashboard_Admin,OU=Dashboard_Group,OU=Intranet_Group,OU=Groups,DC=cant-col,DC=ac,DC=uk', $_SESSION['ldap']['groups']) || 
102
            in_array('CN=Dashboard_CS_NS,OU=Dashboard_Group,OU=Intranet_Group,OU=Groups,DC=cant-col,DC=ac,DC=uk', $_SESSION['ldap']['groups'])) {
103
        
104
            $crud = new grocery_CRUD();
105
            $crud->set_table('mobile_policy');
106
            $crud->set_subject('Mobile Policy', 'Mobile Policy');
107
            $crud->unset_columns('id'); 
108
            $crud->edit_fields('mobile'); 
109
            $crud->unset_add();
110
            $crud->unset_read();
111
            $output = $crud->render();
112
113
            $this->load->view('templates/header.php');
114
            $this->load->view('computing-support/mobile-policy/accepted', $output);
115
            $this->load->view('templates/footer.php');
116
            $this->load->view('templates/table_assets.php', $output);
117
            
118
        } else {
119
            redirect('permissions');
120
        }
121
        
122
    } // END user permissions
123
}
124