本文整理汇总了PHP中Recipe::loadRecipe方法的典型用法代码示例。如果您正苦于以下问题:PHP Recipe::loadRecipe方法的具体用法?PHP Recipe::loadRecipe怎么用?PHP Recipe::loadRecipe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Recipe
的用法示例。
在下文中一共展示了Recipe::loadRecipe方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getData
/**
Loads all of the recipes we are going to export into the $exportRecipes
array.
@param $id The recipe id to be exported, if set to 0 then export all recipes
*/
function getData($id)
{
global $DB_LINK, $db_table_recipes;
if ($id == 0) {
$this->exportAll = true;
// recursively call for all the recipes in the database
$sql = "SELECT recipe_id FROM {$db_table_recipes}";
$rc = $DB_LINK->Execute($sql);
DBUtils::checkResult($rc, NULL, NULL, $sql);
while (!$rc->EOF) {
$this->getData($rc->fields['recipe_id']);
$rc->MoveNext();
}
} else {
$recipeObj = new Recipe($id);
$recipeObj->loadRecipe();
$this->exportRecipes[] = $recipeObj;
}
}
示例2: isValidID
<?php
require_once "classes/Recipe.class.php";
$recipe_id = isValidID($_REQUEST['recipe_id']) ? $_REQUEST['recipe_id'] : 0;
$recipeObj = new Recipe($recipe_id);
$recipeObj->loadRecipe();
?>
<table cellspacing="0" cellpadding="1" border="0" width="100%">
<tr>
<td align="left" class="title">
<?php
echo $LangUI->_('Review Recipe');
?>
</td>
</tr>
</table>
<p>
<table cellspacing="0" cellpadding="1" border="0" width="100%">
<tr>
<td align="center" class="title">
<?php
echo $recipeObj->name;
?>
</td>
</tr>
</table>
<P>
<b><?php
echo $LangUI->_('Rating');
?>
:</b><br />
示例3: getRelated
/**
Gets the child/related recipes for this recipe
@param $req set to true then only the required recipes are returned, false all are returned
@return array of recipe objects
*/
function getRelated($req)
{
global $DB_LINK, $db_table_related_recipes;
$children = array();
$sql = "SELECT related_child,related_required FROM {$db_table_related_recipes} WHERE related_parent=" . $DB_LINK->addq($this->id, get_magic_quotes_gpc());
$rc = $DB_LINK->Execute($sql);
DBUtils::checkResult($rc, NULL, NULL, $sql);
while (!$rc->EOF) {
if ($req) {
// get all the required recipes
if ($rc->fields['related_required'] == $DB_LINK->true) {
$tmpObj = new Recipe($rc->fields['related_child']);
$tmpObj->loadRecipe();
$children[] = $tmpObj;
}
} else {
// get all the children
$tmpObj = new Recipe($rc->fields['related_child']);
$tmpObj->loadRecipe();
$children[] = $tmpObj;
}
$rc->MoveNext();
}
return $children;
}
示例4: loadItems
/**
Loads all of the ingredients and recipes saved in the database for this shopping
list into an instance of this shopping list.
@param $clear if true then the list is cleared before new items are added, if false then they are appended
*/
function loadItems($clear)
{
global $DB_LINK, $db_table_list_recipes, $db_table_list_ingredients;
if (isset($clear) && $clear) {
// clear out the items if we are told to
$this->recipes = array();
$this->ingredients = array();
}
// Add the recipes
$sql = "SELECT list_rp_recipe, list_rp_scale FROM {$db_table_list_recipes} WHERE list_rp_id=" . $DB_LINK->addq($this->id, get_magic_quotes_gpc());
$rc = $DB_LINK->Execute($sql);
DBUtils::checkResult($rc, NULL, NULL, $sql);
while (!$rc->EOF) {
$recipeObj = new Recipe($rc->fields['list_rp_recipe']);
$recipeObj->loadRecipe();
$this->addRecipe($recipeObj, $rc->fields['list_rp_scale']);
$rc->MoveNext();
}
// Add the ingredients
$sql = "SELECT list_ing_ingredient,list_ing_unit,list_ing_qualifier,list_ing_quantity FROM {$db_table_list_ingredients} WHERE list_ing_id=" . $DB_LINK->addq($this->id, get_magic_quotes_gpc()) . " ORDER BY list_ing_order";
$rc = $DB_LINK->Execute($sql);
DBUtils::checkResult($rc, NULL, NULL, $sql);
while (!$rc->EOF) {
$ingObj = new Ingredient();
$ingObj->setIngredientMap($rc->fields['list_ing_ingredient'], NULL, $rc->fields['list_ing_qualifier'], $rc->fields['list_ing_quantity'], $rc->fields['list_ing_unit']);
$ingObj->loadIngredient();
$this->addIngredient($ingObj);
$rc->MoveNext();
}
}