public function action_removeimage() { $user = Auth::instance()->get_user(); $user->avatar = ""; $user->save(); $image = CacheImage::instance(); $src = $image->resize($user->avatar, 100, 100); echo $src; exit; }
protected function menu_init() { $this->view->bind('topmenu', $topmenu)->bind('myaccount', $myaccount)->bind('sidemenu', $profilemenu)->bind('image', $image)->bind('role', $role)->bind('username', $username)->bind('user', $user); $user_id = $this->request->param('id'); $user = ORM::factory('user', $user_id); $role = $user->role()->name; $username = $user->firstname; $avatar = $user->avatar; $avatar = $avatar === null ? '' : $avatar; $img_user = CacheImage::instance()->resize($avatar, 100, 100); $view_avatar = View::factory('account/sidemenu/profile')->bind('avatar_user', $img_user)->bind('user', $user)->bind('role', $role); $this->view->set('avatar', $view_avatar); $menu = Acl_Menu::factory('profile'); $topmenu = $menu->get('topmenu'); $profilemenu = $menu->get('profilemenu'); $myaccount = $menu->get('myaccount'); $institution = ORM::factory('institution', $id = 1); $image = CacheImage::instance()->resize($institution->logo, 240, 60); }
public function action_show_map() { $room = ORM::factory('room', $this->request->param('id')); $location = ORM::factory('location', $room->location_id); $images = CacheImage::instance(); $image = $images->resize($location->image, 400, 200); $html = '<img src ="' . $image . '" />'; $json = array('success' => 0, 'html' => $html); echo json_encode($json); exit; }
<?php $image = CacheImage::instance(); $avatar = $image->resize($user->avatar, 75, 75); $curr_user = Auth::instance()->get_user(); $curr_avatar = $image->resize($curr_user->avatar, 40, 40); ?> <table class="fullwidth"> <tr> <td class="w8"> <a href="<?php echo $url . "/" . $user->id; ?> "><img src = "<?php echo $avatar; ?> " class = "h70 "></img></a> </td> <td class="vatop hpad10"> <p class="h3"><span class = "roleIcon <?php echo $user->role(); ?> "> </span><a href="<?php echo $url . "/" . $user->id; ?> "><?php echo $user->fullname(); ?> </a></p><br>
public function action_removeimage() { $image = CacheImage::instance(); $src = $image->resize('', 100, 100); echo $src; exit; }
public function action_edit() { $submitted = false; $id = $this->request->param('id'); if (!$id) { Request::current()->redirect('location'); } $location = ORM::factory('location', $id); if ($this->request->method() === 'POST' && $this->request->post()) { if (Arr::get($this->request->post(), 'save') !== null) { $submitted = true; $validator = $location->validator($this->request->post()); if ($validator->check()) { $location->name = $this->request->post('name'); $location->image = $this->request->post('image'); $location->save(); Request::current()->redirect('location'); exit; } else { $this->_errors = $validator->errors('location'); } } } $form = $this->form('location/edit/id/' . $id, $submitted, array('name' => $location->name, 'image' => $location->image)); $links = array('cancel' => Html::anchor('/location/', 'or cancel')); $upload_url = URL::site('location/uploadmap'); $images = CacheImage::instance(); $image = $images->resize($location->image, 400, 200); //$image = $location->image; $view = View::factory('location/form')->bind('links', $links)->bind('form', $form)->bind('image', $image)->bind('upload_url', $upload_url); Breadcrumbs::add(array('System', Url::site('system'))); Breadcrumbs::add(array('Location', Url::site('location'))); Breadcrumbs::add(array('Edit', Url::site('location/edit/id/' . $id))); $this->content = $view; }
public function action_uploadinst() { $filename = 'inst_' . time() . '_' . $_FILES['image']['name']; $file_validation = new Validation($_FILES); $file_validation->rule('image', 'upload::valid'); $file_validation->rule('image', 'upload::type', array(':value', array('jpg', 'png', 'gif', 'jpeg'))); if ($file_validation->check()) { if ($path = Upload::save($_FILES['image'], $filename, DIR_IMAGE)) { $images = CacheImage::instance(); $src = $images->resize($filename, 100, 100); $json = array('success' => 1, 'image' => $src, 'filename' => $filename); } else { $json = array('success' => 0, 'errors' => array('image' => 'The file is not a valid Image')); } } else { $json = array('success' => 0, 'errors' => (array) $file_validation->errors('profile')); } echo json_encode($json); exit; }
public function action_comment() { $feed_id = $this->request->post('id'); $data = $this->request->post('data'); $comment = ORM::factory('feedcomment'); $comment->comment = $data; $comment->feed_id = $feed_id; $comment->date = strtotime(date('d-m-Y G:i:s')); $comment->user_id = Auth::instance()->get_user()->id; $comment->save(); $image = CacheImage::instance(); $curr_user = Auth::instance()->get_user(); $curr_avatar = $image->resize($curr_user->avatar, 40, 40); $span = Date::fuzzy_span($comment->date); $json = array('name' => $curr_user->firstname . " " . $curr_user->lastname, 'img' => $curr_avatar, 'text' => Html::chars($comment->comment), 'time' => $span, 'comment_id' => $comment->id); echo json_encode($json); exit; }
public function action_get_students() { if (!$this->request->post('course_id')) { $response = '<p>No Course Selected</p>'; echo json_encode(array('html' => $response)); exit; } $course = ORM::factory('course', $this->request->post('course_id')); $users = Model_Course::get_students($course); $cacheimage = CacheImage::instance(); $view = View::factory('course/ajax_show_students')->bind('cacheimage', $cacheimage)->bind('course', $course)->bind('users', $users); $response = $this->response->body($view)->body(); echo json_encode(array('html' => $response)); }
protected function menu_init() { $this->view->bind('topmenu', $topmenu)->bind('sidemenu', $sidemenu)->bind('coursemenu', $coursemenu)->bind('myaccount', $myaccount)->bind('image', $image)->bind('role', $role)->bind('username', $username)->bind('user', $user); if (!Auth::instance()->logged_in()) { $role = 'guest'; } else { $user = Auth::instance()->get_user(); $role = $user->role()->name; $username = Auth::instance()->get_user()->firstname; //if ($user->is_role('student') || $user->is_role('parent') || $user->is_role('admin')) { $avatar = Auth::instance()->get_user()->avatar; $avatar = $avatar === null ? '' : $avatar; $img_user = CacheImage::instance()->resize($avatar, 72, 72); $childs = ORM::factory('user')->where('parent_user_id', '=', $user->id)->find_all(); $img_child = array(); foreach ($childs as $child) { $child_avatar = $child->avatar; $child_avatar = $child_avatar === null ? '' : $child_avatar; $img_child[$child->firstname] = CacheImage::instance()->resize($child_avatar, 30, 30); } $change_img_url = Url::site('account'); $view_avatar = View::factory('account/sidemenu/' . strtolower($role))->bind('avatar_user', $img_user)->bind('avatar_students', $img_child)->bind('user', $user)->bind('role', $role)->bind('change_img_url', $change_img_url); $this->view->set('avatar', $view_avatar); //} } $menu = Acl_Menu::factory($role); // var_dump($menu); exit; $topmenu = $menu->get('topmenu'); $sidemenu = $menu->get('sidemenu'); $coursemenu = $menu->get('coursemenu'); $myaccount = $menu->get('myaccount'); $institution = ORM::factory('institution', $id = 1); $image = CacheImage::instance()->resize($institution->logo, 240, 60); }