コード例 #1
0
ファイル: list.php プロジェクト: nyairo/mcl-search
// open db connection
$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 {
コード例 #2
0
 /**
  * Private function to load an openmrs map source.
  */
 private function _loadMapSource($cld)
 {
     // Load the concept ids from the concept map source
     $sql_concepts = 'select cm.concept_id ' . 'from ' . $dict_name . '.concept_map cm ' . 'where cm.source = ' . $cld->getListId();
     $rsc_concepts = mysql_query($sql_concepts, $this->getConnection());
     if (!$rsc_concepts) {
         echo "could not query db in ConceptListFactory::_loadMapSource: " . mysql_error();
         exit;
     }
     // Put the data in to the ConceptList object
     $cl = new ConceptList($cld);
     while ($row = mysql_fetch_assoc($rsc_concepts)) {
         $_id = $row['concept_id'];
         $cl->addConcept($_id);
     }
     return $cl;
 }