Code Duplication    Length = 22-28 lines in 2 locations

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

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

main/forum/forumfunction.inc.php 1 location

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