本文整理汇总了PHP中human_to_unix函数的典型用法代码示例。如果您正苦于以下问题:PHP human_to_unix函数的具体用法?PHP human_to_unix怎么用?PHP human_to_unix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了human_to_unix函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
public function edit()
{
$this->Purview_model->checkPurviewAjax($this->tablefunc, 'edit');
$post = $this->input->post(NULL, TRUE);
if ($post['id'] && $post['action'] == site_aurl($this->tablefunc)) {
$data = elements($this->fields, $post);
$data['updatetime'] = time();
$data['puttime'] = human_to_unix($post['puttime']);
$data['uid'] = $this->session->userdata('uid');
$data['tags'] = $this->Tags_model->loadTagIds($post['tags'], $this->editlang);
$data['recommends'] = isset($post['recommends']) && $post['recommends'] ? implode(',', $post['recommends']) : '';
$this->Data_model->editData(array('id' => $post['id']), $data);
$category = $this->Data_model->getSingle(array('id' => $data['category']), 'category');
$cachefile = $category['model'] . '/detail_' . $this->editlang . '_' . $category['dir'] . '_' . $post['id'];
if (file_exists('data/cache/' . $cachefile)) {
$this->Cache_model->delete($cachefile);
}
$this->Cache_model->deleteSome($this->tablefunc . '_' . $this->editlang);
$this->Cache_model->deleteSome('recommend_' . $this->editlang . '_' . $this->tablefunc);
$this->Cache_model->deleteSome($category['dir'] . '/related_' . $this->editlang . '_' . $post['id']);
show_jsonmsg(array('status' => 200, 'id' => $post['id'], 'remsg' => $this->_setlist($this->Data_model->getSingle(array('id' => $post['id'])), false)));
} else {
$id = $this->uri->segment(4);
if ($id > 0 && ($view = $this->Data_model->getSingle(array('id' => $id)))) {
$res = array('tpl' => 'view', 'tablefunc' => $this->tablefunc, 'view' => $view, 'categoryarr' => $this->categoryarr, 'recommendarr' => $this->recommendarr, 'recommends' => $view['recommends'] == '' ? array() : explode(',', $view['recommends']), 'tags' => $this->Tags_model->loadTags($view['tags'], $this->editlang));
show_jsonmsg(array('status' => 200, 'remsg' => $this->load->view($this->tablefunc, $res, true)));
} else {
show_jsonmsg(array('status' => 203));
}
}
}
示例2: index
public function index($id = null)
{
isset($id) ? null : exit("无此账号,请输入类似网址,http://127.0.0.1/index.php/player/index/127232");
$data["total_price"] = $this->data_model->getSumPriceByPlayerID($id);
$data["count_price"] = $this->data_model->getCountPriceByPlayerID($id);
$data["activeTime"] = $this->data_model->getActiveTimeByPlayerID($id);
//激活时间
$data["firstPayTime"] = $this->data_model->getFirstPayTimeByPlayerID($id);
$data["lastPayTime"] = $this->data_model->getLastPayTimeByPlayerID($id);
$data["diffUnix"] = diffUnix(human_to_unix($data["activeTime"]), human_to_unix($data["firstPayTime"]));
$data['pay_list'] = $this->data_model->getPayByPlayerID($id);
$data['title'] = '账号ID:' . $id . '的详细信息';
$data["info"] = $this->player_model->playerInfo($id);
//chart info
$room_info = $this->match_model->getTotalPriceAndTotalCountByPlayerID($id);
$match_info = $this->room_model->getTotalPriceAndTotalCountByPlayerID($id);
$data['room_sum'] = $room_info['sum'];
$data['room_count'] = $room_info['count'];
$data['match_sum'] = $match_info['sum'];
$data['match_count'] = $match_info['count'];
$this->load->view('templates/header', $data);
$this->load->view('templates/side', $data);
$this->load->view('pages/player', $data);
$this->load->view('pages/pay_by_id', $data);
$this->load->view('templates/footer');
}
示例3: GetDateTimeInFormat
function GetDateTimeInFormat($datestamp, $format)
{
switch ($format) {
// Swatch Internet Time
case null:
case 1:
return date_format(date_create($datestamp), 'jS F, Y') . ' @' . date("B", human_to_unix($datestamp)) . ' .beats';
// Unix time
// Unix time
case 2:
return human_to_unix($datestamp);
// Time since
// Time since
case 3:
return timespan(human_to_unix($datestamp), time()) . ' ago';
// Database
// Database
case 4:
return $datestamp;
// English
// English
case 5:
return date_format(date_create($datestamp), 'jS F, Y, g:i a');
// American
// American
case 6:
return date_format(date_create($datestamp), 'F jS, Y, g:i a');
}
}
示例4: human_unix
function human_unix($date, $time)
{
if (!empty($date) && !empty($time)) {
$date = explode('/', $date);
if (count($date) == 3) {
return human_to_unix($date[2] . '-' . $date[0] . '-' . $date[1] . ' ' . $time);
}
}
return 0;
}
示例5: create
public function create()
{
$client_id = $this->input->post('client_id');
$address_id = $this->input->post('address_id');
$call_date = human_to_unix($this->input->post('call_date'));
$params = compact('client_id', 'call_date', 'address_id');
$order_id = $this->order_model->add($params);
trigger_event('create_order', 'order', $order_id, false, 'miniant');
send_json_data(array('order_id' => $order_id));
}
示例6: edit_profile
public function edit_profile($user_id = '')
{
is_admin();
$this->session->set_userdata('current_url', current_url());
$birthday = $this->input->post('birth_year') . '-' . $this->input->post('birth_month') . '-' . $this->input->post('birth_date') . ' ' . date('H:i', time());
$dob_long = human_to_unix($birthday);
$admin = $this->Admin_m->get_admin_details($user_id);
$this->_data['admin_data'] = $admin;
if ($this->Admin_m->get_admin_details($user_id) === FALSE) {
redirect(site_url('admin'));
}
$config = array(array('field' => 'display_name', 'label' => lang('display_name'), 'rules' => 'required'), array('field' => 'first_name', 'label' => lang('first_name'), 'rules' => 'required'), array('field' => 'last_name', 'label' => lang('last_name'), 'rules' => 'required'), array('field' => 'phone', 'Label' => lang('phone'), 'rules' => 'min_length[10]'), array('field' => 'mobile', 'Label' => lang('mobile'), 'rules' => 'min_length[10]'), array('field' => 'mobile', 'Label' => lang('mobile'), 'rules' => 'min_length[10]'), array('field' => 'company', 'Label' => lang('company'), 'rules' => 'xss_clean'), array('field' => 'gender', 'Label' => lang('gender'), 'rules' => 'required'));
$this->form_validation->set_rules($config);
if ($this->input->post('edit_profile')) {
if ($this->form_validation->run()) {
$image_path = './assets/admin/avatar';
$thumb_path = $image_path . '/images';
$config = array('allowed_types' => "jpg|jpeg|gif|png", 'upload_path' => $image_path, 'max_size' => 10000, 'encrypt_name' => TRUE);
$this->load->library('upload', $config);
$this->upload->initialize($config);
if ($this->upload->do_upload()) {
if ($admin->num_rows() > 0) {
$a = $admin->row();
$file_name = './assets/admin/avatar/images/' . $a->gravatar;
if ($a->gravatar != null) {
delete_my_file($file_name);
}
}
$upload_info = $this->upload->data();
$config = array('source_image' => $upload_info['full_path'], 'new_image' => $thumb_path, 'maintain_ratio' => true, 'width' => 300, 'height' => 200);
$this->load->library('image_lib', $config);
//load library
$this->image_lib->resize();
//do whatever specified in config
delete_my_file($upload_info['full_path']);
$data_user = array('last_login' => time(), 'active' => $this->input->post('active'), 'group_id' => $this->input->post('group_id'));
$data_profile = array('display_name' => $this->input->post('display_name'), 'first_name' => $this->input->post('first_name'), 'last_name' => $this->input->post('last_name'), 'company' => $this->input->post('company'), 'gender' => $this->input->post('gender'), 'dob' => $dob_long, 'phone' => $this->input->post('phone'), 'mobile' => $this->input->post('mobile'), 'address' => $this->input->post('address'), 'gravatar' => $upload_info['file_name']);
$this->Admin_m->edit_profile($user_id, $data_user, $data_profile);
$this->session->set_flashdata('error', lang('update') . lang('success'));
redirect('admin');
} else {
$data_user = array('last_login' => time(), 'active' => $this->input->post('active'), 'group_id' => $this->input->post('group_id'));
$data_profile = array('display_name' => $this->input->post('display_name'), 'first_name' => $this->input->post('first_name'), 'last_name' => $this->input->post('last_name'), 'company' => $this->input->post('company'), 'gender' => $this->input->post('gender'), 'dob' => $dob_long, 'phone' => $this->input->post('phone'), 'mobile' => $this->input->post('mobile'), 'address' => $this->input->post('address'));
$this->Admin_m->edit_profile($user_id, $data_user, $data_profile);
$this->session->set_flashdata('error', lang('edit_profile') . lang('success'));
redirect('admin');
}
} else {
$this->display_admin('admin/edit_profile');
}
} else {
$this->display_admin('admin/edit_profile');
}
}
示例7: get_current_date_start_time
public function get_current_date_start_time($country_code = 'BD')
{
$time_zone_array = DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, $country_code);
$dateTimeZone = new DateTimeZone($time_zone_array[0]);
$dateTime = new DateTime("now", $dateTimeZone);
$unix_current_time = now() + $dateTime->getOffset();
$human_current_time = unix_to_human($unix_current_time);
$human_current_time_array = explode(" ", $human_current_time);
$human_current_date = $human_current_time_array[0];
$human_current_date_start_time = $human_current_date . ' 00:00 AM';
$unix_current_date_start_time = human_to_unix($human_current_date_start_time);
return $unix_current_date_start_time - $dateTime->getOffset();
}
示例8: projectdetail
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;
}
}
示例9: list_guest_books
/**
* List guest book
*
* @access public
* @return string
*/
public function list_guest_books()
{
$start = $this->input->get_post('start');
$limit = $this->input->get_post('limit');
$start = empty($start) ? 0 : $start;
$limit = empty($limit) ? MAX_DISPLAY_SEARCH_RESULTS : $limit;
$guest_books = $this->guest_book_model->get_guest_books($start, $limit);
$records = array();
if ($guest_books !== NULL) {
foreach ($guest_books as $guest_book) {
$records[] = array('guest_books_id' => $guest_book['guest_books_id'], 'title' => $guest_book['title'], 'email' => $guest_book['email'], 'guest_books_status' => $guest_book['guest_books_status'], 'languages' => show_image($guest_book['code']), 'content' => $guest_book['content'], 'date_added' => mdate('%Y/%m/%d', human_to_unix($guest_book['date_added'])));
}
}
$this->output->set_output(json_encode(array(EXT_JSON_READER_TOTAL => $this->guest_book_model->get_totals(), EXT_JSON_READER_ROOT => $records)));
}
示例10: download
function download($id = FALSE)
{
$this->load->helper(array('dompdf', 'file'));
$this->load->library('parser');
$data["invoice"] = Invoice::find($id);
$data['items'] = InvoiceHasItem::find('all', array('conditions' => array('invoice_id=?', $id)));
if ($data['invoice']->company_id != $this->client->company->id) {
redirect('cinvoices');
}
$data["core_settings"] = Setting::first();
$due_date = date($data["core_settings"]->date_format, human_to_unix($data["invoice"]->due_date . ' 00:00:00'));
$parse_data = array('due_date' => $due_date, 'invoice_id' => $data["invoice"]->reference, 'client_link' => $data["core_settings"]->domain, 'company' => $data["core_settings"]->company);
$html = $this->load->view($data["core_settings"]->template . '/' . $data["core_settings"]->invoice_pdf_template, $data, true);
$html = $this->parser->parse_string($html, $parse_data);
$filename = 'Invoice_' . $data["invoice"]->reference;
pdf_create($html, $filename, TRUE);
}
示例11: list_best_orders
/**
* List the best orders
*
* @access public
* @return string
*/
public function list_best_orders()
{
$this->load->model('best_orders_model');
$this->load->helper('date');
$start = $this->input->get_post('start') ? $this->input->get_post('start') : 0;
$limit = $this->input->get_post('limit') ? $this->input->get_post('limit') : MAX_DISPLAY_SEARCH_RESULTS;
$start_date = $this->input->get_post('start_date');
$end_date = $this->input->get_post('end_date');
$orders = $this->best_orders_model->get_orders($start_date, $end_date, $start, $limit);
$records = array();
if ($orders != NULL) {
foreach ($orders as $order) {
$records[] = array('orders_id' => $order['orders_id'], 'customers_id' => $order['customers_id'], 'customers_name' => $order['customers_name'], 'date_purchased' => mdate('%Y/%m/%d %H:%i:%s', human_to_unix($order['date_purchased'])), 'value' => (double) $order['value']);
}
} else {
$records[] = array('orders_id' => 0, 'customers_id' => 0, 'customers_name' => lang('none'), 'date_purchased' => '', 'value' => 0);
}
$this->output->set_output(json_encode(array(EXT_JSON_READER_TOTAL => $this->best_orders_model->get_total($start_date, $end_date), EXT_JSON_READER_ROOT => $records)));
}
示例12: date_mysql_to_php_display
function date_mysql_to_php_display($dt)
{
$ts = human_to_unix($dt);
$CI =& get_instance();
$current_date_format = $CI->config->item('account_date_format');
switch ($current_date_format) {
case 'dd/mm/yyyy':
return date('d M Y', $ts);
break;
case 'mm/dd/yyyy':
return date('M d Y', $ts);
break;
case 'yyyy/mm/dd':
return date('Y M d', $ts);
break;
default:
$CI->messages->add('Invalid date format. Check your account settings.', 'error');
return "";
}
return;
}
示例13: edit
public function edit()
{
$this->Purview_model->checkPurviewAjax($this->tablefunc, 'edit');
$post = $this->input->post(NULL, TRUE);
if ($post['id'] && $post['action'] == site_aurl($this->tablefunc)) {
$data = elements($this->fields, $post);
$data['replytime'] = human_to_unix($post['replytime']);
$data['uid'] = $this->session->userdata('uid');
$data['replyuid'] = $this->session->userdata('uid');
$this->Data_model->editData(array('id' => $post['id']), $data);
show_jsonmsg(array('status' => 200, 'id' => $post['id'], 'remsg' => $this->_setlist($this->Data_model->getSingle(array('id' => $post['id'])), false)));
} else {
$id = $this->uri->segment(4);
if ($id > 0 && ($view = $this->Data_model->getSingle(array('id' => $id)))) {
$res = array('tpl' => 'view', 'tablefunc' => $this->tablefunc, 'view' => $view, 'categoryarr' => $this->categoryarr);
show_jsonmsg(array('status' => 200, 'remsg' => $this->load->view($this->tablefunc, $res, true)));
} else {
show_jsonmsg(array('status' => 203));
}
}
}
示例14: view
function view($id = FALSE)
{
$this->view_data['submenu'] = array($this->lang->line('application_back') => 'cprojects', $this->lang->line('application_overview') => 'cprojects/view/' . $id, $this->lang->line('application_media') => 'cprojects/media/' . $id);
$this->view_data['project'] = Project::find($id);
$this->view_data['project_has_invoices'] = Invoice::find('all', array('conditions' => array('project_id = ? AND company_id=? AND estimate != ? AND issue_date<=?', $id, $this->client->company->id, 1, date('Y-m-d', time()))));
$tasks = ProjectHasTask::count(array('conditions' => 'project_id = ' . $id));
$tasks_done = ProjectHasTask::count(array('conditions' => array('status = ? AND project_id = ?', 'done', $id)));
@($this->view_data['opentaskspercent'] = $tasks_done / $tasks * 100);
$this->view_data['time_days'] = round((human_to_unix($this->view_data['project']->end . ' 00:00') - human_to_unix($this->view_data['project']->start . ' 00:00')) / 3600 / 24);
$this->view_data['time_left'] = $this->view_data['time_days'];
$this->view_data['timeleftpercent'] = 100;
if (human_to_unix($this->view_data['project']->start . ' 00:00') < time() && human_to_unix($this->view_data['project']->end . ' 00:00') > time()) {
$this->view_data['time_left'] = round((human_to_unix($this->view_data['project']->end . ' 00:00') - time()) / 3600 / 24);
$this->view_data['timeleftpercent'] = $this->view_data['time_left'] / $this->view_data['time_days'] * 100;
}
if (human_to_unix($this->view_data['project']->end . ' 00:00') < time()) {
$this->view_data['time_left'] = 0;
$this->view_data['timeleftpercent'] = 0;
}
@($this->view_data['opentaskspercent'] = $tasks_done / $tasks * 100);
$tracking = $this->view_data['project']->time_spent;
if (!empty($this->view_data['project']->tracking)) {
$tracking = time() - $this->view_data['project']->tracking + $this->view_data['project']->time_spent;
}
$this->view_data['timertime'] = $tracking;
$this->view_data['time_spent_from_today'] = time() - $this->view_data['project']->time_spent;
$tracking = floor($tracking / 60);
$tracking_hours = floor($tracking / 60);
$tracking_minutes = $tracking - $tracking_hours * 60;
$this->view_data['time_spent'] = $tracking_hours . " " . $this->lang->line('application_hours') . " " . $tracking_minutes . " " . $this->lang->line('application_minutes');
$this->view_data['time_spent_counter'] = sprintf("%02s", $tracking_hours) . ":" . sprintf("%02s", $tracking_minutes);
if (!isset($this->view_data['project_has_invoices'])) {
$this->view_data['project_has_invoices'] = array();
}
if ($this->view_data['project']->company_id != $this->client->company->id) {
redirect('cprojects');
}
$this->content_view = 'projects/client_views/view';
}
示例15: db_to_th
function db_to_th($datetime = '', $time = TRUE, $format = 'F')
{
if ($format == 'F') {
$month_th = array(1 => 'มกราคม', 2 => 'กุมภาพันธ์', 3 => 'มีนาคม', 4 => 'เมษายน', 5 => 'พฤษภาคม', 6 => 'มิถุนายน', 7 => 'กรกฏาคม', 8 => 'สิงหาคม', 9 => 'กันยายน', 10 => 'ตุลาคม', 11 => 'พฤศจิกายน', 12 => 'ธันวาคม');
} else {
$month_th = array(1 => 'ม.ค.', 2 => 'ก.พ.', 3 => 'มี.ค.', 4 => 'เม.ย', 5 => 'พ.ค.', 6 => 'มิ.ย', 7 => 'ก.ค.', 8 => 'ส.ค.', 9 => 'ก.ย.', 10 => 'ต.ค.', 11 => 'พ.ย.', 12 => 'ธ.ค.');
}
$datetime = human_to_unix($datetime);
if ($format == 'F') {
$r = date('d', $datetime) . ' ' . $month_th[date('n', $datetime)] . ' ' . (date('Y', $datetime) + 543);
} else {
if ($format == 'T') {
$r = date('d', $datetime) . '/' . date('n', $datetime) . '/' . (date('Y', $datetime) + 543);
} else {
$r = date('d', $datetime) . '-' . date('n', $datetime) . '-' . (date('Y', $datetime) + 543);
}
}
if ($time) {
$r .= ' - ' . date('H', $datetime) . ':' . date('i', $datetime);
}
return $r;
}