本文整理汇总了PHP中Query_helper类的典型用法代码示例。如果您正苦于以下问题:PHP Query_helper类的具体用法?PHP Query_helper怎么用?PHP Query_helper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Query_helper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: system_edit
private function system_edit()
{
if ($this->permissions['edit']) {
$user = User_helper::get_user();
$id = $user->id;
$uisc_id = $user->uisc_id;
$this->current_action = 'edit';
$ajax['status'] = true;
$data = array();
$data['title'] = $this->lang->line("EDIT_PROFILE");
$data['uisc_detail'] = $this->Profile_view_model->get_uisc_info($id, $uisc_id);
$data['secretary'] = $this->Profile_view_model->get_secretary_info($id, $uisc_id);
$data['chairmen_info'] = Query_helper::get_info($this->config->item('table_entrepreneur_chairmen_info'), '*', array('uisc_id =' . $uisc_id), 1);
$data['entrepreneur_info'] = Query_helper::get_info($this->config->item('table_entrepreneur_infos'), '*', array('user_id =' . $id, 'uisc_id =' . $uisc_id), 1);
$data['education_info'] = Query_helper::get_info($this->config->item('table_entrepreneur_education'), '*', array('user_id =' . $id, 'uisc_id =' . $uisc_id), 1);
$data['training_info'] = Query_helper::get_info($this->config->item('table_training'), '*', array('user_id =' . $id, 'uisc_id =' . $uisc_id), 0);
$data['investment_info'] = Query_helper::get_info($this->config->item('table_investment'), '*', array('user_id =' . $id, 'uisc_id =' . $uisc_id), 1);
$data['location_info'] = Query_helper::get_info($this->config->item('table_center_location'), '*', array('user_id =' . $id, 'uisc_id =' . $uisc_id), 1);
$data['resources_info'] = Query_helper::get_info($this->config->item('table_uisc_resources'), '*', array('user_id =' . $id, 'uisc_id =' . $uisc_id), 0);
$data['device_info'] = Query_helper::get_info($this->config->item('table_device_infos'), '*', array('user_id =' . $id, 'uisc_id =' . $uisc_id), 1);
$data['electricity_info'] = Query_helper::get_info($this->config->item('table_electricity'), '*', array('user_id =' . $id, 'uisc_id =' . $uisc_id), 1);
$data['resources'] = $this->Profile_view_model->get_resource_info($id, $uisc_id);
$ajax['system_content'][] = array("id" => "#system_wrapper_top_menu", "html" => $this->load_view("top_menu", "", true));
$ajax['system_content'][] = array("id" => "#system_wrapper", "html" => $this->load_view("profile/profile_view/system_add_edit", $data, true));
if ($this->message) {
$ajax['system_message'] = $this->message;
}
$ajax['system_page_url'] = $this->get_encoded_url('profile/profile_view/index/edit/' . $id);
$this->jsonReturn($ajax);
} else {
$ajax['status'] = true;
$ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
$this->jsonReturn($ajax);
}
}
示例2: login
public function login()
{
$user = User_helper::get_user();
if ($user) {
$this->dashboard_page();
} else {
if ($this->input->post()) {
if (User_helper::login($this->input->post("username"), $this->input->post("password"))) {
$user = User_helper::get_user();
$user_info['user_id'] = $user->id;
$user_info['login_time'] = time();
$user_info['ip_address'] = $this->input->ip_address();
$user_info['request_headers'] = json_encode($this->input->request_headers());
Query_helper::add($this->config->item('table_user_login_history'), $user_info);
$this->dashboard_page($this->lang->line("MSG_LOGIN_SUCCESS"));
} else {
$ajax['status'] = false;
$ajax['system_message'] = $this->lang->line("MSG_USERNAME_PASSWORD_INVALID");
$this->jsonReturn($ajax);
}
} else {
$this->login_page();
//login page view
}
}
}
示例3: user_info
public function user_info()
{
$id = $_POST['id'];
$data['users'] = Query_helper::get_info($this->config->item('table_users'), '*', array('status = ' . $this->config->item('STATUS_ACTIVE'), "id = " . $id), 1);
$ajax['system_content'][] = array("id" => "#user_model_body", "html" => $this->load_view("common/user_info", $data, true));
$this->jsonReturn($ajax);
}
示例4: dcms_save
private function dcms_save()
{
$user = User_helper::get_user();
$data = array();
if (!$this->check_validation()) {
$ajax['status'] = false;
$ajax['system_message'] = $this->message;
$this->jsonReturn($ajax);
} else {
$data['suggestion'] = $this->input->post('suggestion');
$data['date'] = date('Y-m-d');
$data['uisc_id'] = $user->uisc_id;
$data['created'] = $user->id;
$data['user_id'] = $user->id;
$this->db->trans_start();
//DB Transaction Handle START
Query_helper::add($this->config->item('table_suggestion'), $data);
$this->db->trans_complete();
//DB Transaction Handle END
if ($this->db->trans_status() === TRUE) {
$this->message = $this->lang->line("MSG_CREATE_SUCCESS");
$this->dcms_add();
} else {
$ajax['status'] = false;
$ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
$this->jsonReturn($ajax);
}
}
}
示例5: get_product_list_by_category
public function get_product_list_by_category()
{
$category_id = $this->input->post('category_id');
$products = Query_helper::get_info($this->config->item('table_product'), array('product_name value', 'product_name text'), array('category_id=' . $category_id), 0, 0, 'product_name');
$ajax['status'] = true;
$ajax['system_content'][] = array("id" => "#product_name", "html" => $this->load_view("dropdown", array('drop_down_options' => $products), true));
$this->jsonReturn($ajax);
}
示例6: get_municipal_ward
public function get_municipal_ward()
{
$zilla_id = $this->input->post('zilla_id');
$municipal_id = $this->input->post('municipal_id');
$municipal_wards = Query_helper::get_info($this->config->item('table_municipal_wards'), array('wardid value', 'wardname text'), array('visible = 1', 'zillaid = ' . $zilla_id, 'municipalid = ' . $municipal_id));
$ajax['status'] = true;
$ajax['system_content'][] = array("id" => "#user_municipal_ward_id", "html" => $this->load_view("dropdown", array('drop_down_options' => $municipal_wards), true));
$this->jsonReturn($ajax);
}
示例7: system_save
private function system_save()
{
$user = User_helper::get_user();
$id = $this->input->post("id");
if ($id > 0) {
if (!$this->permissions['edit']) {
$ajax['status'] = false;
$ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
$this->jsonReturn($ajax);
die;
}
} else {
if (!$this->permissions['add']) {
$ajax['status'] = false;
$ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
$this->jsonReturn($ajax);
die;
}
}
if (!$this->check_validation()) {
$ajax['status'] = false;
$ajax['system_message'] = $this->message;
$this->jsonReturn($ajax);
} else {
$userDetail = array();
$userDetail['ques_id'] = $this->input->post('ques_id');
$userDetail['ques_ans'] = $this->input->post('ques_ans');
if ($id > 0) {
$userDetail['update_by'] = $user->id;
$userDetail['update_date'] = time();
$this->db->trans_start();
//DB Transaction Handle START
Query_helper::update($this->config->item('table_users'), $userDetail, array("id = " . $id));
$this->db->trans_complete();
//DB Transaction Handle END
if ($this->db->trans_status() === TRUE) {
$this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
$save_and_new = $this->input->post('system_save_new_status');
if ($save_and_new == 1) {
$this->system_edit();
} else {
$this->system_edit();
}
} else {
$ajax['status'] = false;
$ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
$this->jsonReturn($ajax);
}
} else {
$ajax['status'] = false;
$ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
$this->jsonReturn($ajax);
}
}
}
示例8: index
public function index()
{
$user = User_helper::get_user();
$data['divisions'] = array();
$data['display_divisions'] = false;
$data['default_divisions'] = true;
$data['zillas'] = array();
$data['display_zillas'] = false;
$data['default_zillas'] = true;
$data['upazilas'] = array();
$data['display_upazilas'] = false;
$data['default_upazilas'] = true;
$data['unions'] = array();
$data['display_unions'] = false;
$data['default_unions'] = true;
if ($user->user_group_id == $this->config->item('SUPER_ADMIN_GROUP_ID') || $user->user_group_id == $this->config->item('A_TO_I_GROUP_ID') || $user->user_group_id == $this->config->item('DONOR_GROUP_ID') || $user->user_group_id == $this->config->item('MINISTRY_GROUP_ID')) {
$data['divisions'] = Query_helper::get_info($this->config->item('table_divisions'), array('divid value', 'divname text'), array());
$data['display_divisions'] = true;
$data['default_divisions'] = true;
} else {
$data['divisions'] = Query_helper::get_info($this->config->item('table_divisions'), array('divid value', 'divname text'), array('divid =' . $user->division));
$data['display_divisions'] = true;
$data['default_divisions'] = false;
$data['display_zillas'] = true;
if ($user->user_group_id == $this->config->item('DIVISION_GROUP_ID')) {
$data['zillas'] = Query_helper::get_info($this->config->item('table_zillas'), array('zillaid value', 'zillaname text'), array('visible = 1', 'divid = ' . $user->division));
$data['default_zillas'] = true;
$data['display_upazilas'] = false;
} else {
$data['zillas'] = Query_helper::get_info($this->config->item('table_zillas'), array('zillaid value', 'zillaname text'), array('visible = 1', 'divid = ' . $user->division, 'zillaid =' . $user->zilla));
$data['default_zillas'] = false;
$data['display_upazilas'] = true;
if ($user->user_group_id == $this->config->item('DISTRICT_GROUP_ID')) {
$data['upazilas'] = Query_helper::get_info($this->config->item('table_upazilas'), array('upazilaid value', 'upazilaname text'), array('visible = 1', 'zillaid = ' . $user->zilla));
$data['default_upazilas'] = true;
//$data['display_unions']=true;
} else {
$data['upazilas'] = Query_helper::get_info($this->config->item('table_upazilas'), array('upazilaid value', 'upazilaname text'), array('visible = 1', 'zillaid = ' . $user->zilla, 'upazilaid = ' . $user->upazila));
$data['default_upazilas'] = false;
$data['display_unions'] = true;
$data['unions'] = Query_helper::get_info($this->config->item('table_unions'), array('unionid value', 'unionname text'), array('visible = 1', 'zillaid = ' . $user->zilla, 'upazilaid=' . $user->upazila));
$data['default_unions'] = true;
//TODO
//increase report menu for union users
}
}
}
$ajax['status'] = true;
$data['title'] = $this->lang->line("REPORT_UISC_REGISTRATION_TITLE");
$ajax['system_content'][] = array("id" => "#system_wrapper_top_menu", "html" => $this->load_view("top_menu", "", true));
$ajax['system_content'][] = array("id" => "#system_wrapper", "html" => $this->load_view("report/registered_union_list", $data, true));
$ajax['system_page_url'] = $this->get_encoded_url('report/registered_union_list');
$this->jsonReturn($ajax);
}
示例9: index
public function index()
{
$user = User_helper::get_user();
$data['divisions'] = array();
$data['display_divisions'] = false;
$data['default_divisions'] = true;
$data['zillas'] = array();
$data['display_zillas'] = false;
$data['default_zillas'] = true;
$data['municipal'] = array();
$data['display_city_corporation'] = false;
$data['default_city_corporation'] = true;
$data['city_corporation_ward'] = array();
$data['display_city_corporation_ward'] = false;
$data['default_city_corporation_ward'] = true;
if ($user->user_group_level == $this->config->item('SUPER_ADMIN_GROUP_ID') || $user->user_group_level == $this->config->item('A_TO_I_GROUP_ID') || $user->user_group_level == $this->config->item('DONOR_GROUP_ID') || $user->user_group_level == $this->config->item('MINISTRY_GROUP_ID')) {
$data['divisions'] = Query_helper::get_info($this->config->item('table_divisions'), array('divid value', 'divname text'), array());
$data['display_divisions'] = true;
$data['default_divisions'] = true;
} else {
$data['divisions'] = Query_helper::get_info($this->config->item('table_divisions'), array('divid value', 'divname text'), array('divid =' . $user->division));
$data['display_divisions'] = true;
$data['default_divisions'] = false;
$data['display_zillas'] = true;
if ($user->user_group_level == $this->config->item('DIVISION_GROUP_ID')) {
$data['zillas'] = Query_helper::get_info($this->config->item('table_zillas'), array('zillaid value', 'zillaname text'), array('visible = 1', 'divid = ' . $user->division));
$data['default_zillas'] = true;
$data['display_city_corporation'] = false;
} else {
$data['zillas'] = Query_helper::get_info($this->config->item('table_zillas'), array('zillaid value', 'zillaname text'), array('visible = 1', 'divid = ' . $user->division, 'zillaid =' . $user->zilla));
$data['default_zillas'] = false;
$data['display_city_corporation'] = true;
if ($user->user_group_level == $this->config->item('DISTRICT_GROUP_ID')) {
$data['city_corporations'] = Query_helper::get_info($this->config->item('table_city_corporations'), array('citycorporationid value', 'citycorporationname text'), array('visible = 1', 'zillaid = ' . $user->zilla, 'divid=' . $user->division));
$data['default_city_corporation'] = true;
//$data['display_unions']=true;
} else {
$data['city_corporations'] = Query_helper::get_info($this->config->item('table_city_corporations'), array('citycorporationid value', 'citycorporationname text'), array('visible = 1', 'zillaid = ' . $user->zilla, 'divid=' . $user->division, 'citycorporationid=' . $user->citycorporation));
$data['default_city_corporation'] = false;
$data['display_city_corporation_ward'] = true;
$data['city_corporation_words'] = Query_helper::get_info($this->config->item('table_city_corporation_wards'), array('citycorporationwardid value', 'wardname text'), array('visible = 1', 'zillaid = ' . $user->zilla, 'divid=' . $user->division, 'citycorporationid = ' . $user->citycorporation));
$data['default_city_corporation_ward'] = true;
//TODO
//increase report menu for union users
}
}
}
$ajax['status'] = true;
$data['title'] = $this->lang->line("REPORT_COUNTRY_WISE_CITY_CORPORATION_MONTHLY_INCOME_TITLE");
$ajax['system_content'][] = array("id" => "#system_wrapper_top_menu", "html" => $this->load_view("top_menu", "", true));
$ajax['system_content'][] = array("id" => "#system_wrapper", "html" => $this->load_view("report/country_wise_city_corporation_monthly_income_list", $data, true));
$ajax['system_page_url'] = $this->get_encoded_url('report/country_wise_city_corporation_monthly_income_list');
$this->jsonReturn($ajax);
}
示例10: index
public function index()
{
$user = User_helper::get_user();
$data['divisions'] = array();
$data['display_divisions'] = false;
$data['default_divisions'] = true;
$data['zillas'] = array();
$data['display_zillas'] = false;
$data['default_zillas'] = true;
$data['municipal'] = array();
$data['display_municipal'] = false;
$data['default_municipal'] = true;
$data['municipal_ward'] = array();
$data['display_municipal_ward'] = false;
$data['default_municipal_ward'] = true;
if ($user->user_group_level == $this->config->item('SUPER_ADMIN_GROUP_ID') || $user->user_group_level == $this->config->item('A_TO_I_GROUP_ID') || $user->user_group_level == $this->config->item('DONOR_GROUP_ID') || $user->user_group_level == $this->config->item('MINISTRY_GROUP_ID')) {
$data['divisions'] = Query_helper::get_info($this->config->item('table_divisions'), array('divid value', 'divname text'), array());
$data['display_divisions'] = true;
$data['default_divisions'] = true;
} else {
$data['divisions'] = Query_helper::get_info($this->config->item('table_divisions'), array('divid value', 'divname text'), array('divid =' . $user->division));
$data['display_divisions'] = true;
$data['default_divisions'] = false;
$data['display_zillas'] = true;
if ($user->user_group_level == $this->config->item('DIVISION_GROUP_ID')) {
$data['zillas'] = Query_helper::get_info($this->config->item('table_zillas'), array('zillaid value', 'zillaname text'), array('visible = 1', 'divid = ' . $user->division));
$data['default_zillas'] = true;
$data['display_municipal'] = false;
} else {
$data['zillas'] = Query_helper::get_info($this->config->item('table_zillas'), array('zillaid value', 'zillaname text'), array('visible = 1', 'divid = ' . $user->division, 'zillaid =' . $user->zilla));
$data['default_zillas'] = false;
$data['display_municipal'] = true;
if ($user->user_group_level == $this->config->item('DISTRICT_GROUP_ID')) {
$data['municipals'] = Query_helper::get_info($this->config->item('table_municipals'), array('municipalid value', 'municipalname text'), array('visible = 1', 'zillaid = ' . $user->zilla));
$data['default_municipal'] = true;
//$data['display_unions']=true;
} else {
$data['municipals'] = Query_helper::get_info($this->config->item('table_municipals'), array('municipalid value', 'municipalname text'), array('visible = 1', 'zillaid = ' . $user->zilla, 'municipalid = ' . $user->municipal));
$data['default_municipal'] = false;
$data['display_municipal_ward'] = true;
$data['municipal_wards'] = Query_helper::get_info($this->config->item('table_municipal_wards'), array('wardid value', 'wardname text'), array('visible = 1', 'zillaid = ' . $user->zilla, 'municipalid = ' . $user->municipal));
$data['default_municipal_ward'] = true;
//TODO
//increase report menu for union users
}
}
}
$ajax['status'] = true;
//$data['title']=$this->lang->line("REPORT_CABINET_MUNICIPAL_SERVICE_HOLDER_INCOME_TITLE");
//$ajax['system_content'][]=array("id"=>"#system_wrapper_top_menu","html"=>$this->load_view("top_menu","",true));
$ajax['system_content'][] = array("id" => "#go_location", "html" => $this->load_view("report/cabinet/cabinet_municipal_service_holder_income_list", $data, true));
//$ajax['system_page_url']=$this->get_encoded_url('report/cabinet/cabinet_municipal_service_holder_income_list');
$this->jsonReturn($ajax);
}
示例11: dcms_list
private function dcms_list()
{
if ($this->permissions['list']) {
$this->current_action = 'list';
$ajax['status'] = true;
//$ajax['system_content'][] = array("id" => "#system_wrapper_top_menu", "html" => $this->load_view("top_menu", "", true));
$data['services'] = Query_helper::get_info($this->config->item('table_api_services'), '*', array('status =1'));
$ajax['system_content'][] = array("id" => "#system_wrapper", "html" => $this->load_view("esheba_management/external_service/list", $data, true));
//approval/entrepreneur_approval/dcms_list
if ($this->message) {
$ajax['system_message'] = $this->message;
}
$ajax['system_page_url'] = $this->get_encoded_url('esheba_management/services/index/list');
//approval/Entrepreneur_approval
$ajax['system_page_title'] = $this->lang->line("SERVICES");
$this->jsonReturn($ajax);
} else {
$ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
$this->jsonReturn($ajax);
}
}
示例12: index
public function index($service_id)
{
$user = User_helper::get_user();
$time = time();
$service_info = Query_helper::get_info($this->config->item('table_api_services'), '*', array('status =1', 'id =' . $service_id), 1);
if ($service_info) {
$data['auth_token'] = random_string('unique') . $time;
$data['user_id'] = $user->id;
$data['service_id'] = $service_id;
$data['time'] = $time;
$data['status'] = 1;
$id = Query_helper::add($this->config->item('table_api_auth_token'), $data);
if ($id) {
redirect($service_info['service_url'] . $data['auth_token'], 'refresh');
} else {
echo "Unable to save data";
}
} else {
echo "invalid service";
}
}
示例13: upload_excel_file
//.........这里部分代码省略.........
$invoice_data['upazilaid'] = $upazila;
$invoice_data['zillaid'] = $zilla;
$invoice_data['divid'] = $division;
$invoice_data['type'] = $user_group_id;
$invoice_data['invoice_date'] = $invoice_date;
$invoice_data['total_income'] = $total_income;
$invoice_data['total_service'] = $total_services;
$invoice_data['total_men'] = $total_men;
$invoice_data['total_women'] = $total_women;
$invoice_data['total_tribe'] = $total_tribe;
$invoice_data['total_disability'] = $total_disability;
$zilla_invoice_data['uisc_id'] = $uisc_id;
$zilla_invoice_data['unionid'] = $unioun;
$zilla_invoice_data['municipalid'] = $municipal;
$zilla_invoice_data['citycorporationid'] = $citycorporation;
$zilla_invoice_data['upazilaid'] = $upazila;
$zilla_invoice_data['zillaid'] = $zilla;
$zilla_invoice_data['divid'] = $division;
$zilla_invoice_data['type'] = $user_group_id;
$zilla_invoice_data['invoice_date'] = $invoice_date;
$zilla_invoice_data['total_income'] = $total_income;
$zilla_invoice_data['total_service'] = $total_services;
$zilla_invoice_data['total_men'] = $total_men;
$zilla_invoice_data['total_women'] = $total_women;
// echo $zilla_table_invoice;
// print_r($zilla_invoice_data);exit;
if (!$check_income) {
if ($total_services > 0) {
$this->db->trans_start();
//DB Transaction Handle START
//$delete_invoice_data['invoice_date'] = $invoice_date;
//Query_helper::delete('invoices', $delete_invoice_data);
if ($this->Service_template_model->delete_invoice_data($invoice_date)) {
$invoice_id = Query_helper::add('invoices', $invoice_data);
$zilla_invoice_id = Query_helper::add($zilla_table_invoice, $zilla_invoice_data);
for ($i = 0; $i < $count; $i++) {
if ($this->Service_template_model->check_uisc_service_existence($servicePost[$i])) {
list($service_id, $service_name) = $this->Service_template_model->check_uisc_service_existence($servicePost[$i]);
$invoice_details_data['invoice_id'] = $invoice_id;
$invoice_details_data['receiver_name'] = $customerPost[$i];
$invoice_details_data['receiver_sex'] = $genderPost[$i];
$invoice_details_data['service_id'] = $service_id;
//$this->Service_template_model->get_service_id($servicePost[$i]);
$invoice_details_data['income'] = System_helper::Get_Bng_to_Eng($earningPost[$i]);
$invoice_details_data['service_name'] = $service_name;
//$this->Service_template_model->get_service_name($servicePost[$i]);
$zilla_invoice_details_data['invoice_id'] = $zilla_invoice_id;
$zilla_invoice_details_data['receiver_name'] = $customerPost[$i];
$zilla_invoice_details_data['receiver_sex'] = $genderPost[$i];
$zilla_invoice_details_data['service_id'] = $service_id;
//$this->Service_template_model->get_service_id($servicePost[$i]);
$zilla_invoice_details_data['income'] = System_helper::Get_Bng_to_Eng($earningPost[$i]);
$zilla_invoice_details_data['service_name'] = $service_name;
//$this->Service_template_model->get_service_name($servicePost[$i]);
Query_helper::add('invoice_details', $invoice_details_data);
Query_helper::add($zilla_table_invoice_details, $zilla_invoice_details_data);
}
}
$fileInfo = array('user_id' => $user->id, 'uisc_id' => $uisc_id, 'file_name' => $fileName, 'upload_date' => strtotime($invDate), 'create_date' => time());
Query_helper::add($this->config->item('table_excel_history'), $fileInfo);
$this->db->trans_complete();
//DB Transaction Handle END
if ($this->db->trans_status() === TRUE) {
$this->message = $this->lang->line("MSG_CREATE_SUCCESS");
$this->dcms_add();
} else {
示例14: system_save
private function system_save()
{
$user = User_helper::get_user();
$id = $this->input->post("id");
if (!$this->permissions['edit']) {
$ajax['status'] = false;
$ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
$this->jsonReturn($ajax);
die;
}
if (!$this->check_validation()) {
$ajax['status'] = false;
$ajax['system_message'] = $this->message;
$this->jsonReturn($ajax);
} else {
$tasks = $this->input->post('tasks');
$user_group_id = $this->input->post('id');
$time = time();
$this->db->trans_start();
//DB Transaction Handle START
foreach ($tasks as $task) {
$data = array();
if (isset($task['list']) && $task['list'] == 1) {
$data['list'] = 1;
} else {
$data['list'] = 0;
}
if (isset($task['view']) && $task['view'] == 1) {
$data['view'] = 1;
} else {
$data['view'] = 0;
}
if (isset($task['add']) && $task['add'] == 1) {
$data['add'] = 1;
} else {
$data['add'] = 0;
}
if (isset($task['edit']) && $task['edit'] == 1) {
$data['edit'] = 1;
} else {
$data['edit'] = 0;
}
if (isset($task['delete']) && $task['delete'] == 1) {
$data['delete'] = 1;
} else {
$data['delete'] = 0;
}
if (isset($task['report']) && $task['report'] == 1) {
$data['report'] = 1;
} else {
$data['report'] = 0;
}
if (isset($task['print']) && $task['print'] == 1) {
$data['print'] = 1;
} else {
$data['print'] = 0;
}
if ($data['view'] || $data['add'] || $data['edit'] || $data['delete'] || $data['report'] || $data['print']) {
$data['list'] = 1;
}
if ($task['ugr_id'] > 0) {
$data['update_by'] = $user->id;
$data['update_date'] = $time;
Query_helper::update($this->config->item('table_user_group_role'), $data, array("id = " . $task['ugr_id']));
} else {
$data['user_group_id'] = $user_group_id;
$data['component_id'] = $task['component_id'];
$data['module_id'] = $task['module_id'];
$data['task_id'] = $task['task_id'];
$data['create_by'] = $user->id;
$data['create_date'] = $time;
Query_helper::add($this->config->item('table_user_group_role'), $data);
}
}
$this->db->trans_complete();
//DB Transaction Handle END
if ($this->db->trans_status() === TRUE) {
$this->message = $this->lang->line("MSG_ROLE_ASSIGN_SUCCESS");
$this->system_list();
} else {
$ajax['status'] = false;
$ajax['system_message'] = $this->lang->line("MSG_ROLE_ASSIGN_FAIL");
$this->jsonReturn($ajax);
}
}
}
示例15: system_save
private function system_save()
{
$user = User_helper::get_user();
$id = $this->input->post("id");
if ($id > 0) {
if (!$this->permissions['edit']) {
$ajax['status'] = false;
$ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
$this->jsonReturn($ajax);
die;
}
} else {
if (!$this->permissions['add']) {
$ajax['status'] = false;
$ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
$this->jsonReturn($ajax);
die;
}
}
if (!$this->check_validation()) {
$ajax['status'] = false;
$ajax['system_message'] = $this->message;
$this->jsonReturn($ajax);
} else {
if ($id > 0) {
$ajax['status'] = false;
$ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
$this->jsonReturn($ajax);
} else {
$data = array();
$user_id = $user->id;
$uisc_id = $user->uisc_id;
$data['uisc_id'] = $uisc_id;
$data['user_id'] = $user_id;
$data['question'] = $this->input->post('question');
$data['user_type'] = $this->input->post('user_group');
$data['create_by'] = $user_id;
$data['create_date'] = time();
$this->db->trans_start();
//DB Transaction Handle START
Query_helper::add($this->config->item('table_faqs'), $data);
$this->db->trans_complete();
//DB Transaction Handle END
if ($this->db->trans_status() === TRUE) {
$this->message = $this->lang->line("MSG_CREATE_SUCCESS");
$save_and_new = $this->input->post('system_save_new_status');
if ($save_and_new == 1) {
$this->system_add();
} else {
$this->system_list();
}
} else {
$ajax['status'] = false;
$ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
$this->jsonReturn($ajax);
}
}
}
}