source: branches/2.2.0.1/agileProjects/inc/class.soinsertElement.inc.php @ 4269

Revision 4269, 4.1 KB checked in by rafaelraymundo, 13 years ago (diff)

Ticket #1823 - Adicionada primeira versao do modulo de kanban para avaliacao.

  • Property svn:executable set to *
Line 
1<?php
2        /************************************************************************************************\
3        *  Gerencia de projetos ageis                                                                   *
4        *  by Rafael Raymundo da Silva (rafael2000@gmail.com)                                           *
5        * ----------------------------------------------------------------------------------------------*
6        *  This program is free software; you can redistribute it and/or modify it                      *
7        *  under the terms of the GNU General Public License as published by the                        *
8        *  Free Software Foundation; either version 2 of the License, or (at your                       *
9        *  option) any later version.                                                                   *
10        \***********************************************************************************************/
11include_once('../header.inc.php');
12
13        class soinsertElement{
14
15                var $db;
16                var $insert_projects;
17                var $insert_partic;
18                var $insert_admin;
19                var $insert_sprint;
20                var $insert_task;
21
22                public function soinsertProject($name,$description,$particArray,$adminArray){
23                        include_once('../phpgwapi/inc/class.db.inc.php');
24               
25                        $particArray = unserialize($particArray);
26                        $adminArray = unserialize($adminArray);
27
28                        $numPartic = count($particArray);
29                        $numAdmin = count($adminArray);
30
31                        $this->insert_projects = $GLOBALS['phpgw']->db;
32                        $this->insert_partic = $GLOBALS['phpgw']->db;
33                        $this->insert_admin = $GLOBALS['phpgw']->db;
34
35                        //Insere o projeto guardando seu ID
36                        $proj_id = $this->insert_projects->query('INSERT INTO phpgw_agile_projects(proj_name,proj_description,proj_owner) VALUES(\''.$name.'\',\''.$description.'\',\''.$_SESSION['phpgw_info']['expresso']['user']['userid'].'\') RETURNING proj_id',__LINE__,__FILE__);
37                        $proj_id=substr($proj_id, 7);
38                       
39                        //Insere os usuarios participantes e posteriormente os administradores
40                        for($i=0;$i<$numPartic;$i++){
41                                $this->insert_partic->query('INSERT INTO phpgw_agile_users_projects(uprojects_id_user, uprojects_id_project,uprojects_user_admin,uprojects_active) VALUES(\''.$particArray[$i].'\',\''.$proj_id.'\',FALSE,FALSE)',__LINE__,__FILE__);
42                        }
43                        for($i=0;$i<$numAdmin;$i++){
44                                $this->insert_admin->query('INSERT INTO phpgw_agile_users_projects(uprojects_id_user, uprojects_id_project,uprojects_user_admin,uprojects_active) VALUES(\''.$adminArray[$i].'\',\''.$proj_id.'\',TRUE,FALSE)',__LINE__,__FILE__);
45                        }
46                }
47
48                public function soinsertSprint($name,$dt_start,$dt_end,$goal){
49                        include_once('../phpgwapi/inc/class.db.inc.php');
50                        $this->insert_sprint = $GLOBALS['phpgw']->db;
51
52                        //Insere o sprint
53                        $sprint_insert = $this->insert_sprint->query('INSERT INTO phpgw_agile_sprints(sprints_id_proj, sprints_name, sprints_dt_start, sprints_dt_end, sprints_goal) VALUES(\''.$_SESSION['phpgw_info']['expresso']['agileProjects']['active'].'\',\''.$name.'\',\''.$dt_start.'\',\''.$dt_end.'\', \''.$goal.'\')',__LINE__,__FILE__);
54                }
55               
56                public function soinsertTask($sprint,$priority,$responsable,$title,$description,$estimate){
57//system("echo $sprint >/tmp/control.txt");
58                        include_once('../phpgwapi/inc/class.db.inc.php');
59                       
60                        if($priority != 'true'){
61                                $priority = 'f';
62                        }
63                        else{
64                                $priority = 't';
65                        }
66
67                        $this->insert_task = $GLOBALS['phpgw']->db;
68
69                        //Insere a tarefa
70                        $task_insert = $this->insert_task->query('INSERT INTO phpgw_agile_tasks(tasks_id_sprints,tasks_priority, tasks_id_proj, tasks_id_owner, tasks_title, tasks_description, tasks_status, tasks_estimate) VALUES('.$sprint.',\''.$priority.'\','.$_SESSION['phpgw_info']['expresso']['agileProjects']['active'].','.$responsable.',\''.$title.'\',\''.$description.'\',\'sprintBacklog\','.$estimate.');',__LINE__,__FILE__);
71                }
72        }
73?>
Note: See TracBrowser for help on using the repository browser.