Exemplo n.º 1
0
 public function action_index()
 {
     $this->template->title = "Terms of Use";
     $this->template->sub = "";
     $view = View::forge("terms");
     $this->template->content = $view;
 }
 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');
 }
Exemplo n.º 3
0
 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');
 }
Exemplo n.º 4
0
 public function view()
 {
     $right_items = [View::forge('layouts/index/right_items/settings_icon')];
     $section_links = [View::forge('layout/navtab', ['link_content' => 'Start', 'link' => 'view/layouts_start']), View::forge('layout/navtab', ['link_content' => 'Settings', 'link' => 'view/layouts_settings']), View::forge('layout/navtab', ['link_content' => 'Fleet', 'link' => 'view/layouts_fleet'])];
     $header = View::forge('layout/nav_header', ['section_links' => $section_links, 'right_items' => $right_items]);
     $this->header_view = $header;
 }
Exemplo n.º 5
0
 /**
  * Редактирование записи
  * 
  * @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');
 }
Exemplo n.º 6
0
 public function action_new()
 {
     if (@$_GET['bbstype']) {
         $bbstype = $_GET['bbstype'];
     } elseif (@$_POST['bbs_type_id']) {
         $bbstype = $_POST['bbs_type_id'];
     } else {
         $bbstype = 0;
     }
     $input = \Model\Imp::setDefaultPost($_POST, $_GET, Session::get());
     //if(@$_POST) \De::str($input);
     $view = View::forge('imp/new');
     $view->set('bbstype', $bbstype);
     $view->set_safe('input', $input);
     $view->set('mail_flag', @$input['mail_flag'] == 'on' ? true : false);
     // $mail_flag = @$input['mail_flag'] ? "checked='checked'" : '' ;
     $this->template->set_global('title', \Model\imp::getTitle($bbstype));
     $this->template->set_global('bbstype', $bbstype);
     if (@$_POST['formkey']) {
         $result = \Model\Imp::insertPost($_POST);
         // \De::str($result);
         if ($result) {
             \Response::redirect('/imp/imp?bbstype=' . $_POST['bbs_type_id']);
             exit;
         } else {
             //\De::str(\Session::get());
             //\Response::redirect('/imp/new');
         }
     } else {
         // if(@$_POST) //echo "不正アクセスです。";exit;
     }
     $this->template->content = $view;
     return $this->template;
 }
Exemplo n.º 7
0
 public function action_Edit($Kid = 0)
 {
     //ドロップダウンリストの生成
     $select = Model_College::get_list();
     $Kid and $this->data['category'] = Model_Category::query()->where('Kid', '=', $Kid)->get();
     if (Input::post()) {
         $val = Model_Category::validate();
         if ($val->run()) {
             $query = DB::update('Category')->set(array('Cid' => Input::post('college'), 'Kname' => Input::post('Kname'), 'Kkana' => Input::post('Kkana'), 'luID' => Auth::get_screen_name()))->where('Kid', '=', $Kid)->execute();
             Response::redirect('category');
         } else {
             $this->message = $val->error();
             $view = View::forge('categorymanagement/CategoryEdit', $this->data);
             $view->set_global('message', $this->message, false);
             //ドロップダウン箇所のセット
             $view->set_global('select', $select, false);
         }
     } else {
         $view = View::forge('categorymanagement/CategoryEdit', $this->data);
         $view->set_global('message', $this->message, false);
         //ドロップダウン箇所のセット
         $view->set_global('select', $select, false);
     }
     return $view;
 }
Exemplo n.º 8
0
 public function action_edit($id = null)
 {
     is_null($id) and Response::redirect('point');
     if (!($point = Model_Point::find($id))) {
         Session::set_flash('error', 'Could not find point #' . $id);
         Response::redirect('point');
     }
     $val = Model_Point::validate('edit');
     if ($val->run()) {
         $point->user_id = Input::post('user_id');
         $point->point = Input::post('point');
         if ($point->save()) {
             Session::set_flash('success', 'Updated point #' . $id);
             Response::redirect('point');
         } else {
             Session::set_flash('error', 'Could not update point #' . $id);
         }
     } else {
         if (Input::method() == 'POST') {
             $point->user_id = $val->validated('user_id');
             $point->point = $val->validated('point');
             Session::set_flash('error', $val->error());
         }
         $this->template->set_global('point', $point, false);
     }
     $this->template->title = "Points";
     $this->template->content = View::forge('point/edit');
 }
Exemplo n.º 9
0
 public function action_index()
 {
     require "call.php";
     $this->template->title = "Try It Yourself";
     $view = View::forge("try");
     $this->template->content = $view;
 }
Exemplo n.º 10
0
 public function action_index()
 {
     require "call.php";
     $this->template->title = "Tutor";
     $view = View::forge("tutor");
     $this->template->content = $view;
 }
Exemplo n.º 11
0
 public function action_edit($id = null)
 {
     $form = Model_Form::find($id);
     $val = Model_Form::validate('edit');
     if ($val->run()) {
         $form->name = Input::post('name');
         $form->email = Input::post('email');
         $form->comment = Input::post('comment');
         $form->ip_address = Input::post('ip_address');
         $form->user_agent = Input::post('user_agent');
         if ($form->save()) {
             Session::set_flash('success', e('Updated form #' . $id));
             Response::redirect('admin/form');
         } else {
             Session::set_flash('error', e('Could not update form #' . $id));
         }
     } else {
         if (Input::method() == 'POST') {
             $form->name = $val->validated('name');
             $form->email = $val->validated('email');
             $form->comment = $val->validated('comment');
             $form->ip_address = $val->validated('ip_address');
             $form->user_agent = $val->validated('user_agent');
             Session::set_flash('error', $val->error());
         }
         $this->template->set_global('form', $form, false);
     }
     $this->template->title = "Forms";
     $this->template->content = View::forge('admin/form/edit');
 }
 public function action_edit($id = null)
 {
     $currency = Model_Currency::find($id);
     $val = Model_Currency::validate('edit');
     if ($val->run()) {
         $currency->name = Input::post('name');
         $currency->symbol = Input::post('symbol');
         $currency->country = Input::post('country');
         $currency->is_default = Input::post('is_default');
         $currency->exchange_rate = Input::post('exchange_rate');
         if ($currency->save()) {
             Session::set_flash('success', e('Updated currency #' . $id));
             Response::redirect('admin/currencies');
         } else {
             Session::set_flash('error', e('Could not update currency #' . $id));
         }
     } else {
         if (Input::method() == 'POST') {
             $currency->name = $val->validated('name');
             $currency->symbol = $val->validated('symbol');
             $currency->country = $val->validated('country');
             $currency->is_default = $val->validated('is_default');
             $currency->exchange_rate = $val->validated('exchange_rate');
             Session::set_flash('error', $val->error());
         }
         $this->template->set_global('currency', $currency, false);
     }
     $countries = Model_Country::find('all', array('order_by' => array(array('name', 'asc'))));
     $this->template->set_global('countries', $countries);
     $this->template->set_global('yes_no', array('0' => 'No', '1' => 'Yes'));
     $this->template->title = "Currencies";
     $this->template->content = View::forge('admin/currencies/edit');
 }
Exemplo n.º 13
0
 /**
  * TOP
  *
  * @access  public
  * @return  Response
  */
 public function action_index()
 {
     if (Input::get('lang') == 'en') {
         $view = View::forge(self::VIEW_FILE_PREFIX_EN . 'index.tpl');
     } elseif (Input::get('lang') == 'hk') {
         $view = View::forge(self::VIEW_FILE_PREFIX_HK . 'index.tpl');
     } elseif (Input::get('lang') == 'hkj') {
         $view = View::forge(self::VIEW_FILE_PREFIX_HKJ . 'index.tpl');
     } elseif (Input::get('lang') == 'hkzh') {
         $view = View::forge(self::VIEW_FILE_PREFIX_HKZH . 'index.tpl');
     } else {
         $view = View::forge(self::VIEW_FILE_PREFIX . 'index.tpl');
     }
     // 現在、tplに直書きの為、コメントアウト
     /*        
             $list = Model_Support_Help::get_help(2, null);
             $ipost_list = Model_Support_Help::get_help_ipost();
             $sub_menu   = Model_Master_Support_Help_Genre::find_all();
     
             $view->set('sub_menu',     $sub_menu);
             $view->set('list',         $list);
             $view->set('ipost_list',   $ipost_list);
     */
     return $view;
 }
Exemplo n.º 14
0
 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');
 }
Exemplo n.º 15
0
 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');
 }
Exemplo n.º 16
0
 /**
  * Mmeber_profile edit
  * 
  * @access  public
  * @return  Response
  */
 public function action_edit($type = null)
 {
     list($type, $is_regist) = self::validate_type($type, $this->u->id);
     $form_member_profile = new Form_MemberProfile($type == 'regist' ? 'regist-config' : 'config', $this->u);
     $form_member_profile->set_validation();
     if (\Input::method() == 'POST') {
         \Util_security::check_csrf();
         try {
             $form_member_profile->validate(true);
             \DB::start_transaction();
             $form_member_profile->seve();
             if ($is_regist) {
                 Model_MemberConfig::delete_value($this->u->id, 'terms_un_agreement');
             }
             \DB::commit_transaction();
             $message = $is_regist ? sprintf('%sが%sしました。', term('site.registration'), term('form.complete')) : term('profile') . 'を編集しました。';
             $redirect_uri = $is_regist ? $this->after_auth_uri : 'member/profile';
             \Session::set_flash('message', $message);
             \Response::redirect($redirect_uri);
         } catch (\FuelException $e) {
             if (\DB::in_transaction()) {
                 \DB::rollback_transaction();
             }
             \Session::set_flash('error', $e->getMessage());
         }
     }
     $this->set_title_and_breadcrumbs(term('profile') . term($is_regist ? 'site.registration' : 'form.edit'), $is_regist ? array() : array('member/profile' => term('common.my', 'profile')), $is_regist ? null : $this->u);
     $this->template->content = View::forge('member/profile/edit', array('is_regist' => $is_regist, 'val' => $form_member_profile->get_validation(), 'member_public_flags' => $form_member_profile->get_member_public_flags(), 'profiles' => $form_member_profile->get_profiles(), 'member_profile_public_flags' => $form_member_profile->get_member_profile_public_flags()));
 }
Exemplo n.º 17
0
 /**
  * Mmeber setting viewtype
  * 
  * @access  public
  * @return  Response
  */
 public function action_index()
 {
     $page_name = term('notice', 'site.setting');
     $val = \Form_MemberConfig::get_validation($this->u->id, 'notice', 'Notice');
     if (\Input::method() == 'POST') {
         \Util_security::check_csrf();
         try {
             if (!$val->run()) {
                 throw new \FuelException($val->show_errors());
             }
             $post = $val->validated();
             \DB::start_transaction();
             \Form_MemberConfig::save($this->u->id, $val, $post);
             \DB::commit_transaction();
             \Session::set_flash('message', $page_name . 'を変更しました。');
             \Response::redirect('member/setting');
         } catch (\FuelException $e) {
             if (\DB::in_transaction()) {
                 \DB::rollback_transaction();
             }
             \Session::set_flash('error', $e->getMessage());
         }
     }
     $this->set_title_and_breadcrumbs($page_name, array('member/setting' => term('site.setting', 'form.update')), $this->u);
     $this->template->content = \View::forge('member/setting/_parts/form', array('val' => $val, 'label_size' => 5, 'form_params' => array('common' => array('radio' => array('layout_type' => 'grid')))));
 }
Exemplo n.º 18
0
 public function action_edit($id = null)
 {
     is_null($id) and Response::redirect('News');
     $news = Model_News::find($id);
     $val = Model_News::validate('edit');
     if ($val->run()) {
         $news->title = Input::post('title');
         $news->article = Input::post('article');
         $news->call_center_id = Input::post('call_center_id');
         $news->user_id = Input::post('user_id');
         if ($news->save()) {
             Session::set_flash('success', 'Updated news #' . $id);
             Response::redirect('news');
         } else {
             Session::set_flash('error', 'Could not update news #' . $id);
         }
     } else {
         if (Input::method() == 'POST') {
             $news->title = $val->validated('title');
             $news->article = $val->validated('article');
             $news->call_center_id = $val->validated('call_center_id');
             $news->user_id = $val->validated('user_id');
             Session::set_flash('error', $val->error());
         }
         $this->template->set_global('news', $news, false);
     }
     $this->template->title = "News";
     $this->template->content = View::forge('news/edit');
 }
Exemplo n.º 19
0
Arquivo: lot.php Projeto: wxl2012/wx
 /**
  * 拍品详情
  *
  * @param int $id 拍品ID
  */
 public function action_view($id = 0)
 {
     $params = ['title' => '精选拍品'];
     $params['item'] = \Model_Lot::find($id);
     \View::set_global($params);
     $this->template->content = \View::forge("{$this->theme}/lot/view");
 }
Exemplo n.º 20
0
 /**
  * Sends the instructions to a user's email address.
  *
  * @return bool
  */
 private static function _send_instructions($name, Model_User $user)
 {
     $config_key = null;
     switch ($name) {
         case 'confirmation':
             $config_key = 'confirmable';
             break;
         case 'reset_password':
             $config_key = 'recoverable';
             break;
         case 'unlock':
             $config_key = 'lockable';
             break;
         default:
             throw new \InvalidArgumentException("Invalid instruction: {$name}");
     }
     $mail = \Email::forge();
     $mail->from(\Config::get('email.defaults.from.email'), \Config::get('email.defaults.from.name'));
     $mail->to($user->email);
     $mail->subject(__("warden.mailer.subject.{$name}"));
     $token_name = "{$name}_token";
     $mail->html_body(\View::forge("warden/mailer/{$name}_instructions", array('username' => $user->username, 'uri' => \Uri::create(':url/:token', array('url' => rtrim(\Config::get("warden.{$config_key}.url"), '/'), 'token' => $user->{$token_name})))));
     $mail->priority(\Email::P_HIGH);
     try {
         return $mail->send();
     } catch (\EmailSendingFailedException $ex) {
         logger(\Fuel::L_ERROR, "Warden\\Mailer failed to send {$name} instructions.");
         return false;
     }
 }
Exemplo n.º 21
0
 public function action_edit($id = null)
 {
     is_null($id) and Response::redirect('news/category');
     if (!($news_category = Model_News_Category::find($id))) {
         Session::set_flash('error', 'Could not find news_category #' . $id);
         Response::redirect('news/category');
     }
     $val = Model_News_Category::validate('edit');
     if ($val->run()) {
         $news_category->name = Input::post('name');
         if ($news_category->save()) {
             Session::set_flash('success', 'Updated news_category #' . $id);
             Response::redirect('news/category');
         } else {
             Session::set_flash('error', 'Could not update news_category #' . $id);
         }
     } else {
         if (Input::method() == 'POST') {
             $news_category->name = $val->validated('name');
             Session::set_flash('error', $val->error());
         }
         $this->template->set_global('news_category', $news_category, false);
     }
     $this->template->title = "News_categories";
     $this->template->content = View::forge('news/category/edit');
 }
Exemplo n.º 22
0
 public static function render($app, $ref_id, $title = 'Comments')
 {
     if (!isset($app)) {
         throw new \FuelException('Petro_Comment : Invalid $app = ' . $app);
     }
     $query = \DB::query('SELECT ' . static::$_table . '.*, users.username FROM ' . static::$_table . ', users' . ' WHERE ' . static::$_table . '.user_id = users.id' . ' AND ' . static::$_table . '.app = "' . $app . '"' . ' AND ' . static::$_table . '.ref_id = ' . $ref_id . ' ORDER BY ' . static::$_table . '.created_at asc')->execute();
     $data['title'] = $title;
     $data['app'] = $app;
     $data['ref_id'] = $ref_id;
     $data['total_comments'] = count($query);
     if ($data['total_comments'] <= 0) {
         $data['comments'] = str_replace('{text}', 'No comments yet.', \Config::get('petro.template.comment.empty'));
     } else {
         $t = \Config::get('petro.template.comment.item');
         $out = '';
         foreach ($query as $item) {
             $author = isset($item['username']) ? $item['username'] : '******';
             $date = empty($item['created_at']) ? '' : \Date::forge($item['created_at'])->format(\Config::get('petro.date_format', '%Y-%m-%d %H:%M'));
             $cost = empty($item['cost']) ? '' : number_format($item['cost']);
             $out .= str_replace(array('{comment_id}', '{comment_author}', '{comment_date}', '{comment_text}', '{comment_cost}'), array($item['id'], $author, $date, nl2br($item['text']), $cost), $t);
         }
         $data['comments'] = $out;
     }
     $data['last_url'] = \Uri::current();
     return \View::forge('petro/comments/_form', $data, false)->render();
 }
 public function action_search()
 {
     //main.jsから投げられたpostdataを取得
     $category = Input::post('category');
     $refine = Input::post('refine');
     $text = Input::post('text');
     //検索条件の生成
     $query = ['limit' => '', 'order' => 'year', 'column' => 'category', 'value' => $category, 'column2' => '', 'value2' => ''];
     if ($category == 'all') {
         $query['column'] = '';
         $query['value'] = '';
     }
     //テキストボックスに何も入力されていなかったら
     if ($text) {
         if ($refine == 'all') {
             $query['value2'] = '%' . $text . '%';
             //生成した検索条件をModel(paperadministration/papsersearch/papersearch)に渡す
             $contents['papers'] = Model_Paperadministration_Papersearch::find_all($query);
         } else {
             $query['column2'] = $refine;
             $query['value2'] = '%' . $text . '%';
             //生成した検索条件をModel(paperadministration/papsersearch/papersearch)に渡す
             $contents['papers'] = Model_Paperadministration_Papersearch::find_paper($query);
         }
     } else {
         //生成した検索条件をModel(paperadministration/papsersearch/papersearch)に渡す
         $contents['papers'] = Model_Paperadministration_Papersearch::find_paper($query);
     }
     $contents['pagetitle'] = '';
     //検索してきた論文たちをViewのコンテンツ部分(paperadministration/parts/newpaper)に渡す
     $data['content'] = View::forge('paperadministration/parts/content', $contents);
     //main.jsに検索結果を挿入済みのコンテンツ部分を渡す
     return $data['content'];
 }
Exemplo n.º 24
0
 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');
 }
Exemplo n.º 25
0
 public function action_edit($id = null)
 {
     $student = Model_Student::find('first', ['where' => ['user_id' => $id]]);
     if (!$student) {
         $student = Model_Student::forge(['user_id' => $id]);
     }
     $val = Model_Student::validate('edit');
     if ($val->run()) {
         $student->user_id = Input::post('user_id');
         $student->year_level = Input::post('year_level');
         $student->course_id = Input::post('course_id');
         if ($student->save()) {
             Session::set_flash('success', e('Updated student #' . $id));
             Response::redirect('site/student');
         } else {
             Session::set_flash('error', e('Could not update student #' . $id));
         }
     } else {
         if (Input::method() == 'POST') {
             $student->user_id = $val->validated('user_id');
             $student->year_level = $val->validated('year_level');
             $student->course_id = $val->validated('course_id');
             Session::set_flash('error', $val->error());
         }
         $this->template->set_global('student', $student, false);
     }
     $this->template->title = "Students";
     $this->template->content = View::forge('site/student/edit');
 }
Exemplo n.º 26
0
 public function action_edit($id = null)
 {
     is_null($id) and Response::redirect('faculty');
     if (!($faculty = Model_Faculty::find($id))) {
         Session::set_flash('error', 'Could not find faculty #' . $id);
         Response::redirect('faculty');
     }
     $val = Model_Faculty::validate('edit');
     if ($val->run()) {
         $faculty->name = Input::post('name');
         $faculty->phone = Input::post('phone');
         $faculty->email = Input::post('email');
         $faculty->hotline = Input::post('hotline');
         $faculty->address = Input::post('address');
         if ($faculty->save()) {
             Session::set_flash('success', 'Updated faculty #' . $id);
             Response::redirect('faculty');
         } else {
             Session::set_flash('error', 'Could not update faculty #' . $id);
         }
     } else {
         if (Input::method() == 'POST') {
             $faculty->name = $val->validated('name');
             $faculty->phone = $val->validated('phone');
             $faculty->email = $val->validated('email');
             $faculty->hotline = $val->validated('hotline');
             $faculty->address = $val->validated('address');
             Session::set_flash('error', $val->error());
         }
         $this->template->set_global('faculty', $faculty, false);
     }
     $this->template->title = "Faculties";
     $this->template->content = View::forge('faculty/edit');
 }
Exemplo n.º 27
0
 public function action_index()
 {
     if (Input::method() == 'POST') {
     }
     echo View::forge('unsubscribe');
     exit;
 }
Exemplo n.º 28
0
 public function action_index()
 {
     require APPPATH . '/vendor/php-recipe-2nd/make_chart_parts.php';
     $output = APPPATH . '/cache/benchmark-results.json';
     $results = json_decode(file_get_contents($output), true);
     $barColors = array('pink', 'purple', 'green', 'red', 'blue', 'gray', 'orange');
     // Time Benchmark
     $data[] = array('', 'time', array('role' => 'style'));
     // header
     $colors = $barColors;
     foreach ($results as $fw => $result) {
         $data[] = array($fw, $result['time'], array_shift($colors));
     }
     //var_dump($data); exit;
     $options = array('title' => 'Time', 'titleTextStyle' => array('fontSize' => 16), 'hAxis' => array('title' => 'time (ms)', 'titleTextStyle' => array('bold' => true)), 'vAxis' => array('minValue' => 0, 'maxValue' => 0.01), 'width' => 500, 'height' => 400, 'bar' => array('groupWidth' => '90%'), 'legend' => array('position' => 'none'));
     $type = 'ColumnChart';
     list($chart_time, $div_time) = makeChartParts($data, $options, $type);
     // Memory Benchmark
     $data = array();
     $data[] = array('', 'memory', array('role' => 'style'));
     // header
     $colors = $barColors;
     foreach ($results as $fw => $result) {
         $data[] = array($fw, $result['memory'], array_shift($colors));
     }
     $options = array('title' => 'Memory', 'titleTextStyle' => array('fontSize' => 16), 'hAxis' => array('title' => 'memory (KB)', 'titleTextStyle' => array('bold' => true)), 'vAxis' => array('minValue' => 0, 'maxValue' => 1), 'width' => 500, 'height' => 400, 'bar' => array('groupWidth' => '90%'), 'legend' => array('position' => 'none'));
     $type = 'ColumnChart';
     list($chart_mem, $div_mem) = makeChartParts($data, $options, $type);
     $data = ['chart_time' => $chart_time, 'div_time' => $div_time, 'chart_mem' => $chart_mem, 'div_mem' => $div_mem];
     return View::forge('index/index', $data, false);
 }
Exemplo n.º 29
0
 public function action_edit($id = null)
 {
     is_null($id) and Response::redirect('Foto');
     $foto = Model_Foto::find($id);
     $val = Model_Foto::validate('edit');
     if ($val->run()) {
         $foto->imagen = Input::post('imagen');
         $foto->width = Input::post('width');
         $foto->height = Input::post('height');
         $foto->articulo_id = Input::post('articulo_id');
         $foto->dimension_id = Input::post('dimension_id');
         $foto->estado = Input::post('estado');
         if ($foto->save()) {
             Session::set_flash('success', 'Updated foto #' . $id);
             Response::redirect('foto');
         } else {
             Session::set_flash('error', 'Could not update foto #' . $id);
         }
     } else {
         if (Input::method() == 'POST') {
             $foto->imagen = $val->validated('imagen');
             $foto->width = $val->validated('width');
             $foto->height = $val->validated('height');
             $foto->articulo_id = $val->validated('articulo_id');
             $foto->dimension_id = $val->validated('dimension_id');
             $foto->estado = $val->validated('estado');
             Session::set_flash('error', $val->error());
         }
         $this->template->set_global('foto', $foto, false);
     }
     $this->template->title = "Fotos";
     $this->template->content = View::forge('foto/edit');
 }
Exemplo n.º 30
0
 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');
 }