0byt3m1n1
Path:
/
data
/
17
/
1
/
18
/
11
/
1670011
/
user
/
1801231
/
htdocs
/
marketting
/
system
/
application
/
models
/
[
Home
]
File: modules_model.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); /* | ------------------------------------------------------------------------- | COPYRIGHT NOTICE | Copyright 2008 JROX Technologies, Inc. All Rights Reserved. | ------------------------------------------------------------------------- | This script may be only used and modified in accordance to the license | agreement attached (license.txt) except where expressly noted within | commented areas of the code body. This copyright notice and the | comments above and below must remain intact at all times. By using this | code you agree to indemnify JROX Technologies, Inc, its corporate agents | and affiliates from any liability that might arise from its use. | | Selling the code for this program without prior written consent is | expressly forbidden and in violation of Domestic and International | copyright laws. | | ------------------------------------------------------------------------- | FILENAME - modules_model.php | ------------------------------------------------------------------------- | | This model handles the functions for managing modules | */ class Modules_Model extends Model { function _add_module() { $data = $this->db_validation_model->_clean_data($_POST); $data['module_status'] = '0'; //insert into db if (!$this->db->insert('modules', $data)) { show_error($this->lang->line('could_not_add_module')); //log error log_message('error', 'Could not insert module into modules table'); return false; } else { $data['module_id'] = $this->db->insert_id(); //log success log_message('info', 'module '. $data['module_id'] . ' inserted into modules table'); } return $data; } // ------------------------------------------------------------------------ function _delete_module($id = '') { //update product modules first $data = array('post_purchase_module_id' => 0); $this->db->where('post_purchase_module_id', $id); $this->db->update('products', $data); $data = array('signup_module_id' => 0); $this->db->where('signup_module_id', $id); $this->db->update('products', $data); $data = array('expires_module_id' => 0); $this->db->where('expires_module_id', $id); $this->db->update('products', $data); //update attribute modules $data = array('attribute_options' => ''); $this->db->where('attribute_options', $id); $this->db->update('products_attributes', $data); //get the module details first $this->db->where('module_id', $id); $get = $this->db->get('modules'); $row = $get->result_array(); if (!empty($row)) { //delete from settings table $this->db->where('settings_group', $id); $this->db->where('settings_module', $row[0]['module_type']); $query = $this->db->delete('settings'); } //delete module $this->db->where('module_id', $id); if ($this->db->delete('modules')) { //log success log_message('info', 'module ID #' . $id . ' deleted successfully'); } else { show_error($this->lang->line('could_not_delete_module')); //log error log_message('error', 'module ID #' . $id . ' could not be deleted'); } return true; } // ------------------------------------------------------------------------ function _get_module_details($id = '') { //get the data from modules table $this->db->where('module_id', $id); $query = $this->db->get('modules'); if ($query->num_rows() > 0) { return $query->result_array(); } else { return false; } } // ------------------------------------------------------------------------ function _get_module_column($column = '', $value = '') { $this->db->where($column, $value); $query = $this->db->get('modules'); if ($query->num_rows() > 0) { return $query->row_array(); } return false; } // ------------------------------------------------------------------------ function _get_modules($limit = 25, $offset = 0, $sort_column = '', $sort_order = '') { //get all the admins from db for list view if (!$sort_order) $sort_order = $this->config->item('dbs_mod_order'); if (!$sort_column) $sort_column = $this->config->item('dbs_mod_column'); $this->db->order_by($sort_column, $sort_order); $query = $this->db->get('modules', $limit, $offset); if ($query->num_rows() > 0) { return $query->result_array(); } return false; } // ------------------------------------------------------------------------ function _check_module_install($type = '', $name = '') { //check if module is already installed $this->db->where('module_name', $name); $this->db->where('module_type', $type); $query = $this->db->get('modules'); if ($query->num_rows() < 1) { return true; } return false; } // ------------------------------------------------------------------------ function _run_modules($type = '') { $this->db->where('module_type', $type); $this->db->where('module_status', '1'); $query = $this->db->get('modules'); if ($query->num_rows() > 0) { $data = $query->result_array(); return $data; } return false; } // ------------------------------------------------------------------------ function _run_module($id = '') { $this->db->where('module_id', $id); $this->db->where('module_status', '1'); $query = $this->db->get('modules'); if ($query->num_rows() > 0) { $data = $query->row_array(); return $data; } return false; } // ------------------------------------------------------------------------ function _update_module($id = '') { //clean the data first $data = $this->db_validation_model->_clean_data($_POST); //update module data $this->db->where('module_id', $id); if (!$this->db->update('modules', $data)) { show_error($this->lang->line('could_not_update_module')); //log error log_message('error', 'Could not update module ID ' . $id . 'in modules table'); return false; } else { //log success log_message('info', 'module ID '. $id . ' updated in modules table'); } return true; } // ------------------------------------------------------------------------ } ?>
© 2017 -
ZeroByte.ID
.