function form_fields($values = array())
 {
     $fields = parent::form_fields();
     $fields['last_modified']['type'] = 'hidden';
     $fields['date_added']['type'] = 'hidden';
     return $fields;
 }
 function on_before_validate($values)
 {
     if ($values['username'] == "" || $values['username'] == NULL) {
         $this->password_in_clear = $password = $this->random_password();
         $ci = CI_Controller::get_instance();
         $ci->load->helper('url');
         $ci->load->library('session');
         $ci->load->library('extemplate');
         $ci->load->library("email");
         $ci->load->config('tank_auth', TRUE);
         $hasher = new PasswordHash($ci->config->item('phpass_hash_strength', 'tank_auth'), $ci->config->item('phpass_hash_portable', 'tank_auth'));
         $hashed_password = $hasher->HashPassword($password);
         $values["password"] = $hashed_password;
         $values["created"] = datetime_now();
         $values['username'] = trim($values['email']);
         $values["last_ip"] = $_SERVER['REMOTE_ADDR'];
         $data = $values;
         $data['site_name'] = 'http://www.ressphere.com';
         $data['password'] = $this->password_in_clear;
         if ($ci->config->item('email_account_details')) {
             base::_begin_send_email('Welcome to', $data['email'], $data, $ci);
         }
     }
     return parent::on_before_validate($values);
 }
 function form_fields($values = array())
 {
     $fields = parent::form_fields();
     $fields['video_name']['required'] = TRUE;
     $fields['video_path']['required'] = TRUE;
     return $fields;
 }
 /**
  * Constructor.
  *
  * @access	public
  * @return	void
  */
 public function __construct()
 {
     $CI =& get_instance();
     $tables = $CI->config->item('tables', 'fuel');
     parent::__construct($tables['fuel_navigation_groups']);
     $this->add_validation('name', array(&$this, 'valid_name'), lang('error_requires_string_value'));
 }
 /**
  * Lists the log items
  *
  * @access	public
  * @param	int The limit value for the list data (optional)
  * @param	int The offset value for the list data (optional)
  * @param	string The field name to order by (optional)
  * @param	string The sorting order (optional)
  * @param	boolean Determines whether the result is just an integer of the number of records or an array of data (optional)
  * @return	mixed If $just_count is true it will return an integer value. Otherwise it will return an array of data (optional)
  */
 public function list_items($limit = NULL, $offset = NULL, $col = 'entry_date', $order = 'desc', $just_count = FALSE)
 {
     $this->db->select($this->_logs_table . '.id, entry_date, CONCAT(' . $this->_tables['fuel_users'] . '.first_name, " ", ' . $this->_tables['fuel_users'] . '.last_name) as name, message, type', FALSE);
     $this->db->join($this->_tables['fuel_users'], $this->_logs_table . '.user_id = ' . $this->_tables['fuel_users'] . '.id', 'left');
     $data = parent::list_items($limit, $offset, $col, $order, $just_count);
     return $data;
 }
 function list_items($limit = NULL, $offset = NULL, $col = 'id', $order = 'asc')
 {
     $this->db->join('wa_items', 'wa_items.id = wa_market_prices.item_id', 'left');
     $this->db->select('wa_market_prices.id, wa_market_prices.item_id, wa_market_prices.quantity, wa_market_prices.price, wa_items.name AS name, wa_items.damage AS damage', FALSE);
     $data = parent::list_items($limit, $offset, $col, $order);
     return $data;
 }
 function list_items($limit = NULL, $offset = NULL, $col = 'id', $order = 'asc')
 {
     $this->db->join('wa_items', 'wa_items.id = wa_enchantments.item_id', 'left');
     $this->db->select('wa_enchantments.id, wa_enchantments.name, wa_enchantments.level, wa_enchantments.item_id', FALSE);
     $data = parent::list_items($limit, $offset, $col, $order);
     return $data;
 }
 function list_items($limit = NULL, $offset = NULL, $col = 'id', $order = 'asc')
 {
     $this->db->join('wa_items', 'wa_items.id = wa_static_shops.item_id', 'left');
     $this->db->select('wa_static_shops.id, wa_static_shops.item_id, wa_items.name AS name, wa_items.damage AS damage, wa_static_shops.buy, wa_static_shops.sell', FALSE);
     $data = parent::list_items($limit, $offset, $col, $order);
     return $data;
 }
 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;
 }
 function list_items($limit = NULL, $offset = NULL, $col = 'id', $order = 'asc')
 {
     $this->db->join('wa_items', 'wa_items.id = wa_auctions.item_id', 'left');
     $this->db->join('wa_users', 'wa_users.id = wa_auctions.seller', 'left');
     $this->db->select('wa_auctions.id, wa_auctions.item_id, wa_users.username AS seller, wa_auctions.price, wa_items.name AS name, wa_items.damage AS damage, wa_auctions.quantity, wa_auctions.started', FALSE);
     $data = parent::list_items($limit, $offset, $col, $order);
     return $data;
 }
 function list_items($limit = NULL, $offset = NULL, $col = 'id', $order = 'asc')
 {
     $this->db->join('wa_items', 'wa_items.id = wa_mail.item_id', 'left');
     $this->db->join('wa_users', 'wa_users.id = wa_mail.player', 'left');
     $this->db->select('wa_mail.id, wa_mail.item_id, wa_users.username AS owner, wa_items.name AS name, wa_items.damage AS damage, wa_mail.quantity', FALSE);
     $data = parent::list_items($limit, $offset, $col, $order);
     return $data;
 }
Exemple #12
0
 public function form_fields()
 {
     $fields = parent::form_fields();
     $CI =& get_instance();
     $CI->load->helper('directory');
     $CI->load->helper('file');
     return $fields;
 }
 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;
 }
 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;
 }
 function form_fields($values = array())
 {
     $fields = parent::form_fields();
     foreach ($fields as &$f) {
         $f['displayonly'] = true;
     }
     return $fields;
 }
Exemple #16
0
 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;
 }
 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;
 }
 public function __construct($table_name)
 {
     // Main entries table
     parent::__construct($table_name);
     // Align record model name
     // Define the record class name, rather for it to when crazy
     $this->record_class = $table_name . "_record";
     // 1. For benchmark (profiler) to keep track total execute time
     //    Able to disable through "application/config/MY_config.php"
     // 2. For Error switching purpose
     //$this->CI =& get_instance();
     //$this->CI->config->load("MY_config");
     $this->config->load("MY_config");
 }
 function form_fields($values = array())
 {
     $fields = parent::form_fields();
     $CI =& get_instance();
     $CI->load->model('authors_model');
     $CI->load->model('categories_model');
     $CI->load->model('categories_to_articles_model');
     $category_options = $CI->categories_model->options_list('id', 'name', array('published' => 'yes'), 'name');
     $category_values = !empty($values['id']) ? array_keys($CI->categories_to_articles_model->find_all_array_assoc('category_id', array('article_id' => $values['id'], 'categories.published' => 'yes'))) : array();
     $fields['categories'] = array('label' => 'Categories', 'type' => 'array', 'class' => 'add_edit categories', 'options' => $category_options, 'value' => $category_values, 'mode' => 'multi');
     if ($CI->fuel_auth->has_permission('authors')) {
         $fields['author_id']['class'] = 'add_edit authors';
     }
     return $fields;
 }
 function form_fields($values = array())
 {
     $fields = parent::form_fields();
     $CI =& get_instance();
     $CI->load->module_model(FUEL_FOLDER, 'users_model');
     $CI->load->module_library(BLOG_FOLDER, 'fuel_blog');
     $options = $CI->users_model->options_list();
     $upload_image_path = assets_server_path($CI->fuel_blog->settings('asset_upload_path'));
     $fields['fuel_user_id'] = array('label' => 'User', 'type' => 'select', 'options' => $options);
     // put all project images into a projects suboflder.
     $fields['avatar_image_upload']['upload_path'] = assets_server_path($CI->fuel_blog->settings('asset_upload_path'));
     // fix the preview by adding projects in front of the image path since we are saving it in a subfolder
     if (!empty($values['avatar_image'])) {
         $fields['avatar_image_upload']['before_html'] = '<img src="' . assets_path($CI->fuel_blog->settings('asset_upload_path') . $values['avatar_image']) . '" style="float: right;"/>';
     }
     return $fields;
 }
Exemple #21
0
 function form_fields($values = array(), $related_fields = array())
 {
     $fields = parent::form_fields($values, $related_fields);
     $CI =& get_instance();
     $CI->load->module_model(FUEL_FOLDER, 'fuel_users_model');
     $CI->load->module_library(BLOG_FOLDER, 'fuel_blog');
     //use only fuel users not already chosen
     $where = !empty($values['fuel_user_id']) ? array('fuel_user_id !=' => $values['fuel_user_id']) : array();
     $already_used = array_keys($this->options_list('fuel_user_id', 'display_name', $where));
     if (!empty($already_used)) {
         $CI->fuel_users_model->db()->where_not_in('id', $already_used);
     }
     $options = $CI->fuel_users_model->options_list();
     $upload_image_path = assets_server_path($CI->fuel->blog->settings('asset_upload_path'));
     $fields['fuel_user_id'] = array('label' => 'User', 'type' => 'select', 'options' => $options, 'module' => 'users');
     return $fields;
 }
 function form_fields($values = array())
 {
     $fields = parent::form_fields();
     $CI =& get_instance();
     $CI->load->module_library(BLOG_FOLDER, 'fuel_blog');
     $CI->load->module_model(BLOG_FOLDER, 'blog_users_model');
     $CI->load->module_model(BLOG_FOLDER, 'blog_categories_model');
     $CI->load->module_model(BLOG_FOLDER, 'blog_posts_to_categories_model');
     $blog_config = $CI->config->item('blog');
     $category_options = $CI->blog_categories_model->options_list('id', 'name', array('published' => 'yes'), 'name');
     $category_values = !empty($values['id']) ? array_keys($CI->blog_posts_to_categories_model->find_all_array_assoc('category_id', array('post_id' => $values['id'], $this->_tables['blog_categories'] . '.published' => 'yes'))) : array();
     $fields['categories'] = array('label' => 'Categories', 'type' => 'array', 'options' => $category_options, 'class' => 'add_edit blog/categories combo', 'value' => $category_values, 'mode' => 'multi');
     $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->settings('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']);
         } else {
             $fields['formatting'] = array('type' => 'select', 'options' => $blog_config['formatting'], 'default' => $fields['formatting']['default']);
         }
     }
     $fields['published']['order'] = 10000;
     if (!is_true_val($CI->fuel_blog->settings('allow_comments'))) {
         unset($fields['allow_comments']);
     }
     $fields['upload_images'] = array('type' => 'file', 'class' => 'multifile', 'order' => 6, 'upload_path' => assets_server_path($CI->fuel_blog->settings('asset_upload_path')), 'comment' => 'Upload images to be used with your blog posts');
     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['permalink']['order'] = 2;
     // for older versions where the schema order was different
     return $fields;
 }
	function _common_query()
	{
		parent::_common_query();
		$this->db->select($this->_tables['navigation'].'.*, '.$this->_tables['navigation_groups'].'.id group_id, '.$this->_tables['navigation_groups'].'.name group_name');
		$this->db->join($this->_tables['navigation_groups'], $this->_tables['navigation_groups'].'.id='.$this->_tables['navigation'].'.group_id', 'left');
		$this->db->order_by('precedence, location asc');
	}
 function form_fields()
 {
     $fields = parent::form_fields();
     return $fields;
 }
 /**
  * Overwrites the _common_query parent method to automatically sort by precedence value
  *
  * @access	public
  * @param mixed parameter to pass to common query (optional)
  * @return	array
  */
 public function _common_query($params = NULL)
 {
     parent::_common_query();
     $this->db->order_by('precedence asc');
 }
 /**
  * Loads the advanced modules config file
  *
  * @access	public
  * @param	string Name of config file. Default is the name of the advanced module (optional)
  * @return	void
  */
 public function load_config($config = NULL)
 {
     if (empty($config)) {
         $config = $this->name;
     }
     // last parameter tells it to fail gracefully
     // check application directory for overwrites
     $this->CI->load->module_config('app', $config, FALSE, TRUE);
     $app_config = $this->CI->config->item($this->name);
     // now get the blog configuration
     $this->CI->load->module_config($this->folder(), $config, FALSE, TRUE);
     $module_config = $this->CI->config->item($this->name);
     // if app config exists then merge
     if (!empty($app_config)) {
         $this->_config = array_merge($module_config, $app_config);
     } else {
         $this->_config = $module_config;
     }
     // special case for tables so that they are loaded into the static Base_module_model variable
     if ($this->CI->config->item('tables')) {
         if (!class_exists('Base_module_model')) {
             require_once BASEPATH . 'core/Model.php';
             require_once FUEL_PATH . 'models/base_module_model.php';
         }
         Base_module_model::$tables = array_merge(Base_module_model::$tables, $this->CI->config->item('tables'));
     }
 }
 /**
  * Constructor
  *
  * @access	public
  * @param	string	The table name
  * @param	mixed	If an array, it will assume they are initialization properties. If a string, it will assume it's the name of the module the module exists in
  * @return	void
  */
 public function __construct($table = NULL, $params = NULL)
 {
     $CI =& get_instance();
     $CI->load->module_language(FUEL_FOLDER, 'fuel');
     // initialize parameters to pass to parent model
     // if it is a string, then we assume it's a module name, if it is an array, then we extract the module name from it'
     if (is_array($params)) {
         if (isset($params['module'])) {
             $module = $params['module'];
         }
     } else {
         $module = $params;
         $params = array();
     }
     if (!isset($module)) {
         $module = FUEL_FOLDER;
     }
     $fuel_tables = array();
     $module_tables = array();
     $config_tables = array();
     // first load the FUEL config so that we can get the tables
     $CI->config->module_load(FUEL_FOLDER, 'fuel', TRUE);
     $fuel_tables = $CI->config->item('tables', 'fuel');
     // load in the module configuration file
     if (!empty($module) and $module != FUEL_FOLDER) {
         // fail gracefully is last parameter
         $CI->config->module_load($module, $module, FALSE, TRUE);
         if ($CI->config->item('tables')) {
             $module_tables = $CI->config->item('tables');
         }
     }
     // look in the generic configuration space
     if ($CI->config->item('tables')) {
         $config_tables = $CI->config->item('tables');
     }
     // create master list of tables
     self::$tables = array_merge(self::$tables, $config_tables, $module_tables, $fuel_tables);
     $this->set_tables(self::$tables);
     // set the table to the configuration mapping if it is in array
     if ($this->tables($table)) {
         $table = $this->tables($table);
     }
     // if no configuration mapping is found then we will assume it is just the straight up table name
     parent::__construct($table, $params);
     // table name and params
     // load additional helpers here
     $this->load->helper('typography');
     $this->load->helper('text');
     $this->load->helper('markdown');
     $this->load->helper('format');
     // set formatters
     if (!empty($this->_formatters) and !empty($this->formatters)) {
         $this->formatters = array_merge_recursive($this->_formatters, $this->formatters);
     } else {
         $this->formatters = $this->_formatters;
     }
 }
 function form_fields($values = array())
 {
     $fields = parent::form_fields();
     $fields['value']['class'] = 'markitup';
     return $fields;
 }
 public function on_after_post($values)
 {
     $values = parent::on_after_save($values);
     $data = $this->normalized_save_data;
     if (isset($data['other_perms']) and is_array($data['other_perms']) and !empty($values['name'])) {
         $module = $values['name'];
         $CI =& get_instance();
         $other_perms = $CI->fuel->permissions->create_simple_module_permissions($module, $data['other_perms']);
         $users = $CI->input->post('users');
         if (!empty($users)) {
             // get the IDS of the other perms
             $perm_ids = array();
             foreach ($other_perms as $op) {
                 $perm = $this->find_one_array(array('name' => $op['name']));
                 $perm_ids[] = $perm['id'];
             }
             // now associate the other users to those perms
             $CI->load->module_model(FUEL_FOLDER, 'fuel_users_model');
             foreach ($users as $user_id) {
                 $user = $CI->fuel_users_model->find_by_key($user_id);
                 if (isset($user->id)) {
                     $model = $user->get_permissions(TRUE);
                     $user_perms = $model->find_all_array_assoc('id');
                     $user_perm_ids = array_keys($user_perms);
                     $user->permissions = array_merge($user_perm_ids, $perm_ids);
                     $user->save();
                 }
             }
         }
     }
     return $values;
 }
 /**
  * Add FUEL specific changes to the form_fields method
  *
  * @access	public
  * @param	array Values of the form fields (optional)
  * @param	array An array of related fields. This has been deprecated in favor of using has_many and belongs to relationships (deprecated)
  * @return	array An array to be used with the Form_builder class
  */
 public function form_fields($values = array(), $related = array())
 {
     $CI =& get_instance();
     $fields = parent::form_fields($values, $related);
     //$fields['value']['value'] = (!empty($values['value'])) ? $this->cast($values['value'], $values['type']) : '';
     if (isset($values['page_id'])) {
         $page = $CI->fuel->pages->find($values['page_id']);
         if (isset($page->id)) {
             $layout = $this->fuel->layouts->get($page->layout);
             // grab values from entire set of layout vars to be used with merging (e.g. {page_id})
             $page_vars = $this->find_all_by_page_id($values['page_id']);
             $values = array_merge($page_vars, $values);
             $layout->set_field_values($values);
             $layout_fields = $layout->fields();
             if (isset($layout_fields[$values['name']])) {
                 $fields['value'] = $layout_fields[$values['name']];
                 $fields['value']['name'] = 'value';
             }
         }
     }
     // not needed due to on_before_clean
     unset($fields['type']);
     return $fields;
 }