/**
 * 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
}
/**
 * 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
}
/**
 * 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
}
 /**
  * Constructor
  *
  * @param Milestone $object
  */
 function __construct($object)
 {
     $this->route = Router::assemble("frosso_ec_set_milestone_percent", array("project_slug" => $object->getProject()->getSlug(), "milestone_id" => $object->getId()));
 }
/**
 * Populate $links with add discussion URL via portal
 *
 * @param Milestone $milestone
 * @param array $links
 * @param Portal $portal
 * @return null
 */
function discussions_handle_on_portal_milestone_add_links($milestone, &$links, &$portal)
{
    $links[lang('Discussion')] = portal_discussions_module_add_discussion_url($portal, $milestone->getProject(), array('milestone_id' => $milestone->getId()));
}