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>'; }
public function chain($item = null) { list($item) = self::_wrapArgs(func_get_args(), 1); $__ = isset($this) && isset($this->_chained) && $this->_chained ? $this : underscore($item); $__->_chained = true; return $__; }
public function test_underscore() { $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, underscore($str)); } }
/** * Generates set of code based on data. * * @return array */ public function generate() { $this->prepareData($this->data); $columnFields = ['name', 'description', 'label']; $table = $this->describe->getTable($this->data['name']); foreach ($table as $column) { if ($column->isAutoIncrement()) { continue; } $field = strtolower($column->getField()); $method = 'set_' . $field; $this->data['camel'][$field] = lcfirst(camelize($method)); $this->data['underscore'][$field] = underscore($method); array_push($this->data['columns'], $field); if ($column->isForeignKey()) { $referencedTable = Tools::stripTableSchema($column->getReferencedTable()); $this->data['foreignKeys'][$field] = $referencedTable; array_push($this->data['models'], $referencedTable); $dropdown = ['list' => plural($referencedTable), 'table' => $referencedTable, 'field' => $field]; if (!in_array($field, $columnFields)) { $field = $this->describe->getPrimaryKey($referencedTable); $dropdown['field'] = $field; } array_push($this->data['dropdowns'], $dropdown); } } return $this->data; }
/** * Model definition. */ function define() { // Fields. $this->fields = array('id', 'slug', 'name', 'fields', 'inputs', 'subscribers', 'date_created', 'date_updated', 'fields' => function ($channel) { return orderby($channel['fields'], 'sort'); }, 'fields_by_id' => function ($channel) { return Channels::get_fields_by_id($channel); }, 'entries' => function ($channel) { return get("/entries", array('channel_id' => $channel['id'])); }, 'entry_count' => function ($channel) { return get("/entries/:count", array('channel_id' => $channel['id'])); }); $this->search_fields = array('name'); // Indexes. $this->indexes = array('id' => 'unique', 'slug' => 'unique'); // Query defaults. $this->query = array('order' => 'name ASC'); // Validate. $this->validate = array('required' => array('name', 'slug'), 'unique' => array('slug'), ':fields' => array('required' => array('id', 'name', 'type'), 'unique' => array('id'))); // Event binds. $this->binds = array('POST' => function ($event) { $data =& $event['data']; // Auto slug? if ($data['name'] && !$data['slug']) { $data['slug'] = hyphenate($data['name']); } }, 'POST.fields' => function ($event) { $data =& $event['data']; // Default field ID to underscored field name. if (isset($data['name']) && !$data['id']) { $data['id'] = underscore($data['name']); } }); }
/** * Transforms the field into the template. * * @param string $field * @param string $type * @return array */ protected function transformField($field, $type) { if ($type == 'camelize') { return ['field' => lcfirst(camelize($field)), 'accessor' => lcfirst(camelize('get_' . $field)), 'mutator' => lcfirst(camelize('set_' . $field))]; } return ['field' => lcfirst(underscore($field)), 'accessor' => lcfirst(underscore('get_' . $field)), 'mutator' => lcfirst(underscore('set_' . $field))]; }
public function collectionName() { if ($this->_ns) { return substr($this->_ns, strpos($this->_ns, '.') + 1); } $name = str_replace('\\', '_', underscore(get_called_class())); return preg_replace('/_model/', '', $name, 1); }
public function testCanWrapWithShortcutFunction() { // Skip if base function not present if (!function_exists('underscore')) { return $this->assertTrue(true); } $under = underscore($this->array); $this->assertInstanceOf('Underscore\\Underscore', $under); }
public function update($fields) { $fields['group_key'] = strtolower(preg_replace("/[^a-z\\-_\\d]/i", "", underscore($fields['group_title']))); $update_item = parent::update($fields); // Everytime you update a group, let's publish it. CI()->load->model('publish_queue_model'); CI()->publish_queue_model->publish($this->table, $update_item[$this->id_field], $update_item); return $update_item; }
/** * Fetches the default template for an action of this controller. It calculates * the file location, loads it into smarty and returns the results. * * @param string The name of the action to display the view of * @param array An array of parameters to send to the template. This generally come * from the route processor. * @return The rendered result * @author Ted Kulp **/ function render_template($action_name, $params = array()) { $default_template_dir = str_replace('_controller', '', underscore(get_class($this))); $path_to_default_template = join_path($this->get_component_directory(), 'views', $default_template_dir, underscore($action_name) . '.tpl'); if (is_file($path_to_default_template)) { return smarty()->fetch("file:{$path_to_default_template}"); } else { throw new SilkViewNotFoundException(); } }
/** * */ public function setLabel($label) { if (!is_string($label)) { throw new \InvalidArgumentException(); } $this->label = $label; if (empty($this->name)) { $this->name = underscore($label, '-'); } }
function downloadStudentResult($class_id, $topic_manage_id) { $this->CI->load->model('student_info_model'); $this->CI->load->model('class_model'); $this->CI->load->model('topic_model'); $this->CI->load->model('student_mark_model'); $this->CI->load->helper('inflector'); $this->CI->load->library(['utils']); $class = $this->CI->class_model->find_by_pkey($class_id); $topic = $this->CI->topic_model->getTopicIdByTopicManageId($topic_manage_id); $topics = array_filter(array_map('trim', explode(',', $topic->topic_id))); $studentsMark = $this->CI->student_mark_model->getMarkStudents($topics, $class_id); $studentsMark = $this->CI->utils->makeList('student_id', $studentsMark); $students = $this->CI->student_info_model->getAllStudents($class_id); $this->CI->load->library('PhpOffice/PHPExcel'); $sheet = $this->CI->phpexcel->getActiveSheet(); $title_class = underscore($class->class_name) . '.xls'; $row = 1; // header $sheet->setCellValue('A' . $row, 'STT'); $sheet->setCellValue('B' . $row, 'Họ tên'); $sheet->setCellValue('C' . $row, 'Điểm'); $sheet->setCellValue('D' . $row, 'Ghi chú'); $sheet->setCellValue('E' . $row, 'IP'); $listIndentities = array(); $ipList = array(); foreach ($students as $key => $student) { ++$row; $sheet->setCellValue("A{$row}", $student->indentity_number); $sheet->setCellValue("B{$row}", $student->fullname); if (isset($studentsMark[$student->student_id])) { $resultOfStudent = $studentsMark[$student->student_id]; if (!empty($resultOfStudent->ip_address) && in_array($resultOfStudent->ip_address, $ipList)) { $sheet->setCellValue("D{$row}", "Trùng địa chỉ IP"); } else { $sheet->setCellValue("D{$row}", ""); $ipList[] = $resultOfStudent->ip_address; } $sheet->setCellValue("E{$row}", $resultOfStudent->ip_address); $sheet->setCellValue("C{$row}", (double) $resultOfStudent->score); } else { $sheet->setCellValue("D{$row}", "Chưa làm bài"); $sheet->setCellValue("C{$row}", ""); } if (in_array($student->indentity_number, $listIndentities)) { $sheet->setCellValue("D{$row}", "Trùng mã số học sinh"); } $listIndentities[] = $student->indentity_number; } unset($sheet); header('Content-type: application/vnd.ms-excel'); header("Content-Disposition: attachment; filename=\"{$title_class}\""); $writer = new PHPExcel_Writer_Excel5($this->CI->phpexcel); $writer->save('php://output'); }
/** * The one and only autoload function for the system. This basically allows us * to remove a lot of the require_once BS and keep the file loading to as much * of a minimum as possible. */ function silk_autoload($class_name) { $files = scan_classes(); if (array_key_exists('class.' . underscore($class_name) . '.php', $files)) { require $files['class.' . underscore($class_name) . '.php']; } else { if (array_key_exists('class.' . strtolower($class_name) . '.php', $files)) { require $files['class.' . strtolower($class_name) . '.php']; } } }
function getModelName() { if ($this->modelName === null) { $className = get_class($this); $tmp = explode('_', underscore($className)); $prefix = pascal(implode('_', array_slice($tmp, 0, count($tmp) - 1))); //echo $prefix; $this->modelName = $prefix . 'Model'; } return $this->modelName; }
/** * Construct mongo. */ function __construct($params) { parent::__construct($params); // Adapter represents one collection at a time. if ($params['name']) { $this->collection = underscore($params['name']); } else { throw new Exception("MongoDB adapter requires param 'name'"); } // Connect! $this->connect(); }
public function __construct($id = false, $type = false) { if ($type !== false) { $this->_type = $type; } elseif ($this->_type === false) { $this->_type = underscore(get_class($this)); } if ($id !== false) { $this->_id = $id; } // TODO: PERHAPS $this->addCondition('id', ATTR_IS, $id); }
protected function render($action = null) { $request = $this->request; $action = $action ?? $this->action; $view = new \app\view\Engine(); $view->_data =& $this->_data; $view->includePath($this->bindViews()); $view->currentPath(preg_replace('/\\//', '/view/', underscore($this->controller), 1)); $view->render($action); $view->renderOver($this->bindOverviews()); return $this->response->capture(); }
public function cleanPath($path) { // Accent characters should be plain text $accent_translation = array('á' => 'a', 'Á' => 'A', 'à' => 'a', 'À' => 'A', 'ă' => 'a', 'Ă' => 'A', 'â' => 'a', 'Â' => 'A', 'å' => 'a', 'Å' => 'A', 'ã' => 'a', 'Ã' => 'A', 'ą' => 'a', 'Ą' => 'A', 'ā' => 'a', 'Ā' => 'A', 'ä' => 'ae', 'Ä' => 'AE', 'æ' => 'ae', 'Æ' => 'AE', 'ḃ' => 'b', 'Ḃ' => 'B', 'ć' => 'c', 'Ć' => 'C', 'ĉ' => 'c', 'Ĉ' => 'C', 'č' => 'c', 'Č' => 'C', 'ċ' => 'c', 'Ċ' => 'C', 'ç' => 'c', 'Ç' => 'C', 'ď' => 'd', 'Ď' => 'D', 'ḋ' => 'd', 'Ḋ' => 'D', 'đ' => 'd', 'Đ' => 'D', 'ð' => 'dh', 'Ð' => 'Dh', 'é' => 'e', 'É' => 'E', 'è' => 'e', 'È' => 'E', 'ĕ' => 'e', 'Ĕ' => 'E', 'ê' => 'e', 'Ê' => 'E', 'ě' => 'e', 'Ě' => 'E', 'ë' => 'e', 'Ë' => 'E', 'ė' => 'e', 'Ė' => 'E', 'ę' => 'e', 'Ę' => 'E', 'ē' => 'e', 'Ē' => 'E', 'ḟ' => 'f', 'Ḟ' => 'F', 'ƒ' => 'f', 'Ƒ' => 'F', 'ğ' => 'g', 'Ğ' => 'G', 'ĝ' => 'g', 'Ĝ' => 'G', 'ġ' => 'g', 'Ġ' => 'G', 'ģ' => 'g', 'Ģ' => 'G', 'ĥ' => 'h', 'Ĥ' => 'H', 'ħ' => 'h', 'Ħ' => 'H', 'í' => 'i', 'Í' => 'I', 'ì' => 'i', 'Ì' => 'I', 'î' => 'i', 'Î' => 'I', 'ï' => 'i', 'Ï' => 'I', 'ĩ' => 'i', 'Ĩ' => 'I', 'į' => 'i', 'Į' => 'I', 'ī' => 'i', 'Ī' => 'I', 'ĵ' => 'j', 'Ĵ' => 'J', 'ķ' => 'k', 'Ķ' => 'K', 'ĺ' => 'l', 'Ĺ' => 'L', 'ľ' => 'l', 'Ľ' => 'L', 'ļ' => 'l', 'Ļ' => 'L', 'ł' => 'l', 'Ł' => 'L', 'ṁ' => 'm', 'Ṁ' => 'M', 'ń' => 'n', 'Ń' => 'N', 'ň' => 'n', 'Ň' => 'N', 'ñ' => 'n', 'Ñ' => 'N', 'ņ' => 'n', 'Ņ' => 'N', 'ó' => 'o', 'Ó' => 'O', 'ò' => 'o', 'Ò' => 'O', 'ô' => 'o', 'Ô' => 'O', 'ő' => 'o', 'Ő' => 'O', 'õ' => 'o', 'Õ' => 'O', 'ø' => 'oe', 'Ø' => 'OE', 'ō' => 'o', 'Ō' => 'O', 'ơ' => 'o', 'Ơ' => 'O', 'ö' => 'oe', 'Ö' => 'OE', 'ṗ' => 'p', 'Ṗ' => 'P', 'ŕ' => 'r', 'Ŕ' => 'R', 'ř' => 'r', 'Ř' => 'R', 'ŗ' => 'r', 'Ŗ' => 'R', 'ś' => 's', 'Ś' => 'S', 'ŝ' => 's', 'Ŝ' => 'S', 'š' => 's', 'Š' => 'S', 'ṡ' => 's', 'Ṡ' => 'S', 'ş' => 's', 'Ş' => 'S', 'ș' => 's', 'Ș' => 'S', 'ß' => 'SS', 'ť' => 't', 'Ť' => 'T', 'ṫ' => 't', 'Ṫ' => 'T', 'ţ' => 't', 'Ţ' => 'T', 'ț' => 't', 'Ț' => 'T', 'ŧ' => 't', 'Ŧ' => 'T', 'ú' => 'u', 'Ú' => 'U', 'ù' => 'u', 'Ù' => 'U', 'ŭ' => 'u', 'Ŭ' => 'U', 'û' => 'u', 'Û' => 'U', 'ů' => 'u', 'Ů' => 'U', 'ű' => 'u', 'Ű' => 'U', 'ũ' => 'u', 'Ũ' => 'U', 'ų' => 'u', 'Ų' => 'U', 'ū' => 'u', 'Ū' => 'U', 'ư' => 'u', 'Ư' => 'U', 'ü' => 'ue', 'Ü' => 'UE', 'ẃ' => 'w', 'Ẃ' => 'W', 'ẁ' => 'w', 'Ẁ' => 'W', 'ŵ' => 'w', 'Ŵ' => 'W', 'ẅ' => 'w', 'Ẅ' => 'W', 'ý' => 'y', 'Ý' => 'Y', 'ỳ' => 'y', 'Ỳ' => 'Y', 'ŷ' => 'y', 'Ŷ' => 'Y', 'ÿ' => 'y', 'Ÿ' => 'Y', 'ź' => 'z', 'Ź' => 'Z', 'ž' => 'z', 'Ž' => 'Z', 'ż' => 'z', 'Ż' => 'Z', 'þ' => 'th', 'Þ' => 'Th', 'µ' => 'u', 'а' => 'a', 'А' => 'a', 'б' => 'b', 'Б' => 'b', 'в' => 'v', 'В' => 'v', 'г' => 'g', 'Г' => 'g', 'д' => 'd', 'Д' => 'd', 'е' => 'e', 'Е' => 'e', 'ё' => 'e', 'Ё' => 'e', 'ж' => 'zh', 'Ж' => 'zh', 'з' => 'z', 'З' => 'z', 'и' => 'i', 'И' => 'i', 'й' => 'j', 'Й' => 'j', 'к' => 'k', 'К' => 'k', 'л' => 'l', 'Л' => 'l', 'м' => 'm', 'М' => 'm', 'н' => 'n', 'Н' => 'n', 'о' => 'o', 'О' => 'o', 'п' => 'p', 'П' => 'p', 'р' => 'r', 'Р' => 'r', 'с' => 's', 'С' => 's', 'т' => 't', 'Т' => 't', 'у' => 'u', 'У' => 'u', 'ф' => 'f', 'Ф' => 'f', 'х' => 'h', 'Х' => 'h', 'ц' => 'c', 'Ц' => 'c', 'ч' => 'ch', 'Ч' => 'ch', 'ш' => 'sh', 'Ш' => 'sh', 'щ' => 'sch', 'Щ' => 'sch', 'ъ' => '', 'Ъ' => '', 'ы' => 'y', 'Ы' => 'y', 'ь' => '', 'Ь' => '', 'э' => 'e', 'Э' => 'e', 'ю' => 'ju', 'Ю' => 'ju', 'я' => 'ja', 'Я' => 'ja'); $path = str_replace(array_keys($accent_translation), array_values($accent_translation), $path); // Lowercase underscore $path = strtolower(underscore($path)); // Make sure it doesn't have a trailing slash $path = rtrim($path, '/'); // No spaces $path = trim($path); return $path; }
function get_alias($name) { $name = underscore($name); $query = $this->db->get_where('facilities', array('alias' => $name)); if ($query->num_rows() > 0) { $count = $query->num_rows(); $count++; $name = $name . '_' . $count; return $name; } else { return $name; } }
public function transform($transform, $string = '') { if (empty($string)) { return $string; } switch ($transform) { case 'underscore': return underscore($string); break; case 'humanize': return humanize($string); } }
public function insert_file($titre, $capacite, $extension, $url) { if ($this->session->userdata('logged_in')) { //On insert le message $data = array('auteur' => $this->session->userdata('numero'), 'url' => underscore($url), 'timestamp' => time(), 'extension' => $extension, 'titre' => $titre, 'capacite' => $capacite); $this->db->insert('begoo_file', $data); $last_insert = mysql_insert_id(); //On prévient ses amis de l'insertion du nouveau fichier en notification $message = '<span class="user_post">' . $this->connects->username($this->session->userdata('numero'), 0) . '</span> ' . $this->lang->line('note_file'); $url = '/file/cola/look_file/' . $last_insert; $this->prevent_my_friends($message, $url); //et on dit que tout s'est bien passé return $last_insert; } }
public function update_menu_info() { $data = array(); $menu_id = $this->input->post('menu_id', TRUE); $word = $data['menu_name'] = $this->input->post('menu_name', true); $data['menu_link'] = underscore($word); $data['menu_dropdown'] = $this->input->post('menu_dropdown', true); $data['menu_widget_order'] = $this->input->post('menu_widget_order', true); $data['menu_category'] = $this->input->post('menu_category', true); $data['menu_serial'] = $this->input->post('menu_serial', TRUE); $data['menu_status'] = $this->input->post('menu_status', true); $this->create_and_manage_model->update_menu_info($data, $menu_id); $message_data = array(); $message_data['successfull'] = "Updated This User Info Successfully!"; $this->session->set_userdata($message_data); redirect('super_admin/create_new_menu'); }
public function update($fields, $publish_mothod = 'draft') { // Additional updates which need to be made to event items only if (in_array($fields['type'], array('page_calendar_event', 'mirror_calendar_event_source'))) { $date_fields = array('content_start_date', 'content_end_date'); foreach ($date_fields as $date_field) { if (!empty($fields[$date_field . '_day'])) { $content_date = $fields[$date_field . '_day']; if (!empty($fields[$date_field . '_time'])) { $hour = $fields[$date_field . '_time'][0]; $mins = !empty($fields[$date_field . '_time'][1]) ? $fields[$date_field . '_time'][1] : '00'; if ($fields[$date_field . '_time'][2] == 'pm') { $hour = $hour + 12; } $content_date .= ' ' . $hour . ':' . $mins . ':00'; } else { $content_date .= ' 00:00:00'; } $fields[$date_field] = $content_date; } } $fields['file_title'] = $fields['title']; $fields['file_name'] = strtolower(preg_replace("/[^a-z\\-_\\d]/i", "", underscore($fields['file_title']))); } // Do update (through page model) $update_item = parent::update($fields, $publish_mothod); // When you update a mirror source let's see if a destination should be automatically set up. // TODO: This should be moved to the create method after CHW implementation. if (!empty($update_item['parent_id']) && !empty($update_item['type']) && $update_item['type'] == 'mirror_calendar_event_source') { $parent = CI()->page_model->getById($update_item['parent_id'], 'navigation'); // We only do this if this is inside a source. Parent source must always be set up manually. if ($parent[0]['type'] == 'mirror_calendar_source') { $mirror_parent = CI()->page_model->get(array('source_id' => $parent[0]['page_id']), 'navigation'); foreach ($mirror_parent as $mp) { // Is there a copy of this already in there? $mirror_item = CI()->page_model->get(array('parent_id' => $mp['page_id'], 'source_id' => $update_item['page_id']), 'navigation'); if (!count($mirror_item)) { // Create it $mirror_create = array('title' => $update_item['title'], 'module' => 'page_calendar', 'type' => 'mirror_calendar_event', 'parent_path' => $mp['path'], 'parent_id' => $mp['page_id'], 'source_id' => $update_item['page_id'], 'template_id' => $update_item['template_id'], 'page_id' => -1); CI()->page_calendar_model->update($mirror_create); } } } } return $update_item; }
public function updateKelas() { $splitKelas = preg_split("/ /", $_POST['kelas-edit-nama']); $this->tingkat = $splitKelas[0]; if (isset($splitKelas[2])) { $this->nama = $splitKelas[1] . " " . $splitKelas[2]; } else { $this->nama = $splitKelas[1]; } $this->slug = underscore($_POST['kelas-edit-nama']); $id = $_POST['kelas-edit-id']; // Database Query - Update $this->db->where('id', $id); $this->db->update('kelas', $this); // Back to Kelas after completed header('location:' . base_url() . index_page() . '/kelas'); }
private function native_upload($fild = '') { $ci =& get_instance(); $config = $this->config; if (!isset($_FILES[$fild]['name']) || trim($_FILES[$fild]['name']) == '') { return array('stat' => 'err', 'error' => 'empty'); } $org_name = $_FILES[$fild]['name']; $ci->load->helper('inflector'); list($name, $format) = explode('.', underscore($_FILES[$fild]['name'])); $config['file_name'] = md5(uniqid()) . '.' . $format; $ci->load->library('upload'); $ci->upload->initialize($config); if ($ci->upload->do_upload($fild)) { $done = $ci->upload->data(); return array('name' => $org_name, 'stat' => 'ok', 'size' => $done['file_size'], 'new_name' => $done['file_name']); } else { return array('name' => $org_name, 'stat' => 'err', 'config' => $config, 'error' => $ci->upload->display_errors()); } }
/** * Generates set of code based on data. * * @return array */ public function generate() { $this->prepareData($this->data); foreach ($this->data['columns'] as $column) { $field = strtolower($column->getField()); $accessor = 'get_' . $field; $mutator = 'set_' . $field; $this->data['camel'][$field] = ['field' => lcfirst(camelize($field)), 'accessor' => lcfirst(camelize($accessor)), 'mutator' => lcfirst(camelize($mutator))]; $this->data['underscore'][$field] = ['field' => lcfirst(underscore($field)), 'accessor' => lcfirst(underscore($accessor)), 'mutator' => lcfirst(underscore($mutator))]; if ($column->isForeignKey()) { $field = $column->getField(); array_push($this->data['indexes'], $field); $this->data['primaryKeys'][$field] = 'get_' . $this->describe->getPrimaryKey($column->getReferencedTable()); if ($this->data['isCamel']) { $this->data['primaryKeys'][$field] = camelize($this->data['primaryKeys'][$field]); } } $column->setReferencedTable(Tools::stripTableSchema($column->getReferencedTable())); } return $this->data; }
/** * Retrieves an instance of an ORM'd object for doing * find_by_* methods. * * @return mixed The object with the given name, or null if it's not registered * @author Ted Kulp **/ function get_orm_class($name, $try_prefix = true) { if (isset($this->classes[$name])) { return $this->classes[$name]; } elseif (isset($this->classes[underscore($name)])) { return $this->classes[underscore($name)]; } else { // Let's try to load the thing dynamically $name = camelize($name); if (class_exists($name)) { $this->classes[underscore($name)] = new $name(); return $this->classes[underscore($name)]; } else { if ($try_prefix) { return $this->get_orm_class('silk_' . $name, false); } else { var_dump('Class not found! -- ' . $name); return null; } } } }
/** * Generates set of code based on data. * * @return array */ public function generate() { $this->prepareData($this->data); foreach ($this->data['columns'] as $column) { $field = strtolower($column->getField()); $accessor = 'get_' . $field; $mutator = 'set_' . $field; $this->data['camel'][$field] = ['field' => lcfirst(camelize($field)), 'accessor' => lcfirst(camelize($accessor)), 'mutator' => lcfirst(camelize($mutator))]; $this->data['underscore'][$field] = ['field' => lcfirst(underscore($field)), 'accessor' => lcfirst(underscore($accessor)), 'mutator' => lcfirst(underscore($mutator))]; if ($column->isForeignKey()) { $referencedTable = Tools::stripTableSchema($column->getReferencedTable()); $this->data['foreignKeys'][$field] = plural($referencedTable); $singular = $field . '_singular'; $this->data['foreignKeys'][$singular] = singular($referencedTable); $this->data['primaryKeys'][$field] = 'get_' . $this->describe->getPrimaryKey($referencedTable); if ($this->data['isCamel']) { $this->data['primaryKeys'][$field] = camelize($this->data['primaryKeys'][$field]); } } } return $this->data; }
}); ///////////////////////////////////////////////////////////////////////////////////////////////////////// // reset field on save ///////////////////////////////////////////////////////////////////////////////////////////////////////// $(document).ajaxSuccess(function(event, xhr, settings) { if (settings.url == "{{ module_site_url }}manage_<?=underscore($stripped_master_table_name)?>/index/insert") { response = $.parseJSON(xhr.responseText); if(response.success == true){ <?php echo $var_data ?> = {update:new Array(), insert:new Array(), delete:new Array()}; $('#md_table_<?php echo $master_column_name; ?> tr').not(':first').remove(); __synchronize('<?=$real_input_id?>', <?=$var_data?>); } }else{ // avoid detail inserted twice on update update_url = "{{ module_site_url }}manage_<?=underscore($stripped_master_table_name)?>/index/update"; if(settings.url.substr(0, update_url.length) == update_url){ response = $.parseJSON(xhr.responseText); if(response.success == true){ $('#form-button-save').attr('disabled', 'disabled'); $('#save-and-go-back-button').attr('disabled', 'disabled'); $('#cancel-button').attr('disabled', 'disabled'); } } } }); </script>
public function cariUkm($id) { if ($this->input->post("cariukm") == "") { if ($this->input->post("min") == "") { if ($this->input->post("max") == "") { if ($this->input->post("urut") == "") { $a = 1; } else { $a = 0; } } else { $a = 0; } } else { $a = 0; } } else { $a = 0; } if ($a == 1) { redirect("home_controller/ukm/{$id}"); } if ($this->input->post("cariukm") != "") { $produk = underscore($this->input->post("cariukm")); } else { $produk = underscore("semua produk"); } if ($this->input->post("min") == "") { $min = 0; } else { $min = $min = $this->input->post("min"); } if ($this->input->post("max") == "") { $max = 0; } else { $max = $this->input->post("max"); } $urut = $this->input->post("urut"); $link = setPermalink($produk, $id); redirect("home_controller/pencarianUkm/{$link}/{$min}/{$max}/{$urut}/"); }