Code Duplication    Length = 22-28 lines in 2 locations

main/inc/lib/thematic.lib.php 1 location

@@ 810-837 (lines=28) @@
807
     * @param	int		Thematic advance id
808
     * @return	int		Affected rows
809
     */
810
    public function thematic_advance_destroy($thematic_advance_id)
811
    {
812
        $_course = api_get_course_info();
813
        $course_id = api_get_course_int_id();
814
815
        // definition database table
816
        $tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
817
818
        // protect data
819
        $thematic_advance_id = intval($thematic_advance_id);
820
        $user_id = api_get_user_id();
821
822
        $sql = "DELETE FROM $tbl_thematic_advance
823
                WHERE c_id = $course_id AND id = $thematic_advance_id ";
824
        $result = Database::query($sql);
825
        $affected_rows = Database::affected_rows($result);
826
        if ($affected_rows) {
827
            api_item_property_update(
828
                $_course,
829
                'thematic_advance',
830
                $thematic_advance_id,
831
                'ThematicAdvanceDeleted',
832
                $user_id
833
            );
834
        }
835
836
        return $affected_rows;
837
    }
838
839
    /**
840
     * get thematic plan data

main/forum/forumfunction.inc.php 1 location

@@ 3395-3416 (lines=22) @@
3392
 * @author Isaac Flores <[email protected]>, U.N.A.S University
3393
 * @version December 2008, dokeos  1.8.6
3394
 */
3395
function current_qualify_of_thread($threadId, $sessionId, $userId)
3396
{
3397
    $table_threads_qualify = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY);
3398
3399
    $course_id = api_get_course_int_id();
3400
    $currentUserId = api_get_user_id();
3401
    $sessionId = intval($sessionId);
3402
    $threadId = intval($threadId);
3403
3404
    $sql = "SELECT qualify FROM $table_threads_qualify
3405
            WHERE
3406
                c_id = $course_id AND
3407
                thread_id = $threadId AND
3408
                session_id = $sessionId AND
3409
                qualify_user_id = $currentUserId AND
3410
                user_id = $userId
3411
            ";
3412
    $res = Database::query($sql);
3413
    $row = Database::fetch_array($res, 'ASSOC');
3414
3415
    return $row['qualify'];
3416
}
3417
3418
/**
3419
 * This function stores a reply in the forum_post table.