public function getInsert()
 {
     //if(Input::old('tanggal')!="" and Input::old('nis')!="") {
     $siswa = \DB::table('t_siswa_tingkat')->where('nis', Input::old('nis'))->first();
     if ($siswa == null) {
         \Session::flash('siswa_ilang', 'NIS tidak ditemukan');
         return redirect('/home');
     }
     $date = Date::createFromFormat('Y-m-d', Input::old('tanggal'));
     $tapel = AbsencesController::checkPeriode($date);
     $tapel['kd_tapel'] = \DB::table('t_tahun_ajaran')->where('tahun_ajaran', $tapel['tahun_ajaran'])->first()->kd_tahun_ajaran;
     $siswa_tingkat = \DB::table('t_siswa_tingkat')->where('nis', $siswa->nis)->where('kd_tahun_ajaran', $tapel['kd_tapel'])->where('kd_periode_belajar', $tapel['periode'])->first();
     if ($siswa_tingkat == null) {
         \Session::flash('tahun_ajaran', 'Tahun ajaran belum dimulai');
         return redirect('/home');
     }
     $siswa = \DB::table('t_siswa')->where('nis', $siswa->nis)->first();
     $pikets = \DB::table('t_piket')->where('hari', $date->format('l'))->first();
     $piket = \DB::table('t_guru')->where('kd_guru', $pikets->kd_guru)->first();
     $jam_masuk = Date::createFromFormat('H:i:s', $pikets->jam_masuk, Date::now()->tzName);
     return view('absences.insert', compact('date', 'jam_masuk', 'siswa', 'siswa_tingkat', 'piket', 'tapel'));
     //}
     //else
     //    return redirect('home');
 }
示例#2
0
 public static function combobox($name, $label, $options, $selected = '', $isRequired = false, $placeholder = '', $helpText = '')
 {
     $strPlaceholder = $placeholder != '' ? ' placeholder="' . $placeholder . '"' : '';
     $strInputRequired = $isRequired == true ? ' required="true"' : '';
     $strValue = Input::old($name, $selected);
     $strField = '<div class="input-append dropdown combobox">' . '<input class="input-large combobox-input" type="text" autocomplete="off" ' . 'value="' . $strValue . '" ' . 'name="' . $name . '" id="' . $name . '"' . $strPlaceholder . $strInputRequired . '/>' . '<span class="add-on btn" data-toggle="dropdown"><i class="caret"></i></span>';
     if (count($options) > 0) {
         $strField .= '<ul class="dropdown-menu">';
         foreach ($options as $option) {
             $strField .= '<li><a href="#">' . $option[$name] . '</a></li>';
         }
         $strField .= '</ul>';
     }
     $strField .= '</div>';
     return self::prv_printField($name, $label, $strField, $isRequired, $helpText);
 }
示例#3
0
 public function index()
 {
     $id = session('user')->id;
     $has_pessoa = session('user')->pessoa ? true : false;
     if (session('user')->pessoa) {
         $nome = session('user')->pessoa['nome'];
         $apelido = session('user')->pessoa['apelido'];
         $cpf = session('user')->pessoa['cpf_cnpj'];
         $tipo = session('user')->pessoa['tipo'];
         $data_nascimento = session('user')->pessoa['data_nascimento'];
     } else {
         $nome = Input::old('nome');
         $apelido = Input::old('apelido');
         $cpf = Input::old('cpf_cnpj');
         $tipo = Input::old('tipo');
         $data_nascimento = Input::old('data_nascimento');
     }
     $data_nascimento = date('d-m-Y', strtotime($data_nascimento));
     return view('dados-pessoais.index', ['id' => $id, 'nome' => $nome, 'apelido' => $apelido, 'cpf' => $cpf, 'tipo' => $tipo, 'data_nascimento' => $data_nascimento, 'has_pessoa' => $has_pessoa]);
 }
 public function edit($id = 0)
 {
     if ($id == 0) {
         $old = Input::old();
         $data = array();
         if (!empty($old)) {
             $data = $old;
         }
         $data['groups'] = array();
     } else {
         $data = Sentry::findUserById($id);
         $groupscursor = $data->getGroups();
         $groups = array();
         foreach ($groupscursor as $v) {
             $groups[] = $v['id'];
         }
         $data['groups'] = $groups;
     }
     $groups = Groups::get();
     return view('users::edit', array('data' => $data, 'groups' => $groups));
 }
 public function getDataArrayConfig($arrConfigInfo, $arrConfigDropDownOptions, $arr_logged_in_user)
 {
     return array('arrConfigInfo' => $arrConfigInfo, 'arrConfigDropDownOptions' => $arrConfigDropDownOptions, 'arr_logged_in_user' => $arr_logged_in_user, 'input_old' => array('ts_test' => Input::old('ts_test', $arrConfigInfo['ts_test']), 'ts_implement' => Input::old('ts_implement', $arrConfigInfo['ts_implement']), 'ts_bypass' => Input::old('ts_bypass', $arrConfigInfo['ts_bypass']), 'permit_delay' => Input::old('permit_delay', $arrConfigInfo['permit_delay'])));
 }
示例#6
0
 /**
  * Search in the database for certain items
  *
  * @param SearchRequest $request
  * @return mixed
  */
 public function search(SearchRequest $request)
 {
     $searchQuery = $request->has('query') ? $request->input('query') : Input::old('query');
     $resultsArray = [];
     // Search in the topics table
     $topics = $this->topic->where('title', 'like', '%' . $searchQuery . '%')->get();
     foreach ($topics as $topicResult) {
         $resultsArray[] = $topicResult;
     }
     // Search in the users table
     $users = $this->user->where('name', 'like', '%' . $searchQuery . '%')->get();
     foreach ($users as $userResult) {
         $resultsArray[] = $userResult;
     }
     // Search in the posts table
     $posts = $this->post->where('content', 'like', '%' . $searchQuery . '%')->get();
     foreach ($posts as $postResult) {
         $resultsArray[] = $postResult;
     }
     // Search for reports
     $reports = $this->report->where('reason', 'like', '%' . $searchQuery . '%')->get();
     foreach ($reports as $reportResult) {
         $resultsArray[] = $reportResult;
     }
     // Search for conversations
     $conversations = $this->conversation->where('subject', 'like', '%' . $searchQuery . '%')->get();
     foreach ($conversations as $conv) {
         $resultsArray[] = $conv;
     }
     $results = Collection::make($resultsArray);
     $results = $results->filter(function ($item) {
         if ($item instanceof User) {
             return !$item->isBanned() and $item->isConfirmed();
         }
         if ($item instanceof Topic) {
             return $item->canView;
         }
         if ($item instanceof Post) {
             return $item->topic != null && $item->topic->canView;
         }
         if ($item instanceof Report) {
             return Entrust::can('viewReports');
         }
         if ($item instanceof Conversation) {
             if (!Auth::check()) {
                 return false;
             }
             try {
                 $item->getParticipantFromUser(Auth::id());
                 return true;
             } catch (ModelNotFoundException $ex) {
                 return false;
             }
         }
     });
     $results = $results->sortBy(function ($item) {
         if ($item instanceof Conversation) {
             return 'conversation_' . mb_strtolower($item->subject);
         }
         if ($item instanceof User) {
             return 'user_' . mb_strtolower($item->name);
         }
         if ($item instanceof Topic) {
             return sprintf('topic_%-12s%s', mb_strtolower($item->title), $item->posts()->count());
         }
         if ($item instanceof Post) {
             if ($item->updated_at == null || $item->updated_at->toDateTimeString() <= $item->created_at->toDateTimeString()) {
                 return sprintf('post_%s%-12s', mb_strtolower($item->content), $item->created_at);
             }
             return sprintf('post_%s%-12s', mb_strtolower($item->content), $item->updated_at);
         }
         if ($item instanceof Report) {
             return sprintf('report_%-12s', mb_strtolower($item->reason));
         }
     });
     return view('core.search.search', compact('results', 'searchQuery'));
 }
示例#7
0
 /**
  * Get the value of the form field. If no POST data exists or reinitialize() has been called, default value
  * will be used. Otherwise, POST value will be used. Using "checkbox" type ensures a boolean return value.
  *
  * @param  string  $name
  * @param  string  $type
  * @return mixed
  */
 public function value($name, $type = 'standard')
 {
     $name = str_replace('(', '', str_replace(')', '', $name));
     $value = "";
     if (isset($this->defaults[$name])) {
         $value = $this->defaults[$name];
     }
     if (!$this->reset) {
         if ($_POST || isset($_GET[$name])) {
             $value = Input::get($name);
         }
         if (Input::old($name)) {
             $value = Input::old($name);
         }
     }
     if ($type == "checkbox") {
         $value = (bool) $value;
     }
     return $value;
 }
示例#8
0
 public static function combobox($name)
 {
     $formElement = new FormElement();
     $formElement->closable(true);
     $formElement->tag('select');
     $formElement->name($name);
     $formElement->value(Input::old($name));
     return $formElement;
 }
示例#9
0
 public function getDataArrayGetAddRole($arr_users_processed, $arr_logged_in_user)
 {
     return array('arr_users' => $arr_users_processed, 'arr_logged_in_user' => $arr_logged_in_user, 'input_old' => array('user_id' => Input::old('user_id', 0)));
 }
示例#10
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param int $id
  * @return Response
  */
 public function edit($id)
 {
     //Check permission
     if (Permissions::isAllowed(Auth::user(), 'user', 'update') !== true) {
         return Redirect::route('get admin/login')->with('reason', Lang::get('firadmin::admin.messages.insufficient-permission') . '<br>')->with('error', 1);
     }
     //Get the user data
     $user = $this->_users->find($id);
     //If the user don't exist
     if (!$user) {
         //Returns a response in JSON format if it's an Ajax request
         if (AjaxRequest::isAjax()) {
             return Response::json(array('error' => 1, 'reason' => Lang::get('firadmin::admin.messages.user-not-found')));
         }
         //Redirect to users index with errors
         return Redirect::to(Config::get('firadmin::route.user'))->with('reason', Lang::get('firadmin::admin.messages.user-not-found'))->with('error', 1);
         //Else the user exist great !
     } else {
         //If we have roles set from input
         Input::old('roles') ? $selected_roles = Input::old('roles') : ($selected_roles = $user->getRoles());
         //No roles selected, get them from the model
         //Define the layout content
         $this->layout->content = View::make('firadmin::users.edit', array('user' => $user, 'selected_roles' => $selected_roles));
     }
 }
 /**
  * Show the form for editing the specified article.
  *
  * @param $slug
  * @return \Illuminate\Http\Response
  */
 public function edit($slug)
 {
     /*
      * --------------------------------------------------------------------------
      * Show edit form
      * --------------------------------------------------------------------------
      * Populate category into list for build drop down, and try catch old
      * subcategory input because it depends on category, by default subcategory
      * should be exist on edit because all article should have it.
      */
     $article = Article::whereSlug($slug)->firstOrFail();
     $categories = Category::pluck('category', 'id');
     $subcategories = null;
     if (Input::old('category', '') != '') {
         $subcategories = Category::findOrFail(Input::old('category'))->subcategories;
     } else {
         $subcategories = Subcategory::whereCategoryId($article->subcategory->category->id)->get();
     }
     return view('contributor.article_edit', compact('article', 'categories', 'subcategories'));
 }
示例#12
0
 public function getDataArrayGetSignUp()
 {
     return array('input_old' => array('first_name' => Input::old('first_name'), 'last_name' => Input::old('last_name'), 'company' => Input::old('company'), 'client_url' => Input::old('client_url'), 'email' => Input::old('email')));
 }
示例#13
0
 public function getDataArrayGetEditUser($cloaked_client_id, $arr_logged_in_user)
 {
     return array('input_old' => array('first_name' => Input::old('first_name', $arr_logged_in_user['first_name']), 'last_name' => Input::old('last_name', $arr_logged_in_user['last_name']), 'company' => Input::old('company', $arr_logged_in_user['company']), 'client_url' => Input::old('client_url', $arr_logged_in_user['client_url'])), 'cloaked_client_id' => $cloaked_client_id, 'arr_logged_in_user' => $arr_logged_in_user);
 }
示例#14
0
 public function load($ids = array(), $old_flag = true)
 {
     if (!is_array($ids)) {
         $ids = [$ids];
     }
     if ($old_flag && Input::old($this->_id_hidden_name) && is_array(Input::old($this->_id_hidden_name))) {
         $ids = Input::old($this->_id_hidden_name);
     }
     if (!empty($ids)) {
         $this->_load = array();
         $image_files = DB::table(self::TABLE)->select('id', 'dir', 'filename', 'extension', 'size', 'created_at', 'attributes')->whereIn('id', $ids)->get();
         foreach ($image_files as $image_file) {
             $this->addLoadObject(array('id' => $image_file->id, 'dir' => $image_file->dir, 'filename' => $image_file->filename, 'extension' => $image_file->extension, 'size' => $image_file->size, 'created_at' => $image_file->created_at, 'attributes' => json_decode($image_file->attributes, true)));
         }
     }
     return $this;
 }
示例#15
0
文件: Formly.php 项目: jonob/formly
 /**
  * Automatically populate the form field value
  *
  * @todo Note that there is s small error with checkboxes that are selected by default
  * and then unselected by the user. If validation fails, then the checkbox will be
  * selected again, because unselected checkboxes are not posted and there is no way
  * to get this value after the redirect.
  *
  * @param  string $name Html form field to populate
  * @param  string $default The default value for the field
  * @param  string $radioValue Set to true for radio buttons
  * @return string
  */
 private function calculateValue($name, $default = '', $radioValue = '')
 {
     $result = '';
     // First check if there is post data
     // This assumes that you are redirecting after failed post
     // and that you have flashed the data
     // @see http://laravel.com/docs/input#old-input
     if (Input::old($name) !== null) {
         $result = $radioValue ? Input::old($name) == $radioValue : Input::old($name, $default);
     } elseif (!empty($default)) {
         $result = $default;
     } elseif (isset($this->defaults->{$name})) {
         $result = $radioValue ? $this->defaults->{$name} == $radioValue : $this->defaults->{$name};
     }
     return $result;
 }