diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/support_group.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/support_group.php new file mode 100644 index 000000000..b70d93666 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/support_group.php @@ -0,0 +1,148 @@ +executeWithoutParams("SELECT * FROM support_group ORDER BY Name ASC"); + $rows = $statement->fetchAll(); + $result = Array(); + foreach($rows as $group){ + + $instanceGroup = new self(); + $instanceGroup->set($group); + $result[] = $instanceGroup; + } + return $result; + } + + //wrapper for creating a support group + public static function createSupportGroup( $name, $tag) { + + if(strlen($name) < 21 && strlen($name) > 4 &&strlen($tag) < 8 && strlen($tag) > 1 ){ + $notExists = self::supportGroup_NotExists($name, $tag); + if ( $notExists == "SUCCESS" ){ + $sGroup = new self(); + $sGroup->setName($name); + $sGroup->setTag($tag); + $sGroup->create(); + return "SUCCESS"; + }else{ + //return NAME_TAKEN or TAG_TAKEN + return $notExists; + } + }else{ + //RETURN ERROR that indicates SIZE + return "SIZE_ERROR"; + } + } + + //check if group exists + public static function supportGroup_NotExists( $name, $tag) { + $dbl = new DBLayer("lib"); + //check if name is already used + if( $dbl->execute("SELECT * FROM support_group WHERE Name = :name",array('name' => $name))->rowCount() ){ + return "NAME_TAKEN"; + } + else if( $dbl->execute("SELECT * FROM support_group WHERE Tag = :tag",array('tag' => $tag))->rowCount() ){ + return "TAG_TAKEN"; + }else{ + return "SUCCESS"; + } + } + + //return constructed element based on SGroupId + public static function constr_SGroupId( $id) { + $instance = new self(); + $instance->setSGroup($id); + return $instance; + } + + //returns list of all users that are enlisted to a support group + public static function getAllUsersOfSupportGroup($id) { + $dbl = new DBLayer("lib"); + $statement = $dbl->execute("SELECT * FROM ticket_log INNER JOIN ticket_user ON ticket_log.Author = ticket_user.TUserId and ticket_log.Ticket=:id", array('id' => $ticket_id)); + $row = $statement->fetchAll(); + $result = Array(); + foreach($row as $log){ + $instance = new self(); + $instance->set($log); + $result[] = $instance; + } + return $result; + } + + + ////////////////////////////////////////////Methods//////////////////////////////////////////////////// + + public function __construct() { + } + + //set values + public function set($values) { + $this->setSGroupId($values['SGroupId']); + $this->setName($values['Name']); + $this->setTag($values['Tag']); + } + + public function create() { + $dbl = new DBLayer("lib"); + $query = "INSERT INTO support_group (Name, Tag) VALUES (:name, :tag)"; + $values = Array('name' => $this->name, 'tag' => $this->tag); + $dbl->execute($query, $values); + } + + //Load with sGroupId + public function load_With_SGroupId( $id) { + $dbl = new DBLayer("lib"); + $statement = $dbl->execute("SELECT * FROM ticket_log WHERE TLogId=:id", array('id' => $id)); + $row = $statement->fetch(); + $this->set($row); + } + + + //update private data to DB. + public function update(){ + $dbl = new DBLayer("lib"); + $query = "UPDATE ticket_log SET Timestamp = :timestamp, Query = :query, Author = :author, Ticket = :ticket WHERE TLogId=:id"; + $values = Array('id' => $this->getTLogId(), 'timestamp' => $this->getTimestamp(), 'query' => $this->getQuery(), 'author' => $this->getAuthor(), 'ticket' => $this->getTicket() ); + $statement = $dbl->execute($query, $values); + } + + ////////////////////////////////////////////Getters//////////////////////////////////////////////////// + + public function getSGroupId(){ + return $this->sGroupId; + } + + public function getName(){ + return $this->name; + } + + public function getTag(){ + return $this->tag; + } + + ////////////////////////////////////////////Setters//////////////////////////////////////////////////// + + public function setSGroupId($id){ + $this->sGroupId = $id; + } + + public function setName($n){ + $this->name = $n; + } + + public function setTag($t){ + $this->tag = $t; + } + + +} \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini index a5bb624cd..d44423e22 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini @@ -31,6 +31,12 @@ t_send = "Send reply" [show_queue] +[sgroup_list] +group_success = "The group has been created!" +group_name_taken = "The groupname was already used!" +group_tag_taken = "The tag was already used!" +group_size_error = "The name has to be between 4-20 chars and the tag between 2-4!" + [createticket] [show_ticket_log] diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini index e54f4371a..fde9c20a5 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini @@ -31,6 +31,12 @@ t_send = "Envoyer la reponse" [show_queue] +[sgroup_list] +group_success = "le group est cree!" +group_name_taken = "le nom pour le group est deja utilise!" +group_tag_taken = "le tag pour le group est deja utilise!" +group_size_error = "le nom doit etre 4-20 chars et le tag 2-4!" + [createticket] [show_reply] diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/func/add_sgroup.php b/code/ryzom/tools/server/ryzom_ams/www/html/func/add_sgroup.php new file mode 100644 index 000000000..5f5544e6c --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/func/add_sgroup.php @@ -0,0 +1,34 @@ + +
ID | +Name | +Tag | +Action | +
---|---|---|---|
{$group.sGroupId} | +{$group.name} | +{$group.tag} | +Delete | +