/** * Loads the sidebar */ public function action_sidebar() { $this->action = Request::instance()->action; $user = (object) KMS::Session()->get('user'); $sidebar = $this; $this->request->response = View::factory('kms/admin-sidebar', compact('user', 'sidebar')); }
/** * Initializes the object and load in logged in user */ protected function __construct() { $user = KMS::Session()->get('user'); if ($user !== NULL) { $this->_default_user = $user; $this->user($user->id); } }
/** * Sets up the template and loads the site */ public function before() { parent::before(); $this->_site = KMS::instance('site'); $this->_user = KMS::Session()->get('user'); if ($this->_user === NULL) { Request::$current->redirect(Route::url('kms-admin', array('action' => 'login'))); } $this->template->site = KMS::instance('site'); $this->template->title = ucwords(strtolower(Request::instance()->action)); $this->template->sidebar = Request::factory('kms-admin/sidebar')->execute()->response; }
<div class="content-box-content"> <div class="tab-content default-tab" id="tab1"> <?php if (KMS::Session()->path('ua.message.text') !== NULL) { ?> <div class="notification <?php echo KMS::Session()->path('ua.message.class'); ?> png_bg"> <a href="" class="close"><img src="/kms-asset/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a> <div> <?php echo KMS::Session()->path('ua.message.text'); ?> </div> </div> <?php } ?> <?php echo form::open(Route::url('kms-action', array('action' => 'profile_edit'))); ?> <fieldset> <p> <label>Username</label> <input class="text-input large-input" type="text" id="large-input" name="username" value="<?php echo arr::get($profile, 'username');
/** * Tests that a KMS Session object can be created */ public function testSession() { $this->assertInstanceOf('KMS_Session', KMS::Session()); }
<body id="login"> <div id="login-wrapper" class="png_bg"> <div id="login-top"> <h1>Kooshy (KMS)</h1> </div> <!-- End #logn-top --> <div id="login-content"> <div class="notification <?php echo KMS::Session()->path('ua.message.class', 'information'); ?> png_bg"> <a href="" class="close"><img src="/kms-asset/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a> <div> <?php echo KMS::Session()->path('ua.message.text', 'Please login by using the form below.'); ?> </div> </div> <?php echo form::open(Route::url('kms-action', array('action' => 'login'))); ?> <p> <?php echo form::label('ff_username', 'Username'); ?> <?php echo form::input('username', arr::path($ua, 'fields.username'), array('id' => 'ff_username', 'class' => 'text-input')); ?> </p> <div class="clear"></div>
</td> <td><?php echo $item->username; ?> </td> <td><?php echo $item->email; ?> </td> <td><?php echo $item->role->find()->name; ?> </td> <td> <?php if ($item->id != KMS::Session()->get('user')->id) { if (KMS::instance('privilege')->has('user_edit')) { echo html::anchor(Route::url('kms-admin', array('action' => 'admin', 'section' => 'user-edit', 'id' => $item->id)), html::image(trim(Route::url('kms-asset', array('type' => 'images', 'file' => 'icons/pencil.png')), '/'), array('alt' => 'Edit User'))); } ?> <?php if (KMS::instance('privilege')->has('user_delete')) { echo html::anchor(Route::url('kms-admin', array('action' => 'admin', 'section' => 'user-delete', 'id' => $item->id)), html::image(trim(Route::url('kms-asset', array('type' => 'images', 'file' => 'icons/cross.png')), '/'), array('alt' => 'Remove User'))); } } ?> </td> </tr> <?php }
?> <fieldset> <p> <label>List Name</label> <input class="text-input large-input" type="text" name="name" value="<?php echo arr::get($site_list->as_array(), 'name'); ?> " /> </p> <p> <label>Columns</label> </p> </fieldset> <?php foreach (KMS::Session()->path('ua.fields.column_name', array('')) as $key => $value) { $column = array('name' => $value, 'type' => KMS::Session()->path('ua.fields.column_name.' . $key)); ?> <fieldset class="column-left"> <p> <label>Name</label> <input class="text-input medium-input" type="text" name="column_name[]" value="<?php echo arr::get($column, 'name'); ?> " /> </p> </fieldset> <fieldset class="column-right"> <p> <label>Type</label> <?php echo form::select('column_type[]', $column_types, arr::get($column, 'type'), array('class' => 'medium-input'));
/** * Logs a user out of KMS system */ public function action_logout() { $this->_details = "User account `{$this->_user->username}` logged out"; $this->_identifier = "users.{$this->_user->id}"; $this->after(FALSE); KMS::Session()->destroy(); Request::$current->redirect($this->_redirect); }
/** * Gets a singleton KMS object instance * @param type KMS class to get * @param mixed optional parameters * @return mixed */ public static function instance($class, $params = NULL) { $install_file = arr::get(kohana::modules(), 'kms') . 'config/.kms'; if (!file_exists($install_file) && !empty($_SERVER['REQUEST_URI']) && !preg_match('/kms-asset/', $_SERVER['REQUEST_URI'])) { require arr::get(kohana::modules(), 'kms') . 'install.php'; } if (empty(self::$_instance)) { self::$_instance = new KMS(); KMS::Session(); // start session } $kmsclass = 'kms_' . strtolower($class); if (empty(self::$_instances[$kmsclass])) { self::$_instances[$kmsclass] = self::factory($class, $params); } return self::$_instances[$kmsclass]; }
/** * Loads template pages */ public function action_templates() { switch (Request::$current->param('section')) { case 'overview': $this->template->title = 'Site Templates'; $template = KMS::instance('site')->templates->find_all(); $this->template->content = View::factory('kms/template-overview', compact('template')); break; case 'add': $this->template->title = 'Adding Template'; $template = array(); if (KMS::Session()->path('ua.status') === 'failed') { $template = KMS::Session()->path('ua.fields'); } $this->template->content = View::factory('kms/template-add', compact('template')); break; case 'edit': $this->template->title = 'Editing Template'; $template = KMS::instance('site')->templates->find(Request::$current->param('id')); if (!$template->loaded()) { KMS::stop('The requested template was not found'); } if (KMS::Session()->path('ua.status') === 'failed') { $template->values(KMS::Session()->path('ua.fields')); } $template = $template->as_array(); $this->template->content = View::factory('kms/template-edit', compact('template')); break; case 'delete': $template = KMS::instance('site')->templates->find(Request::$current->param('id')); if (!$template->loaded()) { KMS::stop('The requested template was not found'); } $template = $template->as_array(); $this->template->title = 'Delete Template'; $this->template->content = View::factory('kms/template-delete', compact('template')); break; default: Request::$current->redirect(Route::url('kms-admin', array('action' => 'templates', 'section' => 'overview'))); } }