Beispiel #1
0
/**
 * Call back function for task list link
 * 
 * @param mixed $matches
 * @return
 */
function replace_task_list_link_callback($matches)
{
    if (count($matches) < 2) {
        return null;
    }
    // if
    if (!logged_user()->isMemberOfOwnerCompany()) {
        $object = ProjectTaskLists::findOne(array('conditions' => array('`id` = ? AND `project_id` = ? AND `is_private` = 0 ', $matches[1], active_project()->getId())));
    } else {
        $object = ProjectTaskLists::findOne(array('conditions' => array('`id` = ? AND `project_id` = ?', $matches[1], active_project()->getId())));
    }
    // if
    if (!$object instanceof ProjectTaskList) {
        return '<del>' . lang('invalid reference') . '</del>';
    } else {
        return '<a href="' . $object->getViewUrl() . '">' . $object->getName() . '</a>';
    }
    // if
}