Exemplo n.º 1
0
 /**
 	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;
     }
 }
Exemplo n.º 2
0
<?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 />
Exemplo n.º 3
0
 /**
 	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;
 }
 /**
 	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();
     }
 }