Permalink
Browse files

-

  • Loading branch information...
project29k committed Feb 25, 2012
1 parent 76bbfc5 commit 85079d3e584199e20277e6f71413e2b488b76a30
@@ -3,8 +3,53 @@
class profile extends CI_Controller {
function __construct() {
parent::__construct();
+
+ $this->load->language('axipi_dynamic');
+ $this->axipi_library->jquery_load('jquery');
}
public function index() {
$this->zones['content'] = $this->load->view('axipi_core/profile_index', null, true);
}
+ public function rule_usr_email($usr_email, $current = '') {
+ if($current != '') {
+ $query = $this->db->query('SELECT usr.usr_email FROM '.$this->db->dbprefix('usr').' AS usr WHERE usr.usr_email = ? AND usr.usr_email != ? GROUP BY usr.usr_id', array($usr_email, $current));
+ } else {
+ $query = $this->db->query('SELECT usr.usr_email FROM '.$this->db->dbprefix('usr').' AS usr WHERE usr.usr_email = ? GROUP BY usr.usr_id', array($usr_email));
+ }
+ if($query->num_rows() > 0) {
+ $this->form_validation->set_message('rule_usr_email', $this->lang->line('value_already_used'));
+ return FALSE;
+ } else {
+ return TRUE;
+ }
+ }
+ public function update() {
+ $this->load->helper(array('form'));
+ $this->load->library('form_validation');
+ $data = array();
+ $data['usr'] = $this->users_model->get_user($this->usr->usr_id);
+
+ $this->form_validation->set_rules('usr_email', 'lang:usr_email', 'required|max_length[100]|valid_email|callback_rule_usr_email['.$data['usr']->usr_email.']');
+ $this->form_validation->set_rules('usr_emailconfirm', 'lang:usr_emailconfirm', 'required|max_length[100]|valid_email|matches[usr_email]');
+ $this->form_validation->set_rules('usr_passwordconfirm', 'lang:usr_passwordconfirm', 'matches[usr_password]');
+ $this->form_validation->set_rules('usr_firstname', 'lang:usr_firstname', 'max_length[100]');
+ $this->form_validation->set_rules('usr_lastname', 'lang:usr_lastname', 'max_length[100]');
+
+ if($this->form_validation->run() == FALSE) {
+ $this->zones['content'] = $this->load->view('axipi_core/profile_update', $data, true);
+ } else {
+ $this->db->set('usr_email', $this->input->post('usr_email'));
+ if($this->input->post('usr_password') != '' && $this->input->post('usr_passwordconfirm') != '') {
+ $this->db->set('usr_protectedpassword', md5($this->input->post('usr_password')));
+ }
+ $this->db->set('usr_firstname', $this->input->post('usr_firstname'));
+ $this->db->set('usr_lastname', $this->input->post('usr_lastname'));
+ $this->db->set('usr_modifiedby', $this->usr->usr_id);
+ $this->db->set('usr_datemodified', date('Y-m-d H:i:s'));
+ $this->db->where('usr_id', $this->usr->usr_id);
+ $this->db->update('usr');
+ $this->msg[] = $this->lang->line('updated');
+ $this->index();
+ }
+ }
}
@@ -102,6 +102,9 @@ public function delete() {
if($this->form_validation->run() == FALSE) {
$this->zones['content'] = $this->load->view('axipi_dynamic/components/components_delete', $data, true);
} else {
+ $this->db->where('cmp_id', $this->cmp_id);
+ $this->db->delete('cmp_stg');
+
$this->db->where('cmp_id', $this->cmp_id);
$this->db->where('cmp_islocked', 0);
$this->db->delete('cmp');
@@ -120,6 +120,12 @@ public function delete() {
if($this->form_validation->run() == FALSE) {
$this->zones['content'] = $this->load->view('axipi_dynamic/countries/countries_delete', $data, true);
} else {
+ $this->db->where('cou_id', $this->cou_id);
+ $this->db->delete('cou_sub');
+
+ $this->db->where('cou_id', $this->cou_id);
+ $this->db->delete('cou_trl');
+
$this->db->where('cou_id', $this->cou_id);
$this->db->where('cou_islocked', 0);
$this->db->delete('cou');
@@ -102,6 +102,20 @@ public function delete() {
if($this->form_validation->run() == FALSE) {
$this->zones['content'] = $this->load->view('axipi_dynamic/groups/groups_delete', $data, true);
} else {
+ $this->db->where('grp_id', $this->grp_id);
+ $this->db->delete('grp_itm');
+
+ $this->db->where('grp_id', $this->grp_id);
+ $this->db->delete('grp_trl');
+
+ $this->db->where('grp_id', $this->grp_id);
+ $this->db->where('grp_per_islocked', 0);
+ $this->db->delete('grp_per');
+
+ $this->db->where('grp_id', $this->grp_id);
+ $this->db->where('grp_usr_islocked', 0);
+ $this->db->delete('grp_usr');
+
$this->db->where('grp_id', $this->grp_id);
$this->db->where('grp_islocked', 0);
$this->db->delete('grp');
@@ -119,6 +119,12 @@ public function delete() {
if($this->form_validation->run() == FALSE) {
$this->zones['content'] = $this->load->view('axipi_dynamic/hosts/hosts_delete', $data, true);
} else {
+ $this->db->where('hst_id', $this->hst_id);
+ $this->db->delete('hst_trl');
+
+ $this->db->where('hst_id', $this->hst_id);
+ $this->db->delete('hst_stg');
+
$this->db->where('hst_id', $this->hst_id);
$this->db->where('hst_islocked', 0);
$this->db->delete('hst');
@@ -159,9 +159,24 @@ public function delete() {
if($this->form_validation->run() == FALSE) {
$this->zones['content'] = $this->load->view('axipi_dynamic/items/items_delete', $data, true);
} else {
+ $this->db->where('itm_id', $this->itm_id);
+ $this->db->delete('grp_itm');
+
+ $this->db->where('itm_id', $this->itm_id);
+ $this->db->delete('itm_rel');
+
+ $this->db->where('rel_id', $this->itm_id);
+ $this->db->delete('itm_rel');
+
+ $this->db->where('itm_id', $this->itm_id);
+ $this->db->delete('itm_stg');
+
+ $this->db->where('itm_id', $this->itm_id);
+ $this->db->delete('itm_zon');
+
$this->db->where('itm_id', $this->itm_id);
$this->db->where('itm_islocked', 0);
- $this->db->delete('itm');
+ $this->db->delete('itm');
$this->index();
$this->msg[] = $this->lang->line('deleted');
}
@@ -106,6 +106,30 @@ public function delete() {
if($this->form_validation->run() == FALSE) {
$this->zones['content'] = $this->load->view('axipi_dynamic/languages/languages_delete', $data, true);
} else {
+ $this->db->where('lng_id', $this->lng_id);
+ $this->db->delete('cou_trl');
+
+ $this->db->where('lng_id', $this->lng_id);
+ $this->db->delete('grp_trl');
+
+ $this->db->where('lng_id', $this->lng_id);
+ $this->db->delete('hst_trl');
+
+ $this->db->where('lng_id', $this->lng_id);
+ $this->db->delete('lng_stg');
+
+ $this->db->where('lng_id', $this->lng_id);
+ $this->db->delete('per_trl');
+
+ $this->db->where('lng_id', $this->lng_id);
+ $this->db->delete('sct_trl');
+
+ $this->db->where('lng_id', $this->lng_id);
+ $this->db->delete('stg_trl');
+
+ $this->db->where('lng_id', $this->lng_id);
+ $this->db->delete('trl_zon');
+
$this->db->where('lng_id', $this->lng_id);
$this->db->where('lng_islocked', 0);
$this->db->delete('lng');
@@ -106,6 +106,9 @@ public function delete() {
if($this->form_validation->run() == FALSE) {
$this->zones['content'] = $this->load->view('axipi_dynamic/layouts/layouts_delete', $data, true);
} else {
+ $this->db->where('lay_id', $this->lay_id);
+ $this->db->delete('zon');
+
$this->db->where('lay_id', $this->lay_id);
$this->db->where('lay_islocked', 0);
$this->db->delete('lay');
@@ -102,6 +102,13 @@ public function delete() {
if($this->form_validation->run() == FALSE) {
$this->zones['content'] = $this->load->view('axipi_dynamic/permissions/permissions_delete', $data, true);
} else {
+ $this->db->where('per_id', $this->per_id);
+ $this->db->delete('per_trl');
+
+ $this->db->where('per_id', $this->per_id);
+ $this->db->where('grp_per_islocked', 0);
+ $this->db->delete('grp_per');
+
$this->db->where('per_id', $this->per_id);
$this->db->where('per_islocked', 0);
$this->db->delete('per');
@@ -108,6 +108,12 @@ public function delete() {
if($this->form_validation->run() == FALSE) {
$this->zones['content'] = $this->load->view('axipi_dynamic/sections/sections_delete', $data, true);
} else {
+ $this->db->where('sct_id', $this->sct_id);
+ $this->db->delete('sct_trl');
+
+ $this->db->where('sct_id', $this->sct_id);
+ $this->db->delete('sct_stg');
+
$this->db->where('sct_id', $this->sct_id);
$this->db->where('sct_islocked', 0);
$this->db->delete('sct');
@@ -6,6 +6,7 @@ function __construct() {
$this->load->language('axipi_dynamic');
$this->load->model('axipi_dynamic/users_model', '', true);
+ $this->axipi_library->jquery_load('jquery');
if($this->input->get('usr_id')) {
$this->usr_id = $this->input->get('usr_id');
@@ -119,6 +120,16 @@ public function delete() {
if($this->form_validation->run() == FALSE) {
$this->zones['content'] = $this->load->view('axipi_dynamic/users/users_delete', $data, true);
} else {
+ $this->db->where('usr_id', $this->usr_id);
+ $this->db->delete('cnt_usr');
+
+ $this->db->where('usr_id', $this->usr_id);
+ $this->db->delete('stg_usr');
+
+ $this->db->where('usr_id', $this->usr_id);
+ $this->db->where('grp_usr_islocked', 0);
+ $this->db->delete('grp_usr');
+
$this->db->where('usr_id', $this->usr_id);
$this->db->where('usr_islocked', 0);
$this->db->delete('usr');
@@ -111,7 +111,7 @@ public function delete() {
} else {
$this->db->where('zon_id', $this->zon_id);
$this->db->where('zon_islocked', 0);
- $this->db->delete('zon');
+ $this->db->delete('zon');
$this->index();
$this->msg[] = $this->lang->line('deleted');
}
@@ -172,6 +172,7 @@
$lang['setting'] = 'Setting';
$lang['settings-short'] = 'Stg.';
$lang['settings'] = 'Settings';
+$lang['subdivisions'] = 'Subdivisions';
$lang['title-copy'] = 'Copy of %1$s';
$lang['tree-root'] = 'Root';
$lang['update-short'] = 'Upd.';
@@ -9,7 +9,7 @@ function get_all_countries($flt) {
return $query->row();
}
function get_pagination_countries($flt, $num, $offset) {
- $query = $this->db->query('SELECT cou.cou_id, cou.cou_alpha2, cou.cou_alpha3, cou.cou_islocked, cou.cou_ispublished, COUNT(DISTINCT(itm.itm_id)) AS count_items, COUNT(DISTINCT(usr.usr_id)) AS count_users FROM '.$this->db->dbprefix('cou').' AS cou LEFT JOIN '.$this->db->dbprefix('itm').' AS itm ON itm.cou_id = cou.cou_id LEFT JOIN '.$this->db->dbprefix('usr').' AS usr ON usr.cou_id = cou.cou_id WHERE '.implode(' AND ', $flt).' GROUP BY cou.cou_id ORDER BY cou.cou_id DESC LIMIT '.$offset.', '.$num);
+ $query = $this->db->query('SELECT cou.cou_id, cou.cou_alpha2, cou.cou_alpha3, cou.cou_islocked, cou.cou_ispublished, COUNT(DISTINCT(cou_sub.cou_sub_id)) AS count_subdivisions, COUNT(DISTINCT(itm.itm_id)) AS count_items, COUNT(DISTINCT(usr.usr_id)) AS count_users FROM '.$this->db->dbprefix('cou').' AS cou LEFT JOIN '.$this->db->dbprefix('cou_sub').' AS cou_sub ON cou_sub.cou_id = cou.cou_id LEFT JOIN '.$this->db->dbprefix('itm').' AS itm ON itm.cou_id = cou.cou_id LEFT JOIN '.$this->db->dbprefix('usr').' AS usr ON usr.cou_id = cou.cou_id WHERE '.implode(' AND ', $flt).' GROUP BY cou.cou_id ORDER BY cou.cou_id DESC LIMIT '.$offset.', '.$num);
return $query->result();
}
function get_country($cou_id) {
@@ -15,14 +15,8 @@
<div class="column1">
<p><span class="label"><?php echo $this->lang->line('usr_email'); ?></span><?php echo $this->usr->usr_email; ?></p>
-<p><span class="label"><?php echo $this->lang->line('usr_courtesy'); ?></span><?php echo $this->usr->usr_courtesy; ?></p>
-<p><span class="label"><?php echo $this->lang->line('usr_lastname'); ?></span><?php echo $this->usr->usr_lastname; ?></p>
<p><span class="label"><?php echo $this->lang->line('usr_firstname'); ?></span><?php echo $this->usr->usr_firstname; ?></p>
-<p><span class="label"><?php echo $this->lang->line('usr_address1'); ?></span><?php echo $this->usr->usr_address1; ?></p>
-<p><span class="label"><?php echo $this->lang->line('usr_address2'); ?></span><?php echo $this->usr->usr_address2; ?></p>
-<p><span class="label"><?php echo $this->lang->line('usr_address3'); ?></span><?php echo $this->usr->usr_address3; ?></p>
-<p><span class="label"><?php echo $this->lang->line('usr_zipcode'); ?></span><?php echo $this->usr->usr_zipcode; ?></p>
-<p><span class="label"><?php echo $this->lang->line('usr_city'); ?></span><?php echo $this->usr->usr_city; ?></p>
+<p><span class="label"><?php echo $this->lang->line('usr_lastname'); ?></span><?php echo $this->usr->usr_lastname; ?></p>
</div>
<div class="column1 columnlast">
@@ -0,0 +1,53 @@
+<?php
+if($usr) {
+?>
+
+<div class="box-breadcrumbs box1">
+<div class="display">
+<ul>
+<li class="first"><a href="<?php echo current_url(); ?>"><?php echo $this->itm->itm_title; ?></a></li>
+</ul>
+</div>
+</div>
+
+<div class="box1">
+<h1><?php echo $usr->usr_email; ?></h1>
+<ul>
+<li><a href="<?php echo current_url(); ?>"><?php echo $this->lang->line('cancel'); ?></a></li>
+</ul>
+<div class="display">
+
+<?php echo validation_errors(); ?>
+
+<?php echo form_open(current_url().'?a=update&amp;usr_id='.$usr->usr_id); ?>
+
+<div class="column1">
+<fieldset>
+<p><?php echo form_label($this->lang->line('usr_email').' *', 'usr_email'); ?><?php echo form_input('usr_email', set_value('usr_email', $usr->usr_email), 'id="usr_email" class="inputtext"'); ?></p>
+<p><?php echo form_label($this->lang->line('usr_emailconfirm').' *', 'usr_emailconfirm'); ?><?php echo form_input('usr_emailconfirm', set_value('usr_emailconfirm', $usr->usr_email), 'id="usr_emailconfirm" class="inputtext"'); ?></p>
+</fieldset>
+<fieldset>
+<legend><?php echo $this->lang->line('password_change'); ?></legend>
+<p><?php echo form_label($this->lang->line('usr_password'), 'usr_password'); ?><?php echo form_password('usr_password', set_value('usr_password'), 'id="usr_password" class="inputpassword"'); ?></p>
+<p><?php echo form_label($this->lang->line('usr_passwordconfirm'), 'usr_passwordconfirm'); ?><?php echo form_password('usr_passwordconfirm', set_value('usr_passwordconfirm'), 'id="usr_passwordconfirm" class="inputpassword"'); ?></p>
+</fieldset>
+<p><?php echo form_label($this->lang->line('usr_firstname'), 'usr_firstname'); ?><?php echo form_input('usr_firstname', set_value('usr_firstname', $usr->usr_firstname), 'id="usr_firstname" class="inputtext"'); ?></p>
+<p><?php echo form_label($this->lang->line('usr_lastname'), 'usr_lastname'); ?><?php echo form_input('usr_lastname', set_value('usr_lastname', $usr->usr_lastname), 'id="usr_lastname" class="inputtext"'); ?></p>
+</div>
+
+<div class="column1 columnlast">
+<p><input class="inputsubmit" type="submit" name="submit" id="submit" value="<?php echo $this->lang->line('validate'); ?>"></p>
+</div>
+
+</form>
+
+</div>
+</div>
+
+<?php
+} else {
+?>
+
+<?php
+}
+?>
@@ -34,6 +34,7 @@
<th><a class="sort_desc" href="#"><?php echo $this->lang->line('cou_id'); ?></a></th>
<th><?php echo $this->lang->line('cou_alpha2'); ?></th>
<th><?php echo $this->lang->line('cou_alpha3'); ?></th>
+<th><?php echo $this->lang->line('subdivisions'); ?></th>
<th><?php echo $this->lang->line('items'); ?></th>
<th><?php echo $this->lang->line('users'); ?></th>
<th>&nbsp;</th>
@@ -46,6 +47,7 @@
<td><a href="<?php echo current_url(); ?>?a=read&amp;cou_id=<?php echo $result->cou_id;?>"><?php echo $result->cou_id;?></a></td>
<td><?php echo $result->cou_alpha2; ?></td>
<td><?php echo $result->cou_alpha3; ?></td>
+<td><?php echo $result->count_subdivisions; ?></td>
<td><?php echo $result->count_items; ?></td>
<td><?php echo $result->count_users; ?></td>
<th>
@@ -28,7 +28,7 @@
<div class="column1">
<fieldset>
<p><?php echo form_label($this->lang->line('usr_email').' *', 'usr_email'); ?><?php echo form_input('usr_email', set_value('usr_email', $usr->usr_email), 'id="usr_email" class="inputtext"'); ?></p>
-<p><?php echo form_label($this->lang->line('usr_emailconfirm').' *', 'usr_emailconfirm'); ?><?php echo form_input('usr_emailconfirm', set_value('usr_emailconfirm', $usr->usr_email), 'id="usr_email" class="inputtext"'); ?></p>
+<p><?php echo form_label($this->lang->line('usr_emailconfirm').' *', 'usr_emailconfirm'); ?><?php echo form_input('usr_emailconfirm', set_value('usr_emailconfirm', $usr->usr_email), 'id="usr_emailconfirm" class="inputtext"'); ?></p>
</fieldset>
<fieldset>
<legend><?php echo $this->lang->line('password_change'); ?></legend>
@@ -0,0 +1,10 @@
+<html>
+<head>
+ <title>403 Forbidden</title>
+</head>
+<body>
+
+<p>Directory access is forbidden.</p>
+
+</body>
+</html>
@@ -0,0 +1,6 @@
+$(document).ready(function() {
+ $('#usr_password').attr('value', '');
+ $('#usr_password').attr('autocomplete', 'off');
+ $('#usr_passwordconfirm').attr('value', '');
+ $('#usr_passwordconfirm').attr('autocomplete', 'off');
+});
@@ -0,0 +1,10 @@
+<html>
+<head>
+ <title>403 Forbidden</title>
+</head>
+<body>
+
+<p>Directory access is forbidden.</p>
+
+</body>
+</html>
@@ -0,0 +1,6 @@
+$(document).ready(function() {
+ $('#usr_password').attr('value', '');
+ $('#usr_password').attr('autocomplete', 'off');
+ $('#usr_passwordconfirm').attr('value', '');
+ $('#usr_passwordconfirm').attr('autocomplete', 'off');
+});

0 comments on commit 85079d3

Please sign in to comment.