You are here

function tft_is_file_archived in Taxonomy File Tree 7

Same name and namespace in other branches
  1. 7.2 tft.module \tft_is_file_archived()

Checks if the file is already archived.

Parameters

int $nid:

Return value

bool

File

./tft.module, line 689
Module hooks.

Code

function tft_is_file_archived($nid) {
  $node = node_load($nid);
  $folder_tids = array();

  // Get original folder
  foreach (array_keys($node->taxonomy) as $tid) {
    if (variable_get('tft_vocabulary_vid', 0) == db_query("SELECT vid FROM {taxonomy_term_data} WHERE tid = :tid", array(
      ':tid' => $tid,
    ))
      ->fetchField()) {
      $folder_tids[] = $tid;
    }
  }
  foreach ($folder_tids as $tid) {
    if (tft_is_term_archived($tid)) {
      return TRUE;
    }
  }
  return FALSE;
}