Código PHP:
Ver original/*
*Enviar correo
*/
function send()
{
$this->form_validation->set_rules('name', 'Nombre y Apellido', 'required|trim|max_length[100]');
$this->form_validation->set_rules('email', 'Correo', 'required|trim|valid_email|max_length[100]');
$this->form_validation->set_rules('phone', 'Teléfono', 'trim|max_length[30]');
$this->form_validation->set_rules('cell', 'Celular', 'trim|max_length[30]');
$this->form_validation->set_rules('company', 'Empresa/Organización', 'trim|max_length[100]');
$this->form_validation->set_rules('message', 'Mensaje', 'required|trim|max_length[455]');
$statusJson = 'error';
$msgJson = 'Por favor intenta de mas tarde';
if ($this->form_validation->run() === TRUE)
{
$post = (object) $this->input->post(null);
$email = $this->db->where('id', $post->id_email_area)->get('contact_us_emails_area')->row();
// si el correo viene separado por ,
{
$email = $email->email;
if (strpos($email,',') !== false) {
}
}
$email = $this->db->get('contact_us')->row()->email;
//echo $email;
'name' => $post->name,
'email' => $post->email,
'phone' => $post->phone,
'cell' => $post->cell,
'company' => $post->company,
'city' => $post->city,
'message' => $post->message,
'cotizacion' => $post->cotizacion,
'date' => date('Y-m-d H:i:s'), 'lang' => $this->lang_code
);
//Validate sendmail
if( $this->contact_us_emails_m->insert($data['post']))
{
// si estan separados por , mandamos los correos si no mandamos 1 solo
{
foreach($emails AS $row => $value)
{
$this->send_email_to_user($data['post'], $value);
}
}
else
{
$this->send_email_to_user($data['post'], $email);
}
$statusJson = '';
$msgJson = 'Su mensaje ha sido enviado';
}
else
{
$statusJson = 'error';
$msgJson = 'Error Mailing, Contact the Webmaster';
}
} else
{
$statusJson = 'error';
$msgJson = validation_errors();
}
}
public function detail($slug) {
$return = $this->google_map_model->get_many_by('slug', $slug);
$return = $return[0];
if (!$return)
redirect('google_maps');
// Se convierten algunas variables necesarias para usar como slugs
'image' => val_image($return->image),
);
$relation = $this->db->where('google_map_id', $google_map['id'])->get('google_maps_categories')->result();
foreach ($relation as $item) {
$category = $this->google_map_category_model->get_many_by('id', $item->category_id);
$category = $category[0];
"title" => $category->title,
"slug" => $category->slug
);
}
// imagenes para slider
$images = $this->google_map_image_model->get_many_by('google_map_id', $google_map['id']);
// datos para el mapa de google
// mandamos los puntos
$json_markers = json_encode(array(array($google_map['adress'] . ', Prueba-Cali', (double
) $google_map['coordinate1'], (double
) $google_map['coordinate2'])));
// sacamos solo el nombre de la imagen
$imageTogoogle = str_replace(site_url
() . 'uploads/default/' . $this->moduleName . '/', "", $google_map['image']);
// mandamos los datos para el modal dentro del mapa
$json_info_content = json_encode(array(array('image' => $imageTogoogle, 'adress' => $google_map['adress'], 'title' => $google_map['name'], 'moduleName' => $this->moduleName, 'schedule' => $google_map['schedule'], 'description' => $google_map['description'])));
$this->template
->append_js('module::google_maps.js')
->set('json_info_content', $json_info_content)
->set('json_markers', $json_markers)
->set('google_map', (object) $google_map)
->set('categories', $categories)
->set('images', $images)
->build('detail');
}
public function multiple_poins() {
$json_info_content = array(); $statusJson = 'error';
$msgJson = 'Ocurrio un error al cargar los datos de google, porfavor intente más tarde';
if (isset($_POST['idcategory'])) { $idCategory = $_POST['idcategory'];
$google_map = $this->db
->select('*')
->from('google_maps AS gm')
->join('google_maps_categories AS gc', 'gc.google_map_id = gm.id', 'left') ->where('gc.category_id', $idCategory)
//->limit($pagination['limit'], $pagination['offset'])
->get()->result();
if (!empty($google_map)) { foreach ($google_map AS $item) {
$item->image = val_image($item->image);
array_push($json_markers, array($item->adress . ', ' . $item->name, (double
) $item->coordinate1, (double
) $item->coordinate2));
$imageTogoogle = str_replace(site_url
() . 'uploads/default/' . $this->moduleName . '/', "", $item->image);
array_push($json_info_content, array('image' => $imageTogoogle, 'adress' => $item->adress, 'title' => $item->name, 'moduleName' => $this->moduleName, 'schedule' => $item->schedule, 'description' => $item->description)); }
}
$statusJson = '';
$msgJson = 'datos de google cargados correctamente';
}
// mandamos los puntos
// mandamos los datos para el modal dentro del mapa
echo json_encode(array('status' => $statusJson, 'msg' => $msgJson, 'json_markers' => $json_markers, 'json_info_content' => $json_info_content)); }
/**
* Send an email
*
* @param array $comment The comment data.
* @param array $entry The entry data.
* @return boolean
*/
private function send_email_to_user($data, $admin_email) {
$this->load->library('email');
$this->load->library('user_agent');
return Events
::trigger('email', array( 'name' => $data['name'],
'email' => $data['email'],
'phone' => $data['phone'],
'company' => $data['company'],
'city' => $data['city'],
'products' => $products,
'message' => $data['message'],
'cotizacion' => $data['cotizacion'],
'slug' => 'contact',
'to' => Settings::get('contact_email'),
), 'array');
}
}