本文整理汇总了PHP中Database_MySQLUserFactory::get_instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Database_MySQLUserFactory::get_instance方法的具体用法?PHP Database_MySQLUserFactory::get_instance怎么用?PHP Database_MySQLUserFactory::get_instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Database_MySQLUserFactory
的用法示例。
在下文中一共展示了Database_MySQLUserFactory::get_instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_checkout_status
/**
* Determines what stage of the checkout process the user has reached.
*
* Possible statuses:
* - 'no-shopping-basket'
* - 'accounts'
* - 'shipping-details'
* - 'checkout-error'
*/
public function get_checkout_status()
{
// accounts >> shipping-details >> payment-options
//
// if not logged_in then return accounts
//
// if you are logged and you haven't confirmed shipping-details then return shipping-details
//
// if you are logged and you have confirmed shippin-details then return payment-options
//
$mysql_user_factory = Database_MySQLUserFactory::get_instance();
$mysql_user = $mysql_user_factory->get_for_this_project();
$database = $mysql_user->get_database();
$shopping_baskets_table = $database->get_table('hpi_shop_shopping_baskets');
$current_session_has_shopping_basket = $shopping_baskets_table->check_for_current_session_in_shopping_baskets();
if (!$current_session_has_shopping_basket) {
return 'no-shopping-basket';
}
$log_in_manager = Shop_LogInManager::get_instance();
if (!$log_in_manager->is_logged_in()) {
return 'accounts';
} elseif ($log_in_manager->is_logged_in()) {
if (!$this->are_shipping_details_confirmed()) {
return 'shipping-details';
} elseif ($this->are_shipping_details_confirmed()) {
return 'payment-options';
}
}
return 'checkout-error';
}
示例2: get_table
public function get_table()
{
$muf = Database_MySQLUserFactory::get_instance();
$mu = $muf->get_for_this_project();
$database = $mu->get_database();
return $database->get_table($this->get_table_name());
}
示例3: get_dbh
/**
* DEPRECATED!
*
* Use DB::m() instead.
*/
public function get_dbh()
{
$mysql_user_factory = Database_MySQLUserFactory::get_instance();
$mysql_user = $mysql_user_factory->get_for_this_project();
$database = $mysql_user->get_database();
$dbh = $database->get_database_handle();
return $dbh;
}
示例4: log
public function log()
{
#echo "Logging...\n";
$mysql_user_factory = Database_MySQLUserFactory::get_instance();
$mysql_user = $mysql_user_factory->get_for_this_project();
$database = $mysql_user->get_database();
$server_logs_table = $database->get_table('hc_logging_server_logs');
$server_logs_table->add_log_entry($_SERVER['REMOTE_ADDR'], session_id(), 'NOW()', $_SERVER['REQUEST_URI'], $_SERVER['HTTP_REFERER'], $_SERVER['HTTP_USER_AGENT'], $_SERVER['HTTP_HOST']);
}
示例5: __construct
public function __construct($table_name)
{
$mysql_user_factory = Database_MySQLUserFactory::get_instance();
$mysql_user = $mysql_user_factory->get_for_this_project();
$database = $mysql_user->get_database();
$table = $database->get_table($table_name);
$form_name = $table_name . '_adding';
parent::__construct($table, $form_name);
}
示例6: test_get_database_class_returns_database_reflection_class
public static function test_get_database_class_returns_database_reflection_class()
{
$database_class_factory = Database_DatabaseClassFactory::get_instance();
$database_class = $database_class_factory->get_database_class();
$mysql_user_factory = Database_MySQLUserFactory::get_instance();
$mysql_user = $mysql_user_factory->get_for_this_project();
$passwords_file = $mysql_user->get_password_file();
$database_object = $database_class->newInstance($mysql_user, $passwords_file->get_database());
return is_a($database_object, 'Database_Database');
}
示例7: get_img
public static function get_img($image_id)
{
$mysql_user_factory = Database_MySQLUserFactory::get_instance();
$mysql_user = $mysql_user_factory->get_for_this_project();
$database = $mysql_user->get_database();
$images_table = $database->get_table('hc_database_images');
$image_row = $images_table->get_row_by_id($image_id);
$image_renderer = $image_row->get_renderer();
$img = $image_renderer->get_img_in_public_images();
return $img;
}
示例8: get_photograph_adding_form
public function get_photograph_adding_form($photograph_adding_action, $cancel_location)
{
$mysql_user_factory = Database_MySQLUserFactory::get_instance();
$mysql_user = $mysql_user_factory->get_for_this_project();
$database = $mysql_user->get_database();
$photographs_table = $database->get_table('hpi_shop_photographs');
$photograph_adding_form = new HTMLTags_SimpleOLForm('photograph_adding');
$photograph_adding_form->set_attribute_str('enctype', 'multipart/form-data');
#$photograph_adding_action->set_get_variable('table', $photographs_table->get_name());
$photograph_adding_form->set_action($photograph_adding_action);
$photograph_adding_form->set_legend_text('Add a photograph');
/*
* The name
*/
$name_field = $photographs_table->get_field('name');
$name_field_renderer = $name_field->get_renderer();
$input_tag = $name_field_renderer->get_form_input();
$input_tag->set_attribute_str('id', 'name');
$photograph_adding_form->add_input_tag('name', $input_tag);
/* THE FULL SIZE IMAGE UPLOAD */
$full_size_image_file_input_tag = new HTMLTags_Input();
$full_size_image_file_input_tag_name = 'display_photograph_file[]';
$full_size_image_file_input_tag->set_attribute_str('type', 'file');
$full_size_image_file_input_tag->set_attribute_str('id', $full_size_image_file_input_tag_name);
$full_size_image_file_input_tag->set_attribute_str('name', $full_size_image_file_input_tag_name);
$photograph_adding_form->add_input_tag($full_size_image_file_input_tag_name, $full_size_image_file_input_tag, 'Full Size File');
/* THE MEDIUM SIZE IMAGE UPLOAD */
$medium_size_image_file_input_tag = new HTMLTags_Input();
$medium_size_image_file_input_tag_name = 'medium_photograph_file[]';
$medium_size_image_file_input_tag->set_attribute_str('type', 'file');
$medium_size_image_file_input_tag->set_attribute_str('id', $medium_size_image_file_input_tag_name);
$medium_size_image_file_input_tag->set_attribute_str('name', $medium_size_image_file_input_tag_name);
$photograph_adding_form->add_input_tag($medium_size_image_file_input_tag_name, $medium_size_image_file_input_tag, 'Medium Size File');
/* THE THUMBNAIL IMAGE UPLOAD */
$thumbnail_image_file_input_tag = new HTMLTags_Input();
$thumbnail_image_file_input_tag_name = 'thumbnail_photograph_file[]';
$thumbnail_image_file_input_tag->set_attribute_str('type', 'file');
$thumbnail_image_file_input_tag->set_attribute_str('id', $thumbnail_image_file_input_tag_name);
$thumbnail_image_file_input_tag->set_attribute_str('name', $thumbnail_image_file_input_tag_name);
$photograph_adding_form->add_input_tag($thumbnail_image_file_input_tag_name, $thumbnail_image_file_input_tag, 'Thumbnail File');
$photograph_adding_form->add_hidden_input('MAX_FILE_SIZE', '1000000');
/*
* The add button.
*/
$photograph_adding_form->set_submit_text('Add');
$photograph_adding_form->set_cancel_location($cancel_location);
return $photograph_adding_form;
}
示例9: process_photographs
public static function process_photographs()
{
#echo __METHOD__ . "\n";
$tsm_cm = Configuration_ConfigManagerHelper::get_config_manager('plug-ins', 'trackit-stock-management');
/*
* Create the database objects.
*/
$muf = Database_MySQLUserFactory::get_instance();
$mu = $muf->get_for_this_project();
$database = $mu->get_database();
$feed_files_table = $database->get_table('hpi_trackit_stock_management_feed_files');
/*
* Get the list of photographs to process.
*/
$ps = $feed_files_table->get_photographs_to_process();
$cache_dir_name = $tsm_cm->get_cache_dir_name();
$resized_photos_temporary_dir_name = $tsm_cm->get_resized_photos_temporary_dir_name();
if (!is_dir($resized_photos_temporary_dir_name)) {
system("mkdir -p {$resized_photos_temporary_dir_name}");
}
/*
* Resize them.
*/
foreach ($ps as $p) {
$cache_file_name = "{$cache_dir_name}/" . $p->get('name');
#echo "\$cache_file_name: $cache_file_name\n";
$sizes = $tsm_cm->get_photograph_sizes();
for ($i = 0; $i < count($sizes); $i++) {
/*
* Resize the image in the temporary dir.
*/
$sizes[$i]['tmp_file_name'] = "{$resized_photos_temporary_dir_name}/" . $sizes[$i]['name'] . '_' . $p->get('name');
$cmd = 'cp "' . $cache_file_name . '" "' . $sizes[$i]['tmp_file_name'] . '"';
#echo "\$cmd: $cmd\n";
system($cmd);
$cmd = 'mogrify ' . ' -resize ' . $sizes[$i]['x'] . 'x' . $sizes[$i]['y'] . ' ' . '"' . $sizes[$i]['tmp_file_name'] . '"';
#echo "\$cmd: $cmd\n";
system($cmd);
}
$feed_files_table->record_process($p->get('name'));
}
}
示例10: get_selection_manager
public function get_selection_manager($table_name)
{
#print_r($this->selection_managers);
if (!isset($this->selection_managers[$table_name])) {
#print_r($this->selection_managers_file);
$mysql_user_factory = Database_MySQLUserFactory::get_instance();
$mysql_user = $mysql_user_factory->get_for_this_project();
$database = $mysql_user->get_database();
$table = $database->get_table($table_name);
if (isset($this->selection_managers_file) && $this->selection_managers_file->has_selection_manager($table_name)) {
$selection_manager_filename = $this->selection_managers_file->get_selection_manager_filename($table_name);
#echo "\$selection_manager_filename: $selection_manager_filename\n";
$selection_manager_file = new FileSystem_PHPClassFile($selection_manager_filename);
$selection_manager_file->declare_class();
$selection_manager_reflection_class = new ReflectionClass($selection_manager_file->get_php_class_name());
$this->selection_managers[$table_name] = $selection_manager_reflection_class->newInstance($table);
} else {
#echo "Using default selection manager for $table_name\n";
$this->selection_managers[$table_name] = $this->default_selection_manager_reflection_class->newInstance($table);
}
}
return $this->selection_managers[$table_name];
}
示例11: elseif
<?php
/**
* The redirect script for the shopping basket page.
*
* @copyright Clear Line Web Design, 2007-08-02
*/
$mysql_user_factory = Database_MySQLUserFactory::get_instance();
$mysql_user = $mysql_user_factory->get_for_this_project();
$database = $mysql_user->get_database();
$shopping_baskets_table = $database->get_table('hpi_shop_shopping_baskets');
/*
* Set the default return to page.
*/
// ADD PRODUCT
if (isset($_GET['add_product_id']) && isset($_GET['add_product_quantity'])) {
//try {
$product_id = $_GET['add_product_id'];
$quantity = $_GET['add_product_quantity'];
$session_id = session_id();
$last_added_id = $shopping_baskets_table->add_shopping_basket($product_id, $session_id, $quantity);
#$return_to .= '&last_added_shopping_basket_id=' . $last_added_id;
//} catch (Exception $e) {
// print_r(session_id());
// print('Failed to add Product to your Shopping Basket!');
//}
} elseif (isset($_GET['edit_shopping_basket_id'])) {
$shopping_baskets_table->edit_shopping_basket($_GET['edit_shopping_basket_id'], $_POST['quantity']);
$return_to .= '&last_edited_shopping_basket_id=' . $_GET['edit_shopping_basket_id'];
} elseif (isset($_GET['delete_shopping_basket_id'])) {
$row_to_be_deleted = $shopping_baskets_table->get_row_by_id($_GET['delete_shopping_basket_id']);
示例12: get_users_table
public function get_users_table()
{
$muf = Database_MySQLUserFactory::get_instance();
$mu = $muf->get_for_this_project();
$database = $mu->get_database();
$admin_users_table = $database->get_table('hc_admin_users');
return $admin_users_table;
}
示例13: delete_where
public function delete_where($conditions)
{
$mysql_user_factory = Database_MySQLUserFactory::get_instance();
$mysql_user = $mysql_user_factory->get_for_this_project();
$dbh = $mysql_user->get_database_handle();
$statement = 'DELETE FROM ' . $this->get_name();
if (isset($conditions)) {
#$statement .= self::condtions_to_where_clause($conditions);
$statement .= $this->condtions_to_where_clause($conditions);
}
#echo $statement;
$rv = mysql_query($statement, $dbh);
if ($rv) {
return $rv;
} else {
throw new Database_MySQLException($dbh);
}
}
示例14: __construct
public function __construct()
{
$mysql_user_factory = Database_MySQLUserFactory::get_instance();
$mysql_user = $mysql_user_factory->get_for_this_project();
$this->database = $mysql_user->get_database();
}
示例15: get_mysql_user
public function get_mysql_user()
{
$mysql_user_factory = Database_MySQLUserFactory::get_instance();
return $mysql_user_factory->get_for_this_project();
}