@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $entity = get_entity($reshare_guid); |
| 40 | 40 | $wire_entity = get_entity($guid); |
| 41 | 41 | |
| 42 | - if ($entity->getType() == 'group'){ |
|
| 42 | + if ($entity->getType() == 'group') { |
|
| 43 | 43 | $entity->title = $entity->name; |
| 44 | 44 | } |
| 45 | 45 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | 'cp_content_reshared' => $entity, |
| 54 | 54 | 'cp_wire_url' => $wire_entity->getURL(), |
| 55 | 55 | ); |
| 56 | - elgg_trigger_plugin_hook('cp_overwrite_notification','all',$message); |
|
| 56 | + elgg_trigger_plugin_hook('cp_overwrite_notification', 'all', $message); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
@@ -63,8 +63,8 @@ |
||
| 63 | 63 | |
| 64 | 64 | // Notifies the mission manager of the candidates refusal. |
| 65 | 65 | $mission_link = elgg_view('output/url', array( |
| 66 | - 'href' => $mission->getURL(), |
|
| 67 | - 'text' => elgg_get_excerpt($mission->job_title, elgg_get_plugin_setting('mission_job_title_card_cutoff', 'missions')) |
|
| 66 | + 'href' => $mission->getURL(), |
|
| 67 | + 'text' => elgg_get_excerpt($mission->job_title, elgg_get_plugin_setting('mission_job_title_card_cutoff', 'missions')) |
|
| 68 | 68 | )); |
| 69 | 69 | |
| 70 | 70 | $subject = elgg_echo('missions:applicant_leaves', array($applicant->name)); |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | // Processes the reason given by the declining user whether it's from the dropdown menu or the free text entry. |
| 17 | 17 | $reason = get_input('reason'); |
| 18 | -if($reason == 'missions:other') { |
|
| 18 | +if ($reason == 'missions:other') { |
|
| 19 | 19 | $raw_reason = $reason; |
| 20 | 20 | $reason = get_input('other_text'); |
| 21 | 21 | } |
@@ -24,25 +24,25 @@ discard block |
||
| 24 | 24 | $reason = elgg_echo($reason); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | -if(trim($reason) == '') { |
|
| 27 | +if (trim($reason) == '') { |
|
| 28 | 28 | register_error(elgg_echo('missions:please_give_reason_for_declination')); |
| 29 | 29 | forward(REFERER); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | // Deletes the tentative relationship between mission and applicant. |
| 33 | -if(check_entity_relationship($mission->guid, 'mission_tentative', $applicant->guid)) { |
|
| 33 | +if (check_entity_relationship($mission->guid, 'mission_tentative', $applicant->guid)) { |
|
| 34 | 34 | $message_return = 'missions:declination_has_been_sent'; |
| 35 | 35 | remove_entity_relationship($mission->guid, 'mission_tentative', $applicant->guid); |
| 36 | 36 | } |
| 37 | -if(check_entity_relationship($mission->guid, 'mission_applied', $applicant->guid)) { |
|
| 37 | +if (check_entity_relationship($mission->guid, 'mission_applied', $applicant->guid)) { |
|
| 38 | 38 | $message_return = 'missions:withdrawal_has_been_sent'; |
| 39 | 39 | remove_entity_relationship($mission->guid, 'mission_applied', $applicant->guid); |
| 40 | 40 | } |
| 41 | -if(check_entity_relationship($mission->guid, 'mission_offered', $applicant->guid)) { |
|
| 41 | +if (check_entity_relationship($mission->guid, 'mission_offered', $applicant->guid)) { |
|
| 42 | 42 | $message_return = 'missions:declination_has_been_sent'; |
| 43 | 43 | remove_entity_relationship($mission->guid, 'mission_offered', $applicant->guid); |
| 44 | 44 | } |
| 45 | -if(check_entity_relationship($mission->guid, 'mission_accepted', $applicant->guid)) { |
|
| 45 | +if (check_entity_relationship($mission->guid, 'mission_accepted', $applicant->guid)) { |
|
| 46 | 46 | $message_return = 'missions:withdrawal_has_been_sent'; |
| 47 | 47 | remove_entity_relationship($mission->guid, 'mission_accepted', $applicant->guid); |
| 48 | 48 | mm_complete_mission_inprogress_reports($mission, true); |
@@ -18,8 +18,7 @@ |
||
| 18 | 18 | if($reason == 'missions:other') { |
| 19 | 19 | $raw_reason = $reason; |
| 20 | 20 | $reason = get_input('other_text'); |
| 21 | -} |
|
| 22 | -else { |
|
| 21 | +} else { |
|
| 23 | 22 | $raw_reason = $reason; |
| 24 | 23 | $reason = elgg_echo($reason); |
| 25 | 24 | } |
@@ -15,84 +15,84 @@ |
||
| 15 | 15 | $search = $_GET['search']; |
| 16 | 16 | |
| 17 | 17 | if ($search_form['simple'] == '') { |
| 18 | - $search_form['simple'] = $search; |
|
| 18 | + $search_form['simple'] = $search; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | if(trim($search_form['simple']) == '' ) { |
| 22 | 22 | |
| 23 | - $err .= elgg_echo('missions:error:search_field_empty'); |
|
| 23 | + $err .= elgg_echo('missions:error:search_field_empty'); |
|
| 24 | 24 | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | // Currently no error checking is being done for the search form |
| 28 | 28 | if ($err != '') { |
| 29 | - register_error($err); |
|
| 30 | - forward(REFERER); |
|
| 29 | + register_error($err); |
|
| 30 | + forward(REFERER); |
|
| 31 | 31 | } else { |
| 32 | - $array = array(); |
|
| 32 | + $array = array(); |
|
| 33 | 33 | |
| 34 | - switch($_SESSION['mission_search_switch']) { |
|
| 35 | - case 'candidate': |
|
| 36 | - // A multipurpose query which will be applied to skills, experience and education objects. |
|
| 37 | - if (!empty($search_form['simple'])) { |
|
| 38 | - $string_to_array = explode(',', str_replace(', ', ',', $search_form['simple'])); |
|
| 34 | + switch($_SESSION['mission_search_switch']) { |
|
| 35 | + case 'candidate': |
|
| 36 | + // A multipurpose query which will be applied to skills, experience and education objects. |
|
| 37 | + if (!empty($search_form['simple'])) { |
|
| 38 | + $string_to_array = explode(',', str_replace(', ', ',', $search_form['simple'])); |
|
| 39 | 39 | |
| 40 | - foreach($string_to_array as $value) { |
|
| 41 | - $array[] = preg_replace('/[^\p{L}\p{N}_]+/u', ' ', $value); |
|
| 42 | - } |
|
| 43 | - } |
|
| 44 | - $returned = mm_simple_search_database_for_candidates($array, max($_SESSION['candidate_entities_per_page'], 10)); |
|
| 45 | - break; |
|
| 46 | - default: |
|
| 47 | - // A broad range search which determines whether the input text exists within the title, type or description of the mission. |
|
| 48 | - // This also checks guid but this is mostly for testing and admin purposes. |
|
| 49 | - if (! empty($search_form['simple'])) { |
|
| 50 | - $array[0] = array( |
|
| 51 | - 'name' => 'job_title', |
|
| 52 | - 'operand' => 'LIKE', |
|
| 53 | - 'value' => '%' . $search_form['simple'] . '%' |
|
| 54 | - ); |
|
| 55 | - $array[1] = array( |
|
| 56 | - 'name' => 'descriptor', |
|
| 57 | - 'operand' => 'LIKE', |
|
| 58 | - 'value' => '%' . $search_form['simple'] . '%' |
|
| 59 | - ); |
|
| 60 | - $array[2] = array( |
|
| 61 | - 'name' => 'meta_guid', |
|
| 62 | - 'operand' => '=', |
|
| 63 | - 'value' => $search_form['simple'] |
|
| 64 | - ); |
|
| 40 | + foreach($string_to_array as $value) { |
|
| 41 | + $array[] = preg_replace('/[^\p{L}\p{N}_]+/u', ' ', $value); |
|
| 42 | + } |
|
| 43 | + } |
|
| 44 | + $returned = mm_simple_search_database_for_candidates($array, max($_SESSION['candidate_entities_per_page'], 10)); |
|
| 45 | + break; |
|
| 46 | + default: |
|
| 47 | + // A broad range search which determines whether the input text exists within the title, type or description of the mission. |
|
| 48 | + // This also checks guid but this is mostly for testing and admin purposes. |
|
| 49 | + if (! empty($search_form['simple'])) { |
|
| 50 | + $array[0] = array( |
|
| 51 | + 'name' => 'job_title', |
|
| 52 | + 'operand' => 'LIKE', |
|
| 53 | + 'value' => '%' . $search_form['simple'] . '%' |
|
| 54 | + ); |
|
| 55 | + $array[1] = array( |
|
| 56 | + 'name' => 'descriptor', |
|
| 57 | + 'operand' => 'LIKE', |
|
| 58 | + 'value' => '%' . $search_form['simple'] . '%' |
|
| 59 | + ); |
|
| 60 | + $array[2] = array( |
|
| 61 | + 'name' => 'meta_guid', |
|
| 62 | + 'operand' => '=', |
|
| 63 | + 'value' => $search_form['simple'] |
|
| 64 | + ); |
|
| 65 | 65 | |
| 66 | - $translation_key = mm_get_translation_key_from_setting_string($search_form['simple'], elgg_get_plugin_setting('opportunity_type_string', 'missions')); |
|
| 67 | - if($translation_key) { |
|
| 68 | - $array[3] = array( |
|
| 69 | - 'name' => 'job_type', |
|
| 70 | - 'operand' => '=', |
|
| 71 | - 'value' => $translation_key |
|
| 72 | - ); |
|
| 73 | - } |
|
| 74 | - } |
|
| 66 | + $translation_key = mm_get_translation_key_from_setting_string($search_form['simple'], elgg_get_plugin_setting('opportunity_type_string', 'missions')); |
|
| 67 | + if($translation_key) { |
|
| 68 | + $array[3] = array( |
|
| 69 | + 'name' => 'job_type', |
|
| 70 | + 'operand' => '=', |
|
| 71 | + 'value' => $translation_key |
|
| 72 | + ); |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - // Specify which missions' states we would like to filter by. Inclusive. |
|
| 77 | - $mission_state_include_array = ['posted']; |
|
| 78 | - if (isset($_SESSION['mission_search_switch_subtype']) && $_SESSION['mission_search_switch_subtype'] == 'archive') { |
|
| 79 | - $mission_state_include_array = ['cancelled', 'completed']; |
|
| 80 | - unset($_SESSION['mission_search_switch_subtype']); |
|
| 81 | - } |
|
| 76 | + // Specify which missions' states we would like to filter by. Inclusive. |
|
| 77 | + $mission_state_include_array = ['posted']; |
|
| 78 | + if (isset($_SESSION['mission_search_switch_subtype']) && $_SESSION['mission_search_switch_subtype'] == 'archive') { |
|
| 79 | + $mission_state_include_array = ['cancelled', 'completed']; |
|
| 80 | + unset($_SESSION['mission_search_switch_subtype']); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - $returned = mm_search_database_for_missions($array, 'OR', elgg_get_plugin_setting('search_limit', 'missions'), $mission_state_include_array); |
|
| 84 | - } |
|
| 83 | + $returned = mm_search_database_for_missions($array, 'OR', elgg_get_plugin_setting('search_limit', 'missions'), $mission_state_include_array); |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - if (! $returned) { |
|
| 87 | - forward(REFERER); |
|
| 88 | - } else { |
|
| 89 | - // reset the offset on new search |
|
| 90 | - $ref = $_SERVER['HTTP_REFERER']; |
|
| 91 | - $ref = preg_replace('/([?&])offset=[^&]+(&|$)/','$1', $ref); |
|
| 92 | - // elgg_clear_sticky_form('searchsimplefill'); |
|
| 93 | - if($search_form['hidden_return']) { |
|
| 94 | - forward($ref); |
|
| 95 | - } |
|
| 96 | - forward(elgg_get_site_url() . 'missions/display-search-set'); |
|
| 97 | - } |
|
| 86 | + if (! $returned) { |
|
| 87 | + forward(REFERER); |
|
| 88 | + } else { |
|
| 89 | + // reset the offset on new search |
|
| 90 | + $ref = $_SERVER['HTTP_REFERER']; |
|
| 91 | + $ref = preg_replace('/([?&])offset=[^&]+(&|$)/','$1', $ref); |
|
| 92 | + // elgg_clear_sticky_form('searchsimplefill'); |
|
| 93 | + if($search_form['hidden_return']) { |
|
| 94 | + forward($ref); |
|
| 95 | + } |
|
| 96 | + forward(elgg_get_site_url() . 'missions/display-search-set'); |
|
| 97 | + } |
|
| 98 | 98 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | $search_form['simple'] = $search; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | -if(trim($search_form['simple']) == '' ) { |
|
| 21 | +if (trim($search_form['simple']) == '') { |
|
| 22 | 22 | |
| 23 | 23 | $err .= elgg_echo('missions:error:search_field_empty'); |
| 24 | 24 | |
@@ -31,13 +31,13 @@ discard block |
||
| 31 | 31 | } else { |
| 32 | 32 | $array = array(); |
| 33 | 33 | |
| 34 | - switch($_SESSION['mission_search_switch']) { |
|
| 34 | + switch ($_SESSION['mission_search_switch']) { |
|
| 35 | 35 | case 'candidate': |
| 36 | 36 | // A multipurpose query which will be applied to skills, experience and education objects. |
| 37 | 37 | if (!empty($search_form['simple'])) { |
| 38 | 38 | $string_to_array = explode(',', str_replace(', ', ',', $search_form['simple'])); |
| 39 | 39 | |
| 40 | - foreach($string_to_array as $value) { |
|
| 40 | + foreach ($string_to_array as $value) { |
|
| 41 | 41 | $array[] = preg_replace('/[^\p{L}\p{N}_]+/u', ' ', $value); |
| 42 | 42 | } |
| 43 | 43 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | default: |
| 47 | 47 | // A broad range search which determines whether the input text exists within the title, type or description of the mission. |
| 48 | 48 | // This also checks guid but this is mostly for testing and admin purposes. |
| 49 | - if (! empty($search_form['simple'])) { |
|
| 49 | + if (!empty($search_form['simple'])) { |
|
| 50 | 50 | $array[0] = array( |
| 51 | 51 | 'name' => 'job_title', |
| 52 | 52 | 'operand' => 'LIKE', |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | 66 | $translation_key = mm_get_translation_key_from_setting_string($search_form['simple'], elgg_get_plugin_setting('opportunity_type_string', 'missions')); |
| 67 | - if($translation_key) { |
|
| 67 | + if ($translation_key) { |
|
| 68 | 68 | $array[3] = array( |
| 69 | 69 | 'name' => 'job_type', |
| 70 | 70 | 'operand' => '=', |
@@ -83,14 +83,14 @@ discard block |
||
| 83 | 83 | $returned = mm_search_database_for_missions($array, 'OR', elgg_get_plugin_setting('search_limit', 'missions'), $mission_state_include_array); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - if (! $returned) { |
|
| 86 | + if (!$returned) { |
|
| 87 | 87 | forward(REFERER); |
| 88 | 88 | } else { |
| 89 | 89 | // reset the offset on new search |
| 90 | 90 | $ref = $_SERVER['HTTP_REFERER']; |
| 91 | - $ref = preg_replace('/([?&])offset=[^&]+(&|$)/','$1', $ref); |
|
| 91 | + $ref = preg_replace('/([?&])offset=[^&]+(&|$)/', '$1', $ref); |
|
| 92 | 92 | // elgg_clear_sticky_form('searchsimplefill'); |
| 93 | - if($search_form['hidden_return']) { |
|
| 93 | + if ($search_form['hidden_return']) { |
|
| 94 | 94 | forward($ref); |
| 95 | 95 | } |
| 96 | 96 | forward(elgg_get_site_url() . 'missions/display-search-set'); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | add_entity_relationship($mission->guid, 'mission_offered', $applicant->guid); |
| 38 | 38 | |
| 39 | 39 | // Create a record of when the mission is offered for Analytics |
| 40 | - $ia = elgg_set_ignore_access(true); |
|
| 40 | + $ia = elgg_set_ignore_access(true); |
|
| 41 | 41 | $accept_record = new ElggObject(); |
| 42 | 42 | $accept_record->subtype = 'mission-wasoffered'; |
| 43 | 43 | $accept_record->title = 'Mission Offer Report'; |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $accept_record->owner_guid = $applicant->guid; |
| 46 | 46 | $accept_record->mission_guid = $mission->guid; |
| 47 | 47 | $accept_record->save(); |
| 48 | - elgg_set_ignore_access($ia); |
|
| 48 | + elgg_set_ignore_access($ia); |
|
| 49 | 49 | |
| 50 | 50 | $finalize_link = elgg_view('output/url', array( |
| 51 | 51 | 'href' => elgg_get_site_url() . 'missions/view/' . $mission->guid, |
@@ -15,11 +15,11 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | $err = ''; |
| 17 | 17 | |
| 18 | -if($mission == '') { |
|
| 18 | +if ($mission == '') { |
|
| 19 | 19 | $err .= elgg_echo('missions:error:entity_does_not_exist'); |
| 20 | 20 | } |
| 21 | 21 | else { |
| 22 | - if(!check_entity_relationship($mission->guid, 'mission_applied', $applicant->guid)) { |
|
| 22 | + if (!check_entity_relationship($mission->guid, 'mission_applied', $applicant->guid)) { |
|
| 23 | 23 | $err .= elgg_echo('missions:error:applicant_not_applied_to_mission', array($applicant->name)); |
| 24 | 24 | } |
| 25 | 25 | else { |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | 'count' => true |
| 30 | 30 | )); |
| 31 | 31 | |
| 32 | - if($relationship_count >= $mission->number) { |
|
| 32 | + if ($relationship_count >= $mission->number) { |
|
| 33 | 33 | $err .= elgg_echo('missions:error:mission_full'); |
| 34 | 34 | } |
| 35 | 35 | else { |
@@ -17,12 +17,10 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | if($mission == '') { |
| 19 | 19 | $err .= elgg_echo('missions:error:entity_does_not_exist'); |
| 20 | -} |
|
| 21 | -else { |
|
| 20 | +} else { |
|
| 22 | 21 | if(!check_entity_relationship($mission->guid, 'mission_applied', $applicant->guid)) { |
| 23 | 22 | $err .= elgg_echo('missions:error:applicant_not_applied_to_mission', array($applicant->name)); |
| 24 | - } |
|
| 25 | - else { |
|
| 23 | + } else { |
|
| 26 | 24 | $relationship_count = elgg_get_entities_from_relationship(array( |
| 27 | 25 | 'relationship' => 'mission_accepted', |
| 28 | 26 | 'relationship_guid' => $mission->guid, |
@@ -31,8 +29,7 @@ discard block |
||
| 31 | 29 | |
| 32 | 30 | if($relationship_count >= $mission->number) { |
| 33 | 31 | $err .= elgg_echo('missions:error:mission_full'); |
| 34 | - } |
|
| 35 | - else { |
|
| 32 | + } else { |
|
| 36 | 33 | remove_entity_relationship($mission->guid, 'mission_applied', $applicant->guid); |
| 37 | 34 | add_entity_relationship($mission->guid, 'mission_offered', $applicant->guid); |
| 38 | 35 | |
@@ -62,8 +59,7 @@ discard block |
||
| 62 | 59 | if ($err != '') { |
| 63 | 60 | register_error($err); |
| 64 | 61 | forward(REFERER); |
| 65 | -} |
|
| 66 | -else { |
|
| 62 | +} else { |
|
| 67 | 63 | system_message(elgg_echo('missions:offered_user_position', array($applicant->name, $mission->job_title))); |
| 68 | 64 | forward($mission->getURL()); |
| 69 | 65 | } |
| 70 | 66 | \ No newline at end of file |
@@ -37,41 +37,41 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | // Error reporting for bad user input |
| 39 | 39 | if ($err != '') { |
| 40 | - register_error($err); |
|
| 41 | - forward(REFERER); |
|
| 40 | + register_error($err); |
|
| 41 | + forward(REFERER); |
|
| 42 | 42 | } else { |
| 43 | - // $third_form = combine_time_table_from_array($third_form); |
|
| 43 | + // $third_form = combine_time_table_from_array($third_form); |
|
| 44 | 44 | |
| 45 | - // Creation of an ELGGObject of subtype Mission |
|
| 46 | - $mission = new ElggObject(); |
|
| 47 | - $mission->subtype = 'mission'; |
|
| 48 | - $mission->title = $second_form['job_title']; |
|
| 49 | - $mission->description = $second_form['description']; |
|
| 50 | - $mission->access_id = ACCESS_LOGGED_IN; |
|
| 51 | - $mission->owner_guid = elgg_get_logged_in_user_guid(); |
|
| 45 | + // Creation of an ELGGObject of subtype Mission |
|
| 46 | + $mission = new ElggObject(); |
|
| 47 | + $mission->subtype = 'mission'; |
|
| 48 | + $mission->title = $second_form['job_title']; |
|
| 49 | + $mission->description = $second_form['description']; |
|
| 50 | + $mission->access_id = ACCESS_LOGGED_IN; |
|
| 51 | + $mission->owner_guid = elgg_get_logged_in_user_guid(); |
|
| 52 | 52 | |
| 53 | - // Attaches the form data as metadata to the object |
|
| 54 | - $mission->name = $first_form['name']; |
|
| 53 | + // Attaches the form data as metadata to the object |
|
| 54 | + $mission->name = $first_form['name']; |
|
| 55 | 55 | |
| 56 | - // If the organization tree is loaded, then the custom dropdown values will be processed and stored. |
|
| 57 | - if(mo_get_tree_root()) { |
|
| 56 | + // If the organization tree is loaded, then the custom dropdown values will be processed and stored. |
|
| 57 | + if(mo_get_tree_root()) { |
|
| 58 | 58 | $department_string = mo_get_last_input_node($first_form); |
| 59 | 59 | $department_paths = mo_string_all_ancestors($department_string); |
| 60 | 60 | $mission->department = $department_string; |
| 61 | 61 | $mission->department_path_english = $department_paths['english_path']; |
| 62 | 62 | $mission->department_path_french = $department_paths['french_path']; |
| 63 | - } |
|
| 64 | - // If the organization tree is not loaded, then the basic free text entry will be stored. |
|
| 65 | - else { |
|
| 66 | - $mission->department = $first_form['department']; |
|
| 63 | + } |
|
| 64 | + // If the organization tree is not loaded, then the basic free text entry will be stored. |
|
| 65 | + else { |
|
| 66 | + $mission->department = $first_form['department']; |
|
| 67 | 67 | $mission->department_path_english = $first_form['department']; |
| 68 | 68 | $mission->department_path_french = $first_form['department']; |
| 69 | - } |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - $mission->email = $first_form['email']; |
|
| 72 | - $mission->phone = $first_form['phone']; |
|
| 71 | + $mission->email = $first_form['email']; |
|
| 72 | + $mission->phone = $first_form['phone']; |
|
| 73 | 73 | |
| 74 | - $accounts = get_user_by_email($first_form['email']); |
|
| 74 | + $accounts = get_user_by_email($first_form['email']); |
|
| 75 | 75 | //Compare email and username for user with more than one account |
| 76 | 76 | foreach ($accounts as $key) { |
| 77 | 77 | if($key->name == $first_form['name']){ |
@@ -80,29 +80,29 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | if($guid_account){ |
| 83 | - $mission->account = array_pop($guid_account)->guid; |
|
| 83 | + $mission->account = array_pop($guid_account)->guid; |
|
| 84 | 84 | }else{ |
| 85 | - $mission->account = array_pop($accounts)->guid; |
|
| 85 | + $mission->account = array_pop($accounts)->guid; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
| 89 | - $mission->job_title = $second_form['job_title']; |
|
| 90 | - $mission->role_type = $second_form['role_type']; |
|
| 91 | - $mission->job_type = $second_form['job_type']; |
|
| 89 | + $mission->job_title = $second_form['job_title']; |
|
| 90 | + $mission->role_type = $second_form['role_type']; |
|
| 91 | + $mission->job_type = $second_form['job_type']; |
|
| 92 | 92 | // Stores the value of program area selected unless it is other. |
| 93 | - if($second_form['job_area'] != 'missions:other') { |
|
| 94 | - $mission->program_area = $second_form['job_area']; |
|
| 95 | - } |
|
| 93 | + if($second_form['job_area'] != 'missions:other') { |
|
| 94 | + $mission->program_area = $second_form['job_area']; |
|
| 95 | + } |
|
| 96 | 96 | // When other is selected, the free text entry is stored instead. |
| 97 | - else { |
|
| 98 | - $mission->program_area = $second_form['other_text']; |
|
| 99 | - } |
|
| 100 | - $mission->number = $second_form['number']; |
|
| 101 | - $mission->start_date = $second_form['start_date']; |
|
| 102 | - $mission->completion_date = $second_form['completion_date']; |
|
| 103 | - $mission->deadline = $second_form['deadline']; |
|
| 104 | - $mission->descriptor = $second_form['description']; |
|
| 105 | - $mission->openess = $second_form['openess']; |
|
| 97 | + else { |
|
| 98 | + $mission->program_area = $second_form['other_text']; |
|
| 99 | + } |
|
| 100 | + $mission->number = $second_form['number']; |
|
| 101 | + $mission->start_date = $second_form['start_date']; |
|
| 102 | + $mission->completion_date = $second_form['completion_date']; |
|
| 103 | + $mission->deadline = $second_form['deadline']; |
|
| 104 | + $mission->descriptor = $second_form['description']; |
|
| 105 | + $mission->openess = $second_form['openess']; |
|
| 106 | 106 | |
| 107 | 107 | //Nick - Adding group and level to the mission meta data |
| 108 | 108 | if($second_form['group']){ |
@@ -110,36 +110,36 @@ discard block |
||
| 110 | 110 | $mission->gl_level = $second_form['level']; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - $mission->remotely = $third_form['remotely']; |
|
| 114 | - //$mission->flexibility = $third_form['flexibility']; |
|
| 115 | - $mission->security = $third_form['security']; |
|
| 116 | - $mission->location = $third_form['location']; |
|
| 117 | - $mission->time_commitment = $third_form['time_commitment']; |
|
| 118 | - $mission->time_interval = $third_form['time_interval']; |
|
| 119 | - $mission->timezone = $third_form['timezone']; |
|
| 120 | - |
|
| 121 | - // Stores the multiple skill fields in a comma separated string. |
|
| 122 | - $count = 0; |
|
| 123 | - $key_skills = ''; |
|
| 124 | - $skill_array = array(); |
|
| 125 | - foreach($third_form as $key => $value) { |
|
| 126 | - if(!(strpos($key, 'skill') === false) && $value) { |
|
| 127 | - $skill_array[$count] = $value; |
|
| 128 | - if($count == 0) { |
|
| 129 | - $key_skills .= $value; |
|
| 130 | - } |
|
| 131 | - else { |
|
| 132 | - $key_skills .= ', ' . $value; |
|
| 133 | - } |
|
| 134 | - $count++; |
|
| 135 | - } |
|
| 136 | - } |
|
| 137 | - $mission->key_skills = $key_skills; |
|
| 113 | + $mission->remotely = $third_form['remotely']; |
|
| 114 | + //$mission->flexibility = $third_form['flexibility']; |
|
| 115 | + $mission->security = $third_form['security']; |
|
| 116 | + $mission->location = $third_form['location']; |
|
| 117 | + $mission->time_commitment = $third_form['time_commitment']; |
|
| 118 | + $mission->time_interval = $third_form['time_interval']; |
|
| 119 | + $mission->timezone = $third_form['timezone']; |
|
| 120 | + |
|
| 121 | + // Stores the multiple skill fields in a comma separated string. |
|
| 122 | + $count = 0; |
|
| 123 | + $key_skills = ''; |
|
| 124 | + $skill_array = array(); |
|
| 125 | + foreach($third_form as $key => $value) { |
|
| 126 | + if(!(strpos($key, 'skill') === false) && $value) { |
|
| 127 | + $skill_array[$count] = $value; |
|
| 128 | + if($count == 0) { |
|
| 129 | + $key_skills .= $value; |
|
| 130 | + } |
|
| 131 | + else { |
|
| 132 | + $key_skills .= ', ' . $value; |
|
| 133 | + } |
|
| 134 | + $count++; |
|
| 135 | + } |
|
| 136 | + } |
|
| 137 | + $mission->key_skills = $key_skills; |
|
| 138 | 138 | |
| 139 | - $mission->english = mm_pack_language($third_form['lwc_english'], $third_form['lwe_english'], $third_form['lop_english'], 'english'); |
|
| 140 | - $mission->french = mm_pack_language($third_form['lwc_french'], $third_form['lwe_french'], $third_form['lop_french'], 'french'); |
|
| 139 | + $mission->english = mm_pack_language($third_form['lwc_english'], $third_form['lwe_english'], $third_form['lop_english'], 'english'); |
|
| 140 | + $mission->french = mm_pack_language($third_form['lwc_french'], $third_form['lwe_french'], $third_form['lop_french'], 'french'); |
|
| 141 | 141 | |
| 142 | - /*$mission->mon_start = mm_pack_time($third_form['mon_start_hour'], $third_form['mon_start_min'], 'mon_start'); |
|
| 142 | + /*$mission->mon_start = mm_pack_time($third_form['mon_start_hour'], $third_form['mon_start_min'], 'mon_start'); |
|
| 143 | 143 | $mission->mon_duration = mm_pack_time($third_form['mon_duration_hour'], $third_form['mon_duration_min'], 'mon_duration'); |
| 144 | 144 | $mission->tue_start = mm_pack_time($third_form['tue_start_hour'], $third_form['tue_start_min'], 'tue_start'); |
| 145 | 145 | $mission->tue_duration = mm_pack_time($third_form['tue_duration_hour'], $third_form['tue_duration_min'], 'tue_duration'); |
@@ -153,86 +153,86 @@ discard block |
||
| 153 | 153 | $mission->sat_duration = mm_pack_time($third_form['sat_duration_hour'], $third_form['sat_duration_min'], 'sat_duration'); |
| 154 | 154 | $mission->sun_start = mm_pack_time($third_form['sun_start_hour'], $third_form['sun_start_min'], 'sun_start'); |
| 155 | 155 | $mission->sun_duration = mm_pack_time($third_form['sun_duration_hour'], $third_form['sun_duration_min'], 'sun_duration');*/ |
| 156 | - $mission->mon_start = $third_form['mon_start']; |
|
| 157 | - $mission->mon_duration = $third_form['mon_duration']; |
|
| 158 | - $mission->tue_start = $third_form['tue_start']; |
|
| 159 | - $mission->tue_duration = $third_form['tue_duration']; |
|
| 160 | - $mission->wed_start = $third_form['wed_start']; |
|
| 161 | - $mission->wed_duration = $third_form['wed_duration']; |
|
| 162 | - $mission->thu_start = $third_form['thu_start']; |
|
| 163 | - $mission->thu_duration = $third_form['thu_duration']; |
|
| 164 | - $mission->fri_start = $third_form['fri_start']; |
|
| 165 | - $mission->fri_duration = $third_form['fri_duration']; |
|
| 166 | - $mission->sat_start = $third_form['sat_start']; |
|
| 167 | - $mission->sat_duration = $third_form['sat_duration']; |
|
| 168 | - $mission->sun_start = $third_form['sun_start']; |
|
| 169 | - $mission->sun_duration = $third_form['sun_duration']; |
|
| 170 | - |
|
| 171 | - $mission->state = 'posted'; |
|
| 172 | - $mission->version = elgg_get_plugin_setting('mission_version', 'missions'); |
|
| 173 | - |
|
| 174 | - $mission->time_to_post = time() - $_SESSION['mission_creation_begin_timestamp']; |
|
| 175 | - |
|
| 176 | - // Sends the object and all its metadata to the database |
|
| 177 | - $mission->save(); |
|
| 178 | - |
|
| 179 | - $mission->meta_guid = $mission->guid; |
|
| 180 | - |
|
| 181 | - $mission->save(); |
|
| 182 | - |
|
| 183 | - // Generate an analytics record to track "posted". |
|
| 184 | - $analytics_record = new ElggObject(); |
|
| 185 | - $analytics_record->subtype = 'mission-posted'; |
|
| 186 | - $analytics_record->title = 'Mission Posted Report'; |
|
| 187 | - $analytics_record->mission_guid = $mission->guid; |
|
| 188 | - $analytics_record->access_id = ACCESS_LOGGED_IN; |
|
| 189 | - $analytics_record->save(); |
|
| 190 | - |
|
| 191 | - // Creates a relationships between the user (manager) and the mission. |
|
| 192 | - add_entity_relationship($mission->account, 'mission_posted', $mission->guid); |
|
| 193 | - |
|
| 194 | - // Add to the river so it can be seen on the main page. |
|
| 195 | - elgg_create_river_item(array( |
|
| 196 | - 'view' => 'river/object/mission/create', |
|
| 197 | - 'action_type' => 'create', |
|
| 198 | - 'subject_guid' => $mission->owner_guid, |
|
| 199 | - 'object_guid' => $mission->getGUID() |
|
| 200 | - )); |
|
| 201 | - //add_to_river('river/object/mission/create', 'create', $mission->owner_guid, $mission->getGUID()); |
|
| 202 | - |
|
| 203 | - $_SESSION['mission_skill_match_array'] = $skill_array; |
|
| 204 | - unset($_SESSION['mission_duplicating_override_first']); |
|
| 205 | - unset($_SESSION['mission_duplicating_override_second']); |
|
| 206 | - unset($_SESSION['mission_duplicating_override_third']); |
|
| 207 | - |
|
| 208 | - if(count($skill_array) == 0) { |
|
| 156 | + $mission->mon_start = $third_form['mon_start']; |
|
| 157 | + $mission->mon_duration = $third_form['mon_duration']; |
|
| 158 | + $mission->tue_start = $third_form['tue_start']; |
|
| 159 | + $mission->tue_duration = $third_form['tue_duration']; |
|
| 160 | + $mission->wed_start = $third_form['wed_start']; |
|
| 161 | + $mission->wed_duration = $third_form['wed_duration']; |
|
| 162 | + $mission->thu_start = $third_form['thu_start']; |
|
| 163 | + $mission->thu_duration = $third_form['thu_duration']; |
|
| 164 | + $mission->fri_start = $third_form['fri_start']; |
|
| 165 | + $mission->fri_duration = $third_form['fri_duration']; |
|
| 166 | + $mission->sat_start = $third_form['sat_start']; |
|
| 167 | + $mission->sat_duration = $third_form['sat_duration']; |
|
| 168 | + $mission->sun_start = $third_form['sun_start']; |
|
| 169 | + $mission->sun_duration = $third_form['sun_duration']; |
|
| 170 | + |
|
| 171 | + $mission->state = 'posted'; |
|
| 172 | + $mission->version = elgg_get_plugin_setting('mission_version', 'missions'); |
|
| 173 | + |
|
| 174 | + $mission->time_to_post = time() - $_SESSION['mission_creation_begin_timestamp']; |
|
| 175 | + |
|
| 176 | + // Sends the object and all its metadata to the database |
|
| 177 | + $mission->save(); |
|
| 178 | + |
|
| 179 | + $mission->meta_guid = $mission->guid; |
|
| 180 | + |
|
| 181 | + $mission->save(); |
|
| 182 | + |
|
| 183 | + // Generate an analytics record to track "posted". |
|
| 184 | + $analytics_record = new ElggObject(); |
|
| 185 | + $analytics_record->subtype = 'mission-posted'; |
|
| 186 | + $analytics_record->title = 'Mission Posted Report'; |
|
| 187 | + $analytics_record->mission_guid = $mission->guid; |
|
| 188 | + $analytics_record->access_id = ACCESS_LOGGED_IN; |
|
| 189 | + $analytics_record->save(); |
|
| 190 | + |
|
| 191 | + // Creates a relationships between the user (manager) and the mission. |
|
| 192 | + add_entity_relationship($mission->account, 'mission_posted', $mission->guid); |
|
| 193 | + |
|
| 194 | + // Add to the river so it can be seen on the main page. |
|
| 195 | + elgg_create_river_item(array( |
|
| 196 | + 'view' => 'river/object/mission/create', |
|
| 197 | + 'action_type' => 'create', |
|
| 198 | + 'subject_guid' => $mission->owner_guid, |
|
| 199 | + 'object_guid' => $mission->getGUID() |
|
| 200 | + )); |
|
| 201 | + //add_to_river('river/object/mission/create', 'create', $mission->owner_guid, $mission->getGUID()); |
|
| 202 | + |
|
| 203 | + $_SESSION['mission_skill_match_array'] = $skill_array; |
|
| 204 | + unset($_SESSION['mission_duplicating_override_first']); |
|
| 205 | + unset($_SESSION['mission_duplicating_override_second']); |
|
| 206 | + unset($_SESSION['mission_duplicating_override_third']); |
|
| 207 | + |
|
| 208 | + if(count($skill_array) == 0) { |
|
| 209 | 209 | elgg_clear_sticky_form('firstfill'); |
| 210 | 210 | elgg_clear_sticky_form('secondfill'); |
| 211 | 211 | elgg_clear_sticky_form('thirdfill'); |
| 212 | 212 | elgg_clear_sticky_form('ldropfill'); |
| 213 | 213 | elgg_clear_sticky_form('tdropfill'); |
| 214 | - system_message(elgg_echo('missions:succesfully_posted', array($mission->job_title))); |
|
| 215 | - forward(elgg_get_site_url() . 'missions/main'); |
|
| 216 | - } |
|
| 217 | - else { |
|
| 218 | - if($third_form['hidden_java_state'] == 'noscript') { |
|
| 219 | - // Required action security tokens. |
|
| 220 | - $ts = time(); |
|
| 221 | - $token = generate_action_token($ts); |
|
| 222 | - set_input('__elgg_ts', $ts); |
|
| 223 | - set_input('__elgg_token', $token); |
|
| 224 | - |
|
| 225 | - action('missions/post-mission-skill-match'); |
|
| 226 | - } |
|
| 227 | - else { |
|
| 228 | - $_SESSION['mission_skill_match_is_interlude'] = true; |
|
| 229 | - system_message(elgg_echo('missions:saved_beginning_skill_match', array($key_skills))); |
|
| 230 | - forward(REFERER); |
|
| 231 | - } |
|
| 232 | - } |
|
| 214 | + system_message(elgg_echo('missions:succesfully_posted', array($mission->job_title))); |
|
| 215 | + forward(elgg_get_site_url() . 'missions/main'); |
|
| 216 | + } |
|
| 217 | + else { |
|
| 218 | + if($third_form['hidden_java_state'] == 'noscript') { |
|
| 219 | + // Required action security tokens. |
|
| 220 | + $ts = time(); |
|
| 221 | + $token = generate_action_token($ts); |
|
| 222 | + set_input('__elgg_ts', $ts); |
|
| 223 | + set_input('__elgg_token', $token); |
|
| 224 | + |
|
| 225 | + action('missions/post-mission-skill-match'); |
|
| 226 | + } |
|
| 227 | + else { |
|
| 228 | + $_SESSION['mission_skill_match_is_interlude'] = true; |
|
| 229 | + system_message(elgg_echo('missions:saved_beginning_skill_match', array($key_skills))); |
|
| 230 | + forward(REFERER); |
|
| 231 | + } |
|
| 232 | + } |
|
| 233 | 233 | |
| 234 | 234 | |
| 235 | - /* |
|
| 235 | + /* |
|
| 236 | 236 | // Finds a list of users who have the same skills that were input in the third form. |
| 237 | 237 | $user_skill_match = array(); |
| 238 | 238 | foreach($skill_array as $skill) { |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | // A specialized function for checking for errors in the time fields |
| 32 | 32 | $err .= mm_validate_time_all($third_form); |
| 33 | 33 | |
| 34 | -if($err == '') { |
|
| 34 | +if ($err == '') { |
|
| 35 | 35 | $err .= mm_third_post_special_error_check($third_form); |
| 36 | 36 | } |
| 37 | 37 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $mission->name = $first_form['name']; |
| 55 | 55 | |
| 56 | 56 | // If the organization tree is loaded, then the custom dropdown values will be processed and stored. |
| 57 | - if(mo_get_tree_root()) { |
|
| 57 | + if (mo_get_tree_root()) { |
|
| 58 | 58 | $department_string = mo_get_last_input_node($first_form); |
| 59 | 59 | $department_paths = mo_string_all_ancestors($department_string); |
| 60 | 60 | $mission->department = $department_string; |
@@ -74,14 +74,14 @@ discard block |
||
| 74 | 74 | $accounts = get_user_by_email($first_form['email']); |
| 75 | 75 | //Compare email and username for user with more than one account |
| 76 | 76 | foreach ($accounts as $key) { |
| 77 | - if($key->name == $first_form['name']){ |
|
| 77 | + if ($key->name == $first_form['name']) { |
|
| 78 | 78 | $guid_account[] = $key; |
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - if($guid_account){ |
|
| 82 | + if ($guid_account) { |
|
| 83 | 83 | $mission->account = array_pop($guid_account)->guid; |
| 84 | - }else{ |
|
| 84 | + } else { |
|
| 85 | 85 | $mission->account = array_pop($accounts)->guid; |
| 86 | 86 | } |
| 87 | 87 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $mission->role_type = $second_form['role_type']; |
| 91 | 91 | $mission->job_type = $second_form['job_type']; |
| 92 | 92 | // Stores the value of program area selected unless it is other. |
| 93 | - if($second_form['job_area'] != 'missions:other') { |
|
| 93 | + if ($second_form['job_area'] != 'missions:other') { |
|
| 94 | 94 | $mission->program_area = $second_form['job_area']; |
| 95 | 95 | } |
| 96 | 96 | // When other is selected, the free text entry is stored instead. |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $mission->openess = $second_form['openess']; |
| 106 | 106 | |
| 107 | 107 | //Nick - Adding group and level to the mission meta data |
| 108 | - if($second_form['group']){ |
|
| 108 | + if ($second_form['group']) { |
|
| 109 | 109 | $mission->gl_group = $second_form['group']; |
| 110 | 110 | $mission->gl_level = $second_form['level']; |
| 111 | 111 | } |
@@ -122,10 +122,10 @@ discard block |
||
| 122 | 122 | $count = 0; |
| 123 | 123 | $key_skills = ''; |
| 124 | 124 | $skill_array = array(); |
| 125 | - foreach($third_form as $key => $value) { |
|
| 126 | - if(!(strpos($key, 'skill') === false) && $value) { |
|
| 125 | + foreach ($third_form as $key => $value) { |
|
| 126 | + if (!(strpos($key, 'skill') === false) && $value) { |
|
| 127 | 127 | $skill_array[$count] = $value; |
| 128 | - if($count == 0) { |
|
| 128 | + if ($count == 0) { |
|
| 129 | 129 | $key_skills .= $value; |
| 130 | 130 | } |
| 131 | 131 | else { |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | unset($_SESSION['mission_duplicating_override_second']); |
| 206 | 206 | unset($_SESSION['mission_duplicating_override_third']); |
| 207 | 207 | |
| 208 | - if(count($skill_array) == 0) { |
|
| 208 | + if (count($skill_array) == 0) { |
|
| 209 | 209 | elgg_clear_sticky_form('firstfill'); |
| 210 | 210 | elgg_clear_sticky_form('secondfill'); |
| 211 | 211 | elgg_clear_sticky_form('thirdfill'); |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | forward(elgg_get_site_url() . 'missions/main'); |
| 216 | 216 | } |
| 217 | 217 | else { |
| 218 | - if($third_form['hidden_java_state'] == 'noscript') { |
|
| 218 | + if ($third_form['hidden_java_state'] == 'noscript') { |
|
| 219 | 219 | // Required action security tokens. |
| 220 | 220 | $ts = time(); |
| 221 | 221 | $token = generate_action_token($ts); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | if($guid_account){ |
| 83 | 83 | $mission->account = array_pop($guid_account)->guid; |
| 84 | - }else{ |
|
| 84 | + } else{ |
|
| 85 | 85 | $mission->account = array_pop($accounts)->guid; |
| 86 | 86 | } |
| 87 | 87 | |
@@ -127,8 +127,7 @@ discard block |
||
| 127 | 127 | $skill_array[$count] = $value; |
| 128 | 128 | if($count == 0) { |
| 129 | 129 | $key_skills .= $value; |
| 130 | - } |
|
| 131 | - else { |
|
| 130 | + } else { |
|
| 132 | 131 | $key_skills .= ', ' . $value; |
| 133 | 132 | } |
| 134 | 133 | $count++; |
@@ -213,8 +212,7 @@ discard block |
||
| 213 | 212 | elgg_clear_sticky_form('tdropfill'); |
| 214 | 213 | system_message(elgg_echo('missions:succesfully_posted', array($mission->job_title))); |
| 215 | 214 | forward(elgg_get_site_url() . 'missions/main'); |
| 216 | - } |
|
| 217 | - else { |
|
| 215 | + } else { |
|
| 218 | 216 | if($third_form['hidden_java_state'] == 'noscript') { |
| 219 | 217 | // Required action security tokens. |
| 220 | 218 | $ts = time(); |
@@ -223,8 +221,7 @@ discard block |
||
| 223 | 221 | set_input('__elgg_token', $token); |
| 224 | 222 | |
| 225 | 223 | action('missions/post-mission-skill-match'); |
| 226 | - } |
|
| 227 | - else { |
|
| 224 | + } else { |
|
| 228 | 225 | $_SESSION['mission_skill_match_is_interlude'] = true; |
| 229 | 226 | system_message(elgg_echo('missions:saved_beginning_skill_match', array($key_skills))); |
| 230 | 227 | forward(REFERER); |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | system_message(elgg_echo('missions:has_been_reopened', array($mission->job_title))); |
| 30 | 30 | |
| 31 | 31 | // If the admin tool is calling the action then the user is returned to the admin tool page. |
| 32 | -if($from_admin) { |
|
| 32 | +if ($from_admin) { |
|
| 33 | 33 | forward(REFERER); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -26,60 +26,60 @@ |
||
| 26 | 26 | // Detects if backup fields are active or not. If they are then Javascript is disabled. |
| 27 | 27 | $noscript = false; |
| 28 | 28 | foreach ($advanced_form as $name => $value) { |
| 29 | - if(strpos($name, 'backup_') !== false) { |
|
| 30 | - if($value != '') { |
|
| 31 | - $noscript = true; |
|
| 32 | - } |
|
| 33 | - } |
|
| 29 | + if(strpos($name, 'backup_') !== false) { |
|
| 30 | + if($value != '') { |
|
| 31 | + $noscript = true; |
|
| 32 | + } |
|
| 33 | + } |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | // Currently no error checking is done but the support for it is set. |
| 37 | 37 | if ($err != '') { |
| 38 | - register_error($err); |
|
| 39 | - forward(REFERER); |
|
| 38 | + register_error($err); |
|
| 39 | + forward(REFERER); |
|
| 40 | 40 | } else { |
| 41 | - $query_clean = ''; |
|
| 42 | - $array = array(); |
|
| 41 | + $query_clean = ''; |
|
| 42 | + $array = array(); |
|
| 43 | 43 | |
| 44 | - /* |
|
| 44 | + /* |
|
| 45 | 45 | * Runs through all the search fields and evaluates them. |
| 46 | 46 | * Evaluation is different when Javascript is enabled or disabled. |
| 47 | 47 | * Empty evaluations are discarded. |
| 48 | 48 | */ |
| 49 | - for ($i = 0; $i < $element_total; $i ++) { |
|
| 50 | - if($noscript) { |
|
| 51 | - $query_clean = mm_analyze_backup($i, $advanced_form); |
|
| 52 | - } |
|
| 53 | - else { |
|
| 54 | - $query_clean = mm_analyze_advanced_search_element($i, $advanced_form); |
|
| 55 | - } |
|
| 56 | - if(!empty($query_clean)) { |
|
| 57 | - $array[$i] = $query_clean; |
|
| 58 | - } |
|
| 59 | - } |
|
| 49 | + for ($i = 0; $i < $element_total; $i ++) { |
|
| 50 | + if($noscript) { |
|
| 51 | + $query_clean = mm_analyze_backup($i, $advanced_form); |
|
| 52 | + } |
|
| 53 | + else { |
|
| 54 | + $query_clean = mm_analyze_advanced_search_element($i, $advanced_form); |
|
| 55 | + } |
|
| 56 | + if(!empty($query_clean)) { |
|
| 57 | + $array[$i] = $query_clean; |
|
| 58 | + } |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - // These functions executes the query and returns true or false depending on how succesful that query was. |
|
| 62 | - switch($_SESSION['mission_search_switch']) { |
|
| 63 | - case 'candidate': |
|
| 64 | - // Function for candidate searching. |
|
| 65 | - $returned = mm_advanced_search_database_for_candidates($array, 'AND', elgg_get_plugin_setting('search_limit', 'missions')); |
|
| 66 | - break; |
|
| 67 | - default: |
|
| 68 | - // Function for mission searching. |
|
| 69 | - $returned = mm_search_database_for_missions($array, 'AND', elgg_get_plugin_setting('search_limit', 'missions')); |
|
| 70 | - } |
|
| 61 | + // These functions executes the query and returns true or false depending on how succesful that query was. |
|
| 62 | + switch($_SESSION['mission_search_switch']) { |
|
| 63 | + case 'candidate': |
|
| 64 | + // Function for candidate searching. |
|
| 65 | + $returned = mm_advanced_search_database_for_candidates($array, 'AND', elgg_get_plugin_setting('search_limit', 'missions')); |
|
| 66 | + break; |
|
| 67 | + default: |
|
| 68 | + // Function for mission searching. |
|
| 69 | + $returned = mm_search_database_for_missions($array, 'AND', elgg_get_plugin_setting('search_limit', 'missions')); |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - /* |
|
| 72 | + /* |
|
| 73 | 73 | * If the $returned value is null then the user is sent back to the search page. |
| 74 | 74 | * Otherwise they are sent to the search result. |
| 75 | 75 | */ |
| 76 | - if (! $returned) { |
|
| 77 | - forward(REFERER); |
|
| 78 | - } else { |
|
| 79 | - //elgg_clear_sticky_form('advancedfill'); |
|
| 80 | - if($advanced_form['hidden_return']) { |
|
| 81 | - forward(REFERER); |
|
| 82 | - } |
|
| 83 | - forward(elgg_get_site_url() . 'missions/display-search-set'); |
|
| 84 | - } |
|
| 76 | + if (! $returned) { |
|
| 77 | + forward(REFERER); |
|
| 78 | + } else { |
|
| 79 | + //elgg_clear_sticky_form('advancedfill'); |
|
| 80 | + if($advanced_form['hidden_return']) { |
|
| 81 | + forward(REFERER); |
|
| 82 | + } |
|
| 83 | + forward(elgg_get_site_url() . 'missions/display-search-set'); |
|
| 84 | + } |
|
| 85 | 85 | } |
| 86 | 86 | \ No newline at end of file |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | // Detects if backup fields are active or not. If they are then Javascript is disabled. |
| 27 | 27 | $noscript = false; |
| 28 | 28 | foreach ($advanced_form as $name => $value) { |
| 29 | - if(strpos($name, 'backup_') !== false) { |
|
| 30 | - if($value != '') { |
|
| 29 | + if (strpos($name, 'backup_') !== false) { |
|
| 30 | + if ($value != '') { |
|
| 31 | 31 | $noscript = true; |
| 32 | 32 | } |
| 33 | 33 | } |
@@ -46,20 +46,20 @@ discard block |
||
| 46 | 46 | * Evaluation is different when Javascript is enabled or disabled. |
| 47 | 47 | * Empty evaluations are discarded. |
| 48 | 48 | */ |
| 49 | - for ($i = 0; $i < $element_total; $i ++) { |
|
| 50 | - if($noscript) { |
|
| 49 | + for ($i = 0; $i < $element_total; $i++) { |
|
| 50 | + if ($noscript) { |
|
| 51 | 51 | $query_clean = mm_analyze_backup($i, $advanced_form); |
| 52 | 52 | } |
| 53 | 53 | else { |
| 54 | 54 | $query_clean = mm_analyze_advanced_search_element($i, $advanced_form); |
| 55 | 55 | } |
| 56 | - if(!empty($query_clean)) { |
|
| 56 | + if (!empty($query_clean)) { |
|
| 57 | 57 | $array[$i] = $query_clean; |
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | // These functions executes the query and returns true or false depending on how succesful that query was. |
| 62 | - switch($_SESSION['mission_search_switch']) { |
|
| 62 | + switch ($_SESSION['mission_search_switch']) { |
|
| 63 | 63 | case 'candidate': |
| 64 | 64 | // Function for candidate searching. |
| 65 | 65 | $returned = mm_advanced_search_database_for_candidates($array, 'AND', elgg_get_plugin_setting('search_limit', 'missions')); |
@@ -73,11 +73,11 @@ discard block |
||
| 73 | 73 | * If the $returned value is null then the user is sent back to the search page. |
| 74 | 74 | * Otherwise they are sent to the search result. |
| 75 | 75 | */ |
| 76 | - if (! $returned) { |
|
| 76 | + if (!$returned) { |
|
| 77 | 77 | forward(REFERER); |
| 78 | 78 | } else { |
| 79 | 79 | //elgg_clear_sticky_form('advancedfill'); |
| 80 | - if($advanced_form['hidden_return']) { |
|
| 80 | + if ($advanced_form['hidden_return']) { |
|
| 81 | 81 | forward(REFERER); |
| 82 | 82 | } |
| 83 | 83 | forward(elgg_get_site_url() . 'missions/display-search-set'); |
@@ -49,8 +49,7 @@ |
||
| 49 | 49 | for ($i = 0; $i < $element_total; $i ++) { |
| 50 | 50 | if($noscript) { |
| 51 | 51 | $query_clean = mm_analyze_backup($i, $advanced_form); |
| 52 | - } |
|
| 53 | - else { |
|
| 52 | + } else { |
|
| 54 | 53 | $query_clean = mm_analyze_advanced_search_element($i, $advanced_form); |
| 55 | 54 | } |
| 56 | 55 | if(!empty($query_clean)) { |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | )); |
| 28 | 28 | |
| 29 | 29 | // Does not allow the misssion to be cancelled if the count is not zero. |
| 30 | -if($relationship_count > 0) { |
|
| 30 | +if ($relationship_count > 0) { |
|
| 31 | 31 | register_error(elgg_echo('missions:cannot_cancel_mission_with_participants')); |
| 32 | 32 | forward(REFERER); |
| 33 | 33 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | system_message(elgg_echo('missions:has_been_cancelled', array($mission->job_title))); |
| 51 | 51 | |
| 52 | 52 | // If the admin tool is calling the action then the user is returned to the admin tool page. |
| 53 | - if($from_admin) { |
|
| 53 | + if ($from_admin) { |
|
| 54 | 54 | forward(REFERER); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -30,8 +30,7 @@ |
||
| 30 | 30 | if($relationship_count > 0) { |
| 31 | 31 | register_error(elgg_echo('missions:cannot_cancel_mission_with_participants')); |
| 32 | 32 | forward(REFERER); |
| 33 | -} |
|
| 34 | -else { |
|
| 33 | +} else { |
|
| 35 | 34 | $mission->state = 'cancelled'; |
| 36 | 35 | $mission->time_to_cancel = time() - $mission->time_created; |
| 37 | 36 | $mission->time_closed = time(); |
@@ -22,8 +22,8 @@ |
||
| 22 | 22 | $err .= mm_second_post_error_check($second_form); |
| 23 | 23 | |
| 24 | 24 | if ($err == '') { |
| 25 | - forward(elgg_get_site_url() . 'missions/mission-post/step-three'); |
|
| 25 | + forward(elgg_get_site_url() . 'missions/mission-post/step-three'); |
|
| 26 | 26 | } else { |
| 27 | - register_error($err); |
|
| 28 | - forward(REFERER); |
|
| 27 | + register_error($err); |
|
| 28 | + forward(REFERER); |
|
| 29 | 29 | } |