예제 #1
0
    foreach ($grouptags as $id => $tag) {
        if (!$tag || $tag == strtolower($_REQUEST['grouptag'])) {
            unset($grouptags[$id]);
        }
    }
    //end foreach grouptags
}
//end if delete
if (isset($_REQUEST['add'])) {
    $grouptags[] = strtolower($_REQUEST['grouptag']);
}
//end if add
$grouptags = implode(' ', array_unique($grouptags));
$group->my->set('grouptags', $grouptags);
$group->save();
header('Content-Type: text/plain');
if (isset($_REQUEST['form'])) {
    echo '<b>Group Tags:</b> ';
    foreach (explode(' ', $grouptags) as $id => $grouptag) {
        $grouptag = str_replace('+', ' ', $grouptag);
        if ($id > 0) {
            echo ', ';
        }
        echo $grouptag . ' ';
        XNC_Ajax::Link('<img src="http://www.ning.com/xnstatic/icn/cross.gif" alt="[X]" />')->actionUrl('/groupEdit.php?form&delete&grouptag=' . urlencode($grouptag) . '&id=' . $_REQUEST['id'])->htmlElement('group-tags')->callback('Loading', '$(&quot;group-tags&quot;).innerHTML = &quot;<i>Deleting...</i>&quot;;')->confirm('Delete the ' . $grouptag . ' tag?')->make();
    }
    //end foreach grouptags
    exit;
}
//end if isset form
header('Location: ' . $_REQUEST['return_to'], TRUE, 303);
예제 #2
0
파일: view.php 프로젝트: singpolyma/tagging
     echo '</div>';
 }
 //end if current == contributorName
 echo '<br />';
 echo '<p id="group-tags">';
 echo '<b>Group Tags:</b> ';
 foreach ($grouptags as $id => $grouptag) {
     if ($id > 0) {
         echo ', ';
     }
     echo $grouptag . ' ';
     XNC_Ajax::Link('<img src="http://www.ning.com/xnstatic/icn/cross.gif" alt="[X]" />')->actionUrl('/groupEdit.php?form&delete&return_to=' . urlencode('http://' . $_SERVER['HTTP_HOST'] . '/view.php?id=' . $_REQUEST['id']) . '&grouptag=' . urlencode($grouptag) . '&id=' . $_REQUEST['id'])->htmlElement('group-tags')->callback('Loading', '$(&quot;group-tags&quot;).innerHTML = &quot;<i>Deleting...</i>&quot;;')->confirm('Delete the ' . $grouptag . ' tag?')->make();
 }
 //end foreach grouptags
 echo '</p>';
 $grouptagform = XNC_Ajax::Form()->method('post')->actionUrl('/groupEdit.php?form')->htmlElement('group-tags')->callback('Loading', '$(&quot;group-tags&quot;).innerHTML = &quot;<i>Adding...</i>&quot;;');
 $grouptagform->open();
 echo '<input type="hidden" name="add" value="yes" />';
 echo '<input type="hidden" name="id" value="' . $_REQUEST['id'] . '" />';
 echo '<input type="hidden" name="return_to" value="http://' . $_SERVER['HTTP_HOST'] . '/view.php?id=' . $_REQUEST['id'] . '" />';
 echo '<p>Add a group tag: <input type="text" name="grouptag" /> <input type="submit" value="Add" /></p>';
 $grouptagform->close();
 echo '<p>';
 echo '<b>Related Tags:</b> ';
 foreach (fetchTags($group) as $id => $tag) {
     if ($id > 0) {
         echo ', ';
     }
     echo '<a class="tag" href="/index.php/tag/' . $tag . '" rel="tag">' . $tag . '</a>';
 }
 //end foreach tags