Example #1
0
 public function send_note_instantly()
 {
     if (!$this->dx_auth->is_logged_in()) {
         redirect(base_url('login'));
     }
     if ($this->dx_auth->is_admin()) {
         redirect(base_url('notes'));
     }
     if (!$this->dx_auth->is_admin() and !has_organisation()) {
         redirect(base_url('user/setup-profile'));
     }
     $view_note_template = $this->load->view('page/email/view_note', '', true);
     $this->load->model('note_model');
     $this->load->helper('function');
     $receive_all_mail = $this->note_model->get_all_email_list_for_sending_note($this->input->post('note_id'));
     //print_r($receive_all_mail);exit;
     $mail_sending_array = array();
     /*$mail_info = array(
      *      'from' => (string),
      *      'to' => (string|array),
      *      'cc' => (string|array),
      *      'bcc' => (string|array),
      *      'subject' => (string),
      *      'message' => (string),
      *      'header' => (string|array),
      *      'attachment' => (array|string)
      *  )*/
     if (is_array($receive_all_mail) and count($receive_all_mail) > 0) {
         $mail_sending_array['from'] = '*****@*****.**';
         foreach ($receive_all_mail as $mail_list) {
             $temp_mail_to['children_id'] = $mail_list['children_id'];
             if (empty($mail_list['parent_id']) or empty($mail_list['caregiver_unique_id']) or empty($mail_list['parent_email'])) {
                 $temp_mail_to['parent_fname'] = $mail_list['response_note_receiver_first_name'];
                 $temp_mail_to['parent_email'] = $mail_list['response_note_receiver_email'];
             } else {
                 $temp_mail_to['parent_email'] = $mail_list['parent_email'];
                 $temp_mail_to['parent_fname'] = $mail_list['parent_first_name'];
             }
             $temp_mail_to['public_note_view_id'] = $mail_list['response_public_view_id'];
             $temp_mail_to['note_response_id'] = $mail_list['response_id'];
             $temp_mail_to['organisation_name'] = $mail_list['organisation_name'];
             $temp_mail_to['note_title'] = $mail_list['note_title'];
             $mail_sending_array['to'][] = $temp_mail_to;
         }
         $mail_sending_array['subject'] = 'You have a new CloudeNote';
         $mail_sending_array['message'] = $view_note_template;
         //$result = send_mail( $mail_sending_array, 5 );
         if (send_mail($mail_sending_array, 5) != false) {
             echo 'true';
         } else {
             echo 'false';
         }
     } else {
         echo 'None is selected to send mail';
     }
 }
 public function add_sections()
 {
     //If the top level user has not set org name
     //they will redirect to profile editing page.
     if (!has_organisation()) {
         redirect(base_url('user/edit-profile'));
     }
     if ($this->user_info->user_access_level > 3) {
         redirect(base_url('notes'));
     }
     $data['login_user_data'] = $this->user_info;
     $this->load->library('form_validation', '', 'frm_val');
     $this->frm_val->set_rules('new_section', 'Class Name', 'trim|required|xss_clean|strip_tags|callback_is_section_exist');
     $this->frm_val->set_rules('invite_user_id', 'Teacher Name', 'trim|xss_clean');
     $data['add_class_success'] = $this->session->flashdata('add_class_success');
     $data['add_class_error'] = $this->session->flashdata('add_class_error');
     if ($this->frm_val->run() == false) {
     } else {
         $creation_info = array('section_id' => unique_id_generator(), 'section_hash_organisation_id' => md5($this->user_info->id), 'section_name' => set_value('new_section'));
         $assign_info = array();
         if ($accessible_user_info = $this->super_admin->get_user_info(set_value('invite_user_id')) and $accessible_user_info->num_rows() == '1') {
             $assign_info = array('assign_id' => unique_id_generator(), 'assign_access_id' => $accessible_user_info->row()->hashing_email);
             //print_r($accessible_user_info);exit;
         }
         $this->load->model('section_model');
         if ($this->section_model->create_section_and_assign_to($creation_info, $assign_info)) {
             $this->session->set_flashdata('add_class_success', '<div class="alert alert-success"><button type="button" class="close" data-dismiss="alert">×</button><strong>Success! </strong>Class added successfully.</div>');
         } else {
             $this->session->set_flashdata('add_class_error', '<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">×</button><strong>Error! </strong>Something went wrong. Please try again.</div>');
         }
         redirect(base_url('user/' . $this->uri->segment('2')));
     }
     $this->_render_admin('sections/add_sections', $data);
 }
Example #3
0
 public function edit_note($note_id)
 {
     if (!$this->dx_auth->is_logged_in()) {
         redirect(base_url());
     }
     if (!$this->dx_auth->is_admin() and !has_organisation()) {
         redirect(base_url('user/edit-profile'));
     }
     $data['login_user_data'] = $this->user_info;
     //I will write some code for teacher authentication.
     //If teacher have no permission for this he will redirect to his profile with warning message.
     $note_details = $this->note_model->get_note_information_by_id($note_id);
     if ($note_details->num_rows() == '0') {
         redirect(base_url('notes/'));
     }
     $data['load_drag_items'] = true;
     $note_details = $note_details->row();
     //print_r($note_details);exit;
     $ext_css_js_array = array('codeboxr_css' => array('datepicker'), 'codeboxr_js' => array('bootstrap-datepicker', 'date_picker'));
     $this->load->library('form_validation', '', 'frm_val');
     $data['note_create_error'] = $this->session->flashdata('note_create_error');
     $this->frm_val->set_rules('note_name', 'Note Name', 'trim|required|xss_clean|strip_tags|max_length[300]');
     $this->frm_val->set_rules('schedule_date', 'Schedule Date', 'trim|required|xss_clean|strip_tags');
     //$this->frm_val->set_rules('end_date', 'End Date', 'trim|required|xss_clean|strip_tags');
     //$this->frm_val->set_rules('note_details', 'Note Details', 'trim|required|xss_clean|strip_tags|max_length[5000]');
     if ($this->frm_val->run() == false) {
         $data['note_id'] = $note_id;
         $data['note_name'] = $note_details->note_name;
         $data['schedule_date'] = $note_details->note_schedule_date;
         $data['cnote_form_info'] = $note_details->note_json_form_options;
         //$data['end_date'] = $note_details->note_end_date;
         //$data['note_details'] = $note_details->note_details;
         $this->_render_admin('note/edit_note', $data, $ext_css_js_array);
     } else {
         $note_data = array('note_name' => set_value('note_name'), 'note_schedule_date' => set_value('schedule_date'));
         if ($this->note_model->update_note($note_id, $note_data)) {
             $this->session->set_flashdata('note_update_success', '<strong>Success! </strong>Note Creation success.');
             redirect(base_url('notes/'));
         } else {
             $this->session->set_flashdata('note_create_error', '<strong>Error! </strong>Something went error.');
             $this->_render_admin('note/new_note', $data, $ext_css_js_array);
         }
     }
 }
function left_side_menu($session, $permission_level = array())
{
    $access_level = $session->userdata('CN_user_access_level');
    ?>

    <li class="nav-header">Dashboard</li>

    <?php 
    if ($access_level <= '1') {
        ?>
        <li><a href="<?php 
        echo base_url('dashboard/');
        ?>
">User</a></li>
    <?php 
    }
    ?>

<?php 
    if (has_organisation() or $access_level <= '2') {
        ?>
        <?php 
        if ($access_level <= '4' and $access_level > '2') {
            ?>
                <li>
                    <a href="<?php 
            echo base_url('user/profile');
            ?>
"><?php 
            echo $session->userdata('CN_org_name');
            ?>
</a>
                    <ul class="nav nav-list">
                        <li><a href="<?php 
            echo base_url('user/students');
            ?>
">Students</a></li>
                        <li><a href="<?php 
            echo base_url('user/add-students');
            ?>
">Add Students</a></li>
                        <li><a href="<?php 
            echo base_url('user/classes');
            ?>
">Classes</a></li>
                        <?php 
            if ($access_level <= '3') {
                ?>
                            <li><a href="<?php 
                echo base_url('user/add-class');
                ?>
">Add Class</a></li>
                            <li><a href="<?php 
                echo base_url('user/teacher-list');
                ?>
">Teacher(s)</a></li>
                            <li><a href="<?php 
                echo base_url('user/invite-teacher');
                ?>
">Invite Teacher</a></li>
                        <?php 
            }
            ?>
                    </ul>
                </li>
        <?php 
        }
        ?>

        <?php 
        if ($access_level <= '4') {
            ?>
                <li>
                    <a href="<?php 
            echo base_url('notes');
            ?>
">Notes</a>
                    <ul class="nav nav-list">
                        <li><a href="<?php 
            echo base_url('notes');
            ?>
">View All</a></li>
                    <?php 
            if ($access_level >= 3) {
                ?>
                        <li><a href="<?php 
                echo base_url('notes/new');
                ?>
">Add New</a></li>
                    <?php 
            }
            ?>
                    </ul>
                </li>
        <?php 
        }
        ?>

<?php 
    } else {
        ?>
        <li class="disabled">
            <a>Organisation Name</a>
            <ul class="nav nav-list">
                <li class="disabled"><a>Add Class</a></li>
                <?php 
        if ($access_level <= '3') {
            ?>
                    <li class="disabled"><a>Invite Teacher</a></li>
                <?php 
        }
        ?>
            </ul>
        </li>
        <li class="disabled">
            <a>Notes</a>
            <ul class="nav nav-list">
                <li class="disabled"><a>View All</a></li>
                <li class="disabled"><a>Add New</a></li>
            </ul>
        </li>

<?php 
    }
}