public function embed($guid = "") { $pass = false; if (strlen($guid) > 64) { $pass = substr($guid, -32); $guid2 = $guid; $guid = str_replace($pass, '', $guid); if (strcmp($pass, md5('idaciti')) == 0) { $pass = true; } else { $pass = false; } } $this->load->model('explore_model'); $id = guid_to_id($guid2); $current = '/card/view/' . $id; $data['is_embed'] = true; if ($id) { $this_card = $this->cards->get_by_id($id); } $data['periods'] = $this->periods; if (!empty($this_card) && ($this_card->public == 1 || $pass)) { $data['title'] = 'Idaciti - ' . $this_card->name; $data['obj'] = $this_card; $data['op'] = "view_"; $data['current'] = $current; $data['is_internal'] = $pass; $list_companies = $this->cards->get_companies($id); $data['list_companies'] = $list_companies; $list_kpis = $this->cards->get_kpis($id); $data['list_kpis'] = $list_kpis; $companies = array(); foreach ($list_companies as $c) { $companies[] = sprintf("%06d", $c->entity_id); } $kpis = array(); foreach ($list_kpis as $c) { $kpis[] = sprintf("%06d", $c->term_id); } if (empty($kpis[0])) { $kpis[0] = ''; } $sort = !empty($this_card->kpi) ? $this_card->kpi : $kpis[0]; $order = strtoupper(!empty($this_card->order) ? $this_card->order : "DESC"); $sort_ascending = $order == "ASC" ? true : false; $period = !empty($this_card->period) ? array($this_card->period) : array("2013"); $data['kpis'] = $kpis; $data['sort'] = $sort; $data['sort_ascending'] = $sort_ascending; $data['period'] = $period; $resut = $this->explore_model->get_companies($companies, $kpis, $period, $sort, $order); if ($resut == "API_ERROR") { $data['API_ERROR'] = "API_ERROR"; } else { $data['get_companies'] = $resut['result']; $data['get_companies_error'] = $resut['error']; $resut2 = $this->explore_model->get_markers($companies, $kpis, $period, $sort); $data['get_markers'] = $resut2['result']; $data['get_markers_error'] = $resut2['error']; $card_author = $this->users->get_by_id($data['obj']->user); $data['obj']->author = $card_author->first_name . " " . $card_author->last_name; if ($this_card->user != $this->user_id()) { $this->load->model('view_cards_model', 'view_cards'); $viewed = array("card" => $id, "user" => $this->user_id()); $this->view_cards->save($viewed); } } $data['view'] = true; $this->load->view('general/header', $data); $this->load->view('card/embed', $data); $this->load->view('general/footer'); } }
public function embed($guid = "") { $id = guid_to_id($guid); $current = '/storyboard/view/' . $id; if ($id) { $this_sb = $this->storyboards->get_by_id($id); } if (!empty($this_sb) && $this_sb->public == 1) { $title = 'Idaciti - ' . $this_sb->title; $data = array(); $data = $this->load_slides_for_view_and_embed($id, $this_sb, $data, $title, ''); $data['is_embed'] = true; $user = $this->session->userdata('user'); $data['current'] = $current; $data['user'] = $user; $data['avatar'] = $this->users->get_avatar($user); $this->load->view('general/header', $data); $this->load->view('storyboard/embed', $data); $this->load->view('general/footer'); } }