<commit_before><?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
 * This is a survey module for PyroCMS
 *
 * @author 		<NAME> - PyroCMS Dev Team
 * @website		http://unruhdesigns.com
 * @package 	PyroCMS
 * @subpackage 	survey Module
 */
class survey_m extends MY_Model {

	public function __construct(){
		parent::__construct();
		
		/**
		 * If the survey module's table was named "surveys"
		 * then MY_Model would find it automatically. Since
		 * I named it "survey" then we just set the name here.
		 */
		$this->_table = 'survey';
	}

    public function get_all_survey(){
        $query = $this->db->get('survey');

        return $query->result();
    }

    public function update_survey($data){
        $survey = array(
            'name'          => $data['survey_name'],
            'description'   => $data['survey_description'],
            'modified_by'   => $data['user_id'],
            'modified_date' => time(),
        );
        $this->db->where('id', $data['survey_id']);
        return $this->db->update('survey', $survey);
    }

    public function insert_survey($data){
        $survey = array(
            'name'          => $data['survey_name'],
            'description'   => $data['survey_description'],
            'created_by'    => $data['user_id'],
            'create_date'   => time(),
        );

        return $this->db->insert('survey', $survey);
    }

// Survey finished and dpt started ===============================================================================

    public function get_all_dtp(){
        $query = $this->db->get('survey_dpt');

        return $query->result();
    }

    public function update_dpt($data){
        $dpt = array(
            'name'          => $data['dpt_name'],
            'description'   => $data['dpt_description'],
            'modified_by'   => $data['user_id'],
            'modified_date' => time(),
        );
        $this->db->where('id', $data['dpt_id']);
        return $this->db->update('survey_dpt', $dpt);
    }

    public function insert_dpt($data){
        $dpt = array(
            'name'          => $data['dpt_name'],
            'description'   => $data['dpt_description'],
            'created_by'    => $data['user_id'],
            'create_date'   => time(),
        );

        return $this->db->insert('survey_dpt', $dpt);
    }

    // dpt finished and question_categories started ===============================================================================

    public function get_all_question_categories(){
        $query = $this->db->get('survey_question_categories');

        return $query->result();
    }

    public function update_question_categories($data){
        $dpt = array(
            'name'          => $data['question_categories_name'],
            'description'   => $data['question_categories_description'],
            'modified_by'   => $data['user_id'],
            'modified_date' => time(),
        );
        $this->db->where('id', $data['question_categories_id']);
        return $this->db->update('survey_question_categories', $dpt);
    }

    public function insert_question_categories($data){
        $dpt = array(
            'name'          => $data['question_categories_name'],
            'description'   => $data['question_categories_description'],
            'created_by'    => $data['user_id'],
            'create_date'   => time(),
        );

        return $this->db->insert('survey_question_categories', $dpt);
    }

    // default options ============================================

    public function get_all_options(){
        $query = $this->db->get_where('survey_default_options', array('id'=>1));

        return $query->row();
    }

    // for managing question ==========================================

    public function get_all_questions($survey_id = ''){
        $query = $this->db->get_where('survey_questions', array('survey_id'=>$survey_id));
        return $query->result();
    }

    public function question_form_validate($data){
        $validate = true;
        foreach($data as $field=>$value){
            if($field == 'survey_id' || $field == 'user_id'){

            }else{
                if($value == ''){
                    $validate = false;
                }
            }
        }

        return $validate;
    }

    // =============================== clients ====================================

    public function get_all_clients(){
        $query = $this->db->get('survey_clients');

        return $query->result();
    }

    public function update_client($data){
        $client = array(
            'name'          => $data['client_name'],
            'modified_by'   => $data['user_id'],
            'modified_date' => time(),
        );
        $this->db->where('id', $data['client_id']);
        return $this->db->update('survey_clients', $client);
    }

    public function insert_client($data){
        $client = array(
            'name'          => $data['client_name'],
            'created_by'    => $data['user_id'],
            'create_date'   => time(),
        );

        return $this->db->insert('survey_clients', $client);
    }

}<commit_msg>add function get_all_users_by_manager<commit_after><?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
 * This is a survey module for PyroCMS
 *
 * @author 		<NAME> - PyroCMS Dev Team
 * @website		http://unruhdesigns.com
 * @package 	PyroCMS
 * @subpackage 	survey Module
 */
class survey_m extends MY_Model {

	public function __construct(){
		parent::__construct();
		
		/**
		 * If the survey module's table was named "surveys"
		 * then MY_Model would find it automatically. Since
		 * I named it "survey" then we just set the name here.
		 */
		$this->_table = 'survey';
	}

    public function get_all_survey(){
        $query = $this->db->get('survey');

        return $query->result();
    }

    public function update_survey($data){
        $survey = array(
            'name'          => $data['survey_name'],
            'description'   => $data['survey_description'],
            'modified_by'   => $data['user_id'],
            'modified_date' => time(),
        );
        $this->db->where('id', $data['survey_id']);
        return $this->db->update('survey', $survey);
    }

    public function insert_survey($data){
        $survey = array(
            'name'          => $data['survey_name'],
            'description'   => $data['survey_description'],
            'created_by'    => $data['user_id'],
            'create_date'   => time(),
        );

        return $this->db->insert('survey', $survey);
    }

// Survey finished and dpt started ===============================================================================

    public function get_all_dtp(){
        $query = $this->db->get('survey_dpt');

        return $query->result();
    }

    public function update_dpt($data){
        $dpt = array(
            'name'          => $data['dpt_name'],
            'description'   => $data['dpt_description'],
            'modified_by'   => $data['user_id'],
            'modified_date' => time(),
        );
        $this->db->where('id', $data['dpt_id']);
        return $this->db->update('survey_dpt', $dpt);
    }

    public function insert_dpt($data){
        $dpt = array(
            'name'          => $data['dpt_name'],
            'description'   => $data['dpt_description'],
            'created_by'    => $data['user_id'],
            'create_date'   => time(),
        );

        return $this->db->insert('survey_dpt', $dpt);
    }

    // dpt finished and question_categories started ===============================================================================

    public function get_all_question_categories(){
        $query = $this->db->get('survey_question_categories');

        return $query->result();
    }

    public function update_question_categories($data){
        $dpt = array(
            'name'          => $data['question_categories_name'],
            'description'   => $data['question_categories_description'],
            'modified_by'   => $data['user_id'],
            'modified_date' => time(),
        );
        $this->db->where('id', $data['question_categories_id']);
        return $this->db->update('survey_question_categories', $dpt);
    }

    public function insert_question_categories($data){
        $dpt = array(
            'name'          => $data['question_categories_name'],
            'description'   => $data['question_categories_description'],
            'created_by'    => $data['user_id'],
            'create_date'   => time(),
        );

        return $this->db->insert('survey_question_categories', $dpt);
    }

    // default options ============================================

    public function get_all_options(){
        $query = $this->db->get_where('survey_default_options', array('id'=>1));

        return $query->row();
    }

    // for managing question ==========================================

    public function get_all_questions($survey_id = ''){
        $query = $this->db->get_where('survey_questions', array('survey_id'=>$survey_id));
        return $query->result();
    }

    public function question_form_validate($data){
        $validate = true;
        foreach($data as $field=>$value){
            if($field == 'survey_id' || $field == 'user_id'){

            }else{
                if($value == ''){
                    $validate = false;
                }
            }
        }

        return $validate;
    }

    // =============================== clients ====================================

    public function get_all_clients(){
        $query = $this->db->get('survey_clients');

        return $query->result();
    }

    public function update_client($data){
        $client = array(
            'name'          => $data['client_name'],
            'modified_by'   => $data['user_id'],
            'modified_date' => time(),
        );
        $this->db->where('id', $data['client_id']);
        return $this->db->update('survey_clients', $client);
    }

    public function insert_client($data){
        $client = array(
            'name'          => $data['client_name'],
            'created_by'    => $data['user_id'],
            'create_date'   => time(),
        );

        return $this->db->insert('survey_clients', $client);
    }

    public function get_all_users_by_manager(){
        return '';
    }

}
{'fraction_non_alphanumeric': 0.2120259195730894, 'fraction_numerical': 0.0001905850962454736, 'mean_word_length': 2.3381043256997454, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 157, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2714845', 'n_tokens_mistral': 3059, 'n_tokens_neox': 2942, 'n_words': 552}