@@ -9,9 +9,9 @@ |
||
| 9 | 9 | $query = htmlspecialchars($_GET['query']); |
| 10 | 10 | $result = array(); |
| 11 | 11 | foreach ($skills as $s) { |
| 12 | - if (strpos(strtolower($s), strtolower($query)) !== FALSE) { |
|
| 13 | - $result[] = array('value' => $s); |
|
| 14 | - } |
|
| 12 | + if (strpos(strtolower($s), strtolower($query)) !== FALSE) { |
|
| 13 | + $result[] = array('value' => $s); |
|
| 14 | + } |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | $vars["output"] = $result; |
@@ -7,19 +7,19 @@ |
||
| 7 | 7 | |
| 8 | 8 | //This is an Ajax call |
| 9 | 9 | if (elgg_is_xhr()) { |
| 10 | - $user_guid = get_input('guid'); |
|
| 11 | - $skill_guid = get_input('skill'); |
|
| 12 | - $skill = get_entity($skill_guid); |
|
| 10 | + $user_guid = get_input('guid'); |
|
| 11 | + $skill_guid = get_input('skill'); |
|
| 12 | + $skill = get_entity($skill_guid); |
|
| 13 | 13 | |
| 14 | - if ($skill->endorsements == NULL) { |
|
| 15 | - $skill->endorsements = $user_guid; |
|
| 16 | - } |
|
| 17 | - else { |
|
| 18 | - $stack = $skill->endorsements; |
|
| 19 | - if (!(is_array($stack))) { $stack = array($stack); } |
|
| 14 | + if ($skill->endorsements == NULL) { |
|
| 15 | + $skill->endorsements = $user_guid; |
|
| 16 | + } |
|
| 17 | + else { |
|
| 18 | + $stack = $skill->endorsements; |
|
| 19 | + if (!(is_array($stack))) { $stack = array($stack); } |
|
| 20 | 20 | |
| 21 | - $stack[] = $user_guid; |
|
| 22 | - $skill->endorsements = $stack; |
|
| 23 | - } |
|
| 24 | - $skill->save(); |
|
| 21 | + $stack[] = $user_guid; |
|
| 22 | + $skill->endorsements = $stack; |
|
| 23 | + } |
|
| 24 | + $skill->save(); |
|
| 25 | 25 | } |
| 26 | 26 | \ No newline at end of file |
@@ -13,8 +13,7 @@ |
||
| 13 | 13 | |
| 14 | 14 | if ($skill->endorsements == NULL) { |
| 15 | 15 | $skill->endorsements = $user_guid; |
| 16 | - } |
|
| 17 | - else { |
|
| 16 | + } else { |
|
| 18 | 17 | $stack = $skill->endorsements; |
| 19 | 18 | if (!(is_array($stack))) { $stack = array($stack); } |
| 20 | 19 | |
@@ -11,44 +11,44 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | foreach ($skills as $s) { |
| 13 | 13 | |
| 14 | - // full word at start of skill title |
|
| 15 | - if (strpos(strtolower(' ' . $s) . ' ', ' ' . strtolower($query) . ' ') === 0 ) { |
|
| 16 | - $result[] = array( |
|
| 17 | - 'value' => $s, |
|
| 18 | - 'pos' => 0 |
|
| 19 | - ); |
|
| 20 | - } |
|
| 14 | + // full word at start of skill title |
|
| 15 | + if (strpos(strtolower(' ' . $s) . ' ', ' ' . strtolower($query) . ' ') === 0 ) { |
|
| 16 | + $result[] = array( |
|
| 17 | + 'value' => $s, |
|
| 18 | + 'pos' => 0 |
|
| 19 | + ); |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - // full word somewhere in skill title |
|
| 23 | - elseif (strpos(strtolower(' ' . $s) . ' ', ' ' . strtolower($query) . ' ') !== FALSE) { |
|
| 24 | - $result[] = array( |
|
| 25 | - 'value' => $s, |
|
| 26 | - 'pos' => 1 |
|
| 27 | - ); |
|
| 28 | - } |
|
| 22 | + // full word somewhere in skill title |
|
| 23 | + elseif (strpos(strtolower(' ' . $s) . ' ', ' ' . strtolower($query) . ' ') !== FALSE) { |
|
| 24 | + $result[] = array( |
|
| 25 | + 'value' => $s, |
|
| 26 | + 'pos' => 1 |
|
| 27 | + ); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - // partial word at start of skill title |
|
| 31 | - elseif (strpos(strtolower(' ' . $s), ' ' . strtolower($query)) === 0 ) { |
|
| 32 | - $result[] = array( |
|
| 33 | - 'value' => $s, |
|
| 34 | - 'pos' => 2 |
|
| 35 | - ); |
|
| 36 | - } |
|
| 30 | + // partial word at start of skill title |
|
| 31 | + elseif (strpos(strtolower(' ' . $s), ' ' . strtolower($query)) === 0 ) { |
|
| 32 | + $result[] = array( |
|
| 33 | + 'value' => $s, |
|
| 34 | + 'pos' => 2 |
|
| 35 | + ); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - //partial word somewhere in skill title |
|
| 39 | - elseif (strpos(strtolower(' ' . $s), ' ' . strtolower($query)) !== FALSE) { |
|
| 40 | - $result[] = array( |
|
| 41 | - 'value' => $s, |
|
| 42 | - 'pos' => 3 |
|
| 43 | - ); |
|
| 44 | - } |
|
| 38 | + //partial word somewhere in skill title |
|
| 39 | + elseif (strpos(strtolower(' ' . $s), ' ' . strtolower($query)) !== FALSE) { |
|
| 40 | + $result[] = array( |
|
| 41 | + 'value' => $s, |
|
| 42 | + 'pos' => 3 |
|
| 43 | + ); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - elseif (strpos(strtolower($s), strtolower($query)) !== FALSE) { |
|
| 47 | - $result[] = array( |
|
| 48 | - 'value' => $s, |
|
| 49 | - 'pos' => 4 |
|
| 50 | - ); |
|
| 51 | - } |
|
| 46 | + elseif (strpos(strtolower($s), strtolower($query)) !== FALSE) { |
|
| 47 | + $result[] = array( |
|
| 48 | + 'value' => $s, |
|
| 49 | + 'pos' => 4 |
|
| 50 | + ); |
|
| 51 | + } |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | $highest_relevance = array(); |
@@ -58,21 +58,21 @@ discard block |
||
| 58 | 58 | $lowest_relevance = array(); |
| 59 | 59 | |
| 60 | 60 | foreach ( $result as $r ) { |
| 61 | - if ( $r['pos'] == 0 ) { |
|
| 62 | - $highest_relevance[] = $r; |
|
| 63 | - } |
|
| 64 | - elseif ( $r['pos'] == 1 ) { |
|
| 65 | - $high_relevance[] = $r; |
|
| 66 | - } |
|
| 67 | - elseif ( $r['pos'] == 2 ) { |
|
| 68 | - $med_relevance[] = $r; |
|
| 69 | - } |
|
| 70 | - elseif ( $r['pos'] == 3 ) { |
|
| 71 | - $low_relevance[] = $r; |
|
| 72 | - } |
|
| 73 | - elseif ( $r['pos'] == 4 ) { |
|
| 74 | - $lowest_relevance[] = $r; |
|
| 75 | - } |
|
| 61 | + if ( $r['pos'] == 0 ) { |
|
| 62 | + $highest_relevance[] = $r; |
|
| 63 | + } |
|
| 64 | + elseif ( $r['pos'] == 1 ) { |
|
| 65 | + $high_relevance[] = $r; |
|
| 66 | + } |
|
| 67 | + elseif ( $r['pos'] == 2 ) { |
|
| 68 | + $med_relevance[] = $r; |
|
| 69 | + } |
|
| 70 | + elseif ( $r['pos'] == 3 ) { |
|
| 71 | + $low_relevance[] = $r; |
|
| 72 | + } |
|
| 73 | + elseif ( $r['pos'] == 4 ) { |
|
| 74 | + $lowest_relevance[] = $r; |
|
| 75 | + } |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | $result = array_merge($highest_relevance, $high_relevance, $med_relevance, $low_relevance, $lowest_relevance); |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | foreach ($skills as $s) { |
| 13 | 13 | |
| 14 | 14 | // full word at start of skill title |
| 15 | - if (strpos(strtolower(' ' . $s) . ' ', ' ' . strtolower($query) . ' ') === 0 ) { |
|
| 15 | + if (strpos(strtolower(' ' . $s) . ' ', ' ' . strtolower($query) . ' ') === 0) { |
|
| 16 | 16 | $result[] = array( |
| 17 | 17 | 'value' => $s, |
| 18 | 18 | 'pos' => 0 |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | // partial word at start of skill title |
| 31 | - elseif (strpos(strtolower(' ' . $s), ' ' . strtolower($query)) === 0 ) { |
|
| 31 | + elseif (strpos(strtolower(' ' . $s), ' ' . strtolower($query)) === 0) { |
|
| 32 | 32 | $result[] = array( |
| 33 | 33 | 'value' => $s, |
| 34 | 34 | 'pos' => 2 |
@@ -57,20 +57,20 @@ discard block |
||
| 57 | 57 | $low_relevance = array(); |
| 58 | 58 | $lowest_relevance = array(); |
| 59 | 59 | |
| 60 | -foreach ( $result as $r ) { |
|
| 61 | - if ( $r['pos'] == 0 ) { |
|
| 60 | +foreach ($result as $r) { |
|
| 61 | + if ($r['pos'] == 0) { |
|
| 62 | 62 | $highest_relevance[] = $r; |
| 63 | 63 | } |
| 64 | - elseif ( $r['pos'] == 1 ) { |
|
| 64 | + elseif ($r['pos'] == 1) { |
|
| 65 | 65 | $high_relevance[] = $r; |
| 66 | 66 | } |
| 67 | - elseif ( $r['pos'] == 2 ) { |
|
| 67 | + elseif ($r['pos'] == 2) { |
|
| 68 | 68 | $med_relevance[] = $r; |
| 69 | 69 | } |
| 70 | - elseif ( $r['pos'] == 3 ) { |
|
| 70 | + elseif ($r['pos'] == 3) { |
|
| 71 | 71 | $low_relevance[] = $r; |
| 72 | 72 | } |
| 73 | - elseif ( $r['pos'] == 4 ) { |
|
| 73 | + elseif ($r['pos'] == 4) { |
|
| 74 | 74 | $lowest_relevance[] = $r; |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -41,9 +41,7 @@ discard block |
||
| 41 | 41 | 'value' => $s, |
| 42 | 42 | 'pos' => 3 |
| 43 | 43 | ); |
| 44 | - } |
|
| 45 | - |
|
| 46 | - elseif (strpos(strtolower($s), strtolower($query)) !== FALSE) { |
|
| 44 | + } elseif (strpos(strtolower($s), strtolower($query)) !== FALSE) { |
|
| 47 | 45 | $result[] = array( |
| 48 | 46 | 'value' => $s, |
| 49 | 47 | 'pos' => 4 |
@@ -60,17 +58,13 @@ discard block |
||
| 60 | 58 | foreach ( $result as $r ) { |
| 61 | 59 | if ( $r['pos'] == 0 ) { |
| 62 | 60 | $highest_relevance[] = $r; |
| 63 | - } |
|
| 64 | - elseif ( $r['pos'] == 1 ) { |
|
| 61 | + } elseif ( $r['pos'] == 1 ) { |
|
| 65 | 62 | $high_relevance[] = $r; |
| 66 | - } |
|
| 67 | - elseif ( $r['pos'] == 2 ) { |
|
| 63 | + } elseif ( $r['pos'] == 2 ) { |
|
| 68 | 64 | $med_relevance[] = $r; |
| 69 | - } |
|
| 70 | - elseif ( $r['pos'] == 3 ) { |
|
| 65 | + } elseif ( $r['pos'] == 3 ) { |
|
| 71 | 66 | $low_relevance[] = $r; |
| 72 | - } |
|
| 73 | - elseif ( $r['pos'] == 4 ) { |
|
| 67 | + } elseif ( $r['pos'] == 4 ) { |
|
| 74 | 68 | $lowest_relevance[] = $r; |
| 75 | 69 | } |
| 76 | 70 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | $hide_list_explode = explode(',', $manager->missions_hide_list); |
| 14 | 14 | $key = array_search($mission->guid, $hide_list_explode); |
| 15 | -if(!($key === false)) { |
|
| 15 | +if (!($key === false)) { |
|
| 16 | 16 | unset($hide_list_explode[$key]); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -1,553 +1,553 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | if (elgg_is_xhr()) { //This is an Ajax call! |
| 3 | - $user_guid = get_input('guid'); |
|
| 4 | - $user = get_user($user_guid); |
|
| 5 | - $section = get_input('section'); |
|
| 6 | - $error = false; |
|
| 7 | - switch ($section) { |
|
| 8 | - case "profile": |
|
| 9 | - $profile_fields = get_input('profile'); |
|
| 10 | - $social_media = get_input('social_media'); |
|
| 11 | - $error_message = ''; |
|
| 12 | - foreach ( $profile_fields as $f => $v ) { |
|
| 13 | - // cyu - check if email field is empty |
|
| 14 | - if ($f === "email") { |
|
| 15 | - trim($v); // remove white spaces from both sides of string |
|
| 16 | - if (!$v) { |
|
| 17 | - register_error(elgg_echo('gcc_profile:error').elgg_echo('gcc_profile:missingemail')); |
|
| 18 | - return true; |
|
| 19 | - } |
|
| 3 | + $user_guid = get_input('guid'); |
|
| 4 | + $user = get_user($user_guid); |
|
| 5 | + $section = get_input('section'); |
|
| 6 | + $error = false; |
|
| 7 | + switch ($section) { |
|
| 8 | + case "profile": |
|
| 9 | + $profile_fields = get_input('profile'); |
|
| 10 | + $social_media = get_input('social_media'); |
|
| 11 | + $error_message = ''; |
|
| 12 | + foreach ( $profile_fields as $f => $v ) { |
|
| 13 | + // cyu - check if email field is empty |
|
| 14 | + if ($f === "email") { |
|
| 15 | + trim($v); // remove white spaces from both sides of string |
|
| 16 | + if (!$v) { |
|
| 17 | + register_error(elgg_echo('gcc_profile:error').elgg_echo('gcc_profile:missingemail')); |
|
| 18 | + return true; |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - elgg_load_library('c_ext_lib'); |
|
| 22 | - $isValid = false; |
|
| 21 | + elgg_load_library('c_ext_lib'); |
|
| 22 | + $isValid = false; |
|
| 23 | 23 | |
| 24 | - if ($v) { |
|
| 25 | - // cyu - check if the email is in the list of exceptions |
|
| 26 | - $user_email = explode('@',$v); |
|
| 27 | - $list_of_domains = getExtension(); |
|
| 28 | - if (count($list_of_domains) > 0) { |
|
| 29 | - while ($row = mysqli_fetch_array($list_of_domains)) { |
|
| 30 | - if (strtolower($row['ext']) === strtolower($user_email[1])) { |
|
| 31 | - $isValid = true; |
|
| 32 | - break; |
|
| 33 | - } |
|
| 34 | - } |
|
| 35 | - $error_message = elgg_echo('gcc_profile:error').elgg_echo('gcc_profile:notaccepted'); |
|
| 36 | - } |
|
| 37 | - // cyu - check if domain is gc.ca |
|
| 38 | - if (!$isValid) { |
|
| 39 | - $govt_domain = explode('.',$user_email[1]); |
|
| 40 | - $govt_domain_len = count($govt_domain) - 1; |
|
| 41 | - if ($govt_domain[$govt_domain_len - 1].'.'.$govt_domain[$govt_domain_len] === 'gc.ca') { |
|
| 42 | - $isValid = true; |
|
| 43 | - } else { |
|
| 44 | - $isValid = false; |
|
| 45 | - $error_message = elgg_echo('gcc_profile:error').elgg_echo('gcc_profile:notaccepted'); |
|
| 46 | - } |
|
| 47 | - } |
|
| 48 | - } |
|
| 49 | - if (!$isValid) { |
|
| 50 | - register_error($error_message); |
|
| 51 | - return true; |
|
| 52 | - } |
|
| 53 | - $user->set($f, $v); |
|
| 54 | - } |
|
| 55 | - else { |
|
| 56 | - if($f=='department'){ |
|
| 57 | - $obj = elgg_get_entities(array( |
|
| 58 | - 'type' => 'object', |
|
| 59 | - 'subtype' => 'dept_list', |
|
| 60 | - 'owner_guid' => 0 |
|
| 61 | - )); |
|
| 62 | - $departmentsEn = json_decode($obj[0]->deptsEn, true); |
|
| 63 | - $provinces['pov-alb'] = 'Government of Alberta'; |
|
| 64 | - $provinces['pov-bc'] = 'Government of British Columbia'; |
|
| 65 | - $provinces['pov-man'] = 'Government of Manitoba'; |
|
| 66 | - $provinces['pov-nb'] = 'Government of New Brunswick'; |
|
| 67 | - $provinces['pov-nfl'] = 'Government of Newfoundland and Labrador'; |
|
| 68 | - $provinces['pov-ns'] = 'Government of Nova Scotia'; |
|
| 69 | - $provinces['pov-nwt'] = 'Government of Northwest Territories'; |
|
| 70 | - $provinces['pov-nun'] = 'Government of Nunavut'; |
|
| 71 | - $provinces['pov-ont'] = 'Government of Ontario'; |
|
| 72 | - $provinces['pov-pei'] = 'Government of Prince Edward Island'; |
|
| 73 | - $provinces['pov-que'] = 'Government of Quebec'; |
|
| 74 | - $provinces['pov-sask'] = 'Government of Saskatchewan'; |
|
| 75 | - $provinces['pov-yuk'] = 'Government of Yukon'; |
|
| 76 | - $departmentsEn = array_merge($departmentsEn,$provinces); |
|
| 24 | + if ($v) { |
|
| 25 | + // cyu - check if the email is in the list of exceptions |
|
| 26 | + $user_email = explode('@',$v); |
|
| 27 | + $list_of_domains = getExtension(); |
|
| 28 | + if (count($list_of_domains) > 0) { |
|
| 29 | + while ($row = mysqli_fetch_array($list_of_domains)) { |
|
| 30 | + if (strtolower($row['ext']) === strtolower($user_email[1])) { |
|
| 31 | + $isValid = true; |
|
| 32 | + break; |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | + $error_message = elgg_echo('gcc_profile:error').elgg_echo('gcc_profile:notaccepted'); |
|
| 36 | + } |
|
| 37 | + // cyu - check if domain is gc.ca |
|
| 38 | + if (!$isValid) { |
|
| 39 | + $govt_domain = explode('.',$user_email[1]); |
|
| 40 | + $govt_domain_len = count($govt_domain) - 1; |
|
| 41 | + if ($govt_domain[$govt_domain_len - 1].'.'.$govt_domain[$govt_domain_len] === 'gc.ca') { |
|
| 42 | + $isValid = true; |
|
| 43 | + } else { |
|
| 44 | + $isValid = false; |
|
| 45 | + $error_message = elgg_echo('gcc_profile:error').elgg_echo('gcc_profile:notaccepted'); |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | + if (!$isValid) { |
|
| 50 | + register_error($error_message); |
|
| 51 | + return true; |
|
| 52 | + } |
|
| 53 | + $user->set($f, $v); |
|
| 54 | + } |
|
| 55 | + else { |
|
| 56 | + if($f=='department'){ |
|
| 57 | + $obj = elgg_get_entities(array( |
|
| 58 | + 'type' => 'object', |
|
| 59 | + 'subtype' => 'dept_list', |
|
| 60 | + 'owner_guid' => 0 |
|
| 61 | + )); |
|
| 62 | + $departmentsEn = json_decode($obj[0]->deptsEn, true); |
|
| 63 | + $provinces['pov-alb'] = 'Government of Alberta'; |
|
| 64 | + $provinces['pov-bc'] = 'Government of British Columbia'; |
|
| 65 | + $provinces['pov-man'] = 'Government of Manitoba'; |
|
| 66 | + $provinces['pov-nb'] = 'Government of New Brunswick'; |
|
| 67 | + $provinces['pov-nfl'] = 'Government of Newfoundland and Labrador'; |
|
| 68 | + $provinces['pov-ns'] = 'Government of Nova Scotia'; |
|
| 69 | + $provinces['pov-nwt'] = 'Government of Northwest Territories'; |
|
| 70 | + $provinces['pov-nun'] = 'Government of Nunavut'; |
|
| 71 | + $provinces['pov-ont'] = 'Government of Ontario'; |
|
| 72 | + $provinces['pov-pei'] = 'Government of Prince Edward Island'; |
|
| 73 | + $provinces['pov-que'] = 'Government of Quebec'; |
|
| 74 | + $provinces['pov-sask'] = 'Government of Saskatchewan'; |
|
| 75 | + $provinces['pov-yuk'] = 'Government of Yukon'; |
|
| 76 | + $departmentsEn = array_merge($departmentsEn,$provinces); |
|
| 77 | 77 | |
| 78 | - $departmentsFr = json_decode($obj[0]->deptsFr, true); |
|
| 79 | - $provincesFr['pov-alb'] = "Gouvernement de l'Alberta"; |
|
| 80 | - $provincesFr['pov-bc'] = 'Gouvernement de la Colombie-Britannique'; |
|
| 81 | - $provincesFr['pov-man'] = 'Gouvernement du Manitoba'; |
|
| 82 | - $provincesFr['pov-nb'] = 'Gouvernement du Nouveau-Brunswick'; |
|
| 83 | - $provincesFr['pov-nfl'] = 'Gouvernement de Terre-Neuve-et-Labrador'; |
|
| 84 | - $provincesFr['pov-ns'] = 'Gouvernement de la Nouvelle-�cosse'; |
|
| 85 | - $provincesFr['pov-nwt'] = 'Gouvernement du Territoires du Nord-Ouest'; |
|
| 86 | - $provincesFr['pov-nun'] = 'Gouvernement du Nunavut'; |
|
| 87 | - $provincesFr['pov-ont'] = "Gouvernement de l'Ontario"; |
|
| 88 | - $provincesFr['pov-pei'] = "Gouvernement de l'�le-du-Prince-�douard"; |
|
| 89 | - $provincesFr['pov-que'] = 'Gouvernement du Qu�bec'; |
|
| 90 | - $provincesFr['pov-sask'] = 'Gouvernement de Saskatchewan'; |
|
| 91 | - $provincesFr['pov-yuk'] = 'Gouvernement du Yukon'; |
|
| 92 | - $departmentsFr = array_merge($departmentsFr,$provincesFr); |
|
| 78 | + $departmentsFr = json_decode($obj[0]->deptsFr, true); |
|
| 79 | + $provincesFr['pov-alb'] = "Gouvernement de l'Alberta"; |
|
| 80 | + $provincesFr['pov-bc'] = 'Gouvernement de la Colombie-Britannique'; |
|
| 81 | + $provincesFr['pov-man'] = 'Gouvernement du Manitoba'; |
|
| 82 | + $provincesFr['pov-nb'] = 'Gouvernement du Nouveau-Brunswick'; |
|
| 83 | + $provincesFr['pov-nfl'] = 'Gouvernement de Terre-Neuve-et-Labrador'; |
|
| 84 | + $provincesFr['pov-ns'] = 'Gouvernement de la Nouvelle-�cosse'; |
|
| 85 | + $provincesFr['pov-nwt'] = 'Gouvernement du Territoires du Nord-Ouest'; |
|
| 86 | + $provincesFr['pov-nun'] = 'Gouvernement du Nunavut'; |
|
| 87 | + $provincesFr['pov-ont'] = "Gouvernement de l'Ontario"; |
|
| 88 | + $provincesFr['pov-pei'] = "Gouvernement de l'�le-du-Prince-�douard"; |
|
| 89 | + $provincesFr['pov-que'] = 'Gouvernement du Qu�bec'; |
|
| 90 | + $provincesFr['pov-sask'] = 'Gouvernement de Saskatchewan'; |
|
| 91 | + $provincesFr['pov-yuk'] = 'Gouvernement du Yukon'; |
|
| 92 | + $departmentsFr = array_merge($departmentsFr,$provincesFr); |
|
| 93 | 93 | |
| 94 | - if (get_current_language()=='en'){ |
|
| 95 | - $deptString = $departmentsEn[$v]." / ".$departmentsFr[$v]; |
|
| 96 | - }else{ |
|
| 97 | - $deptString = $departmentsFr[$v]." / ".$departmentsEn[$v]; |
|
| 98 | - } |
|
| 94 | + if (get_current_language()=='en'){ |
|
| 95 | + $deptString = $departmentsEn[$v]." / ".$departmentsFr[$v]; |
|
| 96 | + }else{ |
|
| 97 | + $deptString = $departmentsFr[$v]." / ".$departmentsEn[$v]; |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - $user->set('department',$deptString); |
|
| 100 | + $user->set('department',$deptString); |
|
| 101 | 101 | |
| 102 | - }else if($f == 'location' && $v) { |
|
| 102 | + }else if($f == 'location' && $v) { |
|
| 103 | 103 | |
| 104 | - //check to see if addressString exists |
|
| 105 | - if($user->addressString && $user->addressStringFr){ |
|
| 104 | + //check to see if addressString exists |
|
| 105 | + if($user->addressString && $user->addressStringFr){ |
|
| 106 | 106 | |
| 107 | - //split up location field value |
|
| 108 | - $address = explode(',', $v); |
|
| 107 | + //split up location field value |
|
| 108 | + $address = explode(',', $v); |
|
| 109 | 109 | |
| 110 | - //Add cut up location field to address string |
|
| 111 | - //if user enters a proper address the address wil display nicely. If not the map will not display right |
|
| 112 | - //sadly we cannot extract all the same information from the location field properly to complete the json string |
|
| 113 | - $user->addressString = '{"street":"'.$address[0].'","city":"'.$address[1].'","province":"'.$address[2].'","country":"Canada","pc":""}'; |
|
| 114 | - $user->addressStringFr = '{"street":"'.$address[0].'","city":"'.$address[1].'","province":"'.$address[2].'","country":"Canada","pc":""}'; |
|
| 110 | + //Add cut up location field to address string |
|
| 111 | + //if user enters a proper address the address wil display nicely. If not the map will not display right |
|
| 112 | + //sadly we cannot extract all the same information from the location field properly to complete the json string |
|
| 113 | + $user->addressString = '{"street":"'.$address[0].'","city":"'.$address[1].'","province":"'.$address[2].'","country":"Canada","pc":""}'; |
|
| 114 | + $user->addressStringFr = '{"street":"'.$address[0].'","city":"'.$address[1].'","province":"'.$address[2].'","country":"Canada","pc":""}'; |
|
| 115 | 115 | |
| 116 | - } |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - //set value like normal |
|
| 119 | - $user->set($f, $v); |
|
| 118 | + //set value like normal |
|
| 119 | + $user->set($f, $v); |
|
| 120 | 120 | |
| 121 | - } else { |
|
| 122 | - $user->set($f, $v); |
|
| 123 | - } |
|
| 124 | - //register_error($f); |
|
| 121 | + } else { |
|
| 122 | + $user->set($f, $v); |
|
| 123 | + } |
|
| 124 | + //register_error($f); |
|
| 125 | 125 | |
| 126 | - } |
|
| 127 | - } |
|
| 128 | - foreach ( $social_media as $f => $v ) { |
|
| 129 | - $link = $v; |
|
| 130 | - if (filter_var($link, FILTER_VALIDATE_URL) == false) { |
|
| 131 | - $user->set($f, $link); |
|
| 132 | - } |
|
| 133 | - } |
|
| 134 | - //$user->micro = get_input('micro'); |
|
| 135 | - $user->save(); |
|
| 136 | - //forward($user->getURL()); |
|
| 137 | - break; |
|
| 138 | - case 'about-me': |
|
| 139 | - //$user->description = get_input('description', 'ERROR: Ask your admin to grep: 5FH13GAHHHS0001.'); |
|
| 140 | - //error_log(print_r("access: " . get_input('access'))); |
|
| 141 | - create_metadata($user_guid, 'description', get_input('description', 'ERROR: Ask your admin to grep: 5FH13GAHHHS0001.'), 'text', 0, get_input('access')); |
|
| 142 | - $user->save(); |
|
| 143 | - break; |
|
| 144 | - case 'education': |
|
| 145 | - $eguid = get_input('eguid', ''); |
|
| 146 | - $delete = get_input('delete', ''); |
|
| 147 | - $school = get_input('school', 'ERROR: Ask your admin to grep: 5FH13GAHHHS0002.'); |
|
| 148 | - $startdate = get_input('startdate', 'ERROR: Ask your admin to grep: 5FH13GAHHHS0003.'); |
|
| 149 | - $startyear = get_input('startyear'); |
|
| 150 | - $enddate = get_input('enddate', 'ERROR: Ask your admin to grep: 5FH13GAHHHS0004.'); |
|
| 151 | - $endyear = get_input('endyear'); |
|
| 152 | - $ongoing = get_input('ongoing'); |
|
| 153 | - //$program = get_input('program', 'ERROR: Ask your admin to grep: 5FH13GAHHHS0005.'); |
|
| 154 | - $degree = get_input('degree'); |
|
| 155 | - $field = get_input('field', 'ERROR: Ask your admin to grep: 5FH13GAHHHS0006.'); |
|
| 156 | - $access = get_input('access', 'ERROR: Ask your admin to grep: 5321GDS1111661353BB.'); |
|
| 157 | - // create education object |
|
| 158 | - $education_guids = array(); |
|
| 159 | - $education_list = $user->education; |
|
| 160 | - if ($delete != null && !is_array($delete)) { |
|
| 161 | - $delete = array( $delete ); |
|
| 162 | - } |
|
| 163 | - if ( is_array($delete) ) { |
|
| 164 | - foreach ($delete as $delete_guid) { |
|
| 165 | - if ($delete_guid != NULL) { |
|
| 166 | - if ($delete = get_entity($delete_guid)) { |
|
| 167 | - $delete->delete(); |
|
| 168 | - } |
|
| 169 | - if (is_array($education_list)) { |
|
| 170 | - if (($key = array_search($delete_guid, $education_list)) !== false) { |
|
| 171 | - unset($education_list[$key]); |
|
| 172 | - } |
|
| 173 | - } elseif ($education_list == $delete_guid) { |
|
| 174 | - $education_list = null; |
|
| 175 | - } |
|
| 176 | - } |
|
| 177 | - } |
|
| 178 | - } |
|
| 179 | - $user->education = $education_list; |
|
| 180 | - if ($eguid != null && !is_array($eguid)) { |
|
| 181 | - $eguid = array( $eguid ); |
|
| 182 | - } |
|
| 183 | - //create new education entries |
|
| 184 | - if (is_array($eguid)) { |
|
| 185 | - foreach ($eguid as $k => $v) { |
|
| 186 | - $validInput = true; |
|
| 187 | - /* |
|
| 126 | + } |
|
| 127 | + } |
|
| 128 | + foreach ( $social_media as $f => $v ) { |
|
| 129 | + $link = $v; |
|
| 130 | + if (filter_var($link, FILTER_VALIDATE_URL) == false) { |
|
| 131 | + $user->set($f, $link); |
|
| 132 | + } |
|
| 133 | + } |
|
| 134 | + //$user->micro = get_input('micro'); |
|
| 135 | + $user->save(); |
|
| 136 | + //forward($user->getURL()); |
|
| 137 | + break; |
|
| 138 | + case 'about-me': |
|
| 139 | + //$user->description = get_input('description', 'ERROR: Ask your admin to grep: 5FH13GAHHHS0001.'); |
|
| 140 | + //error_log(print_r("access: " . get_input('access'))); |
|
| 141 | + create_metadata($user_guid, 'description', get_input('description', 'ERROR: Ask your admin to grep: 5FH13GAHHHS0001.'), 'text', 0, get_input('access')); |
|
| 142 | + $user->save(); |
|
| 143 | + break; |
|
| 144 | + case 'education': |
|
| 145 | + $eguid = get_input('eguid', ''); |
|
| 146 | + $delete = get_input('delete', ''); |
|
| 147 | + $school = get_input('school', 'ERROR: Ask your admin to grep: 5FH13GAHHHS0002.'); |
|
| 148 | + $startdate = get_input('startdate', 'ERROR: Ask your admin to grep: 5FH13GAHHHS0003.'); |
|
| 149 | + $startyear = get_input('startyear'); |
|
| 150 | + $enddate = get_input('enddate', 'ERROR: Ask your admin to grep: 5FH13GAHHHS0004.'); |
|
| 151 | + $endyear = get_input('endyear'); |
|
| 152 | + $ongoing = get_input('ongoing'); |
|
| 153 | + //$program = get_input('program', 'ERROR: Ask your admin to grep: 5FH13GAHHHS0005.'); |
|
| 154 | + $degree = get_input('degree'); |
|
| 155 | + $field = get_input('field', 'ERROR: Ask your admin to grep: 5FH13GAHHHS0006.'); |
|
| 156 | + $access = get_input('access', 'ERROR: Ask your admin to grep: 5321GDS1111661353BB.'); |
|
| 157 | + // create education object |
|
| 158 | + $education_guids = array(); |
|
| 159 | + $education_list = $user->education; |
|
| 160 | + if ($delete != null && !is_array($delete)) { |
|
| 161 | + $delete = array( $delete ); |
|
| 162 | + } |
|
| 163 | + if ( is_array($delete) ) { |
|
| 164 | + foreach ($delete as $delete_guid) { |
|
| 165 | + if ($delete_guid != NULL) { |
|
| 166 | + if ($delete = get_entity($delete_guid)) { |
|
| 167 | + $delete->delete(); |
|
| 168 | + } |
|
| 169 | + if (is_array($education_list)) { |
|
| 170 | + if (($key = array_search($delete_guid, $education_list)) !== false) { |
|
| 171 | + unset($education_list[$key]); |
|
| 172 | + } |
|
| 173 | + } elseif ($education_list == $delete_guid) { |
|
| 174 | + $education_list = null; |
|
| 175 | + } |
|
| 176 | + } |
|
| 177 | + } |
|
| 178 | + } |
|
| 179 | + $user->education = $education_list; |
|
| 180 | + if ($eguid != null && !is_array($eguid)) { |
|
| 181 | + $eguid = array( $eguid ); |
|
| 182 | + } |
|
| 183 | + //create new education entries |
|
| 184 | + if (is_array($eguid)) { |
|
| 185 | + foreach ($eguid as $k => $v) { |
|
| 186 | + $validInput = true; |
|
| 187 | + /* |
|
| 188 | 188 | if($ongoing[$k] == true){ |
| 189 | 189 | $endyear[$k] = $startyear[$k]; |
| 190 | 190 | }*/ |
| 191 | - if(trim( htmlentities($school[$k])) == '' || trim( htmlentities($degree[$k])) == '' || trim( htmlentities($field[$k])) == ''){ |
|
| 192 | - $validInput = false; |
|
| 193 | - $error == true; |
|
| 194 | - } |
|
| 195 | - /* |
|
| 191 | + if(trim( htmlentities($school[$k])) == '' || trim( htmlentities($degree[$k])) == '' || trim( htmlentities($field[$k])) == ''){ |
|
| 192 | + $validInput = false; |
|
| 193 | + $error == true; |
|
| 194 | + } |
|
| 195 | + /* |
|
| 196 | 196 | if(trim( $endyear[$k]) < trim($startyear[$k])){ |
| 197 | 197 | $validInput = false; |
| 198 | 198 | $error == true; |
| 199 | 199 | } |
| 200 | 200 | */ |
| 201 | - if($validInput == true){ |
|
| 202 | - if ($v == "new") { |
|
| 203 | - $education = new ElggObject(); |
|
| 204 | - $education->subtype = "education"; |
|
| 205 | - $education->owner_guid = $user_guid; |
|
| 206 | - } else { |
|
| 207 | - $education = get_entity($v); |
|
| 208 | - } |
|
| 209 | - $education->title = htmlentities($school[$k]); |
|
| 210 | - $education->description = htmlentities($degree[$k]); |
|
| 211 | - $education->school = htmlentities($school[$k]); |
|
| 212 | - $education->startdate = $startdate[$k]; |
|
| 213 | - $education->startyear = $startyear[$k]; |
|
| 214 | - $education->enddate = $enddate[$k]; |
|
| 215 | - $education->endyear = $endyear[$k]; |
|
| 216 | - $education->ongoing = $ongoing[$k]; |
|
| 217 | - //$education->program = htmlentities($program[$k]); |
|
| 218 | - $education->degree = htmlentities($degree[$k]); |
|
| 219 | - $education->field = htmlentities($field[$k]); |
|
| 220 | - $education->access_id = $access; |
|
| 221 | - if ($v == "new") { |
|
| 222 | - $education_guids[] = $education->save(); |
|
| 223 | - } else { |
|
| 224 | - $education->save(); |
|
| 225 | - } |
|
| 226 | - } |
|
| 227 | - } |
|
| 228 | - } |
|
| 229 | - if ($user->education == NULL) { |
|
| 230 | - $user->education = $education_guids; |
|
| 231 | - } |
|
| 232 | - else { |
|
| 233 | - $stack = $user->education; |
|
| 234 | - if (!(is_array($stack))) { $stack = array($stack); } |
|
| 235 | - if ($education_guids != NULL) { |
|
| 236 | - $user->education = array_merge($stack, $education_guids); |
|
| 237 | - } |
|
| 238 | - } |
|
| 239 | - $user->education_access = $access; |
|
| 240 | - $user->save(); |
|
| 241 | - break; |
|
| 242 | - case 'work-experience': |
|
| 243 | - $work_experience = get_input('work'); |
|
| 244 | - $edit = $work_experience['edit']; |
|
| 245 | - $delete = $work_experience['delete_guids']; |
|
| 246 | - $access = get_input('access'); |
|
| 247 | - $experience_list = $user->work; |
|
| 248 | - if (!(is_array($delete))) { $delete = array($delete); } |
|
| 249 | - foreach ($delete as $delete_guid) { |
|
| 250 | - if ($delete_guid != NULL) { |
|
| 251 | - if ($delete = get_entity($delete_guid)) { |
|
| 252 | - $delete->delete(); |
|
| 253 | - } |
|
| 254 | - if (is_array($experience_list)) { |
|
| 255 | - if (($key = array_search($delete_guid, $experience_list)) !== false) { |
|
| 256 | - unset($experience_list[$key]); |
|
| 257 | - } |
|
| 258 | - } |
|
| 259 | - elseif ($experience_list == $delete_guid) { |
|
| 260 | - $experience_list = null; |
|
| 261 | - } |
|
| 262 | - } |
|
| 263 | - } |
|
| 264 | - $user->work = $experience_list; |
|
| 265 | - $work_experience_guids = array(); |
|
| 266 | - if ($edit != null && !is_array($edit)) { |
|
| 267 | - $edit = array( $edit ); |
|
| 268 | - } |
|
| 201 | + if($validInput == true){ |
|
| 202 | + if ($v == "new") { |
|
| 203 | + $education = new ElggObject(); |
|
| 204 | + $education->subtype = "education"; |
|
| 205 | + $education->owner_guid = $user_guid; |
|
| 206 | + } else { |
|
| 207 | + $education = get_entity($v); |
|
| 208 | + } |
|
| 209 | + $education->title = htmlentities($school[$k]); |
|
| 210 | + $education->description = htmlentities($degree[$k]); |
|
| 211 | + $education->school = htmlentities($school[$k]); |
|
| 212 | + $education->startdate = $startdate[$k]; |
|
| 213 | + $education->startyear = $startyear[$k]; |
|
| 214 | + $education->enddate = $enddate[$k]; |
|
| 215 | + $education->endyear = $endyear[$k]; |
|
| 216 | + $education->ongoing = $ongoing[$k]; |
|
| 217 | + //$education->program = htmlentities($program[$k]); |
|
| 218 | + $education->degree = htmlentities($degree[$k]); |
|
| 219 | + $education->field = htmlentities($field[$k]); |
|
| 220 | + $education->access_id = $access; |
|
| 221 | + if ($v == "new") { |
|
| 222 | + $education_guids[] = $education->save(); |
|
| 223 | + } else { |
|
| 224 | + $education->save(); |
|
| 225 | + } |
|
| 226 | + } |
|
| 227 | + } |
|
| 228 | + } |
|
| 229 | + if ($user->education == NULL) { |
|
| 230 | + $user->education = $education_guids; |
|
| 231 | + } |
|
| 232 | + else { |
|
| 233 | + $stack = $user->education; |
|
| 234 | + if (!(is_array($stack))) { $stack = array($stack); } |
|
| 235 | + if ($education_guids != NULL) { |
|
| 236 | + $user->education = array_merge($stack, $education_guids); |
|
| 237 | + } |
|
| 238 | + } |
|
| 239 | + $user->education_access = $access; |
|
| 240 | + $user->save(); |
|
| 241 | + break; |
|
| 242 | + case 'work-experience': |
|
| 243 | + $work_experience = get_input('work'); |
|
| 244 | + $edit = $work_experience['edit']; |
|
| 245 | + $delete = $work_experience['delete_guids']; |
|
| 246 | + $access = get_input('access'); |
|
| 247 | + $experience_list = $user->work; |
|
| 248 | + if (!(is_array($delete))) { $delete = array($delete); } |
|
| 249 | + foreach ($delete as $delete_guid) { |
|
| 250 | + if ($delete_guid != NULL) { |
|
| 251 | + if ($delete = get_entity($delete_guid)) { |
|
| 252 | + $delete->delete(); |
|
| 253 | + } |
|
| 254 | + if (is_array($experience_list)) { |
|
| 255 | + if (($key = array_search($delete_guid, $experience_list)) !== false) { |
|
| 256 | + unset($experience_list[$key]); |
|
| 257 | + } |
|
| 258 | + } |
|
| 259 | + elseif ($experience_list == $delete_guid) { |
|
| 260 | + $experience_list = null; |
|
| 261 | + } |
|
| 262 | + } |
|
| 263 | + } |
|
| 264 | + $user->work = $experience_list; |
|
| 265 | + $work_experience_guids = array(); |
|
| 266 | + if ($edit != null && !is_array($edit)) { |
|
| 267 | + $edit = array( $edit ); |
|
| 268 | + } |
|
| 269 | 269 | |
| 270 | - //create new work experience entries |
|
| 271 | - if ( is_array($edit) ) { |
|
| 272 | - foreach ($edit as $work) { |
|
| 273 | - $validInput = true; |
|
| 274 | - /* |
|
| 270 | + //create new work experience entries |
|
| 271 | + if ( is_array($edit) ) { |
|
| 272 | + foreach ($edit as $work) { |
|
| 273 | + $validInput = true; |
|
| 274 | + /* |
|
| 275 | 275 | if($work['ongoing'] == true){ |
| 276 | 276 | $work['endyear'] = $work['startyear']; |
| 277 | 277 | } |
| 278 | 278 | */ |
| 279 | - //validation of work experience entry |
|
| 280 | - if(trim($work['title']) == '' || trim($work['organization']) == ''){ |
|
| 281 | - $validInput = false; |
|
| 282 | - $error = true; |
|
| 283 | - } |
|
| 284 | - /* |
|
| 279 | + //validation of work experience entry |
|
| 280 | + if(trim($work['title']) == '' || trim($work['organization']) == ''){ |
|
| 281 | + $validInput = false; |
|
| 282 | + $error = true; |
|
| 283 | + } |
|
| 284 | + /* |
|
| 285 | 285 | if(trim($work['endyear']) < trim($work['startyear'])){ |
| 286 | 286 | $validInput = false; |
| 287 | 287 | $error = true; |
| 288 | 288 | } |
| 289 | 289 | */ |
| 290 | - if($validInput == true) { |
|
| 291 | - if ($work['eguid'] == "new") { |
|
| 292 | - $experience = new ElggObject(); |
|
| 293 | - $experience->subtype = "experience"; |
|
| 294 | - $experience->owner_guid = $user_guid; |
|
| 295 | - } else { |
|
| 296 | - $experience = get_entity($work['eguid']); |
|
| 297 | - } |
|
| 298 | - $experience->title = htmlentities($work['title']); |
|
| 299 | - $experience->description = htmlentities($work['responsibilities']); |
|
| 300 | - $experience->organization = htmlentities($work['organization']); |
|
| 301 | - $experience->startdate = $work['startdate']; |
|
| 302 | - $experience->startyear = $work['startyear']; |
|
| 303 | - $experience->enddate = $work['enddate']; |
|
| 304 | - $experience->endyear = $work['endyear']; |
|
| 305 | - $experience->ongoing = $work['ongoing']; |
|
| 306 | - $experience->responsibilities = trim($work['responsibilities']); |
|
| 307 | - $experience->colleagues = $work['colleagues']; |
|
| 308 | - $experience->access_id = $access; |
|
| 309 | - if ($work['eguid'] == "new") { |
|
| 310 | - $work_experience_guids[] = $experience->save(); |
|
| 311 | - } else { |
|
| 312 | - $experience->save(); |
|
| 313 | - } |
|
| 314 | - } |
|
| 315 | - } |
|
| 316 | - } |
|
| 317 | - if ($user->work == NULL) { |
|
| 318 | - $user->work = $work_experience_guids; |
|
| 319 | - } |
|
| 320 | - else { |
|
| 321 | - $stack = $user->work; |
|
| 322 | - if (!(is_array($stack))) { $stack = array($stack); } |
|
| 323 | - if ($work_experience_guids != NULL) { |
|
| 324 | - $user->work = array_merge($stack, $work_experience_guids); |
|
| 325 | - } |
|
| 326 | - } |
|
| 327 | - $user->work_access = $access; |
|
| 328 | - $user->save(); |
|
| 329 | - break; |
|
| 330 | - case 'skills': |
|
| 331 | - $skillsToAdd = get_input('skillsadded', 'ERROR: Ask your admin to grep: 5FH13GAHHHS0021.'); |
|
| 332 | - $skillsToRemove = get_input('skillsremoved', 'ERROR: Ask your admin to grep: 5FH13GAHHHS0022.'); |
|
| 333 | - //$access = ACCESS_LOGGED_IN; |
|
| 334 | - $access = get_input('access'); |
|
| 335 | - //error_log('test - '.$access); |
|
| 336 | - $skill_guids = array(); |
|
| 337 | - foreach ($skillsToAdd as $new_skill) { |
|
| 338 | - $skill = new ElggObject(); |
|
| 339 | - $skill->subtype = "MySkill"; |
|
| 340 | - $skill->title = htmlentities($new_skill); |
|
| 341 | - $skill->owner_guid = $user_guid; |
|
| 342 | - $skill->access_id = $access; |
|
| 343 | - $skill->endorsements = NULL; |
|
| 344 | - $skill_guids[] = $skill->save(); |
|
| 345 | - } |
|
| 346 | - $skill_list = $user->gc_skills; |
|
| 347 | - if (!(is_array($skill_list))) { $skill_list = array($skill_list); } |
|
| 348 | - if (!(is_array($skillsToRemove))) { $skillsToRemove = array($skillsToRemove); } |
|
| 349 | - foreach ($skillsToRemove as $remove_guid) { |
|
| 350 | - if ($remove_guid != NULL) { |
|
| 351 | - if ($remove = get_entity($remove_guid)) { |
|
| 352 | - $remove->delete(); |
|
| 353 | - } |
|
| 354 | - if (($key = array_search($remove_guid, $skill_list)) !== false) { |
|
| 355 | - unset($skill_list[$key]); |
|
| 356 | - } |
|
| 357 | - } |
|
| 358 | - } |
|
| 359 | - $user->gc_skills = $skill_list; |
|
| 360 | - if ($user->gc_skills == NULL) { |
|
| 361 | - $user->gc_skills = $skill_guids; |
|
| 362 | - } |
|
| 363 | - else { |
|
| 364 | - $stack = $user->gc_skills; |
|
| 365 | - if (!(is_array($stack))) { $stack = array($stack); } |
|
| 366 | - if ($skill_guids != NULL) { |
|
| 367 | - $user->gc_skills = array_merge($stack, $skill_guids); |
|
| 368 | - } |
|
| 369 | - } |
|
| 370 | - //$user->gc_skills = null; // dev stuff... delete me |
|
| 371 | - //$user->skillsupgraded = NULL; // dev stuff.. delete me |
|
| 372 | - $user->skill_access = $access; |
|
| 373 | - $user->save(); |
|
| 290 | + if($validInput == true) { |
|
| 291 | + if ($work['eguid'] == "new") { |
|
| 292 | + $experience = new ElggObject(); |
|
| 293 | + $experience->subtype = "experience"; |
|
| 294 | + $experience->owner_guid = $user_guid; |
|
| 295 | + } else { |
|
| 296 | + $experience = get_entity($work['eguid']); |
|
| 297 | + } |
|
| 298 | + $experience->title = htmlentities($work['title']); |
|
| 299 | + $experience->description = htmlentities($work['responsibilities']); |
|
| 300 | + $experience->organization = htmlentities($work['organization']); |
|
| 301 | + $experience->startdate = $work['startdate']; |
|
| 302 | + $experience->startyear = $work['startyear']; |
|
| 303 | + $experience->enddate = $work['enddate']; |
|
| 304 | + $experience->endyear = $work['endyear']; |
|
| 305 | + $experience->ongoing = $work['ongoing']; |
|
| 306 | + $experience->responsibilities = trim($work['responsibilities']); |
|
| 307 | + $experience->colleagues = $work['colleagues']; |
|
| 308 | + $experience->access_id = $access; |
|
| 309 | + if ($work['eguid'] == "new") { |
|
| 310 | + $work_experience_guids[] = $experience->save(); |
|
| 311 | + } else { |
|
| 312 | + $experience->save(); |
|
| 313 | + } |
|
| 314 | + } |
|
| 315 | + } |
|
| 316 | + } |
|
| 317 | + if ($user->work == NULL) { |
|
| 318 | + $user->work = $work_experience_guids; |
|
| 319 | + } |
|
| 320 | + else { |
|
| 321 | + $stack = $user->work; |
|
| 322 | + if (!(is_array($stack))) { $stack = array($stack); } |
|
| 323 | + if ($work_experience_guids != NULL) { |
|
| 324 | + $user->work = array_merge($stack, $work_experience_guids); |
|
| 325 | + } |
|
| 326 | + } |
|
| 327 | + $user->work_access = $access; |
|
| 328 | + $user->save(); |
|
| 329 | + break; |
|
| 330 | + case 'skills': |
|
| 331 | + $skillsToAdd = get_input('skillsadded', 'ERROR: Ask your admin to grep: 5FH13GAHHHS0021.'); |
|
| 332 | + $skillsToRemove = get_input('skillsremoved', 'ERROR: Ask your admin to grep: 5FH13GAHHHS0022.'); |
|
| 333 | + //$access = ACCESS_LOGGED_IN; |
|
| 334 | + $access = get_input('access'); |
|
| 335 | + //error_log('test - '.$access); |
|
| 336 | + $skill_guids = array(); |
|
| 337 | + foreach ($skillsToAdd as $new_skill) { |
|
| 338 | + $skill = new ElggObject(); |
|
| 339 | + $skill->subtype = "MySkill"; |
|
| 340 | + $skill->title = htmlentities($new_skill); |
|
| 341 | + $skill->owner_guid = $user_guid; |
|
| 342 | + $skill->access_id = $access; |
|
| 343 | + $skill->endorsements = NULL; |
|
| 344 | + $skill_guids[] = $skill->save(); |
|
| 345 | + } |
|
| 346 | + $skill_list = $user->gc_skills; |
|
| 347 | + if (!(is_array($skill_list))) { $skill_list = array($skill_list); } |
|
| 348 | + if (!(is_array($skillsToRemove))) { $skillsToRemove = array($skillsToRemove); } |
|
| 349 | + foreach ($skillsToRemove as $remove_guid) { |
|
| 350 | + if ($remove_guid != NULL) { |
|
| 351 | + if ($remove = get_entity($remove_guid)) { |
|
| 352 | + $remove->delete(); |
|
| 353 | + } |
|
| 354 | + if (($key = array_search($remove_guid, $skill_list)) !== false) { |
|
| 355 | + unset($skill_list[$key]); |
|
| 356 | + } |
|
| 357 | + } |
|
| 358 | + } |
|
| 359 | + $user->gc_skills = $skill_list; |
|
| 360 | + if ($user->gc_skills == NULL) { |
|
| 361 | + $user->gc_skills = $skill_guids; |
|
| 362 | + } |
|
| 363 | + else { |
|
| 364 | + $stack = $user->gc_skills; |
|
| 365 | + if (!(is_array($stack))) { $stack = array($stack); } |
|
| 366 | + if ($skill_guids != NULL) { |
|
| 367 | + $user->gc_skills = array_merge($stack, $skill_guids); |
|
| 368 | + } |
|
| 369 | + } |
|
| 370 | + //$user->gc_skills = null; // dev stuff... delete me |
|
| 371 | + //$user->skillsupgraded = NULL; // dev stuff.. delete me |
|
| 372 | + $user->skill_access = $access; |
|
| 373 | + $user->save(); |
|
| 374 | 374 | |
| 375 | - break; |
|
| 376 | - case 'old-skills': |
|
| 377 | - $user->skillsupgraded = TRUE; |
|
| 378 | - break; |
|
| 379 | - case 'languages': |
|
| 380 | - $firstlang = get_input('firstlang', ''); |
|
| 381 | - $french = get_input('french', 'ERROR: Ask your admin to grep: ASFDJKGJKG333616.'); |
|
| 382 | - $english = get_input('english', 'ERROR: Ask your admin to grep: SDFANLVNVNVNVNVNAA31566.'); |
|
| 383 | - $languagesToAdd = get_input('langadded', 'ERROR: Ask your admin to grep: 5FH13FFSSGAHHHS0021.'); |
|
| 384 | - $languagesToRemove = get_input('langremoved', 'ERROR: Ask your admin to grep: 5AAAAGGFH13GAH0022.'); |
|
| 385 | - //$access = get_input('access'); // not used |
|
| 386 | - $access = get_input('access_id'); |
|
| 387 | - $user->english = $english; |
|
| 388 | - $user->french = $french; |
|
| 389 | - $user->officialLanguage = $firstlang; |
|
| 390 | - $user->save(); |
|
| 375 | + break; |
|
| 376 | + case 'old-skills': |
|
| 377 | + $user->skillsupgraded = TRUE; |
|
| 378 | + break; |
|
| 379 | + case 'languages': |
|
| 380 | + $firstlang = get_input('firstlang', ''); |
|
| 381 | + $french = get_input('french', 'ERROR: Ask your admin to grep: ASFDJKGJKG333616.'); |
|
| 382 | + $english = get_input('english', 'ERROR: Ask your admin to grep: SDFANLVNVNVNVNVNAA31566.'); |
|
| 383 | + $languagesToAdd = get_input('langadded', 'ERROR: Ask your admin to grep: 5FH13FFSSGAHHHS0021.'); |
|
| 384 | + $languagesToRemove = get_input('langremoved', 'ERROR: Ask your admin to grep: 5AAAAGGFH13GAH0022.'); |
|
| 385 | + //$access = get_input('access'); // not used |
|
| 386 | + $access = get_input('access_id'); |
|
| 387 | + $user->english = $english; |
|
| 388 | + $user->french = $french; |
|
| 389 | + $user->officialLanguage = $firstlang; |
|
| 390 | + $user->save(); |
|
| 391 | 391 | |
| 392 | - $metadata = elgg_get_metadata(array( |
|
| 393 | - 'metadata_names' => array('english'), |
|
| 394 | - 'metadata_owner_guids' => array(elgg_get_logged_in_user_guid()), |
|
| 395 | - )); |
|
| 396 | - if ($metadata){ |
|
| 397 | - foreach ($metadata as $data){ |
|
| 392 | + $metadata = elgg_get_metadata(array( |
|
| 393 | + 'metadata_names' => array('english'), |
|
| 394 | + 'metadata_owner_guids' => array(elgg_get_logged_in_user_guid()), |
|
| 395 | + )); |
|
| 396 | + if ($metadata){ |
|
| 397 | + foreach ($metadata as $data){ |
|
| 398 | 398 | |
| 399 | - update_metadata($data->id, $data->name, $data->value, $data->value_type, $data->owner_guid, $access); |
|
| 400 | - //error_log('id '.$data->id .' name '. $data->name.' value '. $data->value.' value type '. $data->value_type.' owner_guid '.$data->owner_guid.' $access '. $access); |
|
| 401 | - } |
|
| 402 | - //$metadata[0]->save(); |
|
| 403 | - } |
|
| 404 | - $metadata = elgg_get_metadata(array( |
|
| 405 | - 'metadata_names' => array('french'), |
|
| 406 | - 'metadata_owner_guids' => array(elgg_get_logged_in_user_guid()), |
|
| 407 | - )); |
|
| 408 | - if ($metadata){ |
|
| 409 | - foreach ($metadata as $data){ |
|
| 399 | + update_metadata($data->id, $data->name, $data->value, $data->value_type, $data->owner_guid, $access); |
|
| 400 | + //error_log('id '.$data->id .' name '. $data->name.' value '. $data->value.' value type '. $data->value_type.' owner_guid '.$data->owner_guid.' $access '. $access); |
|
| 401 | + } |
|
| 402 | + //$metadata[0]->save(); |
|
| 403 | + } |
|
| 404 | + $metadata = elgg_get_metadata(array( |
|
| 405 | + 'metadata_names' => array('french'), |
|
| 406 | + 'metadata_owner_guids' => array(elgg_get_logged_in_user_guid()), |
|
| 407 | + )); |
|
| 408 | + if ($metadata){ |
|
| 409 | + foreach ($metadata as $data){ |
|
| 410 | 410 | |
| 411 | - update_metadata($data->id, $data->name, $data->value, $data->value_type, $data->owner_guid, $access); |
|
| 412 | - } |
|
| 413 | - //$metadata[0]->save(); |
|
| 414 | - } |
|
| 415 | - $metadata = elgg_get_metadata(array( |
|
| 416 | - 'metadata_names' => array('officialLanguage'), |
|
| 417 | - 'metadata_owner_guids' => array(elgg_get_logged_in_user_guid()), |
|
| 418 | - )); |
|
| 419 | - if ($metadata){ |
|
| 420 | - foreach ($metadata as $data){ |
|
| 411 | + update_metadata($data->id, $data->name, $data->value, $data->value_type, $data->owner_guid, $access); |
|
| 412 | + } |
|
| 413 | + //$metadata[0]->save(); |
|
| 414 | + } |
|
| 415 | + $metadata = elgg_get_metadata(array( |
|
| 416 | + 'metadata_names' => array('officialLanguage'), |
|
| 417 | + 'metadata_owner_guids' => array(elgg_get_logged_in_user_guid()), |
|
| 418 | + )); |
|
| 419 | + if ($metadata){ |
|
| 420 | + foreach ($metadata as $data){ |
|
| 421 | 421 | |
| 422 | - update_metadata($data->id, $data->name, $data->value, $data->value_type, $data->owner_guid, $access); |
|
| 423 | - } |
|
| 424 | - //$metadata[0]->save(); |
|
| 425 | - } |
|
| 422 | + update_metadata($data->id, $data->name, $data->value, $data->value_type, $data->owner_guid, $access); |
|
| 423 | + } |
|
| 424 | + //$metadata[0]->save(); |
|
| 425 | + } |
|
| 426 | 426 | |
| 427 | - break; |
|
| 428 | - case 'portfolio': |
|
| 429 | - $portfolio = get_input('portfolio'); |
|
| 430 | - $edit = $portfolio['edit']; |
|
| 431 | - $delete = $portfolio['delete_guids']; |
|
| 432 | - $access = get_input('access'); |
|
| 433 | - $portfolio_list = $user->portfolio; |
|
| 434 | - if (!(is_array($delete))) { $delete = array($delete); } |
|
| 435 | - foreach ($delete as $delete_guid) { |
|
| 436 | - if ($delete_guid != NULL) { |
|
| 437 | - if ($delete = get_entity($delete_guid)) { |
|
| 438 | - $delete->delete(); |
|
| 439 | - } |
|
| 440 | - if (is_array($portfolio_list)) { |
|
| 441 | - if (($key = array_search($delete_guid, $portfolio_list)) !== false) { |
|
| 442 | - unset($portfolio_list[$key]); |
|
| 443 | - } |
|
| 444 | - } |
|
| 445 | - elseif ($portfolio_list == $delete_guid) { |
|
| 446 | - $portfolio_list = null; |
|
| 447 | - } |
|
| 448 | - } |
|
| 449 | - } |
|
| 450 | - $user->portfolio = $portfolio_list; |
|
| 451 | - $portfolio_list_guids = array(); |
|
| 452 | - //create new work experience entries |
|
| 453 | - foreach ($edit as $portfolio_edit) { |
|
| 454 | - $validInput = true; |
|
| 455 | - if(trim($portfolio_edit['title']) == '' || trim($portfolio_edit['description']) == '' || trim($portfolio_edit['link']) == ''){ |
|
| 456 | - $validInput = false; |
|
| 457 | - $error = true; |
|
| 458 | - } |
|
| 459 | - if($portfolio_edit['datestamped'] == false && trim( $portfolio_edit['pubdate']) == ''){ |
|
| 460 | - $validInput = false; |
|
| 461 | - $error = true; |
|
| 462 | - } |
|
| 463 | - if($validInput == true){ |
|
| 464 | - if ($portfolio_edit['eguid'] == "new") { |
|
| 465 | - $entry = new ElggObject(); |
|
| 466 | - $entry->subtype = "portfolio"; |
|
| 467 | - $entry->owner_guid = $user_guid; |
|
| 468 | - } |
|
| 469 | - else { |
|
| 470 | - $entry = get_entity($portfolio_edit['eguid']); |
|
| 471 | - } |
|
| 472 | - $entry->title = htmlentities($portfolio_edit['title']); |
|
| 473 | - $entry->description = htmlentities($portfolio_edit['description']); |
|
| 474 | - $entry->link = $portfolio_edit['link']; |
|
| 475 | - $entry->pubdate = $portfolio_edit['pubdate']; |
|
| 476 | - $entry->datestamped = $portfolio_edit['datestamped']; |
|
| 477 | - $entry->access_id = $access; |
|
| 478 | - if($portfolio_edit['eguid'] == "new") { |
|
| 479 | - $portfolio_list_guids[] = $entry->save(); |
|
| 480 | - } |
|
| 481 | - else { |
|
| 482 | - $entry->save(); |
|
| 483 | - } |
|
| 484 | - } |
|
| 485 | - } |
|
| 486 | - if ($user->portfolio == NULL) { |
|
| 487 | - $user->portfolio = $portfolio_list_guids; |
|
| 488 | - } |
|
| 489 | - else { |
|
| 490 | - $stack = $user->portfolio; |
|
| 491 | - if (!(is_array($stack))) { $stack = array($stack); } |
|
| 492 | - if ($portfolio_list_guids != NULL) { |
|
| 493 | - $user->portfolio = array_merge($stack, $portfolio_list_guids); |
|
| 494 | - } |
|
| 495 | - } |
|
| 496 | - //$user->portfolio = null; |
|
| 497 | - $user->portfolio_access = $access; |
|
| 498 | - $user->save(); |
|
| 499 | - break; |
|
| 427 | + break; |
|
| 428 | + case 'portfolio': |
|
| 429 | + $portfolio = get_input('portfolio'); |
|
| 430 | + $edit = $portfolio['edit']; |
|
| 431 | + $delete = $portfolio['delete_guids']; |
|
| 432 | + $access = get_input('access'); |
|
| 433 | + $portfolio_list = $user->portfolio; |
|
| 434 | + if (!(is_array($delete))) { $delete = array($delete); } |
|
| 435 | + foreach ($delete as $delete_guid) { |
|
| 436 | + if ($delete_guid != NULL) { |
|
| 437 | + if ($delete = get_entity($delete_guid)) { |
|
| 438 | + $delete->delete(); |
|
| 439 | + } |
|
| 440 | + if (is_array($portfolio_list)) { |
|
| 441 | + if (($key = array_search($delete_guid, $portfolio_list)) !== false) { |
|
| 442 | + unset($portfolio_list[$key]); |
|
| 443 | + } |
|
| 444 | + } |
|
| 445 | + elseif ($portfolio_list == $delete_guid) { |
|
| 446 | + $portfolio_list = null; |
|
| 447 | + } |
|
| 448 | + } |
|
| 449 | + } |
|
| 450 | + $user->portfolio = $portfolio_list; |
|
| 451 | + $portfolio_list_guids = array(); |
|
| 452 | + //create new work experience entries |
|
| 453 | + foreach ($edit as $portfolio_edit) { |
|
| 454 | + $validInput = true; |
|
| 455 | + if(trim($portfolio_edit['title']) == '' || trim($portfolio_edit['description']) == '' || trim($portfolio_edit['link']) == ''){ |
|
| 456 | + $validInput = false; |
|
| 457 | + $error = true; |
|
| 458 | + } |
|
| 459 | + if($portfolio_edit['datestamped'] == false && trim( $portfolio_edit['pubdate']) == ''){ |
|
| 460 | + $validInput = false; |
|
| 461 | + $error = true; |
|
| 462 | + } |
|
| 463 | + if($validInput == true){ |
|
| 464 | + if ($portfolio_edit['eguid'] == "new") { |
|
| 465 | + $entry = new ElggObject(); |
|
| 466 | + $entry->subtype = "portfolio"; |
|
| 467 | + $entry->owner_guid = $user_guid; |
|
| 468 | + } |
|
| 469 | + else { |
|
| 470 | + $entry = get_entity($portfolio_edit['eguid']); |
|
| 471 | + } |
|
| 472 | + $entry->title = htmlentities($portfolio_edit['title']); |
|
| 473 | + $entry->description = htmlentities($portfolio_edit['description']); |
|
| 474 | + $entry->link = $portfolio_edit['link']; |
|
| 475 | + $entry->pubdate = $portfolio_edit['pubdate']; |
|
| 476 | + $entry->datestamped = $portfolio_edit['datestamped']; |
|
| 477 | + $entry->access_id = $access; |
|
| 478 | + if($portfolio_edit['eguid'] == "new") { |
|
| 479 | + $portfolio_list_guids[] = $entry->save(); |
|
| 480 | + } |
|
| 481 | + else { |
|
| 482 | + $entry->save(); |
|
| 483 | + } |
|
| 484 | + } |
|
| 485 | + } |
|
| 486 | + if ($user->portfolio == NULL) { |
|
| 487 | + $user->portfolio = $portfolio_list_guids; |
|
| 488 | + } |
|
| 489 | + else { |
|
| 490 | + $stack = $user->portfolio; |
|
| 491 | + if (!(is_array($stack))) { $stack = array($stack); } |
|
| 492 | + if ($portfolio_list_guids != NULL) { |
|
| 493 | + $user->portfolio = array_merge($stack, $portfolio_list_guids); |
|
| 494 | + } |
|
| 495 | + } |
|
| 496 | + //$user->portfolio = null; |
|
| 497 | + $user->portfolio_access = $access; |
|
| 498 | + $user->save(); |
|
| 499 | + break; |
|
| 500 | 500 | |
| 501 | - /* |
|
| 501 | + /* |
|
| 502 | 502 | * MODIFIED CODE! |
| 503 | 503 | * optset is the array of opt-in choices and gets directly saved as a metadata array (cannot be associative). |
| 504 | 504 | * access is not currently being used for anything. |
| 505 | 505 | */ |
| 506 | - case 'opt-in': |
|
| 507 | - $opt_in_set = get_input('opt_in_set'); |
|
| 508 | - $access = get_input('access'); |
|
| 506 | + case 'opt-in': |
|
| 507 | + $opt_in_set = get_input('opt_in_set'); |
|
| 508 | + $access = get_input('access'); |
|
| 509 | 509 | |
| 510 | - $user->opt_in_missions = $opt_in_set[0]; |
|
| 511 | - $user->opt_in_swap = $opt_in_set[1]; |
|
| 512 | - $user->opt_in_mentored = $opt_in_set[2]; |
|
| 513 | - $user->opt_in_mentoring = $opt_in_set[3]; |
|
| 514 | - $user->opt_in_shadowed = $opt_in_set[4]; |
|
| 515 | - $user->opt_in_shadowing = $opt_in_set[5]; |
|
| 516 | - $user->opt_in_jobshare = $opt_in_set[6]; |
|
| 517 | - $user->opt_in_pcSeek = $opt_in_set[7]; |
|
| 518 | - $user->opt_in_pcCreate = $opt_in_set[8]; |
|
| 519 | - $user->opt_in_ssSeek = $opt_in_set[9]; |
|
| 520 | - $user->opt_in_ssCreate = $opt_in_set[10]; |
|
| 521 | - $user->opt_in_rotation = $opt_in_set[11]; |
|
| 522 | - $user->opt_in_assignSeek = $opt_in_set[12]; |
|
| 523 | - $user->opt_in_assignCreate = $opt_in_set[13]; |
|
| 524 | - $user->opt_in_deploySeek = $opt_in_set[14]; |
|
| 525 | - $user->opt_in_deployCreate = $opt_in_set[15]; |
|
| 526 | - $user->opt_in_missionCreate = $opt_in_set[16]; |
|
| 527 | - /*$user->opt_in_peer_coached = $opt_in_set[6]; |
|
| 510 | + $user->opt_in_missions = $opt_in_set[0]; |
|
| 511 | + $user->opt_in_swap = $opt_in_set[1]; |
|
| 512 | + $user->opt_in_mentored = $opt_in_set[2]; |
|
| 513 | + $user->opt_in_mentoring = $opt_in_set[3]; |
|
| 514 | + $user->opt_in_shadowed = $opt_in_set[4]; |
|
| 515 | + $user->opt_in_shadowing = $opt_in_set[5]; |
|
| 516 | + $user->opt_in_jobshare = $opt_in_set[6]; |
|
| 517 | + $user->opt_in_pcSeek = $opt_in_set[7]; |
|
| 518 | + $user->opt_in_pcCreate = $opt_in_set[8]; |
|
| 519 | + $user->opt_in_ssSeek = $opt_in_set[9]; |
|
| 520 | + $user->opt_in_ssCreate = $opt_in_set[10]; |
|
| 521 | + $user->opt_in_rotation = $opt_in_set[11]; |
|
| 522 | + $user->opt_in_assignSeek = $opt_in_set[12]; |
|
| 523 | + $user->opt_in_assignCreate = $opt_in_set[13]; |
|
| 524 | + $user->opt_in_deploySeek = $opt_in_set[14]; |
|
| 525 | + $user->opt_in_deployCreate = $opt_in_set[15]; |
|
| 526 | + $user->opt_in_missionCreate = $opt_in_set[16]; |
|
| 527 | + /*$user->opt_in_peer_coached = $opt_in_set[6]; |
|
| 528 | 528 | $user->opt_in_peer_coaching = $opt_in_set[7]; |
| 529 | 529 | $user->opt_in_skill_sharing = $opt_in_set[8]; |
| 530 | 530 | $user->opt_in_job_sharing = $opt_in_set[9];*/ |
| 531 | 531 | |
| 532 | - // Not saving this at the moment because it is not in use. |
|
| 533 | - //$user->optaccess = $access; |
|
| 532 | + // Not saving this at the moment because it is not in use. |
|
| 533 | + //$user->optaccess = $access; |
|
| 534 | 534 | |
| 535 | - $user->save(); |
|
| 535 | + $user->save(); |
|
| 536 | 536 | |
| 537 | - break; |
|
| 538 | - /* |
|
| 537 | + break; |
|
| 538 | + /* |
|
| 539 | 539 | * END MODIFIED CODE |
| 540 | 540 | */ |
| 541 | 541 | |
| 542 | - default: |
|
| 543 | - system_message(elgg_echo("profile:saved")); |
|
| 544 | - } |
|
| 545 | - //system_message(elgg_echo("profile:saved")); |
|
| 546 | - if($error == true){ |
|
| 547 | - register_error(elgg_echo('Not all information could be saved, empty fields are not allowed')); |
|
| 548 | - } else { |
|
| 549 | - system_message(elgg_echo("profile:saved")); |
|
| 550 | - } |
|
| 542 | + default: |
|
| 543 | + system_message(elgg_echo("profile:saved")); |
|
| 544 | + } |
|
| 545 | + //system_message(elgg_echo("profile:saved")); |
|
| 546 | + if($error == true){ |
|
| 547 | + register_error(elgg_echo('Not all information could be saved, empty fields are not allowed')); |
|
| 548 | + } else { |
|
| 549 | + system_message(elgg_echo("profile:saved")); |
|
| 550 | + } |
|
| 551 | 551 | } |
| 552 | 552 | else { // In case this view will be called via the elgg_view_form() action, then we know it's the basic profile only |
| 553 | 553 | } |
@@ -9,12 +9,12 @@ discard block |
||
| 9 | 9 | $profile_fields = get_input('profile'); |
| 10 | 10 | $social_media = get_input('social_media'); |
| 11 | 11 | $error_message = ''; |
| 12 | - foreach ( $profile_fields as $f => $v ) { |
|
| 12 | + foreach ($profile_fields as $f => $v) { |
|
| 13 | 13 | // cyu - check if email field is empty |
| 14 | 14 | if ($f === "email") { |
| 15 | - trim($v); // remove white spaces from both sides of string |
|
| 15 | + trim($v); // remove white spaces from both sides of string |
|
| 16 | 16 | if (!$v) { |
| 17 | - register_error(elgg_echo('gcc_profile:error').elgg_echo('gcc_profile:missingemail')); |
|
| 17 | + register_error(elgg_echo('gcc_profile:error') . elgg_echo('gcc_profile:missingemail')); |
|
| 18 | 18 | return true; |
| 19 | 19 | } |
| 20 | 20 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | if ($v) { |
| 25 | 25 | // cyu - check if the email is in the list of exceptions |
| 26 | - $user_email = explode('@',$v); |
|
| 26 | + $user_email = explode('@', $v); |
|
| 27 | 27 | $list_of_domains = getExtension(); |
| 28 | 28 | if (count($list_of_domains) > 0) { |
| 29 | 29 | while ($row = mysqli_fetch_array($list_of_domains)) { |
@@ -32,17 +32,17 @@ discard block |
||
| 32 | 32 | break; |
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | - $error_message = elgg_echo('gcc_profile:error').elgg_echo('gcc_profile:notaccepted'); |
|
| 35 | + $error_message = elgg_echo('gcc_profile:error') . elgg_echo('gcc_profile:notaccepted'); |
|
| 36 | 36 | } |
| 37 | 37 | // cyu - check if domain is gc.ca |
| 38 | 38 | if (!$isValid) { |
| 39 | - $govt_domain = explode('.',$user_email[1]); |
|
| 39 | + $govt_domain = explode('.', $user_email[1]); |
|
| 40 | 40 | $govt_domain_len = count($govt_domain) - 1; |
| 41 | - if ($govt_domain[$govt_domain_len - 1].'.'.$govt_domain[$govt_domain_len] === 'gc.ca') { |
|
| 41 | + if ($govt_domain[$govt_domain_len - 1] . '.' . $govt_domain[$govt_domain_len] === 'gc.ca') { |
|
| 42 | 42 | $isValid = true; |
| 43 | 43 | } else { |
| 44 | 44 | $isValid = false; |
| 45 | - $error_message = elgg_echo('gcc_profile:error').elgg_echo('gcc_profile:notaccepted'); |
|
| 45 | + $error_message = elgg_echo('gcc_profile:error') . elgg_echo('gcc_profile:notaccepted'); |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $user->set($f, $v); |
| 54 | 54 | } |
| 55 | 55 | else { |
| 56 | - if($f=='department'){ |
|
| 56 | + if ($f == 'department') { |
|
| 57 | 57 | $obj = elgg_get_entities(array( |
| 58 | 58 | 'type' => 'object', |
| 59 | 59 | 'subtype' => 'dept_list', |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $provinces['pov-que'] = 'Government of Quebec'; |
| 74 | 74 | $provinces['pov-sask'] = 'Government of Saskatchewan'; |
| 75 | 75 | $provinces['pov-yuk'] = 'Government of Yukon'; |
| 76 | - $departmentsEn = array_merge($departmentsEn,$provinces); |
|
| 76 | + $departmentsEn = array_merge($departmentsEn, $provinces); |
|
| 77 | 77 | |
| 78 | 78 | $departmentsFr = json_decode($obj[0]->deptsFr, true); |
| 79 | 79 | $provincesFr['pov-alb'] = "Gouvernement de l'Alberta"; |
@@ -89,20 +89,20 @@ discard block |
||
| 89 | 89 | $provincesFr['pov-que'] = 'Gouvernement du Qu�bec'; |
| 90 | 90 | $provincesFr['pov-sask'] = 'Gouvernement de Saskatchewan'; |
| 91 | 91 | $provincesFr['pov-yuk'] = 'Gouvernement du Yukon'; |
| 92 | - $departmentsFr = array_merge($departmentsFr,$provincesFr); |
|
| 92 | + $departmentsFr = array_merge($departmentsFr, $provincesFr); |
|
| 93 | 93 | |
| 94 | - if (get_current_language()=='en'){ |
|
| 95 | - $deptString = $departmentsEn[$v]." / ".$departmentsFr[$v]; |
|
| 96 | - }else{ |
|
| 97 | - $deptString = $departmentsFr[$v]." / ".$departmentsEn[$v]; |
|
| 94 | + if (get_current_language() == 'en') { |
|
| 95 | + $deptString = $departmentsEn[$v] . " / " . $departmentsFr[$v]; |
|
| 96 | + } else { |
|
| 97 | + $deptString = $departmentsFr[$v] . " / " . $departmentsEn[$v]; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $user->set('department',$deptString); |
|
| 100 | + $user->set('department', $deptString); |
|
| 101 | 101 | |
| 102 | - }else if($f == 'location' && $v) { |
|
| 102 | + } else if ($f == 'location' && $v) { |
|
| 103 | 103 | |
| 104 | 104 | //check to see if addressString exists |
| 105 | - if($user->addressString && $user->addressStringFr){ |
|
| 105 | + if ($user->addressString && $user->addressStringFr) { |
|
| 106 | 106 | |
| 107 | 107 | //split up location field value |
| 108 | 108 | $address = explode(',', $v); |
@@ -110,8 +110,8 @@ discard block |
||
| 110 | 110 | //Add cut up location field to address string |
| 111 | 111 | //if user enters a proper address the address wil display nicely. If not the map will not display right |
| 112 | 112 | //sadly we cannot extract all the same information from the location field properly to complete the json string |
| 113 | - $user->addressString = '{"street":"'.$address[0].'","city":"'.$address[1].'","province":"'.$address[2].'","country":"Canada","pc":""}'; |
|
| 114 | - $user->addressStringFr = '{"street":"'.$address[0].'","city":"'.$address[1].'","province":"'.$address[2].'","country":"Canada","pc":""}'; |
|
| 113 | + $user->addressString = '{"street":"' . $address[0] . '","city":"' . $address[1] . '","province":"' . $address[2] . '","country":"Canada","pc":""}'; |
|
| 114 | + $user->addressStringFr = '{"street":"' . $address[0] . '","city":"' . $address[1] . '","province":"' . $address[2] . '","country":"Canada","pc":""}'; |
|
| 115 | 115 | |
| 116 | 116 | } |
| 117 | 117 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | - foreach ( $social_media as $f => $v ) { |
|
| 128 | + foreach ($social_media as $f => $v) { |
|
| 129 | 129 | $link = $v; |
| 130 | 130 | if (filter_var($link, FILTER_VALIDATE_URL) == false) { |
| 131 | 131 | $user->set($f, $link); |
@@ -158,9 +158,9 @@ discard block |
||
| 158 | 158 | $education_guids = array(); |
| 159 | 159 | $education_list = $user->education; |
| 160 | 160 | if ($delete != null && !is_array($delete)) { |
| 161 | - $delete = array( $delete ); |
|
| 161 | + $delete = array($delete); |
|
| 162 | 162 | } |
| 163 | - if ( is_array($delete) ) { |
|
| 163 | + if (is_array($delete)) { |
|
| 164 | 164 | foreach ($delete as $delete_guid) { |
| 165 | 165 | if ($delete_guid != NULL) { |
| 166 | 166 | if ($delete = get_entity($delete_guid)) { |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | } |
| 179 | 179 | $user->education = $education_list; |
| 180 | 180 | if ($eguid != null && !is_array($eguid)) { |
| 181 | - $eguid = array( $eguid ); |
|
| 181 | + $eguid = array($eguid); |
|
| 182 | 182 | } |
| 183 | 183 | //create new education entries |
| 184 | 184 | if (is_array($eguid)) { |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | if($ongoing[$k] == true){ |
| 189 | 189 | $endyear[$k] = $startyear[$k]; |
| 190 | 190 | }*/ |
| 191 | - if(trim( htmlentities($school[$k])) == '' || trim( htmlentities($degree[$k])) == '' || trim( htmlentities($field[$k])) == ''){ |
|
| 191 | + if (trim(htmlentities($school[$k])) == '' || trim(htmlentities($degree[$k])) == '' || trim(htmlentities($field[$k])) == '') { |
|
| 192 | 192 | $validInput = false; |
| 193 | 193 | $error == true; |
| 194 | 194 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | $error == true; |
| 199 | 199 | } |
| 200 | 200 | */ |
| 201 | - if($validInput == true){ |
|
| 201 | + if ($validInput == true) { |
|
| 202 | 202 | if ($v == "new") { |
| 203 | 203 | $education = new ElggObject(); |
| 204 | 204 | $education->subtype = "education"; |
@@ -264,11 +264,11 @@ discard block |
||
| 264 | 264 | $user->work = $experience_list; |
| 265 | 265 | $work_experience_guids = array(); |
| 266 | 266 | if ($edit != null && !is_array($edit)) { |
| 267 | - $edit = array( $edit ); |
|
| 267 | + $edit = array($edit); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | //create new work experience entries |
| 271 | - if ( is_array($edit) ) { |
|
| 271 | + if (is_array($edit)) { |
|
| 272 | 272 | foreach ($edit as $work) { |
| 273 | 273 | $validInput = true; |
| 274 | 274 | /* |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | } |
| 278 | 278 | */ |
| 279 | 279 | //validation of work experience entry |
| 280 | - if(trim($work['title']) == '' || trim($work['organization']) == ''){ |
|
| 280 | + if (trim($work['title']) == '' || trim($work['organization']) == '') { |
|
| 281 | 281 | $validInput = false; |
| 282 | 282 | $error = true; |
| 283 | 283 | } |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | $error = true; |
| 288 | 288 | } |
| 289 | 289 | */ |
| 290 | - if($validInput == true) { |
|
| 290 | + if ($validInput == true) { |
|
| 291 | 291 | if ($work['eguid'] == "new") { |
| 292 | 292 | $experience = new ElggObject(); |
| 293 | 293 | $experience->subtype = "experience"; |
@@ -393,8 +393,8 @@ discard block |
||
| 393 | 393 | 'metadata_names' => array('english'), |
| 394 | 394 | 'metadata_owner_guids' => array(elgg_get_logged_in_user_guid()), |
| 395 | 395 | )); |
| 396 | - if ($metadata){ |
|
| 397 | - foreach ($metadata as $data){ |
|
| 396 | + if ($metadata) { |
|
| 397 | + foreach ($metadata as $data) { |
|
| 398 | 398 | |
| 399 | 399 | update_metadata($data->id, $data->name, $data->value, $data->value_type, $data->owner_guid, $access); |
| 400 | 400 | //error_log('id '.$data->id .' name '. $data->name.' value '. $data->value.' value type '. $data->value_type.' owner_guid '.$data->owner_guid.' $access '. $access); |
@@ -405,8 +405,8 @@ discard block |
||
| 405 | 405 | 'metadata_names' => array('french'), |
| 406 | 406 | 'metadata_owner_guids' => array(elgg_get_logged_in_user_guid()), |
| 407 | 407 | )); |
| 408 | - if ($metadata){ |
|
| 409 | - foreach ($metadata as $data){ |
|
| 408 | + if ($metadata) { |
|
| 409 | + foreach ($metadata as $data) { |
|
| 410 | 410 | |
| 411 | 411 | update_metadata($data->id, $data->name, $data->value, $data->value_type, $data->owner_guid, $access); |
| 412 | 412 | } |
@@ -416,8 +416,8 @@ discard block |
||
| 416 | 416 | 'metadata_names' => array('officialLanguage'), |
| 417 | 417 | 'metadata_owner_guids' => array(elgg_get_logged_in_user_guid()), |
| 418 | 418 | )); |
| 419 | - if ($metadata){ |
|
| 420 | - foreach ($metadata as $data){ |
|
| 419 | + if ($metadata) { |
|
| 420 | + foreach ($metadata as $data) { |
|
| 421 | 421 | |
| 422 | 422 | update_metadata($data->id, $data->name, $data->value, $data->value_type, $data->owner_guid, $access); |
| 423 | 423 | } |
@@ -452,15 +452,15 @@ discard block |
||
| 452 | 452 | //create new work experience entries |
| 453 | 453 | foreach ($edit as $portfolio_edit) { |
| 454 | 454 | $validInput = true; |
| 455 | - if(trim($portfolio_edit['title']) == '' || trim($portfolio_edit['description']) == '' || trim($portfolio_edit['link']) == ''){ |
|
| 455 | + if (trim($portfolio_edit['title']) == '' || trim($portfolio_edit['description']) == '' || trim($portfolio_edit['link']) == '') { |
|
| 456 | 456 | $validInput = false; |
| 457 | 457 | $error = true; |
| 458 | 458 | } |
| 459 | - if($portfolio_edit['datestamped'] == false && trim( $portfolio_edit['pubdate']) == ''){ |
|
| 459 | + if ($portfolio_edit['datestamped'] == false && trim($portfolio_edit['pubdate']) == '') { |
|
| 460 | 460 | $validInput = false; |
| 461 | 461 | $error = true; |
| 462 | 462 | } |
| 463 | - if($validInput == true){ |
|
| 463 | + if ($validInput == true) { |
|
| 464 | 464 | if ($portfolio_edit['eguid'] == "new") { |
| 465 | 465 | $entry = new ElggObject(); |
| 466 | 466 | $entry->subtype = "portfolio"; |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | $entry->pubdate = $portfolio_edit['pubdate']; |
| 476 | 476 | $entry->datestamped = $portfolio_edit['datestamped']; |
| 477 | 477 | $entry->access_id = $access; |
| 478 | - if($portfolio_edit['eguid'] == "new") { |
|
| 478 | + if ($portfolio_edit['eguid'] == "new") { |
|
| 479 | 479 | $portfolio_list_guids[] = $entry->save(); |
| 480 | 480 | } |
| 481 | 481 | else { |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | system_message(elgg_echo("profile:saved")); |
| 544 | 544 | } |
| 545 | 545 | //system_message(elgg_echo("profile:saved")); |
| 546 | - if($error == true){ |
|
| 546 | + if ($error == true) { |
|
| 547 | 547 | register_error(elgg_echo('Not all information could be saved, empty fields are not allowed')); |
| 548 | 548 | } else { |
| 549 | 549 | system_message(elgg_echo("profile:saved")); |
@@ -51,8 +51,7 @@ discard block |
||
| 51 | 51 | return true; |
| 52 | 52 | } |
| 53 | 53 | $user->set($f, $v); |
| 54 | - } |
|
| 55 | - else { |
|
| 54 | + } else { |
|
| 56 | 55 | if($f=='department'){ |
| 57 | 56 | $obj = elgg_get_entities(array( |
| 58 | 57 | 'type' => 'object', |
@@ -93,13 +92,13 @@ discard block |
||
| 93 | 92 | |
| 94 | 93 | if (get_current_language()=='en'){ |
| 95 | 94 | $deptString = $departmentsEn[$v]." / ".$departmentsFr[$v]; |
| 96 | - }else{ |
|
| 95 | + } else{ |
|
| 97 | 96 | $deptString = $departmentsFr[$v]." / ".$departmentsEn[$v]; |
| 98 | 97 | } |
| 99 | 98 | |
| 100 | 99 | $user->set('department',$deptString); |
| 101 | 100 | |
| 102 | - }else if($f == 'location' && $v) { |
|
| 101 | + } else if($f == 'location' && $v) { |
|
| 103 | 102 | |
| 104 | 103 | //check to see if addressString exists |
| 105 | 104 | if($user->addressString && $user->addressStringFr){ |
@@ -228,8 +227,7 @@ discard block |
||
| 228 | 227 | } |
| 229 | 228 | if ($user->education == NULL) { |
| 230 | 229 | $user->education = $education_guids; |
| 231 | - } |
|
| 232 | - else { |
|
| 230 | + } else { |
|
| 233 | 231 | $stack = $user->education; |
| 234 | 232 | if (!(is_array($stack))) { $stack = array($stack); } |
| 235 | 233 | if ($education_guids != NULL) { |
@@ -255,8 +253,7 @@ discard block |
||
| 255 | 253 | if (($key = array_search($delete_guid, $experience_list)) !== false) { |
| 256 | 254 | unset($experience_list[$key]); |
| 257 | 255 | } |
| 258 | - } |
|
| 259 | - elseif ($experience_list == $delete_guid) { |
|
| 256 | + } elseif ($experience_list == $delete_guid) { |
|
| 260 | 257 | $experience_list = null; |
| 261 | 258 | } |
| 262 | 259 | } |
@@ -316,8 +313,7 @@ discard block |
||
| 316 | 313 | } |
| 317 | 314 | if ($user->work == NULL) { |
| 318 | 315 | $user->work = $work_experience_guids; |
| 319 | - } |
|
| 320 | - else { |
|
| 316 | + } else { |
|
| 321 | 317 | $stack = $user->work; |
| 322 | 318 | if (!(is_array($stack))) { $stack = array($stack); } |
| 323 | 319 | if ($work_experience_guids != NULL) { |
@@ -359,8 +355,7 @@ discard block |
||
| 359 | 355 | $user->gc_skills = $skill_list; |
| 360 | 356 | if ($user->gc_skills == NULL) { |
| 361 | 357 | $user->gc_skills = $skill_guids; |
| 362 | - } |
|
| 363 | - else { |
|
| 358 | + } else { |
|
| 364 | 359 | $stack = $user->gc_skills; |
| 365 | 360 | if (!(is_array($stack))) { $stack = array($stack); } |
| 366 | 361 | if ($skill_guids != NULL) { |
@@ -441,8 +436,7 @@ discard block |
||
| 441 | 436 | if (($key = array_search($delete_guid, $portfolio_list)) !== false) { |
| 442 | 437 | unset($portfolio_list[$key]); |
| 443 | 438 | } |
| 444 | - } |
|
| 445 | - elseif ($portfolio_list == $delete_guid) { |
|
| 439 | + } elseif ($portfolio_list == $delete_guid) { |
|
| 446 | 440 | $portfolio_list = null; |
| 447 | 441 | } |
| 448 | 442 | } |
@@ -465,8 +459,7 @@ discard block |
||
| 465 | 459 | $entry = new ElggObject(); |
| 466 | 460 | $entry->subtype = "portfolio"; |
| 467 | 461 | $entry->owner_guid = $user_guid; |
| 468 | - } |
|
| 469 | - else { |
|
| 462 | + } else { |
|
| 470 | 463 | $entry = get_entity($portfolio_edit['eguid']); |
| 471 | 464 | } |
| 472 | 465 | $entry->title = htmlentities($portfolio_edit['title']); |
@@ -477,16 +470,14 @@ discard block |
||
| 477 | 470 | $entry->access_id = $access; |
| 478 | 471 | if($portfolio_edit['eguid'] == "new") { |
| 479 | 472 | $portfolio_list_guids[] = $entry->save(); |
| 480 | - } |
|
| 481 | - else { |
|
| 473 | + } else { |
|
| 482 | 474 | $entry->save(); |
| 483 | 475 | } |
| 484 | 476 | } |
| 485 | 477 | } |
| 486 | 478 | if ($user->portfolio == NULL) { |
| 487 | 479 | $user->portfolio = $portfolio_list_guids; |
| 488 | - } |
|
| 489 | - else { |
|
| 480 | + } else { |
|
| 490 | 481 | $stack = $user->portfolio; |
| 491 | 482 | if (!(is_array($stack))) { $stack = array($stack); } |
| 492 | 483 | if ($portfolio_list_guids != NULL) { |
@@ -548,6 +539,5 @@ discard block |
||
| 548 | 539 | } else { |
| 549 | 540 | system_message(elgg_echo("profile:saved")); |
| 550 | 541 | } |
| 551 | -} |
|
| 552 | -else { // In case this view will be called via the elgg_view_form() action, then we know it's the basic profile only |
|
| 542 | +} else { // In case this view will be called via the elgg_view_form() action, then we know it's the basic profile only |
|
| 553 | 543 | } |
@@ -12,49 +12,49 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | foreach ($departments as $d) { |
| 14 | 14 | error_log(print_r('$d[title_en] = ' . $d['title_en'], true)); |
| 15 | - // full word at start of skill title |
|
| 16 | - if (strpos(strtolower(' ' . $d['title_en']) . ' ', ' ' . strtolower($query) . ' ') === 0 || |
|
| 17 | - strpos(strtolower(' ' . $d['title_fr']) . ' ', ' ' . strtolower($query) . ' ') === 0 ) { |
|
| 18 | - $result[] = array( |
|
| 19 | - 'value' => $d['title_en'] . ' / ' . $d['title_fr'], |
|
| 20 | - 'pos' => 0 |
|
| 21 | - ); |
|
| 22 | - } |
|
| 15 | + // full word at start of skill title |
|
| 16 | + if (strpos(strtolower(' ' . $d['title_en']) . ' ', ' ' . strtolower($query) . ' ') === 0 || |
|
| 17 | + strpos(strtolower(' ' . $d['title_fr']) . ' ', ' ' . strtolower($query) . ' ') === 0 ) { |
|
| 18 | + $result[] = array( |
|
| 19 | + 'value' => $d['title_en'] . ' / ' . $d['title_fr'], |
|
| 20 | + 'pos' => 0 |
|
| 21 | + ); |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - // full word somewhere in skill title |
|
| 25 | - elseif (strpos(strtolower(' ' . $d['title_en']) . ' ', ' ' . strtolower($query) . ' ') !== FALSE || |
|
| 26 | - strpos(strtolower(' ' . $d['title_fr']) . ' ', ' ' . strtolower($query) . ' ') !== FALSE ) { |
|
| 27 | - $result[] = array( |
|
| 28 | - 'value' => $d['title_en'] . ' / ' . $d['title_fr'], |
|
| 29 | - 'pos' => 1 |
|
| 30 | - ); |
|
| 31 | - } |
|
| 24 | + // full word somewhere in skill title |
|
| 25 | + elseif (strpos(strtolower(' ' . $d['title_en']) . ' ', ' ' . strtolower($query) . ' ') !== FALSE || |
|
| 26 | + strpos(strtolower(' ' . $d['title_fr']) . ' ', ' ' . strtolower($query) . ' ') !== FALSE ) { |
|
| 27 | + $result[] = array( |
|
| 28 | + 'value' => $d['title_en'] . ' / ' . $d['title_fr'], |
|
| 29 | + 'pos' => 1 |
|
| 30 | + ); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - // partial word at start of skill title |
|
| 34 | - elseif (strpos(strtolower(' ' . $d['title_en']), ' ' . strtolower($query)) === 0 || |
|
| 35 | - strpos(strtolower(' ' . $d['title_fr']), ' ' . strtolower($query)) === 0 ) { |
|
| 36 | - $result[] = array( |
|
| 37 | - 'value' => $d['title_en'] . ' / ' . $d['title_fr'], |
|
| 38 | - 'pos' => 2 |
|
| 39 | - ); |
|
| 40 | - } |
|
| 33 | + // partial word at start of skill title |
|
| 34 | + elseif (strpos(strtolower(' ' . $d['title_en']), ' ' . strtolower($query)) === 0 || |
|
| 35 | + strpos(strtolower(' ' . $d['title_fr']), ' ' . strtolower($query)) === 0 ) { |
|
| 36 | + $result[] = array( |
|
| 37 | + 'value' => $d['title_en'] . ' / ' . $d['title_fr'], |
|
| 38 | + 'pos' => 2 |
|
| 39 | + ); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - //partial word somewhere in skill title |
|
| 43 | - elseif (strpos(strtolower(' ' . $d['title_en']), ' ' . strtolower($query)) !== FALSE || |
|
| 44 | - strpos(strtolower(' ' . $d['title_fr']), ' ' . strtolower($query)) !== FALSE ) { |
|
| 45 | - $result[] = array( |
|
| 46 | - 'value' => $d['title_en'] . ' / ' . $d['title_fr'], |
|
| 47 | - 'pos' => 3 |
|
| 48 | - ); |
|
| 49 | - } |
|
| 42 | + //partial word somewhere in skill title |
|
| 43 | + elseif (strpos(strtolower(' ' . $d['title_en']), ' ' . strtolower($query)) !== FALSE || |
|
| 44 | + strpos(strtolower(' ' . $d['title_fr']), ' ' . strtolower($query)) !== FALSE ) { |
|
| 45 | + $result[] = array( |
|
| 46 | + 'value' => $d['title_en'] . ' / ' . $d['title_fr'], |
|
| 47 | + 'pos' => 3 |
|
| 48 | + ); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - elseif (strpos(strtolower($d['title_en']), strtolower($query)) !== FALSE || |
|
| 52 | - strpos(strtolower($d['title_fr']), strtolower($query)) !== FALSE ) { |
|
| 53 | - $result[] = array( |
|
| 54 | - 'value' => $d['title_en'] . ' / ' . $d['title_fr'], |
|
| 55 | - 'pos' => 4 |
|
| 56 | - ); |
|
| 57 | - } |
|
| 51 | + elseif (strpos(strtolower($d['title_en']), strtolower($query)) !== FALSE || |
|
| 52 | + strpos(strtolower($d['title_fr']), strtolower($query)) !== FALSE ) { |
|
| 53 | + $result[] = array( |
|
| 54 | + 'value' => $d['title_en'] . ' / ' . $d['title_fr'], |
|
| 55 | + 'pos' => 4 |
|
| 56 | + ); |
|
| 57 | + } |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | $highest_relevance = array(); |
@@ -64,21 +64,21 @@ discard block |
||
| 64 | 64 | $lowest_relevance = array(); |
| 65 | 65 | |
| 66 | 66 | foreach ( $result as $r ) { |
| 67 | - if ( $r['pos'] == 0 ) { |
|
| 68 | - $highest_relevance[] = $r; |
|
| 69 | - } |
|
| 70 | - elseif ( $r['pos'] == 1 ) { |
|
| 71 | - $high_relevance[] = $r; |
|
| 72 | - } |
|
| 73 | - elseif ( $r['pos'] == 2 ) { |
|
| 74 | - $med_relevance[] = $r; |
|
| 75 | - } |
|
| 76 | - elseif ( $r['pos'] == 3 ) { |
|
| 77 | - $low_relevance[] = $r; |
|
| 78 | - } |
|
| 79 | - elseif ( $r['pos'] == 4 ) { |
|
| 80 | - $lowest_relevance[] = $r; |
|
| 81 | - } |
|
| 67 | + if ( $r['pos'] == 0 ) { |
|
| 68 | + $highest_relevance[] = $r; |
|
| 69 | + } |
|
| 70 | + elseif ( $r['pos'] == 1 ) { |
|
| 71 | + $high_relevance[] = $r; |
|
| 72 | + } |
|
| 73 | + elseif ( $r['pos'] == 2 ) { |
|
| 74 | + $med_relevance[] = $r; |
|
| 75 | + } |
|
| 76 | + elseif ( $r['pos'] == 3 ) { |
|
| 77 | + $low_relevance[] = $r; |
|
| 78 | + } |
|
| 79 | + elseif ( $r['pos'] == 4 ) { |
|
| 80 | + $lowest_relevance[] = $r; |
|
| 81 | + } |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $result = array_merge($highest_relevance, $high_relevance, $med_relevance, $low_relevance, $lowest_relevance); |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | error_log(print_r('$d[title_en] = ' . $d['title_en'], true)); |
| 15 | 15 | // full word at start of skill title |
| 16 | 16 | if (strpos(strtolower(' ' . $d['title_en']) . ' ', ' ' . strtolower($query) . ' ') === 0 || |
| 17 | - strpos(strtolower(' ' . $d['title_fr']) . ' ', ' ' . strtolower($query) . ' ') === 0 ) { |
|
| 17 | + strpos(strtolower(' ' . $d['title_fr']) . ' ', ' ' . strtolower($query) . ' ') === 0) { |
|
| 18 | 18 | $result[] = array( |
| 19 | 19 | 'value' => $d['title_en'] . ' / ' . $d['title_fr'], |
| 20 | 20 | 'pos' => 0 |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | // full word somewhere in skill title |
| 25 | 25 | elseif (strpos(strtolower(' ' . $d['title_en']) . ' ', ' ' . strtolower($query) . ' ') !== FALSE || |
| 26 | - strpos(strtolower(' ' . $d['title_fr']) . ' ', ' ' . strtolower($query) . ' ') !== FALSE ) { |
|
| 26 | + strpos(strtolower(' ' . $d['title_fr']) . ' ', ' ' . strtolower($query) . ' ') !== FALSE) { |
|
| 27 | 27 | $result[] = array( |
| 28 | 28 | 'value' => $d['title_en'] . ' / ' . $d['title_fr'], |
| 29 | 29 | 'pos' => 1 |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | // partial word at start of skill title |
| 34 | 34 | elseif (strpos(strtolower(' ' . $d['title_en']), ' ' . strtolower($query)) === 0 || |
| 35 | - strpos(strtolower(' ' . $d['title_fr']), ' ' . strtolower($query)) === 0 ) { |
|
| 35 | + strpos(strtolower(' ' . $d['title_fr']), ' ' . strtolower($query)) === 0) { |
|
| 36 | 36 | $result[] = array( |
| 37 | 37 | 'value' => $d['title_en'] . ' / ' . $d['title_fr'], |
| 38 | 38 | 'pos' => 2 |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | //partial word somewhere in skill title |
| 43 | 43 | elseif (strpos(strtolower(' ' . $d['title_en']), ' ' . strtolower($query)) !== FALSE || |
| 44 | - strpos(strtolower(' ' . $d['title_fr']), ' ' . strtolower($query)) !== FALSE ) { |
|
| 44 | + strpos(strtolower(' ' . $d['title_fr']), ' ' . strtolower($query)) !== FALSE) { |
|
| 45 | 45 | $result[] = array( |
| 46 | 46 | 'value' => $d['title_en'] . ' / ' . $d['title_fr'], |
| 47 | 47 | 'pos' => 3 |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | elseif (strpos(strtolower($d['title_en']), strtolower($query)) !== FALSE || |
| 52 | - strpos(strtolower($d['title_fr']), strtolower($query)) !== FALSE ) { |
|
| 52 | + strpos(strtolower($d['title_fr']), strtolower($query)) !== FALSE) { |
|
| 53 | 53 | $result[] = array( |
| 54 | 54 | 'value' => $d['title_en'] . ' / ' . $d['title_fr'], |
| 55 | 55 | 'pos' => 4 |
@@ -63,20 +63,20 @@ discard block |
||
| 63 | 63 | $low_relevance = array(); |
| 64 | 64 | $lowest_relevance = array(); |
| 65 | 65 | |
| 66 | -foreach ( $result as $r ) { |
|
| 67 | - if ( $r['pos'] == 0 ) { |
|
| 66 | +foreach ($result as $r) { |
|
| 67 | + if ($r['pos'] == 0) { |
|
| 68 | 68 | $highest_relevance[] = $r; |
| 69 | 69 | } |
| 70 | - elseif ( $r['pos'] == 1 ) { |
|
| 70 | + elseif ($r['pos'] == 1) { |
|
| 71 | 71 | $high_relevance[] = $r; |
| 72 | 72 | } |
| 73 | - elseif ( $r['pos'] == 2 ) { |
|
| 73 | + elseif ($r['pos'] == 2) { |
|
| 74 | 74 | $med_relevance[] = $r; |
| 75 | 75 | } |
| 76 | - elseif ( $r['pos'] == 3 ) { |
|
| 76 | + elseif ($r['pos'] == 3) { |
|
| 77 | 77 | $low_relevance[] = $r; |
| 78 | 78 | } |
| 79 | - elseif ( $r['pos'] == 4 ) { |
|
| 79 | + elseif ($r['pos'] == 4) { |
|
| 80 | 80 | $lowest_relevance[] = $r; |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -46,9 +46,7 @@ discard block |
||
| 46 | 46 | 'value' => $d['title_en'] . ' / ' . $d['title_fr'], |
| 47 | 47 | 'pos' => 3 |
| 48 | 48 | ); |
| 49 | - } |
|
| 50 | - |
|
| 51 | - elseif (strpos(strtolower($d['title_en']), strtolower($query)) !== FALSE || |
|
| 49 | + } elseif (strpos(strtolower($d['title_en']), strtolower($query)) !== FALSE || |
|
| 52 | 50 | strpos(strtolower($d['title_fr']), strtolower($query)) !== FALSE ) { |
| 53 | 51 | $result[] = array( |
| 54 | 52 | 'value' => $d['title_en'] . ' / ' . $d['title_fr'], |
@@ -66,17 +64,13 @@ discard block |
||
| 66 | 64 | foreach ( $result as $r ) { |
| 67 | 65 | if ( $r['pos'] == 0 ) { |
| 68 | 66 | $highest_relevance[] = $r; |
| 69 | - } |
|
| 70 | - elseif ( $r['pos'] == 1 ) { |
|
| 67 | + } elseif ( $r['pos'] == 1 ) { |
|
| 71 | 68 | $high_relevance[] = $r; |
| 72 | - } |
|
| 73 | - elseif ( $r['pos'] == 2 ) { |
|
| 69 | + } elseif ( $r['pos'] == 2 ) { |
|
| 74 | 70 | $med_relevance[] = $r; |
| 75 | - } |
|
| 76 | - elseif ( $r['pos'] == 3 ) { |
|
| 71 | + } elseif ( $r['pos'] == 3 ) { |
|
| 77 | 72 | $low_relevance[] = $r; |
| 78 | - } |
|
| 79 | - elseif ( $r['pos'] == 4 ) { |
|
| 73 | + } elseif ( $r['pos'] == 4 ) { |
|
| 80 | 74 | $lowest_relevance[] = $r; |
| 81 | 75 | } |
| 82 | 76 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | $mission = get_entity(get_input('mid')); |
| 11 | 11 | $manager = get_user(get_input('aid')); |
| 12 | 12 | |
| 13 | -if($manager->missions_hide_list == '') { |
|
| 13 | +if ($manager->missions_hide_list == '') { |
|
| 14 | 14 | $manager->missions_hide_list = $mission->guid; |
| 15 | 15 | } |
| 16 | 16 | else { |
@@ -12,8 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | if($manager->missions_hide_list == '') { |
| 14 | 14 | $manager->missions_hide_list = $mission->guid; |
| 15 | -} |
|
| 16 | -else { |
|
| 15 | +} else { |
|
| 17 | 16 | $manager->missions_hide_list = $manager->missions_hide_list . ',' . $mission->guid; |
| 18 | 17 | } |
| 19 | 18 | $manager->save(); |
@@ -10,76 +10,76 @@ discard block |
||
| 10 | 10 | elgg_register_event_handler('init', 'system', 'b_extended_profile_init'); |
| 11 | 11 | |
| 12 | 12 | function b_extended_profile_init() { |
| 13 | - // Register the endorsements js library |
|
| 14 | - $url = 'mod/b_extended_profile/js/endorsements/'; |
|
| 15 | - // js file containing code for edit, save, cancel toggles and the events that they trigger, plus more |
|
| 16 | - elgg_register_js('gcconnex-profile', $url . "gcconnex-profile.js"); |
|
| 17 | - // Register vendor js libraries |
|
| 18 | - $url = 'mod/b_extended_profile/vendors/'; |
|
| 19 | - // elgg_register_js('typeahead', $url . 'typeahead/dist/typeahead.bundle.js'); // developer version typeahead js file !!! COMMENT THIS OuT AND ENABLE MINIFIED VERSIoN IN PRODcd |
|
| 20 | - elgg_register_js('fancybox', 'vendors/jquery/fancybox/jquery.fancybox-1.3.4.pack.js'); |
|
| 21 | - elgg_register_js('typeahead', $url . 'typeahead/dist/typeahead.bundle.min.js'); // minified typeahead js file |
|
| 22 | - |
|
| 23 | - // Overriding the original javascript file with the modified version. |
|
| 24 | - // The modified version adds code to the ready, editProfile and saveProfile functions. |
|
| 25 | - elgg_register_js('gcconnex-profile', 'mod/b_extended_profile/js/endorsements/gcconnex-profile.js'); |
|
| 26 | - |
|
| 27 | - // Register the gcconnex profile css libraries |
|
| 28 | - $css_url = 'mod/b_extended_profile/css/gcconnex-profile.css'; |
|
| 29 | - elgg_register_css('gcconnex-css', $css_url); |
|
| 30 | - |
|
| 31 | - /* register views |
|
| 13 | + // Register the endorsements js library |
|
| 14 | + $url = 'mod/b_extended_profile/js/endorsements/'; |
|
| 15 | + // js file containing code for edit, save, cancel toggles and the events that they trigger, plus more |
|
| 16 | + elgg_register_js('gcconnex-profile', $url . "gcconnex-profile.js"); |
|
| 17 | + // Register vendor js libraries |
|
| 18 | + $url = 'mod/b_extended_profile/vendors/'; |
|
| 19 | + // elgg_register_js('typeahead', $url . 'typeahead/dist/typeahead.bundle.js'); // developer version typeahead js file !!! COMMENT THIS OuT AND ENABLE MINIFIED VERSIoN IN PRODcd |
|
| 20 | + elgg_register_js('fancybox', 'vendors/jquery/fancybox/jquery.fancybox-1.3.4.pack.js'); |
|
| 21 | + elgg_register_js('typeahead', $url . 'typeahead/dist/typeahead.bundle.min.js'); // minified typeahead js file |
|
| 22 | + |
|
| 23 | + // Overriding the original javascript file with the modified version. |
|
| 24 | + // The modified version adds code to the ready, editProfile and saveProfile functions. |
|
| 25 | + elgg_register_js('gcconnex-profile', 'mod/b_extended_profile/js/endorsements/gcconnex-profile.js'); |
|
| 26 | + |
|
| 27 | + // Register the gcconnex profile css libraries |
|
| 28 | + $css_url = 'mod/b_extended_profile/css/gcconnex-profile.css'; |
|
| 29 | + elgg_register_css('gcconnex-css', $css_url); |
|
| 30 | + |
|
| 31 | + /* register views |
|
| 32 | 32 | register ajax views for all profile sections that are allowed to be edited and displayed via ajax |
| 33 | 33 | display views |
| 34 | 34 | see views/default/profile/wrapper.php for information on adding a new section to the user profile */ |
| 35 | - elgg_register_ajax_view('b_extended_profile/about-me'); |
|
| 36 | - elgg_register_ajax_view('b_extended_profile/education'); |
|
| 37 | - elgg_register_ajax_view('b_extended_profile/work-experience'); |
|
| 38 | - elgg_register_ajax_view('b_extended_profile/endorsements'); |
|
| 39 | - elgg_register_ajax_view('b_extended_profile/languages'); |
|
| 40 | - elgg_register_ajax_view('b_extended_profile/portfolio'); |
|
| 41 | - //Troy T. Lawson |
|
| 42 | - elgg_register_ajax_view('b_extended_profile/skills-access'); |
|
| 43 | - |
|
| 44 | - |
|
| 45 | - // edit views |
|
| 46 | - elgg_register_ajax_view('b_extended_profile/edit_about-me'); |
|
| 47 | - elgg_register_ajax_view('b_extended_profile/edit_education'); |
|
| 48 | - elgg_register_ajax_view('b_extended_profile/edit_work-experience'); |
|
| 49 | - elgg_register_ajax_view('b_extended_profile/edit_languages'); |
|
| 50 | - elgg_register_ajax_view('b_extended_profile/edit_portfolio'); |
|
| 51 | - |
|
| 52 | - // endorsement lightbox |
|
| 53 | - elgg_register_ajax_view('endorse/endorsement'); |
|
| 54 | - |
|
| 55 | - // input views |
|
| 56 | - elgg_register_ajax_view('input/education'); |
|
| 57 | - elgg_register_ajax_view('input/work-experience'); |
|
| 58 | - elgg_register_ajax_view('input/languages'); |
|
| 59 | - elgg_register_ajax_view('input/portfolio'); |
|
| 60 | - |
|
| 61 | - // auto-complete |
|
| 62 | - elgg_register_ajax_view('b_extended_profile/edit_basic'); // ajax view for editing the basic profile fields like name, title, department, email, etc. |
|
| 63 | - |
|
| 64 | - // The new views used for the Opt-In section. |
|
| 65 | - elgg_register_ajax_view('b_extended_profile/opt-in'); |
|
| 66 | - elgg_register_ajax_view('b_extended_profile/edit_opt-in'); |
|
| 67 | - |
|
| 68 | - // register the action for saving profile fields |
|
| 69 | - $action_path = elgg_get_plugins_path() . 'b_extended_profile/actions/b_extended_profile/'; |
|
| 70 | - elgg_register_action('b_extended_profile/edit_profile', $action_path . 'edit_profile.php'); |
|
| 71 | - elgg_register_action('b_extended_profile/add_endorsement', $action_path . 'add_endorsement.php'); |
|
| 72 | - elgg_register_action('b_extended_profile/retract_endorsement', $action_path . 'retract_endorsement.php'); |
|
| 73 | - elgg_register_action('b_extended_profile/user_find', $action_path . 'userfind.php', "public"); |
|
| 35 | + elgg_register_ajax_view('b_extended_profile/about-me'); |
|
| 36 | + elgg_register_ajax_view('b_extended_profile/education'); |
|
| 37 | + elgg_register_ajax_view('b_extended_profile/work-experience'); |
|
| 38 | + elgg_register_ajax_view('b_extended_profile/endorsements'); |
|
| 39 | + elgg_register_ajax_view('b_extended_profile/languages'); |
|
| 40 | + elgg_register_ajax_view('b_extended_profile/portfolio'); |
|
| 41 | + //Troy T. Lawson |
|
| 42 | + elgg_register_ajax_view('b_extended_profile/skills-access'); |
|
| 43 | + |
|
| 44 | + |
|
| 45 | + // edit views |
|
| 46 | + elgg_register_ajax_view('b_extended_profile/edit_about-me'); |
|
| 47 | + elgg_register_ajax_view('b_extended_profile/edit_education'); |
|
| 48 | + elgg_register_ajax_view('b_extended_profile/edit_work-experience'); |
|
| 49 | + elgg_register_ajax_view('b_extended_profile/edit_languages'); |
|
| 50 | + elgg_register_ajax_view('b_extended_profile/edit_portfolio'); |
|
| 51 | + |
|
| 52 | + // endorsement lightbox |
|
| 53 | + elgg_register_ajax_view('endorse/endorsement'); |
|
| 54 | + |
|
| 55 | + // input views |
|
| 56 | + elgg_register_ajax_view('input/education'); |
|
| 57 | + elgg_register_ajax_view('input/work-experience'); |
|
| 58 | + elgg_register_ajax_view('input/languages'); |
|
| 59 | + elgg_register_ajax_view('input/portfolio'); |
|
| 60 | + |
|
| 61 | + // auto-complete |
|
| 62 | + elgg_register_ajax_view('b_extended_profile/edit_basic'); // ajax view for editing the basic profile fields like name, title, department, email, etc. |
|
| 63 | + |
|
| 64 | + // The new views used for the Opt-In section. |
|
| 65 | + elgg_register_ajax_view('b_extended_profile/opt-in'); |
|
| 66 | + elgg_register_ajax_view('b_extended_profile/edit_opt-in'); |
|
| 67 | + |
|
| 68 | + // register the action for saving profile fields |
|
| 69 | + $action_path = elgg_get_plugins_path() . 'b_extended_profile/actions/b_extended_profile/'; |
|
| 70 | + elgg_register_action('b_extended_profile/edit_profile', $action_path . 'edit_profile.php'); |
|
| 71 | + elgg_register_action('b_extended_profile/add_endorsement', $action_path . 'add_endorsement.php'); |
|
| 72 | + elgg_register_action('b_extended_profile/retract_endorsement', $action_path . 'retract_endorsement.php'); |
|
| 73 | + elgg_register_action('b_extended_profile/user_find', $action_path . 'userfind.php', "public"); |
|
| 74 | 74 | |
| 75 | - // The new action saves the data gathered from the new views. |
|
| 76 | - elgg_register_action('b_extended_profile/hide-completed-mission', elgg_get_plugins_path() . 'b_extended_profile/actions/b_extended_profile/hide-completed-mission.php'); |
|
| 77 | - elgg_register_action('b_extended_profile/missions-access-form', elgg_get_plugins_path() . 'b_extended_profile/actions/b_extended_profile/missions-access-form.php'); |
|
| 78 | - elgg_register_action('b_extended_profile/show-completed-mission', elgg_get_plugins_path() . 'b_extended_profile/actions/b_extended_profile/show-completed-mission.php'); |
|
| 75 | + // The new action saves the data gathered from the new views. |
|
| 76 | + elgg_register_action('b_extended_profile/hide-completed-mission', elgg_get_plugins_path() . 'b_extended_profile/actions/b_extended_profile/hide-completed-mission.php'); |
|
| 77 | + elgg_register_action('b_extended_profile/missions-access-form', elgg_get_plugins_path() . 'b_extended_profile/actions/b_extended_profile/missions-access-form.php'); |
|
| 78 | + elgg_register_action('b_extended_profile/show-completed-mission', elgg_get_plugins_path() . 'b_extended_profile/actions/b_extended_profile/show-completed-mission.php'); |
|
| 79 | 79 | |
| 80 | 80 | |
| 81 | - elgg_register_page_handler('userfind', 'userfind_page_handler'); |
|
| 82 | - elgg_register_page_handler('profile', 'extended_profile_page_handler'); |
|
| 81 | + elgg_register_page_handler('userfind', 'userfind_page_handler'); |
|
| 82 | + elgg_register_page_handler('profile', 'extended_profile_page_handler'); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /* |
@@ -88,43 +88,43 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | function extended_profile_page_handler($page) { |
| 90 | 90 | |
| 91 | - if (isset($page[0])) { |
|
| 92 | - $username = $page[0]; |
|
| 93 | - $user = get_user_by_username($username); |
|
| 94 | - elgg_set_page_owner_guid($user->guid); |
|
| 95 | - } elseif (elgg_is_logged_in()) { |
|
| 96 | - forward(elgg_get_logged_in_user_entity()->getURL()); |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - // short circuit if invalid or banned username |
|
| 100 | - if (!$user || ($user->isBanned() && !elgg_is_admin_logged_in())) { |
|
| 101 | - register_error(elgg_echo('profile:notfound')); |
|
| 102 | - forward(); |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - $action = NULL; |
|
| 106 | - if (isset($page[1])) { |
|
| 107 | - $action = $page[1]; |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - if ($action == 'edit') { |
|
| 111 | - // use the core profile edit page |
|
| 112 | - $base_dir = elgg_get_root_path(); |
|
| 113 | - require "{$base_dir}pages/profile/edit.php"; |
|
| 114 | - return true; |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - // main profile page |
|
| 118 | - $params = array( |
|
| 119 | - 'content' => elgg_view('profile/wrapper'), |
|
| 120 | - 'num_columns' => 3, |
|
| 121 | - ); |
|
| 122 | - $content = elgg_view_layout('profile_widgets', $params); |
|
| 123 | - $sidebar = elgg_view('profile/sidebar', array('entity' => $user)); |
|
| 124 | - |
|
| 125 | - $body = elgg_view_layout('one_sidebar', array('content' => $content, 'sidebar' => $sidebar,)); |
|
| 126 | - echo elgg_view_page(elgg_echo('profile:title', array($user->name)), $body); |
|
| 127 | - return true; |
|
| 91 | + if (isset($page[0])) { |
|
| 92 | + $username = $page[0]; |
|
| 93 | + $user = get_user_by_username($username); |
|
| 94 | + elgg_set_page_owner_guid($user->guid); |
|
| 95 | + } elseif (elgg_is_logged_in()) { |
|
| 96 | + forward(elgg_get_logged_in_user_entity()->getURL()); |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + // short circuit if invalid or banned username |
|
| 100 | + if (!$user || ($user->isBanned() && !elgg_is_admin_logged_in())) { |
|
| 101 | + register_error(elgg_echo('profile:notfound')); |
|
| 102 | + forward(); |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + $action = NULL; |
|
| 106 | + if (isset($page[1])) { |
|
| 107 | + $action = $page[1]; |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + if ($action == 'edit') { |
|
| 111 | + // use the core profile edit page |
|
| 112 | + $base_dir = elgg_get_root_path(); |
|
| 113 | + require "{$base_dir}pages/profile/edit.php"; |
|
| 114 | + return true; |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + // main profile page |
|
| 118 | + $params = array( |
|
| 119 | + 'content' => elgg_view('profile/wrapper'), |
|
| 120 | + 'num_columns' => 3, |
|
| 121 | + ); |
|
| 122 | + $content = elgg_view_layout('profile_widgets', $params); |
|
| 123 | + $sidebar = elgg_view('profile/sidebar', array('entity' => $user)); |
|
| 124 | + |
|
| 125 | + $body = elgg_view_layout('one_sidebar', array('content' => $content, 'sidebar' => $sidebar,)); |
|
| 126 | + echo elgg_view_page(elgg_echo('profile:title', array($user->name)), $body); |
|
| 127 | + return true; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /* |
@@ -132,70 +132,70 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | function init_ajax_block($title, $section, $user) { |
| 134 | 134 | |
| 135 | - switch($section){ |
|
| 136 | - case 'about-me': |
|
| 137 | - $field = elgg_echo('gcconnex_profile:about_me'); |
|
| 138 | - break; |
|
| 139 | - case 'education': |
|
| 140 | - $field = elgg_echo('gcconnex_profile:education'); |
|
| 141 | - break; |
|
| 142 | - case 'work-experience': |
|
| 143 | - $field = elgg_echo('gcconnex_profile:experience'); |
|
| 144 | - break; |
|
| 145 | - case 'skills': |
|
| 146 | - $field = elgg_echo('gcconnex_profile:gc_skills'); |
|
| 147 | - break; |
|
| 148 | - case 'languages': |
|
| 149 | - $field = elgg_echo('gcconnex_profile:langs'); |
|
| 150 | - break; |
|
| 151 | - case 'portfolio': |
|
| 152 | - $field = elgg_echo('gcconnex_profile:portfolio'); |
|
| 153 | - break; |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - echo '<div class="panel panel-custom">'; |
|
| 157 | - echo '<div class="panel-heading profile-heading clearfix"><h2 class="profile-info-head panel-title pull-left clearfix">' . $title . '</h2>'; // create the profile section title |
|
| 158 | - |
|
| 159 | - if ($user->canEdit()) { |
|
| 160 | - // create the edit/save/cancel toggles for this section |
|
| 161 | - echo '<span class="gcconnex-profile-edit-controls">'; |
|
| 162 | - echo '<button title="Edit ' . $section . '" class="btn btn-default edit-' . $section . '">' . elgg_echo('gcconnex_profile:edit') . ' <span class="wb-inv">' . $field . '</span></button>'; |
|
| 163 | - |
|
| 164 | - echo '</span>'; |
|
| 165 | - } |
|
| 166 | - echo '</div>'; |
|
| 167 | - // create the profile section wrapper div for css styling |
|
| 168 | - echo '<div id="edit-' . $section . '" tabindex="-1" class="gcconnex-profile-section-wrapper panel-body gcconnex-' . $section . '">'; |
|
| 135 | + switch($section){ |
|
| 136 | + case 'about-me': |
|
| 137 | + $field = elgg_echo('gcconnex_profile:about_me'); |
|
| 138 | + break; |
|
| 139 | + case 'education': |
|
| 140 | + $field = elgg_echo('gcconnex_profile:education'); |
|
| 141 | + break; |
|
| 142 | + case 'work-experience': |
|
| 143 | + $field = elgg_echo('gcconnex_profile:experience'); |
|
| 144 | + break; |
|
| 145 | + case 'skills': |
|
| 146 | + $field = elgg_echo('gcconnex_profile:gc_skills'); |
|
| 147 | + break; |
|
| 148 | + case 'languages': |
|
| 149 | + $field = elgg_echo('gcconnex_profile:langs'); |
|
| 150 | + break; |
|
| 151 | + case 'portfolio': |
|
| 152 | + $field = elgg_echo('gcconnex_profile:portfolio'); |
|
| 153 | + break; |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + echo '<div class="panel panel-custom">'; |
|
| 157 | + echo '<div class="panel-heading profile-heading clearfix"><h2 class="profile-info-head panel-title pull-left clearfix">' . $title . '</h2>'; // create the profile section title |
|
| 158 | + |
|
| 159 | + if ($user->canEdit()) { |
|
| 160 | + // create the edit/save/cancel toggles for this section |
|
| 161 | + echo '<span class="gcconnex-profile-edit-controls">'; |
|
| 162 | + echo '<button title="Edit ' . $section . '" class="btn btn-default edit-' . $section . '">' . elgg_echo('gcconnex_profile:edit') . ' <span class="wb-inv">' . $field . '</span></button>'; |
|
| 163 | + |
|
| 164 | + echo '</span>'; |
|
| 165 | + } |
|
| 166 | + echo '</div>'; |
|
| 167 | + // create the profile section wrapper div for css styling |
|
| 168 | + echo '<div id="edit-' . $section . '" tabindex="-1" class="gcconnex-profile-section-wrapper panel-body gcconnex-' . $section . '">'; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | function finit_ajax_block($section) { |
| 172 | 172 | |
| 173 | - switch($section){ |
|
| 174 | - case 'about-me': |
|
| 175 | - $field = elgg_echo('gcconnex_profile:about_me'); |
|
| 176 | - break; |
|
| 177 | - case 'education': |
|
| 178 | - $field = elgg_echo('gcconnex_profile:education'); |
|
| 179 | - break; |
|
| 180 | - case 'work-experience': |
|
| 181 | - $field = elgg_echo('gcconnex_profile:experience'); |
|
| 182 | - break; |
|
| 183 | - case 'skills': |
|
| 184 | - $field = elgg_echo('gcconnex_profile:gc_skills'); |
|
| 185 | - break; |
|
| 186 | - case 'languages': |
|
| 187 | - $field = elgg_echo('gcconnex_profile:langs'); |
|
| 188 | - break; |
|
| 189 | - case 'portfolio': |
|
| 190 | - $field = elgg_echo('gcconnex_profile:portfolio'); |
|
| 191 | - break; |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - echo '</div>'; |
|
| 195 | - echo '<div class="panel-footer text-right clearfix save-' . $section . ' hidden wb-invisible">'; |
|
| 196 | - echo '<button title="Save ' . $section . '" class="btn btn-primary mrgn-rght-sm save-control save-' . $section . ' hidden wb-invisible">' . elgg_echo('gcconnex_profile:save') . ' <span class="wb-inv">' . $field . '</span></button>'; |
|
| 197 | - echo '<button title="Cancel ' . $section . '" class="btn btn-default cancel-control cancel-' . $section . ' hidden wb-invisible">' . elgg_echo('gcconnex_profile:cancel') . ' <span class="wb-inv">' . $field . '</span></button>'; |
|
| 198 | - echo '</div></div>'; |
|
| 173 | + switch($section){ |
|
| 174 | + case 'about-me': |
|
| 175 | + $field = elgg_echo('gcconnex_profile:about_me'); |
|
| 176 | + break; |
|
| 177 | + case 'education': |
|
| 178 | + $field = elgg_echo('gcconnex_profile:education'); |
|
| 179 | + break; |
|
| 180 | + case 'work-experience': |
|
| 181 | + $field = elgg_echo('gcconnex_profile:experience'); |
|
| 182 | + break; |
|
| 183 | + case 'skills': |
|
| 184 | + $field = elgg_echo('gcconnex_profile:gc_skills'); |
|
| 185 | + break; |
|
| 186 | + case 'languages': |
|
| 187 | + $field = elgg_echo('gcconnex_profile:langs'); |
|
| 188 | + break; |
|
| 189 | + case 'portfolio': |
|
| 190 | + $field = elgg_echo('gcconnex_profile:portfolio'); |
|
| 191 | + break; |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + echo '</div>'; |
|
| 195 | + echo '<div class="panel-footer text-right clearfix save-' . $section . ' hidden wb-invisible">'; |
|
| 196 | + echo '<button title="Save ' . $section . '" class="btn btn-primary mrgn-rght-sm save-control save-' . $section . ' hidden wb-invisible">' . elgg_echo('gcconnex_profile:save') . ' <span class="wb-inv">' . $field . '</span></button>'; |
|
| 197 | + echo '<button title="Cancel ' . $section . '" class="btn btn-default cancel-control cancel-' . $section . ' hidden wb-invisible">' . elgg_echo('gcconnex_profile:cancel') . ' <span class="wb-inv">' . $field . '</span></button>'; |
|
| 198 | + echo '</div></div>'; |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /* |
@@ -203,133 +203,133 @@ discard block |
||
| 203 | 203 | */ |
| 204 | 204 | function userfind_page_handler() { |
| 205 | 205 | |
| 206 | - $user_friends = get_user_friends(elgg_get_logged_in_user_guid(), null, 0); |
|
| 207 | - $query = htmlspecialchars($_GET['query']); |
|
| 208 | - $result = array(); |
|
| 209 | - |
|
| 210 | - foreach ($user_friends as $u) { |
|
| 211 | - |
|
| 212 | - // Complete match for first name |
|
| 213 | - if (strpos(strtolower(' ' . $u['name']) . ' ', ' ' . strtolower($query) . ' ') === 0 ) { |
|
| 214 | - $result[] = array( |
|
| 215 | - 'value' => $u->get('name'), |
|
| 216 | - 'guid' => $u->get('guid'), |
|
| 217 | - 'pic' => elgg_view_entity_icon($u, 'tiny', array( |
|
| 218 | - 'use_hover' => false, |
|
| 219 | - 'href' => false)), |
|
| 220 | - 'avatar' => elgg_view_entity_icon($u, 'small', array( |
|
| 221 | - 'use_hover' => false, |
|
| 222 | - 'href' => false)), |
|
| 223 | - 'pos' => 0 |
|
| 224 | - ); |
|
| 225 | - } |
|
| 226 | - |
|
| 227 | - // Complete match for name (first, middle or last) |
|
| 228 | - elseif (strpos(strtolower(' ' . $u['name']) . ' ', ' ' . strtolower($query) . ' ') !== FALSE) { |
|
| 229 | - $result[] = array( |
|
| 230 | - 'value' => $u->get('name'), |
|
| 231 | - 'guid' => $u->get('guid'), |
|
| 232 | - 'pic' => elgg_view_entity_icon($u, 'tiny', array( |
|
| 233 | - 'use_hover' => false, |
|
| 234 | - 'href' => false)), |
|
| 235 | - 'avatar' => elgg_view_entity_icon($u, 'small', array( |
|
| 236 | - 'use_hover' => false, |
|
| 237 | - 'href' => false)), |
|
| 238 | - 'pos' => 1 |
|
| 239 | - ); |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - // Partial match beginning at start of first name |
|
| 243 | - elseif (strpos(strtolower(' ' . $u['name']), ' ' . strtolower($query)) === 0 ) { |
|
| 244 | - $result[] = array( |
|
| 245 | - 'value' => $u->get('name'), |
|
| 246 | - 'guid' => $u->get('guid'), |
|
| 247 | - 'pic' => elgg_view_entity_icon($u, 'tiny', array( |
|
| 248 | - 'use_hover' => false, |
|
| 249 | - 'href' => false)), |
|
| 250 | - 'avatar' => elgg_view_entity_icon($u, 'small', array( |
|
| 251 | - 'use_hover' => false, |
|
| 252 | - 'href' => false)), |
|
| 253 | - 'pos' => 2 |
|
| 254 | - ); |
|
| 255 | - } |
|
| 256 | - |
|
| 257 | - // Partial match beginning at start of some name (middle, last) |
|
| 258 | - elseif (strpos(strtolower(' ' . $u['name']), ' ' . strtolower($query)) !== FALSE) { |
|
| 259 | - $result[] = array( |
|
| 260 | - 'value' => $u->get('name'), |
|
| 261 | - 'guid' => $u->get('guid'), |
|
| 262 | - 'pic' => elgg_view_entity_icon($u, 'tiny', array( |
|
| 263 | - 'use_hover' => false, |
|
| 264 | - 'href' => false)), |
|
| 265 | - 'avatar' => elgg_view_entity_icon($u, 'small', array( |
|
| 266 | - 'use_hover' => false, |
|
| 267 | - 'href' => false)), |
|
| 268 | - 'pos' => 3 |
|
| 269 | - ); |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - // Partial match somewhere within some name |
|
| 273 | - elseif (strpos(strtolower($u['name']), strtolower($query)) !== FALSE) { |
|
| 274 | - $result[] = array( |
|
| 275 | - 'value' => $u->get('name'), |
|
| 276 | - 'guid' => $u->get('guid'), |
|
| 277 | - 'pic' => elgg_view_entity_icon($u, 'tiny', array( |
|
| 278 | - 'use_hover' => false, |
|
| 279 | - 'href' => false)), |
|
| 280 | - 'avatar' => elgg_view_entity_icon($u, 'small', array( |
|
| 281 | - 'use_hover' => false, |
|
| 282 | - 'href' => false)), |
|
| 283 | - 'pos' => 4 |
|
| 284 | - ); |
|
| 285 | - } |
|
| 286 | - } |
|
| 287 | - |
|
| 288 | - $highest_relevance = array(); |
|
| 289 | - $high_relevance = array(); |
|
| 290 | - $med_relevance = array(); |
|
| 291 | - $low_relevance = array(); |
|
| 292 | - $lowest_relevance = array(); |
|
| 293 | - |
|
| 294 | - foreach ( $result as $r ) { |
|
| 295 | - if ( $r['pos'] == 0 ) { |
|
| 296 | - $highest_relevance[] = $r; |
|
| 297 | - } |
|
| 298 | - elseif ( $r['pos'] == 1 ) { |
|
| 299 | - $high_relevance[] = $r; |
|
| 300 | - } |
|
| 301 | - elseif ( $r['pos'] == 2 ) { |
|
| 302 | - $med_relevance[] = $r; |
|
| 303 | - } |
|
| 304 | - elseif ( $r['pos'] == 3 ) { |
|
| 305 | - $low_relevance[] = $r; |
|
| 306 | - } |
|
| 307 | - elseif ( $r['pos'] == 4 ) { |
|
| 308 | - $lowest_relevance[] = $r; |
|
| 309 | - } |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - $result = array_merge($highest_relevance, $high_relevance, $med_relevance, $low_relevance, $lowest_relevance); |
|
| 313 | - |
|
| 314 | - echo json_encode($result); |
|
| 315 | - return json_encode($result); |
|
| 206 | + $user_friends = get_user_friends(elgg_get_logged_in_user_guid(), null, 0); |
|
| 207 | + $query = htmlspecialchars($_GET['query']); |
|
| 208 | + $result = array(); |
|
| 209 | + |
|
| 210 | + foreach ($user_friends as $u) { |
|
| 211 | + |
|
| 212 | + // Complete match for first name |
|
| 213 | + if (strpos(strtolower(' ' . $u['name']) . ' ', ' ' . strtolower($query) . ' ') === 0 ) { |
|
| 214 | + $result[] = array( |
|
| 215 | + 'value' => $u->get('name'), |
|
| 216 | + 'guid' => $u->get('guid'), |
|
| 217 | + 'pic' => elgg_view_entity_icon($u, 'tiny', array( |
|
| 218 | + 'use_hover' => false, |
|
| 219 | + 'href' => false)), |
|
| 220 | + 'avatar' => elgg_view_entity_icon($u, 'small', array( |
|
| 221 | + 'use_hover' => false, |
|
| 222 | + 'href' => false)), |
|
| 223 | + 'pos' => 0 |
|
| 224 | + ); |
|
| 225 | + } |
|
| 226 | + |
|
| 227 | + // Complete match for name (first, middle or last) |
|
| 228 | + elseif (strpos(strtolower(' ' . $u['name']) . ' ', ' ' . strtolower($query) . ' ') !== FALSE) { |
|
| 229 | + $result[] = array( |
|
| 230 | + 'value' => $u->get('name'), |
|
| 231 | + 'guid' => $u->get('guid'), |
|
| 232 | + 'pic' => elgg_view_entity_icon($u, 'tiny', array( |
|
| 233 | + 'use_hover' => false, |
|
| 234 | + 'href' => false)), |
|
| 235 | + 'avatar' => elgg_view_entity_icon($u, 'small', array( |
|
| 236 | + 'use_hover' => false, |
|
| 237 | + 'href' => false)), |
|
| 238 | + 'pos' => 1 |
|
| 239 | + ); |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + // Partial match beginning at start of first name |
|
| 243 | + elseif (strpos(strtolower(' ' . $u['name']), ' ' . strtolower($query)) === 0 ) { |
|
| 244 | + $result[] = array( |
|
| 245 | + 'value' => $u->get('name'), |
|
| 246 | + 'guid' => $u->get('guid'), |
|
| 247 | + 'pic' => elgg_view_entity_icon($u, 'tiny', array( |
|
| 248 | + 'use_hover' => false, |
|
| 249 | + 'href' => false)), |
|
| 250 | + 'avatar' => elgg_view_entity_icon($u, 'small', array( |
|
| 251 | + 'use_hover' => false, |
|
| 252 | + 'href' => false)), |
|
| 253 | + 'pos' => 2 |
|
| 254 | + ); |
|
| 255 | + } |
|
| 256 | + |
|
| 257 | + // Partial match beginning at start of some name (middle, last) |
|
| 258 | + elseif (strpos(strtolower(' ' . $u['name']), ' ' . strtolower($query)) !== FALSE) { |
|
| 259 | + $result[] = array( |
|
| 260 | + 'value' => $u->get('name'), |
|
| 261 | + 'guid' => $u->get('guid'), |
|
| 262 | + 'pic' => elgg_view_entity_icon($u, 'tiny', array( |
|
| 263 | + 'use_hover' => false, |
|
| 264 | + 'href' => false)), |
|
| 265 | + 'avatar' => elgg_view_entity_icon($u, 'small', array( |
|
| 266 | + 'use_hover' => false, |
|
| 267 | + 'href' => false)), |
|
| 268 | + 'pos' => 3 |
|
| 269 | + ); |
|
| 270 | + } |
|
| 271 | + |
|
| 272 | + // Partial match somewhere within some name |
|
| 273 | + elseif (strpos(strtolower($u['name']), strtolower($query)) !== FALSE) { |
|
| 274 | + $result[] = array( |
|
| 275 | + 'value' => $u->get('name'), |
|
| 276 | + 'guid' => $u->get('guid'), |
|
| 277 | + 'pic' => elgg_view_entity_icon($u, 'tiny', array( |
|
| 278 | + 'use_hover' => false, |
|
| 279 | + 'href' => false)), |
|
| 280 | + 'avatar' => elgg_view_entity_icon($u, 'small', array( |
|
| 281 | + 'use_hover' => false, |
|
| 282 | + 'href' => false)), |
|
| 283 | + 'pos' => 4 |
|
| 284 | + ); |
|
| 285 | + } |
|
| 286 | + } |
|
| 287 | + |
|
| 288 | + $highest_relevance = array(); |
|
| 289 | + $high_relevance = array(); |
|
| 290 | + $med_relevance = array(); |
|
| 291 | + $low_relevance = array(); |
|
| 292 | + $lowest_relevance = array(); |
|
| 293 | + |
|
| 294 | + foreach ( $result as $r ) { |
|
| 295 | + if ( $r['pos'] == 0 ) { |
|
| 296 | + $highest_relevance[] = $r; |
|
| 297 | + } |
|
| 298 | + elseif ( $r['pos'] == 1 ) { |
|
| 299 | + $high_relevance[] = $r; |
|
| 300 | + } |
|
| 301 | + elseif ( $r['pos'] == 2 ) { |
|
| 302 | + $med_relevance[] = $r; |
|
| 303 | + } |
|
| 304 | + elseif ( $r['pos'] == 3 ) { |
|
| 305 | + $low_relevance[] = $r; |
|
| 306 | + } |
|
| 307 | + elseif ( $r['pos'] == 4 ) { |
|
| 308 | + $lowest_relevance[] = $r; |
|
| 309 | + } |
|
| 310 | + } |
|
| 311 | + |
|
| 312 | + $result = array_merge($highest_relevance, $high_relevance, $med_relevance, $low_relevance, $lowest_relevance); |
|
| 313 | + |
|
| 314 | + echo json_encode($result); |
|
| 315 | + return json_encode($result); |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | /* |
| 319 | 319 | * Purpose: check if a profile section has content, so that we know whether or not we should prepare ajax for display |
| 320 | 320 | */ |
| 321 | 321 | function has_content($user, $section) { |
| 322 | - if ( $user->$section != null ) { |
|
| 323 | - return true; |
|
| 324 | - } |
|
| 325 | - else { |
|
| 326 | - if ( $user->canEdit() ) { |
|
| 327 | - return true; |
|
| 328 | - } |
|
| 329 | - else { |
|
| 330 | - return false; |
|
| 331 | - } |
|
| 332 | - } |
|
| 322 | + if ( $user->$section != null ) { |
|
| 323 | + return true; |
|
| 324 | + } |
|
| 325 | + else { |
|
| 326 | + if ( $user->canEdit() ) { |
|
| 327 | + return true; |
|
| 328 | + } |
|
| 329 | + else { |
|
| 330 | + return false; |
|
| 331 | + } |
|
| 332 | + } |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | /* |
@@ -343,70 +343,70 @@ discard block |
||
| 343 | 343 | |
| 344 | 344 | function list_avatars($options) { |
| 345 | 345 | |
| 346 | - $list = ""; |
|
| 347 | - $list .= '<ul class="list-avatars list-unstyled clearfix' . $options['class'] . '">'; |
|
| 348 | - |
|
| 349 | - if ( $options['limit'] == 0 ) { |
|
| 350 | - $options['limit'] = 999; |
|
| 351 | - } |
|
| 352 | - else { |
|
| 353 | - |
|
| 354 | - $link = elgg_view('output/url', array( |
|
| 355 | - 'href' => 'ajax/view/b_extended_profile/edit_basic', |
|
| 356 | - 'class' => 'elgg-lightbox gcconnex-basic-profile-edit elgg-button', |
|
| 357 | - 'text' => elgg_echo('gcconnex_profile:edit_profile') |
|
| 358 | - )); |
|
| 359 | - } |
|
| 360 | - |
|
| 361 | - |
|
| 362 | - if ( $options['use_hover'] === null ) { |
|
| 363 | - $options['use_hover'] = true; |
|
| 364 | - } |
|
| 365 | - |
|
| 366 | - if ( $options['guids'] == null ) { |
|
| 367 | - return false; |
|
| 368 | - } |
|
| 369 | - else { |
|
| 370 | - if (!is_array($options['guids'])) { |
|
| 371 | - $options['guids'] = array($options['guids']); |
|
| 372 | - } |
|
| 373 | - |
|
| 374 | - $guids = $options['guids']; |
|
| 375 | - |
|
| 376 | - // display each avatar, up until the limit is reached |
|
| 377 | - for ( $i=0; $i<$options['limit']; $i++) { |
|
| 378 | - if( ($user = get_user($guids[$i])) == true ) { |
|
| 379 | - if ( $options['edit_mode'] == true ) { |
|
| 380 | - $list .= '<li class="gcconnex-avatar-in-list" data-guid="' . $guids[$i] . '" onclick="removeColleague(this)">'; |
|
| 381 | - $list .= '<div class="remove-colleague-from-list">X'; |
|
| 382 | - $list .= '</div>'; // close div class="remove-colleague-from-list" |
|
| 383 | - |
|
| 384 | - $list .= elgg_view_entity_icon($user, $options['size'], array( |
|
| 385 | - 'use_hover' => $options['use_hover'], |
|
| 386 | - 'href' => false |
|
| 387 | - )); |
|
| 388 | - $list .= '</li>'; // close div class="gcconnex-avatar-in-list" |
|
| 389 | - } |
|
| 390 | - else { |
|
| 391 | - $list .= '<li class="gcconnex-avatar-in-list" data-guid="' . $guids[$i] . '">'; |
|
| 392 | - $list .= elgg_view_entity_icon($user, $options['size'], array( |
|
| 393 | - 'use_hover' => $options['use_hover'], |
|
| 394 | - )); |
|
| 395 | - $list .= '</li>'; // close div class="gcconnex-avatar-in-list" |
|
| 396 | - |
|
| 397 | - } |
|
| 398 | - } |
|
| 399 | - else { |
|
| 400 | - break; |
|
| 401 | - } |
|
| 402 | - } |
|
| 403 | - } |
|
| 404 | - //$list .= count($guids); |
|
| 405 | - if($options['id'] && $options['skill_guid'] && count($guids) > 4){ |
|
| 406 | - $list .= '<a class="btn gcconnex-avatars-expand elgg-lightbox" title="'.elgg_echo('gcconnex_profile:gc_skill:allendorse').'" href="' . elgg_get_site_url() . 'ajax/view/endorse/endorsement?guid=' . $options['skill_guid'] .'" ><i class="fa fa-flip-vertical mrgn-tp-sm fa-ellipsis-h" aria-hidden="true"><span class="wb-invisible">'.elgg_echo('gcconnex_profile:gc_skill:allendorse').'</span></i></a>'; |
|
| 407 | - } |
|
| 408 | - $list .= '</ul>'; // close div class="list-avatars" |
|
| 409 | - return $list; |
|
| 346 | + $list = ""; |
|
| 347 | + $list .= '<ul class="list-avatars list-unstyled clearfix' . $options['class'] . '">'; |
|
| 348 | + |
|
| 349 | + if ( $options['limit'] == 0 ) { |
|
| 350 | + $options['limit'] = 999; |
|
| 351 | + } |
|
| 352 | + else { |
|
| 353 | + |
|
| 354 | + $link = elgg_view('output/url', array( |
|
| 355 | + 'href' => 'ajax/view/b_extended_profile/edit_basic', |
|
| 356 | + 'class' => 'elgg-lightbox gcconnex-basic-profile-edit elgg-button', |
|
| 357 | + 'text' => elgg_echo('gcconnex_profile:edit_profile') |
|
| 358 | + )); |
|
| 359 | + } |
|
| 360 | + |
|
| 361 | + |
|
| 362 | + if ( $options['use_hover'] === null ) { |
|
| 363 | + $options['use_hover'] = true; |
|
| 364 | + } |
|
| 365 | + |
|
| 366 | + if ( $options['guids'] == null ) { |
|
| 367 | + return false; |
|
| 368 | + } |
|
| 369 | + else { |
|
| 370 | + if (!is_array($options['guids'])) { |
|
| 371 | + $options['guids'] = array($options['guids']); |
|
| 372 | + } |
|
| 373 | + |
|
| 374 | + $guids = $options['guids']; |
|
| 375 | + |
|
| 376 | + // display each avatar, up until the limit is reached |
|
| 377 | + for ( $i=0; $i<$options['limit']; $i++) { |
|
| 378 | + if( ($user = get_user($guids[$i])) == true ) { |
|
| 379 | + if ( $options['edit_mode'] == true ) { |
|
| 380 | + $list .= '<li class="gcconnex-avatar-in-list" data-guid="' . $guids[$i] . '" onclick="removeColleague(this)">'; |
|
| 381 | + $list .= '<div class="remove-colleague-from-list">X'; |
|
| 382 | + $list .= '</div>'; // close div class="remove-colleague-from-list" |
|
| 383 | + |
|
| 384 | + $list .= elgg_view_entity_icon($user, $options['size'], array( |
|
| 385 | + 'use_hover' => $options['use_hover'], |
|
| 386 | + 'href' => false |
|
| 387 | + )); |
|
| 388 | + $list .= '</li>'; // close div class="gcconnex-avatar-in-list" |
|
| 389 | + } |
|
| 390 | + else { |
|
| 391 | + $list .= '<li class="gcconnex-avatar-in-list" data-guid="' . $guids[$i] . '">'; |
|
| 392 | + $list .= elgg_view_entity_icon($user, $options['size'], array( |
|
| 393 | + 'use_hover' => $options['use_hover'], |
|
| 394 | + )); |
|
| 395 | + $list .= '</li>'; // close div class="gcconnex-avatar-in-list" |
|
| 396 | + |
|
| 397 | + } |
|
| 398 | + } |
|
| 399 | + else { |
|
| 400 | + break; |
|
| 401 | + } |
|
| 402 | + } |
|
| 403 | + } |
|
| 404 | + //$list .= count($guids); |
|
| 405 | + if($options['id'] && $options['skill_guid'] && count($guids) > 4){ |
|
| 406 | + $list .= '<a class="btn gcconnex-avatars-expand elgg-lightbox" title="'.elgg_echo('gcconnex_profile:gc_skill:allendorse').'" href="' . elgg_get_site_url() . 'ajax/view/endorse/endorsement?guid=' . $options['skill_guid'] .'" ><i class="fa fa-flip-vertical mrgn-tp-sm fa-ellipsis-h" aria-hidden="true"><span class="wb-invisible">'.elgg_echo('gcconnex_profile:gc_skill:allendorse').'</span></i></a>'; |
|
| 407 | + } |
|
| 408 | + $list .= '</ul>'; // close div class="list-avatars" |
|
| 409 | + return $list; |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | /* |
@@ -414,20 +414,20 @@ discard block |
||
| 414 | 414 | */ |
| 415 | 415 | function cmpStartDate($foo, $bar) |
| 416 | 416 | { |
| 417 | - $a = get_entity($foo); |
|
| 418 | - $b = get_entity($bar); |
|
| 419 | - |
|
| 420 | - if (($a instanceof ElggEntity) && ($b instanceof ElggEntity)) { |
|
| 421 | - if ($a->startyear == $b->startyear) { |
|
| 422 | - return (0); |
|
| 423 | - } |
|
| 424 | - else if ($a->startyear > $b->startyear) { |
|
| 425 | - return (-1); |
|
| 426 | - } |
|
| 427 | - else if ($a->startyear < $b->startyear) { |
|
| 428 | - return (1); |
|
| 429 | - } |
|
| 430 | - } |
|
| 417 | + $a = get_entity($foo); |
|
| 418 | + $b = get_entity($bar); |
|
| 419 | + |
|
| 420 | + if (($a instanceof ElggEntity) && ($b instanceof ElggEntity)) { |
|
| 421 | + if ($a->startyear == $b->startyear) { |
|
| 422 | + return (0); |
|
| 423 | + } |
|
| 424 | + else if ($a->startyear > $b->startyear) { |
|
| 425 | + return (-1); |
|
| 426 | + } |
|
| 427 | + else if ($a->startyear < $b->startyear) { |
|
| 428 | + return (1); |
|
| 429 | + } |
|
| 430 | + } |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | /* |
@@ -436,32 +436,32 @@ discard block |
||
| 436 | 436 | function sortDate($foo, $bar) |
| 437 | 437 | { |
| 438 | 438 | |
| 439 | - $a = get_entity($foo); |
|
| 440 | - $b = get_entity($bar); |
|
| 441 | - |
|
| 442 | - // check if $a and $b are both entities object (this will fill up the error log if not checked) |
|
| 443 | - if (($a instanceof ElggEntity) && ($b instanceof ElggEntity)) { |
|
| 444 | - |
|
| 445 | - if ($a->ongoing == "true" && $b->ongoing == "true") { |
|
| 446 | - return (0); |
|
| 447 | - } |
|
| 448 | - else if ($a->ongoing == "true" && $b->ongoing != "true") { |
|
| 449 | - return (-1); |
|
| 450 | - } |
|
| 451 | - else if ($a->ongoing != "true" && $b->ongoing == "true") { |
|
| 452 | - return (1); |
|
| 453 | - } |
|
| 454 | - else { |
|
| 455 | - if ($a->endyear == $b->endyear) { |
|
| 456 | - // @todo: sort by enddate entry (months, saved as strings..) |
|
| 457 | - return (cmpStartDate($a, $b)); |
|
| 458 | - } |
|
| 459 | - else if ($a->endyear > $b->endyear) { |
|
| 460 | - return (-1); |
|
| 461 | - } |
|
| 462 | - else if ($a->endyear < $b->endyear) { |
|
| 463 | - return (1); |
|
| 464 | - } |
|
| 465 | - } |
|
| 466 | - } |
|
| 439 | + $a = get_entity($foo); |
|
| 440 | + $b = get_entity($bar); |
|
| 441 | + |
|
| 442 | + // check if $a and $b are both entities object (this will fill up the error log if not checked) |
|
| 443 | + if (($a instanceof ElggEntity) && ($b instanceof ElggEntity)) { |
|
| 444 | + |
|
| 445 | + if ($a->ongoing == "true" && $b->ongoing == "true") { |
|
| 446 | + return (0); |
|
| 447 | + } |
|
| 448 | + else if ($a->ongoing == "true" && $b->ongoing != "true") { |
|
| 449 | + return (-1); |
|
| 450 | + } |
|
| 451 | + else if ($a->ongoing != "true" && $b->ongoing == "true") { |
|
| 452 | + return (1); |
|
| 453 | + } |
|
| 454 | + else { |
|
| 455 | + if ($a->endyear == $b->endyear) { |
|
| 456 | + // @todo: sort by enddate entry (months, saved as strings..) |
|
| 457 | + return (cmpStartDate($a, $b)); |
|
| 458 | + } |
|
| 459 | + else if ($a->endyear > $b->endyear) { |
|
| 460 | + return (-1); |
|
| 461 | + } |
|
| 462 | + else if ($a->endyear < $b->endyear) { |
|
| 463 | + return (1); |
|
| 464 | + } |
|
| 465 | + } |
|
| 466 | + } |
|
| 467 | 467 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | function init_ajax_block($title, $section, $user) { |
| 134 | 134 | |
| 135 | - switch($section){ |
|
| 135 | + switch ($section) { |
|
| 136 | 136 | case 'about-me': |
| 137 | 137 | $field = elgg_echo('gcconnex_profile:about_me'); |
| 138 | 138 | break; |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | function finit_ajax_block($section) { |
| 172 | 172 | |
| 173 | - switch($section){ |
|
| 173 | + switch ($section) { |
|
| 174 | 174 | case 'about-me': |
| 175 | 175 | $field = elgg_echo('gcconnex_profile:about_me'); |
| 176 | 176 | break; |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | foreach ($user_friends as $u) { |
| 211 | 211 | |
| 212 | 212 | // Complete match for first name |
| 213 | - if (strpos(strtolower(' ' . $u['name']) . ' ', ' ' . strtolower($query) . ' ') === 0 ) { |
|
| 213 | + if (strpos(strtolower(' ' . $u['name']) . ' ', ' ' . strtolower($query) . ' ') === 0) { |
|
| 214 | 214 | $result[] = array( |
| 215 | 215 | 'value' => $u->get('name'), |
| 216 | 216 | 'guid' => $u->get('guid'), |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | // Partial match beginning at start of first name |
| 243 | - elseif (strpos(strtolower(' ' . $u['name']), ' ' . strtolower($query)) === 0 ) { |
|
| 243 | + elseif (strpos(strtolower(' ' . $u['name']), ' ' . strtolower($query)) === 0) { |
|
| 244 | 244 | $result[] = array( |
| 245 | 245 | 'value' => $u->get('name'), |
| 246 | 246 | 'guid' => $u->get('guid'), |
@@ -291,20 +291,20 @@ discard block |
||
| 291 | 291 | $low_relevance = array(); |
| 292 | 292 | $lowest_relevance = array(); |
| 293 | 293 | |
| 294 | - foreach ( $result as $r ) { |
|
| 295 | - if ( $r['pos'] == 0 ) { |
|
| 294 | + foreach ($result as $r) { |
|
| 295 | + if ($r['pos'] == 0) { |
|
| 296 | 296 | $highest_relevance[] = $r; |
| 297 | 297 | } |
| 298 | - elseif ( $r['pos'] == 1 ) { |
|
| 298 | + elseif ($r['pos'] == 1) { |
|
| 299 | 299 | $high_relevance[] = $r; |
| 300 | 300 | } |
| 301 | - elseif ( $r['pos'] == 2 ) { |
|
| 301 | + elseif ($r['pos'] == 2) { |
|
| 302 | 302 | $med_relevance[] = $r; |
| 303 | 303 | } |
| 304 | - elseif ( $r['pos'] == 3 ) { |
|
| 304 | + elseif ($r['pos'] == 3) { |
|
| 305 | 305 | $low_relevance[] = $r; |
| 306 | 306 | } |
| 307 | - elseif ( $r['pos'] == 4 ) { |
|
| 307 | + elseif ($r['pos'] == 4) { |
|
| 308 | 308 | $lowest_relevance[] = $r; |
| 309 | 309 | } |
| 310 | 310 | } |
@@ -319,11 +319,11 @@ discard block |
||
| 319 | 319 | * Purpose: check if a profile section has content, so that we know whether or not we should prepare ajax for display |
| 320 | 320 | */ |
| 321 | 321 | function has_content($user, $section) { |
| 322 | - if ( $user->$section != null ) { |
|
| 322 | + if ($user->$section != null) { |
|
| 323 | 323 | return true; |
| 324 | 324 | } |
| 325 | 325 | else { |
| 326 | - if ( $user->canEdit() ) { |
|
| 326 | + if ($user->canEdit()) { |
|
| 327 | 327 | return true; |
| 328 | 328 | } |
| 329 | 329 | else { |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | $list = ""; |
| 347 | 347 | $list .= '<ul class="list-avatars list-unstyled clearfix' . $options['class'] . '">'; |
| 348 | 348 | |
| 349 | - if ( $options['limit'] == 0 ) { |
|
| 349 | + if ($options['limit'] == 0) { |
|
| 350 | 350 | $options['limit'] = 999; |
| 351 | 351 | } |
| 352 | 352 | else { |
@@ -359,11 +359,11 @@ discard block |
||
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | |
| 362 | - if ( $options['use_hover'] === null ) { |
|
| 362 | + if ($options['use_hover'] === null) { |
|
| 363 | 363 | $options['use_hover'] = true; |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - if ( $options['guids'] == null ) { |
|
| 366 | + if ($options['guids'] == null) { |
|
| 367 | 367 | return false; |
| 368 | 368 | } |
| 369 | 369 | else { |
@@ -374,9 +374,9 @@ discard block |
||
| 374 | 374 | $guids = $options['guids']; |
| 375 | 375 | |
| 376 | 376 | // display each avatar, up until the limit is reached |
| 377 | - for ( $i=0; $i<$options['limit']; $i++) { |
|
| 378 | - if( ($user = get_user($guids[$i])) == true ) { |
|
| 379 | - if ( $options['edit_mode'] == true ) { |
|
| 377 | + for ($i = 0; $i < $options['limit']; $i++) { |
|
| 378 | + if (($user = get_user($guids[$i])) == true) { |
|
| 379 | + if ($options['edit_mode'] == true) { |
|
| 380 | 380 | $list .= '<li class="gcconnex-avatar-in-list" data-guid="' . $guids[$i] . '" onclick="removeColleague(this)">'; |
| 381 | 381 | $list .= '<div class="remove-colleague-from-list">X'; |
| 382 | 382 | $list .= '</div>'; // close div class="remove-colleague-from-list" |
@@ -402,8 +402,8 @@ discard block |
||
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | 404 | //$list .= count($guids); |
| 405 | - if($options['id'] && $options['skill_guid'] && count($guids) > 4){ |
|
| 406 | - $list .= '<a class="btn gcconnex-avatars-expand elgg-lightbox" title="'.elgg_echo('gcconnex_profile:gc_skill:allendorse').'" href="' . elgg_get_site_url() . 'ajax/view/endorse/endorsement?guid=' . $options['skill_guid'] .'" ><i class="fa fa-flip-vertical mrgn-tp-sm fa-ellipsis-h" aria-hidden="true"><span class="wb-invisible">'.elgg_echo('gcconnex_profile:gc_skill:allendorse').'</span></i></a>'; |
|
| 405 | + if ($options['id'] && $options['skill_guid'] && count($guids) > 4) { |
|
| 406 | + $list .= '<a class="btn gcconnex-avatars-expand elgg-lightbox" title="' . elgg_echo('gcconnex_profile:gc_skill:allendorse') . '" href="' . elgg_get_site_url() . 'ajax/view/endorse/endorsement?guid=' . $options['skill_guid'] . '" ><i class="fa fa-flip-vertical mrgn-tp-sm fa-ellipsis-h" aria-hidden="true"><span class="wb-invisible">' . elgg_echo('gcconnex_profile:gc_skill:allendorse') . '</span></i></a>'; |
|
| 407 | 407 | } |
| 408 | 408 | $list .= '</ul>'; // close div class="list-avatars" |
| 409 | 409 | return $list; |
@@ -294,17 +294,13 @@ discard block |
||
| 294 | 294 | foreach ( $result as $r ) { |
| 295 | 295 | if ( $r['pos'] == 0 ) { |
| 296 | 296 | $highest_relevance[] = $r; |
| 297 | - } |
|
| 298 | - elseif ( $r['pos'] == 1 ) { |
|
| 297 | + } elseif ( $r['pos'] == 1 ) { |
|
| 299 | 298 | $high_relevance[] = $r; |
| 300 | - } |
|
| 301 | - elseif ( $r['pos'] == 2 ) { |
|
| 299 | + } elseif ( $r['pos'] == 2 ) { |
|
| 302 | 300 | $med_relevance[] = $r; |
| 303 | - } |
|
| 304 | - elseif ( $r['pos'] == 3 ) { |
|
| 301 | + } elseif ( $r['pos'] == 3 ) { |
|
| 305 | 302 | $low_relevance[] = $r; |
| 306 | - } |
|
| 307 | - elseif ( $r['pos'] == 4 ) { |
|
| 303 | + } elseif ( $r['pos'] == 4 ) { |
|
| 308 | 304 | $lowest_relevance[] = $r; |
| 309 | 305 | } |
| 310 | 306 | } |
@@ -321,12 +317,10 @@ discard block |
||
| 321 | 317 | function has_content($user, $section) { |
| 322 | 318 | if ( $user->$section != null ) { |
| 323 | 319 | return true; |
| 324 | - } |
|
| 325 | - else { |
|
| 320 | + } else { |
|
| 326 | 321 | if ( $user->canEdit() ) { |
| 327 | 322 | return true; |
| 328 | - } |
|
| 329 | - else { |
|
| 323 | + } else { |
|
| 330 | 324 | return false; |
| 331 | 325 | } |
| 332 | 326 | } |
@@ -348,8 +342,7 @@ discard block |
||
| 348 | 342 | |
| 349 | 343 | if ( $options['limit'] == 0 ) { |
| 350 | 344 | $options['limit'] = 999; |
| 351 | - } |
|
| 352 | - else { |
|
| 345 | + } else { |
|
| 353 | 346 | |
| 354 | 347 | $link = elgg_view('output/url', array( |
| 355 | 348 | 'href' => 'ajax/view/b_extended_profile/edit_basic', |
@@ -365,8 +358,7 @@ discard block |
||
| 365 | 358 | |
| 366 | 359 | if ( $options['guids'] == null ) { |
| 367 | 360 | return false; |
| 368 | - } |
|
| 369 | - else { |
|
| 361 | + } else { |
|
| 370 | 362 | if (!is_array($options['guids'])) { |
| 371 | 363 | $options['guids'] = array($options['guids']); |
| 372 | 364 | } |
@@ -386,8 +378,7 @@ discard block |
||
| 386 | 378 | 'href' => false |
| 387 | 379 | )); |
| 388 | 380 | $list .= '</li>'; // close div class="gcconnex-avatar-in-list" |
| 389 | - } |
|
| 390 | - else { |
|
| 381 | + } else { |
|
| 391 | 382 | $list .= '<li class="gcconnex-avatar-in-list" data-guid="' . $guids[$i] . '">'; |
| 392 | 383 | $list .= elgg_view_entity_icon($user, $options['size'], array( |
| 393 | 384 | 'use_hover' => $options['use_hover'], |
@@ -395,8 +386,7 @@ discard block |
||
| 395 | 386 | $list .= '</li>'; // close div class="gcconnex-avatar-in-list" |
| 396 | 387 | |
| 397 | 388 | } |
| 398 | - } |
|
| 399 | - else { |
|
| 389 | + } else { |
|
| 400 | 390 | break; |
| 401 | 391 | } |
| 402 | 392 | } |
@@ -420,11 +410,9 @@ discard block |
||
| 420 | 410 | if (($a instanceof ElggEntity) && ($b instanceof ElggEntity)) { |
| 421 | 411 | if ($a->startyear == $b->startyear) { |
| 422 | 412 | return (0); |
| 423 | - } |
|
| 424 | - else if ($a->startyear > $b->startyear) { |
|
| 413 | + } else if ($a->startyear > $b->startyear) { |
|
| 425 | 414 | return (-1); |
| 426 | - } |
|
| 427 | - else if ($a->startyear < $b->startyear) { |
|
| 415 | + } else if ($a->startyear < $b->startyear) { |
|
| 428 | 416 | return (1); |
| 429 | 417 | } |
| 430 | 418 | } |
@@ -444,22 +432,17 @@ discard block |
||
| 444 | 432 | |
| 445 | 433 | if ($a->ongoing == "true" && $b->ongoing == "true") { |
| 446 | 434 | return (0); |
| 447 | - } |
|
| 448 | - else if ($a->ongoing == "true" && $b->ongoing != "true") { |
|
| 435 | + } else if ($a->ongoing == "true" && $b->ongoing != "true") { |
|
| 449 | 436 | return (-1); |
| 450 | - } |
|
| 451 | - else if ($a->ongoing != "true" && $b->ongoing == "true") { |
|
| 437 | + } else if ($a->ongoing != "true" && $b->ongoing == "true") { |
|
| 452 | 438 | return (1); |
| 453 | - } |
|
| 454 | - else { |
|
| 439 | + } else { |
|
| 455 | 440 | if ($a->endyear == $b->endyear) { |
| 456 | 441 | // @todo: sort by enddate entry (months, saved as strings..) |
| 457 | 442 | return (cmpStartDate($a, $b)); |
| 458 | - } |
|
| 459 | - else if ($a->endyear > $b->endyear) { |
|
| 443 | + } else if ($a->endyear > $b->endyear) { |
|
| 460 | 444 | return (-1); |
| 461 | - } |
|
| 462 | - else if ($a->endyear < $b->endyear) { |
|
| 445 | + } else if ($a->endyear < $b->endyear) { |
|
| 463 | 446 | return (1); |
| 464 | 447 | } |
| 465 | 448 | } |
@@ -19,39 +19,39 @@ discard block |
||
| 19 | 19 | echo '<div class="gcconnex-profile-name">'; |
| 20 | 20 | //edit button |
| 21 | 21 | if ($user->canEdit()) { |
| 22 | - echo '<a role="button" class="btn btn-primary gcconnex-edit-profile overlay-lnk" href="#editProfile">' . elgg_echo('gcconnex_profile:edit_profile') . ' <span class="wb-inv">' . elgg_echo('profile:contactinfo') . '</span></a><script>$(".gcconnex-edit-profile").on("click", function(){ $("#editProfile").focus(); });</script>'; |
|
| 23 | - echo '<!-- Modal --> |
|
| 22 | + echo '<a role="button" class="btn btn-primary gcconnex-edit-profile overlay-lnk" href="#editProfile">' . elgg_echo('gcconnex_profile:edit_profile') . ' <span class="wb-inv">' . elgg_echo('profile:contactinfo') . '</span></a><script>$(".gcconnex-edit-profile").on("click", function(){ $("#editProfile").focus(); });</script>'; |
|
| 23 | + echo '<!-- Modal --> |
|
| 24 | 24 | <div id="editProfile" class="wb-overlay modal-content overlay-def wb-popup-mid" tabindex="-1"> |
| 25 | 25 | <div class=""> |
| 26 | 26 | <div class=""> |
| 27 | 27 | <header class="modal-header profile-edit-header">'; |
| 28 | - echo '<h2 class="modal-title">' . elgg_echo('gcconnex_profile:basic:header') . '</h2>'; |
|
| 29 | - echo '</header>'; |
|
| 30 | - echo '<div class="panel-body overflow-body">'; |
|
| 31 | - $editAvatar = elgg_get_site_url(). 'avatar/edit/' . $user->username; |
|
| 32 | - echo '<div><a href='.$editAvatar.' class="btn btn-primary">'. elgg_echo('gcconnex_profile:profile:edit_avatar') .'</a></div>'; |
|
| 33 | - echo '<div class="basic-profile-standard-field-wrapper col-md-6 col-xs-12">'; // container for css styling, used to group profile content and display them seperately from other fields |
|
| 34 | - |
|
| 35 | - $fields = array('Name', 'Job', 'Department', 'Location', 'Phone', 'Mobile', 'Email', 'Website'); |
|
| 36 | - |
|
| 37 | - foreach ($fields as $field) { // create a label and input box for each field on the basic profile (see $fields above) |
|
| 38 | - echo '<div class="basic-profile-field-wrapper col-xs-12">'; // field wrapper for css styling |
|
| 39 | - |
|
| 40 | - $field = strtolower($field); |
|
| 41 | - echo '<label for="' . $field . '" class="basic-profile-label ' . $field . '-label">' . elgg_echo('gcconnex_profile:basic:' . $field) . '</label>'; // field label |
|
| 42 | - |
|
| 43 | - $value = $user->get($field); |
|
| 44 | - // setup the input for this field |
|
| 45 | - $params = array( |
|
| 46 | - 'name' => $field, |
|
| 47 | - 'id' => $field, |
|
| 48 | - 'class' => 'gcconnex-basic-' . $field, |
|
| 49 | - 'value' => $value, |
|
| 50 | - ); |
|
| 28 | + echo '<h2 class="modal-title">' . elgg_echo('gcconnex_profile:basic:header') . '</h2>'; |
|
| 29 | + echo '</header>'; |
|
| 30 | + echo '<div class="panel-body overflow-body">'; |
|
| 31 | + $editAvatar = elgg_get_site_url(). 'avatar/edit/' . $user->username; |
|
| 32 | + echo '<div><a href='.$editAvatar.' class="btn btn-primary">'. elgg_echo('gcconnex_profile:profile:edit_avatar') .'</a></div>'; |
|
| 33 | + echo '<div class="basic-profile-standard-field-wrapper col-md-6 col-xs-12">'; // container for css styling, used to group profile content and display them seperately from other fields |
|
| 34 | + |
|
| 35 | + $fields = array('Name', 'Job', 'Department', 'Location', 'Phone', 'Mobile', 'Email', 'Website'); |
|
| 36 | + |
|
| 37 | + foreach ($fields as $field) { // create a label and input box for each field on the basic profile (see $fields above) |
|
| 38 | + echo '<div class="basic-profile-field-wrapper col-xs-12">'; // field wrapper for css styling |
|
| 39 | + |
|
| 40 | + $field = strtolower($field); |
|
| 41 | + echo '<label for="' . $field . '" class="basic-profile-label ' . $field . '-label">' . elgg_echo('gcconnex_profile:basic:' . $field) . '</label>'; // field label |
|
| 42 | + |
|
| 43 | + $value = $user->get($field); |
|
| 44 | + // setup the input for this field |
|
| 45 | + $params = array( |
|
| 46 | + 'name' => $field, |
|
| 47 | + 'id' => $field, |
|
| 48 | + 'class' => 'gcconnex-basic-' . $field, |
|
| 49 | + 'value' => $value, |
|
| 50 | + ); |
|
| 51 | 51 | /////////////Troy |
| 52 | - if ($field == 'department') { |
|
| 53 | - /////////////Troy |
|
| 54 | - echo '<div class="basic-profile-field department-test">'; |
|
| 52 | + if ($field == 'department') { |
|
| 53 | + /////////////Troy |
|
| 54 | + echo '<div class="basic-profile-field department-test">'; |
|
| 55 | 55 | $obj = elgg_get_entities(array( |
| 56 | 56 | 'type' => 'object', |
| 57 | 57 | 'subtype' => 'dept_list', |
@@ -99,83 +99,83 @@ discard block |
||
| 99 | 99 | if ($key === false){ |
| 100 | 100 | $key = array_search($value[1], $departments); |
| 101 | 101 | } |
| 102 | - echo elgg_view('input/select', array( |
|
| 102 | + echo elgg_view('input/select', array( |
|
| 103 | 103 | 'name' => $field, |
| 104 | 104 | 'id' => $field, |
| 105 | - 'class' => ' gcconnex-basic-' . $field, |
|
| 106 | - 'value' => $key, |
|
| 105 | + 'class' => ' gcconnex-basic-' . $field, |
|
| 106 | + 'value' => $key, |
|
| 107 | 107 | 'options_values' => $departments, |
| 108 | 108 | |
| 109 | 109 | )); |
| 110 | - } |
|
| 111 | - else { |
|
| 112 | - echo '<div class="basic-profile-field">'; // field wrapper for css styling |
|
| 110 | + } |
|
| 111 | + else { |
|
| 112 | + echo '<div class="basic-profile-field">'; // field wrapper for css styling |
|
| 113 | 113 | |
| 114 | 114 | echo elgg_view("input/text", $params); |
| 115 | 115 | }// input field |
| 116 | - echo '</div>'; //close div class = basic-profile-field |
|
| 116 | + echo '</div>'; //close div class = basic-profile-field |
|
| 117 | 117 | |
| 118 | - echo '</div>'; //close div class = basic-profile-field-wrapper |
|
| 119 | - } |
|
| 118 | + echo '</div>'; //close div class = basic-profile-field-wrapper |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - echo '</div>'; // close div class="basic-profile-standard-field-wrapper" |
|
| 122 | - echo '<div class="basic-profile-social-media-wrapper col-md-6 col-xs-12">'; // container for css styling, used to group profile content and display them seperately from other fields |
|
| 121 | + echo '</div>'; // close div class="basic-profile-standard-field-wrapper" |
|
| 122 | + echo '<div class="basic-profile-social-media-wrapper col-md-6 col-xs-12">'; // container for css styling, used to group profile content and display them seperately from other fields |
|
| 123 | 123 | |
| 124 | 124 | // pre-populate the social media fields and their prepended link for user profiles |
| 125 | 125 | |
| 126 | - $fields = array('Facebook' => "http://www.facebook.com/", |
|
| 127 | - 'Google Plus' => "http://www.google.com/", |
|
| 128 | - 'GitHub' => "https://github.com/", |
|
| 129 | - 'Twitter' => "https://twitter.com/", |
|
| 130 | - 'Linkedin' => "http://ca.linkedin.com/in/", |
|
| 131 | - 'Pinterest' => "http://www.pinterest.com/", |
|
| 132 | - 'Tumblr' => "https://www.tumblr.com/blog/", |
|
| 133 | - 'Instagram' => "http://instagram.com/", |
|
| 134 | - 'Flickr' => "http://flickr.com/", |
|
| 135 | - 'Youtube' => "http://www.youtube.com/"); |
|
| 136 | - |
|
| 137 | - foreach ($fields as $field => $field_link) { // create a label and input box for each social media field on the basic profile |
|
| 138 | - |
|
| 139 | - echo '<div class="basic-profile-field-wrapper social-media-field-wrapper">'; //field wrapper for css styling |
|
| 140 | - |
|
| 141 | - $field = str_replace(' ', '-', $field); // create a css friendly version of the section name |
|
| 142 | - $field = strtolower($field); |
|
| 143 | - |
|
| 144 | - if ($field == "google-plus") { $field = "google"; } |
|
| 145 | - $value = $user->get($field); |
|
| 146 | - |
|
| 147 | - echo '<div class="input-group">'; // input wrapper for prepended link and input box, excludes the input label |
|
| 148 | - echo '<label for="' . $field . 'Input" class="input-group-addon clearfix">' . $field_link . "</label>"; // prepended link |
|
| 149 | - |
|
| 150 | - // setup the input for this field |
|
| 151 | - $placeholder = "test"; |
|
| 152 | - if ($field == "facebook") { $placeholder = "User.Name"; } |
|
| 153 | - if ($field == "google") { $placeholder = "############"; } |
|
| 154 | - if ($field == "github") { $placeholder = "User"; } |
|
| 155 | - if ($field == "twitter") { $placeholder = "@user"; } |
|
| 156 | - if ($field == "linkedin") { $placeholder = "CustomURL"; } |
|
| 157 | - if ($field == "pinterest") { $placeholder = "Username"; } |
|
| 158 | - if ($field == "tumblr") { $placeholder = "Username"; } |
|
| 159 | - if ($field == "instagram") { $placeholder = "@user"; } |
|
| 160 | - if ($field == "flickr") { $placeholder = "Username"; } |
|
| 161 | - if ($field == "youtube") { $placeholder = "Username"; } |
|
| 162 | - |
|
| 163 | - $params = array( |
|
| 164 | - 'name' => $field, |
|
| 165 | - 'id' => $field . 'Input', |
|
| 166 | - 'class' => 'editProfileFields gcconnex-basic-field gcconnex-social-media gcconnex-basic-' . $field, |
|
| 167 | - 'placeholder' => $placeholder, |
|
| 168 | - 'value' => $value |
|
| 169 | - ); |
|
| 170 | - |
|
| 171 | - echo elgg_view("input/text", $params); // input field |
|
| 172 | - |
|
| 173 | - echo '</div>'; // close div class="input-group" |
|
| 174 | - echo '</div>'; // close div class = basic-profile-field-wrapper |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - echo '</div>'; // close div class="basic-profile-social-media-wrapper" |
|
| 178 | - echo ' |
|
| 126 | + $fields = array('Facebook' => "http://www.facebook.com/", |
|
| 127 | + 'Google Plus' => "http://www.google.com/", |
|
| 128 | + 'GitHub' => "https://github.com/", |
|
| 129 | + 'Twitter' => "https://twitter.com/", |
|
| 130 | + 'Linkedin' => "http://ca.linkedin.com/in/", |
|
| 131 | + 'Pinterest' => "http://www.pinterest.com/", |
|
| 132 | + 'Tumblr' => "https://www.tumblr.com/blog/", |
|
| 133 | + 'Instagram' => "http://instagram.com/", |
|
| 134 | + 'Flickr' => "http://flickr.com/", |
|
| 135 | + 'Youtube' => "http://www.youtube.com/"); |
|
| 136 | + |
|
| 137 | + foreach ($fields as $field => $field_link) { // create a label and input box for each social media field on the basic profile |
|
| 138 | + |
|
| 139 | + echo '<div class="basic-profile-field-wrapper social-media-field-wrapper">'; //field wrapper for css styling |
|
| 140 | + |
|
| 141 | + $field = str_replace(' ', '-', $field); // create a css friendly version of the section name |
|
| 142 | + $field = strtolower($field); |
|
| 143 | + |
|
| 144 | + if ($field == "google-plus") { $field = "google"; } |
|
| 145 | + $value = $user->get($field); |
|
| 146 | + |
|
| 147 | + echo '<div class="input-group">'; // input wrapper for prepended link and input box, excludes the input label |
|
| 148 | + echo '<label for="' . $field . 'Input" class="input-group-addon clearfix">' . $field_link . "</label>"; // prepended link |
|
| 149 | + |
|
| 150 | + // setup the input for this field |
|
| 151 | + $placeholder = "test"; |
|
| 152 | + if ($field == "facebook") { $placeholder = "User.Name"; } |
|
| 153 | + if ($field == "google") { $placeholder = "############"; } |
|
| 154 | + if ($field == "github") { $placeholder = "User"; } |
|
| 155 | + if ($field == "twitter") { $placeholder = "@user"; } |
|
| 156 | + if ($field == "linkedin") { $placeholder = "CustomURL"; } |
|
| 157 | + if ($field == "pinterest") { $placeholder = "Username"; } |
|
| 158 | + if ($field == "tumblr") { $placeholder = "Username"; } |
|
| 159 | + if ($field == "instagram") { $placeholder = "@user"; } |
|
| 160 | + if ($field == "flickr") { $placeholder = "Username"; } |
|
| 161 | + if ($field == "youtube") { $placeholder = "Username"; } |
|
| 162 | + |
|
| 163 | + $params = array( |
|
| 164 | + 'name' => $field, |
|
| 165 | + 'id' => $field . 'Input', |
|
| 166 | + 'class' => 'editProfileFields gcconnex-basic-field gcconnex-social-media gcconnex-basic-' . $field, |
|
| 167 | + 'placeholder' => $placeholder, |
|
| 168 | + 'value' => $value |
|
| 169 | + ); |
|
| 170 | + |
|
| 171 | + echo elgg_view("input/text", $params); // input field |
|
| 172 | + |
|
| 173 | + echo '</div>'; // close div class="input-group" |
|
| 174 | + echo '</div>'; // close div class = basic-profile-field-wrapper |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + echo '</div>'; // close div class="basic-profile-social-media-wrapper" |
|
| 178 | + echo ' |
|
| 179 | 179 | |
| 180 | 180 | </div> |
| 181 | 181 | <div class="panel-footer text-right profile-edit-footer"> |
@@ -193,17 +193,17 @@ discard block |
||
| 193 | 193 | echo '</div>'; // close div class="gcconnex-profile-name" |
| 194 | 194 | //actions dropdown |
| 195 | 195 | if (elgg_get_page_owner_guid() != elgg_get_logged_in_user_guid()) { |
| 196 | - $menu = elgg_trigger_plugin_hook('register', "menu:user_hover", array('entity' => $user), array()); |
|
| 197 | - $builder = new ElggMenuBuilder($menu); |
|
| 198 | - $menu = $builder->getMenu(); |
|
| 199 | - $actions = elgg_extract('action', $menu, array()); |
|
| 200 | - $admin = elgg_extract('admin', $menu, array()); |
|
| 201 | - $profile_actions = ''; |
|
| 196 | + $menu = elgg_trigger_plugin_hook('register', "menu:user_hover", array('entity' => $user), array()); |
|
| 197 | + $builder = new ElggMenuBuilder($menu); |
|
| 198 | + $menu = $builder->getMenu(); |
|
| 199 | + $actions = elgg_extract('action', $menu, array()); |
|
| 200 | + $admin = elgg_extract('admin', $menu, array()); |
|
| 201 | + $profile_actions = ''; |
|
| 202 | 202 | |
| 203 | 203 | // cyu - GCCON-151 : Add colleague in FR not there (inconsistent FR and EN menu layout) & other issues |
| 204 | - if (elgg_is_logged_in() && $actions) { |
|
| 204 | + if (elgg_is_logged_in() && $actions) { |
|
| 205 | 205 | $btn_friend_request = ''; |
| 206 | - foreach ($actions as $action) { |
|
| 206 | + foreach ($actions as $action) { |
|
| 207 | 207 | |
| 208 | 208 | if (strcmp($action->getName(),'add_friend') == 0 || strcmp($action->getName(),'remove_friend') == 0) { |
| 209 | 209 | if (!check_entity_relationship(elgg_get_logged_in_user_guid(),'friendrequest',$user->getGUID())) { |
@@ -224,30 +224,30 @@ discard block |
||
| 224 | 224 | } else |
| 225 | 225 | $profile_actions .= '<li>' . $action->getContent(array('class' => 'gcconnex-basic-profile-actions')) . '</li>'; |
| 226 | 226 | } |
| 227 | - } |
|
| 228 | - } |
|
| 229 | - if(elgg_is_logged_in()){ |
|
| 227 | + } |
|
| 228 | + } |
|
| 229 | + if(elgg_is_logged_in()){ |
|
| 230 | 230 | echo "<button type='button' class='btn btn-primary' onclick='location.href=\"{$btn_friend_request_link}\"'>{$btn_friend_request}</button>"; // cyu - added button and removed from actions toggle |
| 231 | 231 | |
| 232 | - echo $add . '<div class="btn-group"><button type="button" class="btn btn-custom mrgn-rght-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
|
| 232 | + echo $add . '<div class="btn-group"><button type="button" class="btn btn-custom mrgn-rght-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
|
| 233 | 233 | ' . elgg_echo('profile:actions') . ' <span class="caret"></span> |
| 234 | 234 | </button> |
| 235 | 235 | <ul class="dropdown-menu pull-right clearfix">'; |
| 236 | - echo $profile_actions; |
|
| 237 | - echo '</ul></div>'; |
|
| 238 | - } |
|
| 236 | + echo $profile_actions; |
|
| 237 | + echo '</ul></div>'; |
|
| 238 | + } |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | // if admin, display admin links |
| 242 | 242 | $admin_links = ''; |
| 243 | 243 | if (elgg_is_admin_logged_in() && elgg_get_logged_in_user_guid() != elgg_get_page_owner_guid()) { |
| 244 | - $text = elgg_echo('admin:options'); |
|
| 244 | + $text = elgg_echo('admin:options'); |
|
| 245 | 245 | |
| 246 | - foreach ($admin as $menu_item) { |
|
| 247 | - $admin_links .= '<li>' . elgg_view('navigation/menu/elements/item', array('item' => $menu_item)) . '</li>'; |
|
| 248 | - } |
|
| 246 | + foreach ($admin as $menu_item) { |
|
| 247 | + $admin_links .= '<li>' . elgg_view('navigation/menu/elements/item', array('item' => $menu_item)) . '</li>'; |
|
| 248 | + } |
|
| 249 | 249 | |
| 250 | - echo '<div class="pull-right btn-group"><button type="button" class="btn btn-custom pull-right dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">' . |
|
| 250 | + echo '<div class="pull-right btn-group"><button type="button" class="btn btn-custom pull-right dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">' . |
|
| 251 | 251 | $text . '<span class="caret"></span> |
| 252 | 252 | </button> |
| 253 | 253 | <ul class="dropdown-menu pull-right clearfix">' . $admin_links . '</ul></div>'; |
@@ -266,24 +266,24 @@ discard block |
||
| 266 | 266 | echo '<div class="gcconnex-profile-contact-info">'; |
| 267 | 267 | |
| 268 | 268 | if ($user->phone != null) { |
| 269 | - echo '<p class="mrgn-bttm-sm"><i class="fa fa-phone fa-lg"></i> ' . $user->phone . '</p>'; |
|
| 269 | + echo '<p class="mrgn-bttm-sm"><i class="fa fa-phone fa-lg"></i> ' . $user->phone . '</p>'; |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | if ($user->mobile != null) { |
| 273 | - echo '<p class="mrgn-bttm-sm"><i class="fa fa-mobile fa-lg"></i> ' . $user->mobile . '</p>'; |
|
| 273 | + echo '<p class="mrgn-bttm-sm"><i class="fa fa-mobile fa-lg"></i> ' . $user->mobile . '</p>'; |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | if ($user->email != null) { |
| 277 | - echo '<p class="mrgn-bttm-sm"><i class="fa fa-envelope fa-lg"></i> <a href="mailto:' . $user->email . '">' . $user->email . '</a></p>'; |
|
| 277 | + echo '<p class="mrgn-bttm-sm"><i class="fa fa-envelope fa-lg"></i> <a href="mailto:' . $user->email . '">' . $user->email . '</a></p>'; |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | if ($user->website != null) { |
| 281 | - echo '<p class="mrgn-bttm-sm"><i class="fa fa-globe fa-lg"></i> '; |
|
| 282 | - echo elgg_view('output/url', array( |
|
| 283 | - 'href' => $user->website, |
|
| 284 | - 'text' => $user->website |
|
| 285 | - )); |
|
| 286 | - echo '</p>'; |
|
| 281 | + echo '<p class="mrgn-bttm-sm"><i class="fa fa-globe fa-lg"></i> '; |
|
| 282 | + echo elgg_view('output/url', array( |
|
| 283 | + 'href' => $user->website, |
|
| 284 | + 'text' => $user->website |
|
| 285 | + )); |
|
| 286 | + echo '</p>'; |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | echo '</div></div>'; // close div class="gcconnex-profile-contact-info" |
@@ -294,22 +294,22 @@ discard block |
||
| 294 | 294 | echo '<div class="gcconnex-profile-social-media-links mrgn-bttm-sm mrgn-lft-md">'; |
| 295 | 295 | foreach ($social as $media) { |
| 296 | 296 | |
| 297 | - if ($link = $user->get($media)) { |
|
| 297 | + if ($link = $user->get($media)) { |
|
| 298 | 298 | |
| 299 | - if ($media == 'facebook') { $link = "http://www.facebook.com/" . $link; $class = "fa-facebook";} |
|
| 300 | - if ($media == 'google') { $link = "http://plus.google.com/" . $link; $class = "fa-google-plus";} |
|
| 301 | - if ($media == 'github') { $link = "https://github.com/" . $link; $class = "fa-github";} |
|
| 302 | - if ($media == 'twitter') { $link = "https://twitter.com/" . $link; $class = "fa-twitter";} |
|
| 303 | - if ($media == 'linkedin') { $link = "http://ca.linkedin.com/in/" . $link; $class = "fa-linkedin";} |
|
| 304 | - if ($media == 'pinterest') { $link = "http://www.pinterest.com/" . $link; $class = "fa-pinterest";} |
|
| 305 | - if ($media == 'tumblr') { $link = "https://www.tumblr.com/blog/" . $link; $class = "fa-tumblr";} |
|
| 306 | - if ($media == 'instagram') { $link = "http://instagram.com/" . $link; $class = "fa-instagram";} |
|
| 307 | - if ($media == 'flickr') { $link = "http://flickr.com/" . $link; $class = "fa-flickr"; } |
|
| 308 | - if ($media == 'youtube') { $link = "http://www.youtube.com/" . $link; $class = "fa-youtube";} |
|
| 299 | + if ($media == 'facebook') { $link = "http://www.facebook.com/" . $link; $class = "fa-facebook";} |
|
| 300 | + if ($media == 'google') { $link = "http://plus.google.com/" . $link; $class = "fa-google-plus";} |
|
| 301 | + if ($media == 'github') { $link = "https://github.com/" . $link; $class = "fa-github";} |
|
| 302 | + if ($media == 'twitter') { $link = "https://twitter.com/" . $link; $class = "fa-twitter";} |
|
| 303 | + if ($media == 'linkedin') { $link = "http://ca.linkedin.com/in/" . $link; $class = "fa-linkedin";} |
|
| 304 | + if ($media == 'pinterest') { $link = "http://www.pinterest.com/" . $link; $class = "fa-pinterest";} |
|
| 305 | + if ($media == 'tumblr') { $link = "https://www.tumblr.com/blog/" . $link; $class = "fa-tumblr";} |
|
| 306 | + if ($media == 'instagram') { $link = "http://instagram.com/" . $link; $class = "fa-instagram";} |
|
| 307 | + if ($media == 'flickr') { $link = "http://flickr.com/" . $link; $class = "fa-flickr"; } |
|
| 308 | + if ($media == 'youtube') { $link = "http://www.youtube.com/" . $link; $class = "fa-youtube";} |
|
| 309 | 309 | |
| 310 | - echo '<a href="' . $link . '" target="_blank"><i class="socialMediaIcons fa ' . $class . ' fa-2x"></i></a>'; |
|
| 310 | + echo '<a href="' . $link . '" target="_blank"><i class="socialMediaIcons fa ' . $class . ' fa-2x"></i></a>'; |
|
| 311 | 311 | |
| 312 | - } |
|
| 312 | + } |
|
| 313 | 313 | } |
| 314 | 314 | echo '</div>'; // close div class="gcconnex-profile-social-media-links" |
| 315 | 315 | echo '</div>'; |
@@ -326,16 +326,16 @@ discard block |
||
| 326 | 326 | |
| 327 | 327 | $profile_actions = ''; |
| 328 | 328 | if (elgg_is_logged_in() && $actions) { |
| 329 | - $profile_actions = '<ul class="elgg-menu profile-action-menu mvm">'; |
|
| 330 | - foreach ($actions as $action) { |
|
| 331 | - $profile_actions .= '<li>' . $action->getContent(array('class' => 'elgg-button elgg-button-action')) . '</li>'; |
|
| 332 | - } |
|
| 333 | - $profile_actions .= '</ul>'; |
|
| 329 | + $profile_actions = '<ul class="elgg-menu profile-action-menu mvm">'; |
|
| 330 | + foreach ($actions as $action) { |
|
| 331 | + $profile_actions .= '<li>' . $action->getContent(array('class' => 'elgg-button elgg-button-action')) . '</li>'; |
|
| 332 | + } |
|
| 333 | + $profile_actions .= '</ul>'; |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | // content links |
| 337 | 337 | $content_menu_title = elgg_echo('gcconnex_profile:user_content'); |
| 338 | 338 | $content_menu = elgg_view_menu('owner_block', array( |
| 339 | - 'entity' => elgg_get_page_owner_entity(), |
|
| 340 | - 'class' => 'profile-content-menu', |
|
| 339 | + 'entity' => elgg_get_page_owner_entity(), |
|
| 340 | + 'class' => 'profile-content-menu', |
|
| 341 | 341 | )); |
@@ -28,8 +28,8 @@ discard block |
||
| 28 | 28 | echo '<h2 class="modal-title">' . elgg_echo('gcconnex_profile:basic:header') . '</h2>'; |
| 29 | 29 | echo '</header>'; |
| 30 | 30 | echo '<div class="panel-body overflow-body">'; |
| 31 | - $editAvatar = elgg_get_site_url(). 'avatar/edit/' . $user->username; |
|
| 32 | - echo '<div><a href='.$editAvatar.' class="btn btn-primary">'. elgg_echo('gcconnex_profile:profile:edit_avatar') .'</a></div>'; |
|
| 31 | + $editAvatar = elgg_get_site_url() . 'avatar/edit/' . $user->username; |
|
| 32 | + echo '<div><a href=' . $editAvatar . ' class="btn btn-primary">' . elgg_echo('gcconnex_profile:profile:edit_avatar') . '</a></div>'; |
|
| 33 | 33 | echo '<div class="basic-profile-standard-field-wrapper col-md-6 col-xs-12">'; // container for css styling, used to group profile content and display them seperately from other fields |
| 34 | 34 | |
| 35 | 35 | $fields = array('Name', 'Job', 'Department', 'Location', 'Phone', 'Mobile', 'Email', 'Website'); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | 'subtype' => 'dept_list', |
| 58 | 58 | 'owner_guid' => 0 |
| 59 | 59 | )); |
| 60 | - if (get_current_language()=='en'){ |
|
| 60 | + if (get_current_language() == 'en') { |
|
| 61 | 61 | $departments = $obj[0]->deptsEn; |
| 62 | 62 | $departments = json_decode($departments, true); |
| 63 | 63 | $provinces['pov-alb'] = 'Government of Alberta'; |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | $provinces['pov-que'] = 'Government of Quebec'; |
| 74 | 74 | $provinces['pov-sask'] = 'Government of Saskatchewan'; |
| 75 | 75 | $provinces['pov-yuk'] = 'Government of Yukon'; |
| 76 | - $departments = array_merge($departments,$provinces); |
|
| 77 | - }else{ |
|
| 76 | + $departments = array_merge($departments, $provinces); |
|
| 77 | + } else { |
|
| 78 | 78 | $departments = $obj[0]->deptsFr; |
| 79 | 79 | $departments = json_decode($departments, true); |
| 80 | 80 | $provinces['pov-alb'] = "Gouvernement de l'Alberta"; |
@@ -90,13 +90,13 @@ discard block |
||
| 90 | 90 | $provinces['pov-que'] = 'Gouvernement du Québec'; |
| 91 | 91 | $provinces['pov-sask'] = 'Gouvernement de Saskatchewan'; |
| 92 | 92 | $provinces['pov-yuk'] = 'Gouvernement du Yukon'; |
| 93 | - $departments = array_merge($departments,$provinces); |
|
| 93 | + $departments = array_merge($departments, $provinces); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $value = explode(" / ", $value); |
| 97 | 97 | $key = array_search($value[0], $departments); |
| 98 | 98 | |
| 99 | - if ($key === false){ |
|
| 99 | + if ($key === false) { |
|
| 100 | 100 | $key = array_search($value[1], $departments); |
| 101 | 101 | } |
| 102 | 102 | echo elgg_view('input/select', array( |
@@ -205,20 +205,20 @@ discard block |
||
| 205 | 205 | $btn_friend_request = ''; |
| 206 | 206 | foreach ($actions as $action) { |
| 207 | 207 | |
| 208 | - if (strcmp($action->getName(),'add_friend') == 0 || strcmp($action->getName(),'remove_friend') == 0) { |
|
| 209 | - if (!check_entity_relationship(elgg_get_logged_in_user_guid(),'friendrequest',$user->getGUID())) { |
|
| 210 | - if ($user->isFriend() && strcmp($action->getName(),'remove_friend') == 0) { |
|
| 208 | + if (strcmp($action->getName(), 'add_friend') == 0 || strcmp($action->getName(), 'remove_friend') == 0) { |
|
| 209 | + if (!check_entity_relationship(elgg_get_logged_in_user_guid(), 'friendrequest', $user->getGUID())) { |
|
| 210 | + if ($user->isFriend() && strcmp($action->getName(), 'remove_friend') == 0) { |
|
| 211 | 211 | $btn_friend_request = $action->getContent(); |
| 212 | 212 | $btn_friend_request_link = $action->getHref(); |
| 213 | 213 | } |
| 214 | - if (!$user->isFriend() && strcmp($action->getName(),'add_friend') == 0) { |
|
| 214 | + if (!$user->isFriend() && strcmp($action->getName(), 'add_friend') == 0) { |
|
| 215 | 215 | $btn_friend_request = $action->getContent(array('class' => 'asdfasdasfad')); |
| 216 | 216 | $btn_friend_request_link = $action->getHref(); |
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | 219 | } else { |
| 220 | 220 | |
| 221 | - if (check_entity_relationship(elgg_get_logged_in_user_guid(),'friendrequest',$user->getGUID()) && strcmp($action->getName(),'friend_request') == 0) { |
|
| 221 | + if (check_entity_relationship(elgg_get_logged_in_user_guid(), 'friendrequest', $user->getGUID()) && strcmp($action->getName(), 'friend_request') == 0) { |
|
| 222 | 222 | $btn_friend_request_link = $action->getHref(); |
| 223 | 223 | $btn_friend_request = $action->getContent(); |
| 224 | 224 | } else |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | } |
| 229 | - if(elgg_is_logged_in()){ |
|
| 229 | + if (elgg_is_logged_in()) { |
|
| 230 | 230 | echo "<button type='button' class='btn btn-primary' onclick='location.href=\"{$btn_friend_request_link}\"'>{$btn_friend_request}</button>"; // cyu - added button and removed from actions toggle |
| 231 | 231 | |
| 232 | 232 | echo $add . '<div class="btn-group"><button type="button" class="btn btn-custom mrgn-rght-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | echo '<div class="pull-right btn-group"><button type="button" class="btn btn-custom pull-right dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">' . |
| 251 | - $text . '<span class="caret"></span> |
|
| 251 | + $text . '<span class="caret"></span> |
|
| 252 | 252 | </button> |
| 253 | 253 | <ul class="dropdown-menu pull-right clearfix">' . $admin_links . '</ul></div>'; |
| 254 | 254 | } |
@@ -296,16 +296,16 @@ discard block |
||
| 296 | 296 | |
| 297 | 297 | if ($link = $user->get($media)) { |
| 298 | 298 | |
| 299 | - if ($media == 'facebook') { $link = "http://www.facebook.com/" . $link; $class = "fa-facebook";} |
|
| 300 | - if ($media == 'google') { $link = "http://plus.google.com/" . $link; $class = "fa-google-plus";} |
|
| 301 | - if ($media == 'github') { $link = "https://github.com/" . $link; $class = "fa-github";} |
|
| 302 | - if ($media == 'twitter') { $link = "https://twitter.com/" . $link; $class = "fa-twitter";} |
|
| 303 | - if ($media == 'linkedin') { $link = "http://ca.linkedin.com/in/" . $link; $class = "fa-linkedin";} |
|
| 304 | - if ($media == 'pinterest') { $link = "http://www.pinterest.com/" . $link; $class = "fa-pinterest";} |
|
| 305 | - if ($media == 'tumblr') { $link = "https://www.tumblr.com/blog/" . $link; $class = "fa-tumblr";} |
|
| 306 | - if ($media == 'instagram') { $link = "http://instagram.com/" . $link; $class = "fa-instagram";} |
|
| 299 | + if ($media == 'facebook') { $link = "http://www.facebook.com/" . $link; $class = "fa-facebook"; } |
|
| 300 | + if ($media == 'google') { $link = "http://plus.google.com/" . $link; $class = "fa-google-plus"; } |
|
| 301 | + if ($media == 'github') { $link = "https://github.com/" . $link; $class = "fa-github"; } |
|
| 302 | + if ($media == 'twitter') { $link = "https://twitter.com/" . $link; $class = "fa-twitter"; } |
|
| 303 | + if ($media == 'linkedin') { $link = "http://ca.linkedin.com/in/" . $link; $class = "fa-linkedin"; } |
|
| 304 | + if ($media == 'pinterest') { $link = "http://www.pinterest.com/" . $link; $class = "fa-pinterest"; } |
|
| 305 | + if ($media == 'tumblr') { $link = "https://www.tumblr.com/blog/" . $link; $class = "fa-tumblr"; } |
|
| 306 | + if ($media == 'instagram') { $link = "http://instagram.com/" . $link; $class = "fa-instagram"; } |
|
| 307 | 307 | if ($media == 'flickr') { $link = "http://flickr.com/" . $link; $class = "fa-flickr"; } |
| 308 | - if ($media == 'youtube') { $link = "http://www.youtube.com/" . $link; $class = "fa-youtube";} |
|
| 308 | + if ($media == 'youtube') { $link = "http://www.youtube.com/" . $link; $class = "fa-youtube"; } |
|
| 309 | 309 | |
| 310 | 310 | echo '<a href="' . $link . '" target="_blank"><i class="socialMediaIcons fa ' . $class . ' fa-2x"></i></a>'; |
| 311 | 311 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $provinces['pov-sask'] = 'Government of Saskatchewan'; |
| 75 | 75 | $provinces['pov-yuk'] = 'Government of Yukon'; |
| 76 | 76 | $departments = array_merge($departments,$provinces); |
| 77 | - }else{ |
|
| 77 | + } else{ |
|
| 78 | 78 | $departments = $obj[0]->deptsFr; |
| 79 | 79 | $departments = json_decode($departments, true); |
| 80 | 80 | $provinces['pov-alb'] = "Gouvernement de l'Alberta"; |
@@ -107,8 +107,7 @@ discard block |
||
| 107 | 107 | 'options_values' => $departments, |
| 108 | 108 | |
| 109 | 109 | )); |
| 110 | - } |
|
| 111 | - else { |
|
| 110 | + } else { |
|
| 112 | 111 | echo '<div class="basic-profile-field">'; // field wrapper for css styling |
| 113 | 112 | |
| 114 | 113 | echo elgg_view("input/text", $params); |
@@ -221,8 +220,9 @@ discard block |
||
| 221 | 220 | if (check_entity_relationship(elgg_get_logged_in_user_guid(),'friendrequest',$user->getGUID()) && strcmp($action->getName(),'friend_request') == 0) { |
| 222 | 221 | $btn_friend_request_link = $action->getHref(); |
| 223 | 222 | $btn_friend_request = $action->getContent(); |
| 224 | - } else |
|
| 225 | - $profile_actions .= '<li>' . $action->getContent(array('class' => 'gcconnex-basic-profile-actions')) . '</li>'; |
|
| 223 | + } else { |
|
| 224 | + $profile_actions .= '<li>' . $action->getContent(array('class' => 'gcconnex-basic-profile-actions')) . '</li>'; |
|
| 225 | + } |
|
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | } |