Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by gunter

  1. How ist it possible to se the correct timezone in config.php? It works for me only with the native php date_default_timezone_set(): /** * Installer: Time zone setting * */ $config->timezone = 'UTC'; echo "<br>date:". date('m/d/Y h:i:s a', time()); $config->timezone = 'Europe/Vienna'; echo "<br>date:". date('m/d/Y h:i:s a', time()); date_default_timezone_set('Europe/Vienna'); echo "<br>date:". date('m/d/Y h:i:s a', time()); I´m getting this, the last line is correct date:05/24/2021 09:17:58 am date:05/24/2021 09:17:58 am date:05/24/2021 11:17:58 am //<- yes this is my time!
  2. Is it possible to use the oauth2 library from the league... with google calendar or other google services? Because I tried to use $service = $provider->getGoogleClient(); but the getGoogleClient() method is unknown... so I think this library is just for social login useful, isn´t it?
  3. I want show a fullcalendar in an inputfield... and send data via ajax back to the module (new event, move event, resize event...) catching the ajax call in the init method works... public function init() { parent::init(); if ($this->config->ajax){ echo "<pre>ajax intercepted!!!"; print_r($_GET); print_r($_POST); exit(0); } } when I POST data via ajax back to the server comes this error: "This request was aborted because it appears to be forged". Maybe I can fix this when I give the POST variables proper names, with the inputfield name as prefix, because now the POST variables have just normal names like title, start or end... $.ajax( { url:'".$ajaxurl2.", type:'POST', data:{title:title, start:start, end:end, id:id}, }); using GET variables works... maybe I should just use them... or do you have an easier solution? $.ajax( { url:'".$ajaxurl2."&update=true&title='+title+'&start='+start+'&end='+end, // type:'POST', // data:{title:title, start:start, end:end, id:id}, ....
  4. Gadgetto thanks for your solution! 🙂 Guys, I found what I was looking for: https://processwire.com/talk/topic/9007-utility-to-help-generate-module-install-function/ it just uses normal processwire json export strings for fields and templates and seems for me to be the simpliest solution... I used it once somewhere in a module, it worked, but I forget where I had it.. 🙂
  5. Thanks, that´s nice what your example does, because I was looking for an example that uses pages like your module does... in the admin, too! 😉
  6. Do you know a module that installs some new templates and fields - so I can take it as example? It should loop trough the templates/fields it has to install and checking their existence before it installs them and it would be nice, if they are deinstalled too, if they are not used. I had once an example, but I forget where 🙂
  7. so the full line is this with the %s as variable for the folder name # ProcessWire ProcessWire=composer create-project processwire/processwire %s --stability=dev
  8. ok, thanks elabx for the hint to look at this.. I compared the html output against a working datetime inputfield... the solution is, I have to set the class by hand... I tought it works automatically by setting $field>datepicker... but thats not true $field->attr("class", "FieldtypeDatetime InputfieldDatetimeDatepicker InputfieldDatetimeDatepicker1"); // I have to set the datepicker class by hand (1, 2 or 3) $field->datepicker = InputfieldDatetime::datepickerClick; // this is not needed, because it´s not working so... I have a working date/time picker now, by setting the right class like this
  9. For a custom fieldtype/inputfield that contains two datetime variables (start + end) I want use two datetime inputfields in the render method. Everything works, except the datepicker does not appear... does anybody know why? public function ___render() { $name = $this->attr('name'); $value = $this->attr('value'); //getting values for start and end $start = $value->data["start"]->toDateTimeString();; $end = $value->data["end"]->toDateTimeString(); //preparing inputfield $field = $this->modules->get('InputfieldDatetime'); $field->set("label", __("Date")); $field->attr("class", "uk-form-width-medium "); $field->required = true; $field->datepicker = InputfieldDatetime::datepickerClick; $field->dateInputFormat = 'Y-m-d'; $field->timeInputFormat = 'H:i'; $field->timeInputSelect = 1; //setting first inputfield $field->attr("id+name",$name."_start"); $field->attr("value",$start); $renderedFieldStart = $field->render(); //setting second inputfield $field->attr("id+name",$name."_end"); $field->attr("value",$end); $renderedFieldEnd = $field->render(); $out = $renderedFieldStart.$renderedFieldEnd; return $out; }
  10. This is a small tutorial... If you want add another field to this fieldtype... first in FieldtypeEvents.module in getDatabaseSchema() add a line that suit your needs, so your new field gets stored to the database $schema['newValue'] = 'TINYTEXT NOT NULL'; try if you can install the module and add a field to a template and check if it works like before add the property to the constructor in Events.php $this->set('newValue', ""); then modify set() and get() so you can modify your new property... now try in your template,´if you can modify and output the new property foreach($page->events as $event){ $event->newValue = "hello new value"; echo "yes it works, we we welcome the new value: ". $event->newValue."<br>"; } if this works properly then go back to FieldtyeEvents.module: add this line in __wakeupValue() to the foreach loop $event->newValue = $v['newValue']; and in _sleepValue() 'newValue' => $event->newValue, in file InputfieldEvents.module in renderRow() method make sure, a $newValue variable gets gets sanitized from $newValue = $this->sanitizer->entities($event->newValue); change $out = " <tr class='Event$cnt $class'> <td><a href='#' class='EventClone'><span class='ui-icon ui-icon-copy'></span></a></td> <td><input type='text' name='{$name}_date[]' value='$date' class='datepicker' /></td> <td><input type='text' name='{$name}_newValue[]' value='$_newValue' /></td> //add this line add your field in __render() <table class='InputfieldEvents'> <thead> <tr class=''> <th class='EventClone'>&nbsp;</th> <th class='EventDate'>Date</th> <th class='EventDate'>newValue</th> //I´ve chosen EventDate class because its narrow and in __processInput() $event->newValue = $input->{"{$name}_newValue"}[$cnt]; I hope I didn´t forget anything, good luck!
  11. Which kind of magic is used so that the BaseFieldtypeRuntime does not appear in the fieldtype list? I want extend my own base fieldtype, thats why I want to know this.
  12. problem solved! I have to set a unique id -> then the code from my last posting works - without setting the id -> just one page (the last one) is getting added to the page array $p->id = rand();
  13. $days = 20; $selector = "template=basic-page"; $resultPageArray = $this->pages->find($selector); for($i=0;$i<=$days;$i++){ $p= new Page(); $p->template = 'basic-page'; // set template $p->title = rand(); $p->name = "virtual-page".rand(); $resultPageArray->add( $p); } d($resultPageArray); the dumping function is very useful! Unfortunately I have a problem, this code should in my opionion add 20 pages to items... but only one page gets added, the rest are under $resultPageArray->itemsAdded
  14. Adrian,please... how did you get that clean pagearray debugging info into the bottom screen? 🙂
  15. Aaahhhh!! A name! That's it, I didn'nt gave one! Thanks so much, Adrian!!!
  16. $calendarPageArray = pages->find($selector); $p = new Page(); // create new page object //some page stuff... $calendarPageArray->add($p); I found out that it doesn´t seem to be possible to add an unsaved page to the pagearray... It´s for a worktime scheduling calendar... a have some real pages with the weekdays and their worktime... and I have also pages with special calendar days with special worktime.. I want get the calendar days from the pagetree into a pagearray... and then adding the generic weekdays as somehow virtual unsaved pages into that pagearray...
  17. Looked really nice.. but after clicking submit the page disappeared from the menu structure... In the admin it was still editable - but at the settings of the page at status was written "corrupted" -> I think, the culprit is the image field.. First I thought that a custom fieldtype written by me... or other fields are the problem, so I added them to $ignorefields and tried to add them again field by field... everything went fine!!! then... I tried to upload an image but this error came: Can’t save page 1610: /about/xxx/: Call $page->of(false); then.. I uploaded an image in the admin... in the frontend view I did nothing, except clicking the submit button of the form -> and "page corrupted" appeared in the page status
  18. Are you using normally just strtotime and time for your date/time calculations???? Because pw uses them for the datetime fieldtype? Or addionally the datetime class? * Because I just made a small calendar module, which uses datetime... but now I´m thinking about, if this was a good idea...
  19. thank you! wall time made it more clear for me! This is a nice page about time!
  20. let´s think about an appointment scheduling website... It´s about meeting personally - making an appointment with the hairdresser, massage therapist... is it possible to ignore the timezone? Is it possible to store an appointment (10:00 till 11:00) so it is saved and viewable forever correctly, even if the server time setting is wrong? And just using the timezone to decide when a reminder email has to be sent? Once I was invited by friend from another country who made an facebook event to meet during his travel in my town with some friends... at 6 pm... and then there was nobody there because they real beginning was at 7 pm... because he was in another timezone when he created the event and facebook thought... ah... different timezone... lets subtract an hour to the beginning of the event... *
  21. I have a solution: in the EventArray I wrote this: public function setTrackChange(){ parent::trackChange('value'); } it works now with this modification, I don´t know if there is a better way $page->events->setTrackChange(); $page->save();
  22. A problem occured... this code does not work, the updated event field is not saved (but saving works, the title is saved) and the sleepvalue method isn´t called $page->title = "custom title"; foreach($page->events as $event){ $event->location ="new location"; $event->notes ="new notes"; } echo "now we save..."; $page->save(); but when I add an event to the field array the new event is saved AND the fields are stored - this code works: $event = new Event(); $event->date = "1979-10-12 00:42:00"; $event->location = "Vogsphere"; $event->notes = "The homeworld of the Vogons"; $page->events->add($event); foreach($page->events as $event){ $event->location ="new location"; $event->notes ="new notes"; } echo "now we save..."; $page->save();
  23. importing the wiredata to the new wire array did also not work... so I found out, that the wire data was referenced and not cloned/copied... this works now... $copies = new EventArray(); //new wire array foreach($originals as $key => $original){ $copies[$key] = clone $originals[$key]; //cloning the wiredata does work.. } shall I just put this into a __clone(); method in my wire array?
  • Create New...