Ejemplo n.º 1
0
$cxn = mysql_connect($mcl_db_host, $mcl_db_uid, $mcl_db_pwd);
if (!$cxn) {
    die('Could not connect to database: ' . mysql_error());
}
mysql_select_db($mcl_enhanced_db_name);
// New list
if ($_POST['action'] == 'new') {
    // Create the new list definition
    $cld = new ConceptListDefinition();
    $cld->setName($list_name);
    $cld->setDescription($list_description);
    // create the new list
    $cl = new ConceptList($cld);
    foreach ($arr_concepts as $c) {
        $cl->addConcept($c->concept_id);
        // TODO: $cl->addConcept($c->dict_id, $c->concept_id);
    }
    // Commit to database
    $clf = new ConceptListFactory();
    $clf->setConnection($cxn);
    if (!$clf->insertConceptList($cl)) {
        trigger_error('Could not create list', E_USER_ERROR);
    } else {
        echo 'successfully created list!';
    }
} elseif ($action == 'add') {
    //
} elseif ($action == 'remove') {
    //
} else {
}
Ejemplo n.º 2
0
$source = $_POST['source'];
$list_id = null;
if (isset($_POST['list'])) {
    $list_id = $_POST['list'];
}
$concepts = null;
if (isset($_POST['concepts'])) {
    $concepts = $_POST['concepts'];
}
// Connect to db
$cxn = mysql_connect($mcl_db_host, $mcl_db_uid, $mcl_db_pwd);
if (!$cxn) {
    die('Could not connect to database: ' . mysql_error());
}
mysql_select_db($mcl_default_concept_dict_db, $cxn);
$clf = new ConceptListFactory();
$clf->setConnection($cxn);
$clf->debug = $debug;
// Determine if this is a restricted list
// NOTE: right now, this only applies to the MCL Core. Can override with 'admin' parameter.
$restrict_editing = false;
if ($list_id == 1) {
    if (!isset($_POST['admin'])) {
        $restrict_editing = true;
    }
}
/****************************************************************************
**	Process Delete
****************************************************************************/
if ($submit == 'delete') {
    // Make the sure the right parameters are set