Skip to content

Commit

Permalink
Styled tables and member list is now generated.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pascal Kriete authored and Pascal Kriete committed Nov 8, 2008
1 parent 82e3534 commit 163c284
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 69 deletions.
23 changes: 21 additions & 2 deletions application/controllers/backend/members/members.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ function Members()

$this->permission->secure_restrict();
$this->layout->set_section('members');

$this->load->model('member_model');
}

// --------------------------------------------------------------------
Expand All @@ -43,17 +45,34 @@ function Members()
*/
function index()
{
$data['members'] = $this->member_model->get_all();

$this->layout->gen_crumb(array(
backend_url('') => 'Backend',
backend_url('members') => 'Members'
));

$this->layout->render('members/home');
$this->layout->render('members/home', $data);
}

// --------------------------------------------------------------------


/**
* Add a new member
*
* @access public
*/
function create()
{
$this->layout->gen_crumb(array(
backend_url('') => 'Backend',
backend_url('members') => 'Members'
));

$this->layout->render('members/home');
}

// --------------------------------------------------------------------

}

Expand Down
1 change: 0 additions & 1 deletion application/libraries/Layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ function Layout()
$this->CI =& get_instance();
log_message('debug', "Layout Class Initialized");

$this->CI->load->helper('html');
$this->root_url = site_url('');
}

Expand Down
3 changes: 3 additions & 0 deletions application/libraries/SP_Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ function Backend_Controller()
$this->input->require_csrf_token();

$this->lang->load('member');

// I use these so much - may move them later
$this->load->library('layout');
$this->load->helper(array('html','form'));
}

// --------------------------------------------------------------------
Expand Down
80 changes: 22 additions & 58 deletions application/models/member_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
* @author Pascal Kriete
*/


class Member_model extends Model {

var $table = 'members';
var $groups_table = 'groups';

/**
* Constructor
*
Expand All @@ -34,9 +36,23 @@ function Member_model()

// --------------------------------------------------------------------

// ================================
// = ========== UPDATE ========== =
// ================================
/**
* Get all users
*
* @access private
* @return bool
*/
function get_all()
{
$this->db->select($this->table.'.*');
$this->db->select($this->db->dbprefix($this->groups_table).'.title AS user_group', FALSE);
$this->db->join($this->groups_table, $this->groups_table.'.group_id = '.$this->table.'.group_id');

$query = $this->db->get($this->table);
return ($query->num_rows() > 0) ? $query->result() : FALSE;
}

// --------------------------------------------------------------------

/**
* Insert New Password
Expand Down Expand Up @@ -108,11 +124,9 @@ function update($data)
$this->db->where('user_id', current_user('id'));
$this->db->update($this->table, $data);
}

// ================================
// = ========== DELETE ========== =
// ================================

// --------------------------------------------------------------------

/**
* Delete a user
*
Expand All @@ -122,58 +136,8 @@ function delete($id)
{
$this->db->delete($this->table, array('user_id' => $id));
}

// ================================
// = ========== OTHERS ========== =
// ================================



}

class Member_model extends Model {


/**
* Get Members
*
* @access public
*/
function get()
{

}

// --------------------------------------------------------------------

/**
* Insert Member
*
* @access public
*/
function insert()
{
// code
}

// --------------------------------------------------------------------

/**
* Delete Member
*
* @access public
*/
function delete()
{
// code
}

// --------------------------------------------------------------------



}

// END Member_model class


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
* Blue Link
* color: #0932d9;
*
* Orange Link
* color: #fe8c0f;
*
*/


/* General Elements
-------------------------------------------------*/

Expand All @@ -26,6 +28,10 @@ h1, h2, h3, h4, h5, h6 {
line-height: 1.5em;
}

h2, h3, h4, h5, h6 {

}

h2, h3, h4, h5, h6 {
color: #252c34;
font-family: HelveticaNeue, "Helvetica Neue", Helvetica, Arial, 'Liberation Sans', FreeSans, sans-serif; /* what a font stack :P */
Expand Down Expand Up @@ -98,7 +104,7 @@ a:hover {
text-align: center;
border: 1px solid #ccc;
padding: 6px;
margin-top: 1em;
margin-top: 1.4em;
}

#session_user {
Expand Down
3 changes: 2 additions & 1 deletion application/views/assets/css/grid/reset.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ q:before, q:after {
content: none;
}

/* remember to define focus styles! */
/* remember to define focus styles!
:focus {
outline: 0;
}
*/

/* remember to highlight inserts somehow! */
ins {
Expand Down
39 changes: 39 additions & 0 deletions application/views/assets/css/tables.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
table {
width: 99%;
position: relative;
}

table tr td
{
padding: 5px 6px 5px 6px;
border-bottom: 1px solid #ccc;
}

table tr th
{
color: #e5e5e5;
text-align: left;
font-weight: bold;
padding: 7px 6px 7px 6px;
background-color: #252c34;
}

table tr.switch
{
background-color: #f5f5ee;
}

table td.true
{
color: #009933;
}

table td.false
{
color: #990000;
}

table tr:hover
{
background-color: #ffffe4;
}
29 changes: 25 additions & 4 deletions application/views/members/home.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
<h1>Members</h1>
<h2>Members</h2>

<p>Member List</p>
<p>New Member</p>
<p>Member Settings</p>
<p><?php echo anchor( backend_url('members/create'), 'Add a Member'); ?></p>

<table cellspacing="0" cellpadding="0">
<thead>
<tr>
<th>Username</th>
<th>E-Mail</th>
<th>User Group</th>
<th>Join Date</th>
<th>Post Count</th>
</tr>
</thead>
<tbody>
<?php foreach($members as $key => $member): ?>
<tr<?php echo ($key & 1) ? ' class="switch"': ''; ?>>
<td><?php echo $member->username; ?></td>
<td><?php echo $member->email; ?></td>
<td><?php echo ucfirst($member->user_group); ?></td>
<td><?php echo date('m/j/Y', $member->join_date); ?></td>
<td><?php echo $member->post_count; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
3 changes: 2 additions & 1 deletion application/views/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
<?php echo link_tag( backend_url('assets/css/grid/reset') )."\n"; ?>
<?php echo link_tag( backend_url('assets/css/grid/960') )."\n"; ?>
<?php echo link_tag( backend_url('assets/css/grid/text') )."\n"; ?>
<?php echo link_tag( backend_url('assets/css/site') )."\n"; ?>
<?php echo link_tag( backend_url('assets/css/backend') )."\n"; ?>
<?php echo link_tag( backend_url('assets/css/tables') )."\n"; ?>

</head>

Expand Down

0 comments on commit 163c284

Please sign in to comment.