Exemple #1
0
 /**
  * Get objects matching the keywords having the current tag
  *
  * @param string $keywords Keywords
  *
  * @return CMbObject[]
  */
 function getObjects($keywords = "")
 {
     if (!$keywords) {
         $items = $this->loadRefItems();
     } else {
         $where = array("tag_id" => "= '{$this->_id}'", "object_class" => "= 'object_class'");
         $item = new CTagItem();
         $items = $item->seek($keywords, $where, 10000);
     }
     CMbArray::invoke($items, "loadTargetObject");
     return CMbArray::pluck($items, "_ref_object");
 }
             } else {
                 if ($_list && $_list->_id && $line["list_name"]) {
                     $concept->ex_list_id = $_list->_id;
                     if ($_list->multiple) {
                         $concept->prop = "set vertical|1 typeEnum|checkbox";
                         if ($msg = $concept->store()) {
                             CAppUI::setMsg("Ligne {$line_number} : {$msg}", UI_MSG_WARNING);
                             continue;
                         } else {
                             CAppUI::setMsg("{$concept->_class}-msg-modify", UI_MSG_OK);
                         }
                     }
                 }
             }
             // TAG BINDING
             $tag_item = new CTagItem();
             $tag_item->setObject($concept);
             $tag_item->tag_id = $tag2->_id;
             $tag_item->loadMatchingObject();
             if (!$tag_item->_id) {
                 if ($msg = $tag_item->store()) {
                     CAppUI::setMsg("Ligne {$line_number} : {$msg}", UI_MSG_WARNING);
                 } else {
                     CAppUI::setMsg("{$tag_item->_class}-msg-create", UI_MSG_OK);
                 }
             }
         }
         break;
 }
 fclose($fp);
 CAppUI::setMsg("Import terminé", UI_MSG_OK);
     $tag_name = $results[$i]["tag"];
     if ($tag_name) {
         $tag = new CTag();
         $tag->name = $tag_name;
         $tag->object_class = $object->_class;
         $tag->loadMatchingObjectEsc();
         if (!$tag->_id) {
             $msg = $tag->store();
             if ($msg) {
                 CAppUI::setMsg($msg, UI_MSG_ERROR);
                 $results[$i]["error"] = $msg;
                 $i++;
                 continue;
             }
         }
         $tag_item = new CTagItem();
         $tag_item->tag_id = $tag->_id;
         $tag_item->object_id = $object->_id;
         $tag_item->object_class = $object->_class;
         $tag_item->loadMatchingObjectEsc();
         if (!$tag_item->_id) {
             $msg = $tag_item->store();
             if ($msg) {
                 CAppUI::setMsg($msg, UI_MSG_ERROR);
                 $results[$i]["error"] = $msg;
                 $i++;
                 continue;
             }
         }
     }
 }