Subversion-Projekte lars-tiefland.ci

Revision

Revision 2107 | Revision 2254 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 2107 Revision 2242
Zeile 4... Zeile 4...
4
 *
4
 *
5
 * An open source application development framework for PHP
5
 * An open source application development framework for PHP
6
 *
6
 *
7
 * This content is released under the MIT License (MIT)
7
 * This content is released under the MIT License (MIT)
8
 *
8
 *
9
 * Copyright (c) 2014 - 2017, British Columbia Institute of Technology
9
 * Copyright (c) 2014 - 2018, British Columbia Institute of Technology
10
 *
10
 *
11
 * Permission is hereby granted, free of charge, to any person obtaining a copy
11
 * Permission is hereby granted, free of charge, to any person obtaining a copy
12
 * of this software and associated documentation files (the "Software"), to deal
12
 * of this software and associated documentation files (the "Software"), to deal
13
 * in the Software without restriction, including without limitation the rights
13
 * in the Software without restriction, including without limitation the rights
14
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
Zeile 27... Zeile 27...
27
 * THE SOFTWARE.
27
 * THE SOFTWARE.
28
 *
28
 *
29
 * @package	CodeIgniter
29
 * @package	CodeIgniter
30
 * @author	EllisLab Dev Team
30
 * @author	EllisLab Dev Team
31
 * @copyright	Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
31
 * @copyright	Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
32
 * @copyright	Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
32
 * @copyright	Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/)
33
 * @license	http://opensource.org/licenses/MIT	MIT License
33
 * @license	http://opensource.org/licenses/MIT	MIT License
34
 * @link	https://codeigniter.com
34
 * @link	https://codeigniter.com
35
 * @since	Version 1.0.0
35
 * @since	Version 1.0.0
36
 * @filesource
36
 * @filesource
37
 */
37
 */
Zeile 224... Zeile 224...
224
	/**
224
	/**
225
	 * Model Loader
225
	 * Model Loader
226
	 *
226
	 *
227
	 * Loads and instantiates models.
227
	 * Loads and instantiates models.
228
	 *
228
	 *
229
	 * @param	string	$model		Model name
229
	 * @param	mixed	$model		Model name
230
	 * @param	string	$name		An optional object name to assign to
230
	 * @param	string	$name		An optional object name to assign to
231
	 * @param	bool	$db_conn	An optional database connection configuration to initialize
231
	 * @param	bool	$db_conn	An optional database connection configuration to initialize
232
	 * @return	object
232
	 * @return	object
233
	 */
233
	 */
234
	public function model($model, $name = '', $db_conn = FALSE)
234
	public function model($model, $name = '', $db_conn = FALSE)
Zeile 301... Zeile 301...
301
				require_once($app_path.'Model.php');
301
				require_once($app_path.'Model.php');
302
				if ( ! class_exists('CI_Model', FALSE))
302
				if ( ! class_exists('CI_Model', FALSE))
303
				{
303
				{
304
					throw new RuntimeException($app_path."Model.php exists, but doesn't declare class CI_Model");
304
					throw new RuntimeException($app_path."Model.php exists, but doesn't declare class CI_Model");
305
				}
305
				}
-
 
306
 
-
 
307
				log_message('info', 'CI_Model class loaded');
306
			}
308
			}
307
			elseif ( ! class_exists('CI_Model', FALSE))
309
			elseif ( ! class_exists('CI_Model', FALSE))
308
			{
310
			{
309
				require_once(BASEPATH.'core'.DIRECTORY_SEPARATOR.'Model.php');
311
				require_once(BASEPATH.'core'.DIRECTORY_SEPARATOR.'Model.php');
310
			}
312
			}
Zeile 315... Zeile 317...
315
				require_once($app_path.$class.'.php');
317
				require_once($app_path.$class.'.php');
316
				if ( ! class_exists($class, FALSE))
318
				if ( ! class_exists($class, FALSE))
317
				{
319
				{
318
					throw new RuntimeException($app_path.$class.".php exists, but doesn't declare class ".$class);
320
					throw new RuntimeException($app_path.$class.".php exists, but doesn't declare class ".$class);
319
				}
321
				}
-
 
322
 
-
 
323
				log_message('info', config_item('subclass_prefix').'Model class loaded');
320
			}
324
			}
321
		}
325
		}
Zeile 322... Zeile 326...
322
 
326
 
323
		$model = ucfirst($model);
327
		$model = ucfirst($model);
Zeile 348... Zeile 352...
348
		{
352
		{
349
			throw new RuntimeException("Class ".$model." already exists and doesn't extend CI_Model");
353
			throw new RuntimeException("Class ".$model." already exists and doesn't extend CI_Model");
350
		}
354
		}
Zeile 351... Zeile 355...
351
 
355
 
-
 
356
		$this->_ci_models[] = $name;
352
		$this->_ci_models[] = $name;
357
		$model = new $model();
-
 
358
		$CI->$name = $model;
353
		$CI->$name = new $model();
359
		log_message('info', 'Model "'.get_class($model).'" initialized');
354
		return $this;
360
		return $this;
Zeile 355... Zeile 361...
355
	}
361
	}