Пример #1
0
 public function Render(Renderer $renderer)
 {
     $result = array();
     $this->dataset->AddFieldFilter($this->captionFieldName, FieldFilter::Contains($this->globals->GetGetValue(self::SearchTermParamName)));
     $highLightCallback = Delegate::CreateFromMethod($this, 'ApplyHighlight')->Bind(array(Argument::$Arg3 => $this->captionFieldName, Argument::$Arg4 => $this->globals->GetGetValue(self::SearchTermParamName)));
     if (!StringUtils::IsNullOrEmpty($this->parentIdFieldName) && $this->globals->IsGetValueSet(self::ParentParamName)) {
         $this->dataset->AddFieldFilter($this->parentIdFieldName, FieldFilter::Equals($this->globals->GetGetValue(self::ParentParamName)));
     }
     $this->dataset->Open();
     while ($this->dataset->Next()) {
         $result[] = array('id' => $this->dataset->GetFieldValueByName($this->idFieldName), 'value' => $this->dataset->GetFieldValueByName($this->captionFieldName), 'label' => $highLightCallback->Call($this->dataset->GetFieldValueByName($this->captionFieldName), $this->captionFieldName));
     }
     $this->dataset->Close();
     echo SystemUtils::ToJSON($result);
 }
 public function Render(Renderer $renderer)
 {
     $result = array();
     $this->dataset->AddFieldFilter($this->captionFieldName, FieldFilter::Contains($this->arrayWrapper->GetValue(self::SearchTermParamName)));
     if (!StringUtils::IsNullOrEmpty($this->parentIdFieldName) && $this->arrayWrapper->IsValueSet(self::ParentParamName)) {
         $this->dataset->AddFieldFilter($this->parentIdFieldName, FieldFilter::Equals($this->arrayWrapper->GetValue(self::ParentParamName)));
     }
     $this->dataset->Open();
     $valueCount = 0;
     while ($this->dataset->Next()) {
         $result[] = array('id' => $this->dataset->GetFieldValueByName($this->idFieldName), 'value' => $this->dataset->GetFieldValueByName($this->captionFieldName));
         if (++$valueCount >= 20) {
             break;
         }
     }
     $this->dataset->Close();
     echo SystemUtils::ToJSON($result);
 }