@@ -163,18 +163,26 @@ |
||
| 163 | 163 | { |
| 164 | 164 | $members = self::getUsers(); |
| 165 | 165 | |
| 166 | - if (is_null($members)) return null; |
|
| 167 | - if (!isset($members['results'])) return null; |
|
| 166 | + if (is_null($members)) { |
|
| 167 | + return null; |
|
| 168 | + } |
|
| 169 | + if (!isset($members['results'])) { |
|
| 170 | + return null; |
|
| 171 | + } |
|
| 168 | 172 | |
| 169 | 173 | $memberIDs = array(); |
| 170 | 174 | |
| 171 | 175 | foreach ($members['results'] as $memb) { |
| 172 | 176 | if (isset($memb['member_id']) && isset($memb['member_type'])) { |
| 173 | - if ($memberType==$memb['member_type']) $memberIDs[]=$memb['member_id']; |
|
| 177 | + if ($memberType==$memb['member_type']) { |
|
| 178 | + $memberIDs[]=$memb['member_id']; |
|
| 179 | + } |
|
| 174 | 180 | } |
| 175 | 181 | } |
| 176 | 182 | |
| 177 | - if (sizeof($memberIDs)<1) return null; |
|
| 183 | + if (sizeof($memberIDs)<1) { |
|
| 184 | + return null; |
|
| 185 | + } |
|
| 178 | 186 | |
| 179 | 187 | $randomIndex = rand(0, sizeof($memberIDs)-1); |
| 180 | 188 | |
@@ -65,9 +65,9 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public static function fromArray(array $params) |
| 67 | 67 | { |
| 68 | - $member= new Member(); |
|
| 68 | + $member = new Member(); |
|
| 69 | 69 | |
| 70 | - foreach($params as $key => $value) { |
|
| 70 | + foreach ($params as $key => $value) { |
|
| 71 | 71 | if (property_exists($member, $key)) { |
| 72 | 72 | $member->{$key} = $value; |
| 73 | 73 | } |
@@ -154,13 +154,13 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | foreach ($members['results'] as $memb) { |
| 156 | 156 | if (isset($memb['member_id']) && isset($memb['member_type'])) { |
| 157 | - if ($memberType==$memb['member_type']) $memberIDs[]=$memb['member_id']; |
|
| 157 | + if ($memberType==$memb['member_type']) $memberIDs[] = $memb['member_id']; |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | if (sizeof($memberIDs)<1) return null; |
| 162 | 162 | |
| 163 | - $randomIndex = rand(0, sizeof($memberIDs)-1); |
|
| 163 | + $randomIndex = rand(0, sizeof($memberIDs) - 1); |
|
| 164 | 164 | |
| 165 | 165 | return $memberIDs[$randomIndex]; |
| 166 | 166 | } |
@@ -6,320 +6,320 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Member extends Common |
| 8 | 8 | { |
| 9 | - public $device_id; |
|
| 10 | - public $device_type; |
|
| 11 | - public $format; |
|
| 9 | + public $device_id; |
|
| 10 | + public $device_type; |
|
| 11 | + public $format; |
|
| 12 | 12 | |
| 13 | - public $strEmail; |
|
| 14 | - public $strPassword; |
|
| 15 | - public $strPassword_1; |
|
| 16 | - public $strPassword_2; |
|
| 17 | - public $strFirstName; |
|
| 18 | - public $strLastName; |
|
| 19 | - public $strIndustry; |
|
| 20 | - public $chkTerms; |
|
| 21 | - public $plan; |
|
| 13 | + public $strEmail; |
|
| 14 | + public $strPassword; |
|
| 15 | + public $strPassword_1; |
|
| 16 | + public $strPassword_2; |
|
| 17 | + public $strFirstName; |
|
| 18 | + public $strLastName; |
|
| 19 | + public $strIndustry; |
|
| 20 | + public $chkTerms; |
|
| 21 | + public $plan; |
|
| 22 | 22 | |
| 23 | - public $session_guid; |
|
| 24 | - public $member_id; |
|
| 23 | + public $session_guid; |
|
| 24 | + public $member_id; |
|
| 25 | 25 | |
| 26 | - public $email_address; |
|
| 27 | - public $first_name; |
|
| 28 | - public $last_name; |
|
| 29 | - public $phone_number; |
|
| 30 | - public $company_name; |
|
| 31 | - public $webinar_date; |
|
| 26 | + public $email_address; |
|
| 27 | + public $first_name; |
|
| 28 | + public $last_name; |
|
| 29 | + public $phone_number; |
|
| 30 | + public $company_name; |
|
| 31 | + public $webinar_date; |
|
| 32 | 32 | |
| 33 | - public $subscription_name; |
|
| 34 | - public $token; |
|
| 35 | - public $payload; |
|
| 33 | + public $subscription_name; |
|
| 34 | + public $token; |
|
| 35 | + public $payload; |
|
| 36 | 36 | |
| 37 | - public $HIDE_ROUTED_ADDRESSES; |
|
| 38 | - public $member_phone; |
|
| 39 | - public $member_zipcode; |
|
| 40 | - public $route_count; |
|
| 41 | - public $member_email; |
|
| 42 | - public $HIDE_VISITED_ADDRESSES; |
|
| 43 | - public $READONLY_USER; |
|
| 44 | - public $member_type; |
|
| 45 | - public $date_of_birth; |
|
| 46 | - public $member_first_name; |
|
| 47 | - public $member_password; |
|
| 48 | - public $HIDE_NONFUTURE_ROUTES; |
|
| 49 | - public $member_last_name; |
|
| 50 | - public $SHOW_ALL_VEHICLES; |
|
| 51 | - public $SHOW_ALL_DRIVERS; |
|
| 37 | + public $HIDE_ROUTED_ADDRESSES; |
|
| 38 | + public $member_phone; |
|
| 39 | + public $member_zipcode; |
|
| 40 | + public $route_count; |
|
| 41 | + public $member_email; |
|
| 42 | + public $HIDE_VISITED_ADDRESSES; |
|
| 43 | + public $READONLY_USER; |
|
| 44 | + public $member_type; |
|
| 45 | + public $date_of_birth; |
|
| 46 | + public $member_first_name; |
|
| 47 | + public $member_password; |
|
| 48 | + public $HIDE_NONFUTURE_ROUTES; |
|
| 49 | + public $member_last_name; |
|
| 50 | + public $SHOW_ALL_VEHICLES; |
|
| 51 | + public $SHOW_ALL_DRIVERS; |
|
| 52 | 52 | |
| 53 | - public $config_key; |
|
| 54 | - public $config_value; |
|
| 53 | + public $config_key; |
|
| 54 | + public $config_value; |
|
| 55 | 55 | |
| 56 | - public $preferred_units; |
|
| 57 | - public $preferred_language; |
|
| 58 | - public $timezone; |
|
| 59 | - public $OWNER_MEMBER_ID; |
|
| 60 | - public $user_reg_state_id; |
|
| 61 | - public $user_reg_country_id; |
|
| 62 | - public $member_picture; |
|
| 63 | - public $api_key; |
|
| 64 | - public $custom_data; |
|
| 56 | + public $preferred_units; |
|
| 57 | + public $preferred_language; |
|
| 58 | + public $timezone; |
|
| 59 | + public $OWNER_MEMBER_ID; |
|
| 60 | + public $user_reg_state_id; |
|
| 61 | + public $user_reg_country_id; |
|
| 62 | + public $member_picture; |
|
| 63 | + public $api_key; |
|
| 64 | + public $custom_data; |
|
| 65 | 65 | |
| 66 | - public static function fromArray(array $params) |
|
| 67 | - { |
|
| 68 | - $member= new Member(); |
|
| 69 | - |
|
| 70 | - foreach($params as $key => $value) { |
|
| 71 | - if (property_exists($member, $key)) { |
|
| 72 | - $member->{$key} = $value; |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - return $member; |
|
| 77 | - } |
|
| 66 | + public static function fromArray(array $params) |
|
| 67 | + { |
|
| 68 | + $member= new Member(); |
|
| 69 | + |
|
| 70 | + foreach($params as $key => $value) { |
|
| 71 | + if (property_exists($member, $key)) { |
|
| 72 | + $member->{$key} = $value; |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + return $member; |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - public static function getUsers() |
|
| 80 | - { |
|
| 81 | - $response = Route4Me::makeRequst(array( |
|
| 82 | - 'url' => Endpoint::USER_V4, |
|
| 83 | - 'method' => 'GET' |
|
| 84 | - )); |
|
| 79 | + public static function getUsers() |
|
| 80 | + { |
|
| 81 | + $response = Route4Me::makeRequst(array( |
|
| 82 | + 'url' => Endpoint::USER_V4, |
|
| 83 | + 'method' => 'GET' |
|
| 84 | + )); |
|
| 85 | 85 | |
| 86 | - return $response; |
|
| 87 | - } |
|
| 86 | + return $response; |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - public static function getUser($params) |
|
| 90 | - { |
|
| 91 | - $response = Route4Me::makeRequst(array( |
|
| 92 | - 'url' => Endpoint::USER_V4, |
|
| 93 | - 'method' => 'GET', |
|
| 94 | - 'query' => array( |
|
| 95 | - 'member_id' => isset($params['member_id']) ? $params['member_id'] : null |
|
| 96 | - ) |
|
| 97 | - )); |
|
| 89 | + public static function getUser($params) |
|
| 90 | + { |
|
| 91 | + $response = Route4Me::makeRequst(array( |
|
| 92 | + 'url' => Endpoint::USER_V4, |
|
| 93 | + 'method' => 'GET', |
|
| 94 | + 'query' => array( |
|
| 95 | + 'member_id' => isset($params['member_id']) ? $params['member_id'] : null |
|
| 96 | + ) |
|
| 97 | + )); |
|
| 98 | 98 | |
| 99 | - return $response; |
|
| 100 | - } |
|
| 99 | + return $response; |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - public static function getUserLocations($param) |
|
| 103 | - { |
|
| 104 | - $response = Route4Me::makeRequst(array( |
|
| 105 | - 'url' => Endpoint::VIEW_USER_LOCATIONS, |
|
| 106 | - 'method' => 'GET', |
|
| 107 | - 'query' => array( |
|
| 108 | - 'query' => $param |
|
| 109 | - ) |
|
| 110 | - )); |
|
| 102 | + public static function getUserLocations($param) |
|
| 103 | + { |
|
| 104 | + $response = Route4Me::makeRequst(array( |
|
| 105 | + 'url' => Endpoint::VIEW_USER_LOCATIONS, |
|
| 106 | + 'method' => 'GET', |
|
| 107 | + 'query' => array( |
|
| 108 | + 'query' => $param |
|
| 109 | + ) |
|
| 110 | + )); |
|
| 111 | 111 | |
| 112 | - return $response; |
|
| 113 | - } |
|
| 112 | + return $response; |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - public static function addDeviceRecord($params) |
|
| 116 | - { |
|
| 117 | - $allQueryFields = array('device_id', 'device_type'); |
|
| 118 | - $allBodyFields = array('device_id', 'device_type', 'format'); |
|
| 119 | - |
|
| 120 | - $response = Route4Me::makeRequst(array( |
|
| 121 | - 'url' => Endpoint::VERIFY_DEVICE_LICENSE, |
|
| 122 | - 'method' => 'POST', |
|
| 123 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 124 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 125 | - )); |
|
| 126 | - |
|
| 127 | - return $response; |
|
| 128 | - } |
|
| 115 | + public static function addDeviceRecord($params) |
|
| 116 | + { |
|
| 117 | + $allQueryFields = array('device_id', 'device_type'); |
|
| 118 | + $allBodyFields = array('device_id', 'device_type', 'format'); |
|
| 119 | + |
|
| 120 | + $response = Route4Me::makeRequst(array( |
|
| 121 | + 'url' => Endpoint::VERIFY_DEVICE_LICENSE, |
|
| 122 | + 'method' => 'POST', |
|
| 123 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 124 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 125 | + )); |
|
| 126 | + |
|
| 127 | + return $response; |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - public static function createMember($params) |
|
| 131 | - { |
|
| 132 | - $excludeFields = array('session_guid', 'member_id', 'token', 'payload', 'webinar_date', |
|
| 133 | - 'company_name', 'config_key', 'config_value', 'api_key'); |
|
| 130 | + public static function createMember($params) |
|
| 131 | + { |
|
| 132 | + $excludeFields = array('session_guid', 'member_id', 'token', 'payload', 'webinar_date', |
|
| 133 | + 'company_name', 'config_key', 'config_value', 'api_key'); |
|
| 134 | 134 | |
| 135 | - $allBodyFields = Route4Me::getObjectProperties(new Member(), $excludeFields); |
|
| 135 | + $allBodyFields = Route4Me::getObjectProperties(new Member(), $excludeFields); |
|
| 136 | 136 | |
| 137 | - $response = Route4Me::makeRequst(array( |
|
| 138 | - 'url' => Endpoint::USER_V4, |
|
| 139 | - 'method' => 'POST', |
|
| 140 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 141 | - )); |
|
| 142 | - |
|
| 143 | - return $response; |
|
| 144 | - } |
|
| 137 | + $response = Route4Me::makeRequst(array( |
|
| 138 | + 'url' => Endpoint::USER_V4, |
|
| 139 | + 'method' => 'POST', |
|
| 140 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 141 | + )); |
|
| 142 | + |
|
| 143 | + return $response; |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | - public static function getRandomMemberByType($memberType) |
|
| 147 | - { |
|
| 148 | - $members = self::getUsers(); |
|
| 146 | + public static function getRandomMemberByType($memberType) |
|
| 147 | + { |
|
| 148 | + $members = self::getUsers(); |
|
| 149 | 149 | |
| 150 | - if (is_null($members)) return null; |
|
| 151 | - if (!isset($members['results'])) return null; |
|
| 150 | + if (is_null($members)) return null; |
|
| 151 | + if (!isset($members['results'])) return null; |
|
| 152 | 152 | |
| 153 | - $memberIDs = array(); |
|
| 153 | + $memberIDs = array(); |
|
| 154 | 154 | |
| 155 | - foreach ($members['results'] as $memb) { |
|
| 156 | - if (isset($memb['member_id']) && isset($memb['member_type'])) { |
|
| 157 | - if ($memberType==$memb['member_type']) $memberIDs[]=$memb['member_id']; |
|
| 158 | - } |
|
| 159 | - } |
|
| 155 | + foreach ($members['results'] as $memb) { |
|
| 156 | + if (isset($memb['member_id']) && isset($memb['member_type'])) { |
|
| 157 | + if ($memberType==$memb['member_type']) $memberIDs[]=$memb['member_id']; |
|
| 158 | + } |
|
| 159 | + } |
|
| 160 | 160 | |
| 161 | - if (sizeof($memberIDs)<1) return null; |
|
| 161 | + if (sizeof($memberIDs)<1) return null; |
|
| 162 | 162 | |
| 163 | - $randomIndex = rand(0, sizeof($memberIDs)-1); |
|
| 163 | + $randomIndex = rand(0, sizeof($memberIDs)-1); |
|
| 164 | 164 | |
| 165 | - return $memberIDs[$randomIndex]; |
|
| 166 | - } |
|
| 165 | + return $memberIDs[$randomIndex]; |
|
| 166 | + } |
|
| 167 | 167 | |
| 168 | 168 | |
| 169 | - public static function updateMember($body) |
|
| 170 | - { |
|
| 171 | - $excludeFields = array('session_guid', 'token', 'payload', 'webinar_date', |
|
| 172 | - 'company_name', 'config_key', 'config_value', 'api_key'); |
|
| 169 | + public static function updateMember($body) |
|
| 170 | + { |
|
| 171 | + $excludeFields = array('session_guid', 'token', 'payload', 'webinar_date', |
|
| 172 | + 'company_name', 'config_key', 'config_value', 'api_key'); |
|
| 173 | 173 | |
| 174 | - $allBodyFields = Route4Me::getObjectProperties(new Member(), $excludeFields); |
|
| 174 | + $allBodyFields = Route4Me::getObjectProperties(new Member(), $excludeFields); |
|
| 175 | 175 | |
| 176 | - $response = Route4Me::makeRequst(array( |
|
| 177 | - 'url' => Endpoint::USER_V4, |
|
| 178 | - 'method' => 'PUT', |
|
| 179 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $body) |
|
| 180 | - )); |
|
| 176 | + $response = Route4Me::makeRequst(array( |
|
| 177 | + 'url' => Endpoint::USER_V4, |
|
| 178 | + 'method' => 'PUT', |
|
| 179 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $body) |
|
| 180 | + )); |
|
| 181 | 181 | |
| 182 | - return $response; |
|
| 183 | - } |
|
| 182 | + return $response; |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | - public static function deleteMember($body) |
|
| 186 | - { |
|
| 187 | - $response = Route4Me::makeRequst(array( |
|
| 188 | - 'url' => Endpoint::USER_V4, |
|
| 189 | - 'method' => 'DELETE', |
|
| 190 | - 'body' => array( |
|
| 191 | - 'member_id' => isset($body->member_id) ? $body->member_id : null |
|
| 192 | - ) |
|
| 185 | + public static function deleteMember($body) |
|
| 186 | + { |
|
| 187 | + $response = Route4Me::makeRequst(array( |
|
| 188 | + 'url' => Endpoint::USER_V4, |
|
| 189 | + 'method' => 'DELETE', |
|
| 190 | + 'body' => array( |
|
| 191 | + 'member_id' => isset($body->member_id) ? $body->member_id : null |
|
| 192 | + ) |
|
| 193 | 193 | |
| 194 | - )); |
|
| 194 | + )); |
|
| 195 | 195 | |
| 196 | - return $response; |
|
| 197 | - } |
|
| 196 | + return $response; |
|
| 197 | + } |
|
| 198 | 198 | |
| 199 | - public static function newAccountRegistration($params) |
|
| 200 | - { |
|
| 201 | - $allQueryFields = array('plan'); |
|
| 202 | - $allBodyFields = array('strEmail', 'strPassword_1', 'strPassword_2', 'strFirstName', |
|
| 203 | - 'strLastName', 'format', 'strIndustry', 'chkTerms', |
|
| 204 | - 'device_type', 'strSubAccountType', 'blDisableMarketing', 'blDisableAccountActivationEmail'); |
|
| 205 | - |
|
| 206 | - $response = Route4Me::makeRequst(array( |
|
| 207 | - 'url' => Endpoint::REGISTER_ACTION, |
|
| 208 | - 'method' => 'POST', |
|
| 209 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 210 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 211 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
| 212 | - )); |
|
| 213 | - |
|
| 214 | - return $response; |
|
| 215 | - } |
|
| 199 | + public static function newAccountRegistration($params) |
|
| 200 | + { |
|
| 201 | + $allQueryFields = array('plan'); |
|
| 202 | + $allBodyFields = array('strEmail', 'strPassword_1', 'strPassword_2', 'strFirstName', |
|
| 203 | + 'strLastName', 'format', 'strIndustry', 'chkTerms', |
|
| 204 | + 'device_type', 'strSubAccountType', 'blDisableMarketing', 'blDisableAccountActivationEmail'); |
|
| 205 | + |
|
| 206 | + $response = Route4Me::makeRequst(array( |
|
| 207 | + 'url' => Endpoint::REGISTER_ACTION, |
|
| 208 | + 'method' => 'POST', |
|
| 209 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 210 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 211 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
| 212 | + )); |
|
| 213 | + |
|
| 214 | + return $response; |
|
| 215 | + } |
|
| 216 | 216 | |
| 217 | - public static function validateSession($params) |
|
| 218 | - { |
|
| 219 | - $allQueryFields = array('session_guid', 'member_id', 'format'); |
|
| 220 | - |
|
| 221 | - $response = Route4Me::makeRequst(array( |
|
| 222 | - 'url' => Endpoint::VALIDATE_SESSION, |
|
| 223 | - 'method' => 'GET', |
|
| 224 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
| 225 | - )); |
|
| 226 | - |
|
| 227 | - return $response; |
|
| 228 | - } |
|
| 217 | + public static function validateSession($params) |
|
| 218 | + { |
|
| 219 | + $allQueryFields = array('session_guid', 'member_id', 'format'); |
|
| 220 | + |
|
| 221 | + $response = Route4Me::makeRequst(array( |
|
| 222 | + 'url' => Endpoint::VALIDATE_SESSION, |
|
| 223 | + 'method' => 'GET', |
|
| 224 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
| 225 | + )); |
|
| 226 | + |
|
| 227 | + return $response; |
|
| 228 | + } |
|
| 229 | 229 | |
| 230 | - public static function memberAuthentication($params) |
|
| 231 | - { |
|
| 232 | - $allBodyFields = array('strEmail', 'strPassword', 'format'); |
|
| 233 | - |
|
| 234 | - $response = Route4Me::makeRequst(array( |
|
| 235 | - 'url' => Endpoint::AUTHENTICATE, |
|
| 236 | - 'method' => 'POST', |
|
| 237 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 238 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
| 239 | - )); |
|
| 240 | - |
|
| 241 | - return $response; |
|
| 242 | - } |
|
| 230 | + public static function memberAuthentication($params) |
|
| 231 | + { |
|
| 232 | + $allBodyFields = array('strEmail', 'strPassword', 'format'); |
|
| 233 | + |
|
| 234 | + $response = Route4Me::makeRequst(array( |
|
| 235 | + 'url' => Endpoint::AUTHENTICATE, |
|
| 236 | + 'method' => 'POST', |
|
| 237 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 238 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
| 239 | + )); |
|
| 240 | + |
|
| 241 | + return $response; |
|
| 242 | + } |
|
| 243 | 243 | |
| 244 | - public static function webinarRegistration($params) |
|
| 245 | - { |
|
| 246 | - $allBodyFields = array('email_address', 'first_name', 'last_name', 'phone_number', |
|
| 247 | - 'company_name', 'member_id', 'webinar_date'); |
|
| 248 | - |
|
| 249 | - $response = Route4Me::makeRequst(array( |
|
| 250 | - 'url' => Endpoint::WEBINAR_REGISTER, |
|
| 251 | - 'method' => 'POST', |
|
| 252 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 253 | - )); |
|
| 254 | - |
|
| 255 | - return $response; |
|
| 256 | - } |
|
| 244 | + public static function webinarRegistration($params) |
|
| 245 | + { |
|
| 246 | + $allBodyFields = array('email_address', 'first_name', 'last_name', 'phone_number', |
|
| 247 | + 'company_name', 'member_id', 'webinar_date'); |
|
| 248 | + |
|
| 249 | + $response = Route4Me::makeRequst(array( |
|
| 250 | + 'url' => Endpoint::WEBINAR_REGISTER, |
|
| 251 | + 'method' => 'POST', |
|
| 252 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 253 | + )); |
|
| 254 | + |
|
| 255 | + return $response; |
|
| 256 | + } |
|
| 257 | 257 | |
| 258 | - public static function purchaseUserLicense($params) |
|
| 259 | - { |
|
| 260 | - $allQueryFields = array('device_id'); |
|
| 261 | - $allBodyFields = array('member_id', 'session_guid', 'device_id', 'device_type', |
|
| 262 | - 'subscription_name', 'token', 'payload', 'format'); |
|
| 263 | - |
|
| 264 | - $response = Route4Me::makeRequst(array( |
|
| 265 | - 'url' => Endpoint::USER_LICENSE, |
|
| 266 | - 'method' => 'POST', |
|
| 267 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 268 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 269 | - )); |
|
| 270 | - |
|
| 271 | - return $response; |
|
| 272 | - } |
|
| 258 | + public static function purchaseUserLicense($params) |
|
| 259 | + { |
|
| 260 | + $allQueryFields = array('device_id'); |
|
| 261 | + $allBodyFields = array('member_id', 'session_guid', 'device_id', 'device_type', |
|
| 262 | + 'subscription_name', 'token', 'payload', 'format'); |
|
| 263 | + |
|
| 264 | + $response = Route4Me::makeRequst(array( |
|
| 265 | + 'url' => Endpoint::USER_LICENSE, |
|
| 266 | + 'method' => 'POST', |
|
| 267 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 268 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 269 | + )); |
|
| 270 | + |
|
| 271 | + return $response; |
|
| 272 | + } |
|
| 273 | 273 | |
| 274 | - public static function newMemberConfigKey($params) |
|
| 275 | - { |
|
| 276 | - $allBodyFields = array('config_key', 'config_value'); |
|
| 277 | - |
|
| 278 | - $response = Route4Me::makeRequst(array( |
|
| 279 | - 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
| 280 | - 'method' => 'POST', |
|
| 281 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 282 | - )); |
|
| 283 | - |
|
| 284 | - return $response; |
|
| 285 | - } |
|
| 274 | + public static function newMemberConfigKey($params) |
|
| 275 | + { |
|
| 276 | + $allBodyFields = array('config_key', 'config_value'); |
|
| 277 | + |
|
| 278 | + $response = Route4Me::makeRequst(array( |
|
| 279 | + 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
| 280 | + 'method' => 'POST', |
|
| 281 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 282 | + )); |
|
| 283 | + |
|
| 284 | + return $response; |
|
| 285 | + } |
|
| 286 | 286 | |
| 287 | - public static function removeMemberConfigKey($params) |
|
| 288 | - { |
|
| 289 | - $allBodyFields = array('config_key'); |
|
| 290 | - |
|
| 291 | - $response = Route4Me::makeRequst(array( |
|
| 292 | - 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
| 293 | - 'method' => 'DELETE', |
|
| 294 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 295 | - )); |
|
| 296 | - |
|
| 297 | - return $response; |
|
| 298 | - } |
|
| 287 | + public static function removeMemberConfigKey($params) |
|
| 288 | + { |
|
| 289 | + $allBodyFields = array('config_key'); |
|
| 290 | + |
|
| 291 | + $response = Route4Me::makeRequst(array( |
|
| 292 | + 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
| 293 | + 'method' => 'DELETE', |
|
| 294 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 295 | + )); |
|
| 296 | + |
|
| 297 | + return $response; |
|
| 298 | + } |
|
| 299 | 299 | |
| 300 | - public static function getMemberConfigData($params) |
|
| 301 | - { |
|
| 302 | - $allQueryFields = array('config_key'); |
|
| 303 | - |
|
| 304 | - $response = Route4Me::makeRequst(array( |
|
| 305 | - 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
| 306 | - 'method' => 'GET', |
|
| 307 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
| 308 | - )); |
|
| 309 | - |
|
| 310 | - return $response; |
|
| 311 | - } |
|
| 300 | + public static function getMemberConfigData($params) |
|
| 301 | + { |
|
| 302 | + $allQueryFields = array('config_key'); |
|
| 303 | + |
|
| 304 | + $response = Route4Me::makeRequst(array( |
|
| 305 | + 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
| 306 | + 'method' => 'GET', |
|
| 307 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
| 308 | + )); |
|
| 309 | + |
|
| 310 | + return $response; |
|
| 311 | + } |
|
| 312 | 312 | |
| 313 | - public static function updateMemberConfigKey($params) |
|
| 314 | - { |
|
| 315 | - $allBodyFields = array('config_key', 'config_value'); |
|
| 316 | - |
|
| 317 | - $response = Route4Me::makeRequst(array( |
|
| 318 | - 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
| 319 | - 'method' => 'PUT', |
|
| 320 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 321 | - )); |
|
| 322 | - |
|
| 323 | - return $response; |
|
| 324 | - } |
|
| 313 | + public static function updateMemberConfigKey($params) |
|
| 314 | + { |
|
| 315 | + $allBodyFields = array('config_key', 'config_value'); |
|
| 316 | + |
|
| 317 | + $response = Route4Me::makeRequst(array( |
|
| 318 | + 'url' => Endpoint::CONFIGURATION_SETTINGS, |
|
| 319 | + 'method' => 'PUT', |
|
| 320 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 321 | + )); |
|
| 322 | + |
|
| 323 | + return $response; |
|
| 324 | + } |
|
| 325 | 325 | } |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | class AvoidanceZone extends Common |
| 9 | 9 | { |
| 10 | - public $territory_id; // Avoidance zone id |
|
| 10 | + public $territory_id; // Avoidance zone id |
|
| 11 | 11 | public $territory_name; |
| 12 | 12 | public $territory_color; |
| 13 | 13 | public $orders; |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | $avoidanceZoneParameters = new AvoidanceZone(); |
| 32 | 32 | |
| 33 | - foreach($params as $key => $value) { |
|
| 33 | + foreach ($params as $key => $value) { |
|
| 34 | 34 | if (property_exists($avoidanceZoneParameters, $key)) { |
| 35 | 35 | $avoidanceZoneParameters->{$key} = $value; |
| 36 | 36 | } |
@@ -7,107 +7,107 @@ |
||
| 7 | 7 | |
| 8 | 8 | class AvoidanceZone extends Common |
| 9 | 9 | { |
| 10 | - public $territory_id; // Avoidance zone id |
|
| 11 | - public $territory_name; |
|
| 12 | - public $territory_color; |
|
| 13 | - public $orders; |
|
| 14 | - public $member_id; |
|
| 15 | - public $territory; // Territory parameters |
|
| 10 | + public $territory_id; // Avoidance zone id |
|
| 11 | + public $territory_name; |
|
| 12 | + public $territory_color; |
|
| 13 | + public $orders; |
|
| 14 | + public $member_id; |
|
| 15 | + public $territory; // Territory parameters |
|
| 16 | 16 | |
| 17 | - public static function fromArray(array $params) |
|
| 18 | - { |
|
| 19 | - if (!isset($params['territory_name'])) { |
|
| 20 | - throw new BadParam('Territory name must be provided'); |
|
| 21 | - } |
|
| 17 | + public static function fromArray(array $params) |
|
| 18 | + { |
|
| 19 | + if (!isset($params['territory_name'])) { |
|
| 20 | + throw new BadParam('Territory name must be provided'); |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - if (!isset($params['territory_color'])) { |
|
| 24 | - throw new BadParam('Territory color must be provided'); |
|
| 25 | - } |
|
| 23 | + if (!isset($params['territory_color'])) { |
|
| 24 | + throw new BadParam('Territory color must be provided'); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - if (!isset($params['territory'])) { |
|
| 28 | - throw new BadParam('Territory must be provided'); |
|
| 29 | - } |
|
| 27 | + if (!isset($params['territory'])) { |
|
| 28 | + throw new BadParam('Territory must be provided'); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - $avoidanceZoneParameters = new AvoidanceZone(); |
|
| 31 | + $avoidanceZoneParameters = new AvoidanceZone(); |
|
| 32 | 32 | |
| 33 | - foreach($params as $key => $value) { |
|
| 34 | - if (property_exists($avoidanceZoneParameters, $key)) { |
|
| 35 | - $avoidanceZoneParameters->{$key} = $value; |
|
| 36 | - } |
|
| 37 | - } |
|
| 33 | + foreach($params as $key => $value) { |
|
| 34 | + if (property_exists($avoidanceZoneParameters, $key)) { |
|
| 35 | + $avoidanceZoneParameters->{$key} = $value; |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - return $avoidanceZoneParameters; |
|
| 40 | - } |
|
| 39 | + return $avoidanceZoneParameters; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - public static function getAvoidanceZone($territory_id) |
|
| 43 | - { |
|
| 44 | - $avoidanceZone = Route4Me::makeRequst(array( |
|
| 45 | - 'url' => Endpoint::AVOIDANCE_ZONE, |
|
| 46 | - 'method' => 'GET', |
|
| 47 | - 'query' => array( |
|
| 48 | - 'territory_id' => $territory_id |
|
| 49 | - ) |
|
| 50 | - )); |
|
| 42 | + public static function getAvoidanceZone($territory_id) |
|
| 43 | + { |
|
| 44 | + $avoidanceZone = Route4Me::makeRequst(array( |
|
| 45 | + 'url' => Endpoint::AVOIDANCE_ZONE, |
|
| 46 | + 'method' => 'GET', |
|
| 47 | + 'query' => array( |
|
| 48 | + 'territory_id' => $territory_id |
|
| 49 | + ) |
|
| 50 | + )); |
|
| 51 | 51 | |
| 52 | - return $avoidanceZone; |
|
| 53 | - } |
|
| 52 | + return $avoidanceZone; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - public static function getAvoidanceZones($params) |
|
| 56 | - { |
|
| 57 | - $avoidanceZones = Route4Me::makeRequst(array( |
|
| 58 | - 'url' => Endpoint::AVOIDANCE_ZONE, |
|
| 59 | - 'method' => 'GET', |
|
| 60 | - 'query' => array( |
|
| 61 | - 'offset' => isset($params->offset) ? $params->offset : null, |
|
| 62 | - 'limit' => isset($params->limit) ? $params->limit : null, |
|
| 63 | - ) |
|
| 64 | - )); |
|
| 55 | + public static function getAvoidanceZones($params) |
|
| 56 | + { |
|
| 57 | + $avoidanceZones = Route4Me::makeRequst(array( |
|
| 58 | + 'url' => Endpoint::AVOIDANCE_ZONE, |
|
| 59 | + 'method' => 'GET', |
|
| 60 | + 'query' => array( |
|
| 61 | + 'offset' => isset($params->offset) ? $params->offset : null, |
|
| 62 | + 'limit' => isset($params->limit) ? $params->limit : null, |
|
| 63 | + ) |
|
| 64 | + )); |
|
| 65 | 65 | |
| 66 | - return $avoidanceZones; |
|
| 67 | - } |
|
| 66 | + return $avoidanceZones; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - public static function addAvoidanceZone($params) |
|
| 70 | - { |
|
| 71 | - $terParams = array(); |
|
| 69 | + public static function addAvoidanceZone($params) |
|
| 70 | + { |
|
| 71 | + $terParams = array(); |
|
| 72 | 72 | |
| 73 | - if (isset($params->territory['type'])) $terParams['type'] = $params->territory['type']; |
|
| 74 | - if (isset($params->territory['data'])) $terParams['data'] = $params->territory['data']; |
|
| 73 | + if (isset($params->territory['type'])) $terParams['type'] = $params->territory['type']; |
|
| 74 | + if (isset($params->territory['data'])) $terParams['data'] = $params->territory['data']; |
|
| 75 | 75 | |
| 76 | - $abContacts = Route4Me::makeRequst(array( |
|
| 77 | - 'url' => Endpoint::AVOIDANCE_ZONE, |
|
| 78 | - 'method' => 'POST', |
|
| 79 | - 'body' => array( |
|
| 80 | - 'territory_name' => isset($params->territory_name) ? $params->territory_name : null, |
|
| 81 | - 'territory_color' => isset($params->territory_color) ? $params->territory_color : null, |
|
| 82 | - 'territory' => $terParams |
|
| 83 | - ) |
|
| 84 | - )); |
|
| 76 | + $abContacts = Route4Me::makeRequst(array( |
|
| 77 | + 'url' => Endpoint::AVOIDANCE_ZONE, |
|
| 78 | + 'method' => 'POST', |
|
| 79 | + 'body' => array( |
|
| 80 | + 'territory_name' => isset($params->territory_name) ? $params->territory_name : null, |
|
| 81 | + 'territory_color' => isset($params->territory_color) ? $params->territory_color : null, |
|
| 82 | + 'territory' => $terParams |
|
| 83 | + ) |
|
| 84 | + )); |
|
| 85 | 85 | |
| 86 | - return $abContacts; |
|
| 87 | - } |
|
| 86 | + return $abContacts; |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - public function deleteAvoidanceZone($territory_id) |
|
| 90 | - { |
|
| 91 | - $result = Route4Me::makeRequst(array( |
|
| 92 | - 'url' => Endpoint::AVOIDANCE_ZONE, |
|
| 93 | - 'method' => 'DELETEARRAY', |
|
| 94 | - 'query' => array( |
|
| 95 | - 'territory_id' => $territory_id |
|
| 96 | - ) |
|
| 97 | - )); |
|
| 89 | + public function deleteAvoidanceZone($territory_id) |
|
| 90 | + { |
|
| 91 | + $result = Route4Me::makeRequst(array( |
|
| 92 | + 'url' => Endpoint::AVOIDANCE_ZONE, |
|
| 93 | + 'method' => 'DELETEARRAY', |
|
| 94 | + 'query' => array( |
|
| 95 | + 'territory_id' => $territory_id |
|
| 96 | + ) |
|
| 97 | + )); |
|
| 98 | 98 | |
| 99 | - return $result; |
|
| 100 | - } |
|
| 99 | + return $result; |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - public function updateAvoidanceZone($params) |
|
| 103 | - { |
|
| 104 | - $avoidanceZone = Route4Me::makeRequst(array( |
|
| 105 | - 'url' => Endpoint::AVOIDANCE_ZONE, |
|
| 106 | - 'method' => 'PUT', |
|
| 107 | - 'body' => $params, |
|
| 102 | + public function updateAvoidanceZone($params) |
|
| 103 | + { |
|
| 104 | + $avoidanceZone = Route4Me::makeRequst(array( |
|
| 105 | + 'url' => Endpoint::AVOIDANCE_ZONE, |
|
| 106 | + 'method' => 'PUT', |
|
| 107 | + 'body' => $params, |
|
| 108 | 108 | |
| 109 | - )); |
|
| 109 | + )); |
|
| 110 | 110 | |
| 111 | - return $avoidanceZone; |
|
| 112 | - } |
|
| 111 | + return $avoidanceZone; |
|
| 112 | + } |
|
| 113 | 113 | } |
@@ -70,8 +70,12 @@ |
||
| 70 | 70 | { |
| 71 | 71 | $terParams = array(); |
| 72 | 72 | |
| 73 | - if (isset($params->territory['type'])) $terParams['type'] = $params->territory['type']; |
|
| 74 | - if (isset($params->territory['data'])) $terParams['data'] = $params->territory['data']; |
|
| 73 | + if (isset($params->territory['type'])) { |
|
| 74 | + $terParams['type'] = $params->territory['type']; |
|
| 75 | + } |
|
| 76 | + if (isset($params->territory['data'])) { |
|
| 77 | + $terParams['data'] = $params->territory['data']; |
|
| 78 | + } |
|
| 75 | 79 | |
| 76 | 80 | $abContacts = Route4Me::makeRequst(array( |
| 77 | 81 | 'url' => Endpoint::AVOIDANCE_ZONE, |
@@ -1,7 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -use Route4Me\Exception\BadParam; |
|
| 5 | 4 | use Route4Me\Route4Me; |
| 6 | 5 | use Route4Me\Common; |
| 7 | 6 | use Route4Me\Enum\Endpoint; |
@@ -8,283 +8,283 @@ |
||
| 8 | 8 | |
| 9 | 9 | class Address extends Common |
| 10 | 10 | { |
| 11 | - public $route_destination_id; |
|
| 12 | - public $alias; |
|
| 13 | - public $member_id; |
|
| 14 | - public $address; |
|
| 15 | - public $addressUpdate; |
|
| 16 | - public $is_depot = false; |
|
| 17 | - public $lat; |
|
| 18 | - public $lng; |
|
| 19 | - public $route_id; |
|
| 20 | - public $original_route_id; |
|
| 21 | - public $optimization_problem_id; |
|
| 22 | - public $sequence_no; |
|
| 23 | - public $geocoded; |
|
| 24 | - public $preferred_geocoding; |
|
| 25 | - public $failed_geocoding; |
|
| 26 | - public $geocodings = array(); |
|
| 27 | - public $contact_id; |
|
| 28 | - public $is_visited; |
|
| 29 | - public $customer_po; |
|
| 30 | - public $invoice_no; |
|
| 31 | - public $reference_no; |
|
| 32 | - public $order_no; |
|
| 33 | - public $weight; |
|
| 34 | - public $cost; |
|
| 35 | - public $revenue; |
|
| 36 | - public $cube; |
|
| 37 | - public $pieces; |
|
| 38 | - public $email; |
|
| 39 | - public $phone; |
|
| 40 | - public $tracking_number; |
|
| 41 | - public $destination_note_count; |
|
| 42 | - public $drive_time_to_next_destination; |
|
| 43 | - public $distance_to_next_destination; |
|
| 44 | - public $generated_time_window_start; |
|
| 45 | - public $generated_time_window_end; |
|
| 46 | - public $time_window_start; |
|
| 47 | - public $time_window_end; |
|
| 48 | - public $time; |
|
| 49 | - public $notes; |
|
| 50 | - public $timestamp_last_visited; |
|
| 51 | - public $custom_fields = array(); |
|
| 52 | - public $manifest = array(); |
|
| 11 | + public $route_destination_id; |
|
| 12 | + public $alias; |
|
| 13 | + public $member_id; |
|
| 14 | + public $address; |
|
| 15 | + public $addressUpdate; |
|
| 16 | + public $is_depot = false; |
|
| 17 | + public $lat; |
|
| 18 | + public $lng; |
|
| 19 | + public $route_id; |
|
| 20 | + public $original_route_id; |
|
| 21 | + public $optimization_problem_id; |
|
| 22 | + public $sequence_no; |
|
| 23 | + public $geocoded; |
|
| 24 | + public $preferred_geocoding; |
|
| 25 | + public $failed_geocoding; |
|
| 26 | + public $geocodings = array(); |
|
| 27 | + public $contact_id; |
|
| 28 | + public $is_visited; |
|
| 29 | + public $customer_po; |
|
| 30 | + public $invoice_no; |
|
| 31 | + public $reference_no; |
|
| 32 | + public $order_no; |
|
| 33 | + public $weight; |
|
| 34 | + public $cost; |
|
| 35 | + public $revenue; |
|
| 36 | + public $cube; |
|
| 37 | + public $pieces; |
|
| 38 | + public $email; |
|
| 39 | + public $phone; |
|
| 40 | + public $tracking_number; |
|
| 41 | + public $destination_note_count; |
|
| 42 | + public $drive_time_to_next_destination; |
|
| 43 | + public $distance_to_next_destination; |
|
| 44 | + public $generated_time_window_start; |
|
| 45 | + public $generated_time_window_end; |
|
| 46 | + public $time_window_start; |
|
| 47 | + public $time_window_end; |
|
| 48 | + public $time; |
|
| 49 | + public $notes; |
|
| 50 | + public $timestamp_last_visited; |
|
| 51 | + public $custom_fields = array(); |
|
| 52 | + public $manifest = array(); |
|
| 53 | 53 | |
| 54 | - public $first_name; |
|
| 55 | - public $last_name; |
|
| 56 | - public $is_departed; |
|
| 57 | - public $timestamp_last_departed; |
|
| 58 | - public $order_id; |
|
| 59 | - public $priority; |
|
| 60 | - public $curbside_lat; |
|
| 61 | - public $curbside_lng; |
|
| 62 | - public $time_window_start_2; |
|
| 63 | - public $time_window_end_2; |
|
| 54 | + public $first_name; |
|
| 55 | + public $last_name; |
|
| 56 | + public $is_departed; |
|
| 57 | + public $timestamp_last_departed; |
|
| 58 | + public $order_id; |
|
| 59 | + public $priority; |
|
| 60 | + public $curbside_lat; |
|
| 61 | + public $curbside_lng; |
|
| 62 | + public $time_window_start_2; |
|
| 63 | + public $time_window_end_2; |
|
| 64 | 64 | |
| 65 | - public static function fromArray(array $params) |
|
| 66 | - { |
|
| 67 | - $address = new Address(); |
|
| 68 | - foreach ($params as $key => $value) { |
|
| 69 | - if (property_exists($address, $key)) { |
|
| 70 | - $address->{$key} = $value; |
|
| 71 | - } |
|
| 72 | - } |
|
| 65 | + public static function fromArray(array $params) |
|
| 66 | + { |
|
| 67 | + $address = new Address(); |
|
| 68 | + foreach ($params as $key => $value) { |
|
| 69 | + if (property_exists($address, $key)) { |
|
| 70 | + $address->{$key} = $value; |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - return $address; |
|
| 75 | - } |
|
| 74 | + return $address; |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - public static function getAddress($routeId, $addressId) |
|
| 78 | - { |
|
| 79 | - $address = Route4Me::makeRequst(array( |
|
| 80 | - 'url' => Endpoint::ADDRESS_V4, |
|
| 81 | - 'method' => 'GET', |
|
| 82 | - 'query' => array( |
|
| 83 | - 'route_id' => $routeId, |
|
| 84 | - 'route_destination_id' => $addressId, |
|
| 85 | - ) |
|
| 86 | - )); |
|
| 77 | + public static function getAddress($routeId, $addressId) |
|
| 78 | + { |
|
| 79 | + $address = Route4Me::makeRequst(array( |
|
| 80 | + 'url' => Endpoint::ADDRESS_V4, |
|
| 81 | + 'method' => 'GET', |
|
| 82 | + 'query' => array( |
|
| 83 | + 'route_id' => $routeId, |
|
| 84 | + 'route_destination_id' => $addressId, |
|
| 85 | + ) |
|
| 86 | + )); |
|
| 87 | 87 | |
| 88 | - return Address::fromArray($address); |
|
| 89 | - } |
|
| 88 | + return Address::fromArray($address); |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - /*Get notes from the specified route destination |
|
| 91 | + /*Get notes from the specified route destination |
|
| 92 | 92 | * Returns an address object with notes, if an address exists, otherwise - return null. |
| 93 | 93 | */ |
| 94 | - public static function GetAddressesNotes($noteParams) |
|
| 95 | - { |
|
| 96 | - $address = Route4Me::makeRequst(array( |
|
| 97 | - 'url' => Endpoint::ADDRESS_V4, |
|
| 98 | - 'method' => 'GET', |
|
| 99 | - 'query' => array( |
|
| 100 | - 'route_id' => isset($noteParams['route_id']) ? $noteParams['route_id'] : null, |
|
| 101 | - 'route_destination_id' => isset($noteParams['route_destination_id']) |
|
| 102 | - ? $noteParams['route_destination_id'] : null, |
|
| 103 | - 'notes' => 1, |
|
| 104 | - ) |
|
| 105 | - )); |
|
| 94 | + public static function GetAddressesNotes($noteParams) |
|
| 95 | + { |
|
| 96 | + $address = Route4Me::makeRequst(array( |
|
| 97 | + 'url' => Endpoint::ADDRESS_V4, |
|
| 98 | + 'method' => 'GET', |
|
| 99 | + 'query' => array( |
|
| 100 | + 'route_id' => isset($noteParams['route_id']) ? $noteParams['route_id'] : null, |
|
| 101 | + 'route_destination_id' => isset($noteParams['route_destination_id']) |
|
| 102 | + ? $noteParams['route_destination_id'] : null, |
|
| 103 | + 'notes' => 1, |
|
| 104 | + ) |
|
| 105 | + )); |
|
| 106 | 106 | |
| 107 | - return $address; |
|
| 108 | - } |
|
| 107 | + return $address; |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | - public function update() |
|
| 111 | - { |
|
| 112 | - $addressUpdate = Route4Me::makeRequst(array( |
|
| 113 | - 'url' => Endpoint::ADDRESS_V4, |
|
| 114 | - 'method' => 'PUT', |
|
| 115 | - 'body' => $this->toArray(), |
|
| 116 | - 'query' => array( |
|
| 117 | - 'route_id' => $this->route_id, |
|
| 118 | - 'route_destination_id' => $this->route_destination_id, |
|
| 119 | - ), |
|
| 120 | - )); |
|
| 110 | + public function update() |
|
| 111 | + { |
|
| 112 | + $addressUpdate = Route4Me::makeRequst(array( |
|
| 113 | + 'url' => Endpoint::ADDRESS_V4, |
|
| 114 | + 'method' => 'PUT', |
|
| 115 | + 'body' => $this->toArray(), |
|
| 116 | + 'query' => array( |
|
| 117 | + 'route_id' => $this->route_id, |
|
| 118 | + 'route_destination_id' => $this->route_destination_id, |
|
| 119 | + ), |
|
| 120 | + )); |
|
| 121 | 121 | |
| 122 | - return Address::fromArray($addressUpdate); |
|
| 123 | - } |
|
| 122 | + return Address::fromArray($addressUpdate); |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - public function markAddress($params) |
|
| 126 | - { |
|
| 127 | - $allQueryFields = array('route_id', 'route_destination_id'); |
|
| 128 | - $allBodyFields = array('is_visited', 'is_departed'); |
|
| 125 | + public function markAddress($params) |
|
| 126 | + { |
|
| 127 | + $allQueryFields = array('route_id', 'route_destination_id'); |
|
| 128 | + $allBodyFields = array('is_visited', 'is_departed'); |
|
| 129 | 129 | |
| 130 | - $result = Route4Me::makeRequst(array( |
|
| 131 | - 'url' => Endpoint::ADDRESS_V4, |
|
| 132 | - 'method' => 'PUT', |
|
| 133 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 134 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 135 | - )); |
|
| 130 | + $result = Route4Me::makeRequst(array( |
|
| 131 | + 'url' => Endpoint::ADDRESS_V4, |
|
| 132 | + 'method' => 'PUT', |
|
| 133 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 134 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 135 | + )); |
|
| 136 | 136 | |
| 137 | - return $result; |
|
| 138 | - } |
|
| 137 | + return $result; |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | - public function markAsDeparted($params) |
|
| 141 | - { |
|
| 142 | - $allQueryFields = array('route_id', 'address_id', 'is_departed', 'member_id'); |
|
| 140 | + public function markAsDeparted($params) |
|
| 141 | + { |
|
| 142 | + $allQueryFields = array('route_id', 'address_id', 'is_departed', 'member_id'); |
|
| 143 | 143 | |
| 144 | - $address = Route4Me::makeRequst(array( |
|
| 145 | - 'url' => Endpoint::MARK_ADDRESS_DEPARTED, |
|
| 146 | - 'method' => 'PUT', |
|
| 147 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
| 148 | - )); |
|
| 144 | + $address = Route4Me::makeRequst(array( |
|
| 145 | + 'url' => Endpoint::MARK_ADDRESS_DEPARTED, |
|
| 146 | + 'method' => 'PUT', |
|
| 147 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
| 148 | + )); |
|
| 149 | 149 | |
| 150 | - return $address; |
|
| 151 | - } |
|
| 150 | + return $address; |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | - public function markAsVisited($params) |
|
| 154 | - { |
|
| 155 | - $allQueryFields = array('route_id', 'address_id', 'is_visited', 'member_id'); |
|
| 153 | + public function markAsVisited($params) |
|
| 154 | + { |
|
| 155 | + $allQueryFields = array('route_id', 'address_id', 'is_visited', 'member_id'); |
|
| 156 | 156 | |
| 157 | - $address = Route4Me::makeRequst(array( |
|
| 158 | - 'url' => Endpoint::UPDATE_ADDRESS_VISITED, |
|
| 159 | - 'method' => 'PUT', |
|
| 160 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
| 161 | - )); |
|
| 157 | + $address = Route4Me::makeRequst(array( |
|
| 158 | + 'url' => Endpoint::UPDATE_ADDRESS_VISITED, |
|
| 159 | + 'method' => 'PUT', |
|
| 160 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
| 161 | + )); |
|
| 162 | 162 | |
| 163 | - return $address; |
|
| 164 | - } |
|
| 163 | + return $address; |
|
| 164 | + } |
|
| 165 | 165 | |
| 166 | - public function deleteAddress() |
|
| 167 | - { |
|
| 168 | - $address = Route4Me::makeRequst(array( |
|
| 169 | - 'url' => Endpoint::ADDRESS_V4, |
|
| 170 | - 'method' => 'DELETE', |
|
| 171 | - 'query' => array( |
|
| 172 | - 'route_id' => $this->route_id, |
|
| 173 | - 'route_destination_id' => $this->route_destination_id, |
|
| 174 | - ) |
|
| 175 | - )); |
|
| 166 | + public function deleteAddress() |
|
| 167 | + { |
|
| 168 | + $address = Route4Me::makeRequst(array( |
|
| 169 | + 'url' => Endpoint::ADDRESS_V4, |
|
| 170 | + 'method' => 'DELETE', |
|
| 171 | + 'query' => array( |
|
| 172 | + 'route_id' => $this->route_id, |
|
| 173 | + 'route_destination_id' => $this->route_destination_id, |
|
| 174 | + ) |
|
| 175 | + )); |
|
| 176 | 176 | |
| 177 | - return (bool)$address['deleted']; |
|
| 178 | - } |
|
| 177 | + return (bool)$address['deleted']; |
|
| 178 | + } |
|
| 179 | 179 | |
| 180 | - public function moveDestinationToRoute($params) |
|
| 181 | - { |
|
| 182 | - $allBodyFields = array('to_route_id', 'route_destination_id', 'after_destination_id'); |
|
| 180 | + public function moveDestinationToRoute($params) |
|
| 181 | + { |
|
| 182 | + $allBodyFields = array('to_route_id', 'route_destination_id', 'after_destination_id'); |
|
| 183 | 183 | |
| 184 | - $result = Route4Me::makeRequst(array( |
|
| 185 | - 'url' => Endpoint::MOVE_ROUTE_DESTINATION, |
|
| 186 | - 'method' => 'POST', |
|
| 187 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 188 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
| 189 | - )); |
|
| 184 | + $result = Route4Me::makeRequst(array( |
|
| 185 | + 'url' => Endpoint::MOVE_ROUTE_DESTINATION, |
|
| 186 | + 'method' => 'POST', |
|
| 187 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 188 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
| 189 | + )); |
|
| 190 | 190 | |
| 191 | - return $result; |
|
| 192 | - } |
|
| 191 | + return $result; |
|
| 192 | + } |
|
| 193 | 193 | |
| 194 | - public function AddAddressNote($params) |
|
| 195 | - { |
|
| 196 | - $allQueryFields = array('route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type'); |
|
| 197 | - $allBodyFields = array('strNoteContents', 'strUpdateType'); |
|
| 194 | + public function AddAddressNote($params) |
|
| 195 | + { |
|
| 196 | + $allQueryFields = array('route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type'); |
|
| 197 | + $allBodyFields = array('strNoteContents', 'strUpdateType'); |
|
| 198 | 198 | |
| 199 | - $result = Route4Me::makeRequst(array( |
|
| 200 | - 'url' => Endpoint::ROUTE_NOTES_ADD, |
|
| 201 | - 'method' => 'POST', |
|
| 202 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 203 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 204 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
| 205 | - )); |
|
| 199 | + $result = Route4Me::makeRequst(array( |
|
| 200 | + 'url' => Endpoint::ROUTE_NOTES_ADD, |
|
| 201 | + 'method' => 'POST', |
|
| 202 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 203 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 204 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
| 205 | + )); |
|
| 206 | 206 | |
| 207 | - return $result; |
|
| 208 | - } |
|
| 207 | + return $result; |
|
| 208 | + } |
|
| 209 | 209 | |
| 210 | - public function AddNoteFile($params) |
|
| 211 | - { |
|
| 212 | - $allQueryFields = array('route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type', 'strUpdateType'); |
|
| 213 | - $allBodyFields = array('strFilename'); |
|
| 210 | + public function AddNoteFile($params) |
|
| 211 | + { |
|
| 212 | + $allQueryFields = array('route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type', 'strUpdateType'); |
|
| 213 | + $allBodyFields = array('strFilename'); |
|
| 214 | 214 | |
| 215 | - $result = Route4Me::fileUploadRequest(array( |
|
| 216 | - 'url' => Endpoint::ROUTE_NOTES_ADD, |
|
| 217 | - 'method' => 'POST', |
|
| 218 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 219 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 220 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
| 221 | - )); |
|
| 215 | + $result = Route4Me::fileUploadRequest(array( |
|
| 216 | + 'url' => Endpoint::ROUTE_NOTES_ADD, |
|
| 217 | + 'method' => 'POST', |
|
| 218 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 219 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 220 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
| 221 | + )); |
|
| 222 | 222 | |
| 223 | - return $result; |
|
| 224 | - } |
|
| 223 | + return $result; |
|
| 224 | + } |
|
| 225 | 225 | |
| 226 | - public function createCustomNoteType($params) |
|
| 227 | - { |
|
| 228 | - $allBodyFields = array('type', 'values'); |
|
| 226 | + public function createCustomNoteType($params) |
|
| 227 | + { |
|
| 228 | + $allBodyFields = array('type', 'values'); |
|
| 229 | 229 | |
| 230 | - $result = Route4Me::makeRequst(array( |
|
| 231 | - 'url' => Endpoint::NOTE_CUSTOM_TYPES_V4, |
|
| 232 | - 'method' => 'POST', |
|
| 233 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 234 | - )); |
|
| 230 | + $result = Route4Me::makeRequst(array( |
|
| 231 | + 'url' => Endpoint::NOTE_CUSTOM_TYPES_V4, |
|
| 232 | + 'method' => 'POST', |
|
| 233 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
|
| 234 | + )); |
|
| 235 | 235 | |
| 236 | - return $result; |
|
| 237 | - } |
|
| 236 | + return $result; |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | - public function removeCustomNoteType($params) |
|
| 240 | - { |
|
| 241 | - $result = Route4Me::makeRequst(array( |
|
| 242 | - 'url' => Endpoint::NOTE_CUSTOM_TYPES_V4, |
|
| 243 | - 'method' => 'DELETE', |
|
| 244 | - 'body' => array( |
|
| 245 | - 'id' => isset($params['id']) ? $params['id'] : null |
|
| 246 | - ) |
|
| 247 | - )); |
|
| 239 | + public function removeCustomNoteType($params) |
|
| 240 | + { |
|
| 241 | + $result = Route4Me::makeRequst(array( |
|
| 242 | + 'url' => Endpoint::NOTE_CUSTOM_TYPES_V4, |
|
| 243 | + 'method' => 'DELETE', |
|
| 244 | + 'body' => array( |
|
| 245 | + 'id' => isset($params['id']) ? $params['id'] : null |
|
| 246 | + ) |
|
| 247 | + )); |
|
| 248 | 248 | |
| 249 | - return $result; |
|
| 250 | - } |
|
| 249 | + return $result; |
|
| 250 | + } |
|
| 251 | 251 | |
| 252 | - public function getAllCustomNoteTypes() |
|
| 253 | - { |
|
| 254 | - $result = Route4Me::makeRequst(array( |
|
| 255 | - 'url' => Endpoint::NOTE_CUSTOM_TYPES_V4, |
|
| 256 | - 'method' => 'GET' |
|
| 257 | - )); |
|
| 252 | + public function getAllCustomNoteTypes() |
|
| 253 | + { |
|
| 254 | + $result = Route4Me::makeRequst(array( |
|
| 255 | + 'url' => Endpoint::NOTE_CUSTOM_TYPES_V4, |
|
| 256 | + 'method' => 'GET' |
|
| 257 | + )); |
|
| 258 | 258 | |
| 259 | - return $result; |
|
| 260 | - } |
|
| 259 | + return $result; |
|
| 260 | + } |
|
| 261 | 261 | |
| 262 | - public function addCustomNoteToRoute($params) |
|
| 263 | - { |
|
| 264 | - $customArray = array(); |
|
| 262 | + public function addCustomNoteToRoute($params) |
|
| 263 | + { |
|
| 264 | + $customArray = array(); |
|
| 265 | 265 | |
| 266 | - foreach ($params as $key => $value) { |
|
| 267 | - if (strpos($key, "custom_note_type")!==false) { |
|
| 268 | - $customArray[$key] = $value; |
|
| 269 | - } |
|
| 270 | - } |
|
| 266 | + foreach ($params as $key => $value) { |
|
| 267 | + if (strpos($key, "custom_note_type")!==false) { |
|
| 268 | + $customArray[$key] = $value; |
|
| 269 | + } |
|
| 270 | + } |
|
| 271 | 271 | |
| 272 | - $allQueryFields = array('route_id', 'address_id', 'format', 'dev_lat', 'dev_lng'); |
|
| 273 | - $allBodyFields = array('strUpdateType', 'strUpdateType', 'strNoteContents'); |
|
| 272 | + $allQueryFields = array('route_id', 'address_id', 'format', 'dev_lat', 'dev_lng'); |
|
| 273 | + $allBodyFields = array('strUpdateType', 'strUpdateType', 'strNoteContents'); |
|
| 274 | 274 | |
| 275 | - $result = Route4Me::makeRequst(array( |
|
| 276 | - 'url' => Endpoint::ROUTE_NOTES_ADD, |
|
| 277 | - 'method' => 'POST', |
|
| 278 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 279 | - 'body' => array_merge(Route4Me::generateRequestParameters($allBodyFields, $params), $customArray), |
|
| 280 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
| 281 | - )); |
|
| 275 | + $result = Route4Me::makeRequst(array( |
|
| 276 | + 'url' => Endpoint::ROUTE_NOTES_ADD, |
|
| 277 | + 'method' => 'POST', |
|
| 278 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 279 | + 'body' => array_merge(Route4Me::generateRequestParameters($allBodyFields, $params), $customArray), |
|
| 280 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
| 281 | + )); |
|
| 282 | 282 | |
| 283 | - return $result; |
|
| 284 | - } |
|
| 283 | + return $result; |
|
| 284 | + } |
|
| 285 | 285 | |
| 286 | - function getAddressId() |
|
| 287 | - { |
|
| 288 | - return $this->route_destination_id; |
|
| 289 | - } |
|
| 286 | + function getAddressId() |
|
| 287 | + { |
|
| 288 | + return $this->route_destination_id; |
|
| 289 | + } |
|
| 290 | 290 | } |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | Route4Me::setApiKey('11111111111111111111111111111111'); |
| 15 | 15 | |
| 16 | 16 | $activityParameters = ActivityParameters::fromArray(array( |
| 17 | - "limit" => 10, |
|
| 18 | - "offset" => 0 |
|
| 17 | + "limit" => 10, |
|
| 18 | + "offset" => 0 |
|
| 19 | 19 | )); |
| 20 | 20 | |
| 21 | 21 | $activities = new ActivityParameters(); |
@@ -23,6 +23,6 @@ discard block |
||
| 23 | 23 | $results = $activities->getValue($actresults, "results"); |
| 24 | 24 | |
| 25 | 25 | foreach ($results as $result) { |
| 26 | - Route4Me::simplePrint($result); |
|
| 27 | - echo "<br>"; |
|
| 26 | + Route4Me::simplePrint($result); |
|
| 27 | + echo "<br>"; |
|
| 28 | 28 | } |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -$root = realpath(dirname(__FILE__) . '/../../'); |
|
| 4 | +$root = realpath(dirname(__FILE__).'/../../'); |
|
| 5 | 5 | require $root.'/vendor/autoload.php'; |
| 6 | 6 | |
| 7 | 7 | use Route4Me\Route4Me; |
@@ -16,9 +16,9 @@ discard block |
||
| 16 | 16 | Route4Me::setApiKey('11111111111111111111111111111111'); |
| 17 | 17 | |
| 18 | 18 | $activityParameters = ActivityParameters::fromArray(array( |
| 19 | - "limit" => 10, |
|
| 20 | - "offset" => 0, |
|
| 21 | - "start" => strtotime("-1 week") |
|
| 19 | + "limit" => 10, |
|
| 20 | + "offset" => 0, |
|
| 21 | + "start" => strtotime("-1 week") |
|
| 22 | 22 | )); |
| 23 | 23 | |
| 24 | 24 | $activities = new ActivityParameters(); |
@@ -26,6 +26,6 @@ discard block |
||
| 26 | 26 | $results = $activities->getValue($actresults, "results"); |
| 27 | 27 | |
| 28 | 28 | foreach ($results as $result) { |
| 29 | - Route4Me::simplePrint($result); |
|
| 30 | - echo "<br>"; |
|
| 29 | + Route4Me::simplePrint($result); |
|
| 30 | + echo "<br>"; |
|
| 31 | 31 | } |
@@ -1,8 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -$root = realpath(dirname(__FILE__) . '/../../'); |
|
| 5 | -require $root . '/vendor/autoload.php'; |
|
| 4 | +$root = realpath(dirname(__FILE__).'/../../'); |
|
| 5 | +require $root.'/vendor/autoload.php'; |
|
| 6 | 6 | |
| 7 | 7 | use Route4Me\Route4Me; |
| 8 | 8 | use Route4Me\Route; |
@@ -1,8 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -$root = realpath(dirname(__FILE__) . '/../../'); |
|
| 5 | -require $root . '/vendor/autoload.php'; |
|
| 4 | +$root = realpath(dirname(__FILE__).'/../../'); |
|
| 5 | +require $root.'/vendor/autoload.php'; |
|
| 6 | 6 | |
| 7 | 7 | use Route4Me\Route4Me; |
| 8 | 8 | use Route4Me\Route; |
@@ -44,21 +44,21 @@ discard block |
||
| 44 | 44 | $locationsFieldsMapping['monthly_nth_wwhat'] = 17; |
| 45 | 45 | |
| 46 | 46 | if (($handle = fopen("$source_file", "r"))!==FALSE) { |
| 47 | - $oAbook = new AddressBookLocation(); |
|
| 47 | + $oAbook = new AddressBookLocation(); |
|
| 48 | 48 | |
| 49 | - $results = $oAbook->addLocationsFromCsvFile($handle, $locationsFieldsMapping); |
|
| 49 | + $results = $oAbook->addLocationsFromCsvFile($handle, $locationsFieldsMapping); |
|
| 50 | 50 | |
| 51 | - echo "Errors: <br><br>"; |
|
| 51 | + echo "Errors: <br><br>"; |
|
| 52 | 52 | |
| 53 | - foreach ($results['fail'] as $evalue) { |
|
| 54 | - echo $evalue."<br>"; |
|
| 55 | - } |
|
| 53 | + foreach ($results['fail'] as $evalue) { |
|
| 54 | + echo $evalue."<br>"; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - echo "Successes: <br><br>"; |
|
| 57 | + echo "Successes: <br><br>"; |
|
| 58 | 58 | |
| 59 | - foreach ($results['success'] as $svalue) { |
|
| 60 | - echo $svalue."<br>"; |
|
| 61 | - } |
|
| 59 | + foreach ($results['success'] as $svalue) { |
|
| 60 | + echo $svalue."<br>"; |
|
| 61 | + } |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /* Add orders with schedules from a CSV file */ |
@@ -78,20 +78,20 @@ discard block |
||
| 78 | 78 | $ordersFieldsMapping['day_scheduled_for_YYMMDD'] = 8; |
| 79 | 79 | |
| 80 | 80 | if (($handle = fopen("$orders_file", "r"))!==FALSE) { |
| 81 | - $order = new Order(); |
|
| 82 | - $results = $order->addOrdersFromCsvFile($handle, $ordersFieldsMapping); |
|
| 81 | + $order = new Order(); |
|
| 82 | + $results = $order->addOrdersFromCsvFile($handle, $ordersFieldsMapping); |
|
| 83 | 83 | |
| 84 | - echo "Errors: <br><br>"; |
|
| 84 | + echo "Errors: <br><br>"; |
|
| 85 | 85 | |
| 86 | - foreach ($results['fail'] as $evalue) { |
|
| 87 | - echo $evalue."<br>"; |
|
| 88 | - } |
|
| 86 | + foreach ($results['fail'] as $evalue) { |
|
| 87 | + echo $evalue."<br>"; |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - echo "Successes: <br><br>"; |
|
| 90 | + echo "Successes: <br><br>"; |
|
| 91 | 91 | |
| 92 | - foreach ($results['success'] as $svalue) { |
|
| 93 | - echo $svalue."<br>"; |
|
| 94 | - } |
|
| 92 | + foreach ($results['success'] as $svalue) { |
|
| 93 | + echo $svalue."<br>"; |
|
| 94 | + } |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /* Get Hybrid Optimization */ |
@@ -100,63 +100,63 @@ discard block |
||
| 100 | 100 | $sched_date = date("Y-m-d", $ep); |
| 101 | 101 | |
| 102 | 102 | $hybridParams = array( |
| 103 | - "target_date_string" => $sched_date, |
|
| 104 | - "timezone_offset_minutes" => 480 |
|
| 103 | + "target_date_string" => $sched_date, |
|
| 104 | + "timezone_offset_minutes" => 480 |
|
| 105 | 105 | ); |
| 106 | 106 | |
| 107 | 107 | $optimization = new OptimizationProblem(); |
| 108 | 108 | $hybridOptimization = $optimization->getHybridOptimization($hybridParams); |
| 109 | 109 | |
| 110 | 110 | if ($hybridOptimization!=null) { |
| 111 | - if (isset($hybridOptimization['optimization_problem_id'])) { |
|
| 112 | - $optid = $hybridOptimization['optimization_problem_id']; |
|
| 111 | + if (isset($hybridOptimization['optimization_problem_id'])) { |
|
| 112 | + $optid = $hybridOptimization['optimization_problem_id']; |
|
| 113 | 113 | |
| 114 | - echo "Hibrid optimization with optimization_problem_id = $optid <br><br>"; |
|
| 114 | + echo "Hibrid optimization with optimization_problem_id = $optid <br><br>"; |
|
| 115 | 115 | |
| 116 | - /* Add depots to the Hybrid Optimization */ |
|
| 117 | - $depotfile = "depots.csv"; |
|
| 116 | + /* Add depots to the Hybrid Optimization */ |
|
| 117 | + $depotfile = "depots.csv"; |
|
| 118 | 118 | |
| 119 | - if (($handle = fopen("$depotfile", "r"))!==FALSE) { |
|
| 120 | - $columns = fgetcsv($handle, $max_line_length, $delemietr); |
|
| 119 | + if (($handle = fopen("$depotfile", "r"))!==FALSE) { |
|
| 120 | + $columns = fgetcsv($handle, $max_line_length, $delemietr); |
|
| 121 | 121 | |
| 122 | - if (empty($columns)) { |
|
| 123 | - $error['message'] = 'Empty'; |
|
| 124 | - return ($error); |
|
| 125 | - } |
|
| 122 | + if (empty($columns)) { |
|
| 123 | + $error['message'] = 'Empty'; |
|
| 124 | + return ($error); |
|
| 125 | + } |
|
| 126 | 126 | |
| 127 | - $depotsParams = array( |
|
| 128 | - 'optimization_problem_id' => $optid, |
|
| 129 | - 'delete_old_depots' => true, |
|
| 130 | - ); |
|
| 127 | + $depotsParams = array( |
|
| 128 | + 'optimization_problem_id' => $optid, |
|
| 129 | + 'delete_old_depots' => true, |
|
| 130 | + ); |
|
| 131 | 131 | |
| 132 | - $iRow = 1; |
|
| 133 | - $depotAddresses = array(); |
|
| 132 | + $iRow = 1; |
|
| 133 | + $depotAddresses = array(); |
|
| 134 | 134 | |
| 135 | - while (($rows = fgetcsv($handle, $max_line_length, $delemietr))!==false) { |
|
| 136 | - if ($rows[0] && $rows[1] && $rows[3] && array(null)!==$rows) { |
|
| 137 | - $depotAddress['lat'] = $rows[0]; |
|
| 138 | - $depotAddress['lng'] = $rows[1]; |
|
| 139 | - $depotAddress['address'] = $rows[3]; |
|
| 140 | - array_push($depotAddresses, $depotAddress); |
|
| 141 | - } |
|
| 142 | - } |
|
| 135 | + while (($rows = fgetcsv($handle, $max_line_length, $delemietr))!==false) { |
|
| 136 | + if ($rows[0] && $rows[1] && $rows[3] && array(null)!==$rows) { |
|
| 137 | + $depotAddress['lat'] = $rows[0]; |
|
| 138 | + $depotAddress['lng'] = $rows[1]; |
|
| 139 | + $depotAddress['address'] = $rows[3]; |
|
| 140 | + array_push($depotAddresses, $depotAddress); |
|
| 141 | + } |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | - $depotsParams['new_depots'] = $depotAddresses; |
|
| 144 | + $depotsParams['new_depots'] = $depotAddresses; |
|
| 145 | 145 | |
| 146 | - $optProblem = new OptimizationProblem(); |
|
| 146 | + $optProblem = new OptimizationProblem(); |
|
| 147 | 147 | |
| 148 | - $resultDepots = $optProblem->addDepotsToHybrid($depotsParams); |
|
| 148 | + $resultDepots = $optProblem->addDepotsToHybrid($depotsParams); |
|
| 149 | 149 | |
| 150 | - /* Reoptimize hybrid optimization */ |
|
| 150 | + /* Reoptimize hybrid optimization */ |
|
| 151 | 151 | |
| 152 | - if ($resultDepots!=null) { |
|
| 153 | - $problemParams = array( |
|
| 154 | - 'optimization_problem_id' => $optid |
|
| 155 | - ); |
|
| 156 | - $problem = OptimizationProblem::reoptimize($problemParams); |
|
| 152 | + if ($resultDepots!=null) { |
|
| 153 | + $problemParams = array( |
|
| 154 | + 'optimization_problem_id' => $optid |
|
| 155 | + ); |
|
| 156 | + $problem = OptimizationProblem::reoptimize($problemParams); |
|
| 157 | 157 | |
| 158 | - Route4Me::simplePrint($problem); |
|
| 159 | - } |
|
| 160 | - } |
|
| 161 | - } |
|
| 158 | + Route4Me::simplePrint($problem); |
|
| 159 | + } |
|
| 160 | + } |
|
| 161 | + } |
|
| 162 | 162 | } |
@@ -96,7 +96,7 @@ |
||
| 96 | 96 | |
| 97 | 97 | /* Get Hybrid Optimization */ |
| 98 | 98 | |
| 99 | -$ep = time()+604800; |
|
| 99 | +$ep = time() + 604800; |
|
| 100 | 100 | $sched_date = date("Y-m-d", $ep); |
| 101 | 101 | |
| 102 | 102 | $hybridParams = array( |
@@ -16,14 +16,14 @@ |
||
| 16 | 16 | |
| 17 | 17 | $territoryParams['type'] = TerritoryTypes::CIRCLE; |
| 18 | 18 | $territoryParams['data'] = array( |
| 19 | - "37.569752822786455,-77.47833251953125", |
|
| 20 | - "5000" |
|
| 19 | + "37.569752822786455,-77.47833251953125", |
|
| 20 | + "5000" |
|
| 21 | 21 | ); |
| 22 | 22 | |
| 23 | 23 | $AvoidanceZoneParameters = AvoidanceZone::fromArray(array( |
| 24 | - "territory_name" => "Test Circle Avoidance Zone ".strval(rand(10000,99999)), |
|
| 25 | - "territory_color" => "ff7700", |
|
| 26 | - "territory" => $territoryParams |
|
| 24 | + "territory_name" => "Test Circle Avoidance Zone ".strval(rand(10000,99999)), |
|
| 25 | + "territory_color" => "ff7700", |
|
| 26 | + "territory" => $territoryParams |
|
| 27 | 27 | )); |
| 28 | 28 | |
| 29 | 29 | $avoidancezone = new AvoidanceZone(); |
@@ -1,8 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -$root = realpath(dirname(__FILE__) . '/../../'); |
|
| 5 | -require $root . '/vendor/autoload.php'; |
|
| 4 | +$root = realpath(dirname(__FILE__).'/../../'); |
|
| 5 | +require $root.'/vendor/autoload.php'; |
|
| 6 | 6 | |
| 7 | 7 | use Route4Me\Route4Me; |
| 8 | 8 | use Route4Me\Enum\TerritoryTypes; |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | ); |
| 22 | 22 | |
| 23 | 23 | $AvoidanceZoneParameters = AvoidanceZone::fromArray(array( |
| 24 | - "territory_name" => "Test Circle Avoidance Zone ".strval(rand(10000,99999)), |
|
| 24 | + "territory_name" => "Test Circle Avoidance Zone ".strval(rand(10000, 99999)), |
|
| 25 | 25 | "territory_color" => "ff7700", |
| 26 | 26 | "territory" => $territoryParams |
| 27 | 27 | )); |