Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 5387 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 www 1
<?php
5387 stevensc 2
 
4842 efrain 3
use LeadersLinked\Model\Network;
4
 
3639 efrain 5
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
6
 
7
$currentUser    = $this->currentUserHelper();
8
$roleName = $currentUser->getUserTypeId();
9
 
10
 
1 www 11
$this->headLink()->appendStylesheet('/react-bundles/dashboard/main.css');
12
$this->inlineScript()->appendFile('https://maps.googleapis.com/maps/api/js?key=' . $google_map_key . '&libraries=places');
13
$currentUser = $this->currentUserHelper();
14
$currentUser = $currentUser->getUser();
15
 
4842 efrain 16
$currentNetwork = $this->currentNetworkHelper();
17
$currentNetwork = $currentNetwork->getNetwork();
1 www 18
 
4842 efrain 19
 
3639 efrain 20
$allowSearchCompany = $acl->isAllowed($roleName, 'search/company') ? 1 : 0;
21
 
22
 
5387 stevensc 23
$allowViewConnectionLevelFilter = $currentNetwork->relationship_user_mode == Network::RELATIONSHIP_USER_MODE_USER_2_USER ? 1 : 0;
4842 efrain 24
 
1 www 25
$routeMoodle = $this->url('moodle');
26
$emojione_image_path_png  = $this->basePath('vendors/smiley/assets/png/');
27
$id = $user_uuid ?? null;
28
$industryFilters = json_encode($industries, true);
29
$connectionLeves = json_encode($connectionLeves, true);
30
$_employeeTypes = json_encode($employeeTypes);
31
$companySizes = json_encode($companySizes, true);
32
$groupTypes = json_encode($groupTypes, true);
33
$googleMapPlacesUrl = 'https://maps.googleapis.com/maps/api/js?key=' . $google_map_key . '&libraries=places';
34
$error_msg = "Por favor seleccione una ubicación real";
35
 
36
$js = <<<JS
37
const filters = {
6363 stevensc 38
  industryFilters: $industryFilters,
39
  connectionLevelFilters: $connectionLeves,
40
  employeeTypeFilters: $_employeeTypes,
41
  companySizeFilters: $companySizes,
42
  groupTypeFilters: $groupTypes,
3639 efrain 43
  allowSearchCompany: '$allowSearchCompany' === '1',
4842 efrain 44
  allowViewConnectionLevelFilter:  '$allowViewConnectionLevelFilter' === '1',
1 www 45
}
46
 
47
 
48
const backendVars={
49
  id: "$id",
50
  labelSend: "LABEL_SEND",
51
  labelUsers: "LABEL_USERS",
3639 efrain 52
  labelWriteMessage: "LABEL_WRITE_YOUR_MESSAGE_HERE",
53
 
1 www 54
}
55
 
5387 stevensc 56
const LABELS = {
57
  MY_GROUPS: 'LABEL_MY_GROUPS',
58
  GROUPS: 'LABEL_GROUPS',
59
  WHAT_ARE_YOU_THINKING: 'LABEL_WHAT_ARE_YOU_THINKING',
60
  GROUP_VIEW: 'LABEL_GROUP_VIEW',
61
  VIEW_MORE: 'LABEL_VIEW_MORE',
62
  VIEW_LESS: 'LABEL_VIEW_LESS',
63
  WHO_HAS_SEEN_MY_PROFILE: 'LABEL_WHO_HAS_SEEN_MY_PROFILE',
64
  CONNECT_WITH: 'LABEL_CONNECT_WITH',
65
  POSTS: 'LABEL_POSTS',
66
  DATATABLE_EMPTY: 'LABEL_DATATABLE_EMPTY',
67
  CONNECT: 'LABEL_CONNECT',
68
  CANCEL: 'LABEL_CANCEL',
69
  NOT_AVAILABLE_POSTS: 'LABEL_NOT_AVAILABLE_POSTS',
70
  MICRO_LEARNING: 'LABEL_MICRO_LEARNING',
71
  NOT_AVAILABLE_FEEDS: 'LABEL_NOT_AVAILABLE_FEEDS',
72
  SEND: 'LABEL_SEND',
73
  SHARE_A_POST: 'LABEL_SHARE_A_POST',
74
  SHARE_WITH: 'LABEL_SHARE_WITH',
75
  CONNECTIONS: 'LABEL_CONNECTIONS',
76
  PUBLIC: 'LABEL_PUBLIC',
77
  SUGGEST_GROUPS: 'LABEL_SUGGEST_GROUPS',
78
  VIEW_RECOMMENDATIONS: 'LABEL_VIEW_RECOMMENDATIONS',
79
  IMAGE: 'LABEL_IMAGE',
80
  DOCUMENT: 'LABEL_DOCUMENT',
81
  AUDIO: 'LABEL_AUDIO',
82
  VIDEO: 'LABEL_VIDEO',
83
  WRITE_A_POST: 'LABEL_WRITE_A_POST',
84
  DELETE: 'LABEL_DELETE',
85
  DOWNLOAD: 'LABEL_DOWNLOAD',
86
  READ_MORE: 'LABEL_READ_MORE',
87
  READ_LESS: 'LABEL_READ_LESS',
88
  LIKE: 'LABEL_LIKE',
89
  COMMENT: 'LABEL_COMMENT',
90
  SHARE: 'LABEL_SHARE',
91
  SHARED: 'LABEL_SHARED',
92
  COMMENTS: 'LABEL_COMMENTS',
93
  SENDS: 'LABEL_SENDS',
94
  WRITE_A_COMMENT: 'LABEL_WRITE_A_COMMENT'
95
}
96
 
1 www 97
function handleScriptLoad(updateQuery, autoCompleteRef, setAddresObject, setError) {
98
  autoComplete = new window.google.maps.places.Autocomplete(
99
    autoCompleteRef.current,
100
    { types: ["(cities)"]}
101
  );
102
  autoComplete.setFields(["address_components", "formatted_address", "geometry"]);
103
  autoComplete.addListener("place_changed", () =>
104
    handlePlaceSelect(updateQuery, setAddresObject, setError)
105
  );
106
}
107
 
108
async function handlePlaceSelect(updateQuery, setAddresObject, setError) {
109
  const addressObject = autoComplete.getPlace();
110
  // console.log(addressObject.geometry.location.lat());
111
  // console.log(addressObject.geometry.location.lng());
112
  const query = addressObject.formatted_address;
113
  if(query){
114
    setError("");
115
    updateQuery(query);
116
    setAddresObject({...addressObject, address_components:[...addressObject.address_components, {latitude: addressObject.geometry.location.lat(),longitude: addressObject.geometry.location.lng(), types:["geometry"]}]});
117
  }else{
118
    setError("$error_msg");
119
  }
120
}
121
 
122
JS;
123
$this->inlineScript()->appendScript($js);
124
$this->inlineScript()->appendFile('/react-bundles/search/searchBundle.js');
125
?>
126
 
127
<div id="react_search" class="posts-section">
128
  <div class="process-comm" id="paginator-process-comm">
129
    <div class="spinner">
130
      <div class="bounce1"></div>
131
      <div class="bounce2"></div>
132
      <div class="bounce3"></div>
133
    </div>
134
  </div>
135
</div>