18 require_once SQ_INCLUDE_PATH.
'/asset_edit/asset_edit_fns.inc';
44 $this->static_screens = Array();
47 $this->static_screens[
'details'][
'name'] = translate(
'details');
48 $this->static_screens[
'details'][
'force_unlock'] = FALSE;
65 $write = $asset->writeAccess(
'attributes');
69 check_box($prefix.
'_rename',
'1');
70 label(translate(
'rename_thesaurus_term_sys_wide'), $prefix.
'_rename');
71 echo
'<input type="hidden" name="'.$prefix.
'_old_name" value="'.$asset->attr(
'name').
'" />';
91 $old_name = array_get_index($_POST, $prefix.
'_old_name',
'');
92 $name = $asset->attr(
'name');
93 $rename = array_get_index($_POST, $prefix.
'_rename', 0);
97 $asset->setAttrValue(
'name', $name);
98 if (!$asset->saveAttributes()) {
99 $asset->setAttrValue(
'name', $old_name);
103 if (!empty($rename) && !empty($asset->_thesaurus->id)) {
104 $hh = $GLOBALS[
'SQ_SYSTEM']->getHipoHerder();
105 $vars = Array(
'thesaurusid' => $asset->_thesaurus->id,
'terms' => Array($old_name => $name));
106 $hh->queueHipo(
'hipo_job_rename_thesaurus_term', $vars);
131 if ($asset->id == 0) {
132 $parent_assetid = array_get_index($_REQUEST,
'parent_assetid');
133 $parent_asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($parent_assetid);
134 if ($parent_asset->type() ==
'thesaurus') {
135 echo translate(
'thesaurus_creating_top_level_term');
137 $relations = (property_exists($parent_asset,
'_thesaurus')) ? $parent_asset->_thesaurus->getActiveRelations() : NULL;
139 <table
class=
"sq-backend-table">
141 <th
class=
"sq-backend-table-header"><strong><?php echo translate(
'parent'); ?></strong></th>
142 <th
class=
"sq-backend-table-header"><strong><?php echo translate(
'relation'); ?></strong></th>
145 <td><?php echo get_asset_tag_line($parent_assetid); ?></td>
147 if (empty($relations)) {
148 echo
'Because the thesaurus has no relations, this term will not be linked to the parent';
150 combo_box($prefix.
'_new_relation[existing]', $relations, FALSE, $parent_asset->_thesaurus->attr(
'default_rel'));
158 $thesaurus = $asset->_thesaurus;
159 $relations = $thesaurus->getActiveRelations();
161 $parents = $asset->_thesaurus->getParentTerms($asset->_termid);
163 $writeable = $asset->writeAccess(
'all');
166 <table
class=
"sq-backend-table">
168 <th
class=
"sq-backend-table-header"><strong><?php echo translate(
'parent'); ?></strong></th>
169 <th
class=
"sq-backend-table-header"><strong><?php echo translate(
'relation'); ?></strong></th>
172 if (empty($relations)) {
173 echo
'<tr><td colspan="2">There are no relations defined in this thesaurus, you cannot set or view the relations to parent terms.</td></tr>';
176 foreach ($parents as $parent) {
177 $parent_rel = array_get_index($parent,
'relid');
179 if (is_null($parent[
'termid']))
continue;
182 echo get_asset_tag_line($thesaurus->id.
':'.$parent[
'termid']);
186 combo_box($prefix.
'_relations['.$parent[
'linkid'].
']', $relations, FALSE, $parent_rel);
188 echo array_get_index($relations, $parent_rel);
217 if ($asset->id == 0) {
218 $new_rel = array_get_index($_REQUEST, $prefix.
'_new_relation');
219 if (isset($new_rel[
'new'])) {
220 $relation = trim($new_rel[
'new']);
223 if (empty($relation)) {
224 $relation = array_get_index($new_rel,
'existing');
227 $asset->_tmp[
'relation'] = $relation;
229 $thesaurus =& $asset->_thesaurus;
230 $relations = array_get_index($_REQUEST, $prefix.
'_relations', Array());
231 foreach ($relations as $link_id => $relid) {
232 $thesaurus->updateLinkRelation($link_id, $relid);
254 if ($asset->id == 0) {
261 $notes = $asset->getTermNotes();
262 foreach ($notes as $note_name => $note_array) {
263 echo
'<tr><td valign="top" align="right">'.$note_name.
':</td><td valign="top">';
264 foreach ($note_array as $note) {
265 echo nl2br($note).
'<br />';
270 $bridge_id = $asset->_thesaurus->id;
271 $child_rel = $asset->_thesaurus->getChildRelationsForTerm($asset->_termid);
272 foreach ($child_rel as $relid => $relname) {
273 echo
'<tr><td valign="top" align="right">'.$relname.
':</td><td valign="top">';
274 $rel_terms = $asset->_thesaurus->getChildTerms($asset->_termid, $relid);
275 foreach ($rel_terms as $term) {
276 $term_assetid = $bridge_id.
':'.$term[
'termid'];
277 $href_array = $GLOBALS[
'SQ_SYSTEM']->am->getAssetBackendHref(Array($term_assetid =>
'details'));
278 $term_backendhref = $href_array[$term_assetid];
279 echo
'<a href="'.$term_backendhref.
'">'.$term[
'term'].
'</a>';