function displayData($data = null, $type = 'string', $row = array(), $wrap_tag_open = '', $wrap_tag_close = '') { $CI =& get_instance(); if (is_null($data) || is_array($data) || strcmp($data, '') === 0 && !count($row)) { return $data; } switch ($type) { case 'string': break; case 'humanize': $CI->load->helper("inflector"); $data = humanize($data); break; case 'date': str2USDate($data); break; case 'datetime': $data = str2USDate($data); break; case 'money': $data = '$' . number_format((double) $data, 2); break; } return $wrap_tag_open . $data . $wrap_tag_close; }
/** * Returns a List of Drivers */ public static function get_drivers() { $drivers = array(); /* * Humanize the Driver Name */ function humanize($segs) { $prepped = array(); foreach ($segs as $v) { $prepped[] = ucfirst($v); } return trim(ucfirst(str_replace('Driver', '', implode(' ', $prepped)))); } /* * Driverize the Driver Name */ function driverize($segs) { foreach ($segs as &$v) { ucfirst($v); } return str_replace('_driver', '', implode('_', $segs)); } foreach (scandir(__DIR__ . '/payment_drivers') as $driver) { if ($driver[0] != '.') { $ex = explode('_', str_replace('.php', '', $driver)); $drivers[driverize($ex)] = humanize($ex); } } return $drivers; }
function foundation_form_input($name, $args = array()) { $isValid = form_error($name) ? false : true; if (!empty($args['default_value'])) { $default_value = $args['default_value']; } else { $default_value = null; } $class = !empty($args['class']) ? $args['class'] : ''; $node = "<label>" . humanize($name); if (!empty($args['as'])) { switch ($args['as']) { case 'collection': if (!empty($args['collection'])) { if ($args['allow_blank']) { $args['collection'] = array_merge(array(" " => " "), $args['collection']); } $node .= form_dropdown($name, $args['collection'], set_value($name)); } break; case 'text': $node .= form_textarea($name, set_value($name, $default_value)); break; default: # ... break; } } else { $node .= form_input($name, set_value($name, $default_value)); } $node .= form_error($name, '<div class="error">', '</div>'); $node .= "</label>"; return $node; }
function add_viewdata() { $CI =& get_instance(); $ctrler = $CI->router->fetch_class(); // only for pages after login if ($ctrler != 'login') { // fallback when mTitle is not set / empty if (empty($CI->mTitle)) { // take controller or action name as title if ($CI->mAction == 'index') { $CI->mTitle = humanize($CI->mCtrler); } else { $CI->mTitle = humanize($CI->mAction); } } // fallback when mViewFile is not set if (empty($CI->mViewFile)) { if ($CI->mAction == 'index') { $CI->mViewFile = $CI->mCtrler; } else { $CI->mViewFile = $CI->mCtrler . '/' . $CI->mAction; } } if ($ctrler != 'home') { // add an "active" entry at the end of breadcrumb (based on mTitle) $CI->mBreadcrumb[] = array('name' => $CI->mTitle); } // push to mViewData before rendering $CI->mViewData['breadcrumb'] = $CI->mBreadcrumb; } // render output $view_data = empty($CI->mViewData) ? NULL : $CI->mViewData; $CI->load->view($CI->mViewFile, $view_data); }
public function test_humanize() { $strs = array('this_is_the_string' => 'This Is The String', 'this_is_another_one' => 'This Is Another One', 'i-am-playing-a-trick' => 'I-am-playing-a-trick', 'what_do_you_think-yo?' => 'What Do You Think-yo?'); foreach ($strs as $str => $expect) { $this->assertEquals($expect, humanize($str)); } }
/** * Retrieve the info for a module * * @access public * @param string module name * @return array */ public function info($module) { if (!empty($this->_cached[$module])) { return $this->_cached[$module]; } //if (!$this->is_allowed($module)) return FALSE; if (!isset($this->_modules[$module])) { return FALSE; } $CI =& get_instance(); $CI->load->helper('inflector'); $CI->load->helper('string'); $defaults = array('module_name' => humanize($module), 'module_uri' => $module, 'model_name' => $module . '_model', 'model_location' => '', 'view_location' => '', 'display_field' => '', 'preview_path' => '', 'views' => array('list' => '_layouts/module_list', 'create_edit' => '_layouts/module_create_edit', 'delete' => '_layouts/module_delete'), 'permission' => $module, 'js_controller' => 'BaseFuelController', 'js_controller_params' => array(), 'js' => '', 'edit_method' => 'find_one_array', 'instructions' => lang('module_instructions_default', $module), 'filters' => array(), 'archivable' => TRUE, 'table_actions' => array('EDIT', 'VIEW', 'DELETE'), 'item_actions' => array('save', 'view', 'publish', 'activate', 'delete', 'duplicate', 'create'), 'list_actions' => array(), 'rows_selectable' => TRUE, 'clear_cache_on_save' => TRUE, 'create_action_name' => 'Create', 'configuration' => '', 'nav_selected' => NULL, 'default_col' => NULL, 'default_order' => NULL, 'sanitize_input' => TRUE, 'sanitize_images' => TRUE, 'displayonly' => FALSE, 'language' => ''); $return = array(); $params = $this->_modules[$module]; foreach ($defaults as $key => $val) { if (isset($params[$key])) { $return[$key] = $params[$key]; } else { $return[$key] = $val; } } $this->_cached[$module] = $return; return $return; }
function __construct() { parent::__construct(); if ($this->router->is_module) { $this->load->add_package_path(MODPATH . $this->router->module_name); } $this->CI = $this; $this->config->load('app'); $this->output->enable_profiler($this->config->item('enable_profiler')); if (!$this->input->is_cli_request()) { if ($this->config->config['cookie_path'] == '') { $x = explode($_SERVER['HTTP_HOST'], $this->config->item('base_url')); $cookie_path = rtrim($x[1], '/'); $this->CI->config->set_item('cookie_path', $cookie_path == '' ? '/' : $cookie_path); } } $this->load->helper(array('url', 'form', 'x', 'text', 'inflector', 'xform')); $this->_name = $this->uri->rsegments[1]; $this->_page_title = $this->config->item('page_title') . ' - ' . (empty($this->uri->rsegments[1]) ? '' : humanize($this->uri->rsegments[1])) . (empty($this->uri->rsegments[2]) ? ' ' : ' ' . humanize($this->uri->rsegments[2])); if ($this->CI->config->item('lang_use_gettext')) { $this->lang->load_gettext(); } $this->load->library('session'); $this->load->library('xparam'); if (!isset($this->auth)) { $this->load->library('xauth', null, 'auth'); } // if ($this->config->item('debug')) { // $this->load->driver('cache', array('adapter' => 'dummy')); // } else { // reekoheek: cache should always be run $this->load->driver('cache', array('adapter' => 'file', 'backup' => 'file')); // } }
private function get_menu_item($menu_id) { $this->load->library('table'); $this->load->model('menu_item'); $content_vars = array(); // Template da tabela $this->table->set_template(array('table_open' => '<table class="table table-striped table-bordered">')); $this->table->set_heading('Label', 'Ordem', 'Tipo', 'Link', 'Ações'); $query = $this->menu_item->get_by_field('menu_id', $menu_id, array('field' => 'ordem', 'order' => 'asc')); foreach ($query->result() as $row) { switch ($row->tipo) { case 'post': $link = $this->get_titulo_postagem($row->href); break; case 'posts': $link = $this->get_titulo_categoria($row->href); break; case 'link': $link = $row->href; break; case 'funcional': $link = humanize($row->href); break; case 'submenu': $link = $this->get_titulo_menu($row->href); break; } $this->table->add_row($row->label, $row->ordem, humanize($row->tipo), $link, div(array('class' => 'btn-group btn-group-sm')) . anchor('admin/menuitens/edit/' . $row->id, glyphicon('edit'), array('class' => 'btn btn-default')) . '<button class="btn btn-default" onClick="return confirmar(\'' . site_url('admin/menuitens/delete/' . $row->id) . '\');">' . glyphicon('trash') . '</button>' . div(null, true)); } $content_vars['menu_id'] = $menu_id; $content_vars['listagem'] = $this->table->generate(); return $this->load->view('menuitens/index', $content_vars, TRUE); }
protected function generate_crud($table, $subject = '') { // create CRUD object $this->load->library('Grocery_CRUD'); $crud = new grocery_CRUD(); $crud->set_table($table); // auto-generate subject if (empty($subject)) { $crud->set_subject(humanize(singular($table))); } // load settings from: application/config/grocery_crud.php $this->load->config('grocery_crud'); $this->mCrudUnsetFields = $this->config->item('grocery_crud_unset_fields'); if ($this->config->item('grocery_crud_unset_jquery')) { $crud->unset_jquery(); } if ($this->config->item('grocery_crud_unset_jquery_ui')) { $crud->unset_jquery_ui(); } if ($this->config->item('grocery_crud_unset_print')) { $crud->unset_print(); } if ($this->config->item('grocery_crud_unset_export')) { $crud->unset_export(); } if ($this->config->item('grocery_crud_unset_read')) { $crud->unset_read(); } foreach ($this->config->item('grocery_crud_display_as') as $key => $value) { $crud->display_as($key, $value); } // other custom logic to be done outside $this->mCrud = $crud; return $crud; }
function tabs($tabs, $position = 'left', $active = FALSE, $id_prefix = '') { if (!$tabs) { return ''; } if (!is_array($tabs)) { return $tabs; } $menu = '<ul class="nav nav-tabs">'; $content = '<div class="tab-content">'; foreach ($tabs as $name => $tab) { if ($tab) { $name = strtolower(underscore($name)); $menu .= '<li'; $content .= '<div id="' . $id_prefix . $name . '" class="tab-pane'; if ($active === FALSE || $active === $name) { $menu .= ' class="active"'; $content .= ' active'; $active = TRUE; } $menu .= '><a href="#' . $id_prefix . $name . '" data-toggle="tab" class="no-ajax">' . humanize(preg_replace('/tab(\\d)+_/i', '', $name)) . '</a></li>'; $content .= '">' . $tab . '</div>'; } } $menu .= '</ul>'; $content .= '</div>'; return '<div class="tabbable tabs-' . $position . '">' . ($position != 'below' ? $menu . $content : $content . $menu) . '</div>'; }
function vasp_breadcrumbs($trail_delimeter = '»', $open_tag = '<p>', $close_tag = '</p>') { $CI =& get_instance(); $CI->load->helper('inflector'); $breadcrumbs = array(); if (count($breadcrumbs) == 0) { $url_parts = array(); $segment = $CI->uri->segment_array(); $last_segment = array_pop($segment); foreach ($segment as $url_ref) { // Skip if we already have this breadcrumb and its not admin //if(in_array($url_ref, $url_parts) or $url_ref == 'admin') continue; $url_parts[] = $url_ref; $breadcrumbs[] = array('name' => humanize(str_replace('-', ' ', $url_ref)), 'url' => implode('/', $url_parts), 'current_page' => FALSE); } $url_parts[] = $last_segment; $breadcrumbs[] = array('name' => humanize(str_replace('-', ' ', $last_segment)), 'url' => implode('/', $url_parts), 'current_page' => TRUE); } // Build HTML to output $html = $open_tag . '<a href="' . site_url('home') . '">Home</a> '; foreach ($breadcrumbs as $breadcrumb) { if (!$breadcrumb['current_page']) { $html .= $trail_delimeter . ' ' . '<a href="' . site_url($breadcrumb['url']) . '">' . $breadcrumb['name'] . '</a> '; } elseif (current_url() === site_url('home') || uri_string() === '') { $html .= ''; } else { $html .= $trail_delimeter . ' ' . $breadcrumb['name']; } } $html .= $close_tag; echo $html; }
function settings($module) { $this->load->helper('form'); $this->load->add_package_path(APPPATH . 'packages/shipping/' . $module . '/'); $this->load->library($module); //ok, in order for the most flexibility, and in case someone wants to use javascript or something //the form gets pulled directly from the library. if (count($_POST) > 0) { $check = $this->{$module}->check(); if (!$check) { $this->session->set_flashdata('message', sprintf(lang('settings_updated'), $module)); redirect($this->config->item('admin_folder') . '/shipping'); } else { //set the error data and form data in the flashdata $this->session->set_flashdata('message', $check); $this->session->set_flashdata('post', $_POST); redirect($this->config->item('admin_folder') . '/shipping/settings/' . $module); } } elseif ($this->session->flashdata('post')) { $data['form'] = $this->{$module}->form($this->session->flashdata('post')); } else { $data['form'] = $this->{$module}->form(); } $data['module'] = $module; $data['page_title'] = sprintf(lang('shipping_settings'), humanize($module)); $this->view($this->config->item('admin_folder') . '/shipping_module_settings', $data); }
function student_name($regno, $details) { foreach ($details as $std) { if ($std["regno"] == $regno) { return humanize($std["name"]); } } }
function is_date_before_date($date, $bdate) { if (!$this->is_date($date) || strtotime($date) > strtotime($this->CI->input->post($bdate))) { $this->set_message('is_date_before_date', "The %s date must come before <strong>" . humanize($bdate) . '</strong>.'); return FALSE; } return TRUE; }
protected function make_label($id, $label_name = "", $options = array()) { $option = array_merge($options, array("for" => $id)); if (!is_string($label_name) || strlen($label_name) < 2) { $label_name = $id; } return $this->content_tag("label", humanize($label_name), $option); }
public function ajax_update() { $this->_validate(); $bday = $this->input->post('bday'); $data = array('name' => humanize($this->input->post('name')), 'mname' => humanize($this->input->post('mname')), 'lname' => humanize($this->input->post('lname')), 'gender' => humanize($this->input->post('gender')), 'age' => humanize($this->input->post('age')), 'bday' => date('Y-m-d', strtotime($bday)), 'citizenship' => humanize($this->input->post('citizenship')), 'occupation' => humanize($this->input->post('occupation')), 'status' => humanize($this->input->post('status')), 'purok' => humanize($this->input->post('purok')), 'resAddress' => humanize($this->input->post('resAddress')), 'perAddress' => humanize($this->input->post('perAddress')), 'email' => $this->input->post('email'), 'telNum' => $this->input->post('telNum'), 'cpNum' => $this->input->post('cpNum'), 'latlong' => $this->input->post('latlong')); $this->InfoTable_model->update(array('resident_id' => $this->input->post('resident_id')), $data); echo json_encode(array("status" => TRUE)); }
function getHierarchy ($titleSort=false) { $this->CI->load->helper(array('url', 'glib_directory', 'inflector')); $pathBase = realpath(APPPATH.'controllers'); $pathThis = __FILE__; foreach (rscandir($pathBase) as $pathController) { if ( ($pathController != $pathThis) && (!strpos($pathController, 'index.html')) ) { // Make Path Relative to Web Root $controller = rtrim(substr($pathController, strlen($pathBase) + 1 , -4 ), '/'); // Clean The Default Controllers From The List $defaultController = $GLOBALS["CI"]->router->routes["default_controller"]; if (strpos($controller,$defaultController)) $controller = preg_replace("/\/$defaultController/i", "", $controller); elseif ($controller == $defaultController) $controller = '/'; // Send As Output If Not a Private Controller if (substr($controller, 0, 1) != '_') { // Set The Title if ($controller == '/') { $title = 'Home'; } else { $title = humanize(ltrim(substr($controller, strrpos($controller, '/')), '/')); } // Add The Directory $data["$controller"] = $title; // Get The Methods When Necessary if (!strpos($pathController, $defaultController.'.php')) { require_once $pathController; if (!strpos($controller, '/')) $className = $controller; else $className = substr($controller, strripos($controller, '/') + 1); $methods = $this->getMethods(ucfirst($className)); foreach ($methods as $method) if ($method != 'index') { $data["$controller"] = $title; } } } } } if ($titleSort) asort($data); else ksort($data); return $data; }
function index() { $this->load->helper('file'); $this->load->helper('inflector'); $data->page_name = 'Options'; $theme_folder = get_dir_file_info(BASEPATH . 'application/views/themes', FALSE, TRUE); foreach ($theme_folder as $key => $value) { if (is_dir(BASEPATH . 'application/views/themes/' . $key)) { $themes[$key]->folder = $key; $themes[$key]->name = humanize($key); } } $data->themes = $themes; if ($_POST) { $this->load->library('validation'); $fields['lifestream_title'] = 'Lifestream Title'; $fields['admin_email'] = 'Admin Email'; $fields['new_password'] = '******'; $fields['new_password_confirm'] = 'New Password Confirm'; $fields['per_page'] = 'Items Per Page'; $this->validation->set_fields($fields); $rules['lifestream_title'] = "trim|required"; $rules['admin_email'] = "trim|required|valid_email"; $rules['new_password'] = "******"; $rules['new_password_confirm'] = "trim"; $rules['per_page'] = "numeric"; $this->validation->set_rules($rules); if ($this->validation->run() == FALSE) { $data->errors = $this->validation->error_string; $this->load->view('admin/_header', $data); $this->load->view('admin/options', $data); $this->load->view('admin/_footer'); } else { //set new password if required if ($this->validation->new_password && $this->validation->new_password != '') { $password = md5($this->validation->new_password); $this->db->update('users', array('user_pass' => $password), array('ID' => $this->data->user->ID)); } //set admin email $this->db->update('users', array('user_email' => $this->validation->admin_email), array('ID' => $this->data->user->ID)); unset($_POST['new_password']); unset($_POST['new_password_confirm']); //save options foreach ($_POST as $key => $value) { $option_array[$key]->option_name = $key; $option_array[$key]->option_value = $value; } foreach ($option_array as $option) { $this->option_model->add_option($option); } header('Location: ' . $this->config->item('base_url') . 'admin/options'); } } else { $this->load->view('admin/_header', $data); $this->load->view('admin/options', $data); $this->load->view('admin/_footer'); } }
public function __construct() { parent::__construct(); $this->load->helper('inflector'); $this->load->model('user_model', 'users'); $this->mTitle = humanize($this->mAction); $this->_push_breadcrumb('Account'); $this->_push_breadcrumb($this->mTitle); }
public function __construct() { parent::__construct(); $this->load->helper('inflector'); $this->load->library('form_builder'); $this->mTitle = humanize($this->mAction); $this->_push_breadcrumb('Example'); $this->_push_breadcrumb($this->mTitle); }
function clean_header($array) { $CI = get_instance(); $CI->load->helper('inflector'); foreach ($array as $a) { $arr[] = humanize($a); } return $arr; }
public function display($rack_id) { $this->load->helper('inflector'); // Verify rack_id if ($rack_id == -1 || !$this->rack_model->rack_check($rack_id)) { redirect(base_url('rack/notfound')); } $data['rack_data'] = $this->rack_model->get_rack_info($rack_id); $data['rack_data']['address'] = humanize($data['rack_data']['address']); $this->load->library('googlemaps'); $config['minifyJS'] = TRUE; $config['zoom'] = '14'; $config['center'] = $data['rack_data']['lat'] . ', ' . $data['rack_data']['lon']; $this->googlemaps->initialize($config); $marker = array(); $marker['position'] = $data['rack_data']['lat'] . ', ' . $data['rack_data']['lon']; $marker['title'] = $data['rack_data']['address']; $rack_url = base_url() . "rack/" . $data['rack_data']['rack_id']; $marker['infowindow_content'] = "<h4 class=\"title\">Bike Rack</h4><p><span class=\"region\">" . $data['rack_data']['address'] . "</span><br><span class=\"rack_count\">Number of racks: " . $data['rack_data']['rack_count'] . "</span></p>"; if ($this->rack_model->is_favourited($rack_id, $this->session->userdata('email'))) { $icon_url = base_url() . "assets/images/noun_project/star.svg"; } else { if ($data['rack_data']['rack_count'] == 1) { $icon_url = base_url() . "assets/images/noun_project/bike-rack-1.svg"; } else { if ($data['rack_data']['rack_count'] == 2) { $icon_url = base_url() . "assets/images/noun_project/bike-rack-2.svg"; } else { if ($data['rack_data']['rack_count'] == 3) { $icon_url = base_url() . "assets/images/noun_project/bike-rack-3.svg"; } else { $icon_url = base_url() . "assets/images/noun_project/bike-rack.svg"; } } } } $marker['marker_image'] = "new google.maps.MarkerImage('" . $icon_url . "', null, null, null, new google.maps.Size(64,64))"; $this->googlemaps->add_marker($marker); $data['map'] = $this->googlemaps->create_map(); $data['page_name'] = "rack-page"; // Show and allow adding comments $data['comments'] = $this->rack_model->get_comments($rack_id); // Gets the rating for a rack $data['rating'] = $this->rack_model->get_rating($rack_id); $data['is_logged_in'] = $this->user_model->is_logged_in(); $this->load->helper('form'); $this->load->library('form_validation'); $this->form_validation->set_error_delimiters('<div class="alert alert-danger fade in">', '<button type="button" class="close" data-dismiss="alert">×</button></div>'); $this->form_validation->set_rules('text', 'text', 'required'); if ($this->form_validation->run() === TRUE) { $this->rack_model->add_comment($rack_id); redirect('rack/' . $rack_id . ''); } $this->template->title('Rack - ' . $data['rack_data']['address'] . '', 'Kuklos')->build('pages/rack/home', $data); }
public function up() { $this->dbforge->modify_column('blog', array('comments_enabled' => array('type' => 'set', 'constraint' => array('no', '1 day', '1 week', '2 weeks', '1 month', '3 months', 'always'), 'null' => false, 'default' => 'always'))); $this->db->update('blog', array('comments_enabled' => '3 months')); // Lets update the comments table with these new awesome fields $this->dbforge->modify_column('comments', array('module_id' => array('name' => 'entry_id', 'type' => 'varchar', 'constraint' => 255, 'null' => true), 'name' => array('name' => 'user_name', 'type' => 'varchar', 'constraint' => 255), 'email' => array('name' => 'user_email', 'type' => 'varchar', 'constraint' => 255), 'website' => array('name' => 'user_website', 'type' => 'varchar', 'constraint' => 255, 'null' => true))); $this->dbforge->add_column('comments', array('entry_title' => array('type' => 'char', 'constraint' => 255, 'null' => false), 'entry_key' => array('type' => 'varchar', 'constraint' => 100, 'null' => false), 'entry_plural' => array('type' => 'varchar', 'constraint' => 100, 'null' => false), 'uri' => array('type' => 'varchar', 'constraint' => 255, 'null' => true), 'cp_uri' => array('type' => 'varchar', 'constraint' => 255, 'null' => true))); $comments = $this->db->get('comments')->result(); foreach ($comments as &$comment) { // What did they comment on switch ($comment->module) { case 'gallery': $comment->module = plural($comment->module); break; case 'gallery-image': $comment->module = 'galleries'; $ci->load->model('galleries/gallery_image_m'); if ($item = $ci->gallery_image_m->get($comment->module_id)) { continue 2; } break; } $this->load->model('addons/module_m'); // Use the old comment logic to grab title names, then we can never have to use this junk again if (in_array($comment->module, array('blog', 'pages'))) { // Grab an item switch ($comment->module) { case 'blog': // Get this one article out of the db $item = $this->db->get_where('blog', array('id' => $comment->entry_id))->row(); $comment->entry_title = $item->title; $comment->uri = 'blog/' . date('Y/m', $item->created_on) . '/' . $item->slug; $comment->entry_key = 'blog:post'; $comment->entry_plural = 'blog:posts'; $comment->cp_uri = 'admin/' . $comment->module . '/preview/' . $item->id; break; case 'pages': // Get this one page out of the db $item = $this->db->get_where('pages', array('id' => $comment->entry_id))->row(); $comment->entry_title = $item->title; $comment->uri = $item->uri; $comment->entry_key = 'pages:page'; $comment->entry_plural = 'pages:pages'; $comment->cp_uri = 'admin/' . $comment->module . '/preview/' . $item->id; break; } } else { $comment->entry_title = $comment->module . ' #' . $comment->entry_id; $comment->entry_key = humanize(singular($comment->module)); $comment->entry_plural = humanize(plural($comment->module)); } // Save this comment again $this->db->where('id', $comment->id)->update('comments', $comment); } }
function validates_confirmation_of($model, $field, $options = array()) { $params = array_merge($_GET, $_POST); $model_name = strtolower(get_class($model)); if (isset($params[$model_name][$field])) { if ($params[$model_name]["confirm_{$field}"] != $model->fields[$field]) { add_error_message_to($model, $field, !$options['custom_message'] ? pluralize(humanize($field)) . " do not match." : $options['custom_message']); } unset($model->fields["confirm_{$field}"]); } }
public function __construct() { parent::__construct(); $this->_load_models(); $this->_load_helpers(); $this->_base = $this->router->fetch_module() . '/' . $this->router->fetch_class(); $this->_primary_key = $this->{$this->router->fetch_class()}->primary_key; $this->data['id'] = $this->_primary_key; $this->data['title'] = strlen($this->router->fetch_class()) > 3 ? humanize($this->router->fetch_class()) : strtoupper($this->router->fetch_class()); $this->data['base'] = $this->_base; $this->data['breadcrumb'] = ['<i class="fa fa-home"></i> Home', strlen($this->router->fetch_module()) > 3 ? humanize($this->router->fetch_module()) : strtoupper($this->router->fetch_module()), strlen($this->router->fetch_class()) > 3 ? humanize($this->router->fetch_class()) : strtoupper($this->router->fetch_class())]; }
function __construct() { parent::__construct(); $this->load->helper(array('directory', 'inflector')); $languages = directory_map(APPPATH . '/language'); foreach ($languages as $key => $language) { if (is_array($language)) { if (is_numeric(array_search('mcb_lang.php', $language))) { $this->languages[$key] = humanize($key); } } } }
public function transform($transform, $string = '') { if (empty($string)) { return $string; } switch ($transform) { case 'underscore': return underscore($string); break; case 'humanize': return humanize($string); } }
protected function _generate_view($data = array(), $template = 'template') { // $data['menu'] = $this->_generate_menu(); $data['menu'] = $this->global_model->get_menu2(); $data['page_header'] = humanize($this->uri->segment(1)); $data['page_header_desc'] = 'List'; $data['loading_text'] = "<i class='fa fa-refresh fa-spin'></i> Menyimpan..."; $data['segment1'] = $this->uri->segment(1); $data['segment2'] = $this->uri->segment(2); $data['csrf_token'] = $this->security->get_csrf_token_name(); $data['csrf_hash'] = $this->security->get_csrf_hash(); $this->load->view($template, $data); }
public function get_create($id = false) { $result = parent::get_create(); $values = Backend::get('values'); $values = $values ? $values : array(); if (!empty($id)) { $values['name'] = $id; $values['title'] = humanize($id); } $values['active'] = 1; Backend::add('values', $values); return $result; }
function add_header() { $first = true; foreach ($this->fields as $key => $field) { if ($first) { $first = false; } else { echo ','; } $name = !empty($this->names[$key]) ? humanize($this->names[$key]) : humanize($field); echo '"' . str_replace('"', '\\"', $name) . '"'; } echo "\n"; }