Code Duplication    Length = 12-15 lines in 4 locations

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

@@ 202-214 (lines=13) @@
199
     * @param int $career_id
200
     * @return bool
201
     */
202
    public function get_status($career_id)
203
    {
204
        $TBL_CAREER             = Database::get_main_table(TABLE_CAREER);
205
        $career_id = intval($career_id);
206
        $sql 	= "SELECT status FROM $TBL_CAREER WHERE id = '$career_id'";
207
        $result = Database::query($sql);
208
        if (Database::num_rows($result) > 0) {
209
            $data = Database::fetch_array($result);
210
            return $data['status'];
211
        } else {
212
            return false;
213
        }
214
    }
215
216
    /**
217
     * @param array $params

main/newscorm/resourcelinker.inc.php 1 location

@@ 1342-1353 (lines=12) @@
1339
/**
1340
 * This function checks wether there are added resources or not
1341
 */
1342
function check_added_resources($type, $id) {
1343
    $course_id = api_get_course_int_id();
1344
    $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES);
1345
    $sql = "SELECT * FROM $TABLERESOURCE
1346
            WHERE c_id = $course_id AND source_type='$type' and source_id='$id'";
1347
    $result = Database::query($sql);
1348
    $number_added = Database::num_rows($result);
1349
    if ($number_added != 0)
1350
        return true;
1351
    else
1352
        return false;
1353
}
1354
1355
/**
1356
 * this function is to load the resources that were added to a specific item

main/resourcelinker/resourcelinker.inc.php 1 location

@@ 1468-1479 (lines=12) @@
1465
/**
1466
* this function checks wether there are added resources or not
1467
*/
1468
function check_added_resources($type, $id)
1469
{
1470
	global $_course, $origin;
1471
	$TABLERESOURCE 		= Database::get_course_table(TABLE_LINKED_RESOURCES);
1472
	$sql="SELECT * FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'";
1473
	$result=Database::query($sql);
1474
	$number_added=Database::num_rows($result);
1475
	if ($number_added<>0)
1476
		return true;
1477
	else
1478
		return false;
1479
}
1480
1481
1482
/**

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

@@ 2703-2717 (lines=15) @@
2700
     * @param string session category ID
2701
     * @return mixed false if the session category does not exist, array if the session category exists
2702
     */
2703
    public static function get_session_category($id)
2704
    {
2705
        $tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
2706
        $id = intval($id);
2707
        $sql = "SELECT id, name, date_start, date_end
2708
                FROM $tbl_session_category
2709
                WHERE id= $id";
2710
        $result = Database::query($sql);
2711
        $num = Database::num_rows($result);
2712
        if ($num > 0) {
2713
            return Database::fetch_array($result);
2714
        } else {
2715
            return false;
2716
        }
2717
    }
2718
2719
    /**
2720
     * Get all session categories (filter by access_url_id)