本文整理汇总了PHP中fuel_url函数的典型用法代码示例。如果您正苦于以下问题:PHP fuel_url函数的具体用法?PHP fuel_url怎么用?PHP fuel_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fuel_url函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _remap
public function _remap($method)
{
if (!$this->config->item('allow_forgotten_password', 'fuel')) {
show_404();
}
$this->load->library('session');
$this->load->helper('string');
$this->load->module_model(FUEL_FOLDER, 'fuel_users_model');
$this->load->module_language(FUEL_FOLDER, 'fuel');
$email = fuel_uri_segment(2);
$reset_key = fuel_uri_segment(3);
$user = $this->fuel_users_model->find_one('MD5(email) = "' . $email . '" AND MD5(reset_key) = "' . $reset_key . '"');
if (isset($user->id)) {
$new_pwd = random_string('alnum', 8);
$user->password = $new_pwd;
$user->reset_key = '';
if ($user->save()) {
$params['to'] = $user->email;
$params['subject'] = lang('pwd_reset_subject_success');
$params['message'] = lang('pwd_reset_email_success', $new_pwd);
$params['use_dev_mode'] = FALSE;
if ($this->fuel->notification->send($params)) {
$this->session->set_flashdata('success', lang('pwd_reset_success'));
$this->fuel->logs->write(lang('auth_log_pass_reset', $user->user_name, $this->input->ip_address()), 'debug');
} else {
$this->session->set_flashdata('error', $this->email->print_debugger());
}
} else {
$this->session->set_flashdata('error', lang('error_pwd_reset'));
}
} else {
$this->session->set_flashdata('error', lang('error_pwd_reset'));
}
redirect(fuel_url('login'));
}
开发者ID:ressphere,项目名称:cb_iloveproperty,代码行数:35,代码来源:reset.php
示例2: tree
function tree($just_published = FALSE)
{
$CI =& get_instance();
$CI->load->helper('array');
$return = array();
$where = array();
if ($just_published) {
$sql['where'] = array('published' => 'yes');
}
$pages = $this->find_all_array_assoc('location', $where, 'location asc');
foreach ($pages as $key => $val) {
$parts = explode('/', $val['location']);
$label = array_pop($parts);
$parent = implode('/', $parts);
if (!empty($pages[$parent]) || strrpos($val['location'], '/') === FALSE) {
$return[$key]['label'] = $label;
$return[$key]['parent_id'] = empty($parent) ? 0 : $parent;
} else {
// if orphaned... then put them in the _orphans folder
if (empty($return['_orphans'])) {
$return['_orphans'] = array('label' => '_orphans', 'parent_id' => 0, 'location' => null);
}
$return[$key]['label'] = $key;
$return[$key]['parent_id'] = '_orphans';
}
if ($val['published'] == 'no') {
$return[$key]['attributes'] = array('class' => 'unpublished', 'title' => 'unpublished');
}
$return[$key]['location'] = fuel_url('pages/edit/' . $val['id']);
}
$return = array_sorter($return, 'label', 'asc');
return $return;
}
开发者ID:joeydi,项目名称:FUEL-CMS,代码行数:33,代码来源:pages_model.php
示例3: tree
function tree()
{
$CI =& get_instance();
$CI->load->model('categories_model');
$CI->load->model('categories_to_articles_model');
$return = array();
$categories = $CI->categories_model->find_all(array(), 'id asc');
$categories_to_articles = $CI->categories_to_articles_model->find_all('', 'categories.name asc');
$cat_id = -1;
foreach($categories as $category)
{
$cat_id = $category->id;
$return[] = array('id' => $category->id, 'label' => $category->name, 'parent_id' => 0, 'location' => fuel_url('categories/edit/'.$category->id));
}
$i = $cat_id +1;
foreach($categories_to_articles as $val)
{
$attributes = ($val->published == 'no') ? array('class' => 'unpublished', 'title' => 'unpublished') : NULL;
$return[$i] = array('id' => $i, 'label' => $val->title, 'parent_id' => $val->category_id, 'location' => fuel_url('articles/edit/'.$val->article_id), 'attributes' => $attributes);
$i++;
}
return $return;
}
开发者ID:rodrigowebe,项目名称:FUEL-CMS,代码行数:26,代码来源:articles_model.php
示例4: upload
public function upload()
{
$this->load->library('form_builder');
$this->load->module_model(FUEL_FOLDER, 'fuel_navigation_groups_model');
$this->load->module_model(FUEL_FOLDER, 'fuel_navigation_model');
$this->js_controller_params['method'] = 'upload';
if (!empty($_POST)) {
$params = $this->input->post();
if (!empty($_FILES['file']['name'])) {
$error = FALSE;
$file_info = $_FILES['file'];
$params['file_path'] = $file_info['tmp_name'];
$params['var'] = $this->input->post('variable') ? $this->input->post('variable', TRUE) : 'nav';
$params['language'] = $this->input->post('language', TRUE);
if (!$this->fuel->navigation->upload($params)) {
$error = TRUE;
}
if ($error) {
add_error(lang('error_upload'));
} else {
// change list view page state to show the selected group id
$this->fuel->admin->set_notification(lang('navigation_success_upload'), Fuel_admin::NOTIFICATION_SUCCESS);
redirect(fuel_url('navigation?group_id=' . $params['group_id']));
}
} else {
add_error(lang('error_upload'));
}
}
$fields = array();
$nav_groups = $this->fuel_navigation_groups_model->options_list('id', 'name', array('published' => 'yes'), 'id asc');
if (empty($nav_groups)) {
$nav_groups = array('1' => 'main');
}
// load custom fields
$this->form_builder->load_custom_fields(APPPATH . 'config/custom_fields.php');
$fields['group_id'] = array('type' => 'select', 'options' => $nav_groups, 'module' => 'navigation_group');
$fields['file'] = array('type' => 'file', 'accept' => '');
$fields['variable'] = array('label' => 'Variable', 'value' => $this->input->post('variable') ? $this->input->post('variable', TRUE) : 'nav', 'size' => 10);
$fields['language'] = array('type' => 'select', 'options' => $this->fuel->language->options(), 'first_option' => lang('label_select_one'));
$fields['clear_first'] = array('type' => 'enum', 'options' => array('yes' => 'yes', 'no' => 'no'));
$fields['__fuel_module__'] = array('type' => 'hidden');
$fields['__fuel_module__']['value'] = $this->module;
$fields['__fuel_module__']['class'] = '__fuel_module__';
$fields['__fuel_module_uri__'] = array('type' => 'hidden');
$fields['__fuel_module_uri__']['value'] = $this->module_uri;
$fields['__fuel_module_uri__']['class'] = '__fuel_module_uri__';
$this->form_builder->set_fields($fields);
$this->form_builder->submit_value = '';
$this->form_builder->use_form_tag = FALSE;
$this->form_builder->set_field_values($_POST);
$vars['instructions'] = lang('navigation_import_instructions');
$vars['form'] = $this->form_builder->render();
$vars['back_action'] = ($this->fuel->admin->last_page() and $this->fuel->admin->is_inline()) ? $this->fuel->admin->last_page() : fuel_uri($this->module_uri);
$crumbs = array($this->module_uri => $this->module_name, lang('action_upload'));
$this->fuel->admin->set_titlebar($crumbs);
$this->fuel->admin->render('upload', $vars, Fuel_admin::DISPLAY_NO_ACTION);
}
开发者ID:ressphere,项目名称:cb_iloveproperty,代码行数:57,代码来源:navigation.php
示例5: tree
function tree($just_published = false)
{
$CI =& get_instance();
$CI->load->helper('array');
$data = array();
$where = array();
$group_id = (!empty($this->filters['group_id'])) ? $this->filters['group_id'] : $this->group_id;
$where['group_id'] = $group_id;
if ($just_published) $where['published'] = 'yes';
$all_nav = $this->find_all_array_assoc('id', $where);
$where = array();
if (!empty($parent))
{
$parent = $this->find_one_array(array('location' => $parent));
$where = array('group_id' => $group_id, 'parent_id' => $parent['id']);
}
else
{
$where = array('group_id' => $group_id);
}
$data = $this->find_all_array($where, 'precedence, location asc');
$return = array();
$i = 0;
foreach($data as $key => $val)
{
$return[$key] = $val;
if ($val['parent_id'] != 0) {
if (empty($all_nav[$val['parent_id']]))
{
if (empty($return['_orphans']))
{
$return['_orphans'] = array('label' => '_orphans', 'parent_id' => 0, 'location' => null);
}
$return[$key]['parent_id'] = '_orphans';
}
}
else
{
$return[$key]['parent_id'] = 0;
}
if ($val['published'] == 'no')
{
$return[$key]['attributes'] = array('class' => 'unpublished', 'title' => 'unpublished');
}
$return[$key]['location'] = fuel_url('navigation/edit/'.$val['id']);
}
//$return = array_sorter($return, 'label', 'asc');
return $return;
}
开发者ID:rodrigowebe,项目名称:FUEL-CMS,代码行数:57,代码来源:navigation_model.php
示例6: _remap
function _remap($module, $segs = NULL)
{
$remote_ips = $this->fuel->config('webhook_remote_ip');
$is_web_hook = $this->fuel->auth->check_valid_ip($remote_ips);
// check if it is CLI or a web hook otherwise we need to validate
$validate = (php_sapi_name() == 'cli' or defined('STDIN') or $is_web_hook) ? FALSE : TRUE;
// Only super admins can execute builds for now
if ($validate and !$this->fuel->auth->is_super_admin()) {
show_error(lang('error_no_access', fuel_url()));
}
// call before build hook
$params = array('module' => $module);
$GLOBALS['EXT']->_call_hook('before_build', $params);
// get the type of build which can either be CSS or JS
$type = array_shift($segs);
$valid_types = array('css', 'js');
if (!empty($type) and in_array($type, $valid_types)) {
$this->load->helper('file');
// get the folder name if it exists
$segs_str = implode('/', $segs);
// explode on colon to separate the folder name from the file name
$seg_parts = explode(':', $segs_str);
// set the folder name to lookin
$folder = $seg_parts[0];
// set the file name if one exists
$filename = !empty($seg_parts[1]) ? $seg_parts[1] : 'main.min';
// get list of files
$files_path = assets_server_path($folder, $type);
$_files = get_filenames($files_path, TRUE);
$files = array();
foreach ($_files as $file) {
// trim to normalize path
$replace = trim(assets_server_path('', $type), '/');
$files[] = str_replace($replace, '', trim($file, '/'));
}
$output_params['type'] = $type;
$output_params['whitespace'] = TRUE;
$output_params['destination'] = assets_server_path($filename . '.' . $type, $type, $module);
$output = $this->asset->optimize($files, $output_params);
echo lang('module_build_asset', strtoupper($type), $output_params['destination']);
} else {
if ($module != 'index' and $this->fuel->modules->exists($module) and $this->fuel->modules->is_advanced($this->fuel->{$module})) {
$results = $this->fuel->{$module}->build();
if ($results === FALSE) {
echo lang('error_no_build');
}
} else {
// run default FUEL optimizations if no module is passed
$this->optimize_js();
$this->optimize_css();
}
}
// call after build hook
$GLOBALS['EXT']->_call_hook('after_build', $params);
}
开发者ID:scotton34,项目名称:sample,代码行数:55,代码来源:build.php
示例7: reset_page_state
/**
* Resets the page state for the current page by default
*
* @access public
* @param string (optional)
* @return void
*/
public function reset_page_state($state_key = NULL)
{
if (empty($state_key)) {
$state_key = $this->fuel->admin->get_state_key();
}
if (!empty($state_key)) {
$session_key = $this->fuel->auth->get_session_namespace();
$user_data = $this->fuel->auth->user_data();
$user_data['page_state'] = array();
$this->session->set_userdata($session_key, $user_data);
redirect(fuel_url($state_key));
}
}
开发者ID:kbjohnson90,项目名称:FUEL-CMS,代码行数:20,代码来源:Fuel_base_controller.php
示例8: tree
public function tree()
{
$CI =& get_instance();
// first get the permissions
$perms_list = $CI->fuel_permissions_model->find_all_array_assoc('name', array(), 'name asc');
$perms = array();
foreach ($perms_list as $perm => $perm_val) {
$sub = explode('/', $perm);
$parent_id = isset($sub[1]) ? $sub[0] : 0;
$sub_attributes = $perm_val['active'] == 'no' ? array('class' => 'unpublished', 'title' => 'unpublished') : NULL;
$perms[$perm] = array('label' => $perm_val['description'], 'parent_id' => $parent_id, 'location' => fuel_url('permissions/edit/' . $perm_val['id']), 'attributes' => $sub_attributes);
}
return $perms;
}
开发者ID:huayuxian,项目名称:FUEL-CMS,代码行数:14,代码来源:fuel_permissions_model.php
示例9: tree
function tree($just_published = FALSE)
{
$CI =& get_instance();
$CI->load->module_model(BLOG_FOLDER, 'blog_posts_model');
$CI->load->helper('array');
$return = array();
$where = $just_published ? $where = array('published' => 'yes') : array();
$comments = $this->find_all($where, 'title asc');
foreach ($comments as $comment) {
if (!isset($return[$comment->post_id])) {
$return['p_' . $comment->post_id] = array('id' => 'p_' . $comment->post_id, 'label' => $comment->title, 'location' => fuel_url('blog/posts/edit/' . $comment->post_id));
}
$label = !empty($comment->author_name) ? $comment->author_name : $comment->author_email;
$attributes = $comment->published == 'no' ? array('class' => 'unpublished', 'title' => 'unpublished') : NULL;
$return['c_' . $comment->id] = array('id' => $comment->id, 'label' => $label, 'parent_id' => 'p_' . $comment->post_id, 'location' => fuel_url('blog/posts/edit/' . $comment->post_id), 'attributes' => $attributes);
}
$return = array_sorter($return, 'label', 'asc');
return $return;
}
开发者ID:kieranklaassen,项目名称:FUEL-CMS,代码行数:19,代码来源:blog_comments_model.php
示例10: _remap
function _remap($method)
{
if (!$this->config->item('allow_forgotten_password', 'fuel')) {
show_404();
}
$this->load->library('session');
$this->load->helper('string');
$this->load->module_model(FUEL_FOLDER, 'users_model');
$this->load->module_language(FUEL_FOLDER, 'fuel');
$email = fuel_uri_segment(2);
$reset_key = fuel_uri_segment(3);
$user = $this->users_model->find_one('MD5(email) = "' . $email . '" AND MD5(reset_key) = "' . $reset_key . '"');
if (isset($user->id)) {
$new_pwd = random_string('alnum', 8);
$user->password = $new_pwd;
$user->reset_key = '';
if ($user->save()) {
$this->load->library('email');
$config['wordwrap'] = TRUE;
$this->email->initialize($config);
$this->email->from($this->config->item('from_email', 'fuel'), $this->config->item('site_name', 'fuel'));
$this->email->to($user->email);
$this->email->subject(lang('pwd_reset_subject_success'));
$msg = lang('pwd_reset_email_success', $new_pwd);
$this->email->message($msg);
if ($this->email->send()) {
$this->session->set_flashdata('success', lang('pwd_reset_success'));
} else {
$this->session->set_flashdata('error', $this->email->print_debugger());
}
} else {
exit('yo3');
$this->session->set_flashdata('error', lang('error_pwd_reset'));
}
} else {
$this->session->set_flashdata('error', lang('error_pwd_reset'));
}
redirect(fuel_url('login'));
}
开发者ID:kieranklaassen,项目名称:FUEL-CMS,代码行数:39,代码来源:reset.php
示例11: tree
function tree($just_published = FALSE)
{
$CI =& get_instance();
$CI->load->module_model(BLOG_FOLDER, 'blog_categories_model');
$CI->load->module_model(FUEL_FOLDER, 'fuel_relationships_model');
$CI->load->helper('array');
$return = array();
$where = $just_published ? $where = array('published' => 'yes') : array();
$categories = $CI->blog_categories_model->find_all($where, 'precedence asc');
$posts_to_categories = $CI->fuel_relationships_model->find_by_candidate($this->_tables['blog_posts'], $this->_tables['blog_categories']);
if (empty($posts_to_categories)) {
return array();
}
foreach ($categories as $category) {
$return[$category->id] = array('id' => $category->id, 'parent_id' => 0, 'label' => $category->name, 'location' => fuel_url('blog/categories/edit/' . $category->id), 'precedence' => $category->precedence);
}
foreach ($posts_to_categories as $val) {
$attributes = $val->candidate_published == 'no' ? array('class' => 'unpublished', 'title' => 'unpublished') : NULL;
$return['p_' . $val->candidate_id . '_c' . $val->foreign_id] = array('label' => $val->candidate_title, 'parent_id' => $val->foreign_id, 'location' => fuel_url('blog/posts/edit/' . $val->candidate_id), 'attributes' => $attributes, 'precedence' => 100000);
}
$return = array_sorter($return, 'precedence', 'asc');
return $return;
}
开发者ID:pwhsueh,项目名称:voting,代码行数:23,代码来源:blog_posts_model.php
示例12: tree
function tree($just_published = FALSE)
{
$CI =& get_instance();
$CI->load->module_model(BLOG_FOLDER, 'blog_categories_model');
$CI->load->module_model(BLOG_FOLDER, 'blog_posts_to_categories_model');
$CI->load->helper('array');
$return = array();
$where = $just_published ? $where = array('published' => 'yes') : array();
$categories = $CI->blog_categories_model->find_all($where, 'id asc');
$posts_to_categories = $CI->blog_posts_to_categories_model->find_all($where, 'title asc');
if (empty($posts_to_categories)) {
return array();
}
foreach ($categories as $category) {
$return[$category->id] = array('id' => $category->id, 'parent_id' => 0, 'label' => $category->name, 'location' => fuel_url('blog/categories/edit/' . $category->id));
}
foreach ($posts_to_categories as $val) {
$attributes = $val->published == 'no' ? array('class' => 'unpublished', 'title' => 'unpublished') : NULL;
$return['p_' . $val->post_id] = array('label' => $val->title, 'parent_id' => $val->category_id, 'location' => fuel_url('blog/posts/edit/' . $val->post_id), 'attributes' => $attributes);
}
$return = array_sorter($return, 'parent_id', 'asc');
return $return;
}
开发者ID:randombrad,项目名称:FUEL-CMS,代码行数:23,代码来源:blog_posts_model.php
示例13: tree
/**
* Tree view that puts categories in a hierarchy based on their parent value
*
* @access public
* @param boolean Determines whether to return just published pages or not (optional... and ignored in the admin)
* @return array An array that can be used by the Menu class to create a hierachical structure
*/
public function tree($just_published = FALSE)
{
$return = array();
$where = $just_published ? array('published' => 'yes') : array();
$categories = $this->find_all_array($where);
foreach ($categories as $category) {
$attributes = (isset($category['published']) and $category['published'] == 'no') ? array('class' => 'unpublished', 'title' => 'unpublished') : NULL;
$return[] = array('id' => $category['id'], 'label' => $category['name'], 'parent_id' => $category['parent_id'], 'location' => fuel_url('categories/edit/' . $category['id']), 'attributes' => $attributes);
}
return $return;
}
开发者ID:scotton34,项目名称:sample,代码行数:18,代码来源:fuel_categories_model.php
示例14: upload
public function upload($inline = FALSE)
{
$this->load->helper('file');
$this->load->helper('security');
$this->load->library('form_builder');
$this->load->library('upload');
$this->js_controller_params['method'] = 'upload';
if (!empty($_POST) and !empty($_FILES)) {
$params['upload_path'] = sys_get_temp_dir();
$params['allowed_types'] = 'php|html|txt';
// to ensure we check the proper mime types
$this->upload->initialize($params);
// Hackery to ensure that a proper php mimetype is set.
// Would set in mimes.php config but that may be updated with the next version of CI which does not include the text/plain
$this->upload->mimes['php'] = array('application/x-httpd-php', 'application/php', 'application/x-php', 'text/php', 'text/x-php', 'application/x-httpd-php-source', 'text/plain');
if ($this->upload->do_upload('file')) {
$upload_data = $this->upload->data();
$error = FALSE;
// read in the file so we can filter it
$file = read_file($upload_data['full_path']);
// sanitize the file before saving
$file = $this->_sanitize($file);
$id = $this->input->post('id', TRUE);
$name = $this->input->post('name', TRUE);
$language = $this->input->post('language', TRUE);
if (empty($name)) {
$name = current(explode('.', $file_info['name']));
}
if ($id) {
$save['id'] = $id;
}
$save['name'] = $name;
$save['view'] = $file;
$save['language'] = $language;
$save['date_added'] = datetime_now();
$save['last_modified'] = date('Y-m-d H:i:s', time() + 1);
// to prevent window from popping up after upload
$id = $this->model->save($save);
if (!$id) {
add_error(lang('error_upload'));
} else {
// change list view page state to show the selected group id
$this->fuel->admin->set_notification(lang('blocks_success_upload'), Fuel_admin::NOTIFICATION_SUCCESS);
redirect(fuel_url('blocks/edit/' . $id));
}
} else {
$error_msg = $this->upload->display_errors('', '');
add_error($error_msg);
}
}
$fields = array();
$blocks = $this->model->options_list('id', 'name', array('published' => 'yes'), 'name');
$fields['name'] = array('label' => lang('form_label_name'), 'type' => 'inline_edit', 'options' => $blocks, 'module' => 'blocks');
$fields['file'] = array('type' => 'file', 'accept' => '', 'required' => TRUE);
$fields['id'] = array('type' => 'hidden');
$fields['language'] = array('type' => 'hidden');
$field_values = $_POST;
$common_fields = $this->_common_fields($field_values);
$fields = array_merge($fields, $common_fields);
$this->form_builder->hidden = array();
$this->form_builder->set_fields($fields);
$this->form_builder->set_field_values($_POST);
$this->form_builder->submit_value = '';
$this->form_builder->use_form_tag = FALSE;
$vars['instructions'] = lang('blocks_upload_instructions');
$vars['form'] = $this->form_builder->render();
$vars['back_action'] = ($this->fuel->admin->last_page() and $this->fuel->admin->is_inline()) ? $this->fuel->admin->last_page() : fuel_uri($this->module_uri);
//$vars['back_action'] = fuel_uri($this->module_uri);
$crumbs = array($this->module_uri => $this->module_name, lang('action_upload'));
$this->fuel->admin->set_titlebar($crumbs);
$this->fuel->admin->render('upload', $vars, Fuel_admin::DISPLAY_NO_ACTION);
}
开发者ID:ressphere,项目名称:cb_iloveproperty,代码行数:72,代码来源:blocks.php
示例15: fuel_url
/**
* Returns a URL specific to the advanced module (e.g. http://localhost/fuel/{advanced_module}/create)
*
* @access public
* @param string The URI path relative to the advanced module (optional)
* @return string
*/
public function fuel_url($uri = '')
{
$uri = trim($uri, '/');
return fuel_url($this->uri_path() . '/' . $uri);
}
开发者ID:ressphere,项目名称:cb_iloveproperty,代码行数:12,代码来源:Fuel_advanced_module.php
示例16: fuel_url
?>
" alt="Layouts" /> <a href="<?php
echo fuel_url('users');
?>
">Users & Permissions</a></h2>
<p>FUEL CMS users are created in the users module in the admin. A single user can subscribe to as many permissions as necessary however, the permissions to manage users and permisisons
gives a user admin level control so use wisely. Furthermore, certain permissions may not be applicable to your setup.</p>
<h2 id="cache" class="ico ico_manage_cache"><img src="<?php
echo img_path('icons/ico_page_lightning.png', 'fuel');
?>
" alt="Layouts" /> <a href="<?php
echo fuel_url('manage/cache');
?>
">Page Cache</a></h2>
<p>FUEL CMS uses a cache to speed up the delivery of pages. Sometimes changes are made to static layouts or blocks and your changes may not be immediately reflected. This is most likely
related to the cache which can be <a href="<?php
echo fuel_url('manage/cache');
?>
">cleared here</a>.</p>
<h2 id="settings" class="ico ico_settings"><img src="<?php
echo img_path('icons/ico_table_gear.png', 'fuel');
?>
" alt="Layouts" /> <a href="<?php
echo fuel_url('settings');
?>
">Settings</a></h2>
<p>Although it's unlikely you'll need to worry too much about this, some modules have extra configuration settings you can manage in the CMS. For example, you may have a blog settings area if the blog is installed.</p>
开发者ID:kbjohnson90,项目名称:FUEL-CMS,代码行数:29,代码来源:index.php
示例17: _tree
/**
* Returns a tree array structure that can be used by a public "tree" method on models inheriting from this class
*
* @access protected
* @param string The name of the model's property to use to generate the tree. Options are 'foreign_keys', 'has_many' or 'belongs_to'
* @return array An array that can be used by the Menu class to create a hierachical structure
*/
protected function _tree($prop = NULL)
{
$CI =& get_instance();
$return = array();
if (!empty($this->foreign_keys) or !empty($this->has_many) or !empty($this->belongs_to)) {
if (empty($prop)) {
if (!empty($this->foreign_keys)) {
$p = $this->foreign_keys;
} else {
if (!empty($this->has_many)) {
$p = $this->has_many;
}
}
} else {
if (property_exists($this, $prop)) {
$p = $this->{$prop};
}
}
$key_field = key($p);
$loc_field = $key_field;
// get related model info
$rel_module = current($p);
if (is_array($rel_module)) {
$rel_module = current($rel_module);
}
$rel_module_obj = $CI->fuel->modules->get($rel_module, FALSE);
if (!$rel_module_obj) {
return array();
}
$rel_model = $rel_module_obj->model();
$rel_key_field = $rel_model->key_field();
$rel_display_field = $rel_module_obj->info('display_field');
$module = strtolower(get_class($this));
$module_obj = $CI->fuel->modules->get($module, FALSE);
if (!$module_obj) {
return array();
}
$model = $module_obj->model();
$display_field = $module_obj->info('display_field');
$rel_col = !empty($rel_module_obj->default_col) ? $rel_module_obj->default_col : $this->key_field();
$rel_order = !empty($rel_module_obj->default_order) ? $rel_module_obj->default_order : 'asc';
if ($prop == 'foreign_keys') {
$groups = $rel_model->find_all_array(array(), $rel_model->key_field() . ' asc');
$children = $this->find_all_array(array(), $key_field . ' asc');
$g_key_field = $rel_model->key_field();
$loc_field = $g_key_field;
} else {
if ($prop == 'has_many') {
$CI->load->module_model(FUEL_FOLDER, 'fuel_relationships_model');
$groups = $rel_model->find_all_array(array(), $rel_col . ' ' . $rel_order);
$children = $CI->fuel_relationships_model->find_by_candidate($this->table_name(), $rel_model->table_name(), NULL, 'array');
$key_field = 'foreign_id';
$g_key_field = 'candidate_id';
$display_field = 'candidate_' . $display_field;
$loc_field = $key_field;
} else {
if ($prop == 'belongs_to') {
$CI->load->module_model(FUEL_FOLDER, 'fuel_relationships_model');
$groups = $rel_model->find_all_array(array(), $rel_col . ' ' . $rel_order);
$children = $CI->fuel_relationships_model->find_by_candidate($rel_model->table_name(), $this->table_name(), NULL, 'array');
$key_field = 'candidate_id';
$g_key_field = 'foreign_id';
$display_field = 'foreign_' . $display_field;
$loc_field = $key_field;
}
}
}
// now get this models records
foreach ($children as $child) {
$used_groups[$child[$key_field]] = $child[$key_field];
$attributes = (isset($child['published']) and $child['published'] == 'no' or isset($child['active']) and $child['active'] == 'no') ? array('class' => 'unpublished', 'title' => 'unpublished') : NULL;
$return['g' . $child[$g_key_field] . '_c_' . $child[$key_field]] = array('parent_id' => $child[$key_field], 'label' => $child[$display_field], 'location' => fuel_url($module_obj->info('module_uri') . '/edit/' . $child[$loc_field]), 'attributes' => $attributes);
}
foreach ($groups as $group) {
if (isset($used_groups[$group[$rel_key_field]])) {
$attributes = (isset($group['published']) and $group['published'] == 'no' or isset($group['active']) and $group['active'] == 'no') ? array('class' => 'unpublished', 'title' => 'unpublished') : NULL;
$return[$group[$rel_key_field]] = array('id' => $group[$rel_key_field], 'parent_id' => 0, 'label' => $group[$rel_display_field], 'location' => fuel_url($rel_module_obj->info('module_uri') . '/edit/' . $group[$rel_key_field]), 'attributes' => $attributes);
}
}
}
return $return;
}
开发者ID:prgoncalves,项目名称:Beatcrumb-web,代码行数:89,代码来源:base_module_model.php
示例18: lang
</ul>
</div>
</div>
<div id="notification" class="notification">
<?php
echo $notifications;
?>
</div>
<div id="main_content">
<div id="main_content_inner">
<p class="instructions"><?php
echo lang('profile_instructions');
?>
</p>
<form method="post" action="<?php
echo fuel_url('my_profile/edit/');
?>
" id="form">
<?php
echo $form;
?>
</form>
</div>
</div>
开发者ID:randombrad,项目名称:FUEL-CMS,代码行数:31,代码来源:my_profile.php
示例19: fuel_url
?>
</h2>
</div>
<div class="clear"></div>
<div id="notification" class="notification">
<?php
echo $notifications;
?>
</div>
<div id="main_content" class="noaction">
<div id="main_content_inner">
<a href="<?php
echo fuel_url('tools/validate');
?>
" id="back_to">< Back to page selection</a>
<div style="float: right;" class="btn">
<form action="<?php
echo site_url($this->uri->uri_string());
?>
" method="post" id="reload_form">
<a href="javascript:$('#reload_form').submit()" class="ico ico_refresh">Reload All</a>
<input type="hidden" name="pages_serialized" value="<?php
echo $pages_serialized;
?>
" />
</form>
</div>
<div id="validation_status"><h2 id="validation_status_text"></h2>
开发者ID:kieranklaassen,项目名称:FUEL-CMS,代码行数:31,代码来源:run.php
示例20: lang
echo lang('modal_yes_btn');
?>
</a></li>
</ul>
</div>
<div class="clear"></div>
</div>
<?php
}
?>
<div id="main_content_inner">
<p class="instructions"><?php
echo $this->instructions;
?>
</p>
<form method="post" action="<?php
echo fuel_url($this->module_uri . '/' . $action . '/' . $id);
?>
" enctype="multipart/form-data" id="form">
<?php
echo $form;
?>
</form>
</div>
</div>
开发者ID:kieranklaassen,项目名称:FUEL-CMS,代码行数:31,代码来源:module_create_edit.php
注:本文中的fuel_url函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论