Code Duplication    Length = 22-28 lines in 2 locations

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

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

main/forum/forumfunction.inc.php 1 location

@@ 3215-3236 (lines=22) @@
3212
 * @author Isaac Flores <[email protected]>, U.N.A.S University
3213
 * @version December 2008, dokeos  1.8.6
3214
 */
3215
function current_qualify_of_thread($threadId, $sessionId, $userId)
3216
{
3217
    $table_threads_qualify = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY);
3218
3219
    $course_id = api_get_course_int_id();
3220
    $currentUserId = api_get_user_id();
3221
    $sessionId = intval($sessionId);
3222
    $threadId = intval($threadId);
3223
3224
    $sql = "SELECT qualify FROM $table_threads_qualify
3225
            WHERE
3226
                c_id = $course_id AND
3227
                thread_id = $threadId AND
3228
                session_id = $sessionId AND
3229
                qualify_user_id = $currentUserId AND
3230
                user_id = $userId
3231
            ";
3232
    $res = Database::query($sql);
3233
    $row = Database::fetch_array($res, 'ASSOC');
3234
3235
    return $row['qualify'];
3236
}
3237
3238
/**
3239
 * This function stores a reply in the forum_post table.