本文整理汇总了PHP中Core::post方法的典型用法代码示例。如果您正苦于以下问题:PHP Core::post方法的具体用法?PHP Core::post怎么用?PHP Core::post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core
的用法示例。
在下文中一共展示了Core::post方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_update
public function action_update()
{
$name = $this->request->param('id');
$field = new Model_Field();
$field_data = $field->get($name);
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Edit') . ' ' . $name));
$this->template->title = __('Edit Custom Field for Advertisement');
//find all, for populating form select fields
list($categories) = Model_Category::get_all();
if ($_POST) {
try {
$options = array('label' => Core::post('label'), 'tooltip' => Core::post('tooltip'), 'required' => Core::post('required') == 'on' ? TRUE : FALSE, 'searchable' => Core::post('searchable') == 'on' ? TRUE : FALSE);
if ($field->update($name, Core::post('values'), Core::post('categories'), $options)) {
Cache::instance()->delete_all();
Theme::delete_minified();
Alert::set(Alert::SUCCESS, __('Field edited ' . $name));
Request::current()->redirect(Route::url('oc-panel', array('controller' => 'fields', 'action' => 'index')));
} else {
Alert::set(Alert::ERROR, __('Field cant be edited' . $name));
}
} catch (Exception $e) {
throw new HTTP_Exception_500();
}
}
$this->template->content = View::factory('oc-panel/pages/fields/update', array('field_data' => $field_data, 'name' => $name, 'categories' => $categories));
}
示例2: action_ipn
public function action_ipn()
{
//todo delete
//paypal::validate_ipn();
$this->auto_render = FALSE;
//START PAYPAL IPN
//manual checks
$id_order = Core::post('item_number');
$paypal_amount = Core::post('mc_gross');
$payer_id = Core::post('payer_id');
//retrieve info for the item in DB
$order = new Model_Order();
$order = $order->where('id_order', '=', $id_order)->where('status', '=', Model_Order::STATUS_CREATED)->limit(1)->find();
if ($order->loaded()) {
//same amount and same currency
if (Core::post('payment_status') == 'Completed' and Core::post('mc_gross') == number_format($order->amount, 2, '.', '') and Core::post('mc_currency') == $order->currency and Core::post('receiver_email') == core::config('payment.paypal_account') || Core::post('business') == core::config('payment.paypal_account')) {
//same price , currency and email no cheating ;)
if (paypal::validate_ipn()) {
$order->confirm_payment('paypal', Core::post('txn_id'), NULL, NULL, NULL, Core::post('mc_fee'));
} else {
Kohana::$log->add(Log::ERROR, 'A payment has been made but is flagged as INVALID');
$this->response->body('KO');
}
} else {
Kohana::$log->add(Log::ERROR, 'Attempt illegal actions with transaction');
$this->response->body('KO');
}
} else {
Kohana::$log->add(Log::ERROR, 'Order not loaded');
$this->response->body('KO');
}
$this->response->body('OK');
}
示例3: action_pay
/**
* [action_form] generates the form to pay at paypal
*/
public function action_pay()
{
$this->auto_render = FALSE;
$id_order = $this->request->param('id');
//retrieve info for the item in DB
$order = new Model_Order();
$order = $order->where('id_order', '=', $id_order)->where('status', '=', Model_Order::STATUS_CREATED)->limit(1)->find();
if ($order->loaded()) {
// include class vendor
require Kohana::find_file('vendor/authorize/', 'autoload');
define('AUTHORIZENET_API_LOGIN_ID', Core::config('payment.authorize_login'));
define('AUTHORIZENET_TRANSACTION_KEY', Core::config('payment.authorize_key'));
define('AUTHORIZENET_SANDBOX', Core::config('payment.authorize_sandbox'));
$sale = new AuthorizeNetAIM();
$sale->amount = $order->amount;
$sale->card_num = Core::post('card-number');
$sale->exp_date = Core::post('expiry-month') . '/' . Core::post('expiry-year');
$response = $sale->authorizeAndCapture();
if ($response->approved) {
$order->confirm_payment('authorize', $response->transaction_id);
//redirect him to his ads
Alert::set(Alert::SUCCESS, __('Thanks for your payment!') . ' ' . $response->transaction_id);
$this->redirect(Route::url('oc-panel', array('controller' => 'profile', 'action' => 'orders')));
} else {
Alert::set(Alert::INFO, $response->error_message);
$this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order)));
}
} else {
Alert::set(Alert::INFO, __('Order could not be loaded'));
$this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order)));
}
}
示例4: action_edit
public function action_edit()
{
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Edit Translation')));
$this->template->title = __('Edit Translation');
$this->template->bind('content', $content);
$content = View::factory('oc-panel/pages/translations/edit');
$this->template->scripts['footer'][] = 'js/oc-panel/translations.js';
$language = $this->language_fix($this->request->param('id'));
//get the translated ad not translated.
list($translation_array, $untranslated_array) = $this->get_translation($language);
//watch out at any standard php installation there's a limit of 1000 posts....edit php.ini max_input_vars = 10000 to amend it.
if ($this->request->post() and is_array(Core::post('translations'))) {
$data_translated = Core::post('translations');
if ($this->save_translation($language, $translation_array, $data_translated)) {
Alert::set(Alert::SUCCESS, $language . ' ' . __('Language saved'));
} else {
Alert::set(Alert::ALERT, $language);
}
$this->redirect(URL::current());
}
//add filters to search
$translation_array_filtered = $translation_array;
//only display not translated
if (core::get('translated') == 1) {
$translation_array_filtered_aux = array();
foreach ($untranslated_array as $key => $value) {
$translation_array_filtered_aux[] = $translation_array_filtered[$value];
}
$translation_array_filtered = $translation_array_filtered_aux;
} elseif (core::get('search') !== NULL) {
$translation_array_filtered_aux = array();
foreach ($translation_array as $key => $value) {
if (strpos($value['original'], core::get('search')) !== FALSE or strpos($value['translated'], core::get('search')) !== FALSE) {
$translation_array_filtered_aux[] = $value;
}
}
$translation_array_filtered = $translation_array_filtered_aux;
}
//how many translated items we have?
$total_items = count($translation_array_filtered);
//get elements for current page
$pagination = Pagination::factory(array('view' => 'oc-panel/crud/pagination', 'total_items' => $total_items, 'items_per_page' => 20))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action(), 'id' => $language));
$trans_array_paginated = array();
$from = $pagination->offset;
$to = $from + $pagination->items_per_page;
for ($key = $from; $key < $to; $key++) {
if (isset($translation_array_filtered[$key])) {
$trans_array_paginated[$key] = $translation_array_filtered[$key];
}
}
$content->edit_language = $language;
$content->translation_array = $trans_array_paginated;
$content->cont_untranslated = count($untranslated_array);
$content->total_items = count($translation_array);
$content->pagination = $pagination->render();
}
示例5: action_new
public function action_new()
{
$this->auto_render = FALSE;
if (Menu::add(Core::post('title'), Core::post('url'), Core::post('target'), Core::post('icon'))) {
Alert::set(Alert::SUCCESS, __('Menu created'));
} else {
Alert::set(Alert::ERROR, __('Menu not created'));
}
Request::current()->redirect(Route::url('oc-panel', array('controller' => 'menu', 'action' => 'index')));
}
示例6: action_index
public function action_index()
{
// validation active
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('List')));
$this->template->title = __('Translations');
//scan project files and generate .po
$parse = $this->request->query('parse');
if ($parse) {
//scan script
require_once Kohana::find_file('vendor', 'POTCreator/POTCreator', 'php');
$obj = new POTCreator();
$obj->set_root(DOCROOT);
$obj->set_exts('php');
$obj->set_regular('/_[_|e]\\([\\"|\']([^\\"|\']+)[\\"|\']\\)/i');
$obj->set_base_path('..');
$obj->set_read_subdir(true);
$obj->write_pot(i18n::get_language_path());
Alert::set(Alert::SUCCESS, 'File regenerated');
}
//change default site language
if ($this->request->param('id')) {
//save language
$locale = new Model_Config();
$locale->where('group_name', '=', 'i18n')->where('config_key', '=', 'locale')->limit(1)->find();
if (!$locale->loaded()) {
$locale->group_name = 'i18n';
$locale->config_key = 'locale';
}
$locale->config_value = $this->request->param('id');
try {
$locale->save();
Alert::set(Alert::SUCCESS, __('Translations regenarated'));
} catch (Exception $e) {
throw HTTP_Exception::factory(500, $e->getMessage());
}
HTTP::redirect(Route::url('oc-panel', array('controller' => 'translations')));
}
//create language
if (Core::post('locale')) {
$language = $this->request->post('locale');
$folder = DOCROOT . 'languages/' . $language . '/LC_MESSAGES/';
// if folder does not exist, try to make it
if (!file_exists($folder) and !@mkdir($folder, 0775, true)) {
// mkdir not successful ?
Alert::set(Alert::ERROR, __('Language folder cannot be created with mkdir. Please correct to be able to create new translation.'));
HTTP::redirect(Route::url('oc-panel', array('controller' => 'translations')));
}
// write an empty .po file for $language
$out = 'msgid ""' . PHP_EOL;
$out .= 'msgstr ""' . PHP_EOL;
File::write($folder . 'messages.po', $out);
Alert::set(Alert::SUCCESS, $this->request->param('id') . ' ' . __('Language saved'));
}
$this->template->content = View::factory('oc-panel/pages/translations/index', array('languages' => i18n::get_languages(), 'current_language' => core::config('i18n.locale')));
}
示例7: action_index
public function action_index()
{
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Newsletter')));
$this->template->title = __('Newsletter');
//count all users
$user = new Model_User();
$user->where('status', '=', Model_User::STATUS_ACTIVE);
$count_all_users = $user->count_all();
//count support expired
$query = DB::select(DB::expr('COUNT(id_order) count'))->from('orders')->where('status', '=', Model_Order::STATUS_PAID)->where('support_date', '<', Date::unix2mysql())->execute();
$count_support_expired = $query->as_array();
$count_support_expired = $count_support_expired[0]['count'];
//count license expired
$query = DB::select(DB::expr('COUNT(id_license) count'))->from('licenses')->where('valid_date', 'IS NOT', NULL)->where('valid_date', '<', Date::unix2mysql())->execute();
$count_license_expired = $query->as_array();
$count_license_expired = $count_license_expired[0]['count'];
//orders per product, not accuarate since 1 user could buy more than 1 product but will do
$query = DB::select(DB::expr('COUNT(id_order) count'))->select('p.title')->select('p.id_product')->from(array('products', 'p'))->join(array('orders', 'o'))->using('id_product')->where('o.status', '=', Model_Order::STATUS_PAID)->group_by('p.id_product')->execute();
$products = $query->as_array();
//post done sending newsletter
if ($this->request->post() and Core::post('subject') != NULL) {
$users = array();
if (core::post('send_all') == 'on') {
$query = DB::select('email')->select('name')->from('users')->where('status', '=', Model_User::STATUS_ACTIVE)->execute();
$users = array_merge($users, $query->as_array());
}
if (Theme::get('premium') == 1) {
if (core::post('send_expired_support') == 'on') {
$query = DB::select('email')->select('name')->from(array('users', 'u'))->join(array('orders', 'o'))->using('id_user')->where('o.status', '=', Model_Order::STATUS_PAID)->where('o.support_date', '<', Date::unix2mysql())->where('u.subscriber', '=', 1)->group_by('u.id_user')->execute();
$users = array_merge($users, $query->as_array());
}
if (core::post('send_expired_license') == 'on') {
$query = DB::select('email')->select('name')->from(array('licenses', 'l'))->join(array('users', 'u'))->using('id_user')->where('l.valid_date', 'IS NOT', NULL)->where('l.valid_date', '<', Date::unix2mysql())->where('u.subscriber', '=', 1)->group_by('u.id_user')->execute();
$users = array_merge($users, $query->as_array());
}
if (is_numeric(core::post('send_product'))) {
$query = DB::select('email')->select('name')->from(array('users', 'u'))->join(array('orders', 'o'))->using('id_user')->where('o.id_product', '=', core::post('send_product'))->where('o.status', '=', Model_Order::STATUS_PAID)->where('u.subscriber', '=', 1)->group_by('u.id_user')->execute();
$users = array_merge($users, $query->as_array());
}
}
//NOTE $users may have duplicated emails, but phpmailer takes care of not sending the email 2 times to same recipient
//sending!
if (count($users) > 0) {
if (!Email::send($users, '', Core::post('subject'), Kohana::$_POST_ORIG['description'], Core::post('from'), Core::post('from_email'))) {
Alert::set(Alert::ERROR, __('Error on mail delivery, not sent'));
} else {
Alert::set(Alert::SUCCESS, __('Email sent'));
}
} else {
Alert::set(Alert::ERROR, __('Mail not sent'));
}
}
$this->template->content = View::factory('oc-panel/pages/newsletter', array('count_all_users' => $count_all_users, 'count_support_expired' => $count_support_expired, 'count_license_expired' => $count_license_expired, 'products' => $products));
}
示例8: action_index
public function action_index()
{
$email = Core::post('email_subscribe');
if (Valid::email($email, TRUE)) {
/* find user and compare emails */
$obj_user = new Model_User();
$user = $obj_user->where('email', '=', $email)->limit(1)->find();
// case when user is not logged in.
// We create new user if he doesn't exists in DB
// and send him mail for ad created + new profile created
if (!$user->loaded()) {
$user = Model_User::create_email($email);
}
/* save this user to data base as subscriber */
$arr_cat = Core::post('category_subscribe');
// string in this case is returned as "int,int" so we need to format min/max price
$price = Core::post('price_subscribe');
if ($price = Core::post('price_subscribe')) {
$min_price = substr($price, '0', stripos($price, ','));
$max_price = substr($price, strrpos($price, ',') + 1);
} else {
//in case of mobile version
// jquery mobile have different slider, so we need to get data differently
$min_price = Core::post('price_subscribe-1');
$max_price = Core::post('price_subscribe-2');
}
//if categry is not selected, subscribe them for al, set category to 0 thats all...
if ($arr_cat === NULL) {
$arr_cat[] = 0;
}
// create entry table subscriber for each category selected
foreach ($arr_cat as $c => $id_value) {
$obj_subscribe = new Model_Subscribe();
$obj_subscribe->id_user = $user->id_user;
$obj_subscribe->id_category = $id_value;
$obj_subscribe->id_location = Core::post('location_subscribe');
$obj_subscribe->min_price = $min_price;
$obj_subscribe->max_price = $max_price;
try {
$obj_subscribe->save();
} catch (Exception $e) {
throw HTTP_Exception::factory(500, $e->getMessage());
}
}
Alert::set(Alert::SUCCESS, __('Thank you for subscribing'));
$this->redirect(Route::url('default'));
} else {
Alert::set(Alert::ALERT, __('Invalid Email'));
$this->redirect(Route::url('default'));
}
}
示例9: action_pay
/**
* [action_form] generates the form to pay at paypal
*/
public function action_pay()
{
$this->auto_render = FALSE;
$id_order = $this->request->param('id');
//retrieve info for the item in DB
$order = new Model_Order();
$order = $order->where('id_order', '=', $id_order)->where('status', '=', Model_Order::STATUS_CREATED)->limit(1)->find();
if ($order->loaded()) {
if (isset($_POST['stripeToken'])) {
//its a fraud...lets let him know
if ($order->is_fraud() === TRUE) {
Alert::set(Alert::ERROR, __('We had, issues with your transaction. Please try paying with another paymethod.'));
$this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order)));
}
// include class vendor
require Kohana::find_file('vendor/stripe/lib', 'Stripe');
// Set your secret key: remember to change this to your live secret key in production
// See your keys here https://manage.stripe.com/account
Stripe::setApiKey(Core::config('payment.stripe_private'));
// Get the credit card details submitted by the form
$token = Core::post('stripeToken');
// email
$email = Core::post('stripeEmail');
// Create the charge on Stripe's servers - this will charge the user's card
try {
$charge = Stripe_Charge::create(array("amount" => StripeKO::money_format($order->amount), "currency" => $order->currency, "card" => $token, "description" => $order->description));
} catch (Stripe_CardError $e) {
// The card has been declined
Kohana::$log->add(Log::ERROR, 'Stripe The card has been declined');
Alert::set(Alert::ERROR, 'Stripe The card has been declined');
$this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order)));
}
//mark as paid
$order->confirm_payment('stripe', Core::post('stripeToken'));
//redirect him to his ads
Alert::set(Alert::SUCCESS, __('Thanks for your payment!'));
$this->redirect(Route::url('oc-panel', array('controller' => 'profile', 'action' => 'orders')));
} else {
Alert::set(Alert::INFO, __('Please fill your card details.'));
$this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order)));
}
} else {
Alert::set(Alert::INFO, __('Order could not be loaded'));
$this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order)));
}
}
示例10: action_image
public function action_image()
{
$user = Auth::instance()->get_user();
if (Core::post('photo_delete') and $user->delete_image() == TRUE) {
Alert::set(Alert::SUCCESS, __('Photo deleted.'));
} elseif (isset($_FILES['profile_image'])) {
//get image
$image = $_FILES['profile_image'];
//file post
$result = $user->upload_image($image);
if ($result === TRUE) {
Alert::set(Alert::SUCCESS, $image['name'] . ' ' . __('Image is uploaded.'));
} else {
Alert::set(Alert::ALERT, $result);
}
}
$this->redirect(Route::url('oc-panel', array('controller' => 'profile', 'action' => 'edit')));
}
示例11: action_pay
/**
* [action_form] generates the form to pay at paypal
*/
public function action_pay()
{
$this->auto_render = FALSE;
$id_order = $this->request->param('id');
//retrieve info for the item in DB
$order = new Model_Order();
$order = $order->where('id_order', '=', $id_order)->where('status', '=', Model_Order::STATUS_CREATED)->limit(1)->find();
if ($order->loaded()) {
//its a fraud...lets let him know
if ($order->is_fraud() === TRUE) {
Alert::set(Alert::ERROR, __('We had, issues with your transaction. Please try paying with another paymethod.'));
$this->redirect(Route::url('default', array('controller' => 'product', 'action' => 'checkout', 'id' => $order->id_order)));
}
//Functions from https://github.com/paymill/paybutton-examples
$privateApiKey = Core::config('payment.paymill_private');
if (isset($_POST['paymillToken'])) {
$token = $_POST['paymillToken'];
$client = Paymill::request('clients/', array(), $privateApiKey);
$payment = Paymill::request('payments/', array('token' => $token, 'client' => $client['id']), $privateApiKey);
$transaction = Paymill::request('transactions/', array('amount' => Paymill::money_format($order->amount), 'currency' => $order->currency, 'client' => $client['id'], 'payment' => $payment['id'], 'description' => $order->product->title), $privateApiKey);
if (isset($transaction['status']) && $transaction['status'] == 'closed') {
//mark as paid
$order->confirm_payment('paymill', Core::post('paymillToken'), NULL, NULL, NULL, Paymill::calculate_fee($order->amount));
//redirect him to his ads
Alert::set(Alert::SUCCESS, __('Thanks for your payment!'));
$this->redirect(Route::url('default', array('controller' => 'product', 'action' => 'goal', 'id' => $order->id_order)));
} else {
$msg = __('Transaction not successful!');
if (!$transaction['status'] == 'closed') {
$msg .= ' - ' . $transaction['data']['error'];
}
Kohana::$log->add(Log::ERROR, 'Paymill ' . $msg);
Alert::set(Alert::ERROR, $msg);
$this->redirect(Route::url('default', array('controller' => 'product', 'action' => 'checkout', 'id' => $order->id_order)));
}
} else {
Alert::set(Alert::INFO, __('Please fill your card details.'));
$this->redirect(Route::url('default', array('controller' => 'product', 'action' => 'checkout', 'id' => $order->id_order)));
}
} else {
Alert::set(Alert::INFO, __('Order could not be loaded'));
$this->redirect(Route::url('default', array('controller' => 'product', 'action' => 'checkout', 'id' => $order->id_order)));
}
}
示例12: action_index
public function action_index()
{
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Interactive map')));
$this->template->title = __('Interactive map');
$this->template->styles = array('css/map-generator.css' => 'screen');
$this->template->scripts['footer'][] = '//www.google.com/jsapi';
$this->template->scripts['footer'][] = '//maps.google.com/maps/api/js?sensor=false';
$this->template->scripts['footer'][] = 'js/oc-panel/map/jscolor.js';
$this->template->scripts['footer'][] = 'js/oc-panel/map/map-generator.js';
$map_active = Core::post('map_active', Core::Config('appearance.map_active'));
$map_settings = Core::post('current_settings', Core::Config('appearance.map_settings'));
// change map
if (Theme::get('premium') == 1 and Core::post('jscode')) {
Model_Config::set_value('appearance', 'map_active', Core::post('map_active'));
Model_Config::set_value('appearance', 'map_settings', Core::post('current_settings'));
Model_Config::set_value('appearance', 'map_jscode', Kohana::$_POST_ORIG['jscode']);
Core::delete_cache();
Alert::set(Alert::SUCCESS, __('Map saved.'));
}
$this->template->content = View::factory('oc-panel/pages/map', array('map_active' => $map_active, 'map_settings' => $map_settings));
}
示例13: action_ipn
public function action_ipn()
{
//todo delete
//paypal::validate_ipn();
$this->auto_render = FALSE;
//START PAYPAL IPN
//manual checks
$id_order = Core::post('item_number');
$paypal_amount = Core::post('mc_gross');
$payer_id = Core::post('payer_id');
//retrieve info for the item in DB
$order = new Model_Order();
$order = $order->where('id_order', '=', $id_order)->where('status', '=', Model_Order::STATUS_CREATED)->limit(1)->find();
if ($order->loaded()) {
// detect product to be processed
if (is_numeric($order->id_product)) {
$id_category = new Model_Category();
$id_category = $id_category->where('id_category', '=', $order->id_product)->limit(1)->find();
$product_id = $id_category->id_category;
} else {
$product_id = $order->id_product;
}
if (Core::post('mc_gross') == number_format($order->amount, 2, '.', '') && Core::post('mc_currency') == core::config('payment.paypal_currency') && (Core::post('receiver_email') == core::config('payment.paypal_account') || Core::post('business') == core::config('payment.paypal_account'))) {
//same price , currency and email no cheating ;)
if (paypal::validate_ipn()) {
$order->confirm_payment($id_order, core::config('general.moderation'));
} else {
Kohana::$log->add(Log::ERROR, 'A payment has been made but is flagged as INVALID');
$this->response->body('KO');
}
} else {
Kohana::$log->add(Log::ERROR, 'Attempt illegal actions with transaction');
$this->response->body('KO');
}
} else {
Kohana::$log->add(Log::ERROR, 'Order not loaded');
$this->response->body('KO');
}
$this->response->body('OK');
}
示例14: action_update
public function action_update()
{
$name = $this->request->param('id');
$menu_data = Menu::get_item($name);
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Edit Menu') . ' ' . $menu_data['title']));
$this->template->title = __('Edit Menu');
$this->template->styles = array('css/sortable.css' => 'screen');
$this->template->scripts['footer'][] = 'js/jquery-sortable-min.js';
$this->template->scripts['footer'][] = 'js/oc-panel/menu.js';
//find all, for populating form select fields
$categories = Model_Category::get_as_array();
$order_categories = Model_Category::get_multidimensional();
if ($_POST) {
if (Menu::update($name, Core::post('title'), Core::post('url'), Core::post('target'), Core::post('icon'))) {
Alert::set(Alert::SUCCESS, __('Menu updated'));
} else {
Alert::set(Alert::ERROR, __('Menu not updated'));
}
HTTP::redirect(Route::url('oc-panel', array('controller' => 'menu', 'action' => 'index')));
}
// d($categories);
$this->template->content = View::factory('oc-panel/pages/menu/update', array('menu_data' => $menu_data, 'name' => $name, 'categories' => $categories, 'order_categories' => $order_categories));
}
示例15: action_update
public function action_update()
{
$name = $this->request->param('id');
$field = new Model_UserField();
$field_data = $field->get($name);
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Edit') . ' ' . $name));
$this->template->title = __('Edit Custom Field for Advertisement');
if ($_POST) {
try {
$options = array('label' => Core::post('label'), 'tooltip' => Core::post('tooltip'), 'required' => Core::post('required') == 'on' ? TRUE : FALSE, 'searchable' => Core::post('searchable') == 'on' ? TRUE : FALSE, 'show_profile' => Core::post('show_profile') == 'on' ? TRUE : FALSE, 'show_register' => Core::post('show_register') == 'on' ? TRUE : FALSE, 'admin_privilege' => Core::post('admin_privilege') == 'on' ? TRUE : FALSE);
if ($field->update($name, Core::post('values'), $options)) {
Core::delete_cache();
Alert::set(Alert::SUCCESS, sprintf(__('Field %s edited'), $name));
} else {
Alert::set(Alert::ERROR, sprintf(__('Field %s cannot be edited'), $name));
}
} catch (Exception $e) {
throw HTTP_Exception::factory(500, $e->getMessage());
}
HTTP::redirect(Route::url('oc-panel', array('controller' => 'userfields', 'action' => 'index')));
}
$this->template->content = View::factory('oc-panel/pages/userfields/update', array('field_data' => $field_data, 'name' => $name));
}