本文整理匯總了PHP中Assets::tabledrag方法的典型用法代碼示例。如果您正苦於以下問題:PHP Assets::tabledrag方法的具體用法?PHP Assets::tabledrag怎麽用?PHP Assets::tabledrag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Assets
的用法示例。
在下文中一共展示了Assets::tabledrag方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: action_configure
/**
* Formats setting
*
* @uses InputFilter::filters
* @uses Assets::tabledrag
* @uses Config::load
* @uses Message::error
* @uses Filter::all
*/
public function action_configure()
{
$id = $this->request->param('id', NULL);
// Get required format
$format = $this->_format->get($id);
$config = Config::load('inputfilter');
if (is_null($format)) {
Log::error('Attempt to access non-existent format id :id', array(':id' => $id));
Message::error(__('Text Format doesn\'t exists!'));
$this->request->redirect(Route::get('admin/format')->uri(), 404);
}
$fallback_format = (int) $config->default_format;
$formats = $this->_format->get_all();
$formats[$id]['id'] = $id;
$all_roles = ORM::factory('role')->find_all()->as_array('id', 'name');
$filters = Filter::all();
$enabled_filters = $formats[$id]['filters'];
// Form attributes
$params = array('id' => $id, 'action' => 'configure');
$this->title = __('Configure %name format', array('%name' => $format['name']));
$view = View::factory('admin/format/form')->set('roles', $all_roles)->set('filters', $filters)->set('enabled_filters', $enabled_filters)->set('format', $format)->set('params', $params);
if ($this->valid_post('filter')) {
unset($_POST['filter'], $_POST['_token'], $_POST['_action']);
Message::info(__('Not implemented yet!'));
}
$this->response->body($view);
Assets::tabledrag();
}
示例2: action_index
/**
* Listing Widgets
*/
public function action_index()
{
$this->title = __('Widgets');
$view = View::factory('admin/widget/list')->bind('widget_regions', $widget_regions)->bind('weight_delta', $weight_delta)->bind('widgets', $widget_listing);
$widget_regions = array();
$adminTheme = Theme::getTheme();
$frontTheme = Theme::getTheme(Config::get('site.theme', $adminTheme->name));
if (isset($adminTheme->regions) and !empty($adminTheme->regions)) {
$widget_regions = Arr::merge($widget_regions, $adminTheme->regions);
}
if (isset($frontTheme->regions) and !empty($frontTheme->regions)) {
$widget_regions = Arr::merge($widget_regions, $frontTheme->regions);
}
// Add a last region for disabled blocks.
$widget_regions = Arr::merge($widget_regions, array(self::$WIDGET_REGION_NONE => self::$WIDGET_REGION_NONE));
$widgets = ORM::factory('widget')->order_by('region')->order_by('weight')->find_all();
// Weights range from -delta to +delta, so delta should be at least half
// of the amount of blocks present. This makes sure all blocks in the same
// region get an unique weight.
$weight_delta = round(count($widgets) / 2);
if (isset($widget_regions[self::$WIDGET_REGION_NONE])) {
$widget_regions[self::$WIDGET_REGION_NONE] = __('Disabled');
}
foreach ($widget_regions as $key => $value) {
// Initialize an empty array for the region.
$widget_listing[$key] = array();
}
// Initialize disabled widgets array.
$widget_listing[self::$WIDGET_REGION_NONE] = array();
// Add each block in the form to the appropriate place in the widget listing.
foreach ($widgets as $widget) {
// Fetch the region for the current widget.
$region = isset($widget->region) ? $widget->region : self::$WIDGET_REGION_NONE;
$widget_listing[$region][] = $widget;
}
if ($this->valid_post('widget-list')) {
foreach ($_POST['widgets'] as $widget) {
$widget['status'] = (int) ($widget['region'] != self::$WIDGET_REGION_NONE);
$widget['region'] = $widget['status'] ? $widget['region'] : self::$WIDGET_REGION_NONE;
DB::update('widgets')->set(array('status' => $widget['status'], 'weight' => $widget['weight'], 'region' => $widget['region']))->where('id', '=', $widget['id'])->execute();
}
Message::success(__('The Widget settings have been updated.'));
Cache::instance('widgets')->delete_all();
$this->request->redirect(Route::get('admin/widget')->uri());
}
$this->response->body($view);
Assets::tabledrag();
Assets::js('widgets', 'media/js/widgets.js', array('jquery'), FALSE, array('weight' => 5));
}
示例3: action_list
/**
* Lists all menu items
*/
public function action_list()
{
$id = (int) $this->request->param('id');
$menu = ORM::factory('menu', array('id' => $id, 'lft' => 1));
if (!$menu->loaded()) {
Log::error('Attempt to access non-existent menu id: :id', array(':id' => $id));
Message::error(__('Menu: doesn\'t exists!'));
$this->request->redirect(Route::get('admin/menu')->uri());
}
$this->title = __('Items for %vocab', array('%vocab' => $menu->title));
$view = View::factory('admin/menu/item/list')->bind('items', $items)->bind('id', $id);
$items = DB::select()->from('menus')->where('lft', '>', $menu->lft)->where('rgt', '<', $menu->rgt)->where('scp', '=', $menu->scp)->order_by('lft', 'ASC')->execute()->as_array();
if (count($items) == 0) {
Message::info(__("Menu Items doesn't exists!"));
$this->response->body(View::factory('admin/menu/item/none')->set('id', $id));
}
$this->response->body($view);
Assets::tabledrag();
}
示例4: action_list
/**
* List of terms for vocabulary
*
* @uses Message::error
* @uses Message::info
* @uses Request::redirect
* @uses Route::get
* @uses Route::uri
* @uses DB::select
*/
public function action_list()
{
$id = (int) $this->request->param('id', 0);
$vocab = ORM::factory('term', array('id' => $id, 'lft' => 1));
if (!$vocab->loaded()) {
Log::error('Attempt to access non-existent category group.');
Message::error(__("Category Group doesn't exists!"));
$this->request->redirect(Route::get('admin/taxonomy')->uri(), 404);
}
$this->title = __('Categories of Group %vocab', array('%vocab' => $vocab->name));
$params = array('action' => 'add', 'id' => $id);
$view = View::factory('admin/term/list')->bind('terms', $terms)->bind('id', $id)->bind('params', $params);
$terms = DB::select()->from('terms')->where('lft', '>', $vocab->lft)->where('rgt', '<', $vocab->rgt)->where('scp', '=', $vocab->scp)->order_by('lft', 'ASC')->execute()->as_array();
if (count($terms) == 0) {
Message::info(__('There are no Categories that have been created for %vocab.', array('%vocab' => $vocab->name)));
$view = View::factory('admin/term/none')->bind('params', $params);
}
$this->response->body($view);
Assets::tabledrag();
}