Created
June 7, 2011 14:01
-
-
Save nerdsrescueme/1012312 to your computer and use it in GitHub Desktop.
Admin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Controller_Admin extends \Controller { | |
protected $current_user = null; | |
protected $sortable = array(); // Used in action_sort for vars. | |
protected $filterable = array(); | |
public function action_index() | |
{ | |
// Display dashboard. | |
} | |
public function action_login() | |
{ | |
// Do login and redirect. | |
} | |
public function action_logout() | |
{ | |
// Logout and redirect. | |
} | |
// Convenience functions. | |
public function sort($sortable = null) | |
{ | |
// Sort selections. Use $this->sortable array. | |
} | |
public function filter($filterable = null) | |
{ | |
// Filter selections. Use $this->filterable array. | |
} | |
protected function _is_xhr() | |
{ | |
// Return boolean: is this an ajax request? | |
} | |
protected function _process_multiple($key) | |
{ | |
// Determine whether multiple entries are to be edited at once. | |
} | |
// Overrides | |
public function before() | |
{ | |
// Check Auth. | |
// Set current user or guest. | |
} | |
public function router($resource, array $arguments = array()) | |
{ | |
$segments = array_shift(\Request::active()->uri->segments); | |
if ($modpath = \Fuel::add_module($segments[0])) | |
{ | |
if (file_exists($modpath.$segments[1].'php')) | |
{ | |
$request = \Request::factory(implode(DS, $segments), false)->execute(); | |
$this->template->content = $request->response->body->content; | |
return; | |
} | |
} | |
if (method_exists($this, "action_$resource")) | |
{ | |
call_user_func_array(array($this, "action_$resource"), $arguments); | |
} | |
$this->response->status = 404; | |
return; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Model_Comment extends Orm\Model { | |
public static $_belongs_to = array('page'); | |
public static $_has_one = array('author'); // Map to user. | |
public static $_properties = array( | |
'is_active' => array(), | |
'user_id' => array(), | |
'name' => array(), | |
'email' => array(), | |
'website' => array(), | |
'comment' => array(), | |
'ip_hash' => array(), | |
'type' => array(), | |
'type_id' => array(), | |
'created_on' => array(), | |
'updated_on' => array(), | |
'deleted_on' => array(), | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Controller_Admin_Pages extends Controller_Admin { | |
public function $filterable = array(); | |
public function action_index() | |
{ | |
// List pages. | |
} | |
public function action_preview($id = null) | |
{ | |
// Preview page content. | |
} | |
public function action_create() | |
{ | |
// Create new page. | |
} | |
public function action_edit($id = null) | |
{ | |
// Edit page. | |
} | |
public function action_enable($id = null)\ | |
{ | |
// Enable page. | |
} | |
public function action_disable($id = null) | |
{ | |
// Disable page. | |
} | |
private function _enable($id = null) | |
{ | |
// Enable. | |
} | |
private function _disable($id = null) | |
{ | |
// Disable. | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Model_Page extends Orm\Model { | |
public static $_has_one = array('layout'); | |
public static $_has_many = array('comments'); | |
public static $_properties = array( | |
'parent_id' => array(), | |
'layout_id' => array(), | |
'revision_id' => array(), | |
'restricted_to' => array(), | |
'order' => array(), | |
'created_on' => array(), | |
'updated_on' => array(), | |
'deleted_on' => array(), | |
'is_deleted' => array(), | |
'rss_enabled' => array(), | |
'comments_enabled' => array(), | |
'is_home' => array(), | |
'status' => array(), | |
'slug' => array(), | |
'title' => array(), | |
'uri' => array(), | |
'meta_title' => array(), | |
'meta_keywords' => array(), | |
'meta_description' => array(), | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Controller_Admin_User extends Controller_Admin { | |
protected $filterable = array(); | |
// Index inherited from Controller_Admin | |
public function action_edit() | |
{ | |
// Get $current_user info and edit info. | |
} | |
public function action_register() | |
{ | |
// Registration form. | |
} | |
public function action_confirm() | |
{ | |
// Confirmation of registration. | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Controller_Admin_Users extends Controller_Admin { | |
protected $filterable = array(); | |
public function action_index() | |
{ | |
// List users. | |
} | |
public function action_view($id = null) | |
{ | |
// View user. | |
} | |
public function action_create() | |
{ | |
// Create user. | |
} | |
public function action_edit($id = null) | |
{ | |
// Edit user. | |
} | |
public function action_permit($id = null) | |
{ | |
// Add or remove permissions from user. | |
} | |
public function action_activate($id = null) | |
{ | |
// Activate user. | |
} | |
public function action_deactivate($id = null) | |
{ | |
// Disable user. | |
} | |
public function action_delete($id = null) | |
{ | |
// Delete user. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment