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)); } } }
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'); }
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'); } }
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; }
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)); }
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'); } }
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(); }
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; } }
/** * 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))); }
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); }
/** * 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))); }
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; }
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)); } } }
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'; }
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; }
function time_ago($timeago, $short = false) { $instance =& get_instance(); $now = time(); $timepices = array(); if (!is_numeric($timeago)) { $timeago = human_to_unix($timeago); } $timespan = timespan($timeago, $now); $timespan = explode(",", trim($timespan)); foreach ($timespan as $key => $value) { $timespanvalue = explode(" ", trim($value)); $arrayvalue = $timespanvalue[0] . " " . $instance->lang->line('application_' . $timespanvalue[1]); $timepices[$key] = $arrayvalue; } $return = $timepices[0]; if (isset($timepices[1]) && $short == false) { $return .= ' ' . $instance->lang->line('application_and') . ' ' . $timepices[1]; } $return .= ' ' . $instance->lang->line('application_ago'); return $return; }
function index() { $this->check_session(); $this->load->model('Workout', 'workout'); $user->id = $this->tank_auth->get_user_id(); $result['workouts'] = $this->workout->get_connection_workouts($user); for($i=0; $i<count($result['workouts']); $i++) { $post_time = $result['workouts'][$i]->workout_date; $post_date = human_to_unix($post_time); $post_date = timespan($post_date); $post_time_array = explode(", ", $post_date); $post_time_count = count($post_time_array); switch ($post_time_count) { case 0: break; case 1: $post_date = strtolower($post_time_array[0])." ago"; break; case 2: $post_date = strtolower($post_time_array[1])." ago"; break; case 3: $post_date = strtolower($post_time_array[2])." ago"; break; default: $post_date = date("j \of M y", strtotime($post_time)); } $result['workouts'][$i]->workout_date = $post_date; } $this->load->view('connections', $result); }
public function process_edit() { require_capability('orders:editorders'); if ($this->input->post('return')) { redirect(base_url() . 'miniant/orders/order/browse'); } $assignment_id = $this->input->post('assignment_id'); $required_fields = array('assignment_id' => "assignment ID", 'appointment_date' => "Appointment date", 'estimated_duration' => "Estimated duration", 'senior_technician_id' => "Senior technician"); $assignment = $this->assignment_model->get($assignment_id); foreach ($required_fields as $field => $description) { $this->form_validation->set_rules($field, $description, 'required'); } $success = $this->form_validation->run(); if (!$success) { add_message('The form could not be submitted. Please check the errors below', 'danger'); return $this->edit($assignment_id); } $assignment_params = array('appointment_date' => human_to_unix($this->input->post('appointment_date')), 'estimated_duration' => $this->input->post('estimated_duration'), 'order_id' => $assignment->order_id); $this->assignment_model->edit($assignment_id, $assignment_params); $this->order_model->edit($assignment->order_id, array('senior_technician_id' => $this->input->post('senior_technician_id'))); $this->update_statuses($assignment_id, $this->input->post('status_id')); add_message("assignment has been successfully updated!", 'success'); redirect(base_url() . 'miniant/orders/schedule'); }
public function get_bookings() { $start = human_to_unix($this->input->post('start'), true); $end = human_to_unix($this->input->post('end'), true); $confirmed = $this->input->post('confirmed'); $bookings = array(); $bookings = $this->booking_model->get_for_schedule($start, $end, null, $confirmed); $events = array(); foreach ($bookings as $booking) { $recipients = $this->booking_model->get_recipients($booking->id); $staff = $this->user_model->get_dropdown_full_name(false); $job_site = $this->job_site_model->get($booking->job_site_id); $event = new stdClass(); $event->id = "{$booking->id}"; $event->title = $this->load->view('job_site/booking_title', compact('booking', 'confirmed', 'job_site'), true); $event->allDay = true; $event->start = unix_to_human($booking->booking_date, '%Y-%m-%d'); $event->end = unix_to_human($booking->booking_date + 60, '%Y-%m-%d'); $event->job_site_id = $booking->job_site_id; $event->confirmed = $confirmed; $events[] = $event; } echo json_encode($events); }
echo '<a href="' . base_url() . 'expenses/attachment/' . $value->id . '" style="color: #505458;"><i class="fa fa-paperclip tt" title="' . $value->attachment_description . '"></i></a>'; } ?> </td> <td><?php if (isset($value->description)) { echo $value->description; } ?> </td> <td class="hidden-xs" ><span class="label label-info"><?php echo $value->category; ?> </span></td> <td class="hidden-xs"><span><?php $unix = human_to_unix($value->date . ' 00:00'); echo '<span class="hidden">' . $unix . '</span> '; echo date($core_settings->date_format, $unix); ?> </span></td> <td class="hidden-xs minus "><span class="<?php if (isset($value->invoice->id)) { echo 'plus tt" title="' . $this->lang->line("application_rebilled_on_invoice") . ' #' . $value->invoice->reference; } ?> "><?php echo display_money(sprintf("%01.2f", round($value->value, 2))); ?> </span></td> <td class="hidden-xs bold"><?php echo display_money(sprintf("%01.2f", round($sum, 2)));
<li class="timeline-inverted"> <div class="timeline-badge" style="background: rgb(96, 187, 248);"> <?php echo $i; ?> </div> <div class="timeline-panel"> <div class="timeline-heading"> <h5 class="timeline-title"> <p><small class="text-muted"><span class="writer"><?php echo $value->from; ?> </span> <span class="datetime"><?php $unix = human_to_unix($value->datetime); echo date($core_settings->date_format . ' ' . $core_settings->date_time_format, $unix); ?> </span></small> <?php if ($value->from == $this->user->firstname . " " . $this->user->lastname || $this->user->admin == "1") { ?> <a href="<?php echo base_url(); ?> projects/deletemessage/<?php echo $media->project_id; ?> /<?php echo $media->id; ?>
/** * Edit User * */ public function edit() { $data['nav'] = 'users'; $this->template->title = lang('lang_manage_users'); $this->load->model('usergroups/usergroups_model'); $this->template->set_metadata('stylesheet', base_url() . 'themes/cp/css/smoothness/jquery-ui.css', 'link'); $this->template->set_metadata('js', 'js/jquery-ui.min.js', 'js_include'); $data['fields'] = ''; if ($this->events->active('fields')) { $this->load->model('fields/fields_model'); $data['fields'] = $this->fields_model->get_fields('users'); } $data['id'] = (int) $this->uri->segment(4, 0); $data['row'] = $this->users_model->get_user($data['id']); $data['notes'] = $this->users_model->user_notes($data['id']); $data['groups'] = $this->usergroups_model->get_groups(); $data['active_listings'] = $this->users_model->users_listings($data['id']); $data['total_order_amount'] = $this->orders_model->user_total_spent($data['id']); $data['total_orders'] = $this->orders_model->get_users_orders($data['id'], TRUE); $this->load->helper(array('form', 'url', 'html', 'date')); $this->load->library('form_validation'); $this->form_validation->set_rules('user_username', 'lang:lang_username', 'required|alpha_numeric|callback_username_check[' . $data['id'] . ']'); $this->form_validation->set_rules('user_email', 'lang:lang_email', 'required|valid_email'); $this->form_validation->set_rules('user_group', 'lang:lang_user_group', 'required|is_natural_no_zero|callback_usergroup_check[' . $data['id'] . ']'); $this->form_validation->set_rules('user_password', 'lang:lang_password', ''); $this->form_validation->set_rules('user_password_confirm', 'lang:lang_password_confirm', 'callback_password_check|matches[user_password]'); $this->events->trigger('users_controller/edit'); if ($data['fields'] != '') { foreach ($data['fields'] as $fields) { if ($fields['field_type'] == 'checkbox') { $this->form_validation->set_rules($fields['field_internal'] . '[]', $fields['field_name'], $fields['field_validation']); } else { $this->form_validation->set_rules($fields['field_internal'], $fields['field_name'], 'trim|' . $fields['field_validation']); } } } if ($this->form_validation->run() == FALSE) { $this->template->build('admin/users_edit', $data); } else { $user_id = (int) $this->input->post('user_id', TRUE); $update = array('user_username' => $this->input->post('user_username', TRUE), 'user_email' => $this->input->post('user_email', TRUE), 'user_group' => $this->input->post('user_group', TRUE), 'user_password' => $this->input->post('user_password', TRUE)); // Lets get the extra fields $fields_array = array(); if (isset($data['fields']) && !empty($data['fields'])) { foreach ($data['fields'] as $fields) { $value = $this->input->post($fields['field_internal'], TRUE); // Convert checkboxes to comma delimites. if (is_array($value)) { $value = implode(",", $value); } // Format seconds if ($fields['field_type'] == 'date') { $value = $value . ' 00:00:00'; $value = human_to_unix($value); } $fields_array['extra_field_' . $fields['field_internal']] = $value; } // Merge the fields_array into the original update_data array $update = array_merge($update, $fields_array); } $field_id = $this->users_model->edit_user($user_id, $update); $this->session->set_flashdata('msg', lang('lang_settings_saved')); redirect('admin/users/edit/' . $user_id); } }
function sendestimate($id = FALSE) { $this->load->helper(array('dompdf', 'file')); $this->load->library('parser'); $data["estimate"] = Invoice::find($id); //check if client contact has permissions for estimates and grant if not if (isset($data["estimate"]->company->client->id)) { $access = explode(",", $data["estimate"]->company->client->access); if (!in_array("107", $access)) { $client_estimate_permission = Client::find_by_id($data["estimate"]->company->client->id); $client_estimate_permission->access = $client_estimate_permission->access . ",107"; $client_estimate_permission->save(); } } $data["estimate"]->estimate_sent = date("Y-m-d"); $data["estimate"]->estimate_status = "Sent"; $data['items'] = InvoiceHasItem::find('all', array('conditions' => array('invoice_id=?', $id))); $data["core_settings"] = Setting::first(); $due_date = date($data["core_settings"]->date_format, human_to_unix($data["estimate"]->due_date . ' 00:00:00')); //Set parse values $parse_data = array('client_contact' => $data["estimate"]->company->client->firstname . ' ' . $data["estimate"]->company->client->lastname, 'client_company' => $data["estimate"]->company->name, 'due_date' => $due_date, 'estimate_id' => $data["core_settings"]->estimate_prefix . $data["estimate"]->reference, 'client_link' => $data["core_settings"]->domain, 'company' => $data["core_settings"]->company, 'logo' => '<img src="' . base_url() . '' . $data["core_settings"]->logo . '" alt="' . $data["core_settings"]->company . '"/>', 'invoice_logo' => '<img src="' . base_url() . '' . $data["core_settings"]->invoice_logo . '" alt="' . $data["core_settings"]->company . '"/>'); // Generate PDF $html = $this->load->view($data["core_settings"]->template . '/' . $data["core_settings"]->estimate_pdf_template, $data, true); $html = $this->parser->parse_string($html, $parse_data); $filename = $this->lang->line('application_estimate') . '_' . $data["estimate"]->reference; pdf_create($html, $filename, FALSE); //email $subject = $this->parser->parse_string($data["core_settings"]->estimate_mail_subject, $parse_data); $this->email->from($data["core_settings"]->email, $data["core_settings"]->company); if (!isset($data["estimate"]->company->client->email)) { $this->session->set_flashdata('message', 'error:This client company has no primary contact! Just add a primary contact.'); redirect('estimates/view/' . $id); } $this->email->to($data["estimate"]->company->client->email); $this->email->subject($subject); $this->email->attach("files/temp/" . $filename . ".pdf"); $email_estimate = read_file('./application/views/' . $data["core_settings"]->template . '/templates/email_estimate.html'); $message = $this->parser->parse_string($email_estimate, $parse_data); $this->email->message($message); if ($this->email->send()) { $this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_send_estimate_success')); $data["estimate"]->update_attributes(array('status' => 'Sent', 'sent_date' => date("Y-m-d"))); log_message('error', 'Estimate #' . $data["core_settings"]->estimate_prefix . $data["estimate"]->reference . ' has been send to ' . $data["estimate"]->company->client->email); } else { $this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_send_estimate_error')); log_message('error', 'ERROR: Estimate #' . $data["core_settings"]->estimate_prefix . $data["estimate"]->reference . ' has not been send to ' . $data["estimate"]->company->client->email . '. Please check your servers email settings.'); } unlink("files/temp/" . $filename . ".pdf"); redirect('estimates/view/' . $id); }
?> <tr id="row_num_<?php echo $lt->board_id; ?> "> <th scope="row"> <?php echo $lt->user_id; ?> </th> <td><?php echo $lt->contents; ?> </a></td> <td><time datetime="<?php echo mdate("%Y-%M-%j", human_to_unix($lt->reg_date)); ?> "><?php echo $lt->reg_date; ?> </time></td> <td><a href="#" class="comment_delete" vals="<?php echo $lt->board_id; ?> "><i class="icon-trash"></i>삭제</a></td> </tr> <?php } ?> </table> </div>
echo character_limiter($entry->title, 30); ?> </a></li> <?php } ?> </ul> </div> <div class="col-md-4"> <ul style="list-style-type: none;line-height:1.5;"> <h3>Info</h3> <?php foreach ($info as $entry) { ?> <li><span style="color:#777;margin-right:14px;"><?php echo date("m-d-Y", human_to_unix($entry->created)); ?> </span> <a href="/info/get/<?php echo $entry->id; ?> "><?php echo character_limiter($entry->title, 30); ?> </a></li> <?php } ?> </ul> </div> </div>
function getWorkoutData() { $this->load->model('Workout', 'workout'); $this->load->model('User', 'user'); $user->id = $this->session->userdata('id'); $result['user'] = $this->user->get_user($user); //print_r($result['user']); $this->load->model('Workout', 'workout'); $user->id = $this->session->userdata('id'); $result['workouts'] = $this->workout->get_user_workouts($user); for($i=0; $i<count($result['workouts']); $i++) { $post_time = $result['workouts'][$i]->workout_date; $post_date = human_to_unix($post_time); $post_date = timespan($post_date); $post_time_array = explode(", ", $post_date); $post_time_count = count($post_time_array); switch ($post_time_count) { case 0: break; case 1: $post_date = strtolower($post_time_array[0])." ago"; break; case 2: $post_date = strtolower($post_time_array[0])." ago"; break; default: $post_date = date("j \of M y", $post_time); } $result['workouts'][$i]->workout_date = $post_date; } return $result; }
<td><a rel="external" href="/main/view/<?php echo $li->id; ?> "><?php echo $li->content; ?> </a></td> <td><time datetime="<?php echo mdate("%Y-%M-%j", human_to_unix($li->created_on)); ?> "><?php echo $li->created_on; ?> </time></td> <td><time datetime="<?php echo mdate("%Y-%M-%j", human_to_unix($li->due_date)); ?> "><?php echo $li->due_date; ?> </time></td> </tr> <?php } ?> </tbody> <tfoot> <tr> <td colspan="4"><a href="/main/write/" class="btn btn-success" style="width:80px">쓰기</a></td> </tr> </tfoot>
echo date($core_settings->date_format, $unix); ?> </li> <li><span><?php echo $this->lang->line('application_due_date'); ?> :</span> <a class="label label-default <?php if ($invoice->status == "Paid") { echo 'label-success'; } if ($invoice->due_date <= date('Y-m-d') && $invoice->status != "Paid") { echo 'label-important tt" title="' . $this->lang->line('application_overdue'); } ?> "><?php $unix = human_to_unix($invoice->due_date . ' 00:00'); echo date($core_settings->date_format, $unix); ?> </a></li> <?php if (isset($invoice->company->vat)) { ?> <li><span><?php echo $this->lang->line('application_vat'); ?> :</span> <?php echo $invoice->company->vat; ?> </li> <?php
function preview($id = FALSE) { $this->load->helper(array('dompdf', 'file')); $this->load->library('parser'); $data["estimate"] = Invoice::find($id); $data['items'] = InvoiceHasItem::find('all', array('conditions' => array('invoice_id=?', $id))); $data["core_settings"] = Setting::first(); $due_date = date($data["core_settings"]->date_format, human_to_unix($data["estimate"]->due_date . ' 00:00:00')); $parse_data = array('due_date' => $due_date, 'estimate_id' => $data["estimate"]->reference, 'client_link' => $data["core_settings"]->domain, 'company' => $data["core_settings"]->company); $html = $this->load->view($data["core_settings"]->template . '/' . $data["core_settings"]->estimate_pdf_template, $data, true); $html = $this->parser->parse_string($html, $parse_data); $filename = $this->lang->line('application_estimate') . '_' . $data["core_settings"]->estimate_prefix . $data["estimate"]->reference; pdf_create($html, $filename, TRUE); }
"><?php $unix = human_to_unix($value->end_date . ' 00:00'); echo '<span class="hidden">' . $unix . '</span> '; echo date($core_settings->date_format, $unix); ?> </span></td> <td class="hidden-xs"><span class="label <?php if ($value->status == "Active" && $value->next_payment > date('Y-m-d')) { echo 'label-success'; } if ($value->next_payment < date('Y-m-d') && $value->status != "Inactive" && $value->end_date > date('Y-m-d')) { echo 'label-important tt" title="' . $this->lang->line('application_new_invoice_required'); } ?> "><?php $unix = human_to_unix($value->next_payment . ' 00:00'); echo '<span class="hidden">' . $unix . '</span> '; if ($value->end_date < date('Y-m-d')) { echo $this->lang->line('application_payments_closed'); } else { echo date($core_settings->date_format, $unix); } ?> </span></td> <td><span class="label <?php if ($value->status == "Active") { echo 'label-success'; } else { echo "label-important"; } ?>