<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage forms
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkEdit();
$concept_id = CValue::get("concept_id");
$concept = new CExConcept();
$concept->load($concept_id);
$concept->loadView();
$list_owner = $concept->getRealListOwner();
$list_owner->loadView();
$list_owner->loadRefItems();
$spec = CExConcept::getConceptSpec($concept->prop);
if ($spec instanceof CEnumSpec) {
    $list_owner->updateEnumSpec($spec);
}
$smarty = new CSmartyDP();
$smarty->assign("concept", $concept);
$smarty->assign("spec", $spec);
$smarty->display("inc_concept_value_choser.tpl");
 // CONCEPT
 $concept_prop = CValue::read($prop_map, CMbString::lower($line["concept_type"]));
 if (!$concept_prop) {
     CAppUI::setMsg("Ligne {$line_number} : type de concept invalide : <strong>{$line['concept_type']}</strong>", UI_MSG_WARNING);
     continue;
 }
 // If list name provided, it needs to exist
 if ($line["list_name"]) {
     $_list = new CExList();
     $_list->name = $line["list_name"];
     if (!$_list->loadMatchingObject()) {
         CAppUI::setMsg("Ligne {$line_number} : nom de liste introuvable : <strong>{$line['list_name']}</strong>", UI_MSG_WARNING);
         continue;
     }
 }
 $concept = new CExConcept();
 $ds = $concept->_spec->ds;
 $where = array("name" => $ds->prepare("=%", $line["concept_name"]));
 $concept->loadObject($where);
 if (!$concept->_id) {
     if ($_list && $_list->_id && $line["list_name"]) {
         $concept->ex_list_id = $_list->_id;
         if ($_list->multiple) {
             $concept_prop = "set vertical|1 typeEnum|checkbox";
         }
     }
     $concept->name = $line["concept_name"];
     $concept->prop = $concept_prop;
     if ($msg = $concept->store()) {
         CAppUI::setMsg("Ligne {$line_number} : {$msg}", UI_MSG_WARNING);
         continue;
                break;
            default:
            case 0:
        }
    }
}
$step = $limit;
$total = 0;
if ($limit) {
    $limit = "{$start}, {$limit}";
}
$ref_objects_cache = array();
$search = null;
if ($concept_search) {
    $concept_search = stripslashes($concept_search);
    $search = CExConcept::parseSearch($concept_search);
}
$ex_class_event = new CExClassEvent();
$ex_class_events = null;
$ex_link = new CExLink();
$group_id = $group_id ? $group_id : CGroups::loadCurrent()->_id;
$where = array("ex_link.group_id" => "= '{$group_id}'");
if ($ex_class_id) {
    $where['ex_link.ex_class_id'] = "= '{$ex_class_id}'";
}
$ljoin = array();
$creation_context = null;
if (!$creation_context_class || !$creation_context_id) {
    $creation_context_class = $reference_class;
    $creation_context_id = $reference_id;
}
Exemple #4
0
     $query = "\r\n    UPDATE `ex_class_field`\r\n    SET\r\n    `prop` = REPLACE(`prop`, ' default|0', ''),\r\n    `prop` = REPLACE(`prop`, ' default|1', ''),\r\n    `prop` = REPLACE(`prop`, ' default|', '')\r\n    WHERE `prop` LIKE 'bool %';";
     if (!$ds->query($query)) {
         CAppUI::setMsg("Erreur lors de la remise à zéro des champs booléens (" . $ds->error() . ")", UI_MSG_WARNING);
     } else {
         CAppUI::setMsg($ds->affectedRows() . " champs mis à jour", UI_MSG_OK);
     }
     $query = "\r\n    UPDATE `ex_concept`\r\n    SET\r\n    `prop` = REPLACE(`prop`, ' default|0', ''),\r\n    `prop` = REPLACE(`prop`, ' default|1', ''),\r\n    `prop` = REPLACE(`prop`, ' default|', '')\r\n    WHERE `prop` LIKE 'bool %';";
     if (!$ds->query($query)) {
         CAppUI::setMsg("Erreur lors de la remise à zéro des concepts booléens (" . $ds->error() . ")", UI_MSG_WARNING);
     } else {
         CAppUI::setMsg($ds->affectedRows() . " concepts mis à jour", UI_MSG_OK);
     }
     break;
 case "str_to_text":
     $where = array("prop" => "LIKE 'str%'");
     $concept = new CExConcept();
     $str_concepts = $concept->loadList($where);
     foreach ($str_concepts as $_concept) {
         $_concept->prop = preg_replace("/^(str)/", "text", $_concept->prop);
         if ($msg = $_concept->store()) {
             CAppUI::setMsg($msg, UI_MSG_WARNING);
         } else {
             CAppUI::setMsg("Concept modifié", UI_MSG_OK);
         }
     }
     if (count($str_concepts) == 0) {
         CAppUI::setMsg("Aucun concept modifié", UI_MSG_OK);
     }
     $ex_field = new CExClassField();
     $str_fields = $ex_field->loadList($where);
     foreach ($str_fields as $_field) {
    }
    /** @var CExList[] $_similar */
    $_similar = $import->getSimilarFromElement($_list_element);
    $lists[$_list_element->getAttribute("id")] = array("values" => CMbXMLObjectImport::getValuesFromElement($_list_element), "similar" => $_similar, "elements" => $_elements_values);
}
$sortfunc = function ($a, $b) {
    return strcasecmp($a["values"]["name"], $b["values"]["name"]);
};
uasort($lists, $sortfunc);
$list = new CExList();
/** @var CExList[] $all_lists */
$all_lists = $list->loadGroupList(null, "name");
$concept_elements = $import->getElementsbyClass("CExConcept");
$concepts = array();
foreach ($concept_elements as $_concept_element) {
    $_values = CMbXMLObjectImport::getValuesFromElement($_concept_element);
    $_spec = explode(" ", $_values["prop"]);
    $concepts[$_concept_element->getAttribute("id")] = array("values" => CMbXMLObjectImport::getValuesFromElement($_concept_element), "similar" => $import->getSimilarFromElement($_concept_element), "spec_type" => $_spec[0]);
}
uasort($concepts, $sortfunc);
$concept = new CExConcept();
$all_concepts = $concept->loadGroupList(null, "name");
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("ex_class_name", $ex_class_name);
$smarty->assign("uid", $uid);
$smarty->assign("concepts", $concepts);
$smarty->assign("all_concepts", $all_concepts);
$smarty->assign("lists", $lists);
$smarty->assign("all_lists", $all_lists);
$smarty->display("inc_import_ex_class.tpl");
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage forms
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkEdit();
$keywords = CValue::get("_native_field_view");
$list = CExConcept::getReportableFields();
$show_views = false;
// filtrage
if ($keywords) {
    $show_views = true;
    $re = preg_quote($keywords);
    $re = CMbString::allowDiacriticsInRegexp($re);
    $re = str_replace("/", "\\/", $re);
    $re = "/({$re})/i";
    foreach ($list as $_key => $element) {
        if (!preg_match($re, $element["title"])) {
            unset($list[$_key]);
        }
    }
}
$smarty = new CSmartyDP();
$smarty->assign("host_fields", $list);
$smarty->assign("show_views", $show_views);
/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage forms
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkEdit();
$ex_class_field_id = CValue::get("ex_class_field_id");
$form_name = CValue::get("form_name");
$value = CValue::get("value");
$ex_class_field = new CExClassField();
$ex_class_field->load($ex_class_field_id);
$ex_class_id = $ex_class_field->loadRefExGroup()->ex_class_id;
$ex_object = new CExObject($ex_class_id);
$ex_object->{$ex_class_field->name} = $value;
$spec = CExConcept::getConceptSpec($ex_class_field->prop);
if ($spec instanceof CEnumSpec) {
    $ex_class_field->updateEnumSpec($spec);
}
$ex_class_field->readonly = "0";
$ex_class_field->hidden = "0";
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("ex_field", $ex_class_field);
$smarty->assign("ex_object", $ex_object);
$smarty->assign("form", $form_name);
$smarty->assign("is_predicate", true);
$smarty->display("inc_ex_object_field.tpl");
    }
}
$exclude = array("confidential", "mask", "format", "reported", "perm", "seekable", "pattern", "autocomplete", "cascade", "delimiter", "canonical", "protected", "class", "alphaAndNum", "byteUnit", "length", "loggable");
$boolean = array("notNull", "vertical", "progressive", "cascade");
$options = $spec->_options;
foreach ($exclude as $_exclude) {
    unset($options[$_exclude]);
}
function order_items($a, $b)
{
    $order = $GLOBALS["items"];
    $key_a = array_search($a, $order);
    $key_b = array_search($b, $order);
    return ($key_a === false ? 1000 : $key_a) - ($key_b === false ? 1000 : $key_b);
}
CExConcept::orderSpecs($options);
$items_sub = array();
$items_all = array();
if ($spec instanceof CEnumSpec) {
    if ($list_owner->_id) {
        $list_owner->updateEnumSpec($spec);
        $prop .= " " . implode("|", $spec->_list);
    }
    $items_sub = $spec->_list;
    $items_all = $spec->_list;
}
// to get the right locales
/*
if ($spec instanceof CEnumSpec) {
  $ex_field = new CExClassField;
  $ex_field->load($ex_field_id);
             CAppUI::setMsg("Ligne {$line_number} : {$msg}", UI_MSG_WARNING);
             continue;
         } else {
             CAppUI::setMsg("{$current_class->_class}-msg-create", UI_MSG_OK);
         }
     }
     $current_class->loadRefsGroups();
     $current_group = reset($current_class->_ref_groups);
     continue;
 }
 if (!$current_group || !$current_group->_id) {
     CAppUI::setMsg("Ligne {$line_number} sautée", UI_MSG_OK);
     continue;
 }
 // CONCEPT
 $concept = new CExConcept();
 $ds = $concept->_spec->ds;
 $where = array("name" => $ds->prepare("=%", $line["concept_name"]));
 $concept->loadObject($where);
 if (!$concept->_id) {
     CAppUI::setMsg("Ligne {$line_number} : concept non trouvé : <strong>{$line['concept_name']}</strong>", UI_MSG_WARNING);
     continue;
 }
 // FIELD
 $field = new CExClassField();
 CExClassField::$_load_lite = true;
 $field_name = empty($line["field_name"]) ? $line["concept_name"] : $line["field_name"];
 $ds = $field->_spec->ds;
 $where = array("ex_class_field_translation.std" => $ds->prepare("=%", $field_name), "ex_class_field.ex_group_id" => $ds->prepare("=%", $current_group->_id));
 $ljoin = array("ex_class_field_translation" => "ex_class_field_translation.ex_class_field_id = ex_class_field.ex_class_field_id");
 $field->loadObject($where, null, null, $ljoin);
Exemple #10
0
        if ($prop == "mbField") {
            $prop = "";
        }
        $field = "dummy";
        $object = new CMbObject();
        $object->{$field} = null;
        $object->_props[$field] = $prop;
        @($object->_specs = $object->getSpecs());
        $spec = @CMbFieldSpecFact::getSpec($object, $field, $prop);
        $options = $spec->getOptions();
        $invalid = array("moreThan", "moreEquals", "sameAs", "notContaining", "notNear", "dependsOn", "helped", "aidesaisie");
        foreach ($invalid as $_invalid) {
            unset($options[$_invalid]);
        }
        self::orderSpecs($options);
        $spec->_options = $options;
        return $spec;
    }
    /**
     * @return CExList|CExListItemsOwner
     */
    function getRealListOwner()
    {
        if ($this->ex_list_id) {
            return $this->loadRefExList();
        }
        return parent::getRealListOwner();
    }
}
CExConcept::$_options_order = array_flip(CExConcept::$_options_order);