Exemplo n.º 1
0
 public function parseSearchRelation(umiField $field, $template, $template_item, $template_separator)
 {
     $block_arr = array();
     $name = $field->getName();
     $title = $field->getTitle();
     $guide_id = $field->getGuideId();
     $guide_items = umiObjectsCollection::getInstance()->getGuidedItems($guide_id);
     $fields_filter = getRequest('fields_filter');
     $value = getArrayKey($fields_filter, $name);
     $items = array();
     $i = 0;
     $sz = sizeof($guide_items);
     $is_tpl = !def_module::isXSLTResultMode();
     if (!$is_tpl) {
         $template_item = true;
     }
     $unfilter_link = "";
     foreach ($guide_items as $object_id => $object_name) {
         if (is_array($value)) {
             $selected = in_array($object_id, $value) ? "selected" : "";
         } else {
             $selected = $object_id == $value ? "selected" : "";
         }
         if ($template_item) {
             $line_arr = array();
             $line_arr['attribute:id'] = $line_arr['void:object_id'] = $object_id;
             $line_arr['node:object_name'] = $object_name;
             $params = $_GET;
             unset($params['path']);
             unset($params['p']);
             $params['fields_filter'][$name] = $object_id;
             $filter_link = "?" . http_build_query($params, '', '&');
             unset($params['fields_filter'][$name]);
             $unfilter_link = "?" . http_build_query($params, '', '&');
             $line_arr['attribute:filter_link'] = $filter_link;
             $line_arr['attribute:unfilter_link'] = $unfilter_link;
             if ($selected) {
                 $line_arr['attribute:selected'] = "selected";
             }
             $items[] = def_module::parseTemplate($template_item, $line_arr);
             if (++$i < $sz) {
                 if ($is_tpl) {
                     $items[] = $template_separator;
                 }
             }
         } else {
             $items[] = "<option value=\"{$object_id}\" {$selected}>{$object_name}</option>";
         }
     }
     $block_arr['attribute:unfilter_link'] = $unfilter_link;
     $block_arr['attribute:name'] = $name;
     $block_arr['attribute:title'] = $title;
     $block_arr['subnodes:values'] = $block_arr['void:items'] = $items;
     $block_arr['void:selected'] = $value ? "" : "selected";
     return def_module::parseTemplate($template, $block_arr);
 }
Exemplo n.º 2
0
 protected function importTypeRelation(umiField $v06e3d36fa30cea095545139854ad1fb9, DOMElement $vcaf9b6b99962bf5c2264824231d7a40c, umiObjectType $v599dcce2998a6b40b1e38e8c6006cb0a)
 {
     $v8328b28850bcb3400e7349ac3d5602c6 = $vcaf9b6b99962bf5c2264824231d7a40c->getElementsByTagName('guide');
     $vd535f8615f1de2e299e22535183a9d22 = $v8328b28850bcb3400e7349ac3d5602c6->length ? $v8328b28850bcb3400e7349ac3d5602c6->item(0)->getAttribute('id') : false;
     $v051369818a8073bba5feeb0e957eb308 = $this->relations->getNewTypeIdRelation($this->source_id, $vd535f8615f1de2e299e22535183a9d22);
     if (!$v051369818a8073bba5feeb0e957eb308) {
         return false;
     }
     if ($v06e3d36fa30cea095545139854ad1fb9->getGuideId() != $v051369818a8073bba5feeb0e957eb308) {
         $v06e3d36fa30cea095545139854ad1fb9->setGuideId($v051369818a8073bba5feeb0e957eb308);
         $this->updated_relations++;
         $this->writeLog($this->getLabel('label-relation') . ': ' . $this->getLabel('label-datatype') . " (" . $v599dcce2998a6b40b1e38e8c6006cb0a->getName() . ") - " . $this->getLabel('label-field') . " (" . $v06e3d36fa30cea095545139854ad1fb9->getName() . ") - " . $this->getLabel('label-guide') . " ({$v051369818a8073bba5feeb0e957eb308}) " . $this->getLabel('label-has-been-updated-f'));
         $v06e3d36fa30cea095545139854ad1fb9->commit();
     }
     return true;
 }