コード例 #1
0
ファイル: list.php プロジェクト: nyairo/mcl-search
    echo '<td>' . $c->csrg_id . '</td>';
    echo '<td>' . $c->concept_id . '</td>';
    echo '<td>' . $c->name . '</td>';
    echo '</tr>';
}
echo '</table>';
// 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!';
コード例 #2
0
 /**
  * Private function to load a MCL Concept List definition object.
  */
 private function _loadConceptListDefinition($id)
 {
     // Load the concept list definition
     $sql_list = 'select cl.concept_list_id, cl.list_name, cd.dict_id, cd.dict_name, cd.db_name ' . 'from mcl.concept_list cl ' . 'left join mcl.concept_dict cd on cd.dict_id = cl.dict_id ' . 'where cl.concept_list_id = ' . $id;
     $rsc_list = mysql_query($sql_list, $this->getConnection());
     if (!$rsc_list) {
         echo "could not query db in ConceptListFactory::_loadConceptListDefinition: " . mysql_error();
         exit;
     }
     // Create the ConceptListDefinition object
     $cld = null;
     if ($row = mysql_fetch_assoc($rsc_list)) {
         $cld = new ConceptListDefinition();
         $cld->setListId($row['concept_list_id']);
         $cld->setName($row['list_name']);
         $cld->setDescription('');
         $cld->setDictionary($row['dict_id'], $row['dict_name'], $row['db_name']);
     }
     return $cld;
 }