| 26 |
$access = 'tag users'; |
$access = 'tag users'; |
| 27 |
$items = array(); |
$items = array(); |
| 28 |
|
|
| 29 |
if ($may_cache) { |
if (!$may_cache) { |
| 30 |
|
} |
| 31 |
$items[] = array( |
$items[] = array( |
| 32 |
'path' => 'tags', |
'path' => 'tags', |
| 33 |
'title' => t('Tags in use'), |
'title' => t('Tags in use'), |
| 87 |
'access' => user_access('administer user tags'), |
'access' => user_access('administer user tags'), |
| 88 |
'type' => MENU_CALLBACK, |
'type' => MENU_CALLBACK, |
| 89 |
); |
); |
|
} |
|
| 90 |
return $items; |
return $items; |
| 91 |
} |
} |
| 92 |
|
|
| 97 |
function user_tags_user($op, &$edit, &$account, $category = NULL) { |
function user_tags_user($op, &$edit, &$account, $category = NULL) { |
| 98 |
switch ($op) { |
switch ($op) { |
| 99 |
case 'view': |
case 'view': |
| 100 |
|
drupal_add_css(drupal_get_path('module', 'user_tags') .'/user_tags.css'); |
| 101 |
return user_tags_user_view($account->taxonomy); |
return user_tags_user_view($account->taxonomy); |
| 102 |
break; |
break; |
| 103 |
|
|
| 131 |
* @param char $key : term ID |
* @param char $key : term ID |
| 132 |
* @return all the tags belonging to the user with the specified uid |
* @return all the tags belonging to the user with the specified uid |
| 133 |
*/ |
*/ |
| 134 |
function user_tags_get_terms_query($uid, $rid = null, $key = 'tid') { |
function user_tags_get_terms_query($uid, $key = 'tid', $rid = null) { |
| 135 |
$result = db_query('SELECT tu.rid rid ,t.* FROM {term_data} t |
$result = db_query('SELECT tu.rid rid ,t.* FROM {term_data} t |
| 136 |
INNER JOIN {term_user} tu WHERE tu.tid = t.tid |
INNER JOIN {term_user} tu WHERE tu.tid = t.tid |
| 137 |
'.(($rid)? "AND tu.rid = %d":"").' AND tu.uid =%d',(($rid)?"$rid,$uid":$uid)); |
'.(($rid)? "AND tu.rid = %d":"").' AND tu.uid =%d',(($rid)?"$rid,$uid":$uid)); |
| 138 |
$terms = array(); |
$terms = array(); |
| 140 |
$terms[$term->$key] = $term; |
$terms[$term->$key] = $term; |
| 141 |
} |
} |
| 142 |
return $terms; |
return $terms; |
| 143 |
} |
/*$t = 'SELECT tu.rid rid ,t.tid , t.vid , t.name , t.weight, utv.label_profile description |
| 144 |
|
FROM {term_data} t, {term_user} tu INNER JOIN {user_tags_vocabulary} utv ON tu.rid = utv.rid |
| 145 |
function user_tags_user_view($tags){ |
WHERE tu.tid = t.tid '.(($rid)? "AND tu.rid = %d":"").' AND tu.uid =%d'; |
|
$list = array(); |
|
|
// dprint_r($tags); |
|
|
foreach ($tags as $tid => $term) { |
|
|
// dprint_r($term); |
|
|
$list[] = array('value' => l($term->name, "tags/user/$tid")); |
|
|
} |
|
|
|
|
|
if (!empty($list)) { |
|
|
return array('Tags' => $list); |
|
|
} |
|
|
} |
|
|
|
|
|
function theme_user_tags_user_view(){ |
|
|
$output .= theme('table', $header, $rows); |
|
| 146 |
|
|
| 147 |
$output .= '<h3>' . t('Actions') . '</h3>'; |
$result = db_query($t,(($rid)?"$rid,$uid":$uid)); |
| 148 |
$output .= '<p>' . t('These actions will be performed on the scheduled views.') . '</p>'; |
$terms = array(); |
| 149 |
|
|
| 150 |
$header = array(t('action'), t('delete')); |
while ($term = db_fetch_array ($result)) { |
| 151 |
|
$terms[$term[$key]][] = $term; |
| 152 |
|
|
|
foreach (element_children($form['actions']['old']) as $aid) { |
|
|
$row = array(); |
|
|
$row[] = $form['actions']['old'][$aid]['aid']['#value']; |
|
|
$row[] = drupal_render($form['actions']['old'][$aid]['delete']); |
|
|
$rows[] = $row; |
|
| 153 |
} |
} |
| 154 |
|
return $terms; |
| 155 |
if (!$rows) { |
*/ |
|
$rows[] = array(array('data' => t('No actions have been defined.'), 'colspan' => '6')); |
|
|
} |
|
|
|
|
|
$row = array(); |
|
|
$row[] = drupal_render($form['actions']['new']['aid']); |
|
|
$row[] = ''; |
|
|
$rows[] = $row; |
|
|
|
|
|
$output .= theme('table', $header, $rows); |
|
|
|
|
|
$output .= drupal_render($form); |
|
|
|
|
|
return $output; |
|
| 156 |
} |
} |
| 157 |
|
|
|
|
|
| 158 |
function user_tags_user_load($account){ |
function user_tags_user_load($account){ |
| 159 |
$account->taxonomy = array(); |
$account->taxonomy = array(); |
| 160 |
$account->taxonomy = user_tags_get_terms_query($account->uid); |
$account->taxonomy = user_tags_get_terms_query($account->uid,'description'); |
| 161 |
return $account->taxonomy; |
return $account->taxonomy; |
| 162 |
} |
} |
| 163 |
|
|
| 164 |
|
function user_tags_user_view($tags) { |
| 165 |
|
$value = array(); |
| 166 |
|
$items = array(); |
| 167 |
|
dprint_r($tags); |
| 168 |
|
|
| 169 |
|
} |
| 170 |
|
|
| 171 |
|
|
| 172 |
|
|
| 173 |
/** |
/** |
| 174 |
* generate the vocabulary forms selected for this module |
* generate the vocabulary forms selected for this module |
| 175 |
* in admin setting, if user has already selected any tags |
* in admin setting, if user has already selected any tags |
| 441 |
|
|
| 442 |
|
|
| 443 |
/* |
/* |
| 444 |
* Provide a form to schedule a view. |
* Provide a form to build associations |
| 445 |
*/ |
*/ |
| 446 |
function user_tags_add_vocabulary() { |
function user_tags_add_vocabulary() { |
| 447 |
$op = $_POST['op']; |
$op = $_POST['op']; |
| 485 |
} |
} |
| 486 |
|
|
| 487 |
function _user_tags_setting_form($default, $op = null) { |
function _user_tags_setting_form($default, $op = null) { |
| 488 |
$description = user_tags_setting_form_description(); |
$description = _user_tags_setting_form_description(); |
| 489 |
|
|
| 490 |
$form = array(); |
$form = array(); |
| 491 |
$form['#tree'] = TRUE; // make sure we preserve all hierarchial values. |
$form['#tree'] = TRUE; // make sure we preserve all hierarchial values. |
| 616 |
} |
} |
| 617 |
|
|
| 618 |
|
|
| 619 |
function user_tags_setting_form_description(){ |
function _user_tags_setting_form_description(){ |
| 620 |
$description = new stdClass(); |
$description = new stdClass(); |
| 621 |
$description->vocabulary = "Select a vocabulary to use with this module"; |
$description->vocabulary = "Select a vocabulary to use with this module"; |
| 622 |
$description->vocabulary_name = "Replaces vocabulary name in profile view and edit pages. |
$description->vocabulary_name = "Replaces vocabulary name in profile view and edit pages. |
| 729 |
if(!$form_values['label']['vocabulary']['name']){ |
if(!$form_values['label']['vocabulary']['name']){ |
| 730 |
form_set_value($form['label']['vocabulary']['name'], $vocab->name); |
form_set_value($form['label']['vocabulary']['name'], $vocab->name); |
| 731 |
} |
} |
| 732 |
|
|
| 733 |
if(!$form_values['label']['vocabulary']['description']){ |
if(!$form_values['label']['vocabulary']['description']){ |
| 734 |
form_set_value($form['label']['vocabulary']['description'], $vocab->description); |
form_set_value($form['label']['vocabulary']['description'], $vocab->description); |
| 735 |
} |
} |