本文整理汇总了PHP中Input::method方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::method方法的具体用法?PHP Input::method怎么用?PHP Input::method使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Input
的用法示例。
在下文中一共展示了Input::method方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_upload
/**
* Upload action
* @access public
* @return Response
*/
public function action_upload()
{
$files = array();
if (\Input::method() == 'POST') {
\Util_security::check_csrf();
$file_tmps = array();
$moved_files = array();
try {
//if (!$val->run()) throw new \FuelException($val->show_errors());
$file_tmps = \Site_FileTmp::get_file_tmps_uploaded($this->u->id, true);
//\Site_FileTmp::check_uploaded_under_accepted_filesize($file_tmps, $this->u->filesize_total, \Site_Upload::get_accepted_filesize());
\DB::start_transaction();
list($moved_files, $site_image_ids) = \Site_FileTmp::save_images($file_tmps, $this->u->id, 'admin_user_id', 'site_image');
\DB::commit_transaction();
// thumbnail 作成 & tmp_file thumbnail 削除
\Site_FileTmp::make_and_remove_thumbnails($moved_files);
$message = sprintf('%sをアップロードしました。', term('site.image'));
\Session::set_flash('message', $message);
\Response::redirect('admin/content/image');
} catch (\FuelException $e) {
if (\DB::in_transaction()) {
\DB::rollback_transaction();
}
if ($moved_files) {
\Site_FileTmp::move_files_to_tmp_dir($moved_files);
}
$files = \Site_FileTmp::get_file_objects($file_tmps, $this->u->id);
\Session::set_flash('error', $e->getMessage());
}
}
$this->template->post_header = \View::forge('filetmp/_parts/upload_header');
$this->template->post_footer = \View::forge('_parts/form/upload_footer');
$this->set_title_and_breadcrumbs(term('site.image', 'form.upload'), array('admin/content' => term('site.content', 'site.management'), 'admin/content/image' => term('site.image', 'site.management')));
$this->template->content = \View::forge('_parts/form/upload', array('files' => $files));
}
示例2: action_repass
public function action_repass($onepass)
{
if (!Model_User::count(array('where' => array('onepass' => $onepass)))) {
Response::redirect('user/login/without');
}
if (Input::method() == 'POST') {
$val = Model_User::validate('repass');
$val->add_field('email', 'Eメール', 'required|valid_email');
if ($val->run()) {
$user = Model_User::find('first', array('where' => array('onepass' => $onepass)));
$last_login = mb_substr($user['last_login'], -4);
$reset = Input::post('reset');
if ($last_login == $reset) {
$username = Input::post('username');
$email = Input::post('email');
$password = Input::post('password');
if ($username == $user['username'] && $email == $user['email']) {
$user->onepass = md5(time());
$user->save();
$auth = Auth::instance();
$old = $auth->reset_password($username);
$auth->change_password($old, $password, $username);
Response::redirect('user/login');
} else {
Session::set_flash('na', '<p><span class="alert-error">該当者がいません</span></p>');
}
} else {
Session::set_flash('error', "<p>" . $val->show_errors() . "</p>");
}
}
return Model_User::theme('admin/template', 'user/login/repass');
}
}
示例3: action_edit
public function action_edit($id = null)
{
$pay = Model_Part::find($id);
$val = Model_Part::validate('edit');
if ($val->run()) {
$pay->status = Input::post('status');
$pay->price = Input::post('price');
$pay->ship_number = Input::post('ship_number');
$pay->box_number = Input::post('box_number');
$pay->tracking = Input::post('tracking');
$pay->memo = Input::post('memo');
if ($pay->save()) {
Session::set_flash('success', e('Updated pay #' . $id));
Response::redirect('admin/pay');
} else {
Session::set_flash('error', e('Could not update pay #' . $id));
}
} else {
if (Input::method() == 'POST') {
$pay->status = $val->validated('status');
$pay->price = $val->validated('price');
$pay->ship_number = $val->validated('ship_number');
$pay->box_number = $val->validated('box_number');
$pay->tracking = $val->validated('tracking');
$pay->memo = $val->validated('memo');
Session::set_flash('error', $val->error());
}
$this->template->set_global('pay', $pay, false);
}
$this->template->title = "pays";
$this->template->content = View::forge('admin/pay/edit');
}
示例4: action_edit
/**
* Редактирование записи
*
* @param int $id
*/
public function action_edit($id = null)
{
is_null($id) and \Response::redirect_back('admin/videos');
if (!($video = \Model_Video::find($id))) {
\Session::set_flash('error', 'Невозможно найти видео #' . $id);
\Response::redirect_back('admin/videos');
}
$val = \Model_Video::validate('edit');
if ($val->run()) {
$video->videoid = \Input::post('videoid');
if ($video->save()) {
\Session::set_flash('success', 'Видео обновлено.');
\Response::redirect_back('admin/videos');
} else {
\Session::set_flash('error', 'Could not update video #' . $id);
}
} else {
if (\Input::method() == 'POST') {
$video->videoid = $val->validated('videoid');
\Session::set_flash('error', $val->error());
}
$this->template->set_global('video', $video, false);
}
$this->template->content = \View::forge('videos/edit');
}
示例5: action_edit
public function action_edit($id = null)
{
$setting = Model_Setting::find($id);
$val = Model_Setting::validate('edit');
if ($val->run()) {
$setting->setting_key = Input::post('setting_key');
$setting->setting_title = Input::post('setting_title');
$setting->setting_value = Input::post('setting_value');
$setting->setting_data_type_id = Input::post('setting_data_type_id');
if ($setting->save()) {
Session::set_flash('success', e('Updated setting #' . $id));
Response::redirect('admin/settings/view/' . $setting->id);
} else {
Session::set_flash('error', e('Could not update setting #' . $id));
}
} else {
if (Input::method() == 'POST') {
$setting->setting_key = $val->validated('setting_key');
$setting->setting_title = $val->validated('setting_title');
$setting->setting_value = $val->validated('setting_value');
$setting->setting_data_type_id = $val->validated('setting_data_type_id');
Session::set_flash('error', $val->error());
}
$this->template->set_global('setting', $setting, false);
}
$this->template->set_global('data_types', Model_Setting_Data_Type::find('all', array('order_by' => array(array('name', 'asc')))));
$this->template->title = "Settings";
$this->template->content = View::forge('admin/settings/edit');
}
示例6: action_edit
public function action_edit($id = null)
{
is_null($id) and Response::redirect('Survey');
if (!($survey = Model_Survey::find($id))) {
Session::set_flash('error', 'Could not find survey #' . $id);
Response::redirect('Survey');
}
$val = Model_Survey::validate('edit');
if ($val->run()) {
$survey->title = Input::post('title');
$survey->description = Input::post('description');
$survey->type = Input::post('type');
if ($survey->save()) {
Session::set_flash('success', 'Updated survey #' . $id);
Response::redirect('survey');
} else {
Session::set_flash('error', 'Could not update survey #' . $id);
}
} else {
if (Input::method() == 'POST') {
$survey->title = $val->validated('title');
$survey->description = $val->validated('description');
$survey->type = $val->validated('type');
Session::set_flash('error', $val->error());
}
$this->template->set_global('survey', $survey, false);
}
$this->template->title = "Surveys";
$this->template->content = View::forge('survey/edit');
}
示例7: action_edit
public function action_edit($id = null)
{
parent::has_access("add_leave");
is_null($id) and Response::redirect('leaves');
if (!($leave = Model_Leave::find($id))) {
Session::set_flash('error', 'Could not find leave #' . $id);
Response::redirect('leaves');
}
$val = Model_Leave::validate('edit');
if ($val->run()) {
$var_dol_day = Input::post('dol_day');
$var_dol_month = Input::post('dol_month');
$var_dol_year = Input::post('dol_year');
$var_dol = $var_dol_year . '-' . $var_dol_month . '-' . $var_dol_day;
$leave->date_of_leave = $var_dol;
$leave->time = Input::post('time');
$leave->type = Input::post('type');
if ($leave->save()) {
Session::set_flash('success', 'Updated leave #' . $id);
Response::redirect('leaves/view/' . $leave->employee_id);
} else {
Session::set_flash('error', 'Could not update leave #' . $id);
}
} else {
if (Input::method() == 'POST') {
$leave->date_of_leave = $val->validated('date_of_leave');
$leave->time = $val->validated('time');
$leave->type = $val->validated('type');
Session::set_flash('error', $val->error());
}
$this->template->set_global('leave', $leave, false);
}
$this->template->title = "Leaves";
$this->template->content = View::forge('leaves/edit');
}
示例8: action_edit
public function action_edit($id = null)
{
if (Auth::has_access('country.edit') == false) {
Session::set_flash("error", "Only admins may edit countries!");
Response::redirect("country/") and die;
}
is_null($id) and Response::redirect('Country');
$country = Model_Country::find($id);
$val = Model_Country::validate('edit');
if ($val->run()) {
$country->name = Input::post('name');
$country->iso_code = Input::post('iso_code');
if ($country->save()) {
Session::set_flash('success', 'Updated country #' . $id);
Response::redirect('country');
} else {
Session::set_flash('error', 'Could not update country #' . $id);
}
} else {
if (Input::method() == 'POST') {
$country->name = $val->validated('name');
$country->iso_code = $val->validated('iso_code');
Session::set_flash('error', $val->error());
}
$this->template->set_global('country', $country, false);
}
$this->template->title = "Countries";
$this->template->content = View::forge('country/edit');
}
示例9: action_edit
public function action_edit($id = null)
{
is_null($id) and Response::redirect('Proxies');
$proxy = Model_Proxy::find($id);
$val = Model_Proxy::validate('edit');
if ($val->run()) {
$proxy->host = Input::post('host');
$proxy->port = Input::post('port');
$proxy->fail_count = Input::post('fail_count');
if ($proxy->save()) {
Session::set_flash('success', 'Updated proxy #' . $id);
Response::redirect('proxies');
} else {
Session::set_flash('error', 'Could not update proxy #' . $id);
}
} else {
if (Input::method() == 'POST') {
$proxy->host = $val->validated('host');
$proxy->port = $val->validated('port');
$proxy->fail_count = $val->validated('fail_count');
Session::set_flash('error', $val->error());
}
$this->template->set_global('proxy', $proxy, false);
}
$this->template->title = "Proxies";
$this->template->content = View::forge('proxies/edit');
}
示例10: action_edit
public function action_edit($id = null)
{
is_null($id) and Response::redirect('Survey_Question_Answer');
if (!($survey_question_answer = Model_Survey_Question_Answer::find($id))) {
Session::set_flash('error', 'Could not find survey_question_answer #' . $id);
Response::redirect('Survey_Question_Answer');
}
$val = Model_Survey_Question_Answer::validate('edit');
if ($val->run()) {
$survey_question_answer->question_id = Input::post('question_id');
$survey_question_answer->answer = Input::post('answer');
if ($survey_question_answer->save()) {
Session::set_flash('success', 'Updated survey_question_answer #' . $id);
Response::redirect('survey/question/answer');
} else {
Session::set_flash('error', 'Could not update survey_question_answer #' . $id);
}
} else {
if (Input::method() == 'POST') {
$survey_question_answer->question_id = $val->validated('question_id');
$survey_question_answer->answer = $val->validated('answer');
Session::set_flash('error', $val->error());
}
$this->template->set_global('survey_question_answer', $survey_question_answer, false);
}
$this->template->title = "Survey_question_answers";
$this->template->content = View::forge('survey/question/answer/edit');
}
示例11: before
public function before()
{
parent::before();
// Check Auth
if (!\Auth\Auth::check()) {
\Fuel\Core\Response::redirect('auth');
}
/*
* Theme Set
*/
$this->theme = \Theme::instance();
$this->theme->set_template('index');
/*
* Breadcrumb
*/
// $this->_breadcrumb = Breadcrumb::create_links();
if (Session::get('lang')) {
$this->_lang = Session::get('lang');
}
if (Input::method() == 'GET') {
$this->_get = Input::get();
}
if (Input::method() == 'POST') {
$this->_post = Input::post();
}
$this->initialized();
}
示例12: action_edit
public function action_edit($id = null)
{
is_null($id) and Response::redirect('blog');
if (!($blog = Model_Blog::find($id))) {
Session::set_flash('error', 'Could not find blog #' . $id);
Response::redirect('blog');
}
$val = Model_Blog::validate('edit');
if ($val->run()) {
$blog->title = Input::post('title');
$blog->content = Input::post('content');
if ($blog->save()) {
Session::set_flash('success', 'Updated blog #' . $id);
Response::redirect('blog');
} else {
Session::set_flash('error', 'Could not update blog #' . $id);
}
} else {
if (Input::method() == 'POST') {
$blog->title = $val->validated('title');
$blog->content = $val->validated('content');
Session::set_flash('error', $val->error());
}
$this->template->set_global('blog', $blog, false);
}
$this->template->title = "Blogs";
$this->template->content = View::forge('blog/edit');
}
示例13: action_edit
public function action_edit($id = null)
{
parent::has_access("create_employee");
is_null($id) and Response::redirect('employees/view' . $id);
if (!($bank = Model_Bank::find('first', array('where' => array('employee_id' => $id))))) {
Session::set_flash('error', 'Could not find user #' . $id);
Response::redirect('employees/view/' . $id);
}
if (Input::method() == 'POST') {
$bank->account_no = Input::post('account_no');
$bank->account_type = Input::post('account_type');
$bank->branch = Input::post('branch');
$bank->city = Input::post('city');
$bank->state = Input::post('state');
$bank->ifsc_code = Input::post('ifsc_code');
$bank->payment_type = Input::post('payment_type');
if ($bank->save()) {
Session::set_flash('success', 'Updated bank details #' . $id);
Response::redirect('employees/view/' . $id);
} else {
Session::set_flash('error', 'Could not update bank #' . $id);
}
}
$this->template->title = "Banks";
$this->template->content = View::forge('banks/edit');
}
示例14: action_edit
public function action_edit($id = null)
{
is_null($id) and Response::redirect('request');
if (!($request = Model_Request::find($id))) {
Session::set_flash('error', 'Could not find request #' . $id);
Response::redirect('request');
}
$val = Model_Request::validate('edit');
if ($val->run()) {
$request->body = Input::post('body');
$request->ip = Input::post('ip');
if ($request->save()) {
Session::set_flash('success', 'Updated request #' . $id);
Response::redirect('request');
} else {
Session::set_flash('error', 'Could not update request #' . $id);
}
} else {
if (Input::method() == 'POST') {
$request->body = $val->validated('body');
$request->ip = $val->validated('ip');
Session::set_flash('error', $val->error());
}
$this->template->set_global('request', $request, false);
}
$this->template->title = "Requests";
$this->template->content = View::forge('request/edit');
}
示例15: action_edit
public function action_edit($id = null)
{
is_null($id) and Response::redirect('userstationlog');
if (!($userstationlog = Model_Userstationlog::find($id))) {
Session::set_flash('error', 'Could not find userstationlog #' . $id);
Response::redirect('userstationlog');
}
$val = Model_Userstationlog::validate('edit');
if ($val->run()) {
$userstationlog->id = Input::post('id');
$userstationlog->base_line = Input::post('base_line');
$userstationlog->station_id = Input::post('station_id');
$userstationlog->station_id_index = Input::post('station_id_index');
if ($userstationlog->save()) {
Session::set_flash('success', 'Updated userstationlog #' . $id);
Response::redirect('userstationlog');
} else {
Session::set_flash('error', 'Could not update userstationlog #' . $id);
}
} else {
if (Input::method() == 'POST') {
$userstationlog->id = $val->validated('id');
$userstationlog->base_line = $val->validated('base_line');
$userstationlog->station_id = $val->validated('station_id');
$userstationlog->station_id_index = $val->validated('station_id_index');
Session::set_flash('error', $val->error());
}
$this->template->set_global('userstationlog', $userstationlog, false);
}
$this->template->title = "Userstationlogs";
$this->template->content = View::forge('userstationlog/edit');
}