{"id":18389846,"url":"https://github.com/proloser/cakephp-batch","last_synced_at":"2026-03-02T22:11:12.928Z","repository":{"id":1236109,"uuid":"1173108","full_name":"ProLoser/CakePHP-Batch","owner":"ProLoser","description":"Search / Filter and Update / Delete in batches your paginated results","archived":false,"fork":false,"pushed_at":"2015-08-07T20:37:30.000Z","size":183,"stargazers_count":20,"open_issues_count":7,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-04T07:45:02.876Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"hiki/hikidoc","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ProLoser.png","metadata":{"files":{"readme":"README.textile","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-12-16T03:19:34.000Z","updated_at":"2023-07-26T22:59:25.000Z","dependencies_parsed_at":"2022-08-16T12:40:33.275Z","dependency_job_id":null,"html_url":"https://github.com/ProLoser/CakePHP-Batch","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProLoser%2FCakePHP-Batch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProLoser%2FCakePHP-Batch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProLoser%2FCakePHP-Batch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProLoser%2FCakePHP-Batch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ProLoser","download_url":"https://codeload.github.com/ProLoser/CakePHP-Batch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247583551,"owners_count":20962057,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T01:44:49.381Z","updated_at":"2026-03-02T22:11:12.849Z","avatar_url":"https://github.com/ProLoser.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"h1. CakePHP Batch (and filter) Plugin\n\nPaginates Filtered Records and allows Batch deletion and updating of records\n\n!http://deansofer.com/uploads/media/original-CakePHP_Batch_Plugin.jpg!\n\nh2. Background\n\nThe Batch plugin is an extension of \"Jose Diaz-Gonzalez's Filter plugin\":http://github.com/josegonzalez/cakephp-filter-component, which is something of a fork of \"James Fairhurst's Filter Component\":http://www.jamesfairhurst.co.uk/posts/view/cakephp_filter_component/, which is in turn a fork by \"Maciej Grajcarek\":http://blog.uplevel.pl/index.php/2008/06/cakephp-12-filter-component/, which is ITSELF a fork from \"Nik Chankov's code\":http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/. \"Chad Jablonski\":http://github.com/cjab/cakephp-filter-plugin then added RANGE support with a few bug fixes. \"jmroth\":http://github.com/jmroth/cakephp-filter-plugin pointed out a pretty bad redirect issue and \"fixed it\". This also contains a view helper made by \"Matt Curry\":http://github.com/mcurry/cakephp-filter-component.\n\n\u003cdel\u003eThis also uses a behavior adapted from work by \"Brenton\":http://bakery.cakephp.org/articles/view/habtm-searching to allow for HasAndBelongsToMany and HasMany relationships.\u003c/del\u003e Disabled for now as the behavior isn't working.\n\nh2. Installation\n\nh3. Download\n\n* Clone/Submodule/Download from github into @/plugins/batch@\n\nh3. Include Component\n\nInclude the component in your controller (AppController or otherwise)\n\t@var $components = array('Batch.Batch');@\n\t\n*Note:* _The plugin by default only works with the 'index' action. If you want it to support more actions (such as 'admin_index') you must pass the option (see below)_\n\nh3. Setup the form\n\n\u003cpre\u003e\u003ccode\u003e\u003c?php echo $this-\u003eBatch-\u003ecreate('Post')?\u003e\t\n\u003ctable cellpadding=\"0\" cellspacing=\"0\"\u003e\n\u003ctr\u003e\n\t\u003cth\u003e\u003c?php echo $this-\u003ePaginator-\u003esort('subject');?\u003e\u003c/th\u003e\n\t\u003cth\u003e\u003c?php echo $this-\u003ePaginator-\u003esort('user_id');?\u003e\u003c/th\u003e\n\t\u003cth\u003e\u003c?php echo $this-\u003ePaginator-\u003esort('published');?\u003e\u003c/th\u003e\n\t\u003cth class=\"actions\"\u003e\u003c?php __('Actions');?\u003e\u003c/th\u003e\n\u003c/tr\u003e\n\u003c?php \necho $this-\u003eBatch-\u003efilter(array('subject', 'user_id', 'published'));\nforeach ($posts as $post):\n?\u003e\n\u003ctr\u003e\n\t\u003ctd\u003e\u003c?php echo $post['Post']['subject']; ?\u003e\u0026nbsp;\u003c/td\u003e\n\t\u003ctd\u003e\u003c?php echo $post['Post']['user_id']; ?\u003e\u0026nbsp;\u003c/td\u003e\n\t\u003ctd\u003e\u003c?php echo $post['Post']['published']; ?\u003e\u0026nbsp;\u003c/td\u003e\n\t\u003ctd class=\"actions\"\u003e\n\t\t\u003c?php echo $this-\u003eHtml-\u003elink(__('View', true), array('action' =\u003e 'view', $post['Post']['id']), array('class' =\u003e 'view')); ?\u003e\n\t\t\u003c?php echo $this-\u003eHtml-\u003elink(__('Edit', true), array('action' =\u003e 'edit', $post['Post']['id']), array('class' =\u003e 'edit')); ?\u003e\n\t\t\u003c?php echo $this-\u003eHtml-\u003elink(__('Delete', true), array('action' =\u003e 'delete', $post['Post']['id']), array('class' =\u003e 'delete'), sprintf(__('Are you sure you want to delete # %s?', true), $post['Post']['id'])); ?\u003e\n\t\t\u003c?php echo $this-\u003eBatch-\u003echeckbox($post['Post']['id']); ?\u003e\n\t\u003c/td\u003e\n\u003c/tr\u003e\n\u003c?php \nendforeach;\necho $this-\u003eBatch-\u003ebatch(array(null, 'user_id', 'published')); \n?\u003e\n\u003c/table\u003e\n\u003c?php echo $this-\u003eBatch-\u003eend()?\u003e\u003c/code\u003e\u003c/pre\u003e\n\nh3. Include the CSS / JS (Optional)\n\nSome nifty functionality is supplied with the assets:\n\t@var $this-\u003eHtml-\u003escript('/batch/js/jquery')@\n\t@var $this-\u003eHtml-\u003ecss('/batch/css/batch')@\n\t\nThe Javascript relies on jquery but the files are small so feel free to customize them how you see fit.\n\nh2. Advanced Usage\n\nh3. Initialization Tips\n\nThese different initialization options are combined in the setup array. Defaults are shown below.\n\n\u003cpre\u003e\u003ccode\u003e\u003c?php\nclass PostsController extends AppController {\n\tvar $name = 'Posts';\n\tvar $components = array('Batch.Batch' =\u003e array(\n\t\t'actions' =\u003e array('index'), // You need to add admin_index manually\n\t\t'defaults' =\u003e array(),\n\t\t'fieldFormatting' =\u003e array(\n\t\t\t'string'\t=\u003e \"LIKE '%%%s%%'\",\n\t\t\t'text'\t\t=\u003e \"LIKE '%%%s%%'\",\n\t\t\t'datetime'\t=\u003e \"LIKE '%%%s%%'\"\n\t\t),\n\t\t'formOptionsDatetime' =\u003e array(),\n\t\t'paginatorParams' =\u003e array(\n\t\t\t'page',\n\t\t\t'sort',\n\t\t\t'direction',\n\t\t\t'limit'\n\t\t),\n\t\t'parsed' =\u003e false,\n\t\t'redirect' =\u003e false,\n\t\t'useTime' =\u003e false,\n\t\t'separator' =\u003e '/',\n\t\t'rangeSeparator' =\u003e '-',\n\t\t'url' =\u003e array(),\n\t\t'whitelist' =\u003e array(),\n\t\t'cascade' =\u003e true,\n\t\t'callbacks' =\u003e false,\n\t\t'security' =\u003e true,\n\t));\n}\n?\u003e\u003c/code\u003e\u003c/pre\u003e\n\n# actions:\t\t\t\tArray of actions upon which this component will act upon.\n# defaults:\t\t\t\tHolds pagination defaults for controller actions. (syntax is @array('Model' =\u003e array('key' =\u003e 'value')@)\n# fieldFormatting:\t\tFields which will replace the regular syntax in where i.e. field = 'value'\n# formOptionsDatetime:\tFormatting for datetime fields (unused)\n# paginatorParams:\t\tPaginator params sent in the URL\n# parsed:\t\t\t\tUsed to tell whether the data options have been parsed\n# redirect:\t\t\t\tUsed to tell whether to redirect so the url includes filter data\n# useTime:\t\t\t\tUsed to tell whether time should be used in the filtering\n# separator:\t\t\tSeparator to use between fields in a date input\n# rangeSeparator:\t\tSeparator to use between dates in a date range\n# url:\t\t\t\t\tUrl variable used in paginate helper (syntax is @array('url' =\u003e $url)@);\n# whitelist:\t\t\tArray of fields and models for which this component may filter\n# cascade:\t\t\t\tRecord deletion cascades\n# callbacks:\t\t\tRecord update/deletion triggers callbacks\n# security:\t\t\t\tAdd form buttons to the SecurityComponent::ignoreFields attribute. Resolves conflicts with security component\n\nh2. Todo\n\n# Better code commenting - Done, left to help enforce the habit\n# \u003cdel\u003eSupport Datetime\u003c/del\u003e Done\n# \u003cdel\u003eSupport URL redirects and parsing\u003c/del\u003e Done\n# \u003cdel\u003eRefactor datetime filtering for ranges\u003c/del\u003e Done\n# \u003cdel\u003eAllow the action to be configurable\u003c/del\u003e Done\n# \u003cdel\u003eSupport jQuery Datepicker\u003c/del\u003e Outside scope\n# Support Router prefixes, plugins, and named parameters in a \"scope\" instead of \"actions\" key.\n# Expand hasMany and hasAndBelongsToMany support. Refactor behavior to conform with established practices.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproloser%2Fcakephp-batch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fproloser%2Fcakephp-batch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproloser%2Fcakephp-batch/lists"}