Ejemplo n.º 1
0
 public function action_index($search = null)
 {
     // check for admin
     if (!Auth::member(5)) {
         \Response::redirect_back('home');
     }
     if (Input::Method() === 'POST') {
         $users = Input::POST();
         if (empty($users) === false) {
             // Update the users
             foreach ($users as $user_id => $new_group) {
                 $found_user = Model_User::Find(str_replace('user_role_', '', $user_id));
                 if (empty($found_user) === false) {
                     $found_user->group_id = $new_group;
                     $found_user->save();
                 }
             }
         }
     }
     if (Input::Method() === 'GET' && Input::Get('search')) {
         $data['total_count'] = Controller_Search::get_users();
         $pagination = Settings::pagination($data['total_count']);
         $data['users'] = Controller_Search::get_users($pagination);
         $data['search'] = Input::GET('search');
     } else {
         $data['total_count'] = Model_User::query()->where('id', '!=', static::$user_id)->count();
         $pagination = Settings::pagination($data['total_count']);
         $data['users'] = Model_User::query()->where('id', '!=', static::$user_id)->order_by('username', 'ASC')->rows_offset($pagination->offset)->rows_limit($pagination->per_page)->get();
     }
     $data['pagination'] = $pagination->render();
     $this->template->content = View::Forge('admin/users', $data);
 }
Ejemplo n.º 2
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $article = new article();
     $article->title = Input::get('title');
     $article->short_description = Input::get('short_description');
     $article->image = Input::get('image');
     $article->description = Input::get('description');
     $article->category_id = Input::GET('category_id');
     $article->save();
     return View::make('pages.Admin.Article.alert')->with('pesan', $article->title . ' Saved');
 }
 public static function get_urls($all, $pagination = null, $images = false)
 {
     $term = Input::GET('search');
     $results = Model_Url::query()->where('short_url', 'LIKE', '%' . $term . '%')->or_where('url', 'LIKE', '%' . $term . '%');
     if ($all === false) {
         $results->where('user_id', static::$user_id);
     }
     if ($images == false || $images == "false") {
         $results->where('url', 'NOT LIKE', Uri::Create('assets/screenshots') . '%');
     } else {
         $results->where('url', 'LIKE', Uri::Create('assets/screenshots') . '%');
     }
     if (empty($pagination) === false) {
         $results = $results->rows_offset($pagination->offset)->rows_limit($pagination->per_page)->get();
     } else {
         $results = $results->count();
     }
     return $results;
 }
Ejemplo n.º 4
0
<div id="contents-wrap">
	<div id="main">
	<?php 
$g = Input::GET('g', 0);
?>
		<?php 
echo Uri::segment(3);
?>
		<h3>Signup<h3>
		<section class="content-wrap">
			<form action="" method="post" enctype="multipart/form-data">
				<input type="hidden" id="id" value="<?php 
echo Input::get("id", "");
?>
" />
				<ul class="forms">
					<li>
						<h4>Name</h4>
						<div>
							<input placeholder="First name" name="firstname" type="text" required pattern=".{2,20}" style="width: 120px" title="must be less than 20 chars" value="<?php 
echo Session::get_flash("firstname", "");
?>
">
							<input placeholder="Middle name" name="middlename" type="text"  pattern=".{2,20}" style="width: 120px" title="must be less than 20 chars" value="<?php 
echo Session::get_flash("middlename", "");
?>
">
							<input placeholder="Last name" name="lastname" type="text" required pattern=".{2,20}" style="width: 120px" title="must be less than 20 chars" value="<?php 
echo Session::get_flash("lastname", "");
?>
">
Ejemplo n.º 5
0
 public function action_make_image()
 {
     $url_id = \Input::GET('url_id');
     $url_object = \Model_Url::query()->where('id', $url_id)->get_one();
     Controller_Url::img_from_url($url_object);
 }