示例#1
0
 /**
  * Delete a tag in the tag database.
  *
  * @return string Standard JSON envelope
  */
 public function delete($tag)
 {
     getAuthentication()->requireAuthentication();
     $res = Tag::delete($tag);
     if ($res) {
         return $this->noContent('Tag deleted successfully', true);
     } else {
         return $this->error('Tag could not be deleted', false);
     }
 }
示例#2
0
 /**
  * Merge a tag into this one, bringing with it all Assets and JobLists.
  *
  * @param \App\Model\Tag $otherTag
  */
 public function merge(Tag $otherTag)
 {
     if ($otherTag->id === $this->id) {
         return;
     }
     $params = ['t' => $this->id, 'ot' => $otherTag->id];
     \DB::update("UPDATE IGNORE asset_tag SET tag_id = :t WHERE tag_id = :ot", $params);
     \DB::delete("DELETE FROM asset_tag WHERE tag_id = :ot", ['ot' => $otherTag->id]);
     \DB::update("UPDATE IGNORE job_list_tag SET tag_id = :t WHERE tag_id = :ot", $params);
     \DB::delete("DELETE FROM job_list_tag WHERE tag_id = :ot", ['ot' => $otherTag->id]);
     $otherTag->delete();
 }
示例#3
0
function resolveCategoryTag(Tag $tag)
{
    $c = KalturaCriteria::create(categoryPeer::OM_CLASS);
    $c->add(categoryPeer::PARTNER_ID, $tag->getPartnerId());
    $categoryFilter = new categoryFilter();
    $categoryFilter->set('_mlikeand_tags', $tag->getTag());
    $categoryFilter->attachToCriteria($c);
    $count = $c->getRecordsCount();
    if (!$count) {
        $tag->delete();
    }
}
示例#4
0
/**
* Delete a tag. Requires login and user must be owner of the tag.
*
* @param string $tagid
* @return Result or Error
*/
function deleteTag($tagid)
{
    $tagobj = new Tag($tagid);
    return $tagobj->delete();
}
示例#5
0
 /**
  * @param Tag $tag
  * @return int
  */
 private function resolveCategoryTag(Tag $tag)
 {
     $c = KalturaCriteria::create(categoryPeer::OM_CLASS);
     $c->add(categoryPeer::PARTNER_ID, $tag->getPartnerId());
     $categoryFilter = new categoryFilter();
     $tagString = str_replace(kTagFlowManager::$specialCharacters, kTagFlowManager::$specialCharactersReplacement, $tag->getTag());
     $categoryFilter->set('_mlikeand_tags', $tagString);
     $categoryFilter->attachToCriteria($c);
     $c->applyFilters();
     $count = $c->getRecordsCount();
     if (!$count) {
         $tag->delete();
         return 1;
     } else {
         $tag->setInstanceCount($count);
         $tag->save();
         return 1;
     }
     return 0;
 }
示例#6
0
 /**
  * Deletes a tag
  *
  * @param Tag $tag The tag to be deleted
  **/
 public static function delete($tag)
 {
     $tag->delete();
 }
示例#7
0
文件: tag.ajax.php 项目: nioc/ampache
 case 'get_labels':
     $labels = Label::get_display(Label::get_all_labels());
     $results['labels'] = $labels;
     break;
 case 'add_tag':
     debug_event('tag.ajax', 'Adding new tag...', '5');
     Tag::add_tag_map($_GET['type'], $_GET['object_id'], $_GET['tag_id']);
     break;
 case 'add_tag_by_name':
     debug_event('tag.ajax', 'Adding new tag by name...', '5');
     Tag::add($_GET['type'], $_GET['object_id'], $_GET['tag_name'], false);
     break;
 case 'delete':
     debug_event('tag.ajax', 'Deleting tag...', '5');
     $tag = new Tag($_GET['tag_id']);
     $tag->delete();
     header('Location: ' . AmpConfig::get('web_path') . '/browse.php?action=tag');
     exit;
 case 'remove_tag_map':
     debug_event('tag.ajax', 'Removing tag map...', '5');
     $tag = new Tag($_GET['tag_id']);
     $tag->remove_map($_GET['type'], $_GET['object_id']);
     break;
 case 'browse_type':
     $browse = new Browse($_GET['browse_id']);
     $browse->set_filter('object_type', $_GET['type']);
     $browse->store();
     break;
 case 'add_filter':
     $browse = new Browse($_GET['browse_id']);
     $browse->set_filter('tag', $_GET['tag_id']);
示例#8
0
<?php

require __DIR__ . '/../../../init.php';
$tag = new Tag($db, $user->get_id());
$error = array();
if (empty($_GET['name']) && empty($_POST['name'])) {
    redirect('/tags');
}
if (isset($_POST['name'])) {
    $tag->delete($_POST['name']);
    redirect('/tags');
}
$name = $_GET['name'];
echo html(title('Homespot - Delete Tag'), navigation($user->is_authed()) . content(h1("Delete Tag - " . $_GET['name']) . form('post', hidden('name', $_GET['name']) . submit('DELETE'))));
示例#9
0
 public function delete()
 {
     if ($this->f3->exists('PARAMS.tok')) {
         //getIdByTok
         $getIdByTok = new Tag($this->db);
         $getIdByTok->getIdByTok($this->f3->get('PARAMS.tok'));
         $tid = $this->f3->get('ID.id');
         //del by ID
         $tags = new Tag2Item($this->db);
         $loaderase = $tags->getByTagId($tid);
         if (count($loaderase) > 0) {
             foreach ($loaderase as $t) {
                 $itemid = $t['id'];
                 $deltags = new Tag2Item($this->db);
                 $deltags->delete($itemid);
             }
         }
         $tg = new Tag($this->db);
         $tg->delete($this->f3->get('PARAMS.tok'));
     }
     $this->f3->set('COOKIE.message', 'Tag was deleted');
     $this->f3->set('COOKIE.messagetype', 'alert-info hide5s');
     $this->f3->reroute('/t');
 }
示例#10
0
 public function deleteTag(Tag $tag)
 {
     $tag->delete();
     return Redirect::route('tag.list')->with('success', Lang::choice('messages.Tags', 1) . ' ' . trans('messages.is deleted'));
 }