本文整理汇总了PHP中Database_MySQLUserFactory类的典型用法代码示例。如果您正苦于以下问题:PHP Database_MySQLUserFactory类的具体用法?PHP Database_MySQLUserFactory怎么用?PHP Database_MySQLUserFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Database_MySQLUserFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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';
}
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:39,代码来源:Shop_CheckoutManager.inc.php
示例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());
}
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:7,代码来源:Database_AdminXMLPageManager.inc.php
示例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;
}
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:13,代码来源:PublicHTML_HaddockHTTPResponse.inc.php
示例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']);
}
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:9,代码来源:Logging_Logger.inc.php
示例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);
}
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:9,代码来源:Database_AddRowOLForm.inc.php
示例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');
}
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:10,代码来源:Database_DatabaseClassFactoryTests.inc.php
示例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;
}
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:11,代码来源:Database_ImagesHelper.inc.php
示例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;
}
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:48,代码来源:Shop_PhotographsTableRenderer.inc.php
示例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'));
}
}
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:42,代码来源:TrackitStockManagement_PhotographsHelper.inc.php
示例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];
}
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:23,代码来源:Database_SelectionManagerFactory.inc.php
示例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']);
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:31,代码来源:main.inc.php
示例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;
}
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:8,代码来源:Admin_LoginManager.inc.php
示例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);
}
}
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:18,代码来源:Database_Table.inc.php
示例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();
}
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:6,代码来源:ServerAdminScripts_LocalControlCentre.inc.php
示例15: get_mysql_user
public function get_mysql_user()
{
$mysql_user_factory = Database_MySQLUserFactory::get_instance();
return $mysql_user_factory->get_for_this_project();
}
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:5,代码来源:HaddockProjectOrganisation_ProjectDirectory.inc.php
示例16: get_comment_adding_form
public function get_comment_adding_form()
{
$mysql_user_factory = Database_MySQLUserFactory::get_instance();
$mysql_user = $mysql_user_factory->get_for_this_project();
$database = $mysql_user->get_database();
$comments_table = $database->get_table('hpi_shop_comments');
$commenters_table = $database->get_table('hpi_shop_commenters');
$redirect_script_url = new HTMLTags_URL();
$redirect_script_url->set_file('/admin/redirect-script.php');
$redirect_script_url->set_get_variable('type', 'redirect-script');
$redirect_script_url->set_get_variable('module', 'shop');
$redirect_script_url->set_get_variable('page', 'comments');
$cancel_location = new HTMLTags_URL();
$cancel_location->set_file('/admin/shop/comments.html');
$comment_adding_form = new HTMLTags_SimpleOLForm('comment_adding');
$comment_adding_action = clone $redirect_script_url;
$comment_adding_action->set_get_variable('add_comment');
$comment_adding_form->set_action($comment_adding_action);
$comment_adding_form->set_legend_text('Add a comment');
#Added Status Front Page Name Comment
/*
* The name
*/
$name_field = $commenters_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');
$comment_adding_form->add_input_tag('name', $input_tag);
/*
* The email
*/
$email_field = $commenters_table->get_field('email');
$email_field_renderer = $email_field->get_renderer();
$input_tag = $email_field_renderer->get_form_input();
$input_tag->set_attribute_str('id', 'email');
$comment_adding_form->add_input_tag('email', $input_tag);
/*
* The homepage_title
*/
$homepage_title_field = $commenters_table->get_field('homepage_title');
$homepage_title_field_renderer = $homepage_title_field->get_renderer();
$input_tag = $homepage_title_field_renderer->get_form_input();
$input_tag->set_attribute_str('id', 'homepage_title');
$comment_adding_form->add_input_tag('homepage_title', $input_tag);
/*
* The url
*/
$url_field = $commenters_table->get_field('url');
$url_field_renderer = $url_field->get_renderer();
$input_tag = $url_field_renderer->get_form_input();
$input_tag->set_attribute_str('id', 'url');
$comment_adding_form->add_input_tag('url', $input_tag, 'URL');
/*
* The comment
*/
$comment_field = $comments_table->get_field('comment');
$comment_field_renderer = $comment_field->get_renderer();
$input_tag = $comment_field_renderer->get_form_input();
$input_tag->set_attribute_str('id', 'comment');
$comment_adding_form->add_input_tag('comment', $input_tag);
/*
* The status enum
*/
$status_field = $comments_table->get_field('status');
$status_field_renderer = $status_field->get_renderer();
$input_tag = $status_field_renderer->get_form_input();
$input_tag->set_attribute_str('id', 'status');
$comment_adding_form->add_input_tag('status', $input_tag);
/*
* The front_page enum
*/
$front_page_field = $comments_table->get_field('front_page');
$front_page_field_renderer = $front_page_field->get_renderer();
$input_tag = $front_page_field_renderer->get_form_input();
$input_tag->set_attribute_str('id', 'front_page');
$comment_adding_form->add_input_tag('front_page', $input_tag);
/*
* The update button.
*/
$comment_adding_form->set_submit_text('Add');
$comment_adding_form->set_cancel_location($cancel_location);
return $comment_adding_form;
}
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:83,代码来源:Shop_CommentsTableRenderer.inc.php
示例17: Exception
$tsm_cm = Configuration_ConfigManagerHelper::get_config_manager('plug-ins', 'trackit-stock-management');
if ($debug) {
CodeAnalysis_MemoryHelper::cli_print_memory_usage('Created config manager');
}
/*
* Find out if there is an instance of this file already running.
*/
$process_stock_text_files_lock_file = TrackitStockManagement_FeedFilesHelper::get_process_stock_text_files_lock_file();
if ($process_stock_text_files_lock_file->is_locked()) {
throw new Exception('The process-stock-files script is locked!');
} else {
$process_stock_text_files_lock_file->lock();
/*
* Create the database objects.
*/
$muf = Database_MySQLUserFactory::get_instance();
$mu = $muf->get_for_this_project();
$database = $mu->get_database();
if ($debug) {
CodeAnalysis_MemoryHelper::cli_print_memory_usage('Created database objects');
}
$dbh = $database->get_database_handle();
$feed_files_table = $database->get_table('hpi_trackit_stock_management_feed_files');
if ($debug) {
CodeAnalysis_MemoryHelper::cli_print_memory_usage('Created db table objects');
}
/*
* Get the list of stock files to process.
*/
$fs = $feed_files_table->get_stock_text_files_to_process();
if ($debug) {
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:31,代码来源:main.inc.php
示例18: render_body_div_content
public function render_body_div_content()
{
/*
* Get the database objects.
*/
$mysql_user_factory = Database_MySQLUserFactory::get_instance();
$mysql_user = $mysql_user_factory->get_for_this_project();
$database = $mysql_user->get_database();
$products_table = $database->get_table('hpi_shop_products');
$table_renderer = $products_table->get_renderer();
$page_manager = PublicHTML_PageManager::get_instance();
$gvm = Caching_GlobalVarManager::get_instance();
/*
* Assemble the HTML
*/
$content_div = new HTMLTags_Div();
$content_div->set_attribute_str('id', 'content');
/*
* Cloned repeatedly throughout.
*/
#$current_page_url = $gvm->get('current_page_admin_url');
#$redirect_script_url = $gvm->get('redirect_script_admin_url');
$current_page_url = new HTMLTags_URL();
$current_page_url->set_file('/haddock/public-html/public-html/index.php');
$current_page_url->set_get_variable('oo-page');
$current_page_url->set_get_variable('page-class', 'Shop_AdminProductsPage');
$redirect_script_url = Admin_AdminIncluderURLFactory::get_url('plug-ins', 'shop', 'products', 'redirect-script');
$cancel_href = $current_page_url;
########################################################################
#
# Forms for changing the contents of the database.
#
########################################################################
if (isset($_GET['delete_all'])) {
/**
* Confirm deleting all the rows in the table.
*/
$action_div = new HTMLTags_Div();
$action_div->set_attribute_str('id', 'action-div');
$question_delete_all_p = new HTMLTags_P('Are you sure that you want to delete all of the products?');
$action_div->append_tag_to_content($question_delete_all_p);
$confirm_delete_all_p = new HTMLTags_P();
$delete_all_href = clone $redirect_script_url;
$delete_all_href->set_get_variable('delete_all');
$delete_all_a = new HTMLTags_A('DELETE ALL');
$delete_all_a->set_attribute_str('class', 'cool_button');
$delete_all_a->set_attribute_str('id', 'inline');
$delete_all_a->set_href($delete_all_href);
$confirm_delete_all_p->append_tag_to_content($delete_all_a);
$confirm_delete_all_p->append_str_to_content(' ');
$cancel_a = new HTMLTags_A('Cancel');
$cancel_a->set_attribute_str('class', 'cool_button');
$cancel_a->set_attribute_str('id', 'inline');
$cancel_a->set_href($cancel_href);
$confirm_delete_all_p->append_tag_to_content($cancel_a);
$action_div->append_tag_to_content($confirm_delete_all_p);
$content_div->append_tag_to_content($action_div);
} elseif (isset($_GET['delete_id'])) {
/**
* Confirm deleting a row.
*/
$row = $products_table->get_row_by_id($_GET['delete_id']);
$question_p = new HTMLTags_P();
$question_p->set_attribute_str('class', 'question');
$question_p->append_str_to_content('Are you sure that you want to delete this row?');
$content_div->append_tag_to_content($question_p);
/**
* Show the user the data in the row.
*/
$row_renderer = $row->get_renderer();
$content_div->append_tag_to_content($row_renderer->get_all_data_html_table());
# ------------------------------------------------------------------
$answer_p = new HTMLTags_P();
$answer_p->set_attribute_str('class', 'answer');
$delete_link = new HTMLTags_A('DELETE');
$delete_href = clone $redirect_script_url;
$delete_href->set_get_variable('delete_id', $row->get_id());
$delete_link->set_href($delete_href);
$delete_link->set_attribute_str('class', 'cool_button');
$delete_link->set_attribute_str('id', 'inline');
$answer_p->append_tag_to_content($delete_link);
$cancel_link = new HTMLTags_A('Cancel');
$cancel_link->set_href($cancel_href);
$cancel_link->set_attribute_str('class', 'cool_button');
$cancel_link->set_attribute_str('id', 'inline');
$answer_p->append_tag_to_content($cancel_link);
$content_div->append_tag_to_content($answer_p);
} elseif (isset($_GET['edit_id'])) {
/*
* Edit the values of this product.
*/
$row_editing_url = clone $redirect_script_url;
$row_editing_url->set_get_variable('edit_id', $_GET['edit_id']);
$product_row = $products_table->get_row_by_id($_GET['edit_id']);
$row_editing_url->set_get_variable('plu_code', $product_row->get_plu_code());
$product_row_renderer = $product_row->get_renderer();
$row_editing_form = $product_row_renderer->get_product_editing_form($row_editing_url, $cancel_href);
$content_div->append_tag_to_content($row_editing_form);
$explanation_div = new HTMLTags_Div();
$explanation_text = <<<TXT
//.........这里部分代码省略.........
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:101,代码来源:Shop_AdminProductsPage.inc.php
示例19: get_field_renderer_files
public function get_field_renderer_files()
{
$field_renderer_files = array();
/*
* The default field renderer file.
*/
$default_field_renderer_class_file = new FileSystem_PHPClassFile(PROJECT_ROOT . '/haddock/database/classes/renderers/' . 'Database_FieldRenderer.inc.php');
$mysql_user_factory = Database_MySQLUserFactory::get_instance();
$mysql_user = $mysql_user_factory->get_for_this_project();
$database = $mysql_user->get_database();
$table_names = $database->get_table_names();
$project_directory = $this->get_project_directory();
$php_class_files = $project_directory->get_php_class_files();
$field_renderer_reflection_class = new ReflectionClass('Database_FieldRenderer');
foreach ($table_names as $table_name) {
$table = $database->get_table($table_name);
$fields = $table->get_fields();
foreach ($fields as $field) {
$field_renderer_files[$table_name][$field->get_name()][] = $default_field_renderer_class_file;
foreach ($php_class_files as $php_class_file) {
$php_class_file->declare_class();
$php_class_file_reflection_class = $php_class_file->get_reflection_class();
if (!$php_class_file_reflection_class->isAbstract() && $php_class_file_reflection_class->isSubclassOf($field_renderer_reflection_class)) {
$field_renderer_files[$table_name][$field->get_name()][] = $php_class_file;
}
}
}
}
return $field_renderer_files;
}
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:30,代码来源:Database_DatabaseClassFinder.inc.php
示例20: edit_all_products_with_this_products_style_id
public static function edit_all_products_with_this_products_style_id($product_id, $values)
{
$mysql_user_factory = Database_MySQLUserFactory::get_instance();
$mysql_user = $mysql_user_factory->get_for_this_project();
$database = $mysql_user->get_database();
$products_table = $database->get_table('hpi_shop_products');
$query = <<<SQL
SELECT
\thpi_shop_products.style_id
FROM
\thpi_shop_products
\tWHERE
\tid = {$product_id}
SQL;
/*
* Create the database objects.
*/
$muf = Database_MySQLUserFactory::get_instance();
$mu = $muf->get_for_this_project();
$database = $mu->get_database();
$dbh = $database->get_database_handle();
// print_r($query);exit;
$result = mysql_query($query, $dbh);
// print_r($result);exit;
while ($row = mysql_fetch_array($result)) {
$style_id = $row['style_id'];
// print_r($row);exit;
}
$products = self::get_all_products_for_style_id($style_id);
// print_r($products);exit;
foreach ($products as $product) {
$products_table->edit_product($product->get_id(), $_POST['name'], $_POST['description'], $_POST['product_category_id'], $_POST['product_brand_id'], $_POST['supplier_id'], $_POST['sort_order']);
/*
* PRICES
*/
// $product_currency_prices_table = $database->get_table('hpi_shop_product_currency_prices');
// $currencies_table = $database->get_table('hpi_shop_currencies');
// $currencies = $currencies_table->get_all_rows();
// foreach ($currencies as $currency)
// {
// $conditions = array();
// $conditions['product_id'] = $_GET['edit_id'];
// $conditions['currency_id'] = $currency->get_id();
// $product_currency_prices_table->delete_where($conditions);
// $product_currency_prices_table->add_product_currency_price(
// $_GET['edit_id'],
// $currency->get_id(),
// $_POST['price_' . $currency->get_id()]
// );
// }
/*
* TAGS
*/
$product_tags_table = $database->get_table('hpi_shop_product_tags');
// $product = $products_table->get_row_by_id($_GET['edit_id']);
/*
* REMOVE ALL PRINCIPAL TAGS FROM PRODUCT
*/
$products_table->remove_all_principal_tags($product->get_id());
$principal_tags = $product_tags_table->get_principal_tags();
#print_r($principal_tags);exit;
foreach ($principal_tags as $principal_tag) {
if (isset($_POST['tag_' . $principal_tag->get_id()])) {
$product->add_tag($principal_tag);
}
}
/*
* PHOTOGRAPHS
*/
# MAIN PHOTOGRAPH
if (isset($_POST['main_photograph_id'])) {
$product->add_photograph_by_id($_POST['main_photograph_id'], 'main');
}
# DESIGN PHOTOGRAPH
if (isset($_POST['design_photograph_id'])) {
$product->add_photograph_by_id($_POST['design_photograph_id'], 'design');
}
# EXTRAS PHOTOGRAPH
// $product->delete_photograph_product_link_of_type('extra');
// $photographs_table = $database->get_table('hpi_shop_photographs');
// $photographs = $photographs_table->get_all_rows();
// foreach ($photographs as $photograph)
// {
// if (isset($_POST['extra_photograph_id_' . $photograph->get_id()]))
// {
// $product->add_photograph_by_id($photograph->get_id(), 'extra');
// }
// }
//
}
}
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:92,代码来源:Shop_ProductsHelper.inc.php
注:本文中的Database_MySQLUserFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论