Beispiel #1
0
    $result = $thing->SearchRecipe($srchcriteria);
    if ($result == 0) {
        $message = "Recipe does not exist";
    }
}
?>

<body>
<div style="border-style: outset; width: 450px" align="left">
<h2 style="color: red" align="center">Welcome to Recipe System</h2>
<h4 align="center"><label id=questionLabel ><? echo $message; ?></label></h4>
<?php 
ini_set("display_errors", "On");
$thing = new Thing();
$form = new FormGenerator();
$form->generate($thing);
?>
<input type="submit" name="Check" title="Check" value="Search Recipe"/>
<h4>
<a href='Add.php'>Add</a>
</h4>
<h4>
<a href='UpdateRecipe.php'>Update</a>
</h4>
<h4>
<a href='DeleteRecipe.php'>Delete</a>
</h4>
</div>
</body>
</form>
</html>
Beispiel #2
0
    function __autoload($class_name) {
        include $class_name . '.php';
    }

    if (empty($_POST["name"]) && empty($_POST["description"]) && empty($_POST["image"]) && empty($_POST["url"])) {
        echo 'Please Enter Recipe Information.';
    } else {
        $thing = new Recipe('', '', ''); //As Thing, the super parent class extends Tag. Tag construtor is invoked.
        echo $thing->RemoveThing("name", $_POST["name"]);
//echo $thing->RemoveCreativeWork();
//echo $thing->RemoveRecipe();
        echo 'Recipe Deleted Successfully.';
    }
    ?>
<body>
<div style="border-style: outset; width: 450px" align="left">
<h2 align="center" style="color: red">Delete Recipe</h2>
<h5 style="color: red">
<h5>
<?php
                    $recipe = new Recipe();
                    $form = new FormGenerator();
                    $form->generate($recipe);
                    ?>
<input type="submit" name="Check" title="Check" value="Delete Recipe" >
<h4><a href='index.php'>Home</a></h4></td>
</div>
</body>
</form>
</html>
    private static function _page_edit_post_type($post_type)
    {
        // We can't edit built-in post types
        if (!self::_is_existing_post_type($post_type, false)) {
            self::_page_display_error();
            return;
        }
        // Variables for our template (TODO: register this instead of this cheap inline trick)
        $style = '<style>' . file_get_contents(self::get_basepath() . '/css/create_or_edit_post_type_class.css') . '</style>';
        $page_header = __('Edit Content Type: ') . $post_type;
        $fields = '';
        $action_name = 'custom_content_type_mgr_edit_content_type';
        $nonce_name = 'custom_content_type_mgr_edit_content_type_nonce';
        $submit = __('Save', CCTM::txtdomain);
        $msg = '';
        // Any validation errors
        $def = self::$post_type_form_definition;
        // Save data if it was properly submitted
        if (!empty($_POST) && check_admin_referer($action_name, $nonce_name)) {
            $sanitized_vals = self::_sanitize_post_type_def($_POST);
            $error_msg = self::_post_type_name_has_errors($sanitized_vals['post_type']);
            if (empty($error_msg)) {
                self::_save_post_type_settings($sanitized_vals);
                $msg = '
					<script type="text/javascript">
						window.location.replace("?page=' . self::admin_menu_slug . '");
					</script>';
                $msg .= '<div class="updated"><p>' . sprintf(__('Settings for %s have been updated.', CCTM::txtdomain), '<em>' . $sanitized_vals['post_type'] . '</em>') . '</p></div>';
                self::_page_show_all_post_types($msg);
                // TODO: make this message persist across page refreshes
                return;
            } else {
                // This is for repopulating the form
                $def = self::_populate_form_def_from_data($def, $sanitized_vals);
                $msg = "<div class='error'>{$error_msg}</div>";
            }
        }
        // get current values from database
        $data = get_option(self::db_key, array());
        // Populate the form $def with values from the database
        $def = self::_populate_form_def_from_data($def, $data[$post_type]);
        $fields = FormGenerator::generate($def);
        include 'pages/basic_form.php';
    }
Beispiel #4
0
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://autobahn.tablesorter.com/jquery.tablesorter.js"></script>
<script type="text/javascript" src="jsscripts.js"></script>
</head>
<body>
<form  method="post" name="addRecipe" >
 <input type="hidden" id="recordId" name="recordId" value="<?php echo $_GET['id'] ?>"/>
<?php
            ini_set("display_errors", "On");
            include_once 'Recipe.php';
            include_once 'FormGenerator.php';


            $recipe = new Recipe();
            $testForm = new FormGenerator();
            $testForm->generate($recipe, "Add");

            if (empty($_POST["name"]) && empty($_POST["description"]) && empty($_POST["image"]) && empty($_POST["name"])) {
                echo 'Please Enter Recipe Information.';
            } else {
                $thing = new Recipe();
                echo $thing->saveRecipeWork();
                echo 'Recipe Saved Successfully.';
            }
            ?>
   
    
</form>
</body>
</html>
 public static function print_custom_fields($post, $callback_args = '')
 {
     //return;
     $content_type = $callback_args['args'];
     // the 7th arg from add_meta_box()
     $custom_fields = self::_get_custom_fields($content_type);
     $output = '';
     // If no custom content fields are defined...
     if (empty($custom_fields)) {
         global $post;
         $post_type = $post->post_type;
         $url = sprintf('<a href="options-general.php?page=' . CCTM::admin_menu_slug . '&' . CCTM::action_param . '=4&' . CCTM::post_type_param . '=' . $post_type . '">%s</a>', __('Settings Page', CCTM::txtdomain));
         print '<p>';
         printf(__('Custom fields can be added and configured using the %1$s %2$s', CCTM::txtdomain), CCTM::name, $url);
         print '</p>';
         return;
     }
     foreach ($custom_fields as $def_i => &$field) {
         $output_this_field = '';
         $field['label'] = $field['label'] . ' (' . $field['name'] . ')';
         // to display the name used in templates
         $field['value'] = htmlspecialchars(get_post_meta($post->ID, $field['name'], true));
         $field['name'] = self::$prefix . $field['name'];
         // this ensures unique keys in $_POST
     }
     $output = FormGenerator::generate($custom_fields);
     // Print the form
     print '<div class="form-wrap">';
     wp_nonce_field('update_custom_content_fields', 'custom_content_fields_nonce');
     print $output;
     print '</div>';
 }
Beispiel #6
0
<link REL="StyleSheet" TYPE="text/css" HREF="style.css"/>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://autobahn.tablesorter.com/jquery.tablesorter.js"></script>
<script type="text/javascript" src="jsscripts.js"></script>
</head>
<body>
<form action="UpdateRecipe.php" method="post" name="updateRecipe">
<?php
            ini_set("display_errors", "On");
            include_once 'Recipe.php';
            include_once 'FormGenerator.php';

            $recipe = new Recipe();
            $form = new FormGenerator();
 
            $form->generate($recipe, "Update");

            if (strlen($_GET['id']) > 0) {
                $dal = new DBLayer();
                $array = $dal->findone(array('_id' => new MongoId($_GET['id'])));
                                
                echo "<script>
                $(document).ready(function(){
                document.getElementById('name').value = '{$array['name']}';
                document.getElementById('description').value = '{$array['description']}';
                document.getElementById('image').value = '{$array['image']}';
                document.getElementById('about').value = '{$array['author']}';
                document.getElementById('author').value = '{$array['author']}';
                document.getElementById('url').value = '{$array['url']}';
                document.getElementById('ingredients').value = '{$array['ingredients']}';
                document.getElementById('instructions').value = '{$array['instructions']}';
Beispiel #7
0
<link REL="StyleSheet" TYPE="text/css" HREF="style.css"/>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://autobahn.tablesorter.com/jquery.tablesorter.js"></script>
<script type="text/javascript" src="jsscripts.js"></script>
</head>
<body>
<form  method="post" name="DeleteRecipe"/>
<?php
            ini_set("display_errors", "On");
            include_once 'Recipe.php';
            include_once 'FormGenerator.php';

            $recipe = new Recipe();
            $form = new FormGenerator();
           
            $form->generate($recipe, "Delete");

            if (strlen($_GET['id']) > 0) {
                $dal = new DBLayer();
                $array = $dal->findone(array('_id' => new MongoId($_GET['id'])));

                echo "<script>
                $(document).ready(function(){
                document.getElementById('name').value = '{$array['name']}';
                document.getElementById('description').value = '{$array['description']}';
                document.getElementById('image').value = '{$array['image']}';
                document.getElementById('about').value = '{$array['about']}';
                document.getElementById('author').value = '{$array['author']}';
                document.getElementById('url').value = '{$array['url']}';
                document.getElementById('ingredients').value = '{$array['ingredients']}';
                document.getElementById('instructions').value = '{$array['instructions']}';