Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

79 Excellent

About Orkun

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

Profile Information

  • Gender
  • Location

Recent Profile Visitors

4,187 profile views
  1. I have solved this now with a second find since it are not much pages (102 since website launch in 2016). // Workaround $specificSpecialitiesFilteredByClinic = $pages->find("template=specialities-clinics, sort=title, choose_sender_2016={$rootParent->choose_sender_2016}"); $ids = ""; foreach($specificSpecialitiesFilteredByClinic as $speciality){ $ids .= $speciality->parent->id."|"; } $ids = rtrim($ids, "|"); $find = $pages->find("id=$ids, sort=title, limit=24"); KR Orkun
  2. Hi Guys I am trying to sort children pages by their parent title field but it looks like this is only possible in the PW 3 Branch. I am using the 2.7.3 Version. This is my selector at the moment, I am also using pagination (limit): template=specialities-clinics, sort=title, choose_sender_2016={$rootParent->choose_sender_2016}, limit=24 When I try "sort=parent.title" I get the following error: Is there any way/workaround to make this work in the PW 2.7.3 Version? KR Orkun
  3. 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
  4. 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
  5. Hi Bernhard, Thank you for refactoring :) KR Orkun
  6. 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
  7. 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
  8. 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
  9. Nevermind. There was a repeater inside the template which also had a pagefield with custom code in it. :D
  10. 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
  11. 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
  12. 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
  13. 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
  • Create New...