Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

77 Excellent

About Orkun

  • Rank
    Sr. Member
  • Birthday 10/10/1996

Profile Information

  • Gender
  • Location

Recent Profile Visitors

4,098 profile views
  1. Hi Guys The field dependencies doesn't work for me when the "receiver" field is a "InputfieldRadios" field (the inputfields with the defined "showIf" Attribute are always hidden). It only works when I change the "receiver" field to "InputfieldSelect". // Get repeater Pages as selectable Option if(count($page->rootParent->choose_sender_2016->contactform_receivers) > 1){ $field = $modules->get("InputfieldRadios"); $field->label = _gt("empfaenger"); $field->attr('id+name', "receiver"); foreach ($page->rootParent->choose_sender_2016->contactform_receivers as $option) { $field->addOption($option->id, $option->title); } if($input->get->receiver){ $field->value = $input->get->receiver; } $field->required = 1; $form->append($field); } // triggerMedicalFields is a single page reference field which returns the repeater pages as selectable list (PHP Custom Code) if($page->triggerMedicalFields){ $clinicSpecialities = $pages->find("template=specialities-clinics, choose_sender_2016={$page->rootParent->choose_sender_2016}"); if($clinicSpecialities->count > 0){ $field = $modules->get("InputfieldSelect"); $field->label = _gt("fachgebiet"); $field->attr('id+name', "speciality"); foreach ($clinicSpecialities as $option) { $field->addOption($option->parent->id, $option->parent->title); } $field->required = 1; $field->showIf = "receiver={$page->triggerMedicalFields->id}"; $form->append($field); } $field = $modules->get("InputfieldText"); $field->label = _gt("krankheitsbild"); $field->attr('id+name','disease_pattern'); $field->required = 1; $field->showIf = "receiver={$page->triggerMedicalFields->id}"; $form->append($field); $upload_path = $config->paths->assets . "files/-tmp_uploads/"; $field = $modules->get("InputfieldFile"); $field->label = _gt("medizinische-dokumentation"); $field->required = 1; $field->attr("name+id", 'medical-documentation'); $field->destinationPath = $upload_path; $field->extensions = "jpg jpeg gif png"; $field->maxFiles = 3; $field->maxFilesize = 2*1024*1024; // 2mb $field->showIf = "receiver={$page->triggerMedicalFields->id}"; $form->add($field); } How can I make Inputfield Dependencies work with InputfieldRadios? I am using PW Version 2.7.3. KR Orkun
  2. Hi @Robin S Thank you for the tip! I didn't know about the listable method. I am using now the listable hook to hide pages in the admin tree (and also in PageListSelect Inputfields). About the false child count problem. You are probably right, that this is not worth the trouble so I will leave it as it is, since I didn't heard any complains from the users concerning false child count. What is the benefit from hooking Page::listable() instead of ProcessPageList::find()? KR Orkun
  3. Hi Bernhard, Thank you for refactoring :) KR Orkun
  4. It looks like a hook to ProcessPageList::find is working. Here is the code $this->addHookAfter('ProcessPageList::find', function(HookEvent $event) { // Get the object the event occurred on, if needed $ProcessPageList = $event->object; // An 'after' hook can retrieve and/or modify the return value $return = $event->return; // Get values of arguments sent to hook (if needed) $selectorString = $event->arguments(0); $page = $event->arguments(1); $excludePagesByTemplate = array( "newsletter-clinic", "sender_2016", "sender_2016_collab", "inside-news-folder", "basic-page", "event-clinic", "domain_root", "brandportal-index", "key-figures", "jobs", "news", "media-mirror", "worker", "xmlexport", "weekly-menu", "intranet_domain_root", "weekly-menu-index", "daily-menu", "daily-menu-index", "benefit", "benefits-index", "pdiatres-de-garde-index", "xml-feed-index", "courses-index", "help-doc", "stocks-index", "dictionary", "iPad-PDF-Index", "pkb-pikettdienst-index", "heisser-stuhl-index", "heisser-stuhl" ); if($return instanceof PageArray){ foreach($return as $p){ if(in_array($p->template->name, $excludePagesByTemplate)){ if(!$p->editable() && !$p->addable()) { $return->remove($p); } } } } $event->return = $return; }); KR Orkun
  5. Hi @dragan Wouldn't be there problems when using a css or js solution, because of the ajax loading and pagination? I mean there is also still the problem of false child count (also with the current code). KR Orkun
  6. Hi Guys A long time ago (2-3 years ago) I had written the following hook (based on this gist https://gist.github.com/somatonic/5595081): public function init() { $this->addHookAfter('ProcessPageList::execute', $this, 'hidePages'); } public function hidePages(HookEvent $event){ if($this->wire('config')->ajax){ $excludePages = new PageArray(); $the_pages = $this->wire('pages')->find("template=newsletter-clinic|sender_2016|sender_2016_collab|inside-news-folder|basic-page|event-clinic|domain_root|brandportal-index|key-figures|jobs|news|media-mirror|worker|xmlexport|weekly-menu|intranet_domain_root|weekly-menu-index|daily-menu|daily-menu-index|benefit|benefits-index|pdiatres-de-garde-index|xml-feed-index|courses-index|help-doc|stocks-index|dictionary|iPad-PDF-Index|pkb-pikettdienst-index|heisser-stuhl-index|heisser-stuhl"); foreach ($the_pages as $the_page) { if(!$the_page->editable() && !$the_page->addable()) { $excludePages->add($the_page); } } foreach ($this->wire('pages')->find("template=specialties") as $sp) { if($sp->numChildren > 0){ $editableFound = 0; foreach ($sp->children() as $spc) { if($spc->editable()){ $editableFound++; }else{ $excludePages->add($spc); } } if($editableFound == 0){ $excludePages->add($sp); } }else{ $excludePages->add($sp); } } $hidden = explode('|', $excludePages); $json = json_decode($event->return, true); foreach($json['children'] as $key => $child){ if(in_array($child['id'],$hidden)) unset($json['children'][$key]); } $json['children'] = array_values($json['children']); $event->return = json_encode($json); } } It hides all the uneditable and unaddable (can't add children to page) pages for non-superusers. But this code slows down the page tree view heavily. Because of this I wanted to ask if there is better way (possibly a new added hook in PW3?) to hide uneditable/unaddable pages for non-superusers. KR Orkun
  7. Nevermind. There was a repeater inside the template which also had a pagefield with custom code in it. :D
  8. Hi Guys After upgrading from 2.7.3 to 3.0.141 I am getting following errors when editing pages that have a page reference field with php custom code option enabled. On the corresponding page/template I have these two fields/custom code: I have tried to solve it by adding namespace ProcessWire; at the top of the custom code (for both pagefields) but that doens't worked. The error still persist. How can I solve this? KR Orkun
  9. The error persisted even when i deleted the contents of site/assets/cache/FileCompiler. But I have now added the following inside the PHPExcel File and it is working now: KR Orkun
  10. Hi @BitPoet Thank you for your help. But when I do this: require_once( dirname(__FILE__) . '/Classes/PHPExcel.php' /*NoCompile*/ ); I can't access the processwire backend anymore and this error is thrown: KR Orkun
  11. Hi Guys I upgraded today an existing 2.7.3 PW Installation to PW 3.0.141. I am now always getting this message when refreshing the admin because of a custom module I had made a long time ago which is using the PHPExcel library: The Structure of the module looks like this: And it is included like this in the module file: At first I thought I need to add namespace ProcessWire; at the top of to the ProcessEventManager.module but doing that lead to this error message and I wasn't able to use the admin at all: When I remove the line require_once( dirname(___FILE___) . '/Classes/PHPExcel.php'); from the ProcessEventManager.module file the filecompiler message doesn't come anymore. Do you know how can I remove the FileCompiler Message once and for all without removing PHPExcel? KR Orkun
  12. Hi Guys I needed to add extended functionalities for the InputfieldDatetime Module (module is from processwire version 2.7.3) because of a Request of Customer. So I duplicated the module and placed it under /site/modules/. I have added 3 new Settings to the InputfieldDatetime Module. 1. Day Restriction - Restrict different days based on weekdays selection (e.g. saturday, sunday) - WORKING 2. Time Slots - Define Time slots based on custom Integer Value (max is 60 for 1 hour) - WORKING 3. Time Range Rules per Weekday - Define a minTime and MaxTime per Weekday (e.g. Opening Hours of a Restaurant) - NOT WORKING PROPERLY The Problem Time Slots and Day Restriction working fine so far. But the Time Range Rules per Weekday doesn't work right. What should happen is, that when you click on a date, it should update the minTime and maxTime of the Time Select. But the change on the select only happens if you select a date 2 times or when you select a date 1 time and then close the datepicker and reopen it again. The time select doesn't get change when you select a date 1 time and don't close the picker. Here is the whole extended InputfieldDatetime Module. The Files that I have changed: InputfieldDatetime.module InputfieldDatetime.js jquery-ui-timepicker-addon.js (https://trentrichardson.com/examples/timepicker/) - updated it to the newest version, because minTime and maxTime Option was only available in the new version Thats the Part of the JS that is not working correctly: if(datetimerules && datetimerules.length){ options.onSelect = function(date, inst) { var day = $(this).datetimepicker("getDate").getDay(); day = day.toString(); var mintime = $(this).attr('data-weekday'+day+'-mintime'); var maxtime = $(this).attr('data-weekday'+day+'-maxtime'); console.log("weekday: "+day); console.log("minTime: "+mintime); console.log("maxTime: "+maxtime); var optionsAll = $(this).datetimepicker( "option", "all" ); optionsAll.minTime = mintime; optionsAll.maxTime = maxtime; $(this).datetimepicker('destroy'); $(this).datetimepicker(optionsAll); $(this).datetimepicker('refresh'); //$.datepicker._selectDate($(this).attr("id"),date); //$.datepicker._base_getDateDatepicker(); // var inst = $.datepicker._getInst($(this)); // $.datepicker._updateDatepicker(inst); /*$(this).datetimepicker('destroy'); InputfieldDatetimeDatepicker($(this), mintime, maxtime); $(this).datetimepicker('refresh'); */ // $(this).datetimepicker('option', {minTime: mintime, maxTime: maxtime}); } } Can you have a look and find out what the Problem is? InputfieldDatetime.zip Kind Regards Orkun
  13. Nevermind solved it by deleting the Row inside the table "Fields" and also deleted the Table "field_event_dates". Kind Regards Orkun
  • Create New...