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

@@ 3227-3248 (lines=22) @@
3224
 * @author Isaac Flores <[email protected]>, U.N.A.S University
3225
 * @version December 2008, dokeos  1.8.6
3226
 */
3227
function current_qualify_of_thread($threadId, $sessionId, $userId)
3228
{
3229
    $table_threads_qualify = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY);
3230
3231
    $course_id = api_get_course_int_id();
3232
    $currentUserId = api_get_user_id();
3233
    $sessionId = intval($sessionId);
3234
    $threadId = intval($threadId);
3235
3236
    $sql = "SELECT qualify FROM $table_threads_qualify
3237
            WHERE
3238
                c_id = $course_id AND
3239
                thread_id = $threadId AND
3240
                session_id = $sessionId AND
3241
                qualify_user_id = $currentUserId AND
3242
                user_id = $userId
3243
            ";
3244
    $res = Database::query($sql);
3245
    $row = Database::fetch_array($res, 'ASSOC');
3246
3247
    return $row['qualify'];
3248
}
3249
3250
/**
3251
 * This function stores a reply in the forum_post table.