Example #1
0
function human_gmt_to_human_local($human_gmt, $time_zone = NULL)
{
    if (!$time_zone) {
        $time_zone = 'UTC';
    }
    return date('Y-m-d H:i:s', gmt_to_local(strtotime($human_gmt), $time_zone, TRUE)) . ($time_zone == 'UTC' ? ' (UTC)' : '');
}
Example #2
0
function current_time($timezone, $daylight_saving)
{
    $time = time();
    $gmt = local_to_gmt($time);
    $local = gmt_to_local($gmt, $timezone, $daylight_saving);
    return standard_date("DATE_RFC822", $local);
}
function local_time($client_id, $time)
{
    $CI =& get_instance();
    $CI->load->model('client_model');
    $client = $CI->client_model->GetClientDetails($client_id);
    $timestamp = !is_numeric($time) ? strtotime($time) : $time;
    $timestamp = $timestamp - date("Z");
    $timezone = $client->gmt_offset;
    $daylight_saving = date("I") == 1 ? TRUE : FALSE;
    // format
    $format = defined("_CONTROLPANEL") ? "M j, Y" : "c";
    if (defined("_CONTROLPANEL") and strstr($time, ' ')) {
        $format = 'M j, Y h:i a';
    }
    $formatted_date = date($format, gmt_to_local($timestamp, $timezone, $daylight_saving));
    // if the date is null, we won't return it
    // any date before May 29, 1988 is null
    $is_null = $timestamp < 580881600 ? TRUE : FALSE;
    if ($is_null === TRUE and defined("_CONTROLPANEL")) {
        return 'N/A';
    } elseif ($is_null === TRUE) {
        return '0';
    } else {
        return $formatted_date;
    }
}
Example #4
0
 function getTransRateByTime($productId)
 {
     $r = $this->getTargetListByProductId($productId);
     $num = $r->num_rows();
     $ret = array();
     $nret = array();
     foreach ($r->result() as $row) {
         $transEvents = $this->getTransEventsIdByTargetId($row->tid);
         $event_from = $transEvents["from"];
         $event_to = $transEvents["to"];
         $timezonestimestamp = gmt_to_local(local_to_gmt(), $this->config->item('timezones'));
         $timezonestime = date('Y-m-d H:i:m', $timezonestimestamp);
         $from_count = 0;
         $to_count = 0;
         for ($i = 29; $i >= 0; $i--) {
             $dataStr = date('Y-m-d-H-i', strtotime("-{$i} minutes", strtotime($timezonestime)));
             $from_size = $this->redis->get("razor_r_p_e_" . $productId . "_" . $event_from . "_" . $dataStr);
             $from_count += $from_size;
             $to_size = $this->redis->get("razor_r_p_e_" . $productId . "_" . $event_to . "_" . $dataStr);
             $to_count += $to_size;
             if ($from_count == 0) {
                 $rate = 0;
             } else {
                 $rate = $to_count / $from_count;
             }
         }
         $r = array('name' => $row->targetname, 'time' => '-' . $i . lang("v_rpt_realtime_minutes"), 'from_count' => $from_count, 'to_count' => $to_count, 'rate' => $rate, 'event_to' => $event_to);
         if ($to_count == 0) {
             continue;
         }
         array_push($ret, $r);
     }
     return $ret;
 }
Example #5
0
 public function __construct()
 {
     parent::__construct();
     $this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate, no-transform, max-age=0, post-check=0, pre-check=0");
     $this->output->set_header("Pragma: no-cache");
     $this->load->model('noise_model');
     if ($this->auth->is_logged() == FALSE) {
         $this->status_login = "******";
         $this->key_activation = $this->generate_key(20);
     } else {
         $this->status_login = "******";
     }
     // LOAD LIBRARY SLUG
     $config = array('table' => 'notion', 'id' => 'id_notion', 'field' => 'slug', 'title' => 'title', 'replacement' => 'dash');
     $this->load->library('slug', $config);
     ## FECHA
     date_default_timezone_set('UTC');
     $timestamp = now();
     $timezone = 'UM5';
     $daylight_saving = false;
     $now = gmt_to_local($timestamp, $timezone, $daylight_saving);
     $datestring = "%Y-%m-%d %h:%i:%s";
     $this->now = mdate($datestring, $now);
     //$this->name_country = $this->country->ip_info('Visitor', 'Country');
     //$this->code_country = $this->country->ip_info("Visitor", "Country Code");
     $this->name_country = 'PERU';
     $this->code_country = 'PE';
     //$this->state        = $this->country->ip_info('181.66.157.144', 'State');
 }
 public function anadir_contacto($data)
 {
     $timestamp = time();
     $fecha = date("Y-m-d H:i:s");
     $this->db->set('identificador', $data['identificador']);
     $this->db->set('nombre', $data['nombre_completo']);
     $this->db->set('correo', $data['email']);
     $this->db->set('telefono', $data['telefono']);
     $this->db->set('comentario', $data['comentario']);
     $this->db->set('fecha', $fecha);
     $this->db->set('id_servicio', $data['servicio']);
     $this->db->set('id_origen', $data['origen']);
     $this->db->set('unixtime', gmt_to_local($timestamp, $this->timezone, TRUE));
     $this->db->set('ip', $data['ip']);
     $this->db->set('navegador', $data['navegador']);
     $this->db->set('microsite', $data['microsite']);
     $this->db->set('trafico', $data['origin']);
     $this->db->insert($this->contacto);
     if ($this->db->affected_rows() > 0) {
         return TRUE;
     } else {
         return FALSE;
     }
     $result->free_result();
 }
Example #7
0
 public function __construct()
 {
     parent::__construct();
     $this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate, no-transform, max-age=0, post-check=0, pre-check=0");
     $this->output->set_header("Pragma: no-cache");
     $this->load->model('web_model');
     if ($this->auth->is_logged() == FALSE) {
         $this->status_login = "******";
         $this->key_activation = $this->generate_key(20);
     } else {
         $this->status_login = "******";
     }
     /* Obtenemos la fecha actual */
     date_default_timezone_set('UTC');
     $timestamp = now();
     $timezone = 'UM5';
     $daylight_saving = FALSE;
     $now = gmt_to_local($timestamp, $timezone, $daylight_saving);
     $datestring = "%Y-%m-%d %h:%i:%s";
     $this->now = mdate($datestring, $now);
     //$this->name_country = $this->country->ip_info('Visitor', 'Country');
     //$this->code_country = $this->country->ip_info("Visitor", "Country Code");
     $this->name_country = 'PERU';
     $this->code_country = 'PE';
 }
Example #8
0
 function getActivityByMinutes($productId)
 {
     $timezonestimestamp = gmt_to_local(local_to_gmt(), $this->config->item('timezones'));
     $timezonestime = date('Y-m-d H:i:m', $timezonestimestamp);
     $all_ret = array();
     $version = "all";
     for ($i = 29; $i >= 0; $i--) {
         $all_size = 0;
         $dataStr = date('Y-m-d-H-i', strtotime("-{$i} minutes", strtotime($timezonestime)));
         $allAcs = $this->redis->keys("razor_r_ac_p_" . $productId . "_" . $dataStr . "*");
         if ($allAcs && count($allAcs) > 0) {
             for ($k = 0; $k < count($allAcs); $k++) {
                 $key = $allAcs[$k];
                 $len = $this->redis->hlen($key);
                 $all_size += $len;
             }
         }
         if ($i == 0) {
             $onlinedata = array('minutes' => lang("v_rpt_realtime_now"), 'size' => $all_size);
         } else {
             $onlinedata = array('minutes' => "- " . $i . lang("v_rpt_realtime_minutes"), 'size' => $all_size);
         }
         array_push($all_ret, $onlinedata);
     }
     return json_encode($all_ret);
 }
Example #9
0
 function postDate($time, $format = "%M %d %Y %h:%i%a")
 {
     $timezone = $this->session->userdata("timezone");
     if (empty($timezone)) {
         $timezone = "UTC";
     }
     return mdate($format, gmt_to_local($time, $timezone));
 }
 function trigger_convert_to_local($time = '', $gmt_offset, $format = 'Y-m-d H:i:s')
 {
     $CI =& get_instance();
     $time = !is_numeric($time) ? strtotime(str_replace('/', '-', $time)) : $time;
     $timezone = $gmt_offset;
     $daylight_saving = date("I") == 1 ? TRUE : FALSE;
     $time = gmt_to_local($time, $timezone, $daylight_saving);
     return date($format, $time);
 }
Example #11
0
 function get_est_time()
 {
     $now = time();
     $gmt = local_to_gmt($now);
     $timezone = 'UM4';
     $daylight_saving = FALSE;
     $tt = gmt_to_local($gmt, $timezone, $daylight_saving);
     return $tt;
 }
Example #12
0
	function convert_from_gmt($gmt_date,$timezone)
	{
//echo $gmt_date;
if($gmt_date && $timezone){
		return mdate("%d/%m/%Y %H:%i",gmt_to_local(strtotime($gmt_date),$timezone,false));
}
else{
	return "";
}
		
	}
Example #13
0
 public function aktifkan($uid)
 {
     $this->db->where('uid', $uid);
     $query = $this->db->get('user');
     if ($query->num_rows() > 0) {
         $this->db->where('uid', $uid);
         $this->db->update('user', array('stat' => '1', 'aktif' => gmt_to_local(time(), 'UP7', FALSE)));
         return TRUE;
     } else {
         return FALSE;
     }
 }
Example #14
0
 public function submit($username, $password, $nama, $alamat, $email, $kota, $hp)
 {
     $datestring = '%d/%m/%y';
     $time = time();
     $tarif = $this->config->item('biaya');
     $transfer = $tarif + substr($hp, -3);
     $unik = random_string('alnum', 6);
     $pass = do_hash($password . $unik);
     $secure_pass = $unik . '_' . $pass;
     $data = array('userid' => strtolower($username), 'password' => $secure_pass, 'stat' => '0', 'nama' => $nama, 'alamat' => $alamat, 'kota' => $kota, 'telepon' => $hp, 'email' => strtolower($email), 'transfer' => $transfer, 'daftar' => gmt_to_local(time(), 'UP7', FALSE), 'uid' => do_hash($username));
     $this->db->insert('user', $data);
     return TRUE;
 }
Example #15
0
 public function __construct()
 {
     parent::__construct();
     $this->load->model('manager_model');
     /* Obtenemos la fecha actual */
     date_default_timezone_set('UTC');
     $timestamp = now();
     $timezone = 'UM5';
     $daylight_saving = FALSE;
     $now = gmt_to_local($timestamp, $timezone, $daylight_saving);
     $datestring = "%Y-%m-%d %h:%i:%s";
     $this->now = mdate($datestring, $now);
 }
 /**
  * 날짜 표출 형태 변경
  *
  * @author KangMin
  *
  * @param int $time
  * @param string $datetime_type
  *
  * @return string
  */
 function time2date($time, $datetime_type = SETTING_datetime_type)
 {
     $return = '';
     if (IS_USER_LOGIN === TRUE) {
         if (!empty($time)) {
             $return = date($datetime_type, $time - (gmt_to_local($time, SETTING_default_timezone, FALSE) - gmt_to_local($time, USER_INFO_timezone, FALSE)));
         }
     } else {
         if (!empty($time)) {
             $return = date($datetime_type, $time);
         }
     }
     return $return;
 }
Example #17
0
 function save($id = null)
 {
     // Keep track if this is a new user
     $is_new = empty($id);
     // Redirect unauthenticated users to signin page
     if (!$this->authentication->is_signed_in()) {
         redirect('account/sign_in/?continue=' . urlencode(base_url() . 'car/schedules'));
     }
     // Check if they are allowed to Update Users
     if (!$this->authorization->is_permitted('car_schedule_manage') && !empty($id)) {
         $this->session->set_flashdata('parmission', 'You have no permission to update Schedule');
         redirect(base_url() . 'dashboard');
     }
     // Check if they are allowed to Create Users
     if (!$this->authorization->is_permitted('car_schedule_add') && empty($id)) {
         $this->session->set_flashdata('parmission', 'You have no permission to add Schedule');
         redirect(base_url() . 'dashboard');
     }
     // Retrieve sign in user
     $data['account'] = $this->account_model->get_by_id($this->session->userdata('account_id'));
     $data['action'] = 'create';
     $this->form_validation->set_error_delimiters('<div class="field_error">', '</div>');
     $this->form_validation->set_rules(array(array('field' => 'route_id', 'label' => 'lang:select_route', 'rules' => 'trim|required'), array('field' => 'car_id', 'label' => 'lang:select_car', 'rules' => 'trim|required'), array('field' => 'type', 'label' => 'lang:schedule_type', 'rules' => 'trim|required'), array('field' => 'time', 'label' => 'lang:schedule_time', 'rules' => 'trim|required'), array('field' => 'status', 'label' => 'lang:status', 'rules' => 'trim|required')));
     // Run form validation
     if ($this->form_validation->run()) {
         if (empty($id)) {
             $now = gmt_to_local(now(), 'UP5', TRUE);
             $data = array('route_id' => $this->input->post('route_id', TRUE), 'car_id' => $this->input->post('car_id', TRUE), 'schedule_type' => $this->input->post('type', TRUE), 'start_time' => $this->input->post('time', TRUE), 'enable' => $this->input->post('status', TRUE), 'create_user_id' => $data['account']->username, 'create_date' => mdate('%Y-%m-%d %H:%i:%s', $now));
             //print_r($data);
             $schedule_id = $this->general->save_into_table_and_return_insert_id('car_schedule', $data);
             $this->session->set_flashdata('message_success', lang('success_add'));
             //redirect('car/schedules');
         } else {
             $now = gmt_to_local(now(), 'UP5', TRUE);
             $data = array('route_id' => $this->input->post('route_id', TRUE), 'car_id' => $this->input->post('car_id', TRUE), 'schedule_type' => $this->input->post('type', TRUE), 'start_time' => $this->input->post('time', TRUE), 'enable' => $this->input->post('status', TRUE), 'update_user_id' => $data['account']->username, 'update_date' => mdate('%Y-%m-%d %H:%i:%s', $now));
             $this->general->update_table('car_schedule', $data, 'schedule_id', $id);
             $this->session->set_flashdata('message_success', lang('success_update'));
             redirect('car/schedules');
         }
     }
     // Get the account to update
     if (!$is_new) {
         $data['update_details'] = $this->general->get_all_table_info_by_id('car_schedule', 'schedule_id', $id);
         $data['action'] = 'update';
     }
     $data['all_car'] = $this->general->get_list_view('car_info', $field_name = NULL, $id = NULL, $select = NULL, 'car_id', 'desc', NULL, NULL);
     redirect('car/schedules');
     // $this->load->view('car/car_schedules', $data);
 }
Example #18
0
 function projectdetail($var = 'id', $id)
 {
     /* Database Initiation */
     $q = $this->db->get_where('ch_project', array('project_id' => $id));
     $row = $q->row();
     $s = $this->db->get_where('ch_user', array('user_id' => $row->project_user_id));
     $row_user = $s->row();
     $r = $this->db->get_where('ch_projectreward', array('project_id' => $id));
     $reward = $r->row();
     /* Data Inititaion */
     $time = $row->project_time;
     $datetime = human_to_unix($time);
     $data['project_until'] = standard_date('DATE_COOKIE', gmt_to_local($datetime, 'UP7', 'FALSE'));
     $data['sidebar_amount_funding'] = $row->amount_funding;
     $data['project_title'] = $row->project_name;
     $data['project_author'] = $row_user->name;
     $data['user_location'] = $row_user->location;
     $data['user_bio'] = $row_user->bio;
     $data['title'] = $row->project_name . ' by ' . $row_user->name;
     $data['topmenu'] = $this->projectmodel->menu_top($var, $id);
     $data['project_location'] = $row->project_location;
     $data['user_avatar'] = $row_user->avatar;
     for ($i = 1; $i < 6; $i++) {
         $rew = "reward_{$i}";
         $count = "count_{$i}";
         $data["donate_{$i}"] = $reward->{$rew};
         $data["count_{$i}"] = $reward->{$count};
     }
     switch ($var) {
         case 'id':
             $data['project_home'] = $row->project_home;
             $data['project_video'] = $row->project_video;
             $this->projectmodel->template($data, "chprojectdetail");
             break;
         case 'updates':
             $data['project_updates'] = $this->projectmodel->project_updates($id);
             $data['project_updates_form'] = $this->projectmodel->editor($id);
             $this->projectmodel->template($data, "chprojectupdates");
             break;
         case 'comments':
             $data['project_comments'] = $this->projectmodel->project_comments($id);
             $this->projectmodel->template($data, "chprojectcomments");
             break;
         default:
             $data['project_home'] = $row->project_home;
             $this->projectmodel->template($data, "chprojectdetail");
             break;
     }
 }
 public function anadir_inscripciones($data)
 {
     $timestamp = time();
     //$fecha_nac =   date ("Y-m-d H:i:s", strtotime($data['fecha_nacimiento'])); //  date("Y-m-d H:i:s",  );
     //$this->db->set( 'fecha_nacimiento', $fecha_nac );
     $this->db->set('identificador', $data['identificador']);
     $this->db->set('nombre', $data['nombre']);
     $this->db->set('apellidop', $data['apellidop']);
     $this->db->set('apellidom', $data['apellidom']);
     $this->db->set('fecha_nacimiento', $data['fecha_nacimiento']);
     $this->db->set('email', $data['email']);
     $this->db->set('licencia', $data['licencia']);
     $this->db->set('vigencia', $data['vigencia']);
     /*$this->db->set( 'calle', $data['calle'] );
       $this->db->set( 'colonia', $data['colonia'] );
       $this->db->set( 'delegacion', $data['delegacion'] );
       $this->db->set( 'ciudad', $data['ciudad'] );
       $this->db->set( 'cpostal', $data['cpostal'] );
       $this->db->set( 'referencia', $data['referencia'] );*/
     $this->db->set('oficina', $data['oficina']);
     //$this->db->set( 'telefono', $data['telefono'] );
     $this->db->set('celular', $data['celular']);
     //$this->db->set( 'telefono2', $data['telefono2'] );
     /*$this->db->set( 'modelo', $data['modelo'] );
       $this->db->set( 'ano_modelo', $data['ano_modelo'] );
       $this->db->set( 'placa', $data['placa'] );
       $this->db->set( 'serie', $data['serie'] );*/
     $this->db->set('nombA1', $data['nombA1']);
     $this->db->set('edadA1', $data['edadA1']);
     $this->db->set('nombA2', $data['nombA2']);
     $this->db->set('edadA2', $data['edadA2']);
     $this->db->set('comentario', $data['comentario']);
     $this->db->set('coleccion_id_aviso', $data['coleccion_id_aviso']);
     $this->db->set('unixtime', gmt_to_local($timestamp, $this->timezone, TRUE));
     $this->db->set('ip', $data['ip']);
     $this->db->set('navegador', $data['navegador']);
     $this->db->set('periodo', $data['periodo']);
     $this->db->set('microsite', $data['microsite']);
     $this->db->set('trafico', $data['origin']);
     $this->db->insert($this->registro_inscripciones);
     if ($this->db->affected_rows() > 0) {
         return TRUE;
     } else {
         return FALSE;
     }
     $result->free_result();
 }
Example #20
0
 function getOnlineUsers($productId)
 {
     $timezonestimestamp = gmt_to_local(local_to_gmt(), $this->config->item('timezones'));
     $timezonestime = date('Y-m-d H:i:m', $timezonestimestamp);
     $ret = array();
     for ($i = 30; $i >= 0; $i--) {
         $dataStr = date('Y-m-d-H-i', strtotime("-{$i} minutes", strtotime($timezonestime)));
         $size = $this->redis->hlen("razor_r_u_p_" . $productId . "_" . $dataStr);
         if ($i == 0) {
             $onlinedata = array('minutes' => lang("v_rpt_realtime_now"), 'size' => $size);
         } else {
             $onlinedata = array('minutes' => "- " . $i . lang("v_rpt_realtime_minutes"), 'size' => $size);
         }
         array_push($ret, $onlinedata);
     }
     return $ret;
 }
Example #21
0
 public function __construct()
 {
     parent::__construct();
     $this->load->model('locations_model');
     // cargando models medico
     if ($this->auth->is_logged() == FALSE) {
         // verificando login
         redirect(base_url('manager'));
     }
     ## FECHA
     date_default_timezone_set('UTC');
     $timestamp = now();
     $timezone = 'UM5';
     $daylight_saving = TRUE;
     $now = gmt_to_local($timestamp, $timezone, $daylight_saving);
     $datestring = "%Y-%m-%d %h:%i:%s";
     $this->now = mdate($datestring, $now);
 }
Example #22
0
 function __construct()
 {
     parent::__construct();
     $this->load->database();
     $this->load->helper('url');
     $this->load->helper('date');
     $this->load->library('grocery_CRUD');
     //Variable global
     $variableGlobal = "";
     $registro = "";
     //Obtenemos la fecha actual
     $timestamp = now();
     $timezone = 'UM8';
     $daylight_saving = FALSE;
     $now = gmt_to_local($timestamp, $timezone, $daylight_saving);
     $datestring = "%Y-%m-%d %h:%i:%s";
     $this->now = mdate($datestring, $now);
     $this->load->helper('date');
 }
 public function nuevo_usuario($data)
 {
     $timestamp = time();
     $this->db->set('uid', "UUID()", FALSE);
     $this->db->set('nombre', $data['nombre']);
     $this->db->set('apellidos', "AES_ENCRYPT('{$data['apellidos']}','{$this->key_encrypt}')", FALSE);
     $this->db->set('email', "AES_ENCRYPT('{$data['email']}','{$this->key_encrypt}')", FALSE);
     $this->db->set('telefono', "AES_ENCRYPT('{$data['telefono_contacto']}','{$this->key_encrypt}')", FALSE);
     $this->db->set('contrasena', "AES_ENCRYPT('{$data['contrasena']}','{$this->key_encrypt}')", FALSE);
     $this->db->set('rol_usuario', $data['rol_usuario']);
     $this->db->set('tipo_colaborador', $data['tipo_colaborador']);
     $this->db->set('categorias_asignadas', $data['categorias']);
     $this->db->set('alta', gmt_to_local($timestamp, $this->timezone, TRUE));
     $this->db->insert($this->db->dbprefix('sistema_usuarios'));
     if ($this->db->affected_rows() > 0) {
         return TRUE;
     } else {
         return FALSE;
     }
 }
Example #24
0
 public function __construct()
 {
     parent::__construct();
     $this->load->model('events_model');
     // cargando models medico
     if ($this->auth->is_logged() == FALSE) {
         // verificando login
         redirect(base_url('manager'));
     }
     // LOAD LIBRARY SLUG
     $config = array('table' => 'event', 'id' => 'id_event', 'field' => 'slug', 'title' => 'title', 'replacement' => 'dash');
     $this->load->library('slug', $config);
     ## FECHA
     date_default_timezone_set('UTC');
     $timestamp = now();
     $timezone = 'UM5';
     $daylight_saving = TRUE;
     $now = gmt_to_local($timestamp, $timezone, $daylight_saving);
     $datestring = "%Y-%m-%d %h:%i:%s";
     $this->now = mdate($datestring, $now);
 }
Example #25
0
 public function cek($username, $password)
 {
     $this->db->where('userid', $username);
     $this->db->or_where('email', $username);
     $query = $this->db->get('user');
     if ($query->num_rows() === 1) {
         $row = $query->row();
         $p = explode("_", $row->password);
         $real_pass = do_hash($password . $p[0]);
         if ($p[1] === $real_pass) {
             $newdata = array('username' => $row->userid, 'email' => $row->email, 'status' => $row->stat, 'nama' => $row->nama, 'logged_in' => TRUE);
             $this->db->where('userid', $row->userid)->update('user', array('login' => gmt_to_local(time(), 'UP7', FALSE)));
             $this->session->set_userdata($newdata);
             return TRUE;
         } else {
             return FALSE;
         }
     } else {
         return FALSE;
     }
 }
Example #26
0
 function getEventNumByEvent($productId)
 {
     $timezonestimestamp = gmt_to_local(local_to_gmt(), $this->config->item('timezones'));
     $timezonestime = date('Y-m-d H:i:m', $timezonestimestamp);
     $all_ret = array();
     $version = "all";
     $eventid_array = $this->event->getEventIdentifierinfo($productId, $version);
     foreach ($eventid_array->result() as $row) {
         $all_size = 0;
         for ($i = 0; $i <= 30; $i++) {
             $dataStr = date('Y-m-d-H-i', strtotime("-{$i} minutes", strtotime($timezonestime)));
             $size = $this->redis->get("razor_r_p_e_" . $productId . "_" . $row->event_identifier . "_" . $dataStr);
             $all_size += $size;
         }
         $data = array('event' => $row->event_identifier, 'size' => $all_size);
         if ($all_size == 0) {
             continue;
         }
         array_push($all_ret, $data);
     }
     return $all_ret;
 }
Example #27
0
 function add_mapping($id = null)
 {
     // Keep track if this is a new user
     $is_new = empty($id);
     // Enable SSL?
     maintain_ssl($this->config->item("ssl_enabled"));
     // Redirect unauthenticated users to signin page
     if (!$this->authentication->is_signed_in()) {
         redirect('account/sign_in/?continue=' . urlencode(base_url() . 'car/routes'));
     }
     // Redirect unauthorized users to account profile page
     if (!$this->authorization->is_permitted('car_manage_route')) {
         $this->session->set_flashdata('parmission', 'You have no permission to access manage route');
         //redirect(uri_string());
         redirect(base_url() . 'dashboard');
     }
     $data['account'] = $this->account_model->get_by_id($this->session->userdata('account_id'));
     $data['title'] = 'Route Mapping';
     $data['all_routes'] = $this->general->get_list_view('car_route', $field_name = NULL, $id = NULL, $select = NULL, 'route_id', 'asc', NULL, NULL);
     $data['all_nodes'] = $this->general->get_list_view('car_node', $field_name = NULL, $id = NULL, $select = NULL, 'node_id', 'desc', NULL, NULL);
     $this->form_validation->set_error_delimiters('<div class="field_error">', '</div>');
     $this->form_validation->set_rules(array(array('field' => 'route_id', 'label' => 'lang:select_route', 'rules' => 'trim|required'), array('field' => 'node_id', 'label' => 'lang:select_node', 'rules' => 'trim|required'), array('field' => 'prev_node_id', 'label' => 'lang:select_prev_node', 'rules' => 'trim|required'), array('field' => 'next_node_id', 'label' => 'lang:select_next_node', 'rules' => 'trim|required')));
     // Run form validation
     if ($this->form_validation->run()) {
         if (empty($id)) {
             $now = gmt_to_local(now(), 'UP5', TRUE);
             $data = array('route_id' => $this->input->post('route_id', TRUE), 'node_id' => $this->input->post('node_id', TRUE), 'prv_node_id' => $this->input->post('prev_node_id', TRUE), 'next_node_id' => $this->input->post('next_node_id', TRUE), 'duration_to_next' => $this->input->post('duration_to_next', TRUE), 'create_user_id' => $data['account']->username, 'create_date' => mdate('%Y-%m-%d %H:%i:%s', $now));
             $mapping_id = $this->general->save_into_table_and_return_insert_id('car_route_node_mapping', $data);
             $this->session->set_flashdata('message_success', lang('success_add'));
             redirect('car/routes/add_mapping');
         } else {
             $now = gmt_to_local(now(), 'UP5', TRUE);
             $data = array('route_id' => $this->input->post('route_id', TRUE), 'node_id' => $this->input->post('node_id', TRUE), 'prv_node_id' => $this->input->post('prev_node_id', TRUE), 'next_node_id' => $this->input->post('next_node_id', TRUE), 'duration_to_next' => $this->input->post('duration_to_next', TRUE), 'update_user_id' => $data['account']->username, 'update_date' => mdate('%Y-%m-%d %H:%i:%s', $now));
             $this->general->update_table('car_route_node_mapping', $data, 'map_id', $id);
             $this->session->set_flashdata('message_success', lang('success_update'));
             redirect('car/routes/add_mapping');
         }
     }
     // Get the account to update
     if (!$is_new) {
         $data['update_details'] = $this->general->get_all_table_info_by_id('car_route_node_mapping', 'map_id', $id);
         $data['action'] = 'update';
     }
     $this->load->view('car/mapping_save', $data);
 }
Example #28
0
<?$this->load->view('home/header')?>
<div class='container m-t-20' id="myorder">
  <div class='row'>
    <!-- left -->
    <?$this->load->view('home/my')?>
    <!-- left end -->
    <!-- right -->
    <div class='col-lg-10 col-md-9 col-sm-9 col-xs-12'>
      <div class="order-tab">
       <div style="margin:0 auto;width:60%;text-align:center;">
        <?php if($row->expirse_to>time()):?>
          <form action="<?php echo base_url()?>home/user_coupons/update" method="post" onsubmit='return false' role="form" id='coupon_form' class="form-horizontal">
            <p style="font-size:28px;font-weight:blod;" class="req">
              正在领取<?php echo $row->code;?>优惠券(满<?php echo $row->use;?>减<?php echo $row->value;?>)
            </p>
            <p>优惠劵有效期至<?php echo date('Y-m-d h:m:s',gmt_to_local($row->expirse_to));?></p>
            <p>每个ID只能领一次</p>
             <input type="hidden" name="id" value="<?php echo isset($row)?$row->id:'';?>"/>
             <button type="button" class="btn inline-block green" style="padding:6px 12px;" onclick="do_submit('coupon_form')" id='coupon_form_submit_btn'>领取</button>
             <button type="button" class="btn inline-block default" style="padding:6px 12px;" onclick="window.history.back();">取消</button>
          </form>
        <?else:?>
            <?php echo $row->code;?>优惠券已过期
        <?endif;?>
        </div>
    </div>
    <!-- right end --> 
  </div>
    
</div>
Example #29
0
            }
            ?>
                      </div>

                    <?php 
            // enable gui form saver
            if (riake('gui_saver', $meta)) {
                ?>
						</form>
						<?php 
            }
        } else {
            // meta icon ?
            $icon = riake('icon', $meta, false);
            // enable gui form saver
            $form_expire = gmt_to_local(time(), 'UTC') + GUI_EXPIRE;
            $ref = urlencode(current_url());
            $use_namespace = riake('use_namespace', $meta, false);
            $class = riake('classes', riake('custom', $meta));
            $id = riake('id', riake('custom', $meta));
            $action = riake('action', riake('custom', $meta), site_url(array('dashboard', 'options', 'save')));
            $method = riake('method', riake('custom', $meta), 'POST');
            $enctype = riake('enctype', riake('custom', $meta), 'multipart/form-data');
            $namespace = riake('namespace', $meta);
            if (riake('gui_saver', $meta)) {
                ?>
						<form class="form <?php 
                echo $class;
                ?>
" id="<?php 
                echo $id;
Example #30
0
 public function edicion_usuario($data)
 {
     $timestamp = time();
     $id_session = $this->session->userdata('id');
     $this->db->set('fecha_pc', gmt_to_local($timestamp, $this->timezone, TRUE));
     $this->db->set('id_usuario', $id_session);
     $this->db->set('nombre', $data['nombre']);
     $this->db->set('apellidos', $data['apellidos']);
     $this->db->set('email', "AES_ENCRYPT('{$data['email']}','{$this->key_hash}')", FALSE);
     $this->db->set('telefono', "AES_ENCRYPT('{$data['telefono']}','{$this->key_hash}')", FALSE);
     $this->db->set('id_perfil', $data['id_perfil']);
     $this->db->set('contrasena', "AES_ENCRYPT('{$data['contrasena']}','{$this->key_hash}')", FALSE);
     $this->db->where('id', $data['id']);
     $this->db->update($this->usuarios);
     if ($this->db->affected_rows() > 0) {
         return TRUE;
     } else {
         return FALSE;
     }
 }