public function __visitor_count_month($date) { $start_date; $start = date('Y-m-d H:i', strtotime($date['year'] . "-" . $date['month'] . "-01 00:00")); $final_date = $this->_plus_month($date); $end = date('Y-m-d H:i', strtotime($final_date['year'] . "-" . $final_date['month'] . "-01 00:00")); $html = ""; $html .= "<p>total visits: " . stats::get_visitor_count($start, $end) . "</p>"; $html .= "<p>unique visitors: " . stats::get_visitor_count($start, $end, true) . "</p>"; $views = array(); $unique = array(); foreach (date::days($date['month'], $date['year']) as $day) { $start = date('Y-m-d H:i', strtotime($date['year'] . "-" . $date['month'] . "-" . $day . " 00:00")); $end_day = $day + 1; if (count(date::days($date['month'], $date['year'])) < $end_day) { $end = date('Y-m-d H:i', strtotime($final_date['year'] . "-" . $final_date['month'] . "-01 00:00")); } else { $end = date('Y-m-d H:i', strtotime($date['year'] . "-" . $date['month'] . "-" . ($day + 1) . " 00:00")); } $count = stats::get_visitor_count($start, $end); $views[$day] = $count; $count = stats::get_visitor_count($start, $end, true); $unique[$day] = $count; } $chart = new GoogChart(); $dataMultiple = array("Page views" => $views, "Unique visitors" => $unique); $min = 0; $max = 10; // chxr='y',$min,$max,(($max-$min)/10); /* # Chart 2 # */ $chart->setChartAttrs(array('type' => 'line', 'title' => 'Visits for ' . date('F Y', strtotime($start)), 'data' => $dataMultiple, 'size' => array(750, 200), 'labelsXY' => true, 'color' => array('#27aae1', '#e127aa'))); // Print chart $html .= $chart; return $html; }
public function confirm() { if (@$_SESSION['conf']['order']['district_name'] == '' and @$_SESSION['conf']['order']['district_price'] == '') { $this->redirect($this->__("cart")); } if ($this->ispost()) { $this->redirect($this->__("cart") . '/' . $this->__("request")); } $errormsg = ''; //$this->confirm_validation(); $orderfpp = new fpp_order_Model(); $this->refresh_prices_product(); $yr = date("Y"); $this->refresh_prices_shipping(); $cart_content = $_SESSION['conf']['cart']; $total = $_SESSION['conf']['cart']['subtotal_noformat'] + $_SESSION['conf']['order']['district_price']; Basic::currency($total); $payment = new Paymentclass(); $paymentinfo = $payment->infomod(@$_SESSION['conf']['order']['payment_type']); $href_shipping = $this->href($this->__("cart") . '/' . $this->__("shipping")); $this->title = __('Datos de Envio', false); $client = new fpp_client_Model(); $client = $client->db2cls((int) @$_SESSION['conf']['client']['id']); $country = new fpp_country_Model(); $country = $country->db2cls($client->country_client); $this->content = View::factory("main/confirm")->set("country", $country)->set("client", $client)->set("href_shipping", $href_shipping)->set("cart_content", $cart_content)->set("order", @$_SESSION['conf']['order'])->set("errormsg", $errormsg)->set("paymentinfo", $paymentinfo)->set("payment_type", $_SESSION['conf']['order']['payment_type'])->set("comments", @$_SESSION['conf']['order']['comments'])->set("total", $total)->set("select_turn", $orderfpp->turn)->set("select_day", date::days(1))->set("select_month", $this->__months())->set("select_year", date::years($yr, $yr + 2))->render(); }
/** * Creates a group of dropdown boxes for date selection * * @param string comma seperated list of parts to be included * @param string form element name prefix example: user_ * @param array variables to be used within the function * @return string html for specified elements */ public static function date_dropdown($parts = 'month,day,year,time', $prefix = '', $other = array(), $selected = array()) { if (!is_array($parts)) { $parts = explode(',', $parts); } // Blank HTML string. $html = ''; foreach ($parts as $part) { switch ($part) { case 'month': if (!isset($selected['month'])) { $selected['month'] = date('n'); } $html .= form::dropdown($prefix . 'month', date::months(), $selected['month']); break; case 'day': if (!isset($selected['month'])) { $selected['day'] = date('j'); } $html .= form::dropdown($prefix . 'day', date::days(date('n')), $selected['day']); break; case 'year': if (!isset($selected['year'])) { $selected['year'] = date('Y'); } if (!isset($other['year']['start'])) { $other['year']['start'] = false; } if (!isset($other['year']['end'])) { $other['year']['end'] = false; } $html .= form::dropdown($prefix . 'year', date::years($other['year']['start'], $other['year']['end']), $selected['year']); break; case 'time': if (!isset($selected['hour'])) { $selected['hour'] = date('g'); } $html .= form::dropdown($prefix . 'hour', date::hours(), $selected['hour']); if (!isset($selected['min'])) { $selected['min'] = date('i'); } $html .= form::dropdown($prefix . 'min', date::minutes(1), $selected['min']); if (!isset($selected['ampm'])) { $selected['ampm'] = date('a'); } $html .= form::dropdown($prefix . 'ampm', array('am' => 'am', 'pm' => 'pm'), $selected['ampm']); } } return $html; }
public function register() { $config_store_name = $this->config_store_name; $mail_store = $this->mail_store; $href_store = $this->href_store; $address_store = $this->address_store; $logged = $this->_islogged(); if ($this->ispost()) { if ($this->_validate() == true) { if ($logged == false) { $view = View::factory("extras/confirm_mail")->set("client_name", $_POST['fname'] . ' ' . $_POST['lname'])->set("store_name", $config_store_name)->set("mail_store", $mail_store)->set("href_store", $href_store)->set("address_store", $address_store)->set("password", $_POST['password'])->set("user", $_POST['mail'])->render(); basics::mail_html_utf8($_POST['mail'], __("Bienvenido Estimado Cliente", false), $view, $mail_store, $config_store_name); } // Save in DB $id = $logged ? $this->id_client : null; $orm = $this->table->db2cls($id); if ($this->information_print == true) { $data['mail_client'] = @$_POST['mail']; $data['fname_client'] = @$_POST['fname']; $data['lname_client'] = @$_POST['lname']; $data['country_client'] = @$_POST['select_country']; $data['district_client'] = @$_POST['district']; $data['address_client'] = @$_POST['address']; $data['gender_client'] = @$_POST['gender']; $data['birthdate_cliente'] = @$_POST['select_year'] . '-' . @$_POST['select_month'] . '-' . @$_POST['datebirth_day']; $data['company_client'] = @$_POST['company']; $data['ruc_client'] = @$_POST['ruc']; $data['company_address'] = @$_POST['company_address']; $data['departament_client'] = @$_POST['departament']; $data['province_client'] = @$_POST['province']; $data['postalcode_client'] = @$_POST['postalcode']; $data['phone_client'] = @$_POST['phone']; $data['fax_client'] = @$_POST['fax']; $data['dni_client'] = @$_POST['dni']; } if ($this->password_print == true) { $data['password_client'] = fpp::cryptme($_POST['password']); } $orm->set_fields($data); $orm->save(); $this->html_error = basics::divmessage(array(__("Datos Guardados correctamente", false))); if ($logged == false) { $this->_login($orm->mail_client, $orm->password_client); $this->process_continue(); $view = View::factory("main/register_ok")->render(); $this->content = $view; return true; } } } $select_month = array('1' => 'Enero', '2' => 'Febrero', '3' => 'Marzo', '4' => 'Abril', '5' => 'Mayo', '6' => 'Junio', '7' => 'Julio', '8' => 'Agosto', '9' => 'Septiembre', '10' => 'Octubre', '11' => 'Noviembre', '12' => 'Diciembre'); $form = $this->GetHrefClientRegister(); if ($this->password_print == false) { $form = $this->_url('client', 'change_info'); } if ($this->information_print == false) { $form = $this->_url('client', 'change_password'); } $view = View::factory("main/register")->set("form_register", form::open($form))->set("error_message", $this->html_error)->set("select_day", form::dropdown("datebirth_day", date::days(1), @$_POST['datebirth_day']))->set("select_month", form::dropdown("select_month", $select_month, @$_POST['select_month']))->set("select_year", form::dropdown("select_year", date::years(1940, date("Y")), @$_POST['select_year']))->set("select_country", basics::countryselect("select_country", @$_POST['select_country']))->set("password_print", $this->password_print)->set("information_print", $this->information_print)->set("logged", $logged)->set("title", "Registro de Cliente")->render(); $this->title = __('Registro', false); $this->content = $view; }