Code Duplication    Length = 8-8 lines in 5 locations

main/work/work.lib.php 5 locations

@@ 2683-2690 (lines=8) @@
2680
 * @param int $courseId
2681
 * @return array
2682
 */
2683
function getDocumentToWork($documentId, $workId, $courseId)
2684
{
2685
    $table = Database::get_course_table(TABLE_STUDENT_PUBLICATION_REL_DOCUMENT);
2686
    $params = array(
2687
        'document_id = ? and work_id = ? and c_id = ?' => array($documentId, $workId, $courseId)
2688
    );
2689
    return Database::select('*', $table, array('where' => $params));
2690
}
2691
2692
/**
2693
 * @param int $documentId
@@ 2737-2744 (lines=8) @@
2734
 * @param int $courseId
2735
 * @return array
2736
 */
2737
function getAllDocumentToWork($workId, $courseId)
2738
{
2739
    $table = Database::get_course_table(TABLE_STUDENT_PUBLICATION_REL_DOCUMENT);
2740
    $params = array(
2741
        'work_id = ? and c_id = ?' => array($workId, $courseId)
2742
    );
2743
    return Database::select('*', $table, array('where' => $params));
2744
}
2745
2746
/**
2747
 * @param int $documentId
@@ 2751-2758 (lines=8) @@
2748
 * @param int $workId
2749
 * @param int $courseId
2750
 */
2751
function deleteDocumentToWork($documentId, $workId, $courseId)
2752
{
2753
    $table = Database::get_course_table(TABLE_STUDENT_PUBLICATION_REL_DOCUMENT);
2754
    $params = array(
2755
        'document_id = ? and work_id = ? and c_id = ?' => array($documentId, $workId, $courseId)
2756
    );
2757
    Database::delete($table, $params);
2758
}
2759
2760
/**
2761
 * @param int $userId
@@ 2782-2789 (lines=8) @@
2779
 * @param int $courseId
2780
 * @return array
2781
 */
2782
function getUserToWork($userId, $workId, $courseId)
2783
{
2784
    $table = Database::get_course_table(TABLE_STUDENT_PUBLICATION_REL_USER);
2785
    $params = array(
2786
        'user_id = ? and work_id = ? and c_id = ?' => array($userId, $workId, $courseId)
2787
    );
2788
    return Database::select('*', $table, array('where' => $params));
2789
}
2790
2791
/**
2792
 * @param int $workId
@@ 2825-2832 (lines=8) @@
2822
 * @param int $workId
2823
 * @param int $courseId
2824
 */
2825
function deleteUserToWork($userId, $workId, $courseId)
2826
{
2827
    $table = Database::get_course_table(TABLE_STUDENT_PUBLICATION_REL_USER);
2828
    $params = array(
2829
        'user_id = ? and work_id = ? and c_id = ?' => array($userId, $workId, $courseId)
2830
    );
2831
    Database::delete($table, $params);
2832
}
2833
2834
/**
2835
 * @param int $userId