22/* For licensing terms, see /license.txt */
33
44use Chamilo \UserBundle \Entity \User ;
5+ use Chamilo \UserBundle \Entity \Repository \UserRepository ;
56
67/**
78 * Class SkillProfile
@@ -135,8 +136,8 @@ public function get_skills_by_profile($profileId)
135136 /**
136137 * This function is for getting profile info from profile_id.
137138 * @param int $profileId
139+ * @return array
138140 */
139-
140141 public function getProfileInfo ($ profileId )
141142 {
142143 $ sql = "SELECT * FROM $ this ->table p
@@ -338,7 +339,14 @@ public function exists_gradebook_skill($gradebook_id, $skill_id)
338339 {
339340 $ result = $ this ->find (
340341 'all ' ,
341- array ('where ' => array ('gradebook_id = ? AND skill_id = ? ' => array ($ gradebook_id , $ skill_id )))
342+ array (
343+ 'where ' => array (
344+ 'gradebook_id = ? AND skill_id = ? ' => array (
345+ $ gradebook_id ,
346+ $ skill_id
347+ )
348+ )
349+ )
342350 );
343351 if (!empty ($ result )) {
344352 return true ;
@@ -357,7 +365,14 @@ public function get_skill_info($skill_id, $gradebook_id)
357365 $ result = Database::select (
358366 '* ' ,
359367 $ this ->table ,
360- array ('where ' => array ('skill_id = ? AND gradebook_id = ? ' => array ($ skill_id , $ gradebook_id ))),
368+ array (
369+ 'where ' => array (
370+ 'skill_id = ? AND gradebook_id = ? ' => array (
371+ $ skill_id ,
372+ $ gradebook_id
373+ )
374+ )
375+ ),
361376 'first '
362377 );
363378 return $ result ;
@@ -933,6 +948,8 @@ public function edit($params)
933948 *
934949 * @param int $userId User's id
935950 * @param bool $get_skill_data
951+ *
952+ * @return array
936953 */
937954 public function get_user_skills ($ user_id , $ get_skill_data = false )
938955 {
@@ -1043,8 +1060,7 @@ public function get_skills_tree(
10431060
10441061 // If a short code was defined, send the short code to replace
10451062 // skill name (to shorten the text in the wheel)
1046- if (
1047- !empty ($ skill ['short_code ' ]) &&
1063+ if (!empty ($ skill ['short_code ' ]) &&
10481064 api_get_setting ('show_full_skill_name_on_skill_wheel ' ) === 'false '
10491065 ) {
10501066 $ skill ['data ' ]['short_code ' ] = $ skill ['short_code ' ];
@@ -1243,8 +1259,13 @@ public function get_user_skill_ranking($user_id)
12431259 * @param $where_condition
12441260 * @return array
12451261 */
1246- public function get_user_list_skill_ranking ($ start , $ limit , $ sidx , $ sord , $ where_condition )
1247- {
1262+ public function get_user_list_skill_ranking (
1263+ $ start ,
1264+ $ limit ,
1265+ $ sidx ,
1266+ $ sord ,
1267+ $ where_condition
1268+ ) {
12481269 $ start = intval ($ start );
12491270 $ limit = intval ($ limit );
12501271 /* ORDER BY $sidx $sord */
@@ -1270,14 +1291,14 @@ public function get_user_list_skill_ranking($start, $limit, $sidx, $sord, $where
12701291 public function get_user_list_skill_ranking_count ()
12711292 {
12721293 $ sql = "SELECT count(*) FROM (
1273- SELECT count(distinct 1)
1274- FROM {$ this ->table } s
1275- INNER JOIN {$ this ->table_skill_rel_user } su
1276- ON (s.id = su.skill_id)
1277- INNER JOIN {$ this ->table_user } u
1278- ON u.user_id = su.user_id
1279- GROUP BY username
1280- ) as T1 " ;
1294+ SELECT count(distinct 1)
1295+ FROM {$ this ->table } s
1296+ INNER JOIN {$ this ->table_skill_rel_user } su
1297+ ON (s.id = su.skill_id)
1298+ INNER JOIN {$ this ->table_user } u
1299+ ON u.user_id = su.user_id
1300+ GROUP BY username
1301+ ) as T1 " ;
12811302 $ result = Database::query ($ sql );
12821303 if (Database::num_rows ($ result )) {
12831304 $ result = Database::fetch_row ($ result );
@@ -1531,6 +1552,7 @@ public static function userCanAddFeedbackToUser($fromUser, $toUser)
15311552 }
15321553
15331554 $ entityManager = Database::getManager ();
1555+ /** @var UserRepository $userRepo */
15341556 $ userRepo = $ entityManager ->getRepository ('ChamiloUserBundle:User ' );
15351557 $ fromUserStatus = $ fromUser ->getStatus ();
15361558
@@ -1564,10 +1586,12 @@ public static function userCanAddFeedbackToUser($fromUser, $toUser)
15641586 }
15651587 break ;
15661588 case DRH :
1567- return UserManager::is_user_followed_by_drh ($ toUser ->getId (), $ fromUser ->getId ());
1589+ return UserManager::is_user_followed_by_drh (
1590+ $ toUser ->getId (),
1591+ $ fromUser ->getId ()
1592+ );
15681593 }
15691594
15701595 return false ;
15711596 }
1572-
15731597}
0 commit comments