noalyss Version-9
ajax_tag_save.php
Go to the documentation of this file.
1<?php
2//This file is part of NOALYSS and is under GPL
3//see licence.txt
4/**
5 *@file
6 *@brief save a new tag or disable / enable the tag
7 *@see Tag
8 */
9if ( !defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
11$op=$http->request("op");
12global $g_user;
14///check security
15if ( $g_user->check_module('CFGTAG')==0 && $g_user->check_action(TAGADD) == 0)
16{
17 die(_("non permis"));
18}
19
20
21
22//Save a tag
23if ($op=='tag_save')
24{
25 $tag=new Tag($cn);
26 $tag->save($_GET);
27 return;
28}
29//---------------------------------------------------------------------
30// Enable or disable a tag
31//---------------------------------------------------------------------
32if ( $op == "tag_activate")
33{
34 $tag_id=$http->get("t_id");
35 $tag=new Tag($cn, $tag_id);
36 $return=array();
37 $id=sprintf("tag_onoff%d",$tag_id);
38 $data=$tag->get_data();
39 if ( $data->getp('t_actif') == 'Y')
40 {
41 $data->t_actif='N';
42 $data->save();
43 $return['code']='&#xf204;';
44 $return['style']='color:red';
45 } else {
46 $data->t_actif='Y';
47 $data->save();
48 $return['code']='&#xf205;';
49 $return['style']='color:green';
50 }
51 $tag->set_data($data);
52 header("Content-type: text/json; charset: utf8",true);
53 echo json_encode($return);
54}
55?>
global $g_user
$http
$nDossier
$_GET['qcode']
static id()
return the 'gDossier' value after a check
manage the http input (get , post, request) and extract from an array
Tag operations or actions to linked them together.
Definition: tag.class.php:32
const TAGADD