Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- VIEW:
- <div id="avatar_gallery">
- <h1>Avatars Gallery</h1>
- {form_open("avatar_gallery/submit")}
- <div id="avatar_box_gallery">
- <input type="text" name="mess" >
- <input type="submit" id="avatar_button_gallery" name="submit" value="Change Avatar" />
- </div>
- {form_close()}
- </div>
- CONTROLLER:
- <?php
- class avatar_gallery extends MX_Controller
- {
- public function __construct()
- {
- parent::__construct();
- Modules::run('login/is_logged_in');
- $this->load->model('avatar_gallery_model');
- }
- public function index()
- {
- $data = array(
- "user_id" => $this->user->getId(),
- "status" => $this->user->getAccountStatus(),
- "rows" => $this->avatar_gallery_model->view(),
- "text" => htmlspecialchars($this->input->post('mess')),
- );
- // Load the view and pass the data
- $content = $this->template->loadPage("avatar_gallery.tpl", $data);
- // Put the view in a nice content box with a headline
- $box = $this->template->box("Account Panel", $content);
- // Output the view
- $this->template->view($box, "modules/ucp/css/avatar.css");
- }
- public function submit()
- {
- $u_Data = array(
- 'avatar' => htmlspecialchars($this->input->post('mess')),
- );
- $this->avatar_gallery_model->get($u_Data);
- $content = $this->template->loadPage("sent.tpl", $arrData);
- $box = $this->template->box("Account Panel", $content);
- $this->template->view($box, "modules/ucp/css/avatar.css");
- }
- }
- MODEL:
- <?php
- class avatar_gallery_model extends CI_Model
- {
- public function get($u_Data)
- {
- $this->db->update('account_data', $u_Data, array('id' => $this->user->getId()));
- }
- public function view()
- {
- $query = $this->db->query("SELECT * FROM account_data ORDER BY id DESC");
- if($query->num_rows())
- {
- $row = $query->result_array();
- return $row;
- }
- else
- {
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement