Пример #1
0
 public function postGroup($id = null)
 {
     if (Input::has('id')) {
         $group = Group::find(Input::get('id'));
         if (!$group->isGroupOwner(Auth::user()->id)) {
             return Response::json($this->growlMessage('You cannot modify a group you do not own.', 'error'));
         }
         $message = "Your group has been updated!";
     } else {
         $group = new Group();
         $group->status = Group::STATUS_PENDING;
         $message = "Your group has been created! It must be approved before you can invite others to join or create documents.";
     }
     $postData = array('name', 'display_name', 'address1', 'address2', 'city', 'state', 'postal_code', 'phone_number');
     foreach ($postData as $field) {
         $group->{$field} = Input::get($field);
     }
     if ($group->validate()) {
         $group->save();
         $group->addMember(Auth::user()->id, Group::ROLE_OWNER);
         if ($group->status === Group::STATUS_PENDING) {
             Event::fire(MadisonEvent::VERIFY_REQUEST_GROUP, $group);
         }
         return Response::json($this->growlMessage($message, 'success'));
     } else {
         return Response::json($this->growlMessage($group->getErrors()->all(), 'error'), 400);
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  string $location
  * @return Response
  */
 public function show()
 {
     $location = Input::get('location');
     $type = strtolower(Input::get('type'));
     $wildcardLocation = "%" . $location . "%";
     if (Input::has('type')) {
         $types = array('meeting-room', 'coworking', 'desk');
         if (!in_array($type, $types, true)) {
             return Redirect::to('/')->with('flash_message_404', "Sorry, we don't have that type of space so we brought you back home!");
         }
         $listings = Listing::with('thumbnail')->where('isPublic', '=', 1, "and")->where('space_type', '=', $type)->where('city', 'LIKE', $wildcardLocation)->orWhere('state', 'LIKE', $wildcardLocation)->orWhere('suburb', 'LIKE', $wildcardLocation)->orWhere('country', 'LIKE', $wildcardLocation)->orWhere('postcode', 'LIKE', $wildcardLocation)->get();
     } else {
         $listings = Listing::with('thumbnail')->where('isPublic', '=', 1, "and")->where('space_type', '=', $type)->where('city', 'LIKE', $wildcardLocation)->orWhere('state', 'LIKE', $wildcardLocation)->orWhere('suburb', 'LIKE', $wildcardLocation)->orWhere('country', 'LIKE', $wildcardLocation)->orWhere('postcode', 'LIKE', $wildcardLocation)->get();
     }
     $colNum = Listing::where('city', 'LIKE', $wildcardLocation)->orWhere('state', 'LIKE', $wildcardLocation)->orWhere('suburb', 'LIKE', $wildcardLocation)->orWhere('country', 'LIKE', $wildcardLocation)->where('isPublic', '=', '1')->count();
     switch ($colNum) {
         case 1:
             $colNum = 12;
             break;
         case 2:
             $colNum = 6;
             break;
         case 3:
             $colNum = 3;
             break;
     }
     $title = ucwords("Search: " . $type . " spaces in " . $location);
     return View::make('search.results')->with('listings', $listings)->with('title', $title)->with('colNum', $colNum);
 }
Пример #3
0
 /**
  * Create a Job
  * @return \Illuminate\Http\JsonResponse
  */
 public function create()
 {
     Log::info(\Input::all());
     $inputdata = \Input::all();
     $success = false;
     $inputdata["mandate_start"] = strtotime($inputdata["mandate_start"]);
     $inputdata["mandate_end"] = strtotime($inputdata["mandate_end"]);
     $inputdata["date_of_entry"] = strtotime($inputdata["date_of_entry"]);
     if ($this->validator->validate(\Input::all())) {
         $job = Job::create($inputdata);
         if (\Input::has('skills')) {
             $skills = [];
             foreach (\Input::get('skills') as $skill) {
                 $skills[$skill['skill_id']] = ['description' => isset($skill['description']) ? $skill['description'] : '', 'level' => isset($skill['level']) ? $skill['level'] : 0];
             }
             $job->skills()->attach($skills);
         }
         if (\Input::get('agent_id')) {
             $agent = Agent::find(\Input::get('agent_id'));
             // $job->agents()->attach($agent->user_id);
             $job->agent_id = $agent->user_id;
         }
     }
     $success = $job == true;
     return \Response::json(['success' => $success]);
 }
Пример #4
0
function againcrazy()
{
    $DEFusername = '******';
    $DEFpassword = '******';
    $username = '';
    $password = '';
    Auth::attempt($username, $password);
    if (Input::has('username') && Input::has('password')) {
        var_dump($test);
        $username = Input::get('username');
        $password = Input::get('password');
        if (Auth::attempt($username, $password)) {
            header('Location: http://codeup.dev/authorized.php');
            exit;
        } else {
            if (Input::get('username') == '' && Input::get('password') == '') {
                echo "please enter a username and password";
            } else {
                echo "that is not the correct username or password";
            }
        }
    }
    // if (isset($_SESSION['logged_in_user']) && $_SESSION['logged_in_user']) {
    // 		header('Location: http://codeup.dev/authorized.php');
    // 		exit;
    // }
    $passme = ['password' => $password, 'username' => $username];
    return $passme;
}
Пример #5
0
 /**
  * Sort
  *
  * @param \Illuminate\Database\Eloquent\Builder $builder
  * @param string|null                           $sort    Optional sort string
  *
  * @return \Illuminate\Database\Query\Builder
  */
 public function scopeSort(Builder $builder, $sort = null)
 {
     if ((is_null($sort) || empty($sort)) && Input::has($this->getSortParameterName())) {
         $sort = Input::get($this->getSortParameterName());
     }
     if (!is_null($sort)) {
         $sort = explode(',', $sort);
         foreach ($sort as $field) {
             $field = trim($field);
             $order = 'asc';
             switch ($field[0]) {
                 case '-':
                     $field = substr($field, 1);
                     $order = 'desc';
                     break;
                 case '+':
                     $field = substr($field, 1);
                     break;
             }
             $field = trim($field);
             if (in_array($field, $this->getSortable())) {
                 $builder->orderBy($field, $order);
             }
         }
     }
 }
Пример #6
0
 /**
  * Listar registro de celulas con estado 1
  * POST /submodulo/listar
  *
  * @return Response
  */
 public function postListar()
 {
     //si la peticion es ajax
     if (Request::ajax()) {
         //SI ENVIO EL CODIGO DEL USUARIO
         //deberia buscar el menu y las submodulos asignadas a este usuario
         if (Input::has('usuario_id')) {
             $usuarioId = Input::get('usuario_id');
             $submodulos = DB::table('submodulos')->select('id', 'nombre', DB::raw('CONCAT("M",modulo_id) as relation'))->where('estado', '=', '1')->orderBy('nombre')->get();
         } elseif (Input::has('modulo_id')) {
             //Auth::user()->id
             //$perfilId = Session::get('perfilId');
             $usuario = Usuario::find(Auth::user()->id);
             $perfilId = $usuario['perfil_id'];
             $moduloId = Input::get('modulo_id');
             $submodulos = DB::table('submodulos as s')->leftjoin('submodulo_usuario as su', 's.id', '=', 'su.submodulo_id')->select('s.id', 's.nombre', 's.path')->where('modulo_id', '=', $moduloId)->where('s.estado', '=', 1);
             //->where('su.estado', '=', 1);
             if ($perfilId != 8) {
                 $submodulos = $submodulos->where('su.usuario_id', '=', Auth::user()->id);
             }
             //->where('su.usuario_id', '=', Auth::user()->id)
             $submodulos = $submodulos->groupby('s.id')->orderBy('s.nombre')->get();
         } else {
             $submodulos = DB::table('submodulos')->select('id', 'nombre', DB::raw('CONCAT("M",modulo_id) as relation'))->where('estado', '=', '1')->orderBy('nombre')->get();
         }
         return Response::json(array('rst' => 1, 'datos' => $submodulos));
     }
 }
Пример #7
0
 function validate()
 {
     if (!Session::has('vatsimauth')) {
         throw new AuthException('Session does not exist');
     }
     $SSO = new SSO(Config::get('vatsim.base'), Config::get('vatsim.key'), Config::get('vatsim.secret'), Config::get('vatsim.method'), Config::get('vatsim.cert'));
     $session = Session::get('vatsimauth');
     if (Input::get('oauth_token') !== $session['key']) {
         throw new AuthException('Returned token does not match');
         return;
     }
     if (!Input::has('oauth_verifier')) {
         throw new AuthException('No verification code provided');
     }
     $user = $SSO->checkLogin($session['key'], $session['secret'], Input::get('oauth_verifier'));
     if ($user) {
         Session::forget('vatsimauth');
         $authUser = User::find($user->user->id);
         if (is_null($authUser)) {
             $authUser = new User();
             $authUser->vatsim_id = $user->user->id;
             $authUser->name = trim($user->user->name_first . ' ' . $user->user->name_last);
         }
         $authUser->last_login = Carbon::now();
         $authUser->save();
         Auth::login($authUser);
         Messages::success('Welcome on board, <strong>' . $authUser->name . '</strong>!');
         return Redirect::intended('/');
     } else {
         $error = $SSO->error();
         throw new AuthException($error['message']);
     }
 }
Пример #8
0
 public function getknowledge()
 {
     $this->layout->title = 'Corpers Knowledge Bank';
     $this->layout->description = 'Visit the Corperlife knowledge bank to get all NYSC related questions answered.';
     $this->layout->keywords = 'NYSC, questions, knowledge bank';
     $this->layout->top_active = 5;
     $this->layout->top_active_profile = 4;
     $categories = DB::table('qus_category')->get();
     $questions = DB::table('member_qus')->orderBy('member_qus.category_id', 'asc')->get();
     $terms = DB::table('terms_definitions')->get();
     if (Input::has('tab')) {
         $tab = Input::get('tab');
     } else {
         $tab = 1;
     }
     if (Input::has('query') && Input::has('query') != '') {
         $query = Input::get('query');
         $query_results = DB::table('member_qus')->where('question', 'LIKE', "%" . $query . "%")->orWhere('answer', 'LIKE', "%" . $query . "%")->get();
         $term_results = DB::table('terms_definitions')->where('term', 'LIKE', "%" . $query . "%")->orWhere('definition', 'LIKE', "%" . $query . "%")->get();
     } else {
         $query = '';
         $query_results = [];
         $term_results = [];
     }
     $this->layout->main = View::make("profile.pi.knowledge", ["tab" => $tab, "categories" => $categories, "questions" => $questions, 'terms' => $terms, 'query' => $query, 'query_results' => $query_results, 'term_results' => $term_results]);
 }
Пример #9
0
 public function create_album()
 {
     $fb = LazySalesHelper::fb();
     $fbApp = LazySalesHelper::fbApp();
     $accessToken;
     if (Input::has('access_token')) {
         $accessToken = Input::get('access_token');
     } else {
         $accessToken = $_SESSION['accessToken'];
     }
     try {
         $request = new Facebook\FacebookRequest($fbApp, $accessToken, 'POST', '/' . Input::get('node') . '/albums', array('name' => Input::get('album_tittle'), 'message' => Input::get('album_decription')));
         $response = $fb->getClient()->sendRequest($request);
         $album_id = $response->getGraphNode()->getProperty('id');
         $list_decrip = Input::get('list_decrip');
         foreach (Input::get('list_images') as $key => $value) {
             $request = new Facebook\FacebookRequest($fbApp, $accessToken, 'POST', '/' . $album_id . '/photos', array('source' => $fb->fileToUpload('../public/temp/' . $value), 'message' => $list_decrip[$key]));
             $response = $fb->getClient()->sendRequest($request);
         }
     } catch (Facebook\Exceptions\FacebookResponseException $e) {
         // When Graph returns an error
         echo 'Graph returned an error: ' . $e->getMessage();
         exit;
     } catch (Facebook\Exceptions\FacebookSDKException $e) {
         // When validation fails or other local issues
         echo 'Facebook SDK returned an error: ' . $e->getMessage();
         exit;
     }
 }
 public function store()
 {
     $userManager = new UserManagement();
     $this->accountAddValidator->addRule("company", "required");
     if (!$this->accountAddValidator->validate(Input::all())) {
         Session::flash('error_msg', Utils::buildMessages($this->accountAddValidator->getValidation()->messages()->all()));
         return Redirect::to('/customers/create')->withInput(Input::except("avatar"));
     } else {
         try {
             $user = $userManager->createUser(["name" => Input::get("name"), "email" => Input::get("email"), "password" => Input::get("password"), "password_confirmation" => Input::get("password_confirmation"), "birthday" => Input::get("birthday"), "bio" => Input::get("bio"), "mobile_no" => Input::get("mobile_no"), "country" => Input::get("country"), "gender" => Input::get("gender"), "avatar" => Input::hasFile('avatar') ? Utils::imageUpload(Input::file('avatar'), 'profile') : ''], 'customer', Input::has("activated"));
             $company_users = new CompanyCustomers();
             $company_users->customer_id = $user->id;
             $company_users->company_id = Input::get("company");
             $company_users->save();
             $this->mailer->welcome($user->email, $user->name, User::getWelcomeFields(false, $user->id, Input::get("password"), Input::get('company')));
             RecentActivities::createActivity("Customer <a href='/customers/all'>ID:" . $user->id . "</a> created by User ID:" . Auth::user()->id . " User Name:" . Auth::user()->name);
             if (!Input::has("activated")) {
                 $this->mailer->activate($user->email, $user->name, User::getActivateFields(false, $user->id, Input::get('company')));
             }
             Session::flash('success_msg', trans('msgs.customer_created_success'));
             return Redirect::to('/customers/all');
         } catch (\Exception $e) {
             Session::flash('error_msg', trans('msgs.unable_to_add_customer'));
             return Redirect::to('/customers/create')->withInput(Input::except("avatar"));
         }
     }
 }
Пример #11
0
 /**
  * Stores new account
  *
  */
 public function store()
 {
     $user = new User();
     $user->firstname = Input::get('firstname');
     $user->lastname = Input::get('lastname');
     $user->email = Input::get('email');
     $matches = explode("@", $user->email);
     $username = isset($matches[0]) ? $matches[0] : $user->firstname . '_' . $user->lastname;
     $username = preg_replace("/[^0-9a-zA-Z-]/", '', $username);
     $user->username = $username;
     $user->password = Input::get('password');
     $user->gender = Input::get('gender');
     $user->type = Input::has('type') ? Input::get('type') : 'dreamer';
     // The password confirmation will be removed from model
     // before saving. This field will be used in Ardent's
     // auto validation.
     $user->password_confirmation = Input::get('password_confirmation');
     // Save if valid. Password field will be hashed before save
     $user->save();
     if ($user->id) {
         // Redirect with success message, You may replace "Lang::get(..." for your custom message.
         return Redirect::action('UserController@login')->with('notice', Lang::get('confide::confide.alerts.account_created'));
     } else {
         // Get validation errors (see Ardent package)
         $error = $user->errors()->all(':message');
         return Redirect::action('UserController@create')->withInput(Input::except('password'))->with('error', $error);
     }
 }
Пример #12
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     //
     try {
         // Find the user using the user id
         $user = Sentry::findUserById($id);
         if (Input::has('old_password')) {
             if ($user->checkPassword(Input::get('old_password'))) {
                 $user->password = Input::get('new_password');
             } else {
                 return Response::json(array('success' => false, 'message' => 'Password does not match.'));
             }
         } else {
             $user->first_name = Input::get('first_name');
             $user->last_name = Input::get('last_name');
         }
         if ($user->save()) {
             return Response::json(array('success' => true, 'message' => 'Informasi User berhasil diupdate'));
         } else {
             return Response::json(array('success' => false, 'message' => 'Informasi User tidak berhasil diupdate'));
         }
     } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
         return Response::json(array('success' => false, 'message' => 'User tidak diketemukan'));
     } catch (Cartalyst\Sentry\Users\UserExistsException $e) {
         return Response::json(array('success' => false, 'message' => 'Email sudah Terdaftar'));
     }
 }
Пример #13
0
 public function store(UserFormRequestDomain $request)
 {
     $validator = Validator::make($request->all(), $request->rules());
     if ($validator->fails()) {
         return redirect('create')->withErrors($validator)->withInput();
     } else {
         if (\Input::has('domain_id')) {
             $id = \Input::get('domain_id');
             $domain = DomainModel::find($id);
             $alert['msg'] = 'Domain has been updated successfully';
         } else {
             $domain = new DomainModel();
             $alert['msg'] = 'Domain has been created successfully';
         }
         $domain->user_id = \Session::get('user_id');
         $domain->language_id = \Input::get('language_id');
         $domain->template_id = \Input::get('template_id');
         $domain->name = \Input::get('name');
         $domain->description = \Input::get('description');
         $domain->is_deleted = \Input::get('is_deleted');
         $domain->save();
         $alert['type'] = 'success';
         return Redirect::route('domain')->with('alert', $alert);
     }
 }
 public function add_comment()
 {
     $record = RegisterRecord::find(Input::get('record_id'));
     if (!isset($record)) {
         return Response::json(array('error_code' => 2, 'message' => '无该记录'));
     }
     $user_id = RegisterAccount::find($record->account_id)->user_id;
     if ($user_id != Session::get('user.id')) {
         return Response::json(array('error_code' => 3, 'message' => '无效记录'));
     }
     if (!Input::has('content')) {
         return Response::json(array('error_code' => 4, 'message' => '请输入评价'));
     }
     $old_comment = $record->comment()->get();
     if (isset($old_comment)) {
         return Response::json(array('error_code' => 5, 'message' => '已评论'));
     }
     $comment = new Comment();
     $comment->record_id = $record->id;
     $comment->content = Input::get('content');
     if (!$comment->save()) {
         return Response::json(array('error_code' => 1, 'message' => '添加失败'));
     }
     return Response::json(array('error_code' => 0, 'message' => '添加成功'));
 }
Пример #15
0
Файл: Home.php Проект: ZR2/site
 public function anySearch($search = false)
 {
     if (Input::has('q')) {
         $search = Input::get("q", false);
     }
     $this->layout->content = View::make($this->theme("search"))->with("search", $this->getSearchResults($search));
 }
 /**
  *  Decode multipass token and log user
  */
 public function takeCapture()
 {
     if (!Input::has('legend') || !Input::has('zoom') || !Input::has('lat') || !Input::has('lng')) {
         App::abort(500, 'Missing parameters');
     }
     $phantomjs = getenv('PHANTOM_PATH');
     $filename = storage_path() . '/captures/capture_' . str_random(12) . '.jpg';
     $legend = Input::get('legend');
     $zoom = Input::get('zoom');
     $lat = Input::get('lat');
     $lng = Input::get('lng');
     $siteURL = getenv('SITE_URL');
     Log::info('Temp file name:' . $filename);
     App::finish(function ($request, $response) use($filename) {
         if (file_exists($filename)) {
             unlink($filename);
             Log::info('Temp file removed');
         }
     });
     $command = $phantomjs . ' ' . public_path() . '/js/capture.js ' . $filename . ' ' . $legend . ' ' . $zoom . ' ' . $lat . ' ' . $lng . ' ' . $siteURL;
     Log::info('Comand:' . $command);
     shell_exec($command);
     if (file_exists($filename)) {
         $file = 'atlas_capture.jpg';
         return Response::download($filename, $file);
     } else {
         App::abort(500, 'Capture error');
     }
 }
Пример #17
0
function pageController()
{
    // Using an external file of functions for line 8.
    require_once '../Input.php';
    $hit = Input::has('key') ? Input::get('key') : 0;
    return array('hit' => $hit);
}
Пример #18
0
 public function postGeneral($id)
 {
     $id = Crypt::decrypt($id);
     $request = RRequest::find($id);
     if (Input::has('save')) {
         if (Input::get('employee') == 0 || Input::get('organization') == 0 || Input::get('r_plan') == 0 || Input::get('specialist') == 0 || strlen(Input::get('title')) < 2 || strlen(Input::get('description')) < 2) {
             Session::flash('sms_warn', trans('sta.require_field'));
         } else {
             $request->request_by_id = Input::get('employee');
             $request->for_organization_id = Input::get('organization');
             $request->for_planning_id = Input::get('r_plan');
             $request->to_department_id = Input::get('specialist');
             $request->request_title = Input::get('title');
             $request->description = Input::get('description');
             $request->request_date = date('Y-m-d');
             $request->created_by = Auth::user()->employee_id;
             if ($request->save()) {
                 Session::flash('sms_success', trans('sta.save_data_success'));
                 //return Redirect::to('branch_request/general/' . Crypt::encrypt($request->id));
             }
         }
     }
     $organizations = $this->array_list(Organization::list_item());
     $employees = $this->array_list(Employee::list_item());
     $department = $this->array_list(Department::list_item());
     $r_plans = $this->array_list(Rplan::list_item());
     return View::make('branch_request.edit_general', array('id' => $id, 'organizations' => $organizations, 'employees' => $employees, 'specialist' => $department, 'r_plans' => $r_plans, 'request' => $request));
 }
Пример #19
0
 public function reset_password($reset, $id, $da_mail = 1)
 {
     $reset = Input::has('reset') ? Input::get('reset') : $reset;
     $id = Input::has('id') ? Input::get('id') : $id;
     $da_mail = Input::has('da_mail') ? Input::get('da_mail') : $da_mail;
     $new_password = Input::has('new_password') ? Input::get('new_password') : null;
     $data = array('reset' => $reset, 'id' => $id, 'da_mail' => $da_mail, 'new_password' => $new_password);
     $rules = array('reset' => 'required', 'new_password' => 'required');
     $messages = array('newPassword.required' => 'Specifica una nuova password');
     $validator = Validator::make($data, $rules, $messages);
     $user = Sentry::findUserById($id);
     if ($validator->passes()) {
         try {
             $user = Sentry::findUserById($id);
             if ($user->checkResetPasswordCode($reset)) {
                 if ($user->attemptResetPassword($reset, $new_password)) {
                     return $this->make_response($data, false, array('Password resettata con successo'), URL::to('/'));
                 } else {
                     return $this->make_response($data, true, array('Non è stato possibile resettare la password'));
                 }
             } else {
                 return $this->make_response($data, true, array('Reset code non valido'));
             }
         } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
             return $this->make_response($data, true, array('Utente non trovato'));
         }
     }
     if (!$da_mail) {
         $errors = $validator->messages;
         return $this->make_response($data, true, $errors);
     }
     return View::make('login_reset_password')->with('reset', $reset)->with('id', $id)->with('da_mail', $da_mail)->with('args', $this->args);
 }
Пример #20
0
 public function index()
 {
     if (Auth::user()->check()) {
         $page = Input::has('page') ? Input::get('page') : 1;
         $take = Input::has('take') ? Input::get('take') : 20;
         $skip = ($page - 1) * $take;
         $data = VIImage::select('images.id', 'image_details.detail_id', 'image_details.width', 'image_details.height', 'image_details.dpi', 'image_details.size', 'image_details.size_type', 'image_details.path', 'images.name', 'images.short_name', 'images.description', 'images.store')->leftJoin('image_details', function ($join) {
             $join->on('image_details.image_id', '=', 'images.id');
         })->where('images.author_id', Auth::user()->get()->id)->orderBy('images.id', 'desc')->groupBy('images.id');
         $total_image = $data->get()->count();
         $total_page = ceil($total_image / $take);
         $from = $page - 2 > 0 ? $page - 2 : 1;
         $to = $page + 2 <= $total_page ? $page + 2 : $total_page;
         $data = $data->skip($skip)->take($take)->get();
         $arrImages = array();
         if ($data->count() > 0) {
             $i = 0;
             foreach ($data as $key => $value) {
                 $arrImages[$i]['image_id'] = $value->id;
                 $arrImages[$i]['detail_id'] = $value->detail_id;
                 $arrImages[$i]['name'] = $value->name;
                 $arrImages[$i]['short_name'] = $value->short_name;
                 $arrImages[$i]['description'] = $value->description;
                 $arrImages[$i]['store'] = $value->store;
                 $arrImages[$i]['path'] = '/pic/with-logo/' . $value->short_name . '-' . $value->id . '.jpg';
                 $i++;
             }
         }
         $this->layout->metaTitle = Auth::user()->get()->first_name . '\'s Uploads';
         $this->layout->content = View::make('frontend.upload.index', ['files' => $arrImages, 'categories' => Category::getSource(), 'total_image' => $total_image, 'total_page' => $total_page, 'current' => $page, 'from' => $from, 'to' => $to]);
         return;
     }
     return Redirect::route('account-sign-in');
 }
Пример #21
0
 public function create($type = 'csv')
 {
     try {
         $export = static::getExportForType($type);
     } catch (Exception $e) {
         App::abort(404);
     }
     $export->user_id = Auth::user()->id;
     $export->filename = $export->generateFilename();
     $export->path = $export->folderPath();
     $export->setLogbooks(Input::get('logbooks'));
     $save = Input::has('save') ? (bool) Input::get('save') : true;
     if ($export->run($save)) {
         if ($save == false) {
             $res = Response::make($export->content);
             $res->header('Content-type', $export->getContentType());
             return $res;
         } else {
             $export->save();
             return Response::download($export->fullPath(), $export->filename, ['Content-type' => $export->getContentType()]);
         }
     } else {
         return Redirect::to(action('ExportsController@index'))->with('message', ['content' => 'Er is iets mis gegaan met exporteren.', 'class' => 'danger']);
     }
 }
Пример #22
0
function pageController()
{
    $click = Input::has('click') ? Input::get('click') : 0;
    $hit = $click + 1;
    $miss = 'gameOver';
    return array('hit' => $hit, 'miss' => $miss, 'click' => $click);
}
Пример #23
0
 public function Insert_UpdateNews($data)
 {
     $id = Input::get("id");
     if (!Input::has('id')) {
         $news = new News();
     } else {
         $news = News::find(array_get($data, 'id'));
         //tìm id đã có trong data
     }
     $news->title = array_get($data, 'title');
     // Upload images
     if (Input::file('file')) {
         define('PATH_CATEGORY_ICON', rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/upload/');
         $file = array_get($data, 'file');
         $file->move(PATH_CATEGORY_ICON, $file->getClientOriginalName());
         $news->images = $file->getClientOriginalName();
     }
     // End Upload images
     $news->tomtat = array_get($data, 'tomtat');
     $news->content = array_get($data, 'content');
     $news->cat_id = array_get($data, 'cat_id');
     $news->hot = array_get($data, 'hot');
     $news->ngaydangbai = date('Y-m-d H:i:s');
     return $news->save();
 }
Пример #24
0
 /**
  * Subscribe to category.
  *
  * @return Response
  */
 public function subscribe()
 {
     if (!Input::has('id')) {
         return $this->respondInvalidApi('Please provide category id');
     }
     $user = Auth::user();
     $id = Input::get('id');
     if (is_array($id)) {
         $categories = Category::findMany($id)->filter(function ($category) {
             return $category->parent_id != 0;
         });
         if ($categories->count() > 0) {
             $user->subscriptions()->sync($id);
         }
         return $this->respondNoContent();
     }
     $category = Category::find(Input::get('id'));
     if (!$category) {
         return $this->respondNotFound('Post not found');
     }
     // if already in subscriptions
     if ($user->subscriptions->filter(function ($subscription) use($category) {
         return $category->id == $subscription->id;
     })->count() >= 1) {
         return $this->respondNoContent();
     }
     if ($category->parent_id == 0) {
         return $this->respondInvalidApi('Cant subscribe to High level categories');
     }
     $user->subscriptions()->attach($category->id);
     $user->save();
     $category->updateCount('subscriptions');
     return $this->respondNoContent();
 }
 public function delete()
 {
     $error = false;
     if (Input::has("del-gpId")) {
         if (CRUtilities::deleteGP(Input::get("del-gpId"))) {
             return Redirect::to("admin/dashboard/gateway")->with("message", "Gateway Profile has been deleted.");
         } else {
             $error = true;
         }
     } else {
         if (Input::has("rem-crId")) {
             if (CRUtilities::deleteCR(Input::all())) {
                 return Redirect::to("admin/dashboard/gateway")->with("message", "The selected Compute Resource has been successfully removed");
             } else {
                 $error = true;
             }
         } else {
             if (Input::has("rem-srId")) {
                 if (CRUtilities::deleteSR(Input::all())) {
                     return Redirect::to("admin/dashboard/gateway")->with("message", "The selected Compute Resource has been successfully removed");
                 } else {
                     $error = true;
                 }
             } else {
                 $error = true;
             }
         }
     }
     if ($error) {
         return Redirect::to("admin/dashboard/gateway")->with("message", "An error has occurred. Please try again later or report a bug using the link in the Help menu");
     }
 }
Пример #26
0
 public function login()
 {
     $response = array("status" => "ERROR", "messages" => array("id" => 1, "message" => "Incorrect user data..."));
     if (Input::has('facebookID')) {
         $facebookID = Input::get('facebookID');
         $user = User::with('ciudad')->where('facebookID', $facebookID)->take(1)->first();
     } else {
         if (Input::has('email') && Input::has('password')) {
             $email = Input::get('email');
             $password = Input::get('password');
             $user = User::with('ciudad')->where('email', $email)->where('password', $password)->take(1)->first();
         }
     }
     if ($user) {
         $user->ciudad->pais;
         $response = array();
         if ($user) {
             //Generar token
             $token = md5($user->id . $user->name . time());
             $session = new MobileSession();
             $session->user()->associate($user);
             $session->token = $token;
             $session->validFrom = Carbon::now();
             if (Config::get('qpon.MOBILE_SESSION_TIMEOUT')) {
                 $session->validTo = Carbon::now()->addMinutes(Config::get('qpon.MOBILE_SESSION_TIMEOUT'));
             }
             $session->save();
             $response = array("status" => "OK", "messages" => array("id" => 1, "message" => "User logged in succesfully..."), "profile" => $user->toArray(), "session" => $session->toArray());
         } else {
             $response = array("status" => "ERROR", "messages" => array("id" => 1, "message" => "User does not exist or login data is incorrect..."));
         }
     }
     return Response::json($response);
 }
Пример #27
0
 public static function updateNotary($input, $id)
 {
     $answer = [];
     $rules = ['name' => 'required'];
     $validation = Validator::make($input, $rules);
     if ($validation->fails()) {
         $answer['message'] = $validation;
         $answer['error'] = true;
     } else {
         $notary = Notary::find($id);
         $notary->name = $input['name'];
         if (Input::has('status')) {
             $notary->status = $input['status'];
         } else {
             $notary->status = 0;
         }
         if ($notary->save()) {
             $answer['message'] = 'Editado con exito!';
             $answer['error'] = false;
         } else {
             $answer['message'] = 'NOTARY UPDATE error, team noob!';
             $answer['error'] = false;
         }
     }
     return $answer;
 }
Пример #28
0
 public function postStore()
 {
     if (Input::has('porcentaje_especial')) {
         $porcentaje_vendedor = Input::get('porcentaje_especial');
     } else {
         $porcentaje_comision = ComisionEsquemaVendedor::leftJoin('esquema_comision', 'comision_esquema_vendedor.esquema_comision_id', '=', 'esquema_comision.id')->where('asesor_id', Input::get('asesor_id'))->where('comision_esquema_vendedor.activo', 1)->firstOrFail();
         $porcentaje_vendedor = $porcentaje_comision->porcentaje;
     }
     $venta = new Venta();
     $venta->id = Input::get('venta_id');
     $venta->cliente_id = Input::get('cliente_id');
     $venta->folio_solicitud = Input::get('folio_solicitud');
     $venta->descuento = Input::get('descuento');
     $venta->asesor_id = Input::get('asesor_id');
     $venta->fecha = Carbon\Carbon::now();
     $venta->comentarios = Input::get('comentarios');
     $cart = Session::pull('productos', array());
     $products = array();
     $total = 0;
     $total_comision = 0;
     foreach ($cart as $item) {
         $servicio = VistaServicioFuneral::find($item['producto_id']);
         if (count($servicio) > 0) {
             $serv = VistaServicioFuneral::find($item['producto_id']);
             $total_comision = $serv->monto_comisionable * ($porcentaje_vendedor / 100);
         } else {
             $total_comision += ($item['precio'] * $item['cantidad'] - Input::get('descuento') / 1.16) * ($porcentaje_vendedor / 100);
         }
         $venta_producto = new VentaProducto();
         $venta_producto->venta_id = Input::get('venta_id');
         $venta_producto->producto_id = $item['producto_id'];
         $venta_producto->cantidad = $item['cantidad'];
         $venta_producto->precio_unitario = $item['precio'];
         $venta_producto->iva = 16;
         $venta_producto->total = $item['precio'] * $item['cantidad'] * 1.16;
         $total += $venta_producto->total;
         array_push($products, $venta_producto);
     }
     $venta->total = $total - $venta->descuento;
     $plan_pago = PlanPago::find(Input::get('plan_pago'));
     $plan_pago_venta = new PlanPagoVenta();
     $plan_pago_venta->venta_id = Input::get('venta_id');
     $plan_pago_venta->plan_pago_id = $plan_pago->id;
     $plan_pago_venta->fecha_aplicado = Carbon\Carbon::now();
     $plan_pago_venta->pago_regular = ($venta->total - $venta->total * $plan_pago->porcentaje_anticipo / 100) / $plan_pago->numero_pagos;
     $venta->save();
     $venta->ventaproducto()->saveMany($products);
     $venta->planpagoventa()->save($plan_pago_venta);
     if (!Input::has('directa') && $total_comision > 0) {
         $comision = new Comision();
         $comision->id = Input::get('venta_id');
         $comision->asesor_id = Input::get('asesor_id');
         $comision->total = $total_comision;
         $comision->total_comisionable = $total_comision;
         $comision->numero_pagos = $plan_pago->numero_comisiones;
         $comision->porcentaje = $porcentaje_vendedor;
         $venta->comision()->save($comision);
     }
     return Redirect::action('CotizacionControlador@getIndex');
 }
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Employee::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     /* Employee */
     if (Input::has('createEmployee')) {
         Employee::create($data);
     }
     $message = "登録しました。";
     if (Input::has('deleteEmployee')) {
         $e = Employee::where('name', Input::get('name'))->first();
         Employee::destroy($e->id);
         $message = "削除しました。";
         if (Input::has('selectedEmployee')) {
             Input::replace(array('selectedEmployee', ''));
         }
     }
     if (Input::has('updateEmployee')) {
         $validator_for_update = Validator::make($data = Input::all(), Employee::$update_rules);
         if ($validator_for_update->fails()) {
             return Redirect::back()->withErrors($validator_for_update)->withInput();
         }
         $e = Employee::where('name', Input::get('name'))->first();
         Employee::destroy($e->id);
         $data['name'] = $data['new_name'];
         Employee::create($data);
         $message = "更新しました。";
     }
     return Redirect::route('employees.index')->with('message', $message);
 }
Пример #30
0
 public function __construct($keystring, $datecheck = false, $numcheck = false)
 {
     $this->key = $keystring;
     $this->isDate = $datecheck;
     $this->isNumber = $numcheck;
     $this->value = Input::has($this->key) ? $this->setInput() : '';
 }