-
Posts
6,671 -
Joined
-
Last visited
-
Days Won
366
Everything posted by bernhard
-
could you please tell us what you use it for? i know what it does but sometimes it's easier to get the context by an example. thank you
-
hmm... maybe you could hook page::viewable? something like hookafter page::viewable if($page->isUnpublished() AND $page->previewcheckbox == 1 AND $page->createdUser == $user) $event->return = true; i would also create a hook to remove the preview checkbox for all pages that were edited more than 1 hour ago (or 1 day)
-
hi macrura, just visited your site again because i may need something similar. as i did lots of work with datatables recently i saw you might want to add scrollx to your table as it is not 100% visible on very small screens: https://datatables.net/examples/basic_init/scroll_x.html maybe you are already checking for mobile devices. i just checked with chrome window resize
-
Preview/Discussion: RockDataTables
bernhard replied to bernhard's topic in Module/Plugin Development
current version has properly formatted currency fields (atm only euro) and supports colorbars and column sums (also from selected rows) had to remove this video, sorry -
hi @Macrura, glad you like it, but to be honest i don't think any more that this module has a big value now as i've done a lot more modules on my own, i would just put a simple hook into ready.php and hardcode the description. or get the description from a field in a custom settings page or the like...
-
most likely it will be a path issue... try something like that: http://stackoverflow.com/questions/22092683/mpdf-5-7-1-image-displays-as-a-broken-x
-
It is still the same. Show us the code you have and tell us the steps you did and I'm sure someone will help you
-
add a sql query to a pages->find() operation?
bernhard replied to bernhard's topic in General Support
Thank you szabez!! Your post looks ideal for me and helped a lot selector arrays would be much better in other places of my projects code as well -
add a sql query to a pages->find() operation?
bernhard replied to bernhard's topic in General Support
Thank you. Was just wondering if there's a maximum length for a selector string or something like that -
add a sql query to a pages->find() operation?
bernhard replied to bernhard's topic in General Support
Yes, that was one part of the question: how scalable is it...? -
add a sql query to a pages->find() operation?
bernhard replied to bernhard's topic in General Support
Hm. I already had this field in place but I removed it because I didn't want to mess with hooking and having bugs like forgetting to update the field on page delete or the like. Thank you for your input, I'll take a second thought on this -
add a sql query to a pages->find() operation?
bernhard replied to bernhard's topic in General Support
Yes that would be what I need and what I stated in my first post. But still I think it would be the best to get those pages by sql. As I said I'm using a custom dB view. The question is how to exclude the IDS properly. Create an ID string by foreach-ing all SQL results? -
add a sql query to a pages->find() operation?
bernhard replied to bernhard's topic in General Support
Hmmm... Thank you but that's not what I'm looking for. It's not that easy. I'll try to explain more in detail. I have clients on the one hand and projects on the other. Then I also have acquisition processes (acp) that connect clients and projects (like acp "get client x for project y" would connect client x and project y). It's easy to select all acp that started in a given timeframe (first example). But now I need to select only acps that are related to a special type of client. The problem is that this type is dynamically depending on the given year. I have three types of clients: Clients that already had some revenue in the years before , clients that had their first revenue in the current year and clients that did not have any revenue at all. So I cannot count the started processes and subtract the number of clients... I think I have to go the SQL way, but I wanted to make sure that there is no other magical PW way like subselectors. I guess in my case, as I'm querying a custom dB view it's best to go with SQL -
Preview/Discussion: RockDataTables
bernhard replied to bernhard's topic in Module/Plugin Development
hi kathep, sure it is also usable in the frontend. but it is no click-click solution. the module just provides some helpers to define the columns like i showed in the example. to make the code more clear to read, write and maintain. you would just have to include the right scripts (i'm currently loading all the plugins via cdn) and you would be fine. maybe you would also have to do some styling. but all of that is - at least for now - not intended to be handled by my module. hope that answer helps you -
hi, i have a quite complex find operation to do. i already setup those find operations via $pages->count('my selector') the problems is, that i have to exclude some pages from this result. its not possible to put this into a sub-selector because its a complex query that has to do some group by and date comparison and so on. i want to stay with the pages->count() on the other hand because changing completely to an sql query would need some refactoring... what i have now: <?php $count = $pages->count( 'template=rockacp'. ',rockacp_start>'.$fromto[0]. ',rockacp_start<'.$fromto[1] ); what i need is something like this: <?php $count = $pages->count( 'template=rockacp'. ',rockacp_start>'.$fromto[0]. ',rockacp_start<'.$fromto[1]. ',client.id!=1|2|3|4' ); In the example it would be fine, i'm just wondering what would happen if the number of pages gets too large? I don't like the idea of creating an pipe-separated id string and using this for my count operation... any better ideas for this? thank you
-
Preview/Discussion: RockDataTables
bernhard replied to bernhard's topic in Module/Plugin Development
need to setup tables via custom sql queries? PHP // init datatables module $dt2 = $modules->get('RockDataTables2'); // setup columns $sql = 'SELECT * FROM invoicetable'; $dt2->setupColsBySql($sql); // setup table $dt2->id = 'dt_finanzbuch'; $dt2->js('/site/modules/ProcessRockFinance/dt_finanzbuch.js'); $f = $modules->get('InputfieldMarkup'); $f->label = 'Tabelle'; $f->value = $dt2->render(); $form->add($f); // ################################## // ajax request -> return data // non-ajax -> render form + table // ################################## if($config->ajax) { echo $dt2->getJSON($dt2->getDataBySql($sql)); die(); } JS $(document).ready(function() { // setup variables var opt = ProcessWire.config.dt_finanzbuch; // options from backend var colDefs = []; // column definitions // custom column definitions here // load default column definitions colDefs = colDefs.concat(dtGetDefaultDefs(opt)); // initialise table $('#dt_finanzbuch').DataTable({ ajax: { url: './book/', type: 'post' }, columnDefs: colDefs, pageLength: 10, footerCallback: columnSums, }); }); Result As you can see the sum function is not ready. it shows euros for my usecase... -
i think it's more related to setting up a proper rewrite base than changing this module. https://processwire.com/docs/tutorials/troubleshooting-guide/page3
-
hi roych, you should be as clear as possible in your questions. you don't explain what the problem is. you could add screenshots how it is and how it should be. styling is usually done via CSS. answers depend a lot on your setup...
-
vary small thing: could you please make the column width inputfield selected by default after clicking on the width shortcuts? that would make it very fast to change multiple columns at once: click column type number ctrl+s thank you
-
do those pages have a title field? maybe you removed it? in the pagetree you wouldn't realize it because it would show the page name. try a tracy console like $child = $pages->get(_your_childpage_id_); d($child->id); d($child->title);
-
DEPRECATED - this module will not see any updates. I'm short before releasing RockGrid as commercial module. If you are interested contact me via PM this is a preview of a module that i'm working on for quite a long time. I needed it for an intranet office management application that i'm still working on. It makes it very easy to create very customized Datatables using the awesome jquery datatables plugin (www.datatables.net) Download - sorry, removed as it changes too frequently; closed alpha - contact me if you think you can contribute Remarks: The module is intended to be used on the backend. Loading styles is at the moment only done via adding files to the $config->styles/scripts arrays. Also the communicaton to javascript is done via the $config->js() method that is built into the admin and would have to be implemented manually on frontend use. But it would not be difficult of course Installation: Nothing special here, just download + install edit: removed some parts, because i made a complete rewrite of the module (and may not have been the last one)! [...] removed Why i created this module: of course i know @Soma s module but i needed a lot more features and the newer datatables version. also i like to define all the columns as objects and have everything on one place. lister & markupadmindatatable: nice for basic tables but lacks of features to modify the appearance of the cell values (like rendering icons, background colors and so on) datatables provides a great frontend API for filtering, showing/hiding columns, getting data, modifying it... it also plays well together with frontend charts like google chart api in this case: todo / roadmap: reload only one row add filters to all columns (in future also dropdowns, smaller than, bigger than, Regex, ...) make it possible to add table on frontend pages make buttons look like pw buttons make it possible to set settings globally and only for one table provide easy way of colorbars (percentage, red/green), maybe at different positions (left, top, right, bottom) provide easy way of adding action items (edit, show, link etc - visible or onhover) make own layout for tables (topleft, topright, bottom etc to make it easy to create extensions and show messages) privide way of simple javascript plugins (like I already have for row sums etc) provide easy way of handling actions for all selected items (delete selected, update selected...) provide easy way of reloading data (--> easy when using ajax source) easy way of showing/hiding columns excel/csv/clipboard export GUI for table setup processmodule to show different tables (lister replacement)
-
Released: PadLoper (commercial eCommerce platform for ProcessWire)
bernhard replied to apeisa's topic in Modules/Plugins
hi! could you explain some details what has to be done, please? -
Page status invalid when using saveReady hook
bernhard replied to adamspruijt's topic in General Support
any news on that @Soma ? -
i would suggest doing the following: create a new template file for your page that holds the map data with exactly the code from the google example (javascript + html): https://developers.google.com/maps/documentation/javascript/examples/map-simple?hl=de change nothing but your api-key. when you view this page you should see the same map as on the google docs page. replace the fixed values for lat/lng/zoom by those saved in your processwire site. see my example above ($page->map->lat...) view your page, it should show the map at the position that you specified in your backend change your style by adding the styles options (see code below) view your page, you should see the new style if everything works, try to implement your map in your original template file var map; function initMap() { map = new google.maps.Map(document.getElementById('map'), { center: {lat: -34.397, lng: 150.644}, zoom: 8, // add comma here styles: [ { "stylers": [ { "hue": "#c1d72e" } ] } ] }); }
-
just don't use the modules render() method and write the code on your own. you should know how to do that as you say you already did it without the module you have all the necessary field data in these variables: echo $page->map->address; // outputs the address you entered echo $page->map->lat; // outputs the latitude echo $page->map->lng; // outputs the longitude echo $page->map->zoom; // outputs the zoom level you can also just copy the generated markup of your render method and then adjust the necessary (parts of your) scripts.