Development

sfPropelManualOrderPluginFor11

You must first sign up to be able to contribute.

Version 2 (modified by cedric, 9 years ago)
--

sfPropelManualOrderPlugin (For symfony 1.1)

Overview

This module adds simple manual ordering/sort for the admin generator

Installation

  • Install the plugin

Get it from here and unpack into your plugins directory

  • create the sf_sortable table in your database
		CREATE TABLE `sf_sortable`
		(
		        `sortable_id` INTEGER  NOT NULL AUTO_INCREMENT,
		        `list_name` VARCHAR(40)  NOT NULL,
		        `object_id` INTEGER  NOT NULL,
		        `sort_val` INTEGER  NOT NULL,
		        PRIMARY KEY (`sortable_id`),
		        KEY `list`(`list_name`, `sort_val`, `object_id`)
		)Type=MyISAM;
		Enable the sfOpenIDAuth module
  • configure the generator.yml in your admin modules
  param:
    theme:            sortable 				 # change the theme
	
	...
	
    list:
      object_actions:
       _moveTop: -                     # add these actions
			 _moveUp: -                      # 
       _moveDown: -                    # 
       _moveBottom: -                  # 
	
	...
  • link or copy the images to the admin dir
  cp plugins/sfPropelManualOrderePlugin/web/images/* to web/sf/sf_admin/images/

Notes

  • the plugin is designed for ease of use with the admin generator
  • take a look at the sfPropelActAsSortableBehaviorPlugin, which adds similar behaviours to the model
  • works with int primary keys
  • doesn't enforce consistency (but inconsistencies don't break it)
  • is inefficient for high transaction volumes or large lists
  • is not concurrency safe
  • there's an excellent tutorial on how to do manual order:

http://web.archive.org/web/20060519130448/http://www.symfony-project.com/content/book/page/sortable.html

  • icons are thanks to Mark James' great 'Silk' icon set: http://www.famfamfam.com/lab/icons/silk/
  • you can add sort functions into your model classes e.g. in lib/model/MyClass.php, add the lines:
    	        // adding moveUp, moveDown, toTop, toBottom, getSortRank, getSortedList (uses sfMixer/__call)
    	        sfSortablePeer::addSortFunctions('MyClass'); 
    

Changelog

1.0: initial release, copy Beetween version for symfony 1.0 and the new default template for sfPropelAdmin

Attachments