本文整理汇总了PHP中Base_module_model::form_fields方法的典型用法代码示例。如果您正苦于以下问题:PHP Base_module_model::form_fields方法的具体用法?PHP Base_module_model::form_fields怎么用?PHP Base_module_model::form_fields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base_module_model
的用法示例。
在下文中一共展示了Base_module_model::form_fields方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function form_fields($values = array())
{
$fields = parent::form_fields();
$fields['last_modified']['type'] = 'hidden';
$fields['date_added']['type'] = 'hidden';
return $fields;
}
示例2: array
function form_fields($values = array())
{
$fields = parent::form_fields();
$fields['video_name']['required'] = TRUE;
$fields['video_path']['required'] = TRUE;
return $fields;
}
示例3: array
function form_fields($values = array())
{
$fields = parent::form_fields($values);
$CI =& get_instance();
$CI->load->module_model(BLOG_FOLDER, 'blog_users_model');
$blog_config = $CI->fuel->blog->config();
$user_options = $CI->blog_users_model->options_list();
$user = $this->fuel->auth->user_data();
$user_value = !empty($values['author_id']) ? $values['author_id'] : $user['id'];
$author_comment = $fields['author_id']['comment'];
$fields['author_id'] = array('label' => 'Author', 'type' => 'select', 'options' => $user_options, 'first_option' => 'Select an author...', 'value' => $user_value, 'comment' => $author_comment);
if (!isset($values['allow_comments'])) {
$fields['allow_comments']['value'] = $CI->fuel->blog->config('allow_comments') ? 'yes' : 'no';
}
if (!empty($blog_config['formatting'])) {
$blog_config['formatting'] = (array) $blog_config['formatting'];
if (count($blog_config['formatting']) == 1) {
$fields['formatting'] = array('type' => 'hidden', 'options' => current($blog_config['formatting']), 'default' => $fields['formatting']['default']);
if (strtolower($blog_config['formatting'][0]) == 'markdown') {
$fields['content']['markdown'] = TRUE;
$fields['excerpt']['markdown'] = TRUE;
}
} else {
$fields['formatting'] = array('type' => 'select', 'options' => $blog_config['formatting'], 'default' => $fields['formatting']['default']);
}
}
$fields['title']['style'] = 'width: 500px;';
$fields['slug']['style'] = 'width: 500px;';
$fields['content']['style'] = 'width: 680px; height: 400px';
$fields['excerpt']['style'] = 'width: 680px;';
$fields['published']['order'] = 10000;
if (!is_true_val($CI->fuel->blog->config('allow_comments'))) {
unset($fields['allow_comments']);
}
unset($fields['content_filtered']);
$fields['date_added']['type'] = 'hidden';
// so it will auto add
//$fields['date_added']['type'] = 'datetime'; // so it will auto add
$fields['last_modified']['type'] = 'hidden';
// so it will auto add
$fields['slug']['order'] = 2.5;
// for older versions where the schema order was different
$fields['main_image']['folder'] = $CI->fuel->blog->config('asset_upload_path');
$fields['main_image']['img_styles'] = 'float: left; width: 200px;';
$fields['list_image']['folder'] = $CI->fuel->blog->config('asset_upload_path');
$fields['list_image']['img_styles'] = 'float: left; width: 100px;';
$fields['thumbnail_image']['folder'] = $CI->fuel->blog->config('asset_upload_path');
$fields['thumbnail_image']['img_styles'] = 'float: left; width: 60px;';
if (empty($fields['post_date']['value'])) {
$fields['post_date']['value'] = datetime_now();
}
$fields['blocks']['sorting'] = TRUE;
if (!empty($values['id'])) {
unset($fields['related_posts']['options'][$values['id']]);
}
if ($CI->fuel->blog->config('multiple_authors')) {
unset($fields['author_id']);
}
return $fields;
}
示例4: form_fields
public function form_fields($values = array(), $related = array())
{
$fields = parent::form_fields($values, $related);
$fields['publish_date']['comment'] = 'If blank, will default to current date/time';
$fields['publish_date']['value'] = datetime_now();
return $fields;
}
示例5: array
function form_fields($values = array())
{
$fields = parent::form_fields();
$CI =& get_instance();
$CI->load->module_model(BLOG_FOLDER, 'blog_users_model');
$CI->load->module_model(BLOG_FOLDER, 'blog_posts_model');
$post_title = '';
$post_options = $CI->blog_posts_model->options_list('id', 'title', array(), 'date_added desc');
if (empty($post_options)) {
return lang('blog_error_no_posts_to_comment');
}
$fields['post_id'] = array('type' => 'select', 'options' => $post_options, 'label' => 'Post');
if (!empty($values['id'])) {
$post = $CI->blog_posts_model->find_by_key($values['post_id']);
$post_title = $post->title;
if (!$post->is_published()) {
add_error(lang('blog_post_is_not_published'));
}
$fields['post_id'] = array('type' => 'hidden', 'value' => $post_title, 'displayonly' => TRUE);
$fields['post_title'] = array('label' => 'Post', 'value' => $post_title, 'order' => 1);
$fields['post_title']['displayonly'] = TRUE;
$fields['post_published']['displayonly'] = TRUE;
$fields['author_email']['displayonly'] = TRUE;
$fields['author_name']['displayonly'] = TRUE;
$fields['post_title']['displayonly'] = TRUE;
$fields['author_website']['displayonly'] = TRUE;
$fields['ip_host']['displayonly'] = TRUE;
$fields['date_submitted'] = array('displayonly' => TRUE, 'value' => english_date($values['date_added'], TRUE));
$ip_host = !empty($values['author_ip']) ? gethostbyaddr($values['author_ip']) . ' (' . $values['author_ip'] . ')' : '';
$fields['ip_host'] = array('label' => 'IP/Host', 'value' => $ip_host, 'order' => 5, 'displayonly' => TRUE);
$fields['Reply to this Comment'] = array('type' => 'section');
$replies = $this->find_all_array(array('parent_id' => $values['id']));
$reply_arr = array();
foreach ($replies as $r) {
$reply_arr[] = $r['content'];
}
$fields['replies'] = array('label' => 'Replies', 'displayonly' => TRUE, 'value' => implode('<br /><br />', $reply_arr));
if ($values['author_id'] == $CI->fuel_auth->user_data('id') or $CI->fuel_auth->is_super_admin()) {
$fields['reply'] = array('label' => 'Reply', 'type' => 'textarea');
$notify_options = array('Commentor' => lang('blog_comment_notify_option2'), 'All' => lang('blog_comment_notify_option1'), 'None' => lang('blog_comment_notify_option3'));
$fields['reply_notify'] = array('label' => 'Notfiy', 'type' => 'enum', 'options' => $notify_options);
}
// hidden
$fields['author_ip'] = array('type' => 'hidden');
} else {
$fields['author_ip'] = array('type' => 'hidden', 'value' => $_SERVER['REMOTE_ADDR'], 'label' => 'Author IP Address');
$fields['is_spam'] = array('type' => 'hidden');
$fields['date_added']['type'] = 'hidden';
// so it will auto add
$fields['last_modified']['type'] = 'hidden';
// so it will auto add
}
// set author to current fuel user
if (empty($fields['author_id']) and $CI->fuel_auth->user_data('id')) {
$fields['author_id'] = array('value' => $CI->fuel_auth->user_data('id'));
}
$fields['author_id'] = array('type' => 'hidden');
return $fields;
}
示例6: array
function form_fields($values = array())
{
$fields = parent::form_fields();
foreach ($fields as &$f) {
$f['displayonly'] = true;
}
return $fields;
}
示例7: array
function form_fields()
{
$fields = parent::form_fields();
$fields['url']['label'] = 'URL';
$fields['icon'] = array('type' => 'select', 'options' => $this->get_icons(), 'first_option' => 'Select an icon...', 'required' => TRUE, 'after_html' => '<i id="icon-preview" class=""></i>');
$fields['color'] = array('type' => 'colorpicker');
return $fields;
}
示例8: array
function form_fields($values = array())
{
$fields = parent::form_fields();
$upload_path = assets_server_path('authors/', 'images');
$fields['avatar_upload'] = array('type' => 'file', 'upload_path' => $upload_path, 'overwrite' => TRUE);
$fields['published']['order'] = 1000;
return $fields;
}
示例9: array
function form_fields($values = array(), $related = array())
{
$fields = parent::form_fields($values, $related);
$fields['post_date']['comment'] = 'If blank, will default to current date/time';
$fields['post_date']['value'] = datetime_now();
$fields['skillset_requirements']['class'] = 'no_editor';
return $fields;
}
示例10: form_fields
public function form_fields()
{
$fields = parent::form_fields();
$CI =& get_instance();
$CI->load->helper('directory');
$CI->load->helper('file');
return $fields;
}
示例11: array
function form_fields($values = array())
{
$fields = parent::form_fields();
//$fields['published']['order'] = 1000;
$upload_path = ltrim(assets_server_path('i_property/', 'images'), "/");
$fields['Property_info_image'] = array('type' => 'file', 'upload_path' => $upload_path, 'overwrite' => TRUE, 'xss_clean' => TRUE, 'allowed_types' => 'jpg|jpeg|bmp|png|gif');
return $fields;
}
示例12: form_fields
public function form_fields($values = array(), $related = array())
{
$CI =& get_instance();
$fields = parent::form_fields($values, $related);
$fields['form_name']['options'] = $CI->fuel->forms->options_list();
$fields['post']['type'] = 'keyval';
return $fields;
}
示例13: array
function form_fields($values = array(), $related = array())
{
$fields = parent::form_fields($values, $related);
// ******************* ADD CUSTOM FORM STUFF HERE *******************
$fields['content']['img_folder'] = 'articles/';
$fields['image']['folder'] = 'images/articles/';
$fields['thumb_image']['folder'] = 'images/articles/thumbs/';
return $fields;
}
示例14: unset
function form_fields($values = null)
{
$fields = parent::form_fields();
unset($fields['super_admin']);
// save reference it so we can reorder
$pwd_field = $fields['password'];
unset($fields['password']);
$user_id = NULL;
if (!empty($values['id'])) {
$user_id = $values['id'];
}
if (!empty($user_id)) {
$fields['new_password'] = array('type' => 'password', 'size' => 20, 'order' => 5);
} else {
$pwd_field['type'] = 'password';
$pwd_field['size'] = 20;
$fields['password'] = $pwd_field;
$fields['password']['order'] = 5;
}
$fields['user_name']['order'] = 1;
$fields['email']['order'] = 2;
$fields['first_name']['order'] = 3;
$fields['last_name']['order'] = 4;
$fields['confirm_password'] = array('type' => 'password', 'size' => 20, 'order' => 6);
$fields['active']['order'] = 7;
// get permissions
$CI =& get_instance();
$perm_fields = array();
$user = $CI->fuel_auth->user_data();
//if (($CI->fuel_auth->is_super_admin() AND ($user['id'] != $user_id)) AND (!empty($values['super_admin']) AND $values['super_admin'] != 'yes'))
if ($CI->fuel_auth->is_super_admin() and $user['id'] != $user_id or !$CI->fuel_auth->is_super_admin() and $CI->fuel_auth->has_permission('permissions')) {
$CI->load->module_model(FUEL_FOLDER, 'user_to_permissions_model');
$selected_perms = $CI->user_to_permissions_model->get_permissions($user_id, FALSE);
// if (!empty($selected_perms))
// {
$fields['Permissions'] = array('type' => 'section', 'order' => 10);
// }
$CI->load->module_model(FUEL_FOLDER, 'permissions_model');
$perms = $CI->permissions_model->find_all_array(array('active' => 'yes'), 'name asc');
$order = 11;
foreach ($perms as $val) {
$perm_field = 'permissions_' . $val['id'];
$perm_fields[$perm_field]['type'] = 'checkbox';
$perm_fields[$perm_field]['value'] = $val['id'];
$perm_fields[$perm_field]['order'] = $order;
$perm_fields[$perm_field]['label'] = !empty($val['description']) ? $val['description'] : $val['name'];
if (!empty($selected_perms[$val['id']])) {
$perm_fields[$perm_field]['checked'] = TRUE;
}
$order++;
}
}
$fields = array_merge($fields, $perm_fields);
unset($fields['reset_key']);
return $fields;
}
示例15: array
function form_fields($values = array())
{
$fields = parent::form_fields();
$upload_path = assets_server_path('i_property/', 'images');
$fields['category']['required'] = TRUE;
$fields['category_path']['required'] = TRUE;
$fields['category_icon'] = array('required' => TRUE, 'type' => 'file', 'upload_path' => $upload_path, 'overwrite' => TRUE, 'xss_clean' => TRUE, 'is_image' => TRUE, 'allowed_types' => 'jpg|jpeg|bmp|png|gif');
$fields['category_mo_icon'] = array('required' => TRUE, 'type' => 'file', 'upload_path' => $upload_path, 'overwrite' => TRUE, 'xss_clean' => TRUE, 'is_image' => TRUE, 'allowed_types' => 'jpg|jpeg|bmp|png|gif');
return $fields;
}