function tripal_features_set_taxonomy
1.x tripal_feature.admin.inc | tripal_features_set_taxonomy($max_sync = 0, $job_id = NULL) |
Related topics
1 string reference to 'tripal_features_set_taxonomy'
- tripal_feature_admin_validate in tripal_feature/
includes/ tripal_feature.admin.inc
File
- tripal_feature/
includes/ tripal_feature.admin.inc, line 415 - @todo Add file header description
Code
function tripal_features_set_taxonomy($max_sync = 0, $job_id = NULL) {
// make sure our vocabularies are cleaned and reset before proceeding
tripal_feature_del_vocabulary();
tripal_feature_set_vocabulary();
// iterate through all drupal feature nodes and set the taxonomy
$results = db_query("SELECT * FROM {chado_feature}");
$nsql = "SELECT * FROM {node} " .
"WHERE nid = %d";
$i = 0;
// load into ids array
$count = 0;
$chado_features = array();
while ($chado_feature = db_fetch_object($results)) {
$chado_features[$count] = $chado_feature;
$count++;
}
// Iterate through features that need to be synced
$interval = intval($count * 0.01);
foreach ($chado_features as $chado_feature) {
// update the job status every 1% features
if ($job_id and $i % $interval == 0) {
tripal_job_set_progress($job_id, intval(($i / $count) * 100));
}
print "$i of $count: ";
$node = db_fetch_object(db_query($nsql, $chado_feature->nid));
tripal_feature_set_taxonomy($node, $chado_feature->feature_id);
$i++;
}
}