public function picList($data) { $data = $data->toArray(); if ($data['logistic_type'] == 'internal') { $pics = Uploaded::where('parent_id', '=', $data['delivery_id'])->get(); } else { $maxdate = Threeplpictures::where('awb', '=', $data['awb'])->max('ts'); $pics = Threeplpictures::where('awb', '=', $data['awb'])->where('ts', '=', $maxdate)->get(); } $glinks = ''; $thumbnail_url = ''; if ($pics) { if (count($pics) > 0) { foreach ($pics as $g) { if ($data['logistic_type'] == 'internal') { $thumbnail_url = $g->thumbnail_url; $glinks .= '<input type="hidden" class="g_' . $data['_id'] . '" data-caption="' . $g->name . '" value="' . $g->full_url . '" />'; } else { $thumbnail_url = $g->thumbnail; $glinks .= '<input type="hidden" class="g_' . $data['_id'] . '" data-caption="' . $g->consignee_olshop_cust . '" value="' . $g->pictures . '" />'; } } $display = HTML::image($thumbnail_url . '?' . time(), $thumbnail_url, array('class' => 'thumbnail img-polaroid', 'style' => 'cursor:pointer;', 'id' => $data['_id'])) . $glinks; return $display; } else { return 'No Picture'; } } else { return 'No Picture'; } }
private function saveStatus($log, $logistic_name, $logistic_cust_code) { if (is_array($log) && count($log) > 0) { foreach ($log as $l) { $l->ts = new MongoDate(strtotime($l->timestamp)); $l->consignee_logistic_id = $logistic_name; $l->consignee_olshop_cust = $logistic_cust_code; $al = array(); foreach ($l as $k => $vl) { $al[$k] = $vl; } Threeplstatuses::insert($al); foreach ($l->pod as $p) { $p->ts = new MongoDate(strtotime($l->timestamp)); $p->consignee_logistic_id = $logistic_name; $p->consignee_olshop_cust = $logistic_cust_code; $p->awb = $l->awb; $pl = array(); foreach ($p as $pk => $pv) { $pl[$pk] = $pv; } Threeplpictures::insert($pl); } } } }