/**
 * Handle on_milestone_add_links event
 *
 * @param Milestone $milestone
 * @param User $user
 * @param array $links
 * @return null
 */
function tickets_handle_on_milestone_add_links($milestone, $user, &$links)
{
    if ($user->getProjectPermission('ticket', $milestone->getProject()) >= PROJECT_PERMISSION_CREATE) {
        $links[lang('Ticket')] = tickets_module_add_ticket_url($milestone->getProject(), array('milestone_id' => $milestone->getId()));
    }
    // if
}
/**
 * Handle on_milestone_add_links event
 *
 * @param Milestone $milestone
 * @param User $user
 * @param array $links
 * @return null
 */
function pages_handle_on_milestone_add_links($milestone, $user, &$links)
{
    if ($user->getProjectPermission('page', $milestone->getProject()) >= PROJECT_PERMISSION_CREATE) {
        $links[lang('Page')] = pages_module_add_page_url($milestone->getProject(), array('milestone_id' => $milestone->getId()));
    }
    // if
}
/**
 * Populate $objects with objects that $user can see
 *
 * @param Milestone $milestone
 * @param array $objects
 * @param User $user
 * @return null
 */
function checklists_handle_on_milestone_objects(&$milestone, &$objects, &$user)
{
    if ($user->getProjectPermission('checklist', $milestone->getProject()) >= PROJECT_PERMISSION_ACCESS) {
        $objects[lang('Checklists')] = Checklists::findByMilestone($milestone, STATE_VISIBLE, $user->getVisibility());
    }
    // if
}
/**
 * Handle on_milestone_add_links event
 *
 * @param Milestone $milestone
 * @param User $user
 * @param array $links
 * @return null
 */
function discussions_handle_on_milestone_add_links($milestone, $user, &$links)
{
    if ($user->getProjectPermission('discussion', $milestone->getProject()) >= PROJECT_PERMISSION_CREATE) {
        $links[lang('Discussion')] = discussions_module_add_discussion_url($milestone->getProject(), array('milestone_id' => $milestone->getId()));
    }
    // if
}
 /**
  * Constructor
  *
  * @param Milestone $object
  */
 function __construct($object)
 {
     if ($object instanceof RemediaMilestone) {
         $this->object = $object;
     } else {
         $this->object = new RemediaMilestone($object->getId());
     }
 }
/**
 * @param Project $project
 * @param Milestone $milestone
 * @param User $user
 * @param NamedList $sections
 * @param string $interface
 */
function frosso_handle_on_milestone_sections(&$project, &$milestone, &$user, &$sections, $interface)
{
    //uncomment these lines to add a new tab, instead
    if (Tasks::canAccess($user, $project)) {
        Router::assemble('milestone_tasks', array('project_slug' => $project->getSlug(), 'milestone_id' => $milestone->getId()));
        //   		$section = array(
        //         'text' => lang('FRed'),
        //         'url' => Router::assemble('tasks_frosso', array('project_slug' => $project->getSlug(), 'milestone_id' => $milestone->getId())),
        //         'options' => array(),
        //       );
        //       $sections->add('frosso', $section);
    }
    // if
}
Beispiel #7
0
 /**
  * @return array[]
  */
 public function milestoneSelectOptions($valueField = 'id', $status = null, $sort = 'ASC')
 {
     $options = [];
     $milestones = Milestone::where('project_id = ?')->setParameter(0, $this->id)->orderBy('display_order', $sort);
     if ($status !== null) {
         $milestones->andWhere('status = ?')->setParameter(1, $status);
     }
     foreach ($milestones->execute()->fetchAll() as $milestone) {
         $options[] = ['label' => $milestone['name'], 'value' => $milestone[$valueField]];
     }
     return $options;
 }
Beispiel #8
0
 public function testQueryArray()
 {
     $someDate = new QDateTime();
     $someDate->setDate(2006, 1, 1);
     $objItems = Milestone::QueryArray(QQ::GreaterThan(QQN::Milestone()->Project->StartDate, $someDate), QQ::OrderBy(QQN::Milestone()->Project->Name));
     $this->assertEqual(sizeof($objItems), 3);
     $this->assertEqual($objItems[0]->Name, "Milestone F");
     $this->assertEqual($objItems[0]->Project->Name, "Blueman Industrial Site Architecture");
     $this->assertEqual($objItems[1]->Name, "Milestone D");
     $this->assertEqual($objItems[1]->Project->Name, "State College HR System");
     $this->assertEqual($objItems[2]->Name, "Milestone E");
     $this->assertEqual($objItems[2]->Project->Name, "State College HR System");
 }
 /**
  * View the discussion
  *
  */
 function view()
 {
     if ($this->active_milestone->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if (!$this->active_milestone->canView($this->logged_user)) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     ProjectObjectViews::log($this->active_milestone, $this->logged_user);
     $total_objects = 0;
     $objects = $this->active_milestone->getObjects($this->logged_user);
     if (is_foreachable($objects)) {
         foreach ($objects as $objects_by_module) {
             $total_objects += count($objects_by_module);
         }
         // foreach
     }
     // if
     $this->smarty->assign(array('objects' => $objects, 'total_objects' => $total_objects, 'page_back_url' => assemble_url('mobile_access_view_milestones', array('project_id' => $this->active_project->getId()))));
     $this->addBreadcrumb(str_excerpt(clean($this->active_milestone->getName()), 10), mobile_access_module_get_view_url($this->active_milestone));
     $this->addBreadcrumb(lang('View'));
 }
Beispiel #10
0
 public function actionIndex()
 {
     $this->render('layouts/header');
     $this->render('general/index', array('general' => $this->getGeneral(), 'messages' => $this->getMessages()), true);
     $this->render('pokemon/index', array('pokemon' => Pokemon::getPartyPokemon(), 'owned' => $this->getGeneral()->pokedex_owned, 'seen' => $this->getGeneral()->pokedex_seen), true);
     $this->render('badge/index', array('badges' => Badge::getBadges(null, 'LIMIT 0, 8')), true);
     $this->render('pokemon_box/index', array('pokemon' => Pokemon::getBoxPokemon()), true);
     $this->render('pokemon_daycare/index', array('pokemon' => Pokemon::getDaycarePokemon()), true);
     $this->render('item/index', array('items' => Item::getAllItems()), true);
     $this->render('pokemon_history/index', array('pokemon' => Pokemon::getHistoryPokemon()), true);
     $this->render('milestone/index', array('milestones' => Milestone::getMilestones()), true);
     $this->render('fact/index', array('facts' => Fact::getFacts()), true);
     $this->render('credit/index', array('credits' => Credit::getCredits()), true);
     $this->render('layouts/footer');
 }
 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());
 }
 function getHomeTabContent($user_id = '', $tickets_due_flag = '')
 {
     require_once SMARTY_PATH . '/plugins/modifier.html_excerpt.php';
     if (empty($user_id)) {
         $user_id = $this->getId();
     }
     $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
     mysql_select_db(DB_NAME, $link);
     $query = "select setting_value from healingcrystals_user_settings where user_id='" . $user_id . "' and setting_type='HOMETAB_LAYOUT'";
     $result = mysql_query($query);
     if (mysql_num_rows($result)) {
         $info = mysql_fetch_assoc($result);
         $layout_type = $info['setting_value'];
     } else {
         $layout_type = 'summary';
     }
     //possible values for tickets_due_flag: 'due' or 'all'
     if (empty($tickets_due_flag)) {
         $tickets_due_flag = 'due';
     }
     $query = '';
     if ($tickets_due_flag == 'due') {
         $query = "SELECT a.id, a.type, b.user_id, c.reminder_date, IF(c.reminder_date is null, a.due_on, IF(a.due_on<=c.reminder_date, a.due_on, c.reminder_date)) as old_date\n                      FROM healingcrystals_project_objects a\n                      inner join healingcrystals_assignments b on a.id=b.object_id\n                      left outer join healingcrystals_project_object_misc c on (a.id=c.object_id)\n                      where a.state='" . STATE_VISIBLE . "' and b.user_id='" . $user_id . "' and b.is_owner='1' and\n                      (a.type='Task' or a.type='Ticket') and (a.completed_on is null or a.completed_on='') and\n                      ((c.reminder_date is not null and c.reminder_date<>'0000-00-00' and c.reminder_date<=now()) or (a.due_on is not null and a.due_on<=now()) )\n                       order by b.user_id, IFNULL(a.priority, '0') desc, old_date";
     } elseif ($tickets_due_flag == 'all') {
         $query = "SELECT a.id, a.type, b.user_id\n                      FROM healingcrystals_project_objects a\n                      inner join healingcrystals_assignments b on a.id=b.object_id\n                      left outer join healingcrystals_project_object_misc c on (a.id=c.object_id)\n                      where a.state='" . STATE_VISIBLE . "' and b.user_id='" . $user_id . "' and b.is_owner='1' and\n                      (a.type='Task' or a.type='Ticket') and (a.completed_on is null or a.completed_on='') and\n                      a.due_on is not null\n                      order by b.user_id, IFNULL(a.priority, '0') desc";
     }
     if (!empty($query)) {
         $result = mysql_query($query, $link);
         $tickets_due_info = array();
         if (mysql_num_rows($result)) {
             while ($entry = mysql_fetch_assoc($result)) {
                 $tickets_due_info[] = array('type' => $entry['type'], 'id' => $entry['id'], 'reminder' => $entry['reminder_date']);
             }
         }
     }
     $query = "(select b.id, d.id as parent_ref , a.date_added as date_value, e.priority as prio, c.name as project_name\n\t\t from healingcrystals_assignments_action_request a\n\t\t inner join healingcrystals_project_objects b on a.comment_id=b.id\n\t\t inner join healingcrystals_project_objects d on b.parent_id=d.id\n\t\t left outer join healingcrystals_project_objects e on d.milestone_id=e.id\n\t\t inner join healingcrystals_projects c on b.project_id=c.id\n\t\t where b.state='" . STATE_VISIBLE . "' and a.user_id='" . $user_id . "' and a.is_action_request='1'\n                 and d.state='" . STATE_VISIBLE . "'  )\n                 union\n                 (select '' as id, a.object_id as parent_ref, b.created_on as date_value, e.priority as prio, c.name as project_name\n                 from healingcrystals_assignments_flag_fyi_actionrequest a\n                 inner join healingcrystals_project_objects b on a.object_id=b.id\n                 left outer join healingcrystals_project_objects e on b.milestone_id=e.id\n                 inner join healingcrystals_projects c on b.project_id=c.id\n                 where a.user_id='" . $user_id . "' and flag_actionrequest='1' and b.state='" . STATE_VISIBLE . "'\n                  )\n\t\t order by prio desc, project_name, date_value desc";
     //EOF:mod 20111103 #462
     $result = mysql_query($query, $link);
     $action_request_info = array();
     if (mysql_num_rows($result)) {
         while ($entry = mysql_fetch_assoc($result)) {
             if ($layout_type == 'summary') {
                 if (!array_key_exists((string) $entry['parent_ref'], $action_request_info)) {
                     $action_request_info[(string) $entry['parent_ref']] = array();
                 }
                 $action_request_info[(string) $entry['parent_ref']][] = $entry['id'];
             } else {
                 //BOF:mod 20111019 #448
                 if (empty($entry['id'])) {
                     $action_request_info[] = $entry['parent_ref'];
                 } else {
                     //EOF:mod 20111019 #448
                     $action_request_info[] = $entry['id'];
                     //BOF:mod 20111019
                 }
                 //EOF:Mod 20111019
             }
         }
     }
     $query = "(select b.id, d.id as parent_ref , a.date_added as date_value, e.priority as prio, c.name as project_name\n\t\t from healingcrystals_assignments_action_request a\n\t\t inner join healingcrystals_project_objects b on a.comment_id=b.id\n\t\t inner join healingcrystals_project_objects d on b.parent_id=d.id\n\t\t left outer join healingcrystals_project_objects e on d.milestone_id=e.id\n\t\t inner join healingcrystals_projects c on b.project_id=c.id\n\t\t where b.state='" . STATE_VISIBLE . "' and a.user_id='" . $user_id . "' and a.is_fyi='1'\n                 and d.state='" . STATE_VISIBLE . "' )\n                 union\n                 (select '' as id, a.object_id as parent_ref, b.created_on as date_value, e.priority as prio, c.name as project_name\n                 from healingcrystals_assignments_flag_fyi_actionrequest a\n                 inner join healingcrystals_project_objects b on a.object_id=b.id\n                 left outer join healingcrystals_project_objects e on b.milestone_id=e.id\n                 inner join healingcrystals_projects c on b.project_id=c.id\n                 where a.user_id='" . $user_id . "' and flag_fyi='1' and b.state='" . STATE_VISIBLE . "'\n                  )\n\t\t order by prio desc, project_name, date_value desc";
     //EOF:mod 20111103 #462
     $result = mysql_query($query, $link);
     $info = array();
     if (mysql_num_rows($result)) {
         while ($entry = mysql_fetch_assoc($result)) {
             if ($layout_type == 'summary') {
                 if (!array_key_exists((string) $entry['parent_ref'], $info)) {
                     $info[(string) $entry['parent_ref']] = array();
                 }
                 $info[(string) $entry['parent_ref']][] = $entry['id'];
             } else {
                 //BOF:mod 20111019 #448
                 if (empty($entry['id'])) {
                     $info[] = $entry['parent_ref'];
                 } else {
                     //EOF:mod 20111019 #448
                     $info[] = $entry['id'];
                     //BOF:mod 20111019
                 }
                 //EOF:Mod 20111019
             }
         }
     }
     $search_from = time() - 24 * 60 * 60;
     $query = "SELECT a.id, b.user_id FROM healingcrystals_project_objects a\n                 inner join healingcrystals_assignments b on a.id=b.object_id\n\t\t where a.state='" . STATE_VISIBLE . "' and b.user_id='" . $user_id . "' and a.type='Ticket' and a.completed_on is not null and\n\t\t a.completed_on >= '" . date('Y-m-d H:i', $search_from) . "' order by b.user_id, a.due_on";
     $result = mysql_query($query, $link);
     $completed_objects = array();
     if (mysql_num_rows($result)) {
         while ($entry = mysql_fetch_assoc($result)) {
             $query02 = "select max(id) as comment_id from healingcrystals_project_objects where parent_id='" . $entry['id'] . "' and parent_type='Ticket' and type='Comment'";
             $result02 = mysql_query($query02);
             if (mysql_num_rows($result02)) {
                 $comment_info = mysql_fetch_assoc($result02);
             }
             $completed_objects[] = array('ticket_id' => $entry['id'], 'last_comment_id' => $comment_info['comment_id']);
         }
     }
     $fyi_updates = array();
     $query = "select id, fyi_user_id, object_id from healingcrystals_project_objects_to_fyi_users where fyi_user_id='" . $user_id . "' and user_intimated_on is null";
     $result = mysql_query($query);
     if (mysql_num_rows($result)) {
         while ($entry = mysql_fetch_assoc($result)) {
             $fyi_updates[] = $entry['object_id'];
         }
     }
     $fyi_table_start = '
             <a name="fyi"></a>
             <table style="border:1px solid black;">
                 <tr>
                     <td colspan="4">&nbsp;</td>
                 </tr>' . (count($info) ? '
                 <tr>
                     <th colspan="4">FYI Comment(s)</th>
                 </tr>
                 <tr>
                     <td colspan="4">&nbsp;</td>
                 </tr>' : '');
     $fyi_table_end = '
             </table>';
     $action_request_table_start = '
             <a name="action_request"></a>
             <table style="border:1px solid black;">
                 <tr>
                     <td colspan="4">&nbsp;</td>
                 </tr>' . (count($action_request_info) ? '
                 <tr>
                     <th colspan="4">Action Request Comment(s)</th>
                 </tr>
                 <tr>
                     <td colspan="4">&nbsp;</td>
                 </tr>' : '');
     $action_request_table_end = '
             </table>';
     $completed_objects_table_start = '
             <a name="closed_tickets"></a>
             <table style="border:1px solid black;">
                 <tr>
                     <td colspan="2">&nbsp;</td>
                 </tr>' . (count($completed_objects) ? '
                 <tr>
                     <th colspan="2">Recently Closed Tickets</th>
                 </tr>
                 <tr>
                     <td colspan="2">&nbsp;</td>
                 </tr>' : '');
     $completed_objects_table_end = '
             </table>';
     $fyi_updates_table_start = '
             <table style="border:1px solid black;">
                 <tr>
                     <td colspan="2">&nbsp;</td>
                 </tr>' . (count($fyi_updates) ? '
                 <tr>
                     <th colspan="2">FYI Updates</th>
                 </tr>
                 <tr>
                     <td colspan="2">&nbsp;</td>
                 </tr>' : '');
     $fyi_updates_table_end = '
             </table>';
     $tickets_due_table_start = '
             <a name="tickets_due"></a>
             <table style="border:1px solid black;">
                 <tr><td colspan="4">&nbsp;</td></tr>
                 <tr>
                     <th colspan="4">
                         Due Tickets & Tasks:
                         <div style="float:right;font-weight:normal;">
                             <table cellspacing="0" cellpadding="0">
                                 <tr>
                                     <td valign="middle">
                                         <input type="radio" onclick="location.href=\'' . assemble_url('goto_home_tab') . '&due_flag=due\'" name="objects_due" value="due" style="width:20px;" ' . ($tickets_due_flag == 'due' ? ' checked="true"' : '') . ' />
                                     </td>
                                     <td valign="middle">Show Due Dates/Reminders</td>
                                     <td valign="middle">&nbsp;&nbsp;&nbsp;</td>
                                     <td valign="middle">
                                         <input type="radio" onclick="location.href=\'' . assemble_url('goto_home_tab') . '&due_flag=all\'" name="objects_due" value="all" style="width:20px;" ' . ($tickets_due_flag == 'all' ? ' checked="true"' : '') . ' />
                                     </td>
                                     <td valign="middle">Show All Tickets & Tasks</td>
                                 </tr>
                             </table>
                         </div>
                     </th>
                 </tr>
                 <tr><td colspan="4">&nbsp;</td></tr>
                 <tr>
                     <th align="left">Type</th>
                     <th align="left">Name</th>
                     <th align="left">Priority</th>
                     <th align="left">' . ($tickets_due_flag == 'due' ? 'Due on / Reminder' : 'Due on') . '</th>
                 </tr>';
     $tickets_due_table_end = '
             </table>';
     $tickets_due_content = '';
     if ($tickets_due_info && is_array($tickets_due_info)) {
         foreach ($tickets_due_info as $entry) {
             $type = $entry['type'];
             $obj = new $type($entry['id']);
             $due_date_val = $obj->getDueOn();
             if (!empty($due_date_val)) {
                 $due_date = date('F d, Y', strtotime($obj->getDueOn()));
             } else {
                 $due_date = '--';
             }
             if (!empty($entry['reminder']) && $entry['reminder'] != '0000-00-00') {
                 $reminder_date = date('F d, Y', strtotime($entry['reminder']));
             } else {
                 $reminder_date = '--';
             }
             if ($tickets_due_flag == 'due') {
                 $date_string = $due_date . ' / ' . $reminder_date;
             } else {
                 $date_string = $due_date;
             }
             $tickets_due_content .= '
                 <tr>
                     <td>' . $type . '</td>
                     <td>
                         <a target="_blank" href="' . $obj->getViewUrl() . '">
                             <span class="homepageobject">' . strip_tags($obj->getName()) . '</span>
                         </a>
                     </td>
                     <td>' . $obj->getFormattedPriority() . '</td>
                     <td> ' . $date_string . '</td>
                 </tr>';
             unset($obj);
         }
     } else {
         $tickets_due_content .= '
             <tr>
                 <td colspan="4">No Records to Display</td>
             </tr>';
     }
     $fyi_comments_unvisited = 0;
     $content = '';
     if ($info && is_array($info)) {
         if ($layout_type == 'summary') {
             foreach ($info as $ticket_id => $comments) {
                 //BOF:mod 20111019 #448
                 if (!empty($comments[0])) {
                     //EOF:mod 20111019 #448
                     $temp_obj = new Comment($comments[0]);
                     $parenttype = $temp_obj->getParentType();
                     //BOF:mod 20111019 #448
                 } else {
                     $temp_obj = new ProjectObject($ticket_id);
                     $parenttype = $temp_obj->getType();
                 }
                 //EOF:mod 20111019 #448
                 $parentobj = new $parenttype($ticket_id);
                 $comment_links = '';
                 //$comment_info = '';
                 $count = 0;
                 //$max_chars = 1000;
                 foreach ($comments as $comment_id) {
                     $count++;
                     //BOF:mod 20111019 #448
                     if (!empty($comment_id)) {
                         //EOF:mod 20111019 #448
                         $temp_obj = new Comment($comment_id);
                         $is_unvisited = $this->link_unvisited($temp_obj->getId());
                         if ($is_unvisited) {
                             $fyi_comments_unvisited++;
                         }
                         $comment_links .= '<a target="_blank" href="' . $temp_obj->getViewUrl() . '" class="anc01' . (!$is_unvisited ? '_visited' : '') . '">#' . $count . '</a>&nbsp;&nbsp;&nbsp;';
                         //BOF:mod 20111019 #448
                     } else {
                         $is_unvisited = $this->link_unvisited($temp_obj->getId());
                         if ($is_unvisited) {
                             $fyi_comments_unvisited++;
                         }
                         $comment_links .= '<a target="_blank" href="' . $parentobj->getViewUrl() . '" class="anc01' . (!$is_unvisited ? '_visited' : '') . '">#' . $count . '</a>&nbsp;&nbsp;&nbsp;';
                     }
                     //EOF:mod 20111019 #448
                 }
                 $content .= '
                     <tr>
                         <td vlaign="top" class="comment_link" colspan="4">
                             &nbsp;&nbsp;&nbsp;
                             <a target="_blank" href="' . $parentobj->getViewUrl() . '">
                                <span class="homepageobject">' . $parentobj->getName() . '</span>
                             </a>
                             &nbsp;&nbsp;&nbsp;' . $comment_links . '<span id="fyi_' . $parentobj->getId() . '"><img id="icon_plus" src="' . ROOT_URL . '/assets/images/icons/icon_plus.png" hspace="0" vspace="0" border="0" style="cursor:pointer;" /></span>
                         </td>
                     </tr>';
             }
         } else {
             foreach ($info as $comment_id) {
                 //BOF:mod 20111019 #448
                 $temp_obj = new ProjectObject($comment_id);
                 $temp_type = $temp_obj->getType();
                 if ($temp_type == 'Comment') {
                     //EOF:mod 20111019 #448
                     $obj = new Comment($comment_id);
                     //BOF:mod 20111019 #448
                     $is_comment_obj = true;
                 } else {
                     $obj = new $temp_type($comment_id);
                     $is_comment_obj = false;
                 }
                 //EOF:mod 20111019 #448
                 $is_unvisited = $this->link_unvisited($obj->getId());
                 if ($is_unvisited) {
                     $fyi_comments_unvisited++;
                 }
                 $created_by_id = $obj->getCreatedById();
                 $created_by_user = new User($created_by_id);
                 $created_on = strtotime($obj->getCreatedOn());
                 $created_on = date('m-d-y', $created_on);
                 $projectobj = new Project($obj->getProjectId());
                 $parenttype = $obj->getParentType();
                 //BOF:mod 20111019 #448
                 if ($is_comment_obj) {
                     //EOF:mod 20111019 #448
                     $parentobj = new $parenttype($obj->getParentId());
                     //BOF:mod 20111019 #448
                 } else {
                     $parentobj = $obj;
                 }
                 //EOF:mod 20111019 #448
                 $milestone_id = $parentobj->getMilestoneId();
                 if (!empty($milestone_id)) {
                     $milestoneobj = new Milestone($milestone_id);
                 }
                 $assigneesstring = '';
                 list($assignees, $owner_id) = $parentobj->getAssignmentData();
                 foreach ($assignees as $assignee) {
                     $assigneeobj = new User($assignee);
                     $assigneesstring .= '<a target="_blank" href="' . $assigneeobj->getViewUrl() . '">' . $assigneeobj->getName() . '</a>, ';
                     unset($assigneeobj);
                 }
                 if (!empty($assigneesstring)) {
                     $assigneesstring = substr($assigneesstring, 0, -2);
                 }
                 $dueon = date('F d, Y', strtotime($parentobj->getDueOn()));
                 if ($dueon == 'January 01, 1970') {
                     $dueon = '--';
                 }
                 if ($milestoneobj) {
                     $priority = $milestoneobj->getPriority();
                     if (!empty($priority) || $priority == '0') {
                         $priority = $milestoneobj->getFormattedPriority();
                     } else {
                         $priority = '--';
                     }
                 } else {
                     $priority = '--';
                 }
                 $max_chars = 1000;
                 $temp = $obj->getFormattedBody(true, true);
                 $comment_body = $temp;
                 $content .= '
                     <tr>
                         <td valign="top" width="150">Ticket</td>
                         <td valign="top">
                             <a target="_blank" href="' . $parentobj->getViewUrl() . '">' . $parentobj->getName() . '</a>
                         </td>
                     </tr>
                     <tr>
                         <td valign="top">Team &raquo; Project</td>
                         <td valign="top">
                             <a target="_blank" href="' . $projectobj->getOverviewUrl() . '">' . $projectobj->getName() . '</a> &raquo; ' . ($milestoneobj ? '<a target="_blank" href="' . $milestoneobj->getViewUrl() . '">' . $milestoneobj->getName() . '</a>' : '--') . '</td>
                     </tr>
                     <tr>
                         <td valign="top">Project Priority</td>
                         <td valign="top">' . $priority . '</td>
                     </tr>
                     <tr>
                         <td valign="top">Due on</td>
                         <td valign="top">' . $dueon . '</td>
                     </tr>' . (!empty($assigneesstring) ? '<tr>
                         <td valign="top">Assignees</td>
                         <td valign="top">' . $assigneesstring . '</td>
                     </tr>' : '<tr><td colpan="2"></td></tr>') . '<tr>
                         <td valign="top">' . ($is_comment_obj ? 'Comment' : 'Created') . ' by<br/>' . $created_by_user->getName() . '<br/><br/><br/><a target="_blank" href="' . $obj->getViewUrl() . '" class="anc02' . (!$is_unvisited ? '_visited' : '') . '">[view ' . ($is_comment_obj ? 'comment' : 'object') . ']</a><br/>' . $created_on . '<br/><br/><br/><a class="mark_as_read" href="' . ($is_comment_obj ? assemble_url('project_comment_fyi_read', array('project_id' => $obj->getProjectId(), 'comment_id' => $obj->getId())) : assemble_url('project_object_fyi_read', array('project_id' => $obj->getProjectId())) . '&object_id=' . $obj->getId() . '&project_id=' . $obj->getProjectId()) . '">Mark this Notification<br/>as Read</a></td>
                         <td valign="top" style="max-width:500px;"><div style="overflow:auto;">' . $obj->getBody() . '</div></td>
                     </tr>
                     <tr><td colspan="2" style="border-bottom:1px dotted #000000;">&nbsp;</td></tr>
                     <tr><td colspan="2">&nbsp;</td></tr>';
             }
         }
         unset($obj);
         unset($projectobj);
         unset($parentobj);
         unset($milestone_id);
         unset($milestoneobj);
         unset($assignees);
         unset($owner_id);
     }
     $action_request_content = '';
     $action_request_comments_unvisited = 0;
     if ($action_request_info && is_array($action_request_info)) {
         if ($layout_type == 'summary') {
             foreach ($action_request_info as $ticket_id => $comments) {
                 //BOF:mod 20111019 #448
                 if (!empty($comments[0])) {
                     //EOF:mod 20111019 #448
                     $temp_obj = new Comment($comments[0]);
                     $parenttype = $temp_obj->getParentType();
                     //BOF:mod 20111019 #448
                 } else {
                     $temp_obj = new ProjectObject($ticket_id);
                     $parenttype = $temp_obj->getType();
                 }
                 //EOF:mod 20111019 #448
                 $parentobj = new $parenttype($ticket_id);
                 $comment_links = '';
                 //$comment_info = '';
                 $count = 0;
                 //$max_chars = 1000;
                 foreach ($comments as $comment_id) {
                     $count++;
                     //BOF:mod 20111019 #448
                     if (!empty($comment_id)) {
                         //EOF:mod 20111019 #448
                         $temp_obj = new Comment($comment_id);
                         $is_unvisited = $this->link_unvisited($temp_obj->getId());
                         if ($is_unvisited) {
                             $action_request_comments_unvisited++;
                         }
                         $comment_links .= '<a target="_blank" href="' . $temp_obj->getViewUrl() . '" class="anc01' . (!$is_unvisited ? '_visited' : '') . '">#' . $count . '</a>&nbsp;&nbsp;&nbsp;';
                         //BOF:mod 20111019 #448
                     } else {
                         $is_unvisited = $this->link_unvisited($temp_obj->getId());
                         if ($is_unvisited) {
                             $action_request_comments_unvisited++;
                         }
                         $comment_links .= '<a target="_blank" href="' . $parentobj->getViewUrl() . '" class="anc01' . (!$is_unvisited ? '_visited' : '') . '">#' . $count . '</a>&nbsp;&nbsp;&nbsp;';
                     }
                     //EOF:mod 20111019 #448
                 }
                 $action_request_content .= '
                     <tr>
                         <td vlaign="top" class="comment_link" colspan="4">
                             &nbsp;&nbsp;&nbsp;
                             <a target="_blank" href="' . $parentobj->getViewUrl() . '">
                                 <span class="homepageobject">' . $parentobj->getName() . '</span>
                             </a>
                             &nbsp;&nbsp;&nbsp;' . $comment_links . '<span id="action_' . $parentobj->getId() . '"><img id="icon_plus" src="' . ROOT_URL . '/assets/images/icons/icon_plus.png" hspace="0" vspace="0" border="0" style="cursor:pointer;" /></span>
                         </td>
                     </tr>';
             }
         } else {
             foreach ($action_request_info as $comment) {
                 //BOF:mod 20111019 #448
                 $temp_obj = new ProjectObject($comment);
                 $temp_type = $temp_obj->getType();
                 if ($temp_type == 'Comment') {
                     //EOF:mod 20111019 #448
                     $obj = new Comment($comment);
                     //BOF:mod 20111019 #448
                     $is_comment_obj = true;
                 } else {
                     $obj = new $temp_type($comment);
                     $is_comment_obj = false;
                 }
                 //EOF:mod 20111019 #448
                 $is_unvisited = $this->link_unvisited($obj->getId());
                 if ($is_unvisited) {
                     $action_request_comments_unvisited++;
                 }
                 $created_by_id = $obj->getCreatedById();
                 $created_by_user = new User($created_by_id);
                 $created_on = strtotime($obj->getCreatedOn());
                 $created_on = date('m-d-y', $created_on);
                 $projectobj = new Project($obj->getProjectId());
                 $parenttype = $obj->getParentType();
                 //BOF:mod 20111019 #448
                 if ($is_comment_obj) {
                     //EOF:mod 20111019 #448
                     $parentobj = new $parenttype($obj->getParentId());
                     //BOF:mod 20111019 #448
                 } else {
                     $parentobj = $obj;
                 }
                 //EOF:mod 20111019 #448
                 $milestone_id = $parentobj->getMilestoneId();
                 if (!empty($milestone_id)) {
                     $milestoneobj = new Milestone($milestone_id);
                 }
                 $assigneesstring = '';
                 list($assignees, $owner_id) = $parentobj->getAssignmentData();
                 foreach ($assignees as $assignee) {
                     $assigneeobj = new User($assignee);
                     $assigneesstring .= '<a target="_blank" href="' . $assigneeobj->getViewUrl() . '">' . $assigneeobj->getName() . '</a>, ';
                     unset($assigneeobj);
                 }
                 if (!empty($assigneesstring)) {
                     $assigneesstring = substr($assigneesstring, 0, -2);
                 }
                 $dueon = date('F d, Y', strtotime($parentobj->getDueOn()));
                 if ($dueon == 'January 01, 1970') {
                     $dueon = '--';
                 }
                 if ($milestoneobj) {
                     $priority = $milestoneobj->getPriority();
                     if (!empty($priority) || $priority == '0') {
                         $priority = $milestoneobj->getFormattedPriority();
                     } else {
                         $priority = '--';
                     }
                 } else {
                     $priority = '--';
                 }
                 $max_chars = 1000;
                 $temp = $obj->getFormattedBody(true, true);
                 $comment_body = $temp;
                 /*$comment_body = trim(str_excerpt(smarty_modifier_html_excerpt($temp), $max_chars));
                   if (strlen($temp)>$max_chars){
                       $show_read_link = true;
                   } else {
                       $show_read_link = false;
                   }*/
                 $action_request_content .= '
                     <tr>
                         <td valign="top" width="150">Ticket</td>
                         <td valign="top">
                             <a target="_blank" href="' . $parentobj->getViewUrl() . '">' . $parentobj->getName() . '</a>
                         </td>
                     </tr>
                     <tr>
                         <td valign="top">Team &raquo; Project</td>
                         <td valign="top"><a target="_blank" href="' . $projectobj->getOverviewUrl() . '">' . $projectobj->getName() . '</a> &raquo; ' . ($milestoneobj ? '<a target="_blank" href="' . $milestoneobj->getViewUrl() . '">' . $milestoneobj->getName() . '</a>' : '--') . '</td>
                     </tr>
                     <tr>
                         <td valign="top">Project Priority</td>
                         <td valign="top">' . $priority . '</td>
                     </tr>
                     <tr>
                         <td valign="top">Due on</td>
                         <td valign="top">' . $dueon . '</td>
                     </tr>' . (!empty($assigneesstring) ? '<tr>
                         <td valign="top">Assignees</td>
                         <td valign="top">' . $assigneesstring . '</td>
                     </tr>' : '<tr><td colspan="2"></td></tr>') . '<tr>
                         <td valign="top">' . ($is_comment_obj ? 'Comment' : 'Created') . ' by<br/>' . $created_by_user->getName() . '<br/><br/><br/><a target="_blank" href="' . $obj->getViewUrl() . '" class="anc02' . (!$is_unvisited ? '_visited' : '') . '">[view ' . ($is_comment_obj ? 'comment' : 'object') . ']</a><br/>' . $created_on . '<br/><br/><br/><a class="mark_as_complete" href="' . ($is_comment_obj ? assemble_url('project_comment_action_request_completed', array('project_id' => $obj->getProjectId(), 'comment_id' => $obj->getId())) : assemble_url('project_object_action_request_completed', array('project_id' => $obj->getProjectId())) . '&object_id=' . $obj->getId() . '&project_id=' . $obj->getProjectId()) . '">Mark Action Request Complete</a></td>
                         <td valign="top" style="max-width:500px;"><div style="overflow:auto;">' . $obj->getBody() . '</div></td>
                     </tr>
                     <tr><td colspan="2" style="border-bottom:1px dotted #000000;">&nbsp;</td></tr>
                     <tr><td colspan="2">&nbsp;</td></tr>';
             }
         }
         unset($obj);
         unset($projectobj);
         unset($parentobj);
         unset($milestone_id);
         unset($milestoneobj);
         unset($assignees);
         unset($owner_id);
     }
     $completed_objects_content = '';
     if ($completed_objects && is_array($completed_objects)) {
         foreach ($completed_objects[(string) $userid] as $entry) {
             $obj = new Ticket($entry['ticket_id']);
             $projectobj = new Project($obj->getProjectId());
             $milestone_id = $obj->getMilestoneId();
             if (!empty($milestone_id)) {
                 $milestoneobj = new Milestone($milestone_id);
             }
             $assigneesstring = '';
             list($assignees, $owner_id) = $obj->getAssignmentData();
             foreach ($assignees as $assignee) {
                 $assigneeobj = new User($assignee);
                 $assigneesstring .= '<a target="_blank" href="' . $assigneeobj->getViewUrl() . '">' . $assigneeobj->getName() . '</a>, ';
                 unset($assigneeobj);
             }
             if (!empty($assigneesstring)) {
                 $assigneesstring = substr($assigneesstring, 0, -2);
             }
             $completedon = date('F d, Y', strtotime($obj->getCompletedOn()));
             if (!empty($entry['last_comment_id'])) {
                 $commentobj = new Comment($entry['last_comment_id']);
                 $last_comment_body = '<br>' . $commentobj->getBody();
                 unset($commentobj);
             } else {
                 $last_comment_body = '<br>None';
             }
             $completed_objects_content .= '
                 <tr>
                     <td valign="top" width="150">' . $obj->getType() . '</td>
                     <td valign="top"><a target="_blank" href="' . $obj->getViewUrl() . '"><span class="homepageobject">' . $obj->getName() . '</span></a></td>
                 </tr>
                 <tr>
                     <td valign="top">Team &raquo; Project</td>
                     <td valign="top"><a target="_blank" href="' . $projectobj->getOverviewUrl() . '"><span class="homepageobject">' . $projectobj->getName() . '</span></a> &raquo; ' . ($milestoneobj ? '<a target="_blank" href="' . $milestoneobj->getViewUrl() . '"><span class="homepageobject">' . $milestoneobj->getName() . '</span></a>' : '--') . '</td>
                 </tr>
                 <tr>
                     <td valign="top">Completed on</td>
                     <td valign="top">' . $completedon . '</td>
                 </tr>' . (!empty($assigneesstring) ? '<tr>
                     <td valign="top">Assignees</td>
                     <td valign="top">' . $assigneesstring . '</td>
                 </tr>' : '') . '<tr>
                     <td valign="top">&nbsp;</td>
                     <td valign="top" style="max-width:500px;"><div style="overflow:auto;">' . $obj->getBody() . '</div></td>
                 </tr>
                 <tr><td colspan="2">&nbsp;</td></tr>
                 <tr>
                     <td valign="top">&nbsp;</td>
                     <td valign="top"><b>Last comment associated with the ticket:</b><br>' . $last_comment_body . '</td>
                 </tr>
                 <tr><td colspan="2" style="border-bottom:1px dotted #000000;">&nbsp;</td></tr>
                 <tr><td colspan="2">&nbsp;</td></tr>';
             unset($obj);
             unset($projectobj);
             unset($milestone_id);
             unset($milestoneobj);
             unset($assignees);
             unset($owner_id);
         }
     }
     $fyi_updates_content = '';
     if ($fyi_updates && is_array($fyi_updates)) {
         foreach ($fyi_updates[(string) $userid] as $object_id) {
             $baseobj = new ProjectObject($object_id);
             $type = $baseobj->getType();
             switch ($baseobj->getType()) {
                 case 'Page':
                     $obj = new Page($object_id);
                     break;
             }
             if ($obj) {
                 $projectobj = new Project($obj->getProjectId());
                 $milestone_id = $obj->getMilestoneId();
                 if (!empty($milestone_id)) {
                     $milestoneobj = new Milestone($milestone_id);
                 }
                 $subscribers = $obj->getSubscribers();
                 foreach ($subscribers as $subscriber) {
                     $subscriberstring .= '<a target="_blank" href="' . $subscriber->getViewUrl() . '">' . $subscriber->getName() . '</a>, ';
                 }
                 if (!empty($subscriberstring)) {
                     $subscriberstring = substr($subscriberstring, 0, -2);
                 }
                 $fyi_updates_content .= '
             <tr>
                 <td valign="top" width="150">' . $obj->getType() . '</td>
                 <td valign="top"><a target="_blank" href="' . $obj->getViewUrl() . '"><span class="homepageobject">' . $obj->getName() . '</span></a></td>
             </tr>
             <tr>
                 <td valign="top">Team &raquo; Project</td>
                 <td valign="top"><a target="_blank" href="' . $projectobj->getOverviewUrl() . '"><span class="homepageobject">' . $projectobj->getName() . '</span></a> &raquo; ' . ($milestoneobj ? '<a target="_blank" href="' . $milestoneobj->getViewUrl() . '"><span class="homepageobject">' . $milestoneobj->getName() . '</span></a>' : '--') . '</td>
             </tr>' . (!empty($subscriberstring) ? '<tr>
                 <td valign="top">Subscribers</td>
                 <td valign="top">' . $subscriberstring . '</td>
             </tr>' : '') . '<tr>
                 <td valign="top">&nbsp;</td>
                 <td valign="top" style="max-width:500px;"><div style="overflow:auto;">' . $obj->getBody() . '</div></td>
             </tr>
             <tr><td colspan="2" style="border-bottom:1px dotted #000000;">&nbsp;</td></tr>
             <tr><td colspan="2">&nbsp;</td></tr>';
             }
             unset($obj);
             unset($projectobj);
             unset($milestoneobj);
         }
     }
     $home_tab_content = '';
     if (!empty($tickets_due_content)) {
         $home_tab_content .= $tickets_due_table_start . $tickets_due_content . $tickets_due_table_end . '<br/><br/>';
         $goto_links .= '<a href="#tickets_due">Go to Due Tickets & Tasks</a><br/>';
     }
     if (!empty($action_request_content)) {
         $home_tab_content .= $action_request_table_start . $action_request_content . $action_request_table_end . '<br/><br/>';
         $goto_links .= '<a href="#action_request">Go to Action Request Comment(s)</a><br/>';
     }
     if (!empty($content)) {
         $home_tab_content .= $fyi_table_start . $content . $fyi_table_end . '<br/><br/>';
         $goto_links .= '<a href="#fyi">Go to FYI Comment(s)</a><br/>';
     }
     if (!empty($fyi_updates_content)) {
         $home_tab_content .= $fyi_updates_table_start . $fyi_updates_content . $fyi_updates_table_end . '<br/><br/>';
     }
     if (!empty($completed_objects_content)) {
         $home_tab_content .= $completed_objects_table_start . $completed_objects_content . $completed_objects_table_end;
         $goto_links .= '<a href="#closed_tickets">Go to Closed Ticket(s)</a><br/>';
     }
     if (!empty($goto_links)) {
         $goto_links .= '<br/><br/>';
     }
     $goto_links .= '<input type="hidden" id="unvisited_fyi_comments" value="' . $fyi_comments_unvisited . '" />
                    <input type="hidden" id="unvisited_action_request_comments" value="' . $action_request_comments_unvisited . '" />
                    <input type="hidden" id="user_id" value="' . $user_id . '" />';
     $css = '
             <style>
                 td a.anc01_visited, td a.anc02_visited {color:#FF00FF;}
                 body {}
                 span.homepageobject {}
                 table tr {line-height:1.5;}:
             </style>';
     $home_tab_content = $css . $top_message . '<br/><br/>' . $goto_links . $home_tab_content;
     mysql_close($link);
     return $home_tab_content;
 }
 public function testMultiLeafExpansion()
 {
     $objMilestone = Milestone::QuerySingle(QQ::Equal(QQN::Milestone()->Id, 1), QQ::Clause(QQ::ExpandAsArray(QQN::Milestone()->Project->ManagerPerson->ProjectAsTeamMember), QQ::ExpandAsArray(QQN::Milestone()->Project->PersonAsTeamMember)));
     $objProjectArray = $objMilestone->Project->ManagerPerson->_ProjectAsTeamMemberArray;
     $objPeopleArray = $objMilestone->Project->_PersonAsTeamMemberArray;
     $this->assertTrue(is_array($objProjectArray), "_ProjectAsTeamMemberArray is an array");
     $this->assertEqual(count($objProjectArray), 2, "_ProjectAsTeamMemberArray has 2 Project objects");
     $this->assertTrue(is_array($objPeopleArray), "_PersonAsTeamMemberArray is an array");
     $this->assertEqual(count($objPeopleArray), 5, "_PersonAsTeamMemberArray has 5 People objects");
     // try through a unique relationship
     $objLogin = Login::QuerySingle(QQ::Equal(QQN::Login()->PersonId, 7), QQ::Clause(QQ::ExpandAsArray(QQN::Login()->Person->ProjectAsTeamMember), QQ::ExpandAsArray(QQN::Login()->Person->ProjectAsManager)));
     $objProjectArray = $objLogin->Person->_ProjectAsTeamMemberArray;
     $this->assertTrue(is_array($objProjectArray), "_ProjectAsTeamMemberArray is an array");
     $this->assertEqual(count($objProjectArray), 2, "_ProjectAsTeamMemberArray has 2 Project objects");
     $objProjectArray = $objLogin->Person->_ProjectAsManagerArray;
     $this->assertTrue(is_array($objProjectArray), "_ProjectAsManagerArray is an array");
     $this->assertEqual(count($objProjectArray), 2, "_ProjectAsManagerArray has 2 Project objects");
 }
 /**
  * Save milestone record to the database
  *
  * @return boolean
  */
 function save()
 {
     // hack
     DB::beginWork('Saving Milestone @ ' . __CLASS__);
     // 		if($this->isNew()){
     DB::execute('UPDATE ' . TABLE_PREFIX . 'object_contexts SET parent_type = ? WHERE parent_id = ?', 'RemediaMilestone', $this->getId());
     // 		}
     $result = parent::save();
     // hack
     DB::execute('UPDATE ' . TABLE_PREFIX . 'object_contexts SET parent_type = ? WHERE parent_id = ?', 'Milestone', $this->getId());
     DB::execute('UPDATE ' . TABLE_PREFIX . 'project_objects SET type = ? WHERE type = ?', 'Milestone', 'RemediaMilestone');
     DB::execute('UPDATE ' . TABLE_PREFIX . 'modification_logs SET parent_type = ? WHERE parent_type = ?', 'Milestone', 'RemediaMilestone');
     DB::execute('UPDATE ' . TABLE_PREFIX . 'activity_logs SET subject_type = ? WHERE subject_type = ?', 'Milestone', 'RemediaMilestone');
     DB::execute('UPDATE ' . TABLE_PREFIX . 'activity_logs SET action = ? WHERE action = ?', 'milestone/created', 'remedia_milestone/created');
     // DB::execute('DELETE FROM ' . TABLE_PREFIX . 'subscriptions WHERE parent_type = \'RemediaMilestone\' AND parent_id IN (SELECT parent_id FROM ' . TABLE_PREFIX . 'subscriptions WHERE parent_type = \'Milestone\')');
     // DB::execute('UPDATE ' . TABLE_PREFIX . 'subscriptions SET parent_type = ? WHERE parent_type = ?', 'Milestone', 'RemediaMilestone');
     DB::commit('Milestone saved @ ' . __CLASS__);
     return $result;
 }
 /**
  * Reschedule selected milestone
  *
  * @param void
  * @return null
  */
 function reschedule()
 {
     if ($this->active_milestone->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if (!$this->active_milestone->canEdit($this->logged_user)) {
         $this->httpError($this->logged_user);
     }
     // if
     $milestone_data = $this->request->post('milestone');
     if (!is_array($milestone_data)) {
         $milestone_data = array('start_on' => $this->active_milestone->getStartOn(), 'due_on' => $this->active_milestone->getDueOn(), 'reschedule_milstone_objects' => false);
     }
     // if
     $this->smarty->assign('milestone_data', $milestone_data);
     if ($this->request->isSubmitted()) {
         db_begin_work();
         $old_due_on = new DateValue($this->active_milestone->getDueOn());
         $new_start_on = new DateValue(array_var($milestone_data, 'start_on'));
         $new_due_on = new DateValue(array_var($milestone_data, 'due_on'));
         $reschedule_tasks = (bool) array_var($milestone_data, 'reschedule_milstone_objects');
         $successive_milestones = Milestones::findSuccessiveByMilestone($this->active_milestone, STATE_VISIBLE, $this->logged_user->getVisibility());
         // before we update timestamp
         $reschedule = $this->active_milestone->reschedule($new_start_on, $new_due_on, $reschedule_tasks);
         if ($reschedule && !is_error($reschedule)) {
             //if (instance_of($new_due_on, 'DateValue')){
             if ($new_due_on->getTimestamp() != $old_due_on->getTimestamp()) {
                 $with_successive = array_var($milestone_data, 'with_sucessive');
                 $to_move = null;
                 switch (array_var($with_successive, 'action')) {
                     case 'move_all':
                         $to_move = $successive_milestones;
                         break;
                     case 'move_selected':
                         $selected_milestones = array_var($with_successive, 'milestones');
                         if (is_foreachable($selected_milestones)) {
                             $to_move = Milestones::findByIds($selected_milestones, STATE_VISIBLE, $this->logged_user->getVisibility());
                         }
                         // if
                         break;
                 }
                 // switch
                 if (is_foreachable($to_move)) {
                     $diff = $new_due_on->getTimestamp() - $old_due_on->getTimestamp();
                     foreach ($to_move as $to_move_milestone) {
                         $milestone_start_on = $to_move_milestone->getStartOn();
                         $milestone_due_on = $to_move_milestone->getDueOn();
                         $new_milestone_start_on = $milestone_start_on->advance($diff, false);
                         $new_milestone_due_on = $milestone_due_on->advance($diff, false);
                         $to_move_milestone->reschedule($new_milestone_start_on, $new_milestone_due_on, $reschedule_tasks);
                     }
                     // foreach
                 }
                 // if
             }
             // if
             db_commit();
             if ($this->request->getFormat() == FORMAT_HTML) {
                 //flash_success('Milestone ":name" has been updated', array('name' => $this->active_milestone->getName()), false, true);
                 flash_success('Project ":name" has been updated', array('name' => $this->active_milestone->getName()), false, true);
                 $this->redirectToUrl($this->active_milestone->getViewUrl());
             } else {
                 $this->serveData($this->active_milestone);
             }
             // if
             //}
         } else {
             db_rollback();
             if ($this->request->getFormat() == FORMAT_HTML) {
                 $this->smarty->assign('errors', $reschedule);
             } else {
                 $this->serveData($save);
             }
             // if
         }
         // if
     }
     // if
 }
 public function renderPCTypeDashboard()
 {
     $ordertask =new Ordertask('search');
     $ordertask->unsetAttributes();  // clear any default values
     
     $milestone =new Milestone('search');
     $milestone->unsetAttributes();  // clear any default values
     
     $orderlistLookup = Yii::app()->controller->getOrdersLookup();
     if(!empty($orderlistLookup))
     {
         $tmp = array_keys($orderlistLookup);
         $ordertask->order_id = $tmp[0];
         $milestone->order_id = $tmp[0];
     }
     if(isset($_GET['Ordertask']))
         $ordertask->attributes=$_GET['Ordertask'];
     
     if(isset($_GET['Milestone']))
         $milestone->attributes=$_GET['Milestone'];
     
     $payinmodel =new Payment('search');
     $payinmodel->unsetAttributes();  // clear any default values
     if(isset($_GET['Payment']))
         $payinmodel->attributes=$_GET['Payment'];
     
     $totalAR = 0;
     $totalAP = 0;
     $totalCash = 0;
     $accountchart = $this->getAccountChart($totalAR, $totalAP, $totalCash);
     $mschart = $this->getMSTaskChart($milestone->order_id);
     $this->render( $this->getView('index','index'),
                     array(
                         'ordertask' => $ordertask,
                         'milestone'=>$milestone,
                         'orderlistLookup' => $orderlistLookup,
                         'accountchart' => $accountchart,
                         'mschart' => $mschart,
                         'payinmodel'=>$payinmodel,
                         'totalAR' => $totalAR,
                         'totalAP' => $totalAP,
                         'totalCash' => $totalCash,
                         )
                 );
 }
Beispiel #17
0
<?php

require 'includes/master.inc.php';
$Auth->requireAdmin();
$db = Database::getDatabase();
$Nav = 'tickets';
$ticket = new Ticket($_GET['id']);
if (!$ticket->ok()) {
    redirect('/tickets/');
}
$app = new Application($ticket->app_id);
$user = new User($ticket->created_by);
$milestone = new Milestone($ticket->milestone_id);
if (isset($_POST['btnUpdate'])) {
    $th = new TicketHistory();
    $th->dt = dater();
    $th->ticket_id = $ticket->id;
    $th->app_id = $ticket->app_id;
    $th->user_id = $Auth->id;
    $th->user_from = $ticket->assigned_to;
    $th->user_to = $_POST['assigned_to'];
    $th->status_from = $ticket->status;
    $th->status_to = $_POST['status'];
    $th->milestone_from_id = $ticket->milestone_id;
    $th->milestone_to_id = $_POST['milestone_id'];
    $th->comment = trim($_POST['comment']);
    $changed = false;
    if ($th->user_from != $th->user_to) {
        $changed = true;
    }
    if ($th->status_from != $th->status_to) {
Beispiel #18
0
 public function add_ticket()
 {
     if (!Visitor::current()->group->can("add_ticket")) {
         show_403(__("Access Denied"), __("You do not have sufficient privileges to create tickets.", "progress"));
     }
     if (empty($_POST['title'])) {
         Flash::warning(__("Please provide a summary of the ticket in the form of a title.", "progress"));
     }
     if (empty($_POST['milestone_id'])) {
         Flash::warning(__("No milestone selected.", "progress"));
     }
     $milestone = new Milestone($_POST['milestone_id']);
     if ($milestone->no_results) {
         error(__("Error"), __("Invalid milestone.", "progress"));
     }
     if (Flash::exists()) {
         redirect($milestone->url());
     }
     $ticket = Ticket::add($_POST['title'], $_POST['description'], "new", $_POST['milestone_id'], $_POST['owner_id']);
     $files = array();
     foreach ($_FILES['attachment'] as $key => $val) {
         foreach ($val as $file => $attr) {
             $files[$file][$key] = $attr;
         }
     }
     foreach ($files as $attachment) {
         if ($attachment['error'] != 4) {
             $path = upload($attachment, null, "attachments");
             Attachment::add(basename($path), $path, "ticket", $ticket->id);
         }
     }
     $domain = parse_url(Config::current()->url, PHP_URL_HOST);
     if (!empty($ticket->owner->email) and Visitor::current()->id != $ticket->owner->id) {
         mail($ticket->owner->email, _f("Ticket #%d Created! (%s)", array($ticket->id, $ticket->title), "progress"), _f("%s has created the ticket \"%s\" and assigned the owner to you. Description:<br />\n<br />\n%s", array(oneof($ticket->user->full_name, $ticket->user->login), $ticket->title, $ticket->description)), "MIME-Version: 1.0\r\n" . "Content-type: text/html; charset=utf-8\r\n" . "From: no-reply@" . $domain);
     }
     Flash::notice(__("Ticket added.", "progress"), $ticket->url());
 }
Beispiel #19
0
        private function getMilestones($wantedid, $wantedstatus
                , $whowantsid, $whowantstype, $isForChart = false, &$chartData){
            $isperm = false;
            $conditions = array();
            if($isForChart){
                if($wantedid > 0){
                    $tmpcondition = array('order_id=?',$wantedid);
                    \ActiveRecord\Utils::add_condition($conditions, $tmpcondition);
                }
            }else{
                if($wantedid > 0){
                    $tmpcondition = array('id=?',$wantedid);
                    \ActiveRecord\Utils::add_condition($conditions, $tmpcondition);
                }
            }
            if($wantedstatus !== ''){
                if(strtolower($wantedstatus) !== 'latest'){
                    $tmpcondition = array('LCASE(status)=?', strtolower($wantedstatus));
                    \ActiveRecord\Utils::add_condition($conditions, $tmpcondition);
                }else{
                    $tmpcondition =  array($this->getConditionforLatestMilestones());
                    \ActiveRecord\Utils::add_condition($conditions, $tmpcondition);
                }
            }
            if(($whowantstype !== Menu::ppl_type_admin && !$isperm)){
                //whatever id, status been asked give if they are their related records only                
                $tmpcondition = array('person_id=?', $whowantsid);
                \ActiveRecord\Utils::add_condition($conditions, $tmpcondition);
            }
            $result = \Milestone::find('all', array('select' => 'milestones.*, DATEDIFF(milestones.end_at, milestones.start_at) AS duration', 'conditions' => $conditions, 'order' => 'start_at'));            
            $include = array('order');
            $except = array();
//            "id":1, "text":"Project #1", "start_date":"01-04-2013", "duration":"11", "progress": 0.6, "open": true,
//            {"id": "dd2e7a97-1622-4521-a807-f29960218785", "description": "Create concept", "order": 3, "tasks": [
//                {"id": "9c17a6c8-ce8c-4426-8693-a0965ff0fe69", "subject": "Create concept", "color": "#F1C232", "from": new Date(2013,9,10,8,0,0), "to": new Date(2013,9,16,18,0,0)}
//            ]}
//{
//"cols": [
//        {"id":"Room","label":"Room","pattern":"","type":"string"},
//        {"id":"Name","label":"Name","pattern":"","type":"string"}
//        {"id":"Start","label":"Start","pattern":"","type":"date"},
//        {"id":"End","label":"End","pattern":"","type":"date"}
//      ],
//"rows": [
//        {"c":[{"v":"WATCH","f":null},{"v":"TODAYS","f":null},{"v": new Date(2013,10,10,01,46,0),"f":null},{"v": new Date(2013,10,10,06,31,0),"f":null}]},
//        {"c":[{"v":"WATCH","f":null},{"v":"AVERAGE","f":null},{"v": new Date(2013,10,10,01,52,0),"f":null},{"v": new Date(2013,10,10,06,37,0),"f":null}]}
//        
//      ]
//}            
            if(count($result) > 0){
                $chartData = array();
                $order = 0;
                $rowid = 1;
                if($isForChart){
                    switch(Menu::chart_type_current){
                        case Menu::chart_type_angulargantt:
                            $chartRow = array();
                            $chartRow["id"] = $rowid++;
                            $chartRow["description"] = "Milestones";
                            $chartRow["order"] = $order++;
                            $chartRow["tasks"] = array();
                            $chartData[] = $chartRow;
                            break;
                        case Menu::chart_type_googletimeline:
//                            $chartData = new \stdClass();
//                            $colary = array();
//                            $colobj = new \stdClass();
//                            $colobj->id= "Details";
//                            $colobj->label= "Details";
//                            $colobj->pattern= "";
//                            $colobj->type= "string";
//                            $colary[] = $colobj;
//                            $colobj = new \stdClass();
//                            $colobj->id= "Completed";
//                            $colobj->label= "Completed";
//                            $colobj->pattern= "";
//                            $colobj->type= "string";
//                            $colary[] = $colobj;
//                            $colobj = new \stdClass();
//                            $colobj->id= "Start";
//                            $colobj->label= "Start";
//                            $colobj->pattern= "";
//                            $colobj->type= "date";
//                            $colary[] = $colobj;
//                            $colobj = new \stdClass();
//                            $colobj->id= "End";
//                            $colobj->label= "End";
//                            $colobj->pattern= "";
//                            $colobj->type= "date";
//                            $colary[] = $colobj;
//                            $chartData->cols = $colary;
//                            $chartrows = array();
                            break;
                    }
                }
                foreach ($result as &$rec) {
                    //$rec = $rec->to_array(array('include' => $include, 'except' => $except));
                    if($isForChart){
                        switch(Menu::chart_type_current){
                            case Menu::chart_type_angulargantt:
                                $tmprec = array();
                                $this->fillRecForMstaskChart($tmprec, $rec);                                
                                $chartData[0]["tasks"][] = $tmprec;
                                break;
                            case Menu::chart_type_googletimeline:
                                $chartRow = array();
                                $chartRow[] = $rec->details;
                                $chartRow[] = 0;// number_format($rec->completed,0,'.','');//$rec->completed;//
                                $chartRow[] = $rec->start_at;
                                $chartRow[] = $rec->start_at;//$rec->end_at;
                                $chartRow[] = 1;
//                                //another method
//                                $chartrowobj = new \stdClass();
//                                $volobj = new \stdClass();
//                                $volobj->v = $rec['details'];
//                                //$volobj->f = null;
//                                $chartRow[] = $volobj;
//                                $volobj = new \stdClass();
//                                $volobj->v = number_format($rec['completed'],2,'.','');
//                                //$volobj->f = null;
//                                $chartRow[] = $volobj;
//                                $volobj = new \stdClass();
//                                $volobj->v = $this->formJSdateJson($rec['start_at']);
//                                //$volobj->f = null;
//                                $chartRow[] = $volobj;
//                                $volobj = new \stdClass();
//                                $volobj->v = $this->formJSdateJson($rec['end_at']);
//                                //$volobj->f = null;
//                                $chartRow[] = $volobj;
//                                $chartrowobj->c = $chartRow;
//                                $chartrows[] = $chartrowobj;
//                                $chartRow[] = $rec['details'];
//                                $chartRow[] = number_format($rec['completed'],2,'.','');
//                                $chartRow[] = $this->formJSdateJson($rec['start_at']);
//                                $chartRow[] = $this->formJSdateJson($rec['end_at']);
                                $chartData[] = $chartRow;
                                break;
                        }
                    }
                    $rec = $rec->to_array(array('include' => $include, 'except' => $except));
                }
                //$chartData->rows = $chartrows;
                if($isForChart){//collect ordertasks too.
                    $conditions = array();
                    if($wantedid > 0){
                        $tmpcondition = array('order_id=?',$wantedid);
                        \ActiveRecord\Utils::add_condition($conditions, $tmpcondition);
                    }
                    if(($whowantstype !== Menu::ppl_type_admin && !$isperm)){                
                        $allordertasksresult = \Ordertask::find('all', array('joins' => array('ordertaskpeople'), 'select' => 'ordertasks.*, DATEDIFF(ordertasks.end_at, ordertasks.start_at) AS duration', 'conditions' => $conditions, 'order' => 'start_at'));
                    }else{
                        $allordertasksresult = \Ordertask::find('all', array('select' => 'ordertasks.*, DATEDIFF(ordertasks.end_at, ordertasks.start_at) AS duration', 'conditions' => $conditions, 'order' => 'start_at'));
                    }
                    foreach ($allordertasksresult as &$otrec) {
                        //$otrec = $otrec->to_array(array('include' => $include, 'except' => $except));
                        switch(Menu::chart_type_current){
                            case Menu::chart_type_angulargantt://each task as each row
                                $chartRow = array();
                                $chartRow["id"] = $rowid++;
                                $chartRow["description"] = $otrec['details'];
                                $chartRow["order"] = $order++;

                                $chartRow["tasks"] = array();                            
                                $tmprec = array();
                                $this->fillRecForMstaskChart($tmprec, $otrec);                            
                                $chartRow["tasks"][] = $tmprec;

                                $chartData[] = $chartRow;
                                break;
                            case Menu::chart_type_googletimeline:
                                $chartRow = array();
                                $chartRow[] = $otrec->details;
                                $chartRow[] = number_format($otrec->completed,2,'.','');//number_format($otrec->completed,2,'.','');$rec->completed
                                $chartRow[] = $otrec->start_at;
                                $chartRow[] = $otrec->end_at;
                                $chartRow[] = 0;
    //                            $chartRow[] = $otrec['details'];
    //                            $chartRow[] = number_format($otrec['completed'],2,'.','');
    //                            $chartRow[] = $this->formJSdateJson($otrec['start_at']);
    //                            $chartRow[] = $this->formJSdateJson($otrec['end_at']);
                                $chartData[] = $chartRow;
                                break;
                        }
                        $otrec = $otrec->to_array(array('include' => $include, 'except' => $except));
                    }
                }
            }
            return $result;
        }
 public function milestoneSubject($milestone_id)
 {
     $milestone_info = Milestone::find($milestone_id);
     $subject = $milestone_info->subject;
     return $subject;
 }
 function convertToMilestone(&$logged_user, &$error)
 {
     db_begin_work();
     $milestone = new Milestone();
     $milestone->setProjectId($this->getProjectId());
     $milestone->setName($this->getName());
     $milestone->setBody($this->getBody());
     $milestone->setState($this->getState());
     $milestone->setVisibility($this->getVisibility());
     $milestone->setPriority($this->getPriority());
     $milestone->setCommentsCount($this->getCommentsCount());
     $milestone->setIsLocked($this->getIsLocked());
     $milestone->setCreatedById($logged_user->getId());
     $milestone->setCreatedByName($logged_user->getName());
     $milestone->setCreatedByEmail($logged_user->getEmail());
     $save = $milestone->save();
     if ($save && !is_error($save)) {
         db_commit();
         $milestone->ready();
         $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
         mysql_select_db(DB_NAME);
         $query = "update healingcrystals_project_objects set parent_id='" . $milestone->getId() . "', parent_type='Milestone' where parent_id='" . $this->getId() . "' and project_id='" . $this->getProjectId() . "' and type in ('Comment', 'Task')";
         mysql_query($query);
         $query = "update healingcrystals_project_objects set parent_id=null, parent_type=null where parent_id='" . $this->getId() . "' and project_id='" . $this->getProjectId() . "' and type not in ('Comment', 'Task')";
         mysql_query($query);
         $query = "select * from healingcrystals_assignments where object_id='" . $this->getId() . "'";
         $result = mysql_query($query);
         while ($entry = mysql_fetch_assoc($result)) {
             $query = "insert into healingcrystals_assignments (user_id, object_id, is_owner) values ('" . $entry['user_id'] . "', '" . $milestone->getId() . "', '" . $entry['is_owner'] . "')";
             mysql_query($query);
         }
         $query = "select * from healingcrystals_project_object_categories where object_id='" . $this->getId() . "'";
         $result = mysql_query($query);
         while ($entry = mysql_fetch_assoc($result)) {
             $query = "insert ignore into healingcrystals_project_object_categories (object_id, category_id) values ('" . $milestone->getId() . "', '" . $entry['category_id'] . "')";
             mysql_query($query);
         }
         mysql_close($link);
         $this->moveToTrash();
         return $milestone->getId();
     } else {
         db_rollback();
         $error = $save;
         return '';
     }
 }
 /**
  * Find successive milestones by a given milestone
  *
  * @param Milestone $milestone
  * @param integer $min_state
  * @param integer $min_visibility
  * @return array
  */
 function findSuccessiveByMilestone($milestone, $min_state = STATE_VISIBLE, $min_visibility = VISIBILITY_NORMAL)
 {
     return Milestones::find(array('conditions' => array('project_id = ? AND type = ? AND due_on >= ? AND state >= ? AND visibility >= ? AND id != ?', $milestone->getProjectId(), 'Milestone', $milestone->getDueOn(), $min_state, $min_visibility, $milestone->getId()), 'order' => 'name'));
 }
Beispiel #23
0
 public function nextMilestone()
 {
     $db = Database::getDatabase();
     $row = $db->getRow("SELECT * FROM shine_milestones WHERE status = 'open' AND app_id = '{$this->id}'ORDER BY dt_due ASC");
     if ($row !== false) {
         $m = new Milestone();
         $m->load($row);
         return $m;
     }
     return null;
 }
    public function getMSTaskChartData($id)
    {
        $criteria=new CDbCriteria;        
        $criteria->order='details asc';
        $criteria->compare('LCASE(order_id)',strtolower($id),true);
        
        $milestones = Milestone::model()->findAll($criteria);
        $chartData = array();
//        $chartRow = array('Ms/Task','Details','Start','End');
//        $chartData[] = $chartRow;
        $chartRow = array();
        $dateformat = Yii::app()->controller->datetimemysqlformatDMY;
        foreach($milestones as $milestone)
        {
            $start_at = Yii::app()->controller->getMysqlFormattedDatetime($milestone->start_at, $dateformat, false);
            //$end_at = Yii::app()->controller->getMysqlFormattedDatetime($milestone->end_at, $dateformat, false);            
            $chartRow[] = $milestone->details;
            $info = $start_at;
            $chartRow[] = $info;//this info field.
            $chartRow[] = $start_at;
            $chartRow[] = $start_at;
            $chartData[] = $chartRow;
            $chartRow = array();
        }
        
        $criteria=new CDbCriteria;
        $criteria->with = array('task');
        $criteria->order='task.name asc';
        $criteria->compare('LCASE(t.order_id)',strtolower($id),true);
        $ordertasks = Ordertask::model()->findAll($criteria);
        foreach($ordertasks as $ordertask)
        {
            $completed = $ordertask->completed;
            $start_at = Yii::app()->controller->getMysqlFormattedDatetime($ordertask->start_at, $dateformat, false);
            $end_at = Yii::app()->controller->getMysqlFormattedDatetime($ordertask->end_at, $dateformat, false);
            if($start_at === $end_at)
            {
                $datetime = new DateTime($ordertask->start_at);
                $datetime->modify('+24 hour');
                $end_at = $datetime->format($dateformat);
            }
            $info = ' [ ' . $completed . '% ] '. $start_at . ' - ' . $end_at;
            $chartRow[] = $ordertask->task->name;
            $chartRow[] = $info;//this info field.
            $chartRow[] = $start_at;
            $chartRow[] = $end_at;
            $chartData[] = $chartRow;
            $chartRow = array();
        }
//        $datetime = new DateTime('today');       
//        $datestr = $datetime->format($this->datetimemysqlformatDMY);
//        $low = $datestr;
//        $datetime->modify('+2 day');
//        $datestr = $datetime->format($this->datetimemysqlformatDMY);
//        $high = $datestr;
//        ["testms1", 
//            0, 
//            Object { date="2014-08-21 00:00:00", timezone_type=3,
//            timezone="Singapore"}, Object { date="2014-08-21 00:00:00", timezone_type=3,
//            timezone="Singapore"}                
//        ]
//        $chartData = array();
//        $chartRow = array();
//        $chartRow[] = 'MS-1';
//        $chartRow[] = $low;
//        $chartRow[] = $low;
//        $chartData[] = $chartRow;
//        $chartRow = array();
//        $chartRow[] = 'MS-2';
//        $chartRow[] = $low;
//        $chartRow[] = $high;
//        $chartData[] = $chartRow;
        return $chartData;
    }
Beispiel #25
0
 public function testExpand()
 {
     // Test intermediate nodes on expansion
     $clauses = QQ::Clause(QQ::Expand(QQN::Milestone()->Project->ManagerPerson));
     $objMilestone = Milestone::QuerySingle(QQ::Equal(QQN::Milestone()->Id, 1), $clauses);
     $this->assertTrue(!is_null($objMilestone->Name), "Milestone 1 has a name");
     $this->assertEqual($objMilestone->Name, "Milestone A", "Milestone 1 has name of Milestone A");
     $this->assertTrue(!is_null($objMilestone->Project->Name), "Project 1 has a name");
     $this->assertEqual($objMilestone->Project->Name, "ACME Website Redesign", "Project 1 has name of ACME Website Redesign");
     $this->assertTrue(!is_null($objMilestone->Project->ManagerPerson->FirstName), "Person 7 has a name");
     $this->assertEqual($objMilestone->Project->ManagerPerson->FirstName, "Karen", "Person 7 has first name of Karen");
     $clauses = QQ::Clause(QQ::ExpandAsArray(QQN::Project()->PersonAsTeamMember), QQ::OrderBy(QQN::Project()->PersonAsTeamMember->Person->LastName, QQN::Project()->PersonAsTeamMember->Person->FirstName));
     // short reach
     $objProject = Project::QuerySingle(QQ::Equal(QQN::Project()->Id, 1), $clauses);
     $objPersonArray = $objProject->_PersonAsTeamMemberArray;
     $arrNamesOnly = array();
     foreach ($objPersonArray as $item) {
         $arrNamesOnly[] = $item->FirstName . " " . $item->LastName;
     }
     $this->assertEqual($arrNamesOnly, array("Samantha Jones", "Kendall Public", "Alex Smith", "Wendy Smith", "Karen Wolfe"), "Project Team Member expansion is correct");
     // long reach
     $clauses = QQ::Clause(QQ::ExpandAsArray(QQN::Milestone()->Project->PersonAsTeamMember), QQ::OrderBy(QQN::Milestone()->Project->PersonAsTeamMember->Person->LastName, QQN::Milestone()->Project->PersonAsTeamMember->Person->FirstName));
     $objMilestone = Milestone::QuerySingle(QQ::Equal(QQN::Milestone()->Id, 1), $clauses);
     $objPersonArray = $objMilestone->Project->_PersonAsTeamMemberArray;
     $arrNamesOnly = array();
     foreach ($objPersonArray as $item) {
         $arrNamesOnly[] = $item->FirstName . " " . $item->LastName;
     }
     $this->assertEqual($arrNamesOnly, array("Samantha Jones", "Kendall Public", "Alex Smith", "Wendy Smith", "Karen Wolfe"), "Long reach Milestone to Project Team Member expansion is correct");
 }
Beispiel #26
0
 public function admin_destroy_milestone()
 {
     if (!isset($_POST['id'])) {
         error(__("Error"), __("No milestone ID specified.", "progress"));
     }
     if (!isset($_POST['hash']) or $_POST['hash'] != Config::current()->secure_hashkey) {
         show_403(__("Access Denied"), __("Invalid security key."));
     }
     $milestone = new Milestone($_POST['id']);
     if ($milestone->no_results) {
         error(__("Error"), __("Invalid milestone ID specified.", "progress"));
     }
     if (!$milestone->deletable()) {
         show_403(__("Access Denied"), __("You do not have sufficient privileges to delete this milestone.", "progress"));
     }
     foreach ($milestone->tickets as $ticket) {
         $ticket->update(null, null, $_POST['move_milestone']);
     }
     Milestone::delete($milestone->id);
     Flash::notice(__("Milestone deleted.", "progress"), "/admin/?action=manage_milestones");
 }
/**
* Returns the data model based on the primary key given in the GET variable.
* If the data model is not found, an HTTP exception will be raised.
* @param integer the ID of the model to be loaded
*/
public function loadModel($id)
{
$model=Milestone::model()->findByPk($id);
if($model===null)
throw new CHttpException(404,'The requested page does not exist.');
return $model;
}
Beispiel #28
0
 public function testExpand()
 {
     // Test intermediate nodes on expansion
     $clauses = QQ::Clause(QQ::Expand(QQN::Milestone()->Project->ManagerPerson));
     $objMilestone = Milestone::QuerySingle(QQ::Equal(QQN::Milestone()->Id, 1), $clauses);
     $this->assertTrue(!is_null($objMilestone->Name), "Milestone 1 has a name");
     $this->assertEqual($objMilestone->Name, "Milestone A", "Milestone 1 has name of Milestone A");
     $this->assertTrue(!is_null($objMilestone->Project->Name), "Project 1 has a name");
     $this->assertEqual($objMilestone->Project->Name, "ACME Website Redesign", "Project 1 has name of ACME Website Redesign");
     $this->assertTrue(!is_null($objMilestone->Project->ManagerPerson->FirstName), "Person 7 has a name");
     $this->assertEqual($objMilestone->Project->ManagerPerson->FirstName, "Karen", "Person 7 has first name of Karen");
 }
Beispiel #29
0
$arr = explode(':', $issue->issue_cause);
$arr[0] = '<b class="priority-critical-text-color" >' . $arr[0] . '</b>';
foreach ($arr as $i => $text) {
    echo $i == 0 ? '<b>' . $text . '</b>' : '<small>' . $text . '</small>', '<br/>';
}
?>
		  					</p></blockquote>
		  				</dd>
		  			</dl>
	  			</div>
	  		</div>
	  		
	  		<?php 
if ($issue->issue_milestone_id > 0) {
    $milesArr = DbHelper::fetchMilestones(MILE_ID . '=' . $issue->issue_milestone_id);
    $m = Milestone::createFromArr($milesArr[0]);
} else {
    $m = null;
}
?>
	  		<div class="row-fluid" >
	  			<div class="span12" >
	  				<dl class="dl-horizontal" >
							<dt>Milestone</dt>
							<?php 
if (!is_null($m)) {
    ?>
							<dd id="milestoneView" >
								<?php 
    $m->printOverview();
    ?>
Beispiel #30
0
<form id="milestoneForm" action="<?php 
echo $mNavCtl->buildActionURL('issues', 'delMilestone', null);
?>
" method="post" >
	<input type="hidden" id="mId" name="mId" value="" />
</form>

<table class="table ">
<?php 
if (empty($milesArr)) {
    ?>
<tr><td colspan="2" class="muted text-i" >No milestone found.</td></tr><?php 
} else {
    foreach ($milesArr as $m) {
        $milestone = Milestone::createFromArr($m);
        ?>
<tr>
	<td style="width:45%; border-top:0px none;" >
		<h3 style="color:#4183C4; margin:0px 0px;" ><?php 
        echo $m[APP_NAME] . ' ' . $m[MILE_NAME];
        ?>
</h3>
		<span class="muted" >Due in </span><span><?php 
        $milestone->printRemainingTime();
        ?>
</span>
	</td>
	<td style="width:55%; border-top:0px none;" >
		<div class="pull-left" ><?php 
        echo $milestone->count_closed;