Esempio n. 1
0
 public function getNodeFilters(NodeQuery $nodeQuery)
 {
     $parameters = $nodeQuery->getParameters();
     $filterParams = array();
     foreach ($parameters as $key => $value) {
         switch ($key) {
             case 'Title.firstChar':
                 $filterParams[$key] = strtolower(substr($value, 0, 1));
                 break;
             case 'ActiveDate.after':
             case 'CreationDate.after':
                 $filterParams[$key] = $this->DateFactory->newLocalDate($value);
                 break;
             case 'ActiveDate.before':
             case 'CreationDate.before':
                 $filterParams[$key] = $this->DateFactory->newLocalDate($value);
                 break;
             case 'ActiveDate.start':
             case 'CreationDate.start':
                 $value = $this->DateFactory->newLocalDate($value);
                 $value->setTime(0, 0, 0);
                 $filterParams[$key] = $value;
                 break;
             case 'ActiveDate.end':
             case 'CreationDate.end':
                 $value = $this->DateFactory->newLocalDate($value);
                 $value->setTime(23, 59, 59);
                 $filterParams[$key] = $value;
                 break;
             case 'Meta.exist':
                 $filterParams[$key] = PartialUtils::unserializeMetaPartials($value);
                 break;
             case 'OutTags.exist':
             case 'InTags.exist':
                 $filterParams[$key] = PartialUtils::unserializeOutPartials($value);
                 break;
             case 'Title.eq':
             case 'Title.ieq':
             case 'Title.like':
             case 'TreeID.childOf':
             case 'TreeID.eq':
             case 'TreeID.depth':
             case 'Status.eq':
             case 'Status.isActive':
             case 'Status.all':
                 $filterParams[$key] = $value;
                 break;
         }
     }
     if (!array_key_exists('Status.eq', $filterParams) && !array_key_exists('Status.isActive', $filterParams) && !array_key_exists('Status.all', $filterParams)) {
         $filterParams['Status.all'] = false;
     }
     return $filterParams;
 }