Source of file BookPublishersPage.php
Size: 2,489 Bytes - Last Modified: 2021-12-24T05:16:03+00:00
/var/www/docs.ssmods.com/process/src/code/pages/BookPublishersPage.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 | <?php /* * MIT License * * Copyright (c) 2018 Hudhaifa Shatnawi * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * * @author Hudhaifa Shatnawi <hudhaifa.shatnawi@gmail.com> * @version 1.0, Jan 10, 2018 - 4:32:30 PM */ class BookPublishersPage extends DataObjectPage { private static $icon = "librarian/images/books.png"; private static $url_segment = 'publishers'; private static $menu_title = 'Publishers'; private static $allowed_children = 'none'; private static $description = 'Adds publishers page to your library website.'; public function canCreate($member = false) { if (!$member || !(is_a($member, 'Member')) || is_numeric($member)) { $member = Member::currentUserID(); } return (DataObject::get($this->owner->class)->count() > 0) ? false : true; } } class BookPublishersPage_Controller extends DataObjectPage_Controller { protected function getObjectsList() { return DataObject::get('BookPublisher'); } protected function searchObjects($list, $keywords) { return $list->filterAny(array( 'Name:PartialMatch' => $keywords, 'Address:PartialMatch' => $keywords, 'Phone:PartialMatch' => $keywords, )); } protected function getFiltersList() { return null; } } |