function move_to() { $gettype = $_GET['gettype']; $team_id = $_GET['team_id']; $project_id = $_GET['project_id']; $ticket_id = $_GET['ticket_id']; $move_to_object_id = $_GET['move_to_object_id']; if (!empty($gettype)) { $this->smarty->assign('gettype', $gettype); switch ($gettype) { case 'projects': $projects = array(); if (!empty($team_id)) { $project_obj = new Project($team_id); //$projects = Milestones::findByProject($project_obj, $this->logged_user); $projects = Milestones::findActiveByProject($project_obj, STATE_VISIBLE, VISIBILITY_NORMAL, 'name', '', '-1'); } $this->smarty->assign('projects', $projects); break; case 'tickets': $tickets = array(); if (!empty($project_id)) { $milestone_obj = new Milestone($project_id); //$tickets = Tickets::findByMilestone($milestone_obj, STATE_VISIBLE, $this->logged_user->getVisibility()); $tickets = Tickets::findOpenByMilestone($milestone_obj, STATE_VISIBLE, $this->logged_user->getVisibility()); } $this->smarty->assign('tickets', $tickets); break; case 'pages': $pages_with_milestone = array(); $pages_with_project = array(); if (!empty($team_id)) { $project_obj = new Project($team_id); //$pages_with_project = Pages::findByProjectWithoutMilestoneAssociation($project_obj, STATE_VISIBLE, $this->logged_user->getVisibility()); $pages_with_project = Pages::findUnarchivedByProjectWithoutMilestoneAssociation($project_obj, STATE_VISIBLE, $this->logged_user->getVisibility()); } elseif (!empty($project_id)) { if (!empty($project_id)) { $milestone_obj = new Milestone($project_id); $team_id = $milestone_obj->getProjectId(); //$pages_with_milestone = Pages::findByMilestone($milestone_obj, STATE_VISIBLE, $this->logged_user->getVisibility()); $pages_with_milestone = Pages::findUnarchivedByMilestone($milestone_obj, STATE_VISIBLE, $this->logged_user->getVisibility()); $project_obj = new Project($team_id); //$pages_with_project = Pages::findByProjectWithoutMilestoneAssociation($project_obj, STATE_VISIBLE, $this->logged_user->getVisibility()); $pages_with_project = Pages::findUnarchivedByProjectWithoutMilestoneAssociation($project_obj, STATE_VISIBLE, $this->logged_user->getVisibility()); } } $this->smarty->assign('pages_with_milestone', $pages_with_milestone); $this->smarty->assign('pages_with_project', $pages_with_project); break; case 'action': $move_to_object = new ProjectObject($move_to_object_id); $link = mysql_connect(DB_HOST, DB_USER, DB_PASS); mysql_select_db(DB_NAME); mysql_query("update healingcrystals_attachments set parent_id='" . $move_to_object->getId() . "', parent_type='" . $move_to_object->getType() . "' where id='" . $this->active_attachment->getId() . "'"); mysql_close($link); $type = $move_to_object->getType(); $obj = new $type($move_to_object_id); $link = 'Attachment Moved: <a href="' . $obj->getViewUrl() . '">Click to View</a>'; $this->smarty->assign('link', $link); break; } } else { $teams = Projects::findNamesByUser($this->logged_user); $this->smarty->assign('teams', $teams); } $parent = $this->active_attachment->getParent(); $this->smarty->assign('cur_project_id', $parent->getProjectId()); $this->smarty->assign('cur_attachment_id', $this->active_attachment->getId()); }